当前位置: 首页>>代码示例>>PHP>>正文


PHP ca_lists::find方法代码示例

本文整理汇总了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;
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:60,代码来源:Installer.php

示例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 
开发者ID:ffarago,项目名称:pawtucket2,代码行数:31,代码来源:toc_html.php


注:本文中的ca_lists::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。