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


PHP ca_lists::getPrimaryKey方法代码示例

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


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

示例1: caGetListID

/**
 * Fetch item_id for item with specified idno in list
 *
 * @param string $ps_list List code or list label
 * @return int list_id of list or null if no matching list was found
 */
function caGetListID($ps_list)
{
    $t_list = new ca_lists();
    if (is_numeric($ps_list)) {
        if ($t_list->load((int) $ps_list)) {
            return $t_list->getPrimaryKey();
        }
    }
    if ($t_list->load(array('list_code' => $ps_list))) {
        return $t_list->getPrimaryKey();
    }
    $t_label = new ca_list_labels();
    if ($t_label->load(array('name' => $ps_list))) {
        return $t_label->get('list_id');
    }
    return null;
}
开发者ID:guaykuru,项目名称:pawtucket,代码行数:23,代码来源:listHelpers.php

示例2: caGetListID

function caGetListID($ps_list)
{
    global $g_list_id_cache;
    if (isset($g_list_id_cache[$ps_list])) {
        return $g_list_id_cache[$ps_list];
    }
    $t_list = new ca_lists();
    if (is_numeric($ps_list)) {
        if ($t_list->load((int) $ps_list)) {
            return $g_list_id_cache[$ps_list] = $t_list->getPrimaryKey();
        }
    }
    if ($t_list->load(array('list_code' => $ps_list))) {
        return $g_list_id_cache[$ps_list] = $t_list->getPrimaryKey();
    }
    $t_label = new ca_list_labels();
    if ($t_label->load(array('name' => $ps_list))) {
        return $g_list_id_cache[$ps_list] = $t_label->get('list_id');
    }
    return $g_list_id_cache[$ps_list] = null;
}
开发者ID:ffarago,项目名称:pawtucket2,代码行数:21,代码来源:listHelpers.php

示例3: browseName

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

示例4: caGetListID

function caGetListID($ps_list, $pa_options = null)
{
    global $g_list_id_cache;
    if (isset($g_list_id_cache[$ps_list])) {
        return $g_list_id_cache[$ps_list];
    }
    $t_list = new ca_lists();
    if ($o_trans = caGetOption('transaction', $pa_options, null)) {
        $t_list->setTransaction($o_trans);
    }
    if (is_numeric($ps_list)) {
        if ($t_list->load((int) $ps_list)) {
            return $g_list_id_cache[$ps_list] = $t_list->getPrimaryKey();
        }
    }
    if ($t_list->load(array('list_code' => $ps_list))) {
        return $g_list_id_cache[$ps_list] = $t_list->getPrimaryKey();
    }
    $t_label = new ca_list_labels();
    if ($t_label->load(array('name' => $ps_list))) {
        return $g_list_id_cache[$ps_list] = $t_label->get('list_id');
    }
    return $g_list_id_cache[$ps_list] = null;
}
开发者ID:kai-iak,项目名称:pawtucket2,代码行数:24,代码来源:listHelpers.php

示例5: isDeletable

 /**
  * Check if currently loaded row is deletable
  */
 public function isDeletable($po_request)
 {
     // Is row loaded?
     if (!$this->getPrimaryKey()) {
         // this happens when a new list item is about to be created. in those cases we extract the list from the request.
         $vn_list_id = $this->_getListIDFromRequest($po_request);
     } else {
         $vn_list_id = $this->get('list_id');
     }
     if (!$vn_list_id) {
         return false;
     }
     $t_list = new ca_lists($vn_list_id);
     if (!$t_list->getPrimaryKey()) {
         return false;
     }
     return $t_list->isDeletable($po_request);
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:21,代码来源:ca_list_items.php

示例6: fetchAndImport

 private function fetchAndImport($pa_item_queue, $po_client, $pa_config, $pa_tables, $ps_code)
 {
     if (!is_array($pa_tables)) {
         $pa_tables = array();
     }
     $t_rel_type = new ca_relationship_types();
     $vs_base_url = $pa_config['baseUrl'];
     $o_dm = Datamodel::load();
     $t_locale = new ca_locales();
     $t_list = new ca_lists();
     $vn_source_id = $t_list->getItemIDFromList('object_sources', $pa_config['code']);
     $pn_rep_type_id = $t_list->getItemIDFromList('object_representation_types', 'front');
     foreach ($pa_item_queue as $vn_i => $va_item) {
         $vs_table = $va_item['table'];
         $va_import_relationships_from = $pa_config['importRelatedFor'][$va_item['table']];
         print "oo";
         print_r($va_import_relationships_from);
         $vn_id = $va_item['id'];
         if (!$vn_id) {
             print "[Notice] SKIP CAUSE NO ID ({$ps_code})\n";
             continue;
         }
         if (isset($this->opa_processed_records[$vs_table . '/' . $vn_id])) {
             continue;
         }
         $vs_idno = trim((string) $va_item['idno']);
         try {
             $o_xml = $po_client->getItem($vs_table, $vn_id)->get();
         } catch (exception $e) {
             print "[ERROR] While trying to get item information: " . $e->getMessage() . "\n";
             continue;
         }
         $o_item = $o_xml->getItem;
         $t_instance = $o_dm->getInstanceByTableName($vs_table, false);
         $t_instance_label = $t_instance->getLabelTableInstance();
         // Look for existing record
         $vb_skip = false;
         $vb_update = false;
         $vs_label_fld = $t_instance->getLabelDisplayField();
         $vs_label = (string) $o_item->preferred_labels->en_US->{$vs_label_fld};
         print "[Notice] Processing [{$vs_table}] {$vs_label} [{$vs_idno}] ({$ps_code})\n";
         $t_instance_label->clear();
         if ($vs_idno && ($vs_table == 'ca_objects' && $t_instance->load(array('idno' => $vs_idno)) || $vs_table != 'ca_objects' && $t_instance->load(array('idno' => $vs_idno)))) {
             if ($t_instance->hasField('deleted') && $t_instance->get('deleted') == 1) {
                 $t_instance->set('deleted', 0);
             }
             //print "[Notice] Update [{$vs_idno}] for {$vs_table} 'cause it already exists ({$ps_code})\n";
             if (!$t_instance->getPrimaryKey()) {
                 $vb_skip = true;
                 print "[ERROR] Could not load instance for [{$vs_idno}]\n";
             }
             $vb_update = true;
             $t_instance->setMode(ACCESS_WRITE);
             // Clear labels
             $t_instance->removeAllLabels();
             if ($t_instance->numErrors()) {
                 print "[ERROR] Could not remove labels for updating: " . join("; ", $t_instance->getErrors()) . "\n";
             }
             // Clear attributes
             $t_instance->removeAttributes(null, array('dontCheckMinMax' => true));
             if ($t_instance->numErrors()) {
                 print "[ERROR] Could not remove attributes for updating: " . join("; ", $t_instance->getErrors()) . "\n";
             }
             // Clear relationships
             if (is_array($va_import_relationships_from)) {
                 foreach ($va_import_relationships_from as $vs_rel_table => $va_table_info) {
                     $t_instance->removeRelationships($vs_rel_table);
                     if ($t_instance->numErrors()) {
                         print "[ERROR] Could not remove {$vs_rel_table} relationships for updating: " . join("; ", $t_instance->getErrors()) . "\n";
                     }
                 }
             }
             if ($t_instance->tableName() == 'ca_objects') {
                 //$t_instance->set('source_id', $vn_source_id);
             }
             $t_instance->update();
             if ($t_instance->numErrors()) {
                 print "[ERROR] Could not clear record for updating: " . join("; ", $t_instance->getErrors()) . "\n";
             }
         }
         // create new one
         if (!$vb_update) {
             $t_instance->clear();
             if ($t_instance->tableName() == 'ca_objects') {
                 //$t_instance->set('source_id', $vn_source_id);
             }
         }
         $t_instance->setMode(ACCESS_WRITE);
         // add intrinsics
         switch ($vs_table) {
             case 'ca_collections':
                 $va_intrinsics = array('status', 'access', 'idno');
                 break;
             case 'ca_occurrences':
                 $va_intrinsics = array('status', 'access', 'idno');
                 break;
             case 'ca_objects':
                 $va_intrinsics = array('status', 'access', 'idno');
                 break;
             case 'ca_entities':
//.........这里部分代码省略.........
开发者ID:guaykuru,项目名称:pawtucket,代码行数:101,代码来源:DataSynchronizer.php

示例7: processDisplays

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

示例8: setSetting

 /**
  * Set setting value 
  * (you must call insert() or update() to write the settings to the database)
  */
 public function setSetting($ps_setting, $pm_value)
 {
     if (!$this->isValidSetting($ps_setting)) {
         return null;
     }
     $va_setting_info = $this->getSettingInfo($ps_setting);
     if ($va_setting_info['displayType'] == DT_CHECKBOXES) {
         $pm_value = (int) $pm_value;
     }
     if (isset($va_setting_info['useRelationshipTypeList']) && $va_setting_info['useRelationshipTypeList'] || isset($va_setting_info['useList']) && $va_setting_info['useList'] || isset($va_setting_info['showLists']) && $va_setting_info['showLists'] || isset($va_setting_info['showVocabularies']) && $va_setting_info['showVocabularies']) {
         if (!is_array($pm_value)) {
             $pm_value = array($pm_value);
         }
         foreach ($pm_value as $vn_i => $vm_value) {
             if (trim($vm_value) && !is_numeric($vm_value)) {
                 // need to convert codes to ids
                 if ($vs_t = $va_setting_info['useRelationshipTypeList']) {
                     $t_rel = new ca_relationship_types();
                     $pm_value[$vn_i] = $t_rel->getRelationshipTypeID($vs_t, $vm_value);
                 } else {
                     if ($vs_l = $va_setting_info['useList']) {
                         // is a list
                         $t_list = new ca_lists();
                         $pm_value[$vn_i] = $t_list->getItemIDFromList($vs_l, $vm_value);
                     } else {
                         if ($va_setting_info['showLists'] || $va_setting_info['showVocabularies']) {
                             // is a list
                             $t_list = new ca_lists();
                             $vn_list_id = null;
                             if ($t_list->load(array('list_code' => $vm_value))) {
                                 $vn_list_id = $t_list->getPrimaryKey();
                             } else {
                                 if ($t_list->load((int) $vm_value)) {
                                     $vn_list_id = $t_list->getPrimaryKey();
                                 }
                             }
                             if ($vn_list_id) {
                                 $pm_value[$vn_i] = $vn_list_id;
                             }
                         } else {
                             if ($va_setting_info['showSortableBundlesFor']) {
                             }
                         }
                     }
                 }
             }
         }
     }
     $va_settings = $this->getSettings();
     if ($va_setting_info['formatType'] == FT_NUMBER) {
         $pm_value = (double) $pm_value;
     }
     $va_settings[$ps_setting] = $pm_value;
     $this->o_instance->set($this->ops_settings_field, $va_settings);
     return true;
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:60,代码来源:ModelSettings.php

示例9: caLoadULAN

/**
 * 
 *
 * @return string 
 */
function caLoadULAN($ps_path_to_ulan_data = null, $ps_path_to_ulan_config = null, $pa_options = null)
{
    require_once __CA_LIB_DIR__ . '/core/Db.php';
    require_once __CA_LIB_DIR__ . '/core/Configuration.php';
    require_once __CA_LIB_DIR__ . '/ca/Utils/DataMigrationUtils.php';
    require_once __CA_MODELS_DIR__ . '/ca_locales.php';
    require_once __CA_MODELS_DIR__ . '/ca_entities.php';
    require_once __CA_MODELS_DIR__ . '/ca_entities_x_entities.php';
    require_once __CA_MODELS_DIR__ . '/ca_lists.php';
    require_once __CA_MODELS_DIR__ . '/ca_list_items.php';
    require_once __CA_MODELS_DIR__ . '/ca_list_items_x_list_items.php';
    require_once __CA_MODELS_DIR__ . '/ca_relationship_types.php';
    $t = new Timer();
    $o_log = new KLogger(__CA_APP_DIR__ . '/log', KLogger::INFO);
    $va_parent_child_links = array();
    $va_item_item_links = array();
    $va_ulan_id_to_item_id = array();
    $o_log->logInfo("Starting import of Getty ULAN");
    define('__CA_DONT_DO_SEARCH_INDEXING__', true);
    $_ = new Zend_Translate('gettext', __CA_APP_DIR__ . '/locale/en_US/messages.mo', 'en_US');
    $t_locale = new ca_locales();
    $pn_en_locale_id = $t_locale->loadLocaleByCode('en_US');
    if (!($o_config = Configuration::load($ps_path_to_ulan_config))) {
        $o_log->logError("Could not load ULAN import configuration file");
        die("ERROR: Could not load ULAN import configuration\n");
    }
    $vs_ulan_import_mode = $o_config->get('ulan_import_target');
    $t_list = null;
    if ($vs_ulan_import_mode == 'ca_entities') {
        $va_ulan_types = $o_config->getAssoc('ulan_entity_types');
        $va_mapping = $o_config->getAssoc('ulan_entity_mapping');
    } elseif ($vs_ulan_import_mode == 'ca_list_items') {
        $va_ulan_types = $o_config->getAssoc('ulan_list_item_types');
        if (!($vs_ulan_list_code = $o_config->get('ulan_import_list'))) {
            $vs_ulan_list_code = 'ULAN';
        }
        // create vocabulary list record (if it doesn't exist already)
        $t_list = new ca_lists();
        if (!$t_list->load(array('list_code' => $vs_ulan_list_code))) {
            $t_list->setMode(ACCESS_WRITE);
            $t_list->set('list_code', $vs_ulan_list_code);
            $t_list->set('is_system_list', 0);
            $t_list->set('is_hierarchical', 1);
            $t_list->set('use_as_vocabulary', 1);
            $t_list->insert();
            if ($t_list->numErrors()) {
                $o_log->logError("Could not create list record for ULAN: " . join('; ', $t_list->getErrors()));
                die("ERROR: couldn't create ca_list row for ULAN: " . join('; ', $t_list->getErrors()) . "\n");
            }
            $t_list->addLabel(array('name' => 'Union List of Artist Names'), $pn_en_locale_id, null, true);
        }
        $vn_list_id = $t_list->getPrimaryKey();
        $va_mapping = $o_config->getAssoc('ulan_list_item_mapping');
    } else {
        $o_log->logError("Invalid ULAN import mode {$vs_ulan_import_mode}");
        die("ERROR: invalid ULAN import mode {$vs_ulan_import_mode}\n");
    }
    $vn_last_message_length = 0;
    $vn_term_count = 0;
    $va_subject = array();
    foreach (array('ULAN1.xml', 'ULAN2.xml', 'ULAN3.xml') as $vs_file) {
        if (!$ps_path_to_ulan_data) {
            $ps_path_to_ulan_data = ".";
        }
        if (!file_exists($ps_path_to_ulan_data . "/{$vs_file}")) {
            $o_log->logError("Could not find ULAN data file {$vs_file}");
            print "[ERROR] cannot find ULAN data.\n";
            continue;
        }
        $o_log->logInfo("Processing ULAN file {$vs_file}");
        print "[Notice] Processing ULAN file {$vs_file}\n";
        // load
        $o_xml = new XMLReader();
        $o_xml->open($ps_path_to_ulan_data . '/' . $vs_file);
        while ($o_xml->read()) {
            switch ($o_xml->name) {
                # ---------------------------
                case 'Subject':
                    if ($o_xml->nodeType == XMLReader::END_ELEMENT) {
                        if (in_array($va_subject['subject_id'], array('500000000', '500000001'))) {
                            break;
                        }
                        // skip top-level root
                        $vs_preferred_term = $va_subject['preferred_term'];
                        $pb_is_enabled = false;
                        switch ($va_subject['record_type']) {
                            case 'Person':
                            default:
                                $vn_type_id = $va_ulan_types['Person'];
                                $pb_is_enabled = true;
                                break;
                            case 'Corporate Body':
                                $vn_type_id = $va_ulan_types['Corporate Body'];
                                $pb_is_enabled = true;
                                break;
//.........这里部分代码省略.........
开发者ID:idiscussforum,项目名称:providence,代码行数:101,代码来源:supportHelpers.php

示例10: _genTypeNav

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

示例11: join

// Create list for place types (if it doesn't exist already)
$t_place_types = new ca_lists();
if (!$t_place_types->load(array('list_code' => 'tgn_place_types'))) {
    $t_place_types->setMode(ACCESS_WRITE);
    $t_place_types->set('list_code', 'tgn_place_types');
    $t_place_types->set('is_system_list', 1);
    $t_place_types->set('is_hierarchical', 1);
    $t_place_types->set('use_as_vocabulary', 1);
    $t_place_types->insert();
    if ($t_place_types->numErrors()) {
        print "[Error] couldn't create ca_list row for place types: " . join('; ', $t_place_types->getErrors()) . "\n";
        die;
    }
    $t_place_types->addLabel(array('name' => 'Getty TGN place types'), $pn_en_locale_id, null, true);
}
$vn_place_type_list_id = $t_place_types->getPrimaryKey();
// load places
$o_xml = new XMLReader();
print "[Notice] READING TGN TERMS...\n";
$vn_last_message_length = 0;
$vn_term_count = 0;
$t_place = new ca_places();
$t_place->setMode(ACCESS_WRITE);
$t_place->logChanges(false);
// Don't log changes to records during import – takes time and we don't need the logs
if (true) {
    for ($vn_file_index = 1; $vn_file_index <= 15; $vn_file_index++) {
        $o_xml->open("tgn_xml_12/TGN{$vn_file_index}.xml");
        print "\n[Notice] READING TERMS FROM TGN{$vn_file_index}.xml...\n";
        while ($o_xml->read()) {
            switch ($o_xml->name) {
开发者ID:idiscussforum,项目名称:providence,代码行数:31,代码来源:import_tgn.php

示例12: getListCode

 /**
  * Converts list specifier (code or list_id) into a list_id
  *
  * @param mixed $pm_list_name_or_id List code or list_id
  * @return int list for the specified list, or null if the list does not exist
  */
 static function getListCode($pm_list_name_or_id)
 {
     if (ca_lists::$s_list_code_cache[$pm_list_name_or_id]) {
         return ca_lists::$s_list_code_cache[$pm_list_name_or_id];
     }
     if (!is_numeric($pm_list_name_or_id)) {
         return $pm_list_name_or_id;
     } else {
         $t_list = new ca_lists();
         if (!$t_list->load((int) $pm_list_name_or_id)) {
             return null;
         }
         $vn_list_id = $t_list->getPrimaryKey();
         $vs_list_code = $t_list->get('list_code');
     }
     return ca_lists::$s_list_code_cache[$vn_list_id] = $vs_list_code;
 }
开发者ID:ffarago,项目名称:pawtucket2,代码行数:23,代码来源:ca_lists.php

示例13: getListCode

 /**
  * Converts list specifier (code or list_id) into a list_id
  *
  * @param mixed $pm_list_name_or_id List code or list_id
  * @return int list for the specified list, or null if the list does not exist
  */
 static function getListCode($pm_list_name_or_id, $pa_options = null)
 {
     if (ca_lists::$s_list_code_cache[$pm_list_name_or_id]) {
         return ca_lists::$s_list_code_cache[$pm_list_name_or_id];
     }
     if (!is_numeric($pm_list_name_or_id)) {
         return $pm_list_name_or_id;
     } else {
         $t_list = new ca_lists();
         $o_trans = caGetOption('transaction', $pa_options, null);
         if ($o_trans) {
             $t_list->setTransaction($o_trans);
         }
         if (!$t_list->load((int) $pm_list_name_or_id)) {
             return null;
         }
         $vn_list_id = $t_list->getPrimaryKey();
         $vs_list_code = $t_list->get('list_code');
     }
     return ca_lists::$s_list_code_cache[$vn_list_id] = $vs_list_code;
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:27,代码来源:ca_lists.php

示例14: _genTypeNav

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

示例15: _getChangeLogFromRawData


//.........这里部分代码省略.........
                                                 $vs_proc_val = $t_rel_obj->getLabelForDisplay(false);
                                             } else {
                                                 $va_disp_fields = $t_rel_obj->getProperty('LIST_FIELDS');
                                                 foreach ($va_disp_fields as $vs_display_field) {
                                                     if (($vs_tmp = $t_rel_obj->get($vs_display_field)) !== '') {
                                                         $va_rel_values[] = $vs_tmp;
                                                     }
                                                 }
                                                 $vs_proc_val = join(' ', $va_rel_values);
                                             }
                                             if (!$vs_proc_val) {
                                                 $vs_proc_val = '???';
                                             }
                                         } else {
                                             $vs_proc_val = _t("Not set");
                                         }
                                     } else {
                                         $vs_proc_val = _t('Non-existent');
                                     }
                                 } else {
                                     // Adjust display of value for different field types
                                     switch ($va_field_info['FIELD_TYPE']) {
                                         case FT_BIT:
                                             $vs_proc_val = $vs_value ? 'Yes' : 'No';
                                             break;
                                         default:
                                             $vs_proc_val = $vs_value;
                                             break;
                                     }
                                     // Adjust display of value for lists
                                     if ($va_field_info['LIST']) {
                                         $t_list = new ca_lists();
                                         if ($t_list->load(array('list_code' => $va_field_info['LIST']))) {
                                             $vn_list_id = $t_list->getPrimaryKey();
                                             $t_list_item = new ca_list_items();
                                             if ($t_list_item->load(array('list_id' => $vn_list_id, 'item_value' => $vs_value))) {
                                                 $vs_proc_val = $t_list_item->getLabelForDisplay();
                                             }
                                         }
                                     } else {
                                         if ($va_field_info['BOUNDS_CHOICE_LIST']) {
                                             // TODO
                                         }
                                     }
                                 }
                             }
                             $va_changes[] = array('label' => $va_field_info['LABEL'], 'description' => strlen((string) $vs_proc_val) ? $vs_proc_val : $vs_blank_placeholder, 'value' => $vs_value);
                         }
                     }
                     // ---------------------------------------------------------------
                     // is this a label row?
                     if ($va_log_entry['logged_table_num'] == $vn_label_table_num) {
                         foreach ($va_log_entry['snapshot'] as $vs_field => $vs_value) {
                             $va_changes[] = array('label' => $t_item_label->getFieldInfo($vs_field, 'LABEL'), 'description' => $vs_value);
                         }
                     }
                     // ---------------------------------------------------------------
                     // is this an attribute?
                     if ($va_log_entry['logged_table_num'] == 3) {
                         // attribute_values
                         if ($t_element = ca_attributes::getElementInstance($va_log_entry['snapshot']['element_id'])) {
                             if ($o_attr_val = Attribute::getValueInstance($t_element->get('datatype'))) {
                                 $o_attr_val->loadValueFromRow($va_log_entry['snapshot']);
                                 $vs_attr_val = $o_attr_val->getDisplayValue();
                             } else {
                                 $vs_attr_val = '?';
开发者ID:kai-iak,项目名称:pawtucket2,代码行数:67,代码来源:ApplicationChangeLog.php


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