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


PHP ca_metadata_elements::setTransaction方法代码示例

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


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

示例1: getTemplatePlaceholderListForBundle

 /**
  * Returns list of valid template placeholders for the specified bundle. These placeholders always begin
  * with a caret ("^") and will be replaced with content values when a bundle display is rendered by xxx()
  * 
  * @param $ps_bundle_name - name of bundle
  * @return array - list of placeholders as keys; values are text description of value; will return null if bundle name is invalid
  */
 public function getTemplatePlaceholderListForBundle($ps_bundle_name)
 {
     $o_dm = $this->getAppDatamodel();
     $t_instance = null;
     $va_tmp = explode('.', $ps_bundle_name);
     switch (sizeof($va_tmp)) {
         case 2:
             $vs_table = $va_tmp[0];
             $vs_bundle = $va_tmp[1];
             if ($vs_bundle == 'rel') {
                 $vs_bundle = 'preferred_labels';
             }
             break;
         case 1:
             if (!($t_instance = $o_dm->getInstanceByTableName($va_tmp[0], true))) {
                 $vs_table = $o_dm->getTableName($this->get('table_num'));
                 $vs_bundle = $va_tmp[0];
             } else {
                 $vs_table = $va_tmp[0];
                 $vs_bundle = 'preferred_labels';
             }
             break;
         default:
             return null;
             break;
     }
     if (!$t_instance) {
         if (!($t_instance = $o_dm->getInstanceByTableName($vs_table, true))) {
             return null;
         }
     }
     $va_key = array('^label' => array('label' => _t('Placement label'), 'description' => _t('The label for this placement as defined in the placements settings. The value used will be adjusted to reflect the current user's locale.')));
     if ($t_instance->hasField($vs_bundle)) {
         // is intrinsic field
         $va_key["^{$vs_bundle}"] = array('label' => $t_instance->getFieldInfo($vs_bundle, 'LABEL'), 'description' => $t_instance->getFieldInfo($vs_bundle, 'DESCRIPTION'));
         return $va_key;
     }
     $va_element_codes = array_flip($t_instance->getApplicableElementCodes(null, false, false));
     if ($va_element_codes[$vs_bundle]) {
         $t_element = new ca_metadata_elements();
         if ($this->inTransaction()) {
             $t_element->setTransaction($this->getTransaction());
         }
         if ($t_element->load(array('element_code' => $vs_bundle))) {
             // is attribute
             $va_hier = $t_element->getElementsInSet();
             if (is_array($va_hier) && sizeof($va_hier) > 0) {
                 // is container with children
                 foreach ($va_hier as $va_node) {
                     if ($va_node['datatype'] == 0) {
                         continue;
                     }
                     // skip containers
                     $va_key['^' . $va_node['element_code']] = array('label' => $t_instance->getAttributeLabel($va_node['element_code']), 'description' => $t_instance->getAttributeDescription($va_node['element_code']));
                 }
                 return $va_key;
             }
             // is simple single-element attribute
             $va_key["^{$vs_bundle}"] = array('label' => $t_instance->getAttributeLabel($vs_bundle), 'description' => $t_instance->getAttributeDescription($vs_bundle));
             return $va_key;
         }
     }
     if ($vs_bundle == 'preferred_labels') {
         if ($t_label = $t_instance->getLabelTableInstance()) {
             foreach ($t_label->getFormFields() as $vs_field => $va_field_info) {
                 $va_key['^' . $vs_field] = array('label' => $va_field_info['LABEL'], 'description' => $va_field_info['DESCRIPTION']);
             }
             return $va_key;
         }
     }
     if ($vs_bundle == 'nonpreferred_labels') {
         if ($t_label = $t_instance->getLabelTableInstance()) {
             foreach ($t_label->getFormFields() as $vs_field => $va_field_info) {
                 $va_key['^' . $vs_field] = array('label' => $va_field_info['LABEL'], 'description' => $va_field_info['DESCRIPTION']);
             }
             return $va_key;
         }
     }
     if ($vs_bundle == 'ca_object_representations') {
         if ($vs_table == 'ca_objects') {
             $t_rep = new ca_object_representations();
             foreach ($t_rep->getFormFields() as $vs_field => $va_field_info) {
                 $va_key['^' . $vs_field] = array('label' => $va_field_info['LABEL'], 'description' => $va_field_info['DESCRIPTION']);
             }
             $va_key['^media:{version name}'] = array('label' => _t('Specified version of media'), 'description' => _t('The version of the media representation specified by {version name} for display.'));
             return $va_key;
         }
     }
     return null;
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:97,代码来源:ca_bundle_displays.php


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