本文整理汇总了PHP中Horde_Form::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Form::__construct方法的具体用法?PHP Horde_Form::__construct怎么用?PHP Horde_Form::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde_Form
的用法示例。
在下文中一共展示了Horde_Form::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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']);
}
示例2: __construct
public function __construct($vars)
{
parent::__construct($vars, _("Add Users"));
$this->addHidden('', 'queue', 'int', true, true);
global $conf, $whups_driver;
$auth = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Auth')->create();
if ($auth->hasCapability('list')) {
$queue = $vars->get('queue');
$current = $whups_driver->getQueueUsers($queue);
try {
$list = $auth->listUsers();
sort($list);
$users = array();
foreach ($list as $user) {
if (!in_array($user, $current)) {
$users[$user] = $GLOBALS['registry']->convertUsername($user, false);
}
}
$this->addVariable(_("User"), 'user', 'multienum', true, false, null, array($users));
} catch (Horde_Auth_Exception $e) {
$this->addVariable(_("User"), 'user', 'invalid', true, false, null, array(sprintf(_("There was an error listing users: %s"), $e->getMessage())));
}
} else {
$this->addVariable(_("User"), 'user', 'text', true);
}
}
示例3: __construct
public function __construct($query, $vars)
{
parent::__construct($vars, _("Query Parameters"), 'Whups_Form_Query_Parameter');
foreach ($query->parameters as $name) {
$this->addVariable($name, $name, 'text', true);
}
}
示例4: __construct
public function __construct(&$vars, $title = '')
{
global $conf;
parent::__construct($vars, $title);
$this->addHidden('', 'id', 'int', true, true);
if (!$GLOBALS['registry']->getAuth()) {
$this->addVariable(_("Your Email Address"), 'user_email', 'email', true);
if (!empty($conf['guests']['captcha'])) {
$this->addVariable(_("Spam protection"), 'captcha', 'figlet', true, null, null, array(Whups::getCAPTCHA(!$this->isSubmitted()), $conf['guests']['figlet_font']));
}
}
$this->addVariable(_("Comment"), 'newcomment', 'longtext', false);
$this->addVariable(_("Attachment"), 'newattachment', 'file', false);
$this->addVariable(_("Watch this ticket"), 'add_watch', 'boolean', false);
/* Group restrictions. */
if ($GLOBALS['registry']->isAdmin(array('permission' => 'whups:admin')) || $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission('whups:hiddenComments', $GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) {
$groups = $GLOBALS['injector']->getInstance('Horde_Group');
$mygroups = $groups->listGroups($GLOBALS['registry']->getAuth());
if ($mygroups) {
foreach (array_keys($mygroups) as $gid) {
$grouplist[$gid] = $groups->getName($gid, true);
}
asort($grouplist);
$grouplist = array_merge(array(0 => _("This comment is visible to everyone")), $grouplist);
$this->addVariable(_("Make this comment visible only to members of a group?"), 'group', 'enum', true, false, null, array($grouplist));
}
}
}
示例5: __construct
public function __construct(&$vars)
{
parent::__construct($vars, _("Add Priority"));
$this->addHidden('', 'type', 'int', true, true);
$this->addVariable(_("Priority Name"), 'name', 'text', true);
$this->addVariable(_("Priority Description"), 'description', 'text', true);
}
示例6: __construct
public function __construct(&$vars, $title = '')
{
global $whups_driver;
parent::__construct($vars, $title);
$this->addHidden('', 'id', 'int', true, true);
$this->addHidden('', 'group', 'int', false, true);
$this->addHidden('', 'queue', 'int', true, true);
$this->addHidden('', 'newcomment', 'longtext', false, true);
/* Give the user an opportunity to check that type, version,
* etc. are still valid. */
$queue = $vars->get('queue');
$info = $whups_driver->getQueue($queue);
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);
}
$this->addVariable(_("Type"), 'type', 'enum', true, false, null, array($whups_driver->getTypes($queue)));
}
示例7: __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);
}
示例8: __construct
public function __construct(&$vars, $title = '')
{
parent::__construct($vars, $title);
$GLOBALS['page_output']->addScriptFile('form_helpers.js', 'horde');
$this->addHidden('', 'smart_id', 'text', false);
$this->addHidden('', 'actionID', 'text', false);
$vars->set('actionID', 'search_tasks');
$this->addVariable(_("Search Text:"), 'search_pattern', 'text', false);
$v = $this->addVariable(_("Search In:"), 'search_in', 'set', false, false, false, array('values' => array('search_name' => _("Name"), 'search_desc' => _("Description"))));
$v->setDefault(array('search_name', 'search_desc'));
$this->addVariable(_("Tagged with:"), 'search_tags', 'Nag:NagTags', false);
$v = $this->addVariable(_("Search:"), 'search_completed', 'radio', false, false, false, array('values' => array(Nag::VIEW_ALL => _("All"), Nag::VIEW_COMPLETE => _("Completed"), Nag::VIEW_INCOMPLETE => _("Incomplete"))));
$v->setDefault(Nag::VIEW_ALL);
$this->addVariable(_("Due date:"), 'due_date', 'Nag:NagSearchDue', false);
// If editing a SmartList, allow deletion.
if ($vars->get('smart_id')) {
$this->addVariable(_("SmartList Name:"), 'smartlist_name', 'text', false);
$this->setButtons(_("Save"), _("Reset"));
$this->appendButtons(array(array('value' => _("Delete Smart List"), 'name' => 'deletebutton', 'class' => 'horde-delete')));
} else {
$this->addVariable(_("Save this search as a Smart List?"), 'save_smartlist', 'boolean', false);
$sl_name = $this->addVariable(_("Smart List Name:"), 'smartlist_name', 'text', false);
$save_action = new Horde_Form_Action_ConditionalEnable(array('target' => 'save_smartlist', 'enabled' => true, 'values' => 'on'));
$sl_name->setAction($save_action);
$this->setButtons(_("Search"), _("Reset"));
}
}
示例9: __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"))));
}
示例10: __construct
public function __construct($vars)
{
parent::__construct($vars, _("Delete Query?"), 'Whups_Form_Query_Delete');
$yesno = array(array(0 => _("No"), 1 => _("Yes")));
$this->addVariable(_("Really delete this query? This operation is not undoable."), 'yesno', 'enum', true, false, null, $yesno);
$this->setButtons(array(array('class' => 'horde-delete', 'value' => _("Delete Query"))));
}
示例11: __construct
public function __construct(&$vars)
{
parent::__construct($vars, _("Insert Branch"));
$branchtypes = array(Whups_Query::TYPE_AND => _("And"), Whups_Query::TYPE_OR => _("Or"), Whups_Query::TYPE_NOT => _("Not"));
$this->addHidden(null, 'path', 'text', false, true);
$this->addVariable(_("Branch Type"), 'type', 'enum', true, false, null, array($branchtypes));
}
示例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, $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');
}
}
示例15: __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]);
}
}
}