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


PHP caMakeSearchResult函数代码示例

本文整理汇总了PHP中caMakeSearchResult函数的典型用法代码示例。如果您正苦于以下问题:PHP caMakeSearchResult函数的具体用法?PHP caMakeSearchResult怎么用?PHP caMakeSearchResult使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: testGets

 public function testGets()
 {
     $vo_result = caMakeSearchResult('ca_storage_locations', array($this->opn_location_id));
     while ($vo_result->nextHit()) {
         $this->assertEquals(array($this->opn_object_id), $vo_result->get('ca_objects.object_id', array('returnAsArray' => true)));
         $this->assertEquals(array($this->opn_object_id), $vo_result->get('ca_objects.object_id', array('returnWithStructure' => true)));
         $this->assertEquals("{$this->opn_object_id}", $vo_result->get('ca_objects.object_id'));
     }
 }
开发者ID:samrahman,项目名称:providence,代码行数:9,代码来源:ForumThread294947Test.php

示例2: itineraGetTravelers

/**
 * Get list of entities associated with at least one tour stop
 */
function itineraGetTravelers($ps_letter = null)
{
    $ps_letter = strtolower($ps_letter);
    if (!preg_match("!^[a-z]{1}\$!", $ps_letter)) {
        $ps_letter = null;
    }
    $va_params = array();
    if ($ps_letter) {
        $va_params = array("{$ps_letter}%");
    }
    $o_db = new Db();
    $qr_res = $o_db->query("\n\t\t\tSELECT DISTINCT ctsxe.entity_id \n\t\t\tFROM ca_tour_stops_x_entities ctsxe\n\t\t\tINNER JOIN ca_entities AS e ON e.entity_id = ctsxe.entity_id\n\t\t\tINNER JOIN ca_entity_labels AS el ON e.entity_id = el.entity_id\n\t\t\tWHERE\n\t\t\t\tel.is_preferred = 1 AND e.deleted = 0 " . ($ps_letter ? " AND (el.surname LIKE ?)" : '') . "\n\t\t", $va_params);
    $va_entity_ids = $qr_res->getAllFieldValues('entity_id');
    return $qr_travelers = caMakeSearchResult('ca_entities', $va_entity_ids, array('sort' => 'ca_entity_labels.surname'));
}
开发者ID:kai-iak,项目名称:pawtucket2,代码行数:18,代码来源:dataHelpers.php

示例3: __call

 /**
  *
  */
 public function __call($ps_function, $pa_args)
 {
     AssetLoadManager::register("carousel");
     $va_access_values = caGetUserAccessValues($this->request);
     $this->view->setVar('access_values', $va_access_values);
     #
     # --- if there is a set configured to show on the front page, load it now
     #
     $va_featured_ids = array();
     if ($vs_set_code = $this->config->get("front_page_set_code")) {
         $t_set = new ca_sets();
         $t_set->load(array('set_code' => $vs_set_code));
         # Enforce access control on set
         if (sizeof($va_access_values) == 0 || sizeof($va_access_values) && in_array($t_set->get("access"), $va_access_values)) {
             $this->view->setVar('featured_set_id', $t_set->get("set_id"));
             $this->view->setVar('featured_set', $t_set);
             $va_featured_ids = array_keys(is_array($va_tmp = $t_set->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 1))) ? $va_tmp : array());
             $this->view->setVar('featured_set_item_ids', $va_featured_ids);
             $this->view->setVar('featured_set_items_as_search_result', caMakeSearchResult('ca_objects', $va_featured_ids));
         }
     }
     #
     # --- no configured set/items in set so grab random objects with media
     #
     if (sizeof($va_featured_ids) == 0) {
         $t_object = new ca_objects();
         $va_featured_ids = array_keys($t_object->getRandomItems(10, array('checkAccess' => $va_access_values, 'hasRepresentations' => 1)));
         $this->view->setVar('featured_set_item_ids', $va_featured_ids);
         $this->view->setVar('featured_set_items_as_search_result', caMakeSearchResult('ca_objects', $va_featured_ids));
     }
     $this->view->setVar('config', $this->config);
     $o_result_context = new ResultContext($this->request, 'ca_objects', 'front');
     $this->view->setVar('result_context', $o_result_context);
     $o_result_context->setAsLastFind();
     //
     // Try to load selected page if it exists in Front/, otherwise load default Front/front_page_html.php
     //
     $ps_function = preg_replace("![^A-Za-z0-9_\\-]+!", "", $ps_function);
     $vs_path = "Front/{$ps_function}_html.php";
     if (file_exists(__CA_THEME_DIR__ . "/views/{$vs_path}")) {
         $this->render($vs_path);
     } else {
         $this->render("Front/front_page_html.php");
     }
 }
开发者ID:ffarago,项目名称:pawtucket2,代码行数:48,代码来源:FrontController.php

示例4: _getChildren

function _getChildren($pr_res, &$pa_data, $pn_level, $pn_max_levels, &$pa_seen_list)
{
    if ($pn_level > $pn_max_levels) {
        return false;
    }
    while ($pr_res->nextHit()) {
        $vn_entity_id = $pr_res->get('ca_entities.entity_id');
        if ($pa_seen_list[$vn_entity_id]) {
            continue;
        }
        $va_entity = ['id' => $vn_entity_id, 'name' => $pr_res->get('ca_entities.preferred_labels.displayname'), 'children' => $va_children = []];
        $pa_seen_list[$vn_entity_id] = 1;
        if ($va_rel_ids = $pr_res->get('ca_entities.related.entity_id', ['returnAsArray' => true])) {
            $qr_children = caMakeSearchResult('ca_entities', $va_rel_ids);
            _getChildren($qr_children, $va_children, $pn_level + 1, $pn_max_levels, $pa_seen_list);
        }
        $va_entity['children'] = $va_children;
        $pa_data[] = $va_entity;
    }
    return true;
}
开发者ID:kai-iak,项目名称:pawtucket2,代码行数:21,代码来源:get_data_json.php

示例5: array

				</div>		
				<div class='col-sm-2 col-md-2 col-lg-2'>
					Ledger
				</div>
			</div><!-- end row -->
</ifcount>}}}
					<?php 
//print caBusyIndicatorIcon($this->request).' '.addslashes(_t('Loading...'));
$va_rel_ids = $t_item->get('ca_objects_x_entities.relation_id', array('returnAsArray' => true));
$qr_rels = caMakeSearchResult('ca_objects_x_entities', $va_rel_ids, array('sort' => 'ca_objects_x_entities.date_out'));
// set all of the page object_ids
$va_page_ids = array();
while ($qr_rels->nextHit()) {
    $va_page_ids[] = $qr_rels->get("ca_objects_x_entities.see_original_link", array('idsOnly' => 1));
}
$qr_pages = caMakeSearchResult('ca_objects', $va_page_ids);
$va_parents = array();
while ($qr_pages->nextHit()) {
    $va_parents[$qr_pages->get('ca_objects.object_id')] = $qr_pages->get('ca_objects.parent.preferred_labels.name');
}
$qr_rels->seek(0);
// reset the result to the beginning so we can run through it again
$vn_page_type_id = caGetListItemID('object_types', 'page');
$vn_i = 0;
while ($qr_rels->nextHit()) {
    if ($qr_rels->get('ca_objects.type_id') == $vn_page_type_id) {
        continue;
    }
    print "<div class='row ledgerRow'>";
    print "<div class='col-xs-3 col-sm-3 col-md-3 col-lg-3' id='book" . $vn_i . "'>";
    if ($qr_rels->get("ca_objects.parent.preferred_labels")) {
开发者ID:kai-iak,项目名称:pawtucket2,代码行数:31,代码来源:ca_entities_default_html.php

示例6: render

 /**
  * Render the visualization using the currently set data
  * 
  * @param string $ps_visualization Identifier of visualization to use. The identifier is the language-independent name of the visualization as specified in visualization.conf
  * @param string $ps_format Format of rendered visualization. The default, and only supported format at this time, is HTML.
  * @param array $pa_options Options to pass to visualization plugins at render-time.
  *
  * @return string The rendered content
  */
 public function render($ps_visualization, $ps_format = 'HTML', $pa_options = null)
 {
     $this->opn_num_items_rendered = 0;
     if (!($vs_table = $this->getTable())) {
         return null;
     }
     $va_viz_list = Visualizer::getAvailableVisualizations($vs_table);
     if (!isset($va_viz_list[$ps_visualization]) || !is_array($va_viz_settings = $va_viz_list[$ps_visualization])) {
         return null;
     }
     $vs_viz_plugin = $va_viz_settings['plugin'];
     if ($o_viz = $this->getVisualizationPlugin($vs_viz_plugin)) {
         $va_ids = array();
         $o_dm = Datamodel::load();
         $t_instance = $o_dm->getInstanceByTableName($vs_table, true);
         $vs_pk = $t_instance->primaryKey();
         foreach ($this->opa_data as $o_data) {
             if (is_subclass_of($o_data, 'SearchResult')) {
                 while ($o_data->nextHit()) {
                     $va_ids[] = $o_data->get("{$vs_table}.{$vs_pk}");
                 }
             }
             if (is_subclass_of($o_data, 'BundlableLabelableBaseModelWithAttributes')) {
                 $va_ids[] = $o_data->get("{$vs_table}.{$vs_pk}");
             }
             $o_viz->setData(caMakeSearchResult($vs_table, $va_ids));
             $vs_html = $o_viz->render($va_viz_settings, $ps_format, array_merge($pa_options, $va_viz_settings['options']));
             $this->opn_num_items_rendered = $this->opn_num_items_rendered + $o_viz->numItemsRendered();
             return $vs_html;
         }
     } else {
         return null;
     }
 }
开发者ID:ffarago,项目名称:pawtucket2,代码行数:43,代码来源:Visualizer.php

示例7: caGetFrontConfig

<?php 
$va_access_values = $this->getVar("access_values");
$o_config = caGetFrontConfig();
# --- grab the set that has the featured
$t_set = new ca_sets();
$t_set->load(array('set_code' => $o_config->get("front_page_exhibit_set_code")));
$t_exhibition = new ca_occurrences();
if (sizeof($va_access_values) == 0 || sizeof($va_access_values) && in_array($t_set->get("access"), $va_access_values)) {
    $va_exhibition_ids = array_keys(is_array($va_tmp = $t_set->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 1))) ? $va_tmp : array());
    $t_exhibition->load($va_exhibition_ids[0]);
}
# --- check to see if there is an image set configured
$t_set->load(array('set_code' => $o_config->get("front_page_set_code")));
if (sizeof($va_access_values) == 0 || sizeof($va_access_values) && in_array($t_set->get("access"), $va_access_values)) {
    $va_featured_ids = array_keys(is_array($va_tmp = $t_set->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 1))) ? $va_tmp : array());
    $qr_res = caMakeSearchResult('ca_objects', $va_featured_ids);
}
if ($qr_res && $qr_res->numHits()) {
    $qr_res = $this->getVar('featured_set_items_as_search_result');
    while ($qr_res->nextHit()) {
        if ($vs_media = $qr_res->getWithTemplate('^ca_object_representations.media.front', array("checkAccess" => $va_access_values))) {
            print "<div class='col-sm-12'><div class='frontSlide'>" . $vs_media . "</div></div>";
            break;
        }
    }
} else {
    if ($t_exhibition->get("occurrence_id")) {
        # --- use the featured image from the show
        $va_objects = $t_exhibition->get('ca_objects', array("checkAccess" => $va_access_values, "restrictToRelationshipTypes" => array("used_website"), "returnAsArray" => true));
        if (is_array($va_objects) && sizeof($va_objects)) {
            $va_object = array_pop($va_objects);
开发者ID:kai-iak,项目名称:pawtucket2,代码行数:31,代码来源:front_page_html.php

示例8: getPinContent

 /**
  * 
  */
 public function getPinContent()
 {
     $pa_ids = explode(";", $this->request->getParameter('id', pString));
     $this->view->setVar('ids', $pa_ids);
     $this->view->setVar('result', caMakeSearchResult("ca_objects", $pa_ids));
     $this->render("map_balloon_html.php");
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:10,代码来源:MapController.php

示例9: Save

 /**
  * Saves the content of a form editing new or existing records. It returns the same form + status messages rendered into the current view, inherited from ActionController
  *
  * @param array $pa_options Array of options passed through to _initView and saveBundlesForScreen()
  */
 public function Save($pa_options = null)
 {
     if (!is_array($pa_options)) {
         $pa_options = array();
     }
     list($t_subject, $t_ui, $vn_parent_id, $vn_above_id) = $this->_initView(array_merge($pa_options, array('loadSubject' => true)));
     if (!$t_subject) {
         $this->postError(1220, _t('Invalid table %1', $this->ops_table_name), "BaseInterstitalController->Edit()");
         return false;
     }
     if (!is_array($pa_options)) {
         $pa_options = array();
     }
     //
     // Is record of correct type?
     //
     $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__));
     }
     if (is_array($va_restrict_to_types) && !in_array($t_subject->get('type_id'), $va_restrict_to_types)) {
         $this->response->setRedirect($this->request->config->get('error_display_url') . '/n/2560?r=' . urlencode($this->request->getFullUrlPath()));
         return;
     }
     $pn_placement_id = $this->request->getParameter('placement_id', pInteger);
     // placement_id of bundle that launched interstitial editor
     $ps_primary_table = $this->request->getParameter('primary', pString);
     $pn_primary_id = $this->request->getParameter('primary_id', pInteger);
     // Make sure request isn't empty
     if (!sizeof($_POST)) {
         $va_response = array('status' => 20, 'id' => null, 'table' => $t_subject->tableName(), 'type_id' => null, 'display' => null, 'errors' => array(_t("Cannot save using empty request. Are you using a bookmark?") => _t("Cannot save using empty request. Are you using a bookmark?")));
         $this->view->setVar('response', $va_response);
         $this->render('interstitial/interstitial_result_json.php');
         return;
     }
     // Set type name for display
     if (!($vs_type_name = $t_subject->getTypeName())) {
         $vs_type_name = $t_subject->getProperty('NAME_SINGULAR');
     }
     # trigger "BeforeSaveItem" hook
     $this->opo_app_plugin_manager->hookBeforeSaveItem(array('id' => null, 'table_num' => $t_subject->tableNum(), 'table_name' => $t_subject->tableName(), 'instance' => $t_subject, 'is_insert' => true));
     $t_placement = new ca_editor_ui_bundle_placements($pn_placement_id);
     $pa_bundle_settings = $t_placement->getSettings();
     $va_opts = array_merge($pa_options, array('ui_instance' => $t_ui));
     $vb_save_rc = $t_subject->saveBundlesForScreen($this->request->getParameter('screen', pString), $this->request, $va_opts);
     $this->view->setVar('t_ui', $t_ui);
     $vs_message = _t("Saved changes to %1", $vs_type_name);
     //
     // Regenerate display template for bundle that launched the interstitial editor so it will reflect any changes
     //
     $vs_related_table = $t_placement->getEditorType();
     $vs_template = caGetBundleDisplayTemplate($t_subject, $vs_related_table, $pa_bundle_settings);
     $qr_rel_items = caMakeSearchResult($t_subject->tableName(), array($t_subject->getPrimaryKey()));
     //
     // Handle case of self relationships where we need to figure out which direction things are going in
     //
     $va_bundle_values = array_shift(caProcessRelationshipLookupLabel($qr_rel_items, $t_subject, array('template' => $vs_template, 'primaryIDs' => array($ps_primary_table => array($pn_primary_id)))));
     if ($t_subject->hasField('type_id')) {
         if (method_exists($t_subject, "isSelfRelationship") && $t_subject->isSelfRelationship()) {
             $vn_left_id = $t_subject->get($t_subject->getLeftTableFieldName());
             $vn_right_id = $t_subject->get($t_subject->getRightTableFieldName());
             $va_bundle_values['relationship_typename'] = $t_subject->getRelationshipTypename($vn_left_id == $pn_primary_id ? 'ltol' : 'rtol');
         } else {
             $va_bundle_values['relationship_typename'] = $t_subject->getRelationshipTypename($t_subject->getLeftTableFieldName() == $vs_related_table ? 'rtol' : 'ltor');
         }
         $va_bundle_values['relationship_type_code'] = $t_subject->getRelationshipTypeCode();
     }
     //
     // Report errors
     //
     $va_errors = $this->request->getActionErrors();
     // all errors from all sources
     $va_general_errors = $this->request->getActionErrors('general');
     // just "general" errors - ones that are not attached to a specific part of the form
     if (sizeof($va_errors) - sizeof($va_general_errors) > 0) {
         $va_error_list = array();
         $vb_no_save_error = false;
         foreach ($va_errors as $o_e) {
             $va_error_list[$o_e->getErrorDescription()] = $o_e->getErrorDescription() . "\n";
             switch ($o_e->getErrorNumber()) {
                 case 1100:
                     // duplicate/invalid idno
                     if (!$vn_subject_id) {
                         // can't save new record if idno is not valid (when updating everything but idno is saved if it is invalid)
                         $vb_no_save_error = true;
                     }
                     break;
             }
         }
     } else {
         $this->opo_result_context->invalidateCache();
     }
     $this->opo_result_context->saveContext();
     # trigger "SaveItem" hook
     $this->opo_app_plugin_manager->hookSaveItem(array('id' => $vn_subject_id, 'table_num' => $t_subject->tableNum(), 'table_name' => $t_subject->tableName(), 'instance' => $t_subject, 'is_insert' => true));
//.........这里部分代码省略.........
开发者ID:guaykuru,项目名称:pawtucket,代码行数:101,代码来源:BaseInterstitialController.php

示例10: getFacetHierarchyLevel

 /**
  * Given a item_id (request parameter 'id') returns a list of direct children for use in the hierarchy browser
  * Returned data is JSON format
  */
 public function getFacetHierarchyLevel()
 {
     $va_access_values = caGetUserAccessValues($this->request);
     $ps_facet_name = $this->request->getParameter('facet', pString);
     $this->opo_browse->setTypeRestrictions(array($this->opn_type_restriction_id));
     if (!is_array($va_facet_info = $this->opo_browse->getInfoForFacet($ps_facet_name))) {
         return null;
     }
     $va_facet = $this->opo_browse->getFacet($ps_facet_name, array('sort' => 'name', 'checkAccess' => $va_access_values));
     $pa_ids = explode(";", $ps_ids = $this->request->getParameter('id', pString));
     if (!sizeof($pa_ids)) {
         $pa_ids = array(null);
     }
     $va_level_data = array();
     if (($vn_max_items_per_page = $this->request->getParameter('max', pInteger)) < 1 || $vn_max_items_per_page > 1000) {
         $vn_max_items_per_page = null;
     }
     $t_model = $this->opo_datamodel->getInstanceByTableName($this->ops_tablename, true);
     $o_config = Configuration::load();
     if (!is_array($va_sorts = $o_config->getList($this->ops_tablename . '_hierarchy_browser_sort_values')) || !sizeof($va_sorts)) {
         $va_sorts = array();
     }
     foreach ($va_sorts as $vn_i => $vs_sort_fld) {
         $va_tmp = explode(".", $vs_sort_fld);
         if ($va_tmp[1] == 'preferred_labels') {
             $va_tmp[0] = $vs_label_table_name;
             if (!($va_tmp[1] = $va_tmp[2])) {
                 $va_tmp[1] = $vs_label_display_field_name;
             }
             unset($va_tmp[2]);
             $va_sorts[$vn_i] = join(".", $va_tmp);
         }
     }
     if (!in_array($vs_sort_dir = strtolower($o_config->get($this->ops_tablename . '_hierarchy_browser_sort_direction')), array('asc', 'desc'))) {
         $vs_sort_dir = 'asc';
     }
     $va_expanded_facet = array();
     $t_item = new ca_list_items();
     foreach ($va_facet as $vn_id => $va_facet_item) {
         $va_expanded_facet[$vn_id] = true;
         $va_ancestors = $t_item->getHierarchyAncestors($vn_id, array('idsOnly' => true));
         if (is_array($va_ancestors)) {
             foreach ($va_ancestors as $vn_ancestor_id) {
                 $va_expanded_facet[$vn_ancestor_id] = true;
             }
         }
     }
     foreach ($pa_ids as $pn_id) {
         $va_json_data = array('_primaryKey' => 'item_id');
         $va_tmp = explode(":", $pn_id);
         $vn_id = $va_tmp[0];
         $vn_start = (int) $va_tmp[1];
         if ($vn_start < 0) {
             $vn_start = 0;
         }
         switch ($va_facet_info['type']) {
             case 'attribute':
                 // is it a list attribute?
                 $t_element = new ca_metadata_elements();
                 if ($t_element->load(array('element_code' => $va_facet_info['element_code']))) {
                     if ($t_element->get('datatype') == 3) {
                         // 3=list
                         $t_list = new ca_lists();
                         if (!$vn_id) {
                             $vn_id = $t_list->getRootListItemID($t_element->get('list_id'));
                         }
                         $t_item = new ca_list_items($vn_id);
                         $va_children = $t_item->getHierarchyChildren(null, array('idsOnly' => true));
                         $va_child_counts = $t_item->getHierarchyChildCountsForIDs($va_children);
                         $qr_res = caMakeSearchResult('ca_list_items', $va_children);
                         $vs_pk = $t_model->primaryKey();
                         if ($qr_res) {
                             while ($qr_res->nextHit()) {
                                 $vn_parent_id = $qr_res->get('ca_list_items.parent_id');
                                 $vn_item_id = $qr_res->get('ca_list_items.item_id');
                                 if (!isset($va_expanded_facet[$vn_item_id])) {
                                     continue;
                                 }
                                 $va_item = array();
                                 $va_item['item_id'] = $vn_item_id;
                                 $va_item['name'] = $qr_res->get('ca_list_items.preferred_labels');
                                 $va_item['children'] = isset($va_child_counts[$vn_item_id]) && $va_child_counts[$vn_item_id] ? $va_child_counts[$vn_item_id] : 0;
                                 $va_json_data[$vn_item_id] = $va_item;
                             }
                         }
                     }
                 }
                 break;
             case 'label':
                 // label facet
                 $va_facet_info['table'] = $this->ops_tablename;
                 // fall through to default case
             // fall through to default case
             default:
                 if (!$vn_id) {
                     $va_hier_ids = $this->opo_browse->getHierarchyIDsForFacet($ps_facet_name, array('checkAccess' => $va_access_values));
//.........这里部分代码省略.........
开发者ID:idiscussforum,项目名称:providence,代码行数:101,代码来源:BaseRefineableSearchController.php

示例11: array

 * @package CollectiveAccess
 * @subpackage Core
 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License version 3
 *
 * ----------------------------------------------------------------------
 */
#	print $this->render("Front/featured_set_slideshow_html.php");
$va_featured_ids = array();
if ($vs_set_code = $this->request->config->get("front_page_set_code")) {
    $t_set = new ca_sets();
    $t_set->load(array('set_code' => $vs_set_code));
    # Enforce access control on set
    if (sizeof($va_access_values) == 0 || sizeof($va_access_values) && in_array($t_set->get("access"), $va_access_values)) {
        $vs_set_id = $t_set->get("set_id");
        $va_featured_ids = array_keys(is_array($va_tmp = $t_set->getItemRowIDs(array('checkAccess' => $va_access_values, 'shuffle' => 1))) ? $va_tmp : array());
        $featured_set_items_as_search_result = caMakeSearchResult('ca_occurrences', $va_featured_ids);
    }
}
?>
<div class="container">
	<div class="row">
		<div class="col-sm-8">
		<h2>Selected exhibitions</h2>
<?php 
if ($featured_set_items_as_search_result) {
    while ($featured_set_items_as_search_result->nextHit()) {
        $va_occurrence_id = $featured_set_items_as_search_result->get('ca_occurrences.occurrence_id');
        $va_related_objects = $featured_set_items_as_search_result->get('ca_objects.object_id', array('returnAsArray' => true));
        $vn_object_id = $va_related_objects[0];
        $t_object = new ca_objects($vn_object_id);
        $va_reps = $t_object->getPrimaryRepresentation(array('widepreview'), null, array('return_with_access' => $va_access_values));
开发者ID:kai-iak,项目名称:pawtucket2,代码行数:31,代码来源:front_page_html.php

示例12: array

$va_access_values = $this->getVar("access_values");
$va_featured_items = $t_item->get("ca_objects.object_id", array("returnAsArray" => true, "restrictToRelationshipTypes" => array("featured", "cover"), "checkAccess" => $va_access_values));
?>
<div class="row">
	<div class='col-xs-1 col-sm-1 col-md-1 col-lg-1'>
		<div class="detailNavBgLeft">
			{{{previousLink}}}{{{resultsLink}}}
		</div><!-- end detailNavBgLeft -->
	</div><!-- end col -->
	<div class='col-xs-10 col-sm-10 col-md-10 col-lg-10'>
		<div class="container">
			<div class="row">			
				<div class='col-md-6 col-lg-6'>
<?php 
if (is_array($va_featured_items) && sizeof($va_featured_items)) {
    $q_featured_objects = caMakeSearchResult('ca_objects', $va_featured_items);
    $vb_item_output = 0;
    if ($q_featured_objects->numHits()) {
        ?>
   
								<div class="jcarousel-wrapper"><div class="jcarousel" id="repViewerCarousel"><ul>
<?php 
        while ($q_featured_objects->nextHit()) {
            if ($vs_media = $q_featured_objects->getWithTemplate("<div class='repViewerContCont'><div class='repViewerCont'><l>^ca_object_representations.media.mediumlarge</l></div></div>", array("checkAccess" => $va_access_values))) {
                print "<li><div class='detailSlide'>" . $vs_media;
                $vs_caption = $q_featured_objects->getWithTemplate('<l>^ca_objects.preferred_labels.name</l>');
                if ($vs_caption) {
                    print "<p>" . $vs_caption . "</p>";
                }
                print "</div></li>";
                $vb_item_output++;
开发者ID:ffarago,项目名称:pawtucket2,代码行数:31,代码来源:ca_places_default_html.php

示例13: _getAttributeValue

 /**
  * get() value for attribute
  *
  * @param array $pa_value_list
  * @param BaseModel $pt_instance
  * @param array Options
  *
  * @return array|string
  */
 private function _getAttributeValue($pa_value_list, $pt_instance, $pa_options)
 {
     $va_path_components =& $pa_options['pathComponents'];
     $vs_delimiter = isset($pa_options['delimiter']) ? $pa_options['delimiter'] : ';';
     $va_return_values = array();
     $vn_id = $this->get($pt_instance->primaryKey(true));
     $vs_table_name = $pt_instance->tableName();
     if (is_array($pa_value_list) && sizeof($pa_value_list)) {
         $va_val_proc = array();
         foreach ($pa_value_list as $o_attribute) {
             $t_attr_element = $pt_instance->_getElementInstance($o_attribute->getElementID());
             $vn_attr_type = $t_attr_element->get('datatype');
             $va_acc = array();
             $va_values = $o_attribute->getValues();
             if ($pa_options['useLocaleCodes']) {
                 if (!$o_attribute->getLocaleID() || !($vm_locale_id = SearchResult::$opo_locales->localeIDToCode($o_attribute->getLocaleID()))) {
                     $vm_locale_id = __CA_DEFAULT_LOCALE__;
                 }
             } else {
                 if (!($vm_locale_id = $o_attribute->getLocaleID())) {
                     $vm_locale_id = SearchResult::$opo_locales->localeCodeToID(__CA_DEFAULT_LOCALE__);
                 }
             }
             $vb_did_return_value = false;
             foreach ($va_values as $o_value) {
                 $vs_val_proc = null;
                 $vb_dont_return_value = false;
                 $vs_element_code = $o_value->getElementCode();
                 $va_auth_spec = null;
                 if (is_a($o_value, "AuthorityAttributeValue")) {
                     $va_auth_spec = $va_path_components['components'];
                     if ($pt_instance->hasElement($va_path_components['subfield_name'], null, true, array('dontCache' => false))) {
                         array_shift($va_auth_spec);
                         array_shift($va_auth_spec);
                         array_shift($va_auth_spec);
                     } elseif ($pt_instance->hasElement($va_path_components['field_name'], null, true, array('dontCache' => false))) {
                         array_shift($va_auth_spec);
                         array_shift($va_auth_spec);
                         $va_path_components['subfield_name'] = null;
                     }
                 }
                 if ($va_path_components['subfield_name'] && $va_path_components['subfield_name'] !== $vs_element_code && !$o_value instanceof InformationServiceAttributeValue) {
                     $vb_dont_return_value = true;
                     if (!$pa_options['filter']) {
                         continue;
                     }
                 }
                 if (is_a($o_value, "AuthorityAttributeValue") && sizeof($va_auth_spec) > 0) {
                     array_unshift($va_auth_spec, $vs_auth_table_name = $o_value->tableName());
                     if ($qr_res = caMakeSearchResult($vs_auth_table_name, array($o_value->getID()))) {
                         if ($qr_res->nextHit()) {
                             unset($pa_options['returnWithStructure']);
                             $va_options['returnAsArray'] = true;
                             $va_val_proc = $qr_res->get(join(".", $va_auth_spec), $pa_options);
                             if (is_array($va_val_proc)) {
                                 foreach ($va_val_proc as $vn_i => $vs_v) {
                                     $va_return_values[(int) $vn_id][$vm_locale_id][(int) $o_attribute->getAttributeID() . "_{$vn_i}"][$vs_element_code] = $vs_v;
                                 }
                             }
                         }
                     }
                     continue;
                 }
                 if (is_null($vs_val_proc)) {
                     switch ($o_value->getType()) {
                         case __CA_ATTRIBUTE_VALUE_LIST__:
                             $t_element = $pt_instance->_getElementInstance($o_value->getElementID());
                             $vn_list_id = $t_element->get('list_id');
                             $vs_val_proc = $o_value->getDisplayValue(array_merge($pa_options, array('output' => $pa_options['output'], 'list_id' => $vn_list_id)));
                             break;
                         case __CA_ATTRIBUTE_VALUE_INFORMATIONSERVICE__:
                             //ca_objects.informationservice.ulan_container
                             // support subfield notations like ca_objects.wikipedia.abstract, but only if we're not already at subfield-level, e.g. ca_objects.container.wikipedia
                             if ($va_path_components['subfield_name'] && $vs_element_code != $va_path_components['subfield_name'] && $vs_element_code == $va_path_components['field_name']) {
                                 $vs_val_proc = $o_value->getExtraInfo($va_path_components['subfield_name']);
                                 $vb_dont_return_value = false;
                                 break;
                             }
                             // support ca_objects.container.wikipedia.abstract
                             if ($vs_element_code == $va_path_components['subfield_name'] && $va_path_components['num_components'] == 4) {
                                 $vs_val_proc = $o_value->getExtraInfo($va_path_components['components'][3]);
                                 $vb_dont_return_value = false;
                                 break;
                             }
                             // support ca_objects.wikipedia or ca_objects.container.wikipedia (Eg. no "extra" value specified)
                             if ($vs_element_code == $va_path_components['field_name'] || $vs_element_code == $va_path_components['subfield_name']) {
                                 $vs_val_proc = $o_value->getDisplayValue(array_merge($pa_options, array('output' => $pa_options['output'])));
                                 $vb_dont_return_value = false;
                                 break;
                             }
                             continue 2;
//.........这里部分代码省略.........
开发者ID:samrahman,项目名称:providence,代码行数:101,代码来源:SearchResult.php

示例14: getObjectHistory

 /**
  * Return array with list of significant events in object life cycle as configured for 
  * a ca_objects_history editor bundle.
  *
  * @param array $pa_bundle_settings The settings for a ca_objects_history editing BUNDLES
  * @param array $pa_options Array of options. Options include:
  *		noCache = Don't use any cached history data. [Default is false]
  *		currentOnly = Only return history entries dates before or on the current date. [Default is false]
  *		limit = Only return a maximum number of history entries. [Default is null; no limit]
  *
  * @return array A list of life cycle events, indexed by historic timestamp for date of occurrrence. Each list value is an array of history entries.
  *
  * @used-by ca_objects::getObjectHistoryHTMLFormBundle
  */
 public function getObjectHistory($pa_bundle_settings = null, $pa_options = null)
 {
     global $g_ui_locale;
     if (!is_array($pa_options)) {
         $pa_options = array();
     }
     if (!is_array($pa_bundle_settings)) {
         $pa_bundle_settings = array();
     }
     $vs_cache_key = caMakeCacheKeyFromOptions(array_merge($pa_bundle_settings, $pa_options, array('object_id' => $this->getPrimaryKey())));
     $pb_no_cache = caGetOption('noCache', $pa_options, false);
     if (!$pb_no_cache && isset(ca_objects::$s_object_use_cache[$vs_cache_key])) {
         return ca_objects::$s_object_use_cache[$vs_cache_key];
     }
     $pb_display_label_only = caGetOption('displayLabelOnly', $pa_options, false);
     $pb_get_current_only = caGetOption('currentOnly', $pa_options, false);
     $pn_limit = caGetOption('limit', $pa_options, null);
     $vs_display_template = caGetOption('display_template', $pa_bundle_settings, _t('No template defined'));
     $vs_history_template = caGetOption('history_template', $pa_bundle_settings, $vs_display_template);
     $vn_current_date = caDateToHistoricTimestamp(_t('now'));
     $o_media_coder = new MediaInfoCoder();
     //
     // Get history
     //
     $va_history = array();
     // Lots
     if (is_array($va_lot_types = caGetOption('ca_object_lots_showTypes', $pa_bundle_settings, null)) && ($vn_lot_id = $this->get('lot_id'))) {
         $t_lot = new ca_object_lots($vn_lot_id);
         if (!$t_lot->get('deleted')) {
             $va_lot_type_info = $t_lot->getTypeList();
             $vn_type_id = $t_lot->get('type_id');
             $vs_color = $va_lot_type_info[$vn_type_id]['color'];
             if (!$vs_color || $vs_color == '000000') {
                 $vs_color = caGetOption("ca_object_lots_{$va_lot_type_info[$vn_type_id]['idno']}_color", $pa_bundle_settings, 'ffffff');
             }
             $va_dates = array();
             $va_date_elements = caGetOption("ca_object_lots_{$va_lot_type_info[$vn_type_id]['idno']}_dateElement", $pa_bundle_settings, null);
             if (!is_array($va_date_elements) && $va_date_elements) {
                 $va_date_elements = array($va_date_elements);
             }
             if (is_array($va_date_elements) && sizeof($va_date_elements)) {
                 foreach ($va_date_elements as $vs_date_element) {
                     $va_dates[] = array('sortable' => $t_lot->get($vs_date_element, array('getDirectDate' => true)), 'display' => $t_lot->get($vs_date_element));
                 }
             }
             if (!sizeof($va_dates)) {
                 $va_dates[] = array('sortable' => $vn_date = caUnixTimestampToHistoricTimestamps($t_lot->getCreationTimestamp(null, array('timestampOnly' => true))), 'display' => caGetLocalizedDate($vn_date));
             }
             foreach ($va_dates as $va_date) {
                 if (!$va_date['sortable']) {
                     continue;
                 }
                 if (!in_array($vn_type_id, $va_lot_types)) {
                     continue;
                 }
                 if ($pb_get_current_only && $va_date['sortable'] > $vn_current_date) {
                     continue;
                 }
                 $vs_default_display_template = '^ca_object_lots.preferred_labels.name (^ca_object_lots.idno_stub)';
                 $vs_display_template = $pb_display_label_only ? "" : caGetOption("ca_object_lots_{$va_lot_type_info[$vn_type_id]['idno']}_displayTemplate", $pa_bundle_settings, $vs_default_display_template);
                 $va_history[$va_date['sortable']][] = array('type' => 'ca_object_lots', 'id' => $vn_lot_id, 'display' => $t_lot->getWithTemplate($vs_display_template), 'color' => $vs_color, 'icon_url' => $vs_icon_url = $o_media_coder->getMediaTag($va_lot_type_info[$vn_type_id]['icon'], 'icon'), 'typename_singular' => $vs_typename = $va_lot_type_info[$vn_type_id]['name_singular'], 'typename_plural' => $va_lot_type_info[$vn_type_id]['name_plural'], 'type_id' => $vn_type_id, 'icon' => '<div class="caUseHistoryIconContainer" style="background-color: #' . $vs_color . '"><div class="caUseHistoryIcon">' . ($vs_icon_url ? $vs_icon_url : '<div class="caUseHistoryIconText">' . $vs_typename . '</div>') . '</div></div>', 'date' => $va_date['display']);
             }
         }
     }
     // Loans
     $va_loans = $this->get('ca_loans.loan_id', array('returnAsArray' => true));
     if (is_array($va_loan_types = caGetOption('ca_loans_showTypes', $pa_bundle_settings, null)) && is_array($va_loans) && sizeof($va_loans)) {
         $qr_loans = caMakeSearchResult('ca_loans', $va_loans);
         $t_loan = new ca_loans();
         $va_loan_type_info = $t_loan->getTypeList();
         $va_date_elements_by_type = array();
         foreach ($va_loan_types as $vn_type_id) {
             if (!is_array($va_date_elements = caGetOption("ca_loans_{$va_loan_type_info[$vn_type_id]['idno']}_dateElement", $pa_bundle_settings, null)) && $va_date_elements) {
                 $va_date_elements = array($va_date_elements);
             }
             if (!$va_date_elements) {
                 continue;
             }
             $va_date_elements_by_type[$vn_type_id] = $va_date_elements;
         }
         while ($qr_loans->nextHit()) {
             $vn_loan_id = $qr_loans->get('loan_id');
             if ((string) $qr_loans->get('ca_loans.deleted') !== '0') {
                 continue;
             }
             // filter out deleted
//.........这里部分代码省略.........
开发者ID:kai-iak,项目名称:pawtucket2,代码行数:101,代码来源:ca_objects.php

示例15: getRelatedItems


//.........这里部分代码省略.........
             foreach ($va_filters as $vs_filter => $va_filter_vals) {
                 if (!$vs_filter) {
                     continue;
                 }
                 if (!is_array($va_filter_vals)) {
                     $va_filter_vals = array($va_filter_vals);
                 }
                 foreach ($va_filter_vals as $vn_index => $vs_filter_val) {
                     // is value a list attribute idno?
                     $va_tmp = explode('.', $vs_filter);
                     $vs_element = array_pop($va_tmp);
                     if (!is_numeric($vs_filter_val) && (($t_element = $t_rel_item->_getElementInstance($vs_element)) && $t_element->get('datatype') == 3)) {
                         $va_filter_vals[$vn_index] = caGetListItemID($t_element->get('list_id'), $vs_filter_val);
                     }
                 }
                 $t_rel_item->load($va_related_item[$t_rel_item->primaryKey()]);
                 $va_filter_values = $t_rel_item->get($vs_filter, array('returnAsArray' => true, 'alwaysReturnItemID' => true));
                 $vb_keep = false;
                 if (is_array($va_filter_values)) {
                     foreach ($va_filter_values as $vm_filtered_val) {
                         if (!is_array($vm_filtered_val)) {
                             $vm_filtered_val = array($vm_filtered_val);
                         }
                         foreach ($vm_filtered_val as $vs_val) {
                             if (in_array($vs_val, $va_filter_vals)) {
                                 // one match is enough to keep it
                                 $vb_keep = true;
                             }
                         }
                     }
                 }
                 if (!$vb_keep) {
                     unset($va_rels[$vn_pk]);
                 }
             }
         }
     }
     //
     // Sort on fields if specified
     //
     if (is_array($pa_sort_fields) && sizeof($pa_sort_fields) && sizeof($va_rels)) {
         $va_ids = $va_ids_to_rel_ids = array();
         $vs_rel_pk = $t_rel_item->primaryKey();
         foreach ($va_rels as $vn_i => $va_rel) {
             $va_ids[$vn_i] = $va_rel[$vs_rel_pk];
             $va_ids_to_rel_ids[$va_rel[$vs_rel_pk]][] = $vn_i;
         }
         if (sizeof($va_ids) > 0) {
             $qr_sort = caMakeSearchResult($vs_related_table_name, array_values($va_ids), array('sort' => $pa_sort_fields, 'sortDirection' => $ps_sort_direction));
             $va_rels_sorted = array();
             $vs_rel_pk_full = $t_rel_item->primaryKey(true);
             while ($qr_sort->nextHit()) {
                 foreach ($va_ids_to_rel_ids[$qr_sort->get($vs_rel_pk_full)] as $vn_rel_id) {
                     $va_rels_sorted[$vn_rel_id] = $va_rels[$vn_rel_id];
                 }
             }
             $va_rels = $va_rels_sorted;
         }
     }
     switch ($ps_return_as) {
         case 'firstmodelinstance':
             foreach ($va_rels as $vn_id) {
                 $o_instance = new $vs_related_table_name();
                 if ($o_instance->load($vn_id)) {
                     return $o_instance;
                 }
             }
             return null;
             break;
         case 'modelinstances':
             $va_instances = array();
             foreach ($va_rels as $vn_id) {
                 $o_instance = new $vs_related_table_name();
                 if ($o_instance->load($vn_id)) {
                     $va_instances[] = $o_instance;
                 }
             }
             return $va_instances;
             break;
         case 'firstid':
             if (sizeof($va_rels)) {
                 return array_shift($va_rels);
             }
             return null;
             break;
         case 'count':
             return sizeof($va_rels);
             break;
         case 'searchresult':
             if (sizeof($va_rels) > 0) {
                 return caMakeSearchResult($vs_related_table_name, $va_rels);
             }
             return null;
             break;
         default:
         case 'ids':
             return $va_rels;
             break;
     }
 }
开发者ID:samrahman,项目名称:providence,代码行数:101,代码来源:BundlableLabelableBaseModelWithAttributes.php


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