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


PHP ca_lists::itemIsEnabled方法代码示例

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


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

示例1: insert

 /**
  * Override insert() to check type_id (or whatever the type key is called in the table as returned by getTypeFieldName())
  * against the ca_lists list for the table (as defined by getTypeListCode())
  */
 public function insert($pa_options = null)
 {
     if (!is_a($this, "BaseRelationshipModel")) {
         global $AUTH_CURRENT_USER_ID;
         $vb_we_set_transaction = false;
         if (!$this->inTransaction()) {
             $this->setTransaction(new Transaction($this->getDb()));
             $vb_we_set_transaction = true;
         }
         $this->opo_app_plugin_manager->hookBeforeBundleInsert(array('id' => null, 'table_num' => $this->tableNum(), 'table_name' => $this->tableName(), 'instance' => $this));
         $vb_web_set_change_log_unit_id = BaseModel::setChangeLogUnitID();
         // check that type_id is valid for this table
         $t_list = new ca_lists();
         $vn_type_id = $this->get($this->getTypeFieldName());
         $va_field_info = $this->getFieldInfo($this->getTypeFieldName());
         $vb_error = false;
         if ($this->getTypeFieldName() && !(!$vn_type_id && $va_field_info['IS_NULL'])) {
             if (!($vn_ret = $t_list->itemIsEnabled($this->getTypeListCode(), $vn_type_id))) {
                 $va_type_list = $this->getTypeList(array('directChildrenOnly' => false, 'returnHierarchyLevels' => true, 'item_id' => null));
                 if (!isset($va_type_list[$vn_type_id])) {
                     $this->postError(2510, _t("Type must be specified"), "BundlableLabelableBaseModelWithAttributes->insert()", $this->tableName() . '.' . $this->getTypeFieldName());
                 } else {
                     if (is_null($vn_ret)) {
                         $this->postError(2510, _t("<em>%1</em> is invalid", $va_type_list[$vn_type_id]['name_singular']), "BundlableLabelableBaseModelWithAttributes->insert()", $this->tableName() . '.' . $this->getTypeFieldName());
                     } else {
                         $this->postError(2510, _t("<em>%1</em> is not enabled", $va_type_list[$vn_type_id]['name_singular']), "BundlableLabelableBaseModelWithAttributes->insert()", $this->tableName() . '.' . $this->getTypeFieldName());
                     }
                 }
                 $vb_error = true;
             }
             if ($this->HIERARCHY_PARENT_ID_FLD && (bool) $this->getAppConfig()->get($this->tableName() . '_enforce_strict_type_hierarchy')) {
                 // strict means if it has a parent is can only have types that are direct sub-types of the parent's type
                 // and if it is the root of the hierarchy it can only take a top-level type
                 if ($vn_parent_id = $this->get($this->HIERARCHY_PARENT_ID_FLD)) {
                     // is child
                     $t_parent = $this->_DATAMODEL->getInstanceByTableName($this->tableName());
                     if ($t_parent->load($vn_parent_id)) {
                         $vn_parent_type_id = $t_parent->getTypeID();
                         $va_type_list = $t_parent->getTypeList(array('directChildrenOnly' => $this->getAppConfig()->get($this->tableName() . '_enforce_strict_type_hierarchy') == '~' ? false : true, 'childrenOfCurrentTypeOnly' => true, 'returnHierarchyLevels' => true));
                         if (!isset($va_type_list[$this->getTypeID()])) {
                             $va_type_list = $this->getTypeList(array('directChildrenOnly' => false, 'returnHierarchyLevels' => true, 'item_id' => null));
                             $this->postError(2510, _t("<em>%1</em> is not a valid type for a child record of type <em>%2</em>", $va_type_list[$this->getTypeID()]['name_singular'], $va_type_list[$vn_parent_type_id]['name_singular']), "BundlableLabelableBaseModelWithAttributes->insert()", $this->tableName() . '.' . $this->getTypeFieldName());
                             $vb_error = true;
                         }
                     } else {
                         // error - no parent?
                         $this->postError(2510, _t("No parent was found when verifying type of new child"), "BundlableLabelableBaseModelWithAttributes->insert()", $this->tableName() . '.' . $this->getTypeFieldName());
                         $vb_error = true;
                     }
                 } else {
                     // is root
                     $va_type_list = $this->getTypeList(array('directChildrenOnly' => true, 'item_id' => null));
                     if (!isset($va_type_list[$this->getTypeID()])) {
                         $va_type_list = $this->getTypeList(array('directChildrenOnly' => false, 'returnHierarchyLevels' => true, 'item_id' => null));
                         $this->postError(2510, _t("<em>%1</em> is not a valid type for a top-level record", $va_type_list[$this->getTypeID()]['name_singular']), "BundlableLabelableBaseModelWithAttributes->insert()", $this->tableName() . '.' . $this->getTypeFieldName());
                         $vb_error = true;
                     }
                 }
             }
         }
         if (!$this->_validateIncomingAdminIDNo(true, true)) {
             $vb_error = true;
         }
         if ($vb_error) {
             // push all attributes onto errored list
             $va_inserted_attributes_that_errored = array();
             foreach ($this->opa_attributes_to_add as $va_info) {
                 $va_inserted_attributes_that_errored[$va_info['element']][] = $va_info['values'];
             }
             foreach ($va_inserted_attributes_that_errored as $vs_element => $va_list) {
                 $this->setFailedAttributeInserts($vs_element, $va_list);
             }
             if ($vb_web_set_change_log_unit_id) {
                 BaseModel::unsetChangeLogUnitID();
             }
             if ($vb_we_set_transaction) {
                 $this->removeTransaction(false);
             }
             $this->_FIELD_VALUES[$this->primaryKey()] = null;
             // clear primary key set by BaseModel::insert()
             return false;
         }
         $this->_generateSortableIdentifierValue();
         // Process "access_inherit_from_parent" flag where supported
         if ((bool) $this->getAppConfig()->get($this->tableName() . '_allow_access_inheritance') && $this->hasField('access_inherit_from_parent')) {
             // Child record with inheritance set
             if ((bool) $this->get('access_inherit_from_parent') && ($vn_parent_id = $this->get('parent_id')) > 0) {
                 $t_parent = $this->getAppDatamodel()->getInstanceByTableNum($this->tableNum(), false);
                 if ($t_parent->load($vn_parent_id)) {
                     $this->set('access', $t_parent->set('access'));
                 }
             }
         }
     }
     // stash attributes to add
     $va_attributes_added = $this->opa_attributes_to_add;
//.........这里部分代码省略.........
开发者ID:idiscussforum,项目名称:providence,代码行数:101,代码来源:BundlableLabelableBaseModelWithAttributes.php


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