本文整理汇总了PHP中Whups::getOwnerCriteria方法的典型用法代码示例。如果您正苦于以下问题:PHP Whups::getOwnerCriteria方法的具体用法?PHP Whups::getOwnerCriteria怎么用?PHP Whups::getOwnerCriteria使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Whups
的用法示例。
在下文中一共展示了Whups::getOwnerCriteria方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _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);
}
示例2: listTimeObjects
/**
* 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;
}