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


PHP Horde_Form::getType方法代码示例

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


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

示例1: getMetaData

 /**
  * Return the metadata for the table.
  *
  * @return array  An array of the table metadata.
  * @throws Hermes_Exception
  */
 public function getMetaData()
 {
     if (is_null($this->_metaData)) {
         list($app, $name) = explode('/', $this->_config['name']);
         $args = array($name, $this->_config['params']);
         $this->_metaData = $GLOBALS['registry']->callByPackage($app, 'getTableMetaData', $args);
         // We need to make vars for the columns.
         foreach ($this->_metaData['sections'] as $secname => $section) {
             foreach ($section['columns'] as $col) {
                 $title = isset($col['title']) ? $col['title'] : '';
                 $typename = isset($col['type']) ? $col['type'] : 'text';
                 $params = isset($col['params']) ? $col['params'] : array();
                 // Column types which begin with % are pseudo-types handled
                 // directly.
                 if (substr($typename, 0, 1) != '%') {
                     // This type needs to be assigned by reference!
                     $type =& Horde_Form::getType($typename, $params);
                     $var = new Horde_Form_Variable($title, $col['name'], $type, false, true, '');
                     $this->_formVars[$secname][$col['name']] = $var;
                 }
             }
         }
     }
     return $this->_metaData;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:31,代码来源:Table.php

示例2: getHistory

 /**
  * Fetch ticket history
  *
  * @param integer $ticket_id  The ticket to fetch history for.
  *
  * @return array
  */
 public function getHistory($ticket_id, Horde_Form $form = null)
 {
     $rows = $this->_getHistory($ticket_id);
     $attributes = $attributeDetails = array();
     foreach ($rows as $row) {
         if ($row['log_type'] == 'attribute' && strpos($row['log_value'], ':')) {
             $attributes[(int) $row['log_value']] = $row['attribute_name'];
         }
         if ($row['log_type'] == 'type') {
             $attributeDetails += $this->getAttributesForType($row['log_value']);
         }
     }
     $renderer = new Horde_Core_Ui_VarRenderer_Html();
     $history = array();
     foreach ($rows as $row) {
         $label = null;
         $human = $value = $row['log_value'];
         $type = $row['log_type'];
         $transaction = $row['transaction_id'];
         $history[$transaction]['timestamp'] = $row['timestamp'];
         $history[$transaction]['user_id'] = $row['user_id'];
         $history[$transaction]['ticket_id'] = $row['ticket_id'];
         switch ($type) {
             case 'comment':
                 $history[$transaction]['comment'] = $row['comment_text'];
                 $history[$transaction]['changes'][] = array('type' => 'comment', 'value' => $row['log_value'], 'comment' => $row['comment_text']);
                 continue 2;
             case 'queue':
                 $label = $row['queue_name'];
                 break;
             case 'version':
                 $label = $row['version_name'];
                 break;
             case 'type':
                 $label = $row['type_name'];
                 break;
             case 'state':
                 $label = $row['state_name'];
                 break;
             case 'priority':
                 $label = $row['priority_name'];
                 break;
             case 'attribute':
                 continue 2;
             case 'due':
                 $label = $row['log_value_num'];
                 break;
             default:
                 if (strpos($type, 'attribute_') === 0) {
                     try {
                         $value = Horde_Serialize::unserialize($value, Horde_Serialize::JSON);
                     } catch (Horde_Serialize_Exception $e) {
                     }
                     $attribute = substr($type, 10);
                     if (isset($attributes[$attribute])) {
                         $label = $attributes[$attribute];
                         if ($form) {
                             if (isset($form->attributes[$attribute])) {
                                 /* Attribute is part of the current type, so we
                                  * have the form field in the current form. */
                                 $field = $form->attributes[$attribute];
                             } else {
                                 /* Attribute is from a different type, create
                                  * the form field manually. */
                                 $detail = $attributeDetails[$attribute];
                                 $field = new Horde_Form_Variable($detail['human_name'], $type, $form->getType($detail['type'], $detail['params']), $detail['required'], $detail['readonly'], $detail['desc']);
                             }
                             $human = $renderer->render($form, $field, new Horde_Variables(array($type => $value)));
                         }
                         $type = 'attribute';
                     } else {
                         $label = sprintf(_("Attribute %d"), $attribute);
                     }
                 }
                 break;
         }
         $history[$transaction]['changes'][] = array('type' => $type, 'value' => $value, 'human' => $human, 'label' => $label);
     }
     return $history;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:87,代码来源:Driver.php


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