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


PHP Whups::permissionsFilter方法代码示例

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


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

示例1: _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

示例2: _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

示例3: _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

示例4: _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

示例5: __construct

 public function __construct(&$vars)
 {
     global $whups_driver;
     parent::__construct($vars, _("Send Reminders"));
     $queues = Whups::permissionsFilter($whups_driver->getQueues(), 'queue', Horde_Perms::EDIT);
     if (count($queues)) {
         $modtype = 'enum';
         $type_params = array($queues);
     } else {
         $modtype = 'invalid';
         $type_params = array(_("There are no queues available."));
     }
     $this->addVariable(_("Send only for this list of ticket ids"), 'id', 'intlist', false);
     $this->addVariable(_("For tickets from these queues"), 'queue', $modtype, false, false, null, $type_params);
     $cats = $whups_driver->getCategories();
     unset($cats['resolved']);
     $categories = $this->addVariable(_("For tickets which are"), 'category', 'multienum', false, false, null, array($cats, 3));
     $categories->setDefault(array('assigned'));
     $this->addVariable(_("Unassigned tickets"), 'unassigned', 'email', false, false, _("If you select any tickets that do not have an owner, who should we send email to?"));
 }
开发者ID:horde,项目名称:horde,代码行数:20,代码来源:SendReminder.php

示例6: __construct

 public function __construct(&$vars)
 {
     global $whups_driver, $registry;
     if ($registry->hasMethod('tickets/listQueues') == $registry->getApp()) {
         parent::__construct($vars, _("Edit or Delete Queues"));
         $this->setButtons(array(_("Edit Queue"), array('class' => 'horde-delete', 'value' => _("Delete Queue"))));
     } else {
         parent::__construct($vars, _("Edit Queues"));
         $this->setButtons(array(_("Edit Queue")));
     }
     $queues = Whups::permissionsFilter($whups_driver->getQueues(), 'queue', Horde_Perms::EDIT);
     if ($queues) {
         $modtype = 'enum';
         $type_params = array($queues);
     } else {
         $modtype = 'invalid';
         $type_params = array(_("There are no queues to edit"));
     }
     $this->addVariable(_("Queue Name"), 'queue', $modtype, true, false, null, $type_params);
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:20,代码来源:EditQueueStepOne.php

示例7: __construct

 public function __construct(&$vars, $title = '')
 {
     parent::__construct($vars, $title);
     $this->addHidden('', 'id', 'int', true, true);
     /* Queues. */
     $this->addVariable(_("New Queue"), 'queue', 'enum', true, false, null, array(Whups::permissionsFilter($GLOBALS['whups_driver']->getQueues(), 'queue', Horde_Perms::EDIT)));
     $this->addVariable(_("Comment"), 'newcomment', 'longtext', false);
     /* Group restrictions. */
     if ($GLOBALS['registry']->isAdmin(array('permission' => 'whups:admin', 'permlevel' => Horde_Perms::EDIT)) || $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 => _("Any Group")), $grouplist);
             $this->addVariable(_("Viewable only by members of"), 'group', 'enum', true, false, null, array($grouplist));
         }
     }
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:21,代码来源:StepOne.php

示例8: getInfo

 /**
  * Fetch the field values of the submitted form.
  *
  * @param Horde_Variables $vars  A Horde_Variables instance, optional since Horde 3.2.
  * @param array           $info  Array to be filled with the submitted field
  *                               values.
  */
 public function getInfo($vars, &$info)
 {
     parent::getInfo($vars, $info);
     if (empty($info['queue'])) {
         $info['queue'] = array_keys(Whups::permissionsFilter($GLOBALS['whups_driver']->getQueues(), 'queue', Horde_Perms::READ, $GLOBALS['registry']->getAuth(), $GLOBALS['registry']->getAuth()));
     } else {
         $info['queue'] = array($info['queue']);
     }
     if (empty($info['states'])) {
         unset($info['states']);
     }
     // ... if we were given a set of states
     if (isset($info['states'])) {
         // collect them into a list of state_id
         $info['state_id'] = array();
         foreach ($info['states'] as $states) {
             if (isset($states)) {
                 // because null === array_merge(array, null)
                 $info['state_id'] = array_merge($info['state_id'], $states);
             }
         }
         unset($info['states']);
     }
     // Remove any queues that don't have a state selected.
     $types = array();
     foreach ($info['queue'] as $queue) {
         foreach ($GLOBALS['whups_driver']->getTypeIds($queue) as $type) {
             $types[$type][$queue] = true;
         }
     }
     $queues = array();
     foreach ($info['state_id'] as $stateId) {
         $state = $GLOBALS['whups_driver']->getState($stateId);
         if (isset($types[$state['type']])) {
             $queues = array_merge($queues, array_keys($types[$state['type']]));
         }
     }
     $info['queue'] = array_intersect($info['queue'], $queues);
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:46,代码来源:Search.php

示例9: __construct

 public function __construct($vars)
 {
     global $whups_driver;
     parent::__construct($vars, _("Create Ticket - Step 1"));
     $queues = Whups::permissionsFilter($whups_driver->getQueues(), 'queue', Horde_Perms::EDIT);
     if (!$queues) {
         $this->addVariable(_("Queue Name"), 'queue', 'invalid', true, false, null, array(_("There are no queues which you can create tickets in.")));
     } else {
         foreach (array_keys($queues) as $queue_id) {
             $info = $whups_driver->getQueue($queue_id);
             if (!empty($info['description'])) {
                 $queues[$queue_id] .= ' [' . $info['description'] . ']';
             }
         }
         // Auto-select the only queue if only one option is available
         if (count($queues) == 1) {
             $vars->set('queue', array_pop(array_keys($queues)));
         }
         $queues = $this->addVariable(_("Queue Name"), 'queue', 'enum', true, false, null, array($queues, _("Choose:")));
         $queues->setAction(Horde_Form_Action::factory('submit'));
     }
 }
开发者ID:horde,项目名称:horde,代码行数:22,代码来源:CreateStepOne.php

示例10: __construct

 public function __construct($vars)
 {
     global $whups_driver;
     parent::__construct($vars, $vars->get('edit') ? _("Edit Property Criterion") : _("Add Property Criterion"), 'Whups_Form_Query_PropertyCriterion');
     $this->addHidden('', 'edit', 'boolean', false);
     $this->addVariable(_("Id"), 'id', 'intlist', false);
     /* Types. */
     $this->addVariable(_("Type"), 'ttype', 'enum', false, false, null, array($whups_driver->getAllTypes(), _("Any")));
     /* Queues. */
     $queues = Whups::permissionsFilter($whups_driver->getQueues(), 'queue', Horde_Perms::READ);
     if (count($queues)) {
         $v = $this->addVariable(_("Queue"), 'queue', 'enum', false, false, null, array($queues, _("Any")));
         $v->setAction(Horde_Form_Action::factory('reload'));
         if ($vars->get('queue')) {
             $this->addVariable(_("Version"), 'version', 'enum', false, false, null, array($whups_driver->getVersions($vars->get('queue')), _("Any")));
         }
     }
     /* States. */
     $states = $whups_driver->getStates();
     $this->addVariable(_("State"), 'state', 'enum', false, false, null, array($states, _("Any")));
     /* Priorities. */
     $priorities = $whups_driver->getPriorities();
     $this->addVariable(_("Priority"), 'priority', 'enum', false, false, null, array($priorities, _("Any")));
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:24,代码来源:PropertyCriterion.php

示例11: array_keys

 /**
  * Loads a set of tickets, and cache the result inside the Whups_Reports::
  * object to save on database access.
  *
  * @param string $type       'open', 'closed', or 'all' - the set of
  *                           tickets to fetch. A previously cached set
  *                           will be returned if it is available.
  * @param boolean $expanded  List tickets once for each owner of the
  *                           ticket?
  *
  * @return array  The ticket set.
  */
 protected function &_getTicketSet($type, $expanded = false)
 {
     $queues = array_keys(Whups::permissionsFilter($this->_backend->getQueues(), 'queue'));
     $expanded = (int) $expanded;
     switch ($type) {
         case 'open':
             if (is_null($this->_opentickets[$expanded])) {
                 $this->_opentickets[$expanded] = $this->_backend->getTicketsByProperties(array('nores' => true, 'queue' => $queues), true, $expanded);
             }
             return $this->_opentickets[$expanded];
         case 'closed':
             if (is_null($this->_closedtickets[$expanded])) {
                 $this->_closedtickets[$expanded] = $this->_backend->getTicketsByProperties(array('res' => true, 'queue' => $queues), true, $expanded);
             }
             return $this->_closedtickets[$expanded];
         case 'all':
             if (is_null($this->_alltickets[$expanded])) {
                 $this->_alltickets[$expanded] = $this->_backend->getTicketsByProperties(array('queue' => $queues), true, $expanded);
             }
             return $this->_alltickets[$expanded];
     }
 }
开发者ID:horde,项目名称:horde,代码行数:34,代码来源:Reports.php

示例12: array

<?php

/**
 * Copyright 2002-2016 Horde LLC (http://www.horde.org/)
 *
 * See the enclosed file LICENSE for license information (BSD). If you
 * did not receive this file, see http://www.horde.org/licenses/bsdl.php.
 *
 * @author Chuck Hagenbuch <chuck@horde.org>
 */
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('whups');
Whups::addTopbarSearch();
/* Supported graph types. Unused at the moment. */
$graphs = array('open|queue_name' => array('chart', _("Open Tickets by Queue")), 'open|state_name' => array('chart', _("Open Tickets by State")), 'open|type_name' => array('chart', _("Open Tickets by Type")), 'open|priority_name' => array('chart', _("Open Tickets by Priority")), 'open|user_id_requester' => array('chart', _("Open Tickets by Requester")), 'open|owner' => array('chart', _("Open Tickets by Owner")), '@closed:avg:open|owner' => array('plot', _("Average days to close by Owner")), '@closed:avg:open|user_id_requester' => array('plot', _("Average days to close by Requester")), '@closed:avg:open|queue_name' => array('plot', _("Average days to close by Queue")));
/* Supported statistic types. */
$stats = array('avg|open' => _("Average time a ticket is unresolved"), 'max|open' => _("Maximum time a ticket is unresolved"), 'min|open' => _("Minimum time a ticket is unresolved"));
$queues = Whups::permissionsFilter($whups_driver->getQueues(), 'queue', Horde_Perms::READ);
$reporter = new Whups_Reports($whups_driver);
$page_output->header(array('title' => _("Reports")));
$notification->notify(array('listeners' => 'status'));
require WHUPS_TEMPLATES . '/reports/stats.inc';
$page_output->footer();
开发者ID:horde,项目名称:horde,代码行数:23,代码来源:reports.php

示例13: array

    if ($varname == 'owners') {
        $owners = $gowners = array();
        foreach ($value as $owner) {
            if (strpos($owner, 'user:') !== false) {
                $owners[] = $owner;
            } else {
                $gowners[] = $owner;
            }
        }
        $vars->add('owners', $owners);
        $vars->add('group_owners', $gowners);
    }
    $vars->add($varname, $value);
}
if ($tid = $vars->get('transaction')) {
    $history = Whups::permissionsFilter($whups_driver->getHistory($ticket->getId()), 'comment', Horde_Perms::READ);
    if (!empty($history[$tid]['comment'])) {
        // If this was a restricted comment, load the group_id it was
        // restricted to and default to keeping that restriction on
        // the reply.
        foreach ($history[$tid]['changes'] as $change) {
            if (!empty($change['private'])) {
                $permission = $GLOBALS['injector']->getInstance('Horde_Perms')->getPermission('whups:comments:' . $change['value']);
                $group_id = array_shift(array_keys($permission->getGroupPermissions()));
                $vars->set('group', $group_id);
                break;
            }
        }
        $flowed = new Horde_Text_Flowed(preg_replace("/\\s*\n/U", "\n", $history[$tid]['comment']), 'UTF-8');
        $vars->set('newcomment', $flowed->toFlowed(true));
    }
开发者ID:jubinpatel,项目名称:horde,代码行数:31,代码来源:update.php

示例14: getTicketDetails

 /**
  * Returns ticket details.
  *
  * @param integer $ticket      A ticket ID.
  * @param boolean $checkPerms  Enforce permissions?
  *
  * @return array  A ticket information hash.
  * @throws Horde_Exception_NotFound
  * @throws Horde_Exception_PermissionDenied
  */
 public function getTicketDetails($ticket, $checkPerms = true)
 {
     $result = $this->getTicketsByProperties(array('id' => $ticket));
     if (!isset($result[0])) {
         throw new Horde_Exception_NotFound(sprintf(_("Ticket %s was not found."), $ticket));
     }
     $queues = Whups::permissionsFilter($this->getQueues(), 'queue', Horde_Perms::READ, $GLOBALS['registry']->getAuth(), $result[0]['user_id_requester']);
     if ($checkPerms && !in_array($result[0]['queue'], array_flip($queues))) {
         throw new Horde_Exception_PermissionDenied(sprintf(_("You do not have permission to access this ticket (%s)."), $ticket));
     }
     return $result[0];
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:22,代码来源:Sql.php

示例15: catch

Horde_Registry::appInit('whups');
$id = Horde_Util::getFormData('ticket');
$filename = Horde_Util::getFormData('file');
$type = Horde_Util::getFormData('type');
// Get the ticket details first.
if (empty($id)) {
    exit;
}
try {
    $details = $whups_driver->getTicketDetails($id);
} catch (Horde_Exception_PermissionDenied $e) {
    // No permissions to this ticket.
    Horde::url($registry->get('webroot', 'horde') . '/login.php', true)->add('url', Horde::selfUrl(true))->redirect();
}
// Check permissions on this ticket.
if (!count(Whups::permissionsFilter($whups_driver->getHistory($id), 'comment', Horde_Perms::READ))) {
    throw new Horde_Exception(sprintf(_("You are not allowed to view ticket %d."), $id));
}
try {
    $vfs = $injector->getInstance('Horde_Core_Factory_Vfs')->create();
} catch (Horde_Exception $e) {
    throw new Horde_Exception(_("The VFS backend needs to be configured to enable attachment uploads."));
}
try {
    $data = $vfs->read(Whups::VFS_ATTACH_PATH . '/' . $id, $filename);
} catch (Horde_Vfs_Exception $e) {
    throw Horde_Exception(sprintf(_("Access denied to %s"), $filename));
}
$mime_part = new Horde_Mime_Part();
$mime_part->setType(Horde_Mime_Magic::extToMime($type));
$mime_part->setContents($data);
开发者ID:raz0rsdge,项目名称:horde,代码行数:31,代码来源:view.php


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