本文整理汇总了PHP中Horde_Form类的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Form类的具体用法?PHP Horde_Form怎么用?PHP Horde_Form使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Horde_Form类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareImportForm
function prepareImportForm($p_variables, &$p_statement_file_variable)
{
$v_form = new Horde_Form($p_variables, 'Import Statement', 'import_statement');
$p_statement_file_variable = $v_form->addVariable('Statement File (CSV)', 'statement_file', 'file', TRUE);
$v_file_description = '<p>The file must conform to the CSV standard and contain only ' . 'printable, UTF-8 characters.</p>' . '<p>Fields are:</p>' . '<ul><li>Item ID (unique)</li><li>Account Name</li>' . '<li>Item Type (O: opening balance, E: event, C: closing balance)</li>' . '<li>Description</li><li>Amount</li></ul>';
$v_file_description_variable = $v_form->addVariable('', 'description', 'html', FALSE, TRUE);
$v_file_description_variable->setDefault($v_file_description);
$v_form->setButtons('import');
return $v_form;
}
示例2: renderActive
/**
* Renders the form for editing.
*
* @param Horde_Form_Renderer $renderer A renderer instance, optional
* since Horde 3.2.
* @param Variables $vars A Variables instance, optional
* since Horde 3.2.
* @param string $action The form action (url).
* @param string $method The form method, usually either
* 'get' or 'post'.
* @param string $enctype The form encoding type. Determined
* automatically if null.
* @param boolean $focus Focus the first form field?
*/
public function renderActive($renderer, $vars, $action, $method = 'get', $enctype = null, $focus = true)
{
if ($vars->get('old_datatype') === null) {
$this->_addParameters($vars);
}
parent::renderActive($renderer, $vars, $action, $method, $enctype, $focus);
}
示例3: 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;
}
示例4: __construct
public function __construct(&$vars)
{
parent::__construct($vars, _("Edit Attribute"));
$attribute = $vars->get('attribute');
$info = $GLOBALS['whups_driver']->getAttributeDesc($attribute);
$this->addHidden('', 'type', 'int', true, true);
$this->addHidden('', 'attribute', 'int', true, true);
$pname =& $this->addVariable(_("Attribute Name"), 'attribute_name', 'text', true);
$pname->setDefault($info['name']);
$pdesc =& $this->addVariable(_("Attribute Description"), 'attribute_description', 'text', true);
$pdesc->setDefault($info['description']);
$preq =& $this->addVariable(_("Required Attribute?"), 'attribute_required', 'boolean', false);
$preq->setDefault($info['required']);
$ptype =& $this->addVariable(_("Attribute Type"), 'attribute_type', 'enum', true, false, null, array(Whups::fieldTypeNames()));
$ptype->setAction(Horde_Form_Action::factory(array('whups', 'whups_reload'), array('formname' => 'whups_form_admin_editattributesteptwo_reload')));
$ptype->setDefault($info['type']);
$type = $vars->get('attribute_type');
if (empty($type)) {
$type = $info['type'];
}
foreach (Whups::fieldTypeParams($type) as $param => $param_info) {
$pparam =& $this->addVariable($param_info['label'], 'attribute_params[' . $param . ']', $param_info['type'], false);
if (isset($info['params'][$param])) {
$pparam->setDefault($info['params'][$param]);
}
}
}
示例5: __construct
public function __construct(&$vars)
{
global $whups_driver;
parent::__construct($vars, _("Create Ticket - Step 2"));
$types = $whups_driver->getTypes($vars->get('queue'));
$info = $whups_driver->getQueue($vars->get('queue'));
$type = $whups_driver->getDefaultType($vars->get('queue'));
if (count($types) == 0) {
$typetype = 'invalid';
$type_params = array(_("There are no ticket types associated with this queue; until there are, you cannot create any tickets in this queue."));
} else {
$typetype = 'enum';
$type_params = array($types);
if (empty($type) || !isset($types[$type])) {
$type_params[] = _("Choose:");
}
}
$types =& $this->addVariable(_("Ticket Type"), 'type', $typetype, true, false, null, $type_params);
$types->setDefault($type);
if (!empty($info['versioned'])) {
$versions = $whups_driver->getVersions($vars->get('queue'));
if (count($versions) == 0) {
$vtype = 'invalid';
$v_params = array(_("This queue requires that you specify a version, but there are no versions associated with it. Until versions are created for this queue, you will not be able to create tickets."));
} else {
$vtype = 'enum';
$v_params = array($versions);
}
$this->addVariable(_("Queue Version"), 'version', $vtype, true, false, null, $v_params);
} else {
$types->setAction(Horde_Form_Action::factory('submit'));
}
}
示例6: ServerSettings
function ServerSettings(&$vars)
{
parent::Horde_Form($vars);
$this->addHidden('', 'actionId', 'text', true);
$vars->set('actionId', 'serversettings');
$this->addVariable(_("Server Name"), 'servername', 'text', true);
$this->addVariable(_("Server Port"), 'port', 'int', false);
$this->addVariable(_("Player Password"), 'playerpass', 'text', false);
$this->addVariable(_("DM Password"), 'dmpass', 'text', false);
$this->addVariable(_("Maximum Clients"), 'maxclients', 'int', true);
$this->addVariable(_("Minimum Player Level"), 'minlevel', 'int', true);
$this->addVariable(_("Maximum Player Level"), 'maxlevel', 'int', true);
$this->addVariable(_("Pause And Play"), 'pauseandplay', 'enum', true, false, null, array(array('0' => 'DM Only', '1' => 'DM and Players')));
$this->addVariable(_("Player Vs Player"), 'pvp', 'enum', true, false, null, array(array('0' => 'None', '1' => 'Party Only', '2' => 'Free For All')));
$this->addVariable(_("Server Vault"), 'servervault', 'enum', true, false, null, array(array('0' => 'Local Characters Only', '1' => 'Server Characters Only')));
$this->addVariable(_("Enforce Legal Characters"), 'elc', 'enum', true, false, null, array(array('1' => 'Enforce Legal Characters', '0' => 'Any Characters')));
$this->addVariable(_("Item Level Restrictions"), 'ilr', 'enum', true, false, null, array(array('1' => 'Enforce Item Restrictions', '0' => 'Any Items')));
$this->addVariable(_("Game Type"), 'gametype', 'enum', true, false, null, array(array('0' => 'Action', '1' => 'Story', '2' => 'Story Lite', '3' => 'Role Play', '4' => 'Team', '5' => 'Melee', '6' => 'Arena', '7' => 'Aocial', '8' => 'Alternative', '9' => 'PW Action', '10' => 'PW Story', '11' => 'Solo', '12' => 'Tech Support')));
$this->addVariable(_("Parties"), 'oneparty', 'enum', true, false, null, array(array('0' => 'One Party', '1' => 'Multiple Parties')));
$this->addVariable(_("Difficulty"), 'difficulty', 'enum', true, false, null, array(array('1' => 'Easy', '2' => 'Normal', '3' => 'D&D Hardcore', '4' => 'Insane')));
$this->addVariable(_("Auto Save Interval"), 'autosaveinterval', 'int', true, false, _("In minutes, use 0 to disable"));
$this->addVariable(_("Persistence"), 'reloadwhenempty', 'enum', true, false, null, array(array('0' => 'Persistent Module', '1' => 'Reload When Empty')));
$this->addVariable(_("Server Visibility"), 'publicserver', 'enum', true, false, null, array(array('0' => 'Private', '1' => 'Public')));
$this->setTitle(_("Configure Server Settings"));
$this->setButtons(_("Update Config"));
}
示例7: __construct
public function __construct(&$vars)
{
parent::__construct($vars, _("Add Form Reply"));
$this->addHidden('', 'type', 'int', true, true);
$this->addVariable(_("Form Reply Name"), 'reply_name', 'text', true);
$this->addVariable(_("Form Reply Text"), 'reply_text', 'longtext', true);
}
示例8: __construct
public function __construct($vars, $title)
{
parent::__construct($vars, $title);
$this->setButtons(_("Save"), true);
try {
$sam_driver = $GLOBALS['injector']->getInstance('Sam_Driver');
} catch (Sam_Exception $e) {
return;
}
foreach ($this->_attributes as $key => $attribute) {
if (!$sam_driver->hasCapability($key)) {
continue;
}
$var = $this->addVariable($attribute, $key, 'longtext', false, false, null, array('5', '40'));
$var->setHelp($key);
if (!$vars->exists($key)) {
$vars->set($key, $sam_driver->getListOption($key));
}
}
if ($sam_driver->hasCapability('global_defaults') && $GLOBALS['registry']->isAdmin()) {
$this->addVariable('', '', 'spacer', false);
$var = $this->addVariable(_("Make Settings Global"), 'global_defaults', 'boolean', false);
$var->setHelp('global_defaults');
}
}
示例9: __construct
public function __construct(&$vars)
{
parent::__construct($vars, 'editjobtypestep2form');
$jobtype = $vars->get('jobtype');
try {
$info = $GLOBALS['injector']->getInstance('Hermes_Driver')->getJobTypeByID($jobtype);
} catch (Exception $e) {
}
if (!$info) {
$stype = 'invalid';
$type_params = array(_("This is not a valid job type."));
} else {
$stype = 'text';
$type_params = array();
}
$this->addHidden('', 'jobtype', 'int', true, true);
$sname =& $this->addVariable(_("Job Type"), 'name', $stype, true, false, null, $type_params);
if (!empty($info['name'])) {
$sname->setDefault($info['name']);
}
$enab =& $this->addVariable(_("Enabled?"), 'enabled', 'boolean', false);
$enab->setDefault($info['enabled']);
$enab =& $this->addVariable(_("Billable?"), 'billable', 'boolean', false);
$enab->setDefault($info['billable']);
$enab =& $this->addVariable(_("Hourly Rate"), 'rate', 'number', false);
$enab->setDefault($info['rate']);
}
示例10: __construct
public function __construct(&$vars)
{
parent::__construct($vars, _("Add Type"));
$this->appendButtons(_("Add Type"));
$this->addVariable(_("Type Name"), 'name', 'text', true);
$this->addVariable(_("Type Description"), 'description', 'text', true);
}
示例11: __construct
public function __construct($vars)
{
parent::__construct($vars, _("Create Address Book"));
$this->addVariable(_("Name"), 'name', 'text', true);
$this->addVariable(_("Description"), 'description', 'longtext', false, false, null, array(4, 60));
$this->setButtons(array(_("Create")));
}
示例12: __construct
public function __construct(&$vars)
{
parent::__construct($vars, 'editclientstep2form');
$client = $vars->get('client');
try {
$info = $GLOBALS['injector']->getInstance('Hermes_Driver')->getClientSettings($client);
} catch (Hermes_Exception $e) {
}
if (!$info) {
$stype = 'invalid';
$type_params = array(_("This is not a valid client."));
} else {
$stype = 'text';
$type_params = array();
}
$this->addHidden('', 'client', 'text', true, true);
$name =& $this->addVariable(_("Client"), 'name', $stype, false, true, null, $type_params);
$name->setDefault($info['name']);
$enterdescription =& $this->addVariable(sprintf(_("Should users enter descriptions of their timeslices for this client? If not, the description will automatically be \"%s\"."), _("See Attached Timesheet")), 'enterdescription', 'boolean', true);
if (!empty($info['enterdescription'])) {
$enterdescription->setDefault($info['enterdescription']);
}
$exportid =& $this->addVariable(_("ID for this client when exporting data, if different from the name displayed above."), 'exportid', 'text', false);
if (!empty($info['exportid'])) {
$exportid->setDefault($info['exportid']);
}
}
示例13: __construct
public function __construct(&$vars)
{
global $whups_driver, $conf;
parent::__construct($vars, _("Create Ticket - Step 4"));
/* Preserve previously uploaded attachments. */
$this->addHidden('', 'deferred_attachment', 'text', false);
/* Groups. */
$mygroups = $GLOBALS['injector']->getInstance('Horde_Group')->listAll($conf['prefs']['assign_all_groups'] ? null : $GLOBALS['registry']->getAuth());
asort($mygroups);
$users = $whups_driver->getQueueUsers($vars->get('queue'));
$f_users = array();
foreach ($users as $user) {
$f_users['user:' . $user] = Whups::formatUser($user);
}
$f_groups = array();
if (count($mygroups)) {
foreach ($mygroups as $id => $group) {
$f_groups['group:' . $id] = $group;
}
}
if (count($f_users)) {
asort($f_users);
$owners = $this->addVariable(_("Owners"), 'owners', 'multienum', false, false, null, array($f_users));
}
if (count($f_groups)) {
asort($f_groups);
$group_owners = $this->addVariable(_("Group Owners"), 'group_owners', 'multienum', false, false, null, array($f_groups));
}
if (!count($f_users) && !count($f_groups)) {
$owner_params = array(_("There are no users to which this ticket can be assigned."));
$this->addVariable(_("Owners"), 'owners', 'invalid', false, false, null, $owner_params);
}
}
示例14: __construct
public function __construct($vars, $calendar)
{
parent::__construct($vars, sprintf(_("Unsubscribe from %s"), $calendar['name']));
$this->addHidden('', 'url', 'text', true);
$this->addVariable(sprintf(_("Really unsubscribe from the calendar \"%s\" (%s)?"), htmlspecialchars($calendar['name']), htmlspecialchars($calendar['url'])), 'desc', 'description', false);
$this->setButtons(array(array('class' => 'horde-delete', 'value' => _("Unsubscribe")), array('class' => 'horde-cancel', 'value' => _("Cancel"))));
}
示例15: validate
public function validate(&$vars)
{
if (!Whups::hasPermission($this->_queue, 'queue', Horde_Perms::DELETE)) {
$this->setError('yesno', _("Permission Denied."));
}
return parent::validate($vars);
}