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


PHP Whups类代码示例

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


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

示例1: _title

 /**
  */
 protected function _title()
 {
     if (($query = $this->_getQuery()) && $query->name) {
         return Horde::link(Whups::urlFor('query', empty($query->slug) ? array('id' => $query->id) : array('slug' => $query->slug))) . htmlspecialchars($query->name) . '</a>';
     }
     return $this->getName();
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:9,代码来源:Query.php

示例2: __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]);
         }
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:27,代码来源:EditAttributeStepTwo.php

示例3: validate

 public function validate(&$vars)
 {
     if (Whups::hasPermission($this->_queue, 'queue', Horde_Perms::DELETE)) {
         $this->_warn->setDefault('<span class="horde-form-error">' . _("Permission Denied.") . '</span>');
     }
     return parent::validate($vars);
 }
开发者ID:horde,项目名称:horde,代码行数:7,代码来源:Delete.php

示例4: validate

 public function validate(&$vars)
 {
     if (!Whups::hasPermission($this->_queue, 'queue', Horde_Perms::DELETE)) {
         $this->setError('yesno', _("Permission Denied."));
     }
     return parent::validate($vars);
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:7,代码来源:Delete.php

示例5: _table

 /**
  * Generates a table with ticket information.
  *
  * @param array $tickets  A list of tickets.
  * @param string $tableClass  The DOM ID to use for the generated table.
  *
  * @return string  Table HTML code.
  */
 protected function _table($tickets, $tableId = null)
 {
     if (!$tableId) {
         $tableId = get_class($this);
     }
     $columns = isset($this->_params['columns']) ? $this->_params['columns'] : null;
     $sortby = $GLOBALS['prefs']->getValue('sortby');
     $sortdirclass = ' class="' . ($GLOBALS['prefs']->getValue('sortdir') ? 'sortup' : 'sortdown') . '"';
     $html = '<thead><tr><th' . ($sortby == 'id' ? $sortdirclass : '') . '>' . _("Id") . '</th>';
     foreach (Whups::getSearchResultColumns('block', $this->_params['columns']) as $name => $column) {
         if ($column == 'id') {
             continue;
         }
         $html .= '<th' . ($sortby == $column ? $sortdirclass : '') . '>' . $name . '</th>';
     }
     $html .= '</tr></thead><tbody>';
     Whups::sortTickets($tickets);
     foreach ($tickets as $ticket) {
         foreach (Whups::getSearchResultColumns('block', $columns) as $column) {
             $thevalue = Whups::formatColumn($ticket, $column);
             $sortval = '';
             if ($column == 'timestamp' || $column == 'due' || substr($column, 0, 5) == 'date_') {
                 $sortval = strlen($ticket[$column]) ? ' sortval="' . $ticket[$column] . '"' : '';
             }
             $html .= '<td' . $sortval . '>' . (strlen($thevalue) ? $thevalue : '&nbsp;') . '</td>';
         }
         $html .= '</tr>';
     }
     $GLOBALS['page_output']->addScriptFile('tables.js', 'horde');
     return '<table id="' . htmlspecialchars($tableId) . '" class="horde-table sortable" style="width:100%">' . $html . '</tbody></table>';
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:39,代码来源:Tickets.php

示例6: _content

 /**
  */
 protected function _content()
 {
     global $whups_driver;
     $queues = Whups::permissionsFilter($whups_driver->getQueues(), 'queue', Horde_Perms::READ);
     $qsummary = $whups_driver->getQueueSummary(array_keys($queues));
     if (!$qsummary) {
         return '<p class="horde-content"><em>' . _("There are no open tickets.") . '</em></p>';
     }
     $summary = $types = array();
     foreach ($qsummary as $queue) {
         $types[$queue['type']] = $queue['type'];
         if (!isset($summary[$queue['id']])) {
             $summary[$queue['id']] = $queue;
         }
         $summary[$queue['id']][$queue['type']] = $queue['open_tickets'];
     }
     $html = '<thead><tr>';
     $sortby = 'queue_name';
     foreach (array_merge(array('queue_name' => _("Queue")), $types) as $column => $name) {
         $html .= '<th' . ($sortby == $column ? ' class="sortdown"' : '') . '>' . $name . '</th>';
     }
     $html .= '</tr></thead><tbody>';
     foreach ($summary as $queue) {
         $html .= '<tr><td>' . Horde::link(Whups::urlFor('queue', $queue, true), $queue['description']) . htmlspecialchars($queue['name']) . '</a></td>';
         foreach ($types as $type) {
             $html .= '<td>' . (isset($queue[$type]) ? $queue[$type] : '&nbsp;') . '</td>';
         }
         $html .= '</tr>';
     }
     $GLOBALS['page_output']->addScriptFile('tables.js', 'horde');
     return '<table id="whups_block_queuesummary" class="horde-table sortable" style="width:100%">' . $html . '</tbody></table>';
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:34,代码来源:Queuesummary.php

示例7: __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);
     }
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:33,代码来源:CreateStepFour.php

示例8: _getAddressbookSearchParams

 /**
  */
 protected function _getAddressbookSearchParams()
 {
     $params = Whups::getAddressbookSearchParams();
     $ob = new stdClass();
     $ob->fields = $params['fields'];
     $ob->sources = $params['sources'];
     return $ob;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:10,代码来源:ContactAutoCompleter.php

示例9: _content

 /**
  */
 protected function _content()
 {
     $queue_ids = array_keys(Whups::permissionsFilter($GLOBALS['whups_driver']->getQueues(), 'queue', Horde_Perms::READ));
     $info = array('owner' => Whups::getOwnerCriteria($GLOBALS['registry']->getAuth()), 'nores' => true, 'queue' => $queue_ids);
     $assigned = $GLOBALS['whups_driver']->getTicketsByProperties($info);
     if (!$assigned) {
         return '<p class="horde-content"><em>' . _("No tickets are assigned to you.") . '</em></p>';
     }
     return $this->_table($assigned);
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:12,代码来源:Mytickets.php

示例10: _content

 /**
  */
 protected function _content()
 {
     global $whups_driver, $prefs;
     $queue_ids = array_keys(Whups::permissionsFilter($GLOBALS['whups_driver']->getQueues(), 'queue', Horde_Perms::READ));
     $info = array('requester' => $GLOBALS['registry']->getAuth(), 'notowner' => 'user:' . $GLOBALS['registry']->getAuth(), 'nores' => true, 'queue' => $queue_ids);
     $requests = $GLOBALS['whups_driver']->getTicketsByProperties($info);
     if (!$requests) {
         return '<p class="horde-content"><em>' . _("You have no open requests.") . '</em></p>';
     }
     return $this->_table($requests);
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:13,代码来源:Myrequests.php

示例11: validate

 public function validate(&$vars, $canAutoFill = false)
 {
     global $conf;
     if (!parent::validate($vars, $canAutoFill)) {
         if (!$GLOBALS['registry']->getAuth() && !empty($conf['guests']['captcha'])) {
             $vars->remove('captcha');
             $this->removeVariable($varname = 'captcha');
             $this->insertVariableBefore('newcomment', _("Spam protection"), 'captcha', 'figlet', true, null, null, array(Whups::getCAPTCHA(true), $conf['guests']['figlet_font']));
         }
         return false;
     }
     return true;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:13,代码来源:AddComment.php

示例12: _getQueue

 /**
  */
 private function _getQueue()
 {
     if (empty($this->_params['queue'])) {
         return false;
     }
     if (!Whups::permissionsFilter(array($this->_params['queue'] => true), 'queue', Horde_Perms::READ)) {
         return false;
     }
     try {
         return $GLOBALS['whups_driver']->getQueue($this->_params['queue']);
     } catch (Whups_Exception $e) {
         return false;
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:16,代码来源:Queuecontents.php

示例13: __construct

 public function __construct(&$vars)
 {
     global $whups_driver, $registry;
     parent::__construct($vars);
     $queue = $vars->get('queue');
     try {
         $info = $whups_driver->getQueue($queue);
     } catch (Whups_Exception $e) {
         $this->addVariable(_("Invalid Queue"), 'invalid', 'invalid', true, false, null, array(_("Invalid Queue")));
         return;
     }
     $this->setTitle(sprintf(_("Edit %s"), $info['name']));
     $this->addHidden('', 'queue', 'int', true, true);
     $mname = $this->addVariable(_("Queue Name"), 'name', 'text', true, $info['readonly']);
     $mname->setDefault($info['name']);
     $mdesc = $this->addVariable(_("Queue Description"), 'description', 'text', true, $info['readonly']);
     $mdesc->setDefault($info['description']);
     $mslug = $this->addVariable(_("Queue Slug"), 'slug', 'text', false, $info['readonly']);
     $mslug->setDefault($info['slug']);
     $memail = $this->addVariable(_("Queue Email"), 'email', 'email', false, $info['readonly']);
     $memail->setDefault($info['email']);
     $types = $whups_driver->getAllTypes();
     $mtypes = $this->addVariable(_("Ticket Types associated with this Queue"), 'types', 'set', true, false, null, array($types));
     $mtypes->setDefault(array_keys($whups_driver->getTypes($queue)));
     $mdefaults = $this->addVariable(_("Default Ticket Type"), 'default', 'enum', false, false, null, array($types));
     $mdefaults->setDefault($whups_driver->getDefaultType($queue));
     /* Versioned and version link. */
     $mversioned = $this->addVariable(_("Keep a set of versions for this queue?"), 'versioned', 'boolean', false, $info['readonly']);
     $mversioned->setDefault($info['versioned']);
     if ($registry->hasMethod('tickets/listVersions') == $registry->getApp()) {
         $versionlink = array('text' => _("Edit the versions for this queue"), 'url' => Horde::url('admin/?formname=whups_form_admin_editversionstepone')->add('queue', $queue));
         $this->addVariable('', 'link', 'link', false, true, null, array($versionlink));
     }
     /* Usertype and usertype link. */
     $users = $whups_driver->getQueueUsers($queue);
     $f_users = array();
     foreach ($users as $user) {
         $f_users[$user] = Whups::formatUser($user);
     }
     asort($f_users);
     $musers = $this->addVariable(_("Users responsible for this Queue"), 'users', 'set', false, true, null, array($f_users));
     $musers->setDefault($whups_driver->getQueueUsers($queue));
     $userlink = array('text' => _("Edit the users responsible for this queue"), 'url' => Horde::url('admin/?formname=edituserform')->add('queue', $queue));
     $this->addVariable('', 'link', 'link', false, true, null, array($userlink));
     /* Permissions link. */
     if ($GLOBALS['registry']->isAdmin(array('permission' => 'whups:admin', 'permlevel' => Horde_Perms::EDIT))) {
         $permslink = array('text' => _("Edit the permissions on this queue"), 'url' => Horde::url('admin/perms/edit.php', false, array('app' => 'horde'))->add(array('category' => 'whups:queues:' . $queue, 'autocreate' => '1')));
         $this->addVariable('', 'link', 'link', false, true, null, array($permslink));
     }
 }
开发者ID:horde,项目名称:horde,代码行数:50,代码来源:EditQueueStepTwo.php

示例14: __construct

 /**
  * Constructor.
  */
 public function __construct($vars, $title = '')
 {
     global $whups_driver;
     parent::__construct($vars, $title);
     $this->addHidden('', 'tickets', 'text', true, true);
     $this->addHidden('', 'url', 'text', true, true);
     $tickets = array();
     foreach ((array) $vars->get('ticket') as $id) {
         $ticket = $whups_driver->getTicketDetails($id, false);
         if (Whups::hasPermission($ticket['queue'], 'queue', Horde_Perms::DELETE)) {
             $this->_tickets[] = (int) $id;
             $this->addVariable(_("Ticket") . ' ' . $id, 'summary' . $id, 'text', false, true)->setDefault($ticket['summary']);
         }
     }
     $this->addVariable('', 'warn', 'html', false)->setDefault('<span class="horde-form-error">' . _("Really delete these tickets? They will NOT be archived, and will be gone forever.") . '</span>');
     $this->setButtons(array(array('class' => 'horde-delete', 'value' => _("Delete")), array('class' => 'horde-cancel', 'value' => _("Cancel"))));
 }
开发者ID:horde,项目名称:horde,代码行数:20,代码来源:DeleteMultiple.php

示例15: __construct

 public function __construct(&$vars)
 {
     parent::__construct($vars, _("Add Attribute"));
     $this->addHidden('', 'type', 'int', true, true);
     $this->addVariable(_("Attribute Name"), 'attribute_name', 'text', true);
     $this->addVariable(_("Attribute Description"), 'attribute_description', 'text', true);
     $this->addVariable(_("Required Attribute?"), 'attribute_required', 'boolean', false);
     $v =& $this->addVariable(_("Attribute Type"), 'attribute_type', 'enum', true, false, null, array(Whups::fieldTypeNames()));
     $v->setDefault('text');
     $v->setAction(Horde_Form_Action::factory(array('whups', 'whups_reload'), array('formname' => 'whups_form_admin_addattribute_reload')));
     $type = $vars->get('attribute_type');
     if (empty($type)) {
         $type = 'text';
     }
     foreach (Whups::fieldTypeParams($type) as $param => $info) {
         $this->addVariable($info['label'], 'attribute_params[' . $param . ']', $info['type'], false);
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:18,代码来源:AddAttribute.php


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