getOwnerCriteria() public static method

Merges the user's groups with the user name.
public static getOwnerCriteria ( string $user ) : array
$user string A user name.
return array A list of criteria that would match the user.
コード例 #1
0
ファイル: Mytickets.php プロジェクト: jubinpatel/horde
 /**
  */
 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);
 }
コード例 #2
0
ファイル: Api.php プロジェクト: raz0rsdge/horde
 /**
  * Lists tickets with due dates as time objects.
  *
  * @param array $categories  The time categories (from listTimeObjectCategories) to list.
  * @param mixed $start       The start date of the period.
  * @param mixed $end         The end date of the period.
  */
 public function listTimeObjects($categories, $start, $end)
 {
     global $whups_driver;
     $start = new Horde_Date($start);
     $start_ts = $start->timestamp();
     $end = new Horde_Date($end);
     $end_ts = $end->timestamp();
     $criteria['owner'] = Whups::getOwnerCriteria($GLOBALS['registry']->getAuth());
     /* @TODO Use $categories */
     $category = 'due';
     switch ($category) {
         case 'assigned':
             $label = _("Assigned");
             $criteria['ass'] = true;
             break;
         case 'created':
             $label = _("Created");
             break;
         case 'due':
             $label = _("Due");
             $criteria['nores'] = true;
             break;
         case 'resolved':
             $label = _("Resolved");
             $criteria['res'] = true;
             break;
     }
     try {
         $tickets = $whups_driver->getTicketsByProperties($criteria);
     } catch (Whups_Exception $e) {
         return array();
     }
     $objects = array();
     foreach ($tickets as $ticket) {
         switch ($category) {
             case 'assigned':
                 $t_start = $ticket['date_assigned'];
                 break;
             case 'created':
                 $t_start = $ticket['timestamp'];
                 break;
             case 'due':
                 if (empty($ticket['due'])) {
                     continue 2;
                 }
                 $t_start = $ticket['due'];
                 break;
             case 'resolved':
                 $t_start = $ticket['date_resolved'];
                 break;
         }
         if ($t_start + 1 < $start_ts || $t_start > $end_ts) {
             continue;
         }
         $t = new Whups_Ticket($ticket['id'], $ticket);
         $objects[$ticket['id']] = array('title' => sprintf('%s: [#%s] %s', $label, $ticket['id'], $ticket['summary']), 'description' => $t->toString(), 'id' => $ticket['id'], 'start' => date('Y-m-d\\TH:i:s', $t_start), 'end' => date('Y-m-d\\TH:i:s', $t_start + 1), 'params' => array('id' => $ticket['id']), 'link' => Whups::urlFor('ticket', $ticket['id'], true));
     }
     return $objects;
 }