本文整理汇总了PHP中CMbArray::pluck方法的典型用法代码示例。如果您正苦于以下问题:PHP CMbArray::pluck方法的具体用法?PHP CMbArray::pluck怎么用?PHP CMbArray::pluck使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMbArray
的用法示例。
在下文中一共展示了CMbArray::pluck方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testPluck
public function testPluck()
{
$this->assertNull($this->stub->pluck(null, ""));
$array = array("key" => array("key2" => "val", "key3" => array("key4" => "val")));
$this->assertEquals(array("key" => "val"), $this->stub->pluck($array, "key2"));
$array = array('key' => (object) array("property" => 1), 'key2' => (object) array("property" => 2));
$this->assertEquals(array("key" => 1, "key2" => 2), $this->stub->pluck($array, "property"));
}
示例2: deleteContentAndUpdateExchange
/**
* Delete content and update exchange
*
* @param CContentTabular $content_tabular Content tabular
* @param int $type_content_id Content ID
* @param date $date_max Date max
* @param int $max Max exchange
*
* @return int
*/
function deleteContentAndUpdateExchange(CContentTabular $content_tabular, $type_content_id, $date_max, $max)
{
$ds = $content_tabular->_spec->ds;
// Récupère les content Tabulé
$query = "SELECT cx.content_id\r\n FROM content_tabular AS cx, exchange_hl7v2 AS ec\r\n WHERE ec.`date_production` < '{$date_max}'\r\n AND ec.{$type_content_id} = cx.content_id\r\n LIMIT {$max};";
$ids = CMbArray::pluck($ds->loadList($query), "content_id");
// Suppression du contenu Tabulé
$query = "DELETE FROM content_tabular\r\n WHERE content_id " . CSQLDataSource::prepareIn($ids);
$ds->exec($query);
// Mise à jour des échanges
$query = "UPDATE exchange_hl7v2\r\n SET `{$type_content_id}` = NULL \r\n WHERE `{$type_content_id}` " . CSQLDataSource::prepareIn($ids);
$ds->exec($query);
$count = $ds->affectedRows();
return $count;
}
示例3: loadAllSalutations
/**
* Load all salutation from a given class
*
* @param string $object_class Target object class
* @param integer|null $object_id Target object ID
* @param int $perm Permission needed on owners
* @param integer|null $owner_id Specific owner ID
*
* @return CSalutation[]
*/
static function loadAllSalutations($object_class, $object_id = null, $perm = PERM_EDIT, $owner_id = null)
{
if (!$owner_id) {
$users = new CMediusers();
$users = $users->loadListWithPerms($perm, array('actif' => "= '1'"));
$user_ids = $users ? CMbArray::pluck($users, '_id') : array(CMediusers::get()->_id);
unset($users);
} else {
$user_ids = array($owner_id);
}
/** @var CSalutation $salutation */
$salutation = new self();
$ds = $salutation->_spec->ds;
$where = array('owner_id' => $ds->prepareIn($user_ids), 'object_class' => $ds->prepare('= ?', $object_class));
if ($object_id) {
$where['object_id'] = $ds->prepare('= ?', $object_id);
}
return $salutation->loadList($where);
}
示例4: doStore
function doStore()
{
parent::doStore();
if (CModule::getActive("dPprescription") && !$this->_old->_id) {
$p_to_c = new CPrescriptionProtocoleToConcept();
$count_p_to_c = $p_to_c->countList();
if ($count_p_to_c > 0) {
/** @var CExObject $ex_object */
$ex_object = $this->_obj;
$all_fields = $ex_object->loadRefExClass()->loadRefsAllFields();
$bool_concept_ids = array();
foreach ($all_fields as $_field) {
if (strpos($_field->prop, "bool") === 0 && $_field->concept_id && $ex_object->{$_field->name} == "1") {
$bool_concept_ids[] = $_field->concept_id;
}
}
$bool_concept_ids = array_unique($bool_concept_ids);
$where = array("concept_id" => $p_to_c->getDS()->prepareIn($bool_concept_ids));
$protocole_ids = array_values(CMbArray::pluck($p_to_c->loadList($where), "protocole_id"));
if (count($protocole_ids)) {
/** @var CSejour $sejour */
$sejour = $ex_object->getReferenceObject("CSejour");
if ($sejour && $sejour->_id) {
$prescription = $sejour->loadRefPrescriptionSejour();
if (!$prescription->_id) {
$prescription = new CPrescription();
$prescription->object_id = $sejour->_id;
$prescription->object_class = $sejour->_class;
$prescription->type = "sejour";
if ($msg = $prescription->store()) {
CAppUI::setMsg($msg, UI_MSG_WARNING);
}
}
$ops_ids = implode("-", CMbArray::pluck($sejour->loadRefsOperations(array("annulee" => "= '0'")), "operation_id"));
CAppUI::callbackAjax("window.opener.ExObject.checkOpsBeforeProtocole", $protocole_ids, $prescription->_id, $sejour->_id, $ops_ids);
}
}
}
}
}
示例5: foreach
CMbObject::massCountBackRefs($_plage->_ref_operations, 'actes_ccam');
$sejours = CMbObject::massLoadFwdRef($_plage->_ref_operations, "sejour_id");
CMbObject::massLoadFwdRef($sejours, "patient_id");
foreach ($_plage->_ref_operations as $_op) {
$_op->loadRefsFwd();
$_sejour = $_op->_ref_sejour;
$_op->countDocItems();
$_op->canDo();
$_op->loadRefCommande();
$_sejour->canDo();
$_sejour->loadRefsFwd();
$_sejour->_ref_patient->loadRefDossierMedical()->countAllergies();
$_sejour->countDocItems();
/* Comptage du nombre d'activités CCAM */
$_op->_count['codes_ccam'] = 0;
foreach (CMbArray::pluck($_op->_ext_codes_ccam, "activites") as $_code) {
$_op->_count['codes_ccam'] += count($_code);
}
$presc = $_sejour->loadRefPrescriptionSejour();
if ($presc && $presc->_id) {
$presc->countLinesMedsElements($userSel->_id);
}
foreach ($_sejour->_ref_documents as $_doc) {
$_doc->canDo();
}
}
}
}
// Praticien concerné
$user = CMediusers::get();
if ($user->isPraticien()) {
示例6: foreach
foreach ($no_extid as $_object) {
$_object->_disabled = true;
}
$_selected = reset($extid);
}
}
}
// Selected object IS selected (!)
$_selected->_selected = true;
// Check merge
/** @var CMbObject $result */
$result = new $objects_class();
$checkMerge = $result->checkMerge($objects);
// Merge trivial fields
foreach (array_keys($result->getPlainFields()) as $field) {
$values = CMbArray::pluck($objects, $field);
CMbArray::removeValue("", $values);
// No values
if (!count($values)) {
$statuses[$field] = "none";
continue;
}
$result->{$field} = reset($values);
// One unique value
if (count($values) == 1) {
$statuses[$field] = "unique";
continue;
}
// Multiple values
$statuses[$field] = count(array_unique($values)) == 1 ? "duplicate" : "multiple";
}
示例7: loadTriggeredData
/**
* Load trigger data
*
* @return void
*/
function loadTriggeredData()
{
$triggers = $this->loadBackRefs("ex_triggers");
$this->_triggered_data = array();
if (!count($triggers)) {
return;
}
$keys = CMbArray::pluck($triggers, "trigger_value");
$values = CMbArray::pluck($triggers, "ex_class_triggered_id");
$this->_triggered_data = array_combine($keys, $values);
}
示例8: getCategoriesTree
/**
* Get categories tree
*
* @param bool $operation see operations
*
* @return array
*/
static function getCategoriesTree($operation = false)
{
$object = new self();
$target_classes = CDailyCheckList::getNonHASClasses($operation);
$targets = array();
$by_class = array();
foreach ($target_classes as $_class) {
if ($_class != "COperation") {
/** @var CSalle|CBlocOperatoire $_object */
$_object = new $_class();
//$_targets = $_object->loadGroupList();
$_targets = $_object->loadList();
array_unshift($_targets, $_object);
$targets[$_class] = array_combine(CMbArray::pluck($_targets, "_id"), $_targets);
}
$where = array("target_class" => "= '{$_class}'");
if ($_class == "COperation") {
$where["list_type_id"] = ' IS NOT NULL';
}
/** @var CDailyCheckItemCategory[] $_list */
$_list = $object->loadList($where, "target_id+0, title");
// target_id+0 to have NULL at the beginning
$by_object = array();
foreach ($_list as $_category) {
$_key = $_category->target_id ? $_category->target_id : "all";
$by_object[$_key][$_category->_id] = $_category;
}
$by_class[$_class] = $by_object;
}
return array($targets, $by_class);
}
示例9: switch
if (null == ($object_class = CValue::get("object_class"))) {
CAppUI::stepMessage(UI_MSG_WARNING, "{$tab}-msg-mode-missing");
return;
}
$unlock_dossier = CValue::get("unlock_dossier", 0);
$NDA = "";
$IPP = "";
switch ($object_class) {
case "COperation":
$object = new COperation();
// Chargement de l'opération et génération du document
$operation_id = CValue::post("mb_operation_id", CValue::getOrSession("object_id"));
if ($object->load($operation_id)) {
$object->loadRefs();
$codes = explode("|", $object->codes_ccam);
$actes = CMbArray::pluck($object->_ref_actes_ccam, "code_acte");
foreach ($object->_ref_actes_ccam as $acte_ccam) {
$acte_ccam->loadRefsFwd();
}
// Suppression des actes non codés
if (CAppUI::conf("dPsalleOp CActeCCAM del_actes_non_cotes")) {
foreach ($codes as $_key => $_code) {
$key = array_search($_code, $actes);
if ($key === false) {
unset($codes[$_key]);
}
}
}
$object->_codes_ccam = $codes;
$mbSejour =& $object->_ref_sejour;
$mbSejour->loadRefsFwd();
示例10: CSejour
$where["sejour.praticien_id"] = "= '{$chirSel}'";
}
$where["sejour.entree"] = "<= '{$date} 23:59:59'";
$where["sejour.sortie"] = ">= '{$date} 00:00:00'";
$where["sejour.annule"] = "= '0'";
$where["sejour.group_id"] = "= '" . CGroups::loadCurrent()->_id . "'";
$sejour = new CSejour();
/** @var CSejour[] $listSejours */
$listSejours = $sejour->loadList($where, null, null, null, $ljoin);
CStoredObject::massLoadFwdRef($listSejours, "patient_id");
foreach ($listSejours as $_sejour) {
$_sejour->loadRefPraticien();
$_sejour->loadRefPatient();
$_sejour->loadRefsOperations();
$_sejour->loadRefCurrAffectation("{$date} " . CMbDT::time());
$_sejour->_ref_curr_affectation->loadRefLit();
$_sejour->_ref_curr_affectation->_ref_lit->loadCompleteView();
}
$lits = CMbArray::pluck($listSejours, "_ref_curr_affectation", "_ref_lit");
$sorter_chambre = CMbArray::pluck($lits, "_ref_chambre", "_view");
$sorter_service = CMbArray::pluck($lits, "_ref_chambre", "_ref_service", "_view");
$sorter_lit = CMbArray::pluck($lits, "_view");
$sorter_sejour_sortie = CMbArray::pluck($listSejours, "sortie");
$sorter_sejour_entree = CMbArray::pluck($listSejours, "entree");
array_multisort($sorter_service, SORT_ASC, $sorter_chambre, SORT_ASC, $sorter_lit, SORT_ASC, $sorter_sejour_sortie, SORT_ASC, $sorter_sejour_entree, SORT_DESC, $listSejours);
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("date", $date);
$smarty->assign("praticien", $praticien);
$smarty->assign("listSejours", $listSejours);
$smarty->display("inc_vw_hospi.tpl");
示例11: COUNT
$smarty->assign("date", $date);
$smarty->assign("listPrat", $listPrat);
$smarty->assign("listInterv", $listInterv);
$smarty->assign("services", $services);
$smarty->assign("selPrat", $selPrat);
$smarty->assign("canceled", $canceled);
$smarty->assign("sans_anesth", $sans_anesth);
$smarty->assign("count_ops", $count_ops);
$smarty->display("vw_idx_visite_anesth.tpl");
} else {
// Selection des plages du praticien et de celles de sa spécialité
$praticien_id = null;
$function_ids = null;
if ($selPraticien->isPraticien()) {
$praticien_id = $selPraticien->user_id;
$function_ids = CMbArray::pluck($selPraticien->loadBackRefs("secondary_functions"), "function_id");
$function_ids[] = $selPraticien->function_id;
}
// Planning du mois
$month_min = CMbDT::format($date, "%Y-%m-01");
$month_max = CMbDT::format($date, "%Y-%m-31");
$sql = "SELECT plagesop.*, plagesop.date AS opdate,\r\n SEC_TO_TIME(SUM(TIME_TO_SEC(operations.temp_operation))) AS duree,\r\n COUNT(operations.operation_id) AS total,\r\n SUM(operations.rank_voulu > 0) AS planned_by_chir,\r\n COUNT(IF(operations.rank > 0, NULLIF(operations.rank, operations.rank_voulu), NULL)) AS order_validated,\r\n functions_mediboard.text AS nom_function, functions_mediboard.color as color_function\r\n FROM plagesop\r\n LEFT JOIN operations\r\n ON plagesop.plageop_id = operations.plageop_id\r\n AND operations.annulee = '0'\r\n AND operations.chir_id = '{$praticien_id}'\r\n LEFT JOIN functions_mediboard\r\n ON functions_mediboard.function_id = plagesop.spec_id\r\n WHERE (plagesop.chir_id = '{$praticien_id}' OR plagesop.spec_id " . CSQLDataSource::prepareIn($function_ids) . ")\r\n AND plagesop.date BETWEEN '{$month_min}' AND '{$month_max}'\r\n GROUP BY plagesop.plageop_id\r\n ORDER BY plagesop.date, plagesop.debut, plagesop.plageop_id";
$listPlages = array();
if ($praticien_id) {
$listPlages = $ds->loadList($sql);
}
// Urgences du mois
$sql = "SELECT operations.*, operations.date AS opdate,\r\n SEC_TO_TIME(SUM(TIME_TO_SEC(operations.temp_operation))) AS duree,\r\n COUNT(operations.operation_id) AS total\r\n FROM operations\r\n WHERE operations.annulee = '0'\r\n AND operations.chir_id = '{$praticien_id}'\r\n AND operations.plageop_id IS NULL\r\n AND operations.date BETWEEN '{$month_min}' AND '{$month_max}'\r\n GROUP BY operations.date\r\n ORDER BY operations.date";
$listUrgences = array();
if ($praticien_id) {
$listUrgences = $ds->loadList($sql);
示例12: lists
public function lists($column, $key = null)
{
$columns = is_null($key) ? array($column) : array($column, $key);
// First we will just get all of the column values for the record result set
// then we can associate those values with the column if it was specified
// otherwise we can just give these values back without a specific key.
$results = $this->get($columns);
$values = CMbArray::pluck($results, $column);
// If a key was specified and we have results, we will go ahead and combine
// the values with the keys of all of the records so that the values can
// be accessed by the key of the rows instead of simply being numeric.
if (!is_null($key) and count($results) > 0) {
return array_combine(CMbArray::pluck($results, $key), $values);
}
return $values;
}
示例13: flatMimeDecode
/**
* used for decoding a multi mime string into one line
*
* @param string $string decode mime string
*
* @return string
*/
private function flatMimeDecode($string)
{
$parts = imap_mime_header_decode($string);
$str = implode("", CMbArray::pluck($parts, "text"));
if (strpos($string, 'UTF-8') !== false) {
$str = utf8_decode($str);
}
return addslashes($str);
}
示例14: array
if ($mode == "count" || $mode == "plannable") {
if (!CModule::getActive("dPprescription")) {
$counts["plannable"] = null;
$sejours = array();
} else {
// Séjours élligibles
$where = array();
$where["sejour.type"] = "= 'ssr'";
$where["sejour.entree"] = "<= '{$planning->date_max}'";
$where["sejour.sortie"] = ">= '{$planning->date_min}'";
$where["sejour.annule"] = "= '0'";
$sejour_ids = $sejour->loadIds($where);
// Identifiants de catégorie de prescriptions disponibles
$function = $mediuser->loadRefFunction();
$executants = $function->loadBackRefs("executants_prescription");
$category_ids = CMbArray::pluck($executants, "category_prescription_id");
// Recherche des lignes de prescriptions executables
$line = new CPrescriptionLineElement();
$join = array();
$where = array();
$join["element_prescription"] = "element_prescription.element_prescription_id = prescription_line_element.element_prescription_id";
$where["element_prescription.category_prescription_id"] = $ds->prepareIn($category_ids);
$join["prescription"] = "prescription.prescription_id = prescription_line_element.prescription_id";
$where["prescription.type"] = "= 'sejour'";
$where["prescription.object_class"] = "= 'CSejour'";
$where["prescription.object_id"] = $ds->prepareIn($sejour_ids);
$line_ids = $line->loadIds($where, null, null, null, $join);
// Prescriptions exécutables
$query = new CRequest();
$query->addSelect("DISTINCT prescription_id");
$query->addTable("prescription_line_element");
示例15: getNewMarkedClause
/**
* Get a marked where clause
*
* @return string SQL where clause
*/
function getNewMarkedClause($marked, $max = 100)
{
$mark = new CTriggerMark();
$mark->trigger_class = get_class($this);
if ($marked) {
$where["trigger_class"] = "= '{$mark->trigger_class}'";
$where["done"] = "= '0'";
$where["mark"] = "!= '========'";
$marks = $mark->loadList($where, null, $max);
$clause = "\n WHERE {$this->trigger_key_field} " . CSQLDataSource::prepareIn(CMbArray::pluck($marks, "trigger_number"));
} else {
$mark->loadMatchingObject("trigger_number DESC");
$last_number = $mark->trigger_number ? $mark->trigger_number : 0;
$clause = "\n WHERE {$this->trigger_key_field} > '{$last_number}'";
}
return $clause;
}