當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。