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


PHP ca_list_items::load方法代码示例

本文整理汇总了PHP中ca_list_items::load方法的典型用法代码示例。如果您正苦于以下问题:PHP ca_list_items::load方法的具体用法?PHP ca_list_items::load怎么用?PHP ca_list_items::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ca_list_items的用法示例。


在下文中一共展示了ca_list_items::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: browseName

 /**
  * Returns string representing the name of the item the browse will return
  *
  * If $ps_mode is 'singular' [default] then the singular version of the name is returned, otherwise the plural is returned
  */
 public function browseName($ps_mode = 'singular')
 {
     $vb_type_restriction_has_changed = false;
     $vn_type_id = $this->opo_result_context->getTypeRestriction($vb_type_restriction_has_changed);
     $t_list = new ca_lists();
     $t_list->load(array('list_code' => 'occurrence_types'));
     $t_list_item = new ca_list_items();
     $t_list_item->load(array('list_id' => $t_list->getPrimaryKey(), 'parent_id' => null));
     $va_hier = caExtractValuesByUserLocale($t_list_item->getHierarchyWithLabels());
     if (!($vs_name = $ps_mode == 'singular' ? $va_hier[$vn_type_id]['name_singular'] : $va_hier[$vn_type_id]['name_plural'])) {
         $vs_name = '???';
     }
     return $vs_name;
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:19,代码来源:BrowseOccurrencesController.php

示例2: info

 public function info($pa_parameters)
 {
     parent::info($pa_parameters);
     $t_list = $this->view->getVar('t_item');
     if ($t_list->getPrimaryKey()) {
         $va_labels = $t_list->getDisplayLabels();
         $this->view->setVar('labels', $t_list->getPrimaryKey() ? $va_labels : array());
         $this->view->setVar('idno', $t_list->get('idno'));
     }
     $t_list_item = new ca_list_items();
     $t_list_item->load(array('list_id' => $t_list->getPrimaryKey(), 'parent_id' => null));
     $this->view->setVar('t_list_item', $t_list_item);
     if ($vn_item_id = $t_list_item->getPrimaryKey()) {
         $va_children = caExtractValuesByUserLocaleFromHierarchyChildList($t_list_item->getHierarchyChildren(null, array('additionalTableToJoin' => 'ca_list_item_labels', 'additionalTableJoinType' => 'LEFT', 'additionalTableSelectFields' => array('name_plural', 'locale_id'), 'additionalTableWheres' => array('(ca_list_item_labels.is_preferred = 1 OR ca_list_item_labels.is_preferred IS NULL)'))), 'item_id', 'name_plural', 'item_value');
         $this->view->setVar('children', $va_children);
     }
     return $this->render('widget_list_info_html.php', true);
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:18,代码来源:ListEditorController.php

示例3: array

if (sizeof($va_access_values) == 0 || sizeof($va_access_values) && in_array($t_featured_member->get("access"), $va_access_values)) {
    $vn_featured_member_set_id = $t_featured_member->get("set_id");
    $va_featured_member_ids = array_keys(is_array($va_tmp = $t_featured_member->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 1))) ? $va_tmp : array());
    // These are the entity ids in the set
}
$t_entity = new ca_entities($va_featured_member_ids[0]);
$vn_featured_member_id = $va_featured_member_ids[0];
$vs_featured_member_image = $t_entity->get("mem_inst_image", array("version" => "frontpage", "return" => "tag"));
$vs_featured_member_name = $t_entity->getLabelForDisplay();
# --- canned browses
$va_browse_codes = $this->request->config->get('hp_category_browse_codes');
$t_list_item = new ca_list_items();
$va_browses = array();
if (is_array($va_browse_codes) && sizeof($va_browse_codes)) {
    foreach ($va_browse_codes as $vs_item_code) {
        $t_list_item->load(array('idno' => $vs_item_code));
        $va_browses[$t_list_item->get("item_id")] = array("idno" => $vs_item_code, "name" => $t_list_item->getLabelForDisplay());
    }
}
if ($this->getVar("featured_set_id")) {
    $t_featured_set = new ca_sets($this->getVar("featured_set_id"));
    ?>
		<div id="contentcontainer">
			<div id="objectcontainerHP">
				<div class="homeIntro">Navigate through some of the collections of Nova Scotia's community museums to learn about the province's past, and share your own stories and information about what is important to you.</div><!-- end home intro -->
				<div id="objectslidesContainerHP">
<?php 
    # --- featured objects
    foreach ($va_item_media as $vn_object_id => $va_media) {
        if ($va_media['urls']['frontpage']) {
            $vs_image_tag = $va_media["tags"]["frontpage"];
开发者ID:guaykuru,项目名称:pawtucket,代码行数:31,代码来源:splash_html.php

示例4: caGetListItemIdno

function caGetListItemIdno($pn_item_id, $pa_options = null)
{
    global $g_list_item_idno_cache;
    if (isset($g_list_item_idno_cache[$pn_item_id])) {
        return $g_list_item_idno_cache[$pn_item_id];
    }
    $t_item = new ca_list_items();
    if ($o_trans = caGetOption('transaction', $pa_options, null)) {
        $t_item->setTransaction($o_trans);
    }
    $t_item->load($pn_item_id);
    return $g_list_item_idno_cache[$pn_item_id] = $t_item->get('idno');
}
开发者ID:kai-iak,项目名称:pawtucket2,代码行数:13,代码来源:listHelpers.php

示例5: processDisplays

 public function processDisplays()
 {
     require_once __CA_MODELS_DIR__ . "/ca_bundle_displays.php";
     require_once __CA_MODELS_DIR__ . "/ca_bundle_display_placements.php";
     require_once __CA_MODELS_DIR__ . "/ca_bundle_display_type_restrictions.php";
     $o_config = Configuration::load();
     $vo_dm = Datamodel::load();
     if ($this->ops_base_name) {
         // "merge" profile and its base
         $va_displays = array();
         if ($this->opo_base->displays) {
             foreach ($this->opo_base->displays->children() as $vo_display) {
                 $va_displays[self::getAttribute($vo_display, "code")] = $vo_display;
             }
         }
         if ($this->opo_profile->displays) {
             foreach ($this->opo_profile->displays->children() as $vo_display) {
                 $va_displays[self::getAttribute($vo_display, "code")] = $vo_display;
             }
         }
     } else {
         if ($this->opo_profile->displays) {
             foreach ($this->opo_profile->displays->children() as $vo_display) {
                 $va_displays[self::getAttribute($vo_display, "code")] = $vo_display;
             }
         }
     }
     if (!is_array($va_displays) || sizeof($va_displays) == 0) {
         return true;
     }
     foreach ($va_displays as $vo_display) {
         $vs_display_code = self::getAttribute($vo_display, "code");
         $vb_system = self::getAttribute($vo_display, "system");
         $vs_table = self::getAttribute($vo_display, "type");
         if ($o_config->get($vs_table . '_disable')) {
             continue;
         }
         $t_display = $this->opb_updating ? ca_bundle_displays::find(array('code' => $vs_display_code, 'type' => $vs_table), array('returnAs' => 'firstModelInstance')) : false;
         $t_display = $t_display ? $t_display : new ca_bundle_displays();
         $t_display->setMode(ACCESS_WRITE);
         $t_display->set("display_code", $vs_display_code);
         $t_display->set("is_system", $vb_system);
         $t_display->set("table_num", $vo_dm->getTableNum($vs_table));
         $t_display->set("user_id", 1);
         // let administrative user own these
         $this->_processSettings($t_display, $vo_display->settings);
         if ($t_display->getPrimaryKey()) {
             $t_display->update();
         } else {
             $t_display->insert();
         }
         if ($t_display->numErrors()) {
             $this->addError("There was an error while inserting display {$vs_display_code}: " . join(" ", $t_display->getErrors()));
         } else {
             self::addLabelsFromXMLElement($t_display, $vo_display->labels, $this->opa_locales);
             if ($t_display->numErrors()) {
                 $this->addError("There was an error while inserting display label for {$vs_display_code}: " . join(" ", $t_display->getErrors()));
             }
             if (!$this->processDisplayPlacements($t_display, $vo_display->bundlePlacements, null)) {
                 return false;
             }
         }
         if ($vo_display->typeRestrictions) {
             foreach ($vo_display->typeRestrictions->children() as $vo_restriction) {
                 $t_list = new ca_lists();
                 $t_list_item = new ca_list_items();
                 $vs_restriction_code = trim((string) self::getAttribute($vo_restriction, "code"));
                 $vs_type = trim((string) self::getAttribute($vo_restriction, "type"));
                 $t_instance = $vo_dm->getInstanceByTableNum($vn_table_num = $vo_dm->getTableNum($vs_table));
                 $vs_type_list_name = $t_instance->getFieldListCode($t_instance->getTypeFieldName());
                 if ($vs_type) {
                     $t_list->load(array('list_code' => $vs_type_list_name));
                     $t_list_item->load(array('list_id' => $t_list->getPrimaryKey(), 'idno' => $vs_type));
                 }
                 $vn_type_id = $vs_type ? $t_list_item->getPrimaryKey() : null;
                 $t_restriction = $this->opb_updating ? ca_bundle_display_type_restrictions::find(array('table_num' => $vn_table_num, 'type_id' => $vn_type_id), array('returnAs' => 'firstModelInstance')) : false;
                 $t_restriction = $t_restriction ? $t_restriction : new ca_bundle_display_type_restrictions();
                 $t_restriction->setMode(ACCESS_WRITE);
                 $t_restriction->set('table_num', $vn_table_num);
                 $t_restriction->set('include_subtypes', (bool) $vo_restriction->includeSubtypes ? 1 : 0);
                 $t_restriction->set('type_id', $vn_type_id);
                 $t_restriction->set('display_id', $t_display->getPrimaryKey());
                 $this->_processSettings($t_restriction, $vo_restriction->settings);
                 if ($t_restriction->getPrimaryKey()) {
                     $t_restriction->update();
                 } else {
                     $t_restriction->insert();
                 }
                 if ($t_restriction->numErrors()) {
                     $this->addError("There was an error while inserting type restriction {$vs_restriction_code} in display {$vs_display_code}: " . join("; ", $t_restriction->getErrors()));
                 }
             }
         }
         if ($vo_display->userAccess) {
             $t_user = new ca_users();
             $va_display_users = array();
             foreach ($vo_display->userAccess->children() as $vo_permission) {
                 $vs_user = trim((string) self::getAttribute($vo_permission, "user"));
                 $vn_access = $this->_convertUserGroupAccessStringToInt(self::getAttribute($vo_permission, 'access'));
                 if ($vn_access && $t_user->load(array('user_name' => $vs_user))) {
//.........这里部分代码省略.........
开发者ID:idiscussforum,项目名称:providence,代码行数:101,代码来源:Installer.php

示例6: caLightboxSetListItem

function caLightboxSetListItem($po_request, $t_set, $va_check_access = array(), $pa_options = array())
{
    if (!$t_set->get("set_id")) {
        return false;
    }
    $vb_write_access = false;
    if ($pa_options["write_access"]) {
        $vb_write_access = true;
    }
    $va_set_items = caExtractValuesByUserLocale($t_set->getItems(array("user_id" => $po_request->user->get("user_id"), "thumbnailVersions" => array("iconlarge", "icon"), "checkAccess" => $va_check_access, "limit" => 5)));
    $vs_set_display = "";
    $vs_set_display .= "<div class='lbSetContainer'><div class='lbSet " . ($vb_write_access ? "" : "readSet") . "'><div class='lbSetContent'>\n";
    if (!$vb_write_access) {
        $vs_set_display .= "<div class='pull-right caption'>Read Only</div>";
    }
    $vs_set_display .= "<H5>" . caNavLink($po_request, $t_set->getLabelForDisplay(), "", "", "Sets", "setDetail", array("set_id" => $t_set->get("set_id"))) . "</H5>";
    $va_lightbox_display_name = caGetSetDisplayName();
    $vs_lightbox_display_name = $va_lightbox_display_name["singular"];
    $vs_lightbox_display_name_plural = $va_lightbox_display_name["plural"];
    if (sizeof($va_set_items)) {
        $vs_primary_image_block = "";
        $vs_secondary_image_block = "";
        $vn_i = 1;
        $t_list_items = new ca_list_items();
        foreach ($va_set_items as $va_set_item) {
            $t_list_items->load($va_set_item["type_id"]);
            $vs_placeholder = getPlaceholder($t_list_items->get("idno"), "placeholder_media_icon");
            if ($vn_i == 1) {
                # --- is the iconlarge version available?
                $vs_large_icon = "icon";
                if ($va_set_item["representation_url_iconlarge"]) {
                    $vs_large_icon = "iconlarge";
                }
                if ($va_set_item["representation_tag_" . $vs_large_icon]) {
                    $vs_primary_image_block .= "<div class='col-sm-6'><div class='lbSetImg'>" . caNavLink($po_request, $va_set_item["representation_tag_" . $vs_large_icon], "", "", "Sets", "setDetail", array("set_id" => $t_set->get("set_id"))) . "</div><!-- end lbSetImg --></div>\n";
                } else {
                    $vs_primary_image_block .= "<div class='col-sm-6'><div class='lbSetImg'>" . caNavLink($po_request, "<div class='lbSetImgPlaceholder'>" . $vs_placeholder . "</div><!-- end lbSetImgPlaceholder -->", "", "", "Sets", "setDetail", array("set_id" => $t_set->get("set_id"))) . "</div><!-- end lbSetImg --></div>\n";
                }
            } else {
                if ($va_set_item["representation_tag_icon"]) {
                    $vs_secondary_image_block .= "<div class='col-xs-3 col-sm-6 lbSetThumbCols'><div class='lbSetThumb'>" . caNavLink($po_request, $va_set_item["representation_tag_icon"], "", "", "Sets", "setDetail", array("set_id" => $t_set->get("set_id"))) . "</div><!-- end lbSetThumb --></div>\n";
                } else {
                    $vs_secondary_image_block .= "<div class='col-xs-3 col-sm-6 lbSetThumbCols'>" . caNavLink($po_request, "<div class='lbSetThumbPlaceholder'>" . caGetThemeGraphic($po_request, 'spacer.png') . $vs_placeholder . "</div><!-- end lbSetThumbPlaceholder -->", "", "", "Sets", "setDetail", array("set_id" => $t_set->get("set_id"))) . "</div>\n";
                }
            }
            $vn_i++;
        }
        while ($vn_i < 6) {
            $vs_secondary_image_block .= "<div class='col-xs-3 col-sm-6 lbSetThumbCols'>" . caNavLink($po_request, "<div class='lbSetThumbPlaceholder'>" . caGetThemeGraphic($po_request, 'spacer.png') . "</div><!-- end lbSetThumbPlaceholder -->", "", "", "Sets", "setDetail", array("set_id" => $t_set->get("set_id"))) . "</div>";
            $vn_i++;
        }
    } else {
        $vs_primary_image_block .= "<div class='col-sm-6'><div class='lbSetImg'><div class='lbSetImgPlaceholder'>" . _t("this %1 contains no items", $vs_lightbox_display_name) . "</div><!-- end lbSetImgPlaceholder --></div><!-- end lbSetImg --></div>\n";
        $i = 1;
        while ($vn_i < 4) {
            $vs_secondary_image_block .= "<div class='col-xs-3 col-sm-6 lbSetThumbCols'><div class='lbSetThumbPlaceholder'>" . caGetThemeGraphic($po_request, 'spacer.png') . "</div><!-- end lbSetThumbPlaceholder --></div>";
            $vn_i++;
        }
    }
    $vs_set_display .= "<div class='row'>" . $vs_primary_image_block . "<div class='col-sm-6'><div id='comment" . $t_set->get("set_id") . "' class='lbSetComment'><!-- load comments here --></div>\n<div class='lbSetThumbRowContainer'><div class='row lbSetThumbRow' id='lbSetThumbRow" . $t_set->get("set_id") . "'>" . $vs_secondary_image_block . "</div><!-- end row --></div><!-- end lbSetThumbRowContainer --></div><!-- end col --></div><!-- end row -->";
    $vs_set_display .= "</div><!-- end lbSetContent -->\n";
    $vs_set_display .= "<div class='lbSetExpandedInfo' id='lbExpandedInfo" . $t_set->get("set_id") . "'>\n<hr><div>created by: " . trim($t_set->get("ca_users.fname") . " " . $t_set->get("ca_users.lname")) . "</div>\n";
    $vs_set_display .= "<div>Num items: " . $t_set->getItemCount(array("user_id" => $po_request->user->get("user_id"), "checkAccess" => $va_check_access)) . "</div>\n";
    if ($vb_write_access) {
        $vs_set_display .= "<div class='pull-right'>" . caNavLink($po_request, '<span class="glyphicon glyphicon-trash"></span>', '', '', 'Sets', 'DeleteSet', array('set_id' => $t_set->get("set_id")), array("title" => _t("Delete"))) . "</div>\n";
    }
    $vs_set_display .= "<div><a href='#' onclick='jQuery(\"#comment" . $t_set->get("set_id") . "\").load(\"" . caNavUrl($po_request, '', 'Sets', 'AjaxListComments', array('item_id' => $t_set->get("set_id"), 'tablename' => 'ca_sets', 'set_id' => $t_set->get("set_id"))) . "\", function(){jQuery(\"#lbSetThumbRow" . $t_set->get("set_id") . "\").hide(); jQuery(\"#comment" . $t_set->get("set_id") . "\").show();}); return false;' title='" . _t("Comments") . "'><span class='glyphicon glyphicon-comment'></span> <small>" . $t_set->getNumComments() . "</small></a>";
    if ($vb_write_access) {
        $vs_set_display .= "&nbsp;&nbsp;&nbsp;<a href='#' onclick='caMediaPanel.showPanel(\"" . caNavUrl($po_request, '', 'Sets', 'setForm', array("set_id" => $t_set->get("set_id"))) . "\"); return false;' title='" . _t("Edit Name/Description") . "'><span class='glyphicon glyphicon-edit'></span></a>";
    }
    $vs_set_display .= "</div>\n";
    $vs_set_display .= "</div><!-- end lbSetExpandedInfo --></div><!-- end lbSet --></div><!-- end lbSetContainer -->\n";
    return $vs_set_display;
}
开发者ID:kai-iak,项目名称:pawtucket2,代码行数:74,代码来源:themeHelpers.php

示例7: strlen

    $vs_message = "\tLINKING {$vs_child_id} to parent {$vs_parent_id}";
    if (($vn_l = 200 - strlen($vs_message)) < 1) {
        $vn_l = 1;
    }
    $vs_message .= str_repeat(' ', $vn_l);
    $vn_last_message_length = strlen($vs_message);
    print $vs_message;
    if (!($vn_child_item_id = $va_aat_id_to_item_id[$vs_child_id])) {
        print "ERROR: no list item id for child_id {$vs_child_id} (were there previous errors?)\n";
        continue;
    }
    if (!($vn_parent_item_id = $va_aat_id_to_item_id[$vs_parent_id])) {
        print "ERROR: no list item id for parent_id {$vs_child_id} (were there previous errors?)\n";
        continue;
    }
    if (!$t_item->load($vn_child_item_id)) {
        print "ERROR: could not load item for {$vs_child_id} (was translated to item_id={$vn_child_item_id})\n";
        continue;
    }
    $t_item->set('parent_id', $vn_parent_item_id);
    $t_item->update();
    if ($t_item->numErrors()) {
        print "ERROR: could not set parent_id for {$vs_child_id} (was translated to item_id={$vn_child_item_id}): " . join('; ', $t_item->getErrors()) . "\n";
    }
}
if ($vn_list_item_relation_type_id_related > 0) {
    print "\n\nADDING RELATED TERM LINKS...\n";
    $vn_last_message_length = 0;
    $t_item = new ca_list_items();
    $t_link = new ca_list_items_x_list_items();
    $t_link->setMode(ACCESS_WRITE);
开发者ID:idiscussforum,项目名称:providence,代码行数:31,代码来源:import_aat.php

示例8: _genTypeNav

 public function _genTypeNav($pa_params)
 {
     $t_subject = $this->opo_datamodel->getInstanceByTableName($this->ops_tablename, true);
     $t_list = new ca_lists();
     $t_list->load(array('list_code' => $t_subject->getTypeListCode()));
     $t_list_item = new ca_list_items();
     $t_list_item->load(array('list_id' => $t_list->getPrimaryKey(), 'parent_id' => null));
     $va_hier = caExtractValuesByUserLocale($t_list_item->getHierarchyWithLabels());
     $va_restrict_to_types = null;
     if ($t_subject->getAppConfig()->get('perform_type_access_checking')) {
         $va_restrict_to_types = caGetTypeRestrictionsForUser($this->ops_tablename, array('access' => __CA_BUNDLE_ACCESS_READONLY__));
     }
     $va_types = array();
     if (is_array($va_hier)) {
         $va_types_by_parent_id = array();
         $vn_root_id = $t_list->getRootItemIDForList($t_subject->getTypeListCode());
         // organize items by parent id, exclude root
         foreach ($va_hier as $vn_item_id => $va_item) {
             if ($vn_item_id == $vn_root_id) {
                 continue;
             }
             // skip root
             if (is_array($va_restrict_to_types) && !in_array($vn_item_id, $va_restrict_to_types)) {
                 continue;
             }
             $va_types_by_parent_id[$va_item['parent_id']][] = $va_item;
         }
         foreach ($va_hier as $vn_item_id => $va_item) {
             if (is_array($va_restrict_to_types) && !in_array($vn_item_id, $va_restrict_to_types)) {
                 continue;
             }
             if ($va_item['parent_id'] != $vn_root_id) {
                 continue;
             }
             // does this item have sub-items?
             if (isset($va_item['item_id']) && isset($va_types_by_parent_id[$va_item['item_id']]) && is_array($va_types_by_parent_id[$va_item['item_id']])) {
                 $va_subtypes = $this->_getSubTypes($va_types_by_parent_id[$va_item['item_id']], $va_types_by_parent_id, $va_restrict_to_types);
             } else {
                 $va_subtypes = array();
             }
             $va_types[] = array('displayName' => $va_item['name_plural'], 'parameters' => array('type_id' => $va_item['item_id']), 'is_enabled' => $va_item['is_enabled'], 'navigation' => $va_subtypes);
         }
     }
     return $va_types;
 }
开发者ID:samrahman,项目名称:providence,代码行数:45,代码来源:BaseSearchController.php

示例9: caGetDisplayImagesForAuthorityItems

     $va_images = caGetDisplayImagesForAuthorityItems($vs_table, $va_ids, array('version' => 'small', 'relationshipTypes' => caGetOption('selectMediaUsingRelationshipTypes', $va_options, null), 'checkAccess' => $va_access_values));
     $vn_c = 0;
     $qr_res->seek($vn_start);
 }
 $t_list_item = new ca_list_items();
 $vs_add_to_lightbox_msg = addslashes(_t('Add to lightbox'));
 while ($qr_res->nextHit() && $vn_c < $vn_hits_per_block) {
     $vn_id = $qr_res->get("{$vs_table}.{$vs_pk}");
     $vs_idno_detail_link = caDetailLink($this->request, $qr_res->get("{$vs_table}.idno"), '', $vs_table, $vn_id);
     $vs_label_detail_link = caDetailLink($this->request, $qr_res->get("{$vs_table}.preferred_labels.name"), '', $vs_table, $vn_id);
     $vs_thumbnail = "";
     $vs_type_placeholder = "";
     $vs_typecode = "";
     if ($vs_table == 'ca_objects') {
         if (!($vs_thumbnail = $qr_res->getMediaTag('ca_object_representations.media', 'medium', array("checkAccess" => $va_access_values)))) {
             $t_list_item->load($qr_res->get("type_id"));
             $vs_typecode = $t_list_item->get("idno");
             if ($vs_type_placeholder = getPlaceholder($vs_typecode, "placeholder_media_icon")) {
                 $vs_thumbnail = "<div class='bResultItemImgPlaceholder'>" . $vs_type_placeholder . "</div>";
             } else {
                 $vs_thumbnail = $vs_default_placeholder_tag;
             }
         }
         $vs_rep_detail_link = caDetailLink($this->request, $vs_thumbnail, '', $vs_table, $vn_id);
     } else {
         if ($va_images[$vn_id]) {
             $vs_thumbnail = $va_images[$vn_id];
         } else {
             $vs_thumbnail = $vs_default_placeholder_tag;
         }
         $vs_rep_detail_link = caDetailLink($this->request, $vs_thumbnail, '', $vs_table, $vn_id);
开发者ID:kai-iak,项目名称:pawtucket2,代码行数:31,代码来源:browse_results_images_html_old.php

示例10: getElementCount

 /**
  * Returns number of elements in system
  *
  * @param $pb_root_elements_only boolean If true, then only root elements are counted; default is false
  * @param $pm_table_name_or_num mixed Optional table name or number to filter list with. If specified then only elements that have a type restriction to the table are counted. If omitted (default) then all elements, regardless of type restrictions, are returned.
  * @param $pm_type_name_or_id mixed Optional type code or type_id to restrict elements to.  If specified then only elements that have a type restriction to the specified table and type are counted. 
  * @return int The number of elements
  */
 public static function getElementCount($pb_root_elements_only = false, $pm_table_name_or_num = null, $pm_type_name_or_id = null)
 {
     $o_dm = Datamodel::load();
     $vn_table_num = $o_dm->getTableNum($pm_table_name_or_num);
     $vo_db = new Db();
     $va_wheres = array();
     if ($pb_root_elements_only) {
         $va_wheres[] = 'cme.parent_id is NULL';
     }
     if ($vn_table_num) {
         $va_wheres[] = 'cmtr.table_num = ?';
         $va_where_params[] = (int) $vn_table_num;
         if ($pm_type_name_or_id) {
             $t_list_item = new ca_list_items();
             if (!is_numeric($pm_type_name_or_id)) {
                 $t_list_item->load(array('idno' => $pm_type_name_or_id));
             } else {
                 $t_list_item->load((int) $pm_type_name_or_id);
             }
             $va_type_ids = array();
             if ($vn_type_id = $t_list_item->getPrimaryKey()) {
                 $va_type_ids[$vn_type_id] = true;
                 if ($qr_children = $t_list_item->getHierarchy($vn_type_id, array())) {
                     while ($qr_children->nextRow()) {
                         $va_type_ids[$qr_children->get('item_id')] = true;
                     }
                 }
                 $va_wheres[] = '((cmtr.type_id = ?) OR (cmtr.include_subtypes = 1 AND cmtr.type_id IN (?)))';
                 $va_where_params[] = (int) $vn_type_id;
                 $va_where_params[] = $va_type_ids;
             }
         }
         $vs_wheres = ' WHERE ' . join(' AND ', $va_wheres);
         $qr_tmp = $vo_db->query("\n\t\t\t\tSELECT count(*) c\n\t\t\t\tFROM ca_metadata_elements cme\n\t\t\t\tINNER JOIN ca_metadata_type_restrictions AS cmtr ON cme.hier_element_id = cmtr.element_id\n\t\t\t\t{$vs_wheres}\n\t\t\t", $va_where_params);
     } else {
         if (sizeof($va_wheres)) {
             $vs_wheres = ' WHERE ' . join(' AND ', $va_wheres);
         } else {
             $vs_wheres = '';
         }
         $qr_tmp = $vo_db->query("\n\t\t\t\tSELECT count(*) c\n\t\t\t\tFROM ca_metadata_elements cme\n\t\t\t\t{$vs_wheres}\n\t\t\t");
     }
     if ($qr_tmp->nextRow()) {
         return $qr_tmp->get('c');
     }
     return 0;
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:55,代码来源:ca_metadata_elements.php

示例11: _genTypeNav

 /**
  * Returns navigation fragment for types and subtypes of a given primary item type (Eg. ca_objects). Used to generate dynamic type menus 
  * from database by AppNavigation class. 
  *
  * @param array $pa_params Array of parameters used to generate menu
  * @return array List of types with subtypes ready for inclusion in a menu spec
  */
 public function _genTypeNav($pa_params)
 {
     $t_subject = $this->opo_datamodel->getInstanceByTableName($this->ops_table_name, true);
     $t_list = new ca_lists();
     $t_list->load(array('list_code' => $t_subject->getTypeListCode()));
     $t_list_item = new ca_list_items();
     $t_list_item->load(array('list_id' => $t_list->getPrimaryKey(), 'parent_id' => null));
     $va_hier = caExtractValuesByUserLocale($t_list_item->getHierarchyWithLabels());
     $vn_sort_type = $t_list->get('default_sort');
     $va_restrict_to_types = null;
     if ($t_subject->getAppConfig()->get('perform_type_access_checking')) {
         $va_restrict_to_types = caGetTypeRestrictionsForUser($this->ops_table_name, array('access' => __CA_BUNDLE_ACCESS_EDIT__));
     }
     $va_types = array();
     if (is_array($va_hier)) {
         $va_types_by_parent_id = array();
         $vn_root_id = $t_list->getRootItemIDForList($t_subject->getTypeListCode());
         foreach ($va_hier as $vn_item_id => $va_item) {
             if ($vn_item_id == $vn_root_id) {
                 continue;
             }
             // skip root
             $va_types_by_parent_id[$va_item['parent_id']][] = $va_item;
         }
         foreach ($va_hier as $vn_item_id => $va_item) {
             if (is_array($va_restrict_to_types) && !in_array($vn_item_id, $va_restrict_to_types)) {
                 continue;
             }
             if ($va_item['parent_id'] != $vn_root_id) {
                 continue;
             }
             // does this item have sub-items?
             $va_subtypes = array();
             if (!(bool) $this->getRequest()->config->get($this->ops_table_name . '_navigation_new_menu_shows_top_level_types_only') && !(bool) $this->getRequest()->config->get($this->ops_table_name . '_enforce_strict_type_hierarchy')) {
                 if (isset($va_item['item_id']) && isset($va_types_by_parent_id[$va_item['item_id']]) && is_array($va_types_by_parent_id[$va_item['item_id']])) {
                     $va_subtypes = $this->_getSubTypes($va_types_by_parent_id[$va_item['item_id']], $va_types_by_parent_id, $vn_sort_type, $va_restrict_to_types);
                 }
             }
             switch ($vn_sort_type) {
                 case 0:
                     // label
                 // label
                 default:
                     $vs_key = $va_item['name_singular'];
                     break;
                 case 1:
                     // rank
                     $vs_key = sprintf("%08d", (int) $va_item['rank']);
                     break;
                 case 2:
                     // value
                     $vs_key = $va_item['item_value'];
                     break;
                 case 3:
                     // identifier
                     $vs_key = $va_item['idno_sort'];
                     break;
             }
             $va_types[$vs_key][] = array('displayName' => $va_item['name_singular'], 'parameters' => array('type_id' => $va_item['item_id']), 'is_enabled' => $va_item['is_enabled'], 'navigation' => $va_subtypes);
         }
         ksort($va_types);
     }
     $va_types_proc = array();
     foreach ($va_types as $vs_sort_key => $va_items) {
         foreach ($va_items as $vn_i => $va_item) {
             $va_types_proc[] = $va_item;
         }
     }
     return $va_types_proc;
 }
开发者ID:kai-iak,项目名称:pawtucket2,代码行数:77,代码来源:BaseEditorController.php

示例12: getDisplayValue

 /**
  * When returning text will return plural value of list item unless useSingular option is set to true, in which case singular version of list item label will be used.
  *
  * @param array Optional array of options. Support options are:
  * 			list_id = if set then the numeric item_id value is translated into label text in the current locale. If not set then the numeric item_id is returned.
  *			useSingular = If list_id is set then by default the returned text is the plural label. Setting this option to true will force use of the singular label. [Default is false]
  *			showHierarchy = If true then hierarchical parents of list item will be returned and hierarchical options described below will be used to control the output [Default is false]
  *			returnIdno = If true list item idno is returned rather than preferred label [Default is false]
  *			idsOnly = Return numeric item_id only [Default is false]
  *			alwaysReturnItemID = Synonym for idsOnly [Default is false]
  *			output = what value for the list to return. Valid values are text [display text], idno [identifier; same as returnIdno option], value [numeric item_id; same as idsOnly option]. [Default is value]
  *
  *			HIERARCHICAL OPTIONS:
  *				direction - For hierarchy specifications (eg. ca_objects.hierarchy) this determines the order in which the hierarchy is returned. ASC will return the hierarchy root first while DESC will return it with the lowest node first. Default is ASC.
  *				top - For hierarchy specifications (eg. ca_objects.hierarchy) this option, if set, will limit the returned hierarchy to the first X nodes from the root down. Default is to not limit.
  *				bottom - For hierarchy specifications (eg. ca_objects.hierarchy) this option, if set, will limit the returned hierarchy to the first X nodes from the lowest node up. Default is to not limit.
  * 				hierarchicalDelimiter - Text to place between items in a hierarchy for a hierarchical specification (eg. ca_objects.hierarchy) when returning as a string
  *				removeFirstItems - If set to a non-zero value, the specified number of items at the top of the hierarchy will be omitted. For example, if set to 2, the root and first child of the hierarchy will be omitted. Default is zero (don't delete anything).
  *				transaction = the transaction to execute database actions within. [Default is null]
  * @return string The value
  */
 public function getDisplayValue($pa_options = null)
 {
     if (isset($pa_options['output'])) {
         switch (strtolower($pa_options['output'])) {
             case 'idno':
                 $pa_options['returnIdno'] = true;
                 break;
             case 'text':
                 $pa_options['returnIdno'] = false;
                 $pa_options['idsOnly'] = false;
                 break;
             default:
                 $pa_options['idsOnly'] = true;
                 break;
         }
     }
     if ($vb_return_idno = isset($pa_options['returnIdno']) && (bool) $pa_options['returnIdno']) {
         return caGetListItemIdno($this->opn_item_id);
     }
     if (is_null($vb_ids_only = isset($pa_options['idsOnly']) ? (bool) $pa_options['idsOnly'] : null)) {
         $vb_ids_only = isset($pa_options['alwaysReturnItemID']) ? (bool) $pa_options['alwaysReturnItemID'] : false;
     }
     if ($vb_ids_only) {
         return (int) $this->opn_item_id;
     }
     $vn_list_id = is_array($pa_options) && isset($pa_options['list_id']) ? (int) $pa_options['list_id'] : null;
     if ($vn_list_id > 0) {
         $t_list = new ca_lists();
         if ($o_trans = isset($pa_options['transaction']) ? $pa_options['transaction'] : null) {
             $t_list->setTransaction($o_trans);
         }
         $t_item = new ca_list_items();
         if ($pa_options['showHierarchy'] || $vb_return_idno) {
             if ($o_trans) {
                 $t_item->setTransaction($o_trans);
             }
         }
         $vs_get_spec = isset($pa_options['useSingular']) && $pa_options['useSingular'] ? 'preferred_labels.name_singular' : 'preferred_labels.name_plural';
         // do we need to get the hierarchy?
         if ($pa_options['showHierarchy']) {
             $t_item->load((int) $this->opn_item_id);
             return $t_item->get('ca_list_items.hierarchy.' . $vs_get_spec, array_merge(array('removeFirstItems' => 1, 'delimiter' => ' ➔ ', $pa_options)));
         }
         return $t_list->getItemFromListForDisplayByItemID($vn_list_id, $this->opn_item_id, isset($pa_options['useSingular']) && $pa_options['useSingular'] ? false : true);
     }
     return $this->ops_text_value;
 }
开发者ID:samrahman,项目名称:providence,代码行数:68,代码来源:ListAttributeValue.php

示例13: _parameterRestrictionsApply

 private function _parameterRestrictionsApply($pa_parameters, $ps_controller, $ps_action, $pa_fake_parameters)
 {
     $t_item = new ca_list_items();
     foreach ($pa_parameters as $vs_key => $va_value_data) {
         if ($vs_key == "type" && !is_array($va_value_data) && strlen($va_value_data) > 0) {
             if (!$t_item->load(array("idno" => $va_value_data))) {
                 return false;
             }
             // if there is no explicit type_id parameter we need to figure out the subject with the information we have
             // (which is basically the controller name) and get the type_id by ourselves
             if ($pa_fake_parameters["type_id"]) {
                 $vs_type_id = $pa_fake_parameters["type_id"];
             } else {
                 $vs_type_id = $this->opo_request->getParameter("type_id", pInteger);
             }
             if ($vs_type_id == "") {
                 $vs_table = $this->_convertControllerAndActionToSubjectTable($ps_controller, $ps_action);
                 if ($vs_table) {
                     $t_instance = new $vs_table();
                     if ($pa_fake_parameters[$t_instance->primaryKey()]) {
                         $vn_id = $pa_fake_parameters[$t_instance->primaryKey()];
                     } else {
                         $vn_id = $this->opo_request->getParameter($t_instance->primaryKey(), pInteger);
                     }
                     $t_instance->load($vn_id);
                     if (intval($t_instance->get("type_id")) != intval($t_item->getPrimaryKey())) {
                         return false;
                     }
                 }
             } else {
                 if (intval($t_item->getPrimaryKey()) != intval($vs_type_id)) {
                     return false;
                 }
             }
         } else {
             if (isset($pa_fake_parameters[$vs_key])) {
                 $vs_fake_val = $pa_fake_parameters[$vs_key];
                 if (preg_match("/\\{[a-z_]*\\}/", $vs_fake_val)) {
                     // fake value is placeholder for actual value inserted into forms via JS later -> set some fake actual integer value
                     $vs_fake_val = 1;
                 }
             } else {
                 $vs_fake_val = null;
             }
             if (substr($va_value_data["value"], 0, 1) == "!") {
                 switch ($va_value_data["type"]) {
                     case "int":
                         if (intval(substr($va_value_data["value"], 1)) == intval($vs_fake_val ? $vs_fake_val : $this->opo_request->getParameter($vs_key, pInteger))) {
                             return false;
                         }
                         break;
                     case "float":
                         if (floatval(substr($va_value_data["value"], 1)) == floatval($vs_fake_val ? $vs_fake_val : $this->opo_request->getParameter($vs_key, pFloat))) {
                             return false;
                         }
                         break;
                     default:
                         if (strval(substr($va_value_data["value"], 1)) == strval($vs_fake_val ? $vs_fake_val : $this->opo_request->getParameter($vs_key, pString))) {
                             return false;
                         }
                         break;
                 }
             } else {
                 if ($va_value_data["value"] == "not_set") {
                     if ($this->opo_request->getParameter($vs_key, pInteger) != "" || !is_null($vs_fake_val)) {
                         return false;
                     }
                 } else {
                     switch ($va_value_data["type"]) {
                         case "int":
                             if (intval($va_value_data["value"]) != intval($vs_fake_val ? $vs_fake_val : $this->opo_request->getParameter($vs_key, pInteger))) {
                                 return false;
                             }
                             break;
                         case "float":
                             if (floatval($va_value_data["value"]) != floatval($vs_fake_val ? $vs_fake_val : $this->opo_request->getParameter($vs_key, pFloat))) {
                                 return false;
                             }
                             break;
                         default:
                             if (strval($va_value_data["value"]) != strval($vs_fake_val ? $vs_fake_val : $this->opo_request->getParameter($vs_key, pString))) {
                                 return false;
                             }
                             break;
                     }
                 }
             }
         }
     }
     return true;
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:91,代码来源:AccessRestrictions.php

示例14: getTags

 /**
  * Returns COinS tags for inclusion in page
  *
  * @param SearchResult_or_BundleableLabelableBaseModelWithAttributes_subclass $pm_instance_or_result
  * @param string $ps_output_type
  * @param array $pa_options
  */
 public static function getTags($pm_instance_or_result, $ps_output_type = null, $pa_options = null)
 {
     $va_config = COinS::_getConfig($vs_table_name = $pm_instance_or_result->tableName(), $ps_output_type);
     $va_urls = array();
     if (is_subclass_of($pm_instance_or_result, 'BaseModel')) {
         $qr_res = $pm_instance_or_result->makeSearchResult($pm_instance_or_result->tableName(), array($pm_instance_or_result->getPrimaryKey()));
     } else {
         $qr_res = $pm_instance_or_result;
     }
     $o_dm = Datamodel::load();
     $t_instance = $o_dm->getInstanceByTableName($vs_table_name, true);
     $vs_type_fld_name = $t_instance->getTypeFieldName();
     $t_item = new ca_list_items();
     while ($qr_res->nextHit()) {
         $vs_type_name = null;
         if ($vn_type_id = $qr_res->get($vs_type_fld_name)) {
             if ($t_item->load($vn_type_id)) {
                 $vs_type_name = $t_item->get('idno');
             }
         }
         $va_mappings = isset($va_config[$vs_type_name]) ? $va_config[$vs_type_name] : $va_config['__default__'];
         $va_people_mappings = $va_mappings['People'];
         unset($va_mappings['People']);
         $va_item = $va_people = array();
         foreach ($va_mappings as $vs_key => $va_mapping) {
             if (!is_array($va_mapping)) {
                 $vs_static = (string) $va_mapping;
             } else {
                 $vs_static = $va_mapping['value'];
                 $vs_bundle = $va_mapping['bundle'];
                 $va_options = $va_mapping['options'];
             }
             if ($vs_bundle) {
                 $va_item[$vs_key] = $qr_res->get($vs_bundle, $va_options);
             } else {
                 $va_item[$vs_key] = $vs_static;
             }
         }
         if (is_array($va_people_mappings)) {
             foreach ($va_people_mappings as $vn_person_type => $va_mapping) {
                 if (!is_array($va_mapping)) {
                     $vs_static = (string) $va_mapping;
                 } else {
                     $vs_static = $va_mapping['value'];
                     $vs_forename_bundle = $va_mapping['forename'];
                     $vs_surname_bundle = $va_mapping['surname'];
                     $va_options = $va_mapping['options'];
                 }
                 $vs_forename = $qr_res->get($vs_forename_bundle, $va_options);
                 $vs_surname = $qr_res->get($vs_surname_bundle, $va_options);
                 if ($vs_forename || $vs_surname) {
                     $va_people[] = array('DocRelationship' => $vn_person_type, 'FirstName' => $vs_forename, 'LastName' => $vs_surname);
                 }
             }
         }
         $va_urls[] = $vs_url = COinS::_CreateOpenURL($va_item, $va_people);
         $va_tags[] = "<span class='Z3988' title='{$vs_url}'></span>";
     }
     $vb_return_urls = isset($pa_options['returnUrls']) && $pa_options['returnUrls'];
     if (isset($pa_options['returnAsArray']) && $pa_options['returnAsArray']) {
         return $vb_return_urls ? $va_urls : $va_tags;
     } else {
         $vs_delimiter = isset($pa_options['delimiter']) ? $pa_options['delimiter'] : "\n";
         return join($vs_delimiter, $vb_return_urls ? $va_urls : $va_tags);
     }
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:73,代码来源:COinS.php

示例15: array

            print $vs_dob . ")";
        }
        print "<br/>";
    }
    print "</H5>";
}
?>
		<HR/>
<?php 
$va_classification_links = array();
$t_list_item = new ca_list_items();
$va_decorative_types = $t_object->get("ca_objects.decorative_types", array("returnAsArray" => true));
if (sizeof($va_decorative_types)) {
    foreach ($va_decorative_types as $va_decorative_type) {
        $vn_decorative_type = $va_decorative_type["decorative_types"];
        $t_list_item->load($vn_decorative_type);
        if (trim($t_list_item->get("ca_list_item_labels.name_singular"))) {
            $va_classification_links[] = caNavLink($this->request, $t_list_item->get("ca_list_item_labels.name_singular"), "", "", "Browse", "Objects", array("facet" => "decorative_types_facet", "id" => $vn_decorative_type));
        }
    }
    if (sizeof($va_classification_links)) {
        print "<H6>Classification</H6>";
        print join(", ", $va_classification_links);
    }
}
$va_documentation_types = $t_object->get("ca_objects.documentation_types", array("returnAsArray" => true));
if (sizeof($va_documentation_types)) {
    foreach ($va_documentation_types as $va_documentation_type) {
        $vn_documentation_type = $va_documentation_type["documentation_types"];
        $t_list_item->load($vn_documentation_type);
        if (trim($t_list_item->get("ca_list_item_labels.name_singular"))) {
开发者ID:kai-iak,项目名称:pawtucket2,代码行数:31,代码来源:set_item_info_html.php


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