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


PHP caMakeTypeIDList函数代码示例

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


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

示例1: getListItemIDsByName

 /**
  *
  */
 public function getListItemIDsByName($pn_list_id, $ps_name, $pn_parent_id = null, $pn_type_id = null)
 {
     $o_db = $this->getDb();
     $va_params = array((int) $pn_list_id, (string) $ps_name, (string) $ps_name);
     $vs_type_sql = '';
     if ($pn_type_id) {
         if (sizeof($va_type_ids = caMakeTypeIDList('ca_list_items', array($pn_type_id)))) {
             $vs_type_sql = " AND cap.type_id IN (?)";
             $va_params[] = $va_type_ids;
         }
     }
     if ($pn_parent_id) {
         $vs_parent_sql = " AND cap.parent_id = ?";
         $va_params[] = (int) $pn_parent_id;
     }
     $qr_res = $o_db->query("\n\t\t\tSELECT DISTINCT cap.item_id\n\t\t\tFROM ca_list_items cap\n\t\t\tINNER JOIN ca_list_item_labels AS capl ON capl.item_id = cap.item_id\n\t\t\tWHERE\n\t\t\t\tcap.list_id = ? AND (capl.name_singular = ? OR capl.name_plural = ?) {$vs_type_sql} {$vs_parent_sql} AND cap.deleted = 0\n\t\t", $va_params);
     $va_item_ids = array();
     while ($qr_res->nextRow()) {
         $va_item_ids[] = $qr_res->get('item_id');
     }
     return $va_item_ids;
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:25,代码来源:ca_list_items.php

示例2: getAvailableVisualizations

 /**
  * Returns list of configured visualizations
  *
  * @param string $ps_table
  * @param array $pa_options Options are :
  *		restrictToTypes = optional list of types relevant to the specified table. Only unrestricted visualizations and visualizations restricted to the specified types will be included.
  *
  * @return array
  */
 public static function getAvailableVisualizations($ps_table, $pa_options = null)
 {
     $o_viz = new Visualizer();
     $o_viz_config = $o_viz->getVisualizationConfig();
     if (is_array($va_viz_list = $o_viz_config->getAssoc($ps_table))) {
         if (isset($pa_options['restrictToTypes']) && is_array($pa_options['restrictToTypes']) && sizeof($pa_options['restrictToTypes'])) {
             $va_filter_on_types = caMakeTypeIDList($ps_table, $pa_options['restrictToTypes']);
             foreach ($va_viz_list as $vs_code => $va_viz) {
                 if (isset($va_viz['restrictToTypes']) && is_array($va_viz['restrictToTypes']) && sizeof($va_viz['restrictToTypes'])) {
                     $va_types = caMakeTypeIDList($ps_table, $va_viz['restrictToTypes']);
                     if (sizeof(array_intersect($va_types, $va_filter_on_types)) == 0) {
                         unset($va_viz_list[$vs_code]);
                     }
                 }
             }
         }
     } else {
         return array();
     }
     return $va_viz_list;
 }
开发者ID:ffarago,项目名称:pawtucket2,代码行数:30,代码来源:Visualizer.php

示例3: getScreens

 /**
  * Returns list of screens for a given UI. 
  *
  * @param RequestHTTP $po_request The current request
  * @param int $pn_type_id Optional type to restrict screens to
  * @param array $pa_options Options include:
  *		showAll = Include screens that do not have placements. Default is false.
  *
  * @return array List of screens for this user interface
  */
 public function getScreens($po_request = null, $pn_type_id = null, $pa_options = null)
 {
     if (!$this->getPrimaryKey()) {
         return false;
     }
     $vs_opts_md5 = caMakeCacheKeyFromOptions($pa_options);
     if (!($t_instance = $this->_DATAMODEL->getInstanceByTableNum($this->get('editor_type')))) {
         return null;
     }
     if ($t_instance instanceof BaseRelationshipModel) {
         $va_types = $t_instance->getRelationshipTypes();
     } else {
         $va_types = $t_instance->getTypeList();
     }
     $o_db = $this->getDb();
     $va_type_list = caMakeTypeIDList($this->get('editor_type'), array($pn_type_id), array('dontIncludeSubtypesInTypeRestriction' => true));
     if (!sizeof($va_type_list)) {
         $va_type_list = array($pn_type_id);
     }
     $vs_type_sql = (int) $pn_type_id ? "AND (ceustr.type_id IS NULL OR ceustr.type_id IN (" . join(",", $va_type_list) . "))" : '';
     $qr_res = $o_db->query("\n\t\t\tSELECT ceus.*, ceusl.*, ceustr.type_id restriction_type_id\n\t\t\tFROM ca_editor_ui_screens ceus\n\t\t\tINNER JOIN ca_editor_ui_screen_labels AS ceusl ON ceus.screen_id = ceusl.screen_id\n\t\t\tLEFT JOIN ca_editor_ui_screen_type_restrictions AS ceustr ON ceus.screen_id = ceustr.screen_id\n\t\t\tWHERE\n\t\t\t\t(ceus.ui_id = ?) {$vs_type_sql}\n\t\t\tORDER BY \n\t\t\t\tceus.rank, ceus.screen_id\n\t\t", (int) $this->getPrimaryKey());
     $va_screens = array();
     while ($qr_res->nextRow()) {
         if (!$va_screens[$vn_screen_id = $qr_res->get('screen_id')][$vn_screen_locale_id = $qr_res->get('locale_id')]) {
             $va_screens[$vn_screen_id][$vn_screen_locale_id] = $qr_res->getRow();
             if ((bool) $va_screens[$vn_screen_id][$vn_screen_locale_id]['is_default']) {
                 $va_screens[$vn_screen_id][$vn_screen_locale_id]['isDefault'] = "◉";
             }
             $va_screens[$vn_screen_id][$vn_screen_locale_id]['numPlacements'] = sizeof($this->getScreenBundlePlacements($vn_screen_id));
         }
         if ($qr_res->get('restriction_type_id')) {
             $vs_key_to_add = $t_instance instanceof BaseRelationshipModel ? 'type_code' : 'name_plural';
             $va_screens[$vn_screen_id][$vn_screen_locale_id]['typeRestrictions'][$qr_res->get('restriction_type_id')] = $va_types[$qr_res->get('restriction_type_id')][$vs_key_to_add];
         }
     }
     $va_screens_with_bundles = null;
     if ((!isset($pa_options['showAll']) || !$pa_options['showAll']) && sizeof($va_screens)) {
         // Get placements for all screens, so we can filter screens without placements
         $qr_res = $o_db->query("\n\t\t\t\tSELECT screen_id, placement_id, bundle_name\n\t\t\t\tFROM ca_editor_ui_bundle_placements\n\t\t\t\tWHERE\n\t\t\t\t\tscreen_id IN (?)\n\t\t\t", array(array_keys($va_screens)));
         $vs_table = $t_instance->tableName();
         $va_screens_with_bundles = array();
         while ($qr_res->nextRow()) {
             $vn_screen_id = $qr_res->get('screen_id');
             if (isset($va_screens_with_bundles[$vn_screen_id])) {
                 continue;
             }
             if (caGetBundleAccessLevel($vs_table, $qr_res->get('bundle_name')) != __CA_BUNDLE_ACCESS_NONE__) {
                 $va_screens_with_bundles[$vn_screen_id] = true;
             }
         }
     }
     foreach ($va_screens as $vn_screen_id => $va_screen_labels_by_locale) {
         if (is_array($va_screens_with_bundles) && !isset($va_screens_with_bundles[$vn_screen_id])) {
             unset($va_screens[$vn_screen_id]);
             continue;
         }
         foreach ($va_screen_labels_by_locale as $vn_locale_id => $va_restriction_info) {
             if (!is_array($va_screens[$vn_screen_id][$vn_locale_id]['typeRestrictions'])) {
                 continue;
             }
             $va_screens[$vn_screen_id][$vn_locale_id]['typeRestrictionsForDisplay'] = join(', ', $va_screens[$vn_screen_id][$vn_locale_id]['typeRestrictions']);
         }
     }
     return caExtractValuesByUserLocale($va_screens);
 }
开发者ID:ffarago,项目名称:pawtucket2,代码行数:75,代码来源:ca_editor_uis.php

示例4: getRelationshipTypesBySubtype


//.........这里部分代码省略.........
                         // we pass the typename adjusted for direction in 'typename', so there's no need to include typename_reverse in the returned values
                         $vs_key = strlen($va_tmp['rank']) > 0 ? sprintf("%08d", (int) $va_tmp['rank']) . preg_replace('![^A-Za-z0-9_]+!', '_', $va_tmp['typename_reverse']) : preg_replace('![^A-Za-z0-9_]+!', '_', $va_tmp['typename_reverse']);
                         $va_tmp['direction'] = 'rtol';
                         $va_types[$vn_parent_id][$vs_subtype][$vs_key]['rtol_' . $va_row['type_id']][$va_row['locale_id']] = $va_tmp;
                     }
                     break;
             }
         }
         $va_types = $this->_processRelationshipHierarchy($vn_root_id, $va_hier, $va_types, 1);
         $va_processed_types = array('_type_map' => array());
         $va_subtype_lookups = array();
         foreach ($va_types as $vs_subtype => $va_types_by_subtype) {
             $va_types_by_locale = array();
             foreach ($va_types_by_subtype as $vs_key => $va_types_by_key) {
                 foreach ($va_types_by_key as $vs_k => $va_v) {
                     foreach ($va_v as $vs_k2 => $vs_v2) {
                         $va_types_by_locale[$vs_k][$vs_k2] = $vs_v2;
                     }
                 }
             }
             if (!$vb_dont_include_subtypes_in_type_restriction) {
                 // include mapping from parent type used in restriction to child types that inherit the binding
                 if ($vs_subtype != 'NULL' && (!isset($va_subtype_lookups[$vs_subtype]) || !$va_subtype_lookups[$vs_subtype])) {
                     $va_children = $t_list_item->getHierarchyChildren($vs_subtype, array('idsOnly' => true));
                     foreach ($va_children as $vn_child) {
                         $va_processed_types['_type_map'][$vn_child] = $vs_subtype;
                     }
                     $va_subtype_lookups[$vs_subtype] = true;
                 }
             }
             $va_processed_types[$vs_subtype] = caExtractValuesByUserLocale($va_types_by_locale, null, null, array('returnList' => true));
         }
     } else {
         // ----------------------------------------------------------------------------------------
         // regular relationship
         if (!in_array($ps_orientation, array($vs_left_table_name, $vs_right_table_name))) {
             return array();
         }
         while ($qr_res->nextRow()) {
             $va_row = $qr_res->getRow();
             $vn_parent_id = $va_row['parent_id'];
             $va_hier[$vn_parent_id][] = $va_row['type_id'];
             if ($ps_orientation == $vs_left_table_name) {
                 // right-to-left
                 // expand subtype
                 $va_subtypes_to_check = $va_row['sub_type_left_id'] > 0 ? caMakeTypeIDList($vs_left_table_name, array($va_row['sub_type_left_id'])) : null;
                 // skip type if it has a subtype set and it's not in our list
                 if (!(!$va_subtypes_to_check || sizeof(array_intersect($va_subtypes_to_check, $va_ancestor_ids)))) {
                     continue;
                 }
                 $vs_subtype = $va_row['sub_type_right_id'];
                 $vs_key = strlen($va_row['rank']) > 0 ? sprintf("%08d", (int) $va_row['rank']) . preg_replace('![^A-Za-z0-9_]+!', '_', $va_row['typename']) : preg_replace('![^A-Za-z0-9_]+!', '_', $va_row['typename']);
             } else {
                 // left-to-right
                 // expand subtype
                 $va_subtypes_to_check = $va_row['sub_type_right_id'] > 0 ? caMakeTypeIDList($vs_right_table_name, array($va_row['sub_type_right_id'])) : null;
                 // skip type if it has a subtype set and it's not in our list
                 if (!(!$va_subtypes_to_check || sizeof(array_intersect($va_subtypes_to_check, $va_ancestor_ids)))) {
                     continue;
                 }
                 $vs_subtype = $va_row['sub_type_left_id'];
                 $va_row['typename'] = $va_row['typename_reverse'];
                 $vs_key = strlen($va_row['rank']) > 0 ? sprintf("%08d", (int) $va_row['rank']) . preg_replace('![^A-Za-z0-9_]+!', '_', $va_row['typename_reverse']) : preg_replace('![^A-Za-z0-9_]+!', '_', $va_row['typename_reverse']);
             }
             unset($va_row['typename_reverse']);
             // we pass the typename adjusted for direction in '_display', so there's no need to include typename_reverse in the returned values
             if (!$vs_subtype) {
                 $vs_subtype = 'NULL';
             }
             $vn_type_id = $va_row['type_id'];
             $va_types[$vn_parent_id][$vs_subtype][$vs_key][$vn_type_id][$va_row['locale_id']] = $va_row;
         }
         $va_types = $this->_processRelationshipHierarchy($vn_root_id, $va_hier, $va_types, 1);
         $va_processed_types = array('_type_map' => array());
         $va_subtype_lookups = array();
         foreach ($va_types as $vs_subtype => $va_types_by_subtype) {
             $va_types_by_locale = array();
             foreach ($va_types_by_subtype as $vs_key => $va_types_by_key) {
                 foreach ($va_types_by_key as $vn_locale_id => $va_t) {
                     if (!is_array($va_types_by_locale[$vn_locale_id])) {
                         $va_types_by_locale[$vn_locale_id] = array();
                     }
                     $va_types_by_locale[$vn_locale_id] += $va_t;
                 }
             }
             if (!$vb_dont_include_subtypes_in_type_restriction) {
                 // include mapping from parent type used in restriction to child types that inherit the binding
                 if ($vs_subtype != 'NULL' && (!isset($va_subtype_lookups[$vs_subtype]) || !$va_subtype_lookups[$vs_subtype])) {
                     $va_children = $t_list_item->getHierarchyChildren($vs_subtype, array('idsOnly' => true));
                     foreach ($va_children as $vn_child) {
                         $va_processed_types['_type_map'][$vn_child] = $vs_subtype;
                     }
                     $va_subtype_lookups[$vs_subtype] = true;
                 }
             }
             $va_processed_types[$vs_subtype] = caExtractValuesByUserLocale($va_types_by_locale, null, null, array('returnList' => true));
         }
     }
     return $va_processed_types;
 }
开发者ID:ffarago,项目名称:pawtucket2,代码行数:101,代码来源:BaseRelationshipModel.php

示例5: array_combine

    $va_content_array = array_combine($content_id, $va_content);
    print "<h6>Hierarchy</h6><ul>";
    $vn_indent = 0;
    foreach ($va_content_array as $id => $content) {
        print "<li style='margin-left: {$vn_indent}px;'>" . caNavLink($this->request, $content, '', '', 'Detail', 'collections/' . $id) . "</li>";
        $vn_indent += 10;
    }
    print "</ul><div style='width:100%;clear:both;height:1px;'></div>";
}
if (is_array($va_collection_children_ids = $t_item->get('ca_collections.children.collection_id', array('returnAsArray' => true))) && sizeof($va_collection_children_ids)) {
    print "<h6>Content</h6>";
    $qr_children = caMakeSearchResult('ca_collections', $va_collection_children_ids);
    while ($qr_children->nextHit()) {
        $vn_collection_id = $qr_children->get('collection_id');
        print "<div>" . caNavLink($this->request, $qr_children->get('ca_collections.preferred_labels'), '', '', 'Detail', 'collections/' . $vn_collection_id) . "</div>";
        if (in_array($t_item->get('ca_collections.type_id'), caMakeTypeIDList('ca_collections', array('series', 'subseries', 'subsubseries')))) {
            //if (in_array($t_item->get('ca_collections.type_id'), caMakeTypeIDList('ca_collections', array('subseries')))) {
            if ($va_object_levels = $qr_children->get('ca_objects.object_id', array('returnAsArray' => true))) {
                $qr_objects = caMakeSearchResult('ca_objects', $va_object_levels);
                print "<table class='objectContents'>";
                while ($qr_objects->nextHit()) {
                    $vn_object_id = $qr_objects->get('ca_objects.object_id');
                    //$t_object = new ca_objects($va_object_level);
                    print "<tr>";
                    print "<td style='width:20px;'></td><td>Box: " . $qr_objects->get('ca_objects.location.box') . " </td><td>Folder: " . $qr_objects->get('ca_objects.location.folder') . "</td><td style='width:400px;'>" . caNavLink($this->request, $qr_objects->get('ca_objects.preferred_labels.name'), '', '', 'Detail', 'objects/' . $vn_object_id) . " (" . $qr_objects->get('ca_objects.description_public') . ($qr_objects->get('ca_objects.dimensions_as_text') ? ", " . $qr_objects->get('ca_objects.dimensions_as_text') : "") . ")</td>";
                    if ($qr_objects->get('ca_objects.dates.dates_value')) {
                        print "<td>" . $qr_objects->get('ca_objects.dates.dates_value') . "</td>";
                    } else {
                        print "<td>" . $qr_objects->get('ca_objects.dates.date_as_text') . "</td>";
                    }
                    print "</tr>";
开发者ID:kai-iak,项目名称:pawtucket2,代码行数:31,代码来源:ca_collections_default_html.php

示例6: getObjectIDsByName

 /**
  * Return object_ids for objects with labels exactly matching $ps_name
  *
  * @param string $ps_name The label value to search for
  * @param int $pn_parent_id Optional parent_id. If specified search is restricted to direct children of the specified parent object.
  * @param int $pn_type_id Optional type_id.
  * @return array An array of object_ids
  */
 public function getObjectIDsByName($ps_name, $pn_parent_id = null, $pn_type_id = null)
 {
     $o_db = $this->getDb();
     $va_params = array((string) $ps_name);
     $vs_type_sql = '';
     if ($pn_type_id) {
         if (sizeof($va_type_ids = caMakeTypeIDList('ca_objects', array($pn_type_id)))) {
             $vs_type_sql = " AND cap.type_id IN (?)";
             $va_params[] = $va_type_ids;
         }
     }
     if ($pn_parent_id) {
         $vs_parent_sql = " AND cap.parent_id = ?";
         $va_params[] = (int) $pn_parent_id;
     }
     $qr_res = $o_db->query($x = "\n\t\t\t\tSELECT DISTINCT cap.object_id\n\t\t\t\tFROM ca_objects cap\n\t\t\t\tINNER JOIN ca_object_labels AS capl ON capl.object_id = cap.object_id\n\t\t\t\tWHERE\n\t\t\t\t\tcapl.name = ? {$vs_type_sql} {$vs_parent_sql} AND cap.deleted = 0\n\t\t\t", $va_params);
     $va_object_ids = array();
     while ($qr_res->nextRow()) {
         $va_object_ids[] = $qr_res->get('object_id');
     }
     return $va_object_ids;
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:30,代码来源:ca_objects.php

示例7: Form

 /**
  * Generates a form for editing new or existing records. The form is rendered into the current view, inherited from ActionController
  *
  * @param array $pa_values An optional array of values to preset in the format, overriding any existing values in the model of the record being editing.
  * @param array $pa_options Array of options passed through to _initView
  *
  */
 public function Form($pa_values = null, $pa_options = null)
 {
     list($t_subject, $t_ui, $vn_parent_id, $vn_above_id) = $this->_initView($pa_options);
     $vs_field_name_prefix = $this->request->getParameter('fieldNamePrefix', pString);
     $vs_n = $this->request->getParameter('n', pString);
     if ($vn_parent_id = $this->request->getParameter('parent_id', pInteger)) {
         $this->opo_result_context->setParameter($t_subject->tableName() . '_last_parent_id', $vn_parent_id);
     }
     //
     // 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 (($vn_type_id = $t_subject->get('type_id')) && is_array($va_restrict_to_types) && !in_array($vn_type_id, $va_restrict_to_types)) {
         $this->response->setRedirect($this->request->config->get('error_display_url') . '/n/2560?r=' . urlencode($this->request->getFullUrlPath()));
         return;
     }
     if (is_array($pa_values)) {
         foreach ($pa_values as $vs_key => $vs_val) {
             $t_subject->set($vs_key, $vs_val);
         }
     }
     // Set "context" id from those editors that need to restrict idno lookups to within the context of another field value (eg. idno's for ca_list_items are only unique within a given list_id)
     if ($vn_parent_id > 0) {
         $t_parent = $this->opo_datamodel->getInstanceByTableName($this->ops_table_name);
         if ($t_parent->load($vn_parent_id)) {
             if ($vs_idno_context_field = $t_subject->getProperty('ID_NUMBERING_CONTEXT_FIELD')) {
                 $this->view->setVar('_context_id', $t_parent->get($vs_idno_context_field));
             }
             $t_subject->set('idno', $t_parent->get('idno'));
         }
     }
     // Get type
     if (!($vn_type_id = $this->request->getParameter($t_subject->getTypeFieldName(), pString))) {
         $vn_type_id = array_shift(caMakeTypeIDList($t_subject->tableName(), $this->request->config->getList('ca_objects_component_types'), array('dontIncludeSubtypesInTypeRestriction' => true)));
     }
     // Set type restrictions to component types
     $va_component_types = $this->request->config->getList('ca_objects_component_types');
     if (is_array($va_component_types) && sizeof($va_component_types) && !in_array('*', $va_component_types)) {
         $this->view->setVar('restrict_to_types', $va_component_types);
     }
     $this->request->setParameter('type_id', $vn_type_id);
     $t_subject->set('type_id', $vn_type_id);
     $t_ui = ca_editor_uis::loadDefaultUI($this->ops_table_name, $this->request, $vn_type_id);
     // Get default screen (this is all we show in the component editor, even if the UI has multiple screens)
     $va_nav = $t_ui->getScreensAsNavConfigFragment($this->request, $vn_type_id, $this->request->getModulePath(), $this->request->getController(), $this->request->getAction(), array(), array());
     $this->view->setVar('t_ui', $t_ui);
     $this->view->setVar('screen', $va_nav['defaultScreen']);
     $va_field_values = $t_subject->extractValuesFromRequest($va_nav['defaultScreen'], $this->request, array('ui_instance' => $t_ui, 'dontReturnSerialIdno' => true));
     // Set intrinsics
     if (is_array($va_field_values['intrinsic'])) {
         foreach ($va_field_values['intrinsic'] as $vs_f => $vs_v) {
             $t_subject->set($vs_f, $vs_v);
         }
     }
     $t_subject->set('idno', $t_parent->get('idno'));
     // Set attributes
     if (is_array($va_field_values['attributes'])) {
         foreach ($va_field_values['attributes'] as $vn_element_id => $va_attribute_values) {
             $t_subject->setFailedAttributeInserts($vn_element_id, $va_attribute_values);
         }
     }
     // Set preferred labels
     if (is_array($va_field_values['preferred_label'])) {
         $t_subject->setFailedPreferredLabelInserts($va_field_values['preferred_label']);
     }
     // Set nonpreferred labels
     if (is_array($va_field_values['nonpreferred_label'])) {
         $t_subject->setFailedNonPreferredLabelInserts($va_field_values['nonpreferred_label']);
     }
     // Set annotation properties
     if (is_array($va_field_values['annotation_properties']) && method_exists($t_subject, 'setPropertyValue')) {
         foreach ($va_field_values['annotation_properties'] as $vs_property => $vs_property_value) {
             $t_subject->setPropertyValue($vs_property, $vs_property_value);
         }
     }
     if (!$t_ui->getPrimaryKey()) {
         $this->notification->addNotification(_t('There is no configuration available for this editor. Check your system configuration and ensure there is at least one valid configuration for this type of editor.'), __NOTIFICATION_TYPE_ERROR__);
     }
     # Trigger "EditItem" hook
     $this->opo_app_plugin_manager->hookEditItem(array('id' => null, 'table_num' => $t_subject->tableNum(), 'table_name' => $t_subject->tableName(), 'instance' => $t_subject));
     // Set form unique identifiers
     $this->view->setVar('fieldNamePrefix', $_REQUEST['_formName']);
     $this->view->setVar('n', $vs_n);
     $this->view->setVar('q', $this->request->getParameter('q', pString));
     $this->view->setVar('default_parent_id', $this->opo_result_context->getParameter($t_subject->tableName() . '_last_parent_id'));
     $this->view->setVar('notifications', $this->notification->getNotifications());
     $this->render('component_html.php');
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:98,代码来源:ObjectComponentController.php

示例8: find

 /**
  * Find row(s) with fields having values matching specific values. 
  * Results can be returned as model instances, numeric ids or search results (when possible).
  *
  * Exact matching is performed using values in $pa_values. Partial and pattern matching are not supported. Searches may include
  * multiple fields with boolean AND and OR. For example, you can find ca_objects rows with idno = 2012.001 and access = 1 by passing the
  * "boolean" option as "AND" and $pa_values set to array("idno" => "2012.001", "access" => 1).
  * You could find all rows with either the idno or the access values by setting "boolean" to "OR"
  *
  * Keys in the $pa_values parameters must be valid fields in the table which the model sub-class represents. You may also search on preferred and
  * non-preferred labels by specified keys and values for label table fields in "preferred_labels" and "nonpreferred_labels" sub-arrays. For example:
  *
  * array("idno" => 2012.001", "access" => 1, "preferred_labels" => array("name" => "Luna Park at Night"))
  *
  * will find rows with the idno, access and preferred label values.
  *
  * LabelableBaseModelWithAttributes::find() is not a replacement for the SearchEngine. It is intended as a quick and convenient way to programatically fetch rows using
  * simple, clear cut criteria. If you need to fetch rows based upon an identifer or status value LabelableBaseModelWithAttributes::find() will be quicker and less code than
  * using the SearchEngine. For full-text searches, searches on attributes, or searches that require transformations or complex boolean operations use
  * the SearchEngine.
  *
  * @param array $pa_values An array of values to match. Keys are field names, metadata element codes or preferred_labels and /or nonpreferred_labels. This must be an array with at least one key-value pair where the key is a valid field name for the model. If you pass an integer instead of an array it will be used as the primary key value for the table; result will be returned as "firstModelInstance" unless the returnAs option is explicitly set.
  * @param array $pa_options Options are:
  *		transaction = optional Transaction instance. If set then all database access is done within the context of the transaction
  *		returnAs = what to return; possible values are:
  *			searchResult			= a search result instance (aka. a subclass of BaseSearchResult), when the calling subclass is searchable (ie. <classname>Search and <classname>SearchResult classes are defined) 
  *			ids						= an array of ids (aka. primary keys)
  *			modelInstances			= an array of instances, one for each match. Each instance is the same class as the caller, a subclass of BaseModel 
  *			firstId					= the id (primary key) of the first match. This is the same as the first item in the array returned by 'ids'
  *			firstModelInstance		= the instance of the first match. This is the same as the first instance in the array returned by 'modelInstances'
  *			count					= the number of matches
  *		
  *			The default is ids
  *	
  *		limit = if searchResult, ids or modelInstances is set, limits number of returned matches. Default is no limit
  *		boolean = determines how multiple field values in $pa_values are combined to produce the final result. Possible values are:
  *			AND						= find rows that match all criteria in $pa_values
  *			OR						= find rows that match any criteria in $pa_values
  *
  *			The default is AND
  *
  *		labelBoolean = determines how multiple field values in $pa_values['preferred_labels'] and $pa_values['nonpreferred_labels'] are combined to produce the final result. Possible values are:
  *			AND						= find rows that match all criteria in $pa_values['preferred_labels']/$pa_values['nonpreferred_labels']
  *			OR						= find rows that match any criteria in $pa_values['preferred_labels']/$pa_values['nonpreferred_labels']
  *
  *			The default is AND
  *
  *		sort = field to sort on. Must be in <table>.<field> format and be an intrinsic field in either the primary table or the label table. Sort order can be set using the sortDirection option.
  *		sortDirection = the direction of the sort. Values are ASC (ascending) and DESC (descending). [Default is ASC]
  *		allowWildcards = consider "%" as a wildcard when searching. Any term including a "%" character will be queried using the SQL LIKE operator. [Default is false]
  *		purify = process text with HTMLPurifier before search. Purifier encodes &, < and > characters, and performs other transformations that can cause searches on literal text to fail. If you are purifying all input (the default) then leave this set true. [Default is true]
  *		purifyWithFallback = executes the search with "purify" set and falls back to search with unpurified text if nothing is found. [Default is false]
  *		checkAccess = array of access values to filter results by; if defined only items with the specified access code(s) are returned. Only supported for <table_name>.hierarchy.preferred_labels and <table_name>.children.preferred_labels because these returns sets of items. For <table_name>.parent.preferred_labels, which returns a single row at most, you should do access checking yourself. (Everything here applies equally to nonpreferred_labels)
  *		restrictToTypes = Restrict returned items to those of the specified types. An array of list item idnos and/or item_ids may be specified. [Default is null]			 
  *
  * @return mixed Depending upon the returnAs option setting, an array, subclass of LabelableBaseModelWithAttributes or integer may be returned.
  */
 public static function find($pa_values, $pa_options = null)
 {
     $t_instance = null;
     $vs_table = get_called_class();
     if (!is_array($pa_values) && (int) $pa_values > 0) {
         $t_instance = new $vs_table();
         $pa_values = array($t_instance->primaryKey() => (int) $pa_values);
         if (!isset($pa_options['returnAs'])) {
             $pa_options['returnAs'] = 'firstModelInstance';
         }
     }
     if (!is_array($pa_values) || sizeof($pa_values) == 0) {
         return null;
     }
     $ps_return_as = caGetOption('returnAs', $pa_options, 'ids', array('forceLowercase' => true, 'validValues' => array('searchResult', 'ids', 'modelInstances', 'firstId', 'firstModelInstance', 'count')));
     $ps_boolean = caGetOption('boolean', $pa_options, 'and', array('forceLowercase' => true, 'validValues' => array('and', 'or')));
     $ps_label_boolean = caGetOption('labelBoolean', $pa_options, 'and', array('forceLowercase' => true, 'validValues' => array('and', 'or')));
     $ps_sort = caGetOption('sort', $pa_options, null);
     $pa_check_access = caGetOption('checkAccess', $pa_options, null);
     if (!$t_instance) {
         $t_instance = new $vs_table();
     }
     $vn_table_num = $t_instance->tableNum();
     $vs_table_pk = $t_instance->primaryKey();
     $va_sql_params = array();
     $vs_type_restriction_sql = '';
     if ($va_restrict_to_types = caGetOption('restrictToTypes', $pa_options, null)) {
         if (is_array($va_restrict_to_types = caMakeTypeIDList($vs_table, $va_restrict_to_types)) && sizeof($va_restrict_to_types)) {
             $vs_type_restriction_sql = " {$vs_table}." . $t_instance->getTypeFieldName() . " IN (?) AND ";
             $va_sql_params[] = $va_restrict_to_types;
         }
     }
     if (!($t_label = $t_instance->getLabelTableInstance())) {
         if ($t_instance->ATTRIBUTE_TYPE_ID_FLD && is_array($va_restrict_to_types) && sizeof($va_restrict_to_types)) {
             $pa_values[$t_instance->ATTRIBUTE_TYPE_ID_FLD] = $va_restrict_to_types;
         }
         return parent::find($pa_values, $pa_options);
     }
     $vs_label_table = $t_label->tableName();
     $vs_label_table_pk = $t_label->primaryKey();
     $vb_has_simple_fields = false;
     foreach ($pa_values as $vs_field => $vm_value) {
         if (!is_array($vm_value) && $t_instance->hasField($vs_field)) {
//.........这里部分代码省略.........
开发者ID:samrahman,项目名称:providence,代码行数:101,代码来源:LabelableBaseModelWithAttributes.php

示例9: getTypeListAsHTMLFormElement

 /**
  * Returns HTML <select> form element with type list
  *
  * @param string $ps_name The name of the returned form element
  * @param array $pa_attributes An optional array of HTML attributes to place into the returned <select> tag
  * @param array $pa_options An array of options. Supported options are anything supported by ca_lists::getListAsHTMLFormElement as well as:
  *		childrenOfCurrentTypeOnly = Returns only types below the current type
  *		restrictToTypes = Array of type_ids to restrict type list to
  * @return string HTML for list element
  */
 public function getTypeListAsHTMLFormElement($ps_name, $pa_attributes = null, $pa_options = null)
 {
     $t_list = new ca_lists();
     if (isset($pa_options['childrenOfCurrentTypeOnly']) && $pa_options['childrenOfCurrentTypeOnly']) {
         $pa_options['childrenOnlyForItemID'] = $this->get('type_id');
     }
     $pa_options['limitToItemsWithID'] = caGetTypeRestrictionsForUser($this->tableName(), $pa_options);
     if (isset($pa_options['restrictToTypes']) && is_array($pa_options['restrictToTypes'])) {
         $pa_options['restrictToTypes'] = caMakeTypeIDList($this->tableName(), $pa_options['restrictToTypes'], $pa_options);
         if (!$pa_options['limitToItemsWithID'] || !is_array($pa_options['limitToItemsWithID'])) {
             $pa_options['limitToItemsWithID'] = $pa_options['restrictToTypes'];
         } else {
             $pa_options['limitToItemsWithID'] = array_intersect($pa_options['limitToItemsWithID'], $pa_options['restrictToTypes']);
         }
     }
     return $t_list->getListAsHTMLFormElement($this->getTypeListCode(), $ps_name, $pa_attributes, $pa_options);
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:27,代码来源:BaseModelWithAttributes.php

示例10: _get


//.........这里部分代码省略.........
         if (method_exists($t_instance, "getSourceFieldName")) {
             $va_source_ids = caMergeSourceRestrictionLists($t_instance, $pa_options);
             $vs_source_id_fld = $t_instance->getSourceFieldName();
         } else {
             if (method_exists($t_instance, "getSubjectTableInstance")) {
                 $t_label_subj_instance = $t_instance->getSubjectTableInstance();
                 if (method_exists($t_label_subj_instance, "getSourceFieldName")) {
                     $va_source_ids = caMergeSourceRestrictionLists($t_label_subj_instance, $pa_options);
                     $vs_source_id_fld = 'item_source_id';
                 }
             }
         }
         if (is_array($va_source_ids) && sizeof($va_source_ids)) {
             $va_tmp = array();
             foreach ($va_value_list as $vn_id => $va_by_locale) {
                 foreach ($va_by_locale as $vn_locale_id => $va_values) {
                     foreach ($va_values as $vn_i => $va_value) {
                         if (!$va_value[$vs_source_id_fld ? $vs_source_id_fld : 'item_source_id'] || in_array($va_value[$vs_source_id_fld ? $vs_source_id_fld : 'item_source_id'], $va_source_ids)) {
                             $va_tmp[$vn_id][$vn_locale_id][$vn_i] = $va_value;
                         }
                     }
                 }
             }
             $va_value_list = $va_tmp;
         }
         // Exclude types (related)
         if (isset($pa_options['exclude_type']) && $pa_options['exclude_type']) {
             if (!isset($pa_options['exclude_types']) || !is_array($pa_options['exclude_types'])) {
                 $pa_options['exclude_types'] = array();
             }
             $pa_options['exclude_types'][] = $pa_options['exclude_type'];
         }
         if (isset($pa_options['exclude_types']) && is_array($pa_options['exclude_types'])) {
             $va_ids = caMakeTypeIDList($va_path_components['table_name'], $pa_options['exclude_types']);
             if (is_array($va_ids) && sizeof($va_ids) > 0) {
                 $va_tmp = array();
                 foreach ($va_value_list as $vn_id => $va_by_locale) {
                     foreach ($va_by_locale as $vn_locale_id => $va_values) {
                         foreach ($va_values as $vn_i => $va_value) {
                             if (!in_array($va_value[$vs_type_fld ? $vs_type_fld : 'item_type_id'], $va_type_ids)) {
                                 $va_tmp[$vn_id][$vn_locale_id][$vn_i] = $va_value;
                             }
                         }
                     }
                 }
                 $va_value_list = $va_tmp;
             }
         }
         // Handle 'relationship_typename' (related)
         $vb_get_relationship_typename = false;
         if ($va_path_components['field_name'] == 'relationship_typename') {
             $va_path_components['field_name'] = 'rel_type_id';
             $vb_get_relationship_typename = true;
         }
         if ($vb_return_as_array) {
             // return array (intrinsics or labels in primary or related table)
             if ($t_instance->hasField($va_path_components['field_name']) && $va_path_components['table_name'] === $t_instance->tableName()) {
                 // Intrinsic
                 $va_field_info = $t_instance->getFieldInfo($va_path_components['field_name']);
                 $vs_pk = $t_original_instance->primaryKey();
                 // Handle specific intrinsic types
                 switch ($va_field_info['FIELD_TYPE']) {
                     case FT_DATERANGE:
                     case FT_HISTORIC_DATERANGE:
                         foreach ($va_value_list as $vn_id => $va_values_by_locale) {
                             foreach ($va_values_by_locale as $vn_locale_id => $va_values) {
开发者ID:ffarago,项目名称:pawtucket2,代码行数:67,代码来源:SearchResult.php

示例11: getEntityIDsByName

 /**
  * Returns entity_id for entities with matching fore- and surnames
  *
  * @param string $ps_forename The forename to search for
  * @param string $ps_surnamae The surname to search for
  * @return array Entity_id's for matching entities
  */
 public function getEntityIDsByName($ps_forename, $ps_surname, $pn_parent_id = null, $pn_type_id = null)
 {
     $o_db = $this->getDb();
     $va_params = array((string) $ps_forename, (string) $ps_surname);
     $vs_type_sql = '';
     if ($pn_type_id) {
         if (sizeof($va_type_ids = caMakeTypeIDList('ca_entities', array($pn_type_id)))) {
             $vs_type_sql = " AND cae.type_id IN (?)";
             $va_params[] = $va_type_ids;
         }
     }
     if ($pn_parent_id) {
         $vs_parent_sql = " AND cae.parent_id = ?";
         $va_params[] = (int) $pn_parent_id;
     }
     $qr_res = $o_db->query("\n\t\t\tSELECT DISTINCT cae.entity_id\n\t\t\tFROM ca_entities cae\n\t\t\tINNER JOIN ca_entity_labels AS cael ON cael.entity_id = cae.entity_id\n\t\t\tWHERE\n\t\t\t\tcael.forename = ? AND cael.surname = ? {$vs_type_sql} {$vs_parent_sql} AND cae.deleted = 0\n\t\t", $va_params);
     $va_entity_ids = array();
     while ($qr_res->nextRow()) {
         $va_entity_ids[] = $qr_res->get('entity_id');
     }
     return $va_entity_ids;
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:29,代码来源:ca_entities.php

示例12: _getRestrictionSQL

 /**
  * General SQL query WHERE clauses and parameters to restrict queries to specific representation and/or relationship types
  */
 private function _getRestrictionSQL($ps_linking_table, $pn_id, $pa_options)
 {
     $va_restrict_to_types = caGetOption('restrictToTypes', $pa_options, caGetOption('restrict_to_types', $pa_options, null));
     $va_restrict_to_relationship_types = caGetOption('restrictToRelationshipTypes', $pa_options, caGetOption('restrict_to_relationship_types', $pa_options, null));
     $vs_filter_sql = '';
     $pa_params = array($pn_id);
     if ($va_restrict_to_relationship_types || $va_restrict_to_types) {
         if ($va_restrict_to_relationship_types && ($t_rel = $this->getAppDatamodel()->getInstanceByTableName($ps_linking_table, true)) && $t_rel->hasField('type_id')) {
             $va_restrict_to_relationship_types = caMakeRelationshipTypeIDList($ps_linking_table, $va_restrict_to_relationship_types);
             if (is_array($va_restrict_to_relationship_types) && sizeof($va_restrict_to_relationship_types)) {
                 $vs_filter_sql .= " AND (caoor.type_id IN (?))";
                 $pa_params[] = $va_restrict_to_relationship_types;
             }
         }
         if ($va_restrict_to_types) {
             $va_restrict_to_types = caMakeTypeIDList('ca_object_representations', $va_restrict_to_types);
             if (is_array($va_restrict_to_types) && sizeof($va_restrict_to_types)) {
                 $vs_filter_sql .= " AND (caor.type_id IN (?))";
                 $pa_params[] = $va_restrict_to_types;
             }
         }
     }
     return array('sql' => $vs_filter_sql, 'params' => $pa_params);
 }
开发者ID:samrahman,项目名称:providence,代码行数:27,代码来源:RepresentableBaseModel.php

示例13: __call

 /**
  *
  */
 public function __call($ps_function, $pa_args)
 {
     $o_config = caGetListingConfig();
     $ps_function = strtolower($ps_function);
     $ps_type = $this->request->getActionExtra();
     if (!($va_listing_info = caGetInfoForListingType($ps_function))) {
         // invalid listing type – throw error
         die("Invalid listing type");
     }
     MetaTagManager::setWindowTitle($this->request->config->get("app_display_name") . ": " . $va_listing_info["displayName"]);
     $o_dm = Datamodel::load();
     $ps_function = strtolower($ps_function);
     $vs_table = $va_listing_info['table'];
     $vs_search = caGetOption('search', $va_listing_info, '*');
     $vs_segment_by = caGetOption('segmentBy', $va_listing_info, '');
     $this->opo_result_context = new ResultContext($this->request, $vs_table, $this->ops_find_type);
     $this->opo_result_context->setAsLastFind();
     if (!($t_instance = $o_dm->getInstanceByTableName($vs_table, true))) {
         die("Invalid table");
     }
     if (!($o_browse = caGetBrowseInstance($vs_table))) {
         die("Invalid listing");
     }
     // Set browse facet group
     if ($vs_facet_group = caGetOption('browseFacetGroup', $va_listing_info, null)) {
         $o_browse->setFacetGroup($vs_facet_group);
     }
     $va_types = caGetOption('restrictToTypes', $va_listing_info, array(), array('castTo' => 'array'));
     $va_type_list = $t_instance->getTypeList();
     if (!is_array($va_types) || !sizeof($va_types)) {
         $va_types = array_keys($va_type_list);
     } else {
         $va_types = caMakeTypeIDList($vs_table, $va_types, array('dontIncludeSubtypesInTypeRestriction' => true));
     }
     $o_browse->addCriteria("_search", array($vs_search));
     $o_browse->setTypeRestrictions($va_types, array('dontExpandHierarchically' => true));
     $o_browse->execute(array('checkAccess' => $this->opa_access_values));
     //
     // Facets for search
     //
     $va_facets = $o_browse->getInfoForAvailableFacets();
     foreach ($va_facets as $vs_facet_name => $va_facet_info) {
         $va_facets[$vs_facet_name]['content'] = $o_browse->getFacetContent($vs_facet_name, array('checkAccess' => $this->opa_access_values));
     }
     $this->view->setVar('facets', $va_facets);
     //
     // Add criteria and execute
     //
     if ($vs_facet = $this->request->getParameter('facet', pString)) {
         $o_browse->addCriteria($vs_facet, array($vn_facet_id = $this->request->getParameter('id', pString)));
         $this->view->setVar('facet', $vs_facet);
         $this->view->setVar('facet_id', $vn_facet_id);
     }
     //
     // Sorting
     //
     $vb_sort_changed = false;
     if (!($ps_sort = $this->request->getParameter("sort", pString))) {
         if (!($ps_sort = $this->opo_result_context->getCurrentSort())) {
             if (is_array($va_sorts = caGetOption('sortBy', $va_listing_info, null))) {
                 $ps_sort = array_shift(array_keys($va_sorts));
                 $vb_sort_changed = true;
             }
         }
     } else {
         $vb_sort_changed = true;
     }
     if ($vb_sort_changed) {
         # --- set the default sortDirection if available
         $va_sort_direction = caGetOption('sortDirection', $va_listing_info, null);
         if ($ps_sort_direction = $va_sort_direction[$ps_sort]) {
             $this->opo_result_context->setCurrentSortDirection($ps_sort_direction);
         }
     }
     if (!($ps_sort_direction = $this->request->getParameter("direction", pString))) {
         if (!($ps_sort_direction = $this->opo_result_context->getCurrentSortDirection())) {
             $ps_sort_direction = 'asc';
         }
     }
     $this->opo_result_context->setCurrentSort($ps_sort);
     $this->opo_result_context->setCurrentSortDirection($ps_sort_direction);
     $va_sort_by = caGetOption('sortBy', $va_listing_info, null);
     $this->view->setVar('sortBy', is_array($va_sort_by) ? $va_sort_by : null);
     $this->view->setVar('sortBySelect', $vs_sort_by_select = is_array($va_sort_by) ? caHTMLSelect("sort", $va_sort_by, array('id' => "sort"), array("value" => $ps_sort)) : '');
     $this->view->setVar('sortControl', $vs_sort_by_select ? _t('Sort with %1', $vs_sort_by_select) : '');
     $this->view->setVar('sort', $ps_sort);
     $this->view->setVar('sort_direction', $ps_sort_direction);
     $va_lists = array();
     $va_res_list = array();
     $o_browse->execute(array('checkAccess' => $this->opa_access_values));
     $qr_res = $o_browse->getResults(array('sort' => $va_sort_by[$ps_sort], 'sort_direction' => $ps_sort_direction));
     while ($qr_res->nextHit()) {
         $vs_key = $qr_res->getWithTemplate($vs_segment_by);
         $va_lists[$vs_key][] = $va_res_list[] = $qr_res->getPrimaryKey();
     }
     foreach ($va_lists as $vs_key => $va_ids) {
         $va_lists[$vs_key] = caMakeSearchResult($vs_table, $va_ids);
//.........这里部分代码省略.........
开发者ID:kai-iak,项目名称:pawtucket2,代码行数:101,代码来源:ListingController.php

示例14: getTypeListAsHTMLFormElement

 /**
  * Returns HTML <select> form element with type list
  *
  * @param string $ps_name The name of the returned form element
  * @param array $pa_attributes An optional array of HTML attributes to place into the returned <select> tag
  * @param array $pa_options An array of options. Supported options are anything supported by ca_lists::getListAsHTMLFormElement as well as:
  *		childrenOfCurrentTypeOnly = Returns only types below the current type
  *		restrictToTypes = Array of type_ids to restrict type list to
  *		inUse = Return only types that are used by at least one record. [Default is false]
  *		checkAccess = Array of access values to filter returned values on. Available for any related table with an "access" field (ca_objects, ca_entities, etc.). If omitted no filtering is performed. [Default is null]
  * @return string HTML for list element
  */
 public function getTypeListAsHTMLFormElement($ps_name, $pa_attributes = null, $pa_options = null)
 {
     $t_list = new ca_lists();
     if (isset($pa_options['childrenOfCurrentTypeOnly']) && $pa_options['childrenOfCurrentTypeOnly']) {
         $pa_options['childrenOnlyForItemID'] = $this->get('type_id');
     }
     $pa_options['limitToItemsWithID'] = caGetTypeRestrictionsForUser($this->tableName(), $pa_options);
     if (caGetOption('inUse', $pa_options, false)) {
         $vs_access_sql = '';
         $va_sql_params = array();
         if (($va_check_access = caGetOption('checkAccess', $pa_options, null)) && is_array($va_check_access) && sizeof($va_check_access) && $this->hasField('access')) {
             array_walk($va_check_access, function (&$pm_item, $ps_key) {
                 $pm_item = (int) $pm_item;
             });
             $vs_access_sql = " AND (access IN (?))";
             $va_sql_params[] = $va_check_access;
             $qr_types_in_use = $this->getDb()->query("SELECT DISTINCT type_id FROM " . $this->tableName() . ($this->hasField('deleted') ? " WHERE deleted = 0 {$vs_access_sql}" : ""), $va_sql_params);
         }
         if (!is_array($pa_options['limitToItemsWithID'])) {
             $pa_options['limitToItemsWithID'] = array();
         }
         if ($qr_types_in_use->numRows() > 0) {
             $pa_options['limitToItemsWithID'] += $qr_types_in_use->getAllFieldValues('type_id');
         }
     }
     if (isset($pa_options['restrictToTypes']) && is_array($pa_options['restrictToTypes'])) {
         $pa_options['restrictToTypes'] = caMakeTypeIDList($this->tableName(), $pa_options['restrictToTypes'], $pa_options);
         if (!$pa_options['limitToItemsWithID'] || !is_array($pa_options['limitToItemsWithID'])) {
             $pa_options['limitToItemsWithID'] = $pa_options['restrictToTypes'];
         } else {
             $pa_options['limitToItemsWithID'] = array_intersect($pa_options['limitToItemsWithID'], $pa_options['restrictToTypes']);
         }
     }
     return $t_list->getListAsHTMLFormElement($this->getTypeListCode(), $ps_name, $pa_attributes, $pa_options);
 }
开发者ID:samrahman,项目名称:providence,代码行数:47,代码来源:BaseModelWithAttributes.php

示例15: getFacetContent


//.........这里部分代码省略.........
         case 'label':
             if (!($t_item = $this->opo_datamodel->getInstanceByTableName($vs_browse_table_name, true))) {
                 break;
             }
             if (!($t_label = $t_item->getLabelTableInstance())) {
                 break;
             }
             if (!is_array($va_restrict_to_types = $va_facet_info['restrict_to_types'])) {
                 $va_restrict_to_types = array();
             }
             $vs_item_pk = $t_item->primaryKey();
             $vs_label_table_name = $t_label->tableName();
             $vs_label_pk = $t_label->primaryKey();
             $vs_label_display_field = $t_item->getLabelDisplayField();
             $vs_label_sort_field = $t_item->getLabelSortField();
             $vs_where_sql = $vs_join_sql = '';
             $vb_needs_join = false;
             $va_where_sql = array();
             $va_joins = array();
             if ($vs_browse_type_limit_sql) {
                 $va_where_sql[] = $vs_browse_type_limit_sql;
             }
             if (isset($va_facet_info['preferred_labels_only']) && $va_facet_info['preferred_labels_only'] && $t_label->hasField('is_preferred')) {
                 $va_where_sql[] = "l.is_preferred = 1";
             }
             if (isset($pa_options['checkAccess']) && is_array($pa_options['checkAccess']) && sizeof($pa_options['checkAccess']) && $t_item->hasField('access')) {
                 $va_where_sql[] = "(" . $vs_browse_table_name . ".access IN (" . join(',', $pa_options['checkAccess']) . "))";
             }
             if ($t_item->hasField('deleted')) {
                 $va_where_sql[] = "(" . $vs_browse_table_name . ".deleted = 0)";
                 $vb_needs_join = true;
             }
             if (sizeof($va_restrict_to_types)) {
                 $va_restrict_to_type_ids = caMakeTypeIDList($vs_browse_table_name, $va_restrict_to_types, array('dont_include_subtypes_in_type_restriction' => true));
                 if (sizeof($va_restrict_to_type_ids)) {
                     $va_where_sql[] = "(" . $vs_browse_table_name . "." . $t_item->getTypeFieldName() . " IN (" . join(", ", $va_restrict_to_type_ids) . ")" . ($t_item->getFieldInfo('type_id', 'IS_NULL') ? " OR (" . $vs_browse_table_name . '.' . $t_item->getTypeFieldName() . " IS NULL)" : '') . ")";
                     $vb_needs_join = true;
                 }
             }
             if (sizeof($va_exclude_types)) {
                 $va_exclude_type_ids = caMakeTypeIDList($vs_browse_table_name, $va_exclude_types, array('dont_include_subtypes_in_type_restriction' => true));
                 if (sizeof($va_exclude_type_ids)) {
                     $va_where_sql[] = "(" . $vs_browse_table_name . "." . $t_item->getTypeFieldName() . " NOT IN (" . join(", ", $va_exclude_type_ids) . ")" . ($t_item->getFieldInfo('type_id', 'IS_NULL') ? " OR (" . $vs_browse_table_name . '.' . $t_item->getTypeFieldName() . " IS NULL)" : '') . ")";
                     $vb_needs_join = true;
                 }
             }
             if ($vb_needs_join) {
                 $va_joins[] = "INNER JOIN " . $vs_browse_table_name . " ON " . $vs_browse_table_name . "." . $t_item->primaryKey() . " = l." . $t_item->primaryKey();
             }
             if ($va_facet_info['relative_to']) {
                 if ($t_subject->hasField('deleted')) {
                     $va_where_sql[] = "(" . $t_subject->tableName() . ".deleted = 0)";
                 }
                 if ($va_relative_sql_data = $this->_getRelativeFacetSQLData($va_facet_info['relative_to'], $pa_options)) {
                     $va_joins = array_merge($va_joins, $va_relative_sql_data['joins']);
                     $va_where_sql = array_merge($va_where_sql, $va_relative_sql_data['wheres']);
                 }
             }
             if (sizeof($va_results)) {
                 if ($va_facet_info['relative_to']) {
                     $va_where_sql[] = $this->ops_browse_table_name . "." . $t_subject->primaryKey() . " IN (" . join(",", $va_results) . ")";
                 } else {
                     $va_where_sql[] = "l.{$vs_item_pk} IN (" . join(",", $va_results) . ")";
                 }
             }
             if ($this->opo_config->get('perform_item_level_access_checking')) {
开发者ID:kai-iak,项目名称:pawtucket2,代码行数:67,代码来源:BrowseEngine.php


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