本文整理汇总了PHP中ca_lists::find方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_lists::find方法的具体用法?PHP ca_lists::find怎么用?PHP ca_lists::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca_lists
的用法示例。
在下文中一共展示了ca_lists::find方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processLists
public function processLists($f_callback = null)
{
require_once __CA_MODELS_DIR__ . "/ca_lists.php";
require_once __CA_MODELS_DIR__ . "/ca_list_items.php";
if ($this->ops_base_name) {
// "merge" profile and its base
$va_lists = array();
foreach ($this->opo_base->lists->children() as $vo_list) {
$va_lists[self::getAttribute($vo_list, "code")] = $vo_list;
}
foreach ($this->opo_profile->lists->children() as $vo_list) {
$va_lists[self::getAttribute($vo_list, "code")] = $vo_list;
}
} else {
$va_lists = $this->opo_profile->lists->children();
}
$vn_i = 0;
$vn_num_lists = sizeof($va_lists);
foreach ($va_lists as $vo_list) {
$vs_list_code = self::getAttribute($vo_list, "code");
$t_list = $this->opb_updating ? ca_lists::find(array('list_code' => $vs_list_code), array('returnAs' => 'firstModelInstance')) : $this->opb_updating;
// if it doesn't exist create a new one
$t_list = $t_list ? $t_list : new ca_lists();
$t_list->setMode(ACCESS_WRITE);
$vb_hierarchical = self::getAttribute($vo_list, "hierarchical");
$vb_system = self::getAttribute($vo_list, "system");
$vb_voc = self::getAttribute($vo_list, "vocabulary");
$vn_def_sort = self::getAttribute($vo_list, "defaultSort");
if (is_callable($f_callback)) {
$vn_i++;
$f_callback($vs_list_code, $vn_i, $vn_num_lists);
}
$t_list->set("list_code", $vs_list_code);
$t_list->set("is_system_list", intval($vb_system));
$t_list->set("is_hierarchical", $vb_hierarchical);
$t_list->set("use_as_vocabulary", $vb_voc);
if ($vn_def_sort) {
$t_list->set("default_sort", (int) $vn_def_sort);
}
if ($t_list->getPrimaryKey()) {
$t_list->update();
} else {
$t_list->insert();
}
if ($t_list->numErrors()) {
$this->addError("There was an error while inserting list {$vs_list_code}: " . join(" ", $t_list->getErrors()));
} else {
self::addLabelsFromXMLElement($t_list, $vo_list->labels, $this->opa_locales);
if ($t_list->numErrors()) {
$this->addError("There was an error while inserting list label for {$vs_list_code}: " . join(" ", $t_list->getErrors()));
}
if ($vo_list->items) {
if (!$this->processListItems($t_list, $vo_list->items, null)) {
return false;
}
}
}
}
return true;
}
示例2: array
<?php
$vs_list_code = $this->getVar("list_code");
$va_list_items = array();
if ($vs_list_code) {
$t_list = ca_lists::find(array('list_code' => $vs_list_code), array('returnAs' => 'firstmodelinstance'));
if ($t_list) {
$va_list_items = $t_list->getItemsForList($vs_list_code, array('directChildrenOnly' => true, 'extractValuesByUserLocale' => true, 'enabledOnly' => true, 'sort' => __CA_LISTS_SORT_BY_RANK__));
$vn_selected_top_level_item_id = array_shift(array_keys($va_list_items));
}
}
?>
<div class="container subhomebody">
<div class="row">
<div class="col-sm-3 mainmenu">
<!--main menu will go here-->
<ol id="tocMenu">
<?php
foreach ($va_list_items as $vn_i => $va_item) {
if ($vn_i == $vn_selected_top_level_item_id) {
$vs_selected = "class='selected'";
} else {
$vs_selected = '';
}
print "<li {$vs_selected} id='item_{$va_item['item_id']}'><a href='#' onclick='return caFrontLoadSubList({$vn_i});'>" . $va_item['name_plural'] . "</a></li>\n";
}
$va_selected_item = $va_list_items[$vn_selected_top_level_item_id];
?>
</ol>
</div><!-- end col -->
<div class="col-sm-9"> <h1 id="tocTopTitle"><?php