本文整理汇总了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;
}
示例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;
}