本文整理汇总了PHP中Get::enum方法的典型用法代码示例。如果您正苦于以下问题:PHP Get::enum方法的具体用法?PHP Get::enum怎么用?PHP Get::enum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Get
的用法示例。
在下文中一共展示了Get::enum方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
function show()
{
global $page, $db, $user, $fs, $proj;
$page->setTitle($fs->prefs['page_title'] . L('reports'));
$events = array(1 => L('taskopened'), 13 => L('taskreopened'), 2 => L('taskclosed'), 3 => L('taskedited'), 14 => L('assignmentchanged'), 29 => L('events.useraddedtoassignees'), 4 => L('commentadded'), 5 => L('commentedited'), 6 => L('commentdeleted'), 7 => L('attachmentadded'), 8 => L('attachmentdeleted'), 11 => L('relatedadded'), 12 => L('relateddeleted'), 9 => L('notificationadded'), 10 => L('notificationdeleted'), 17 => L('reminderadded'), 18 => L('reminderdeleted'));
$user_events = array(30 => L('created'), 31 => L('deleted'));
$page->assign('events', $events);
$page->assign('user_events', $user_events);
$sort = strtoupper(Get::enum('sort', array('desc', 'asc')));
$where = array();
$params = array();
$orderby = '';
switch (Get::val('order')) {
case 'type':
$orderby = "h.event_type {$sort}, h.event_date {$sort}";
break;
case 'user':
$orderby = "user_id {$sort}, h.event_date {$sort}";
break;
case 'date':
default:
$orderby = "h.event_date {$sort}, h.event_type {$sort}";
}
foreach (Get::val('events', array()) as $eventtype) {
$where[] = 'h.event_type = ?';
$params[] = $eventtype;
}
$where = '(' . implode(' OR ', $where) . ')';
if ($proj->id) {
$where = $where . 'AND (t.project_id = ? OR h.event_type > 29) ';
$params[] = $proj->id;
}
if (($fromdate = Req::val('fromdate')) || Req::val('todate')) {
$where .= ' AND ';
$todate = Req::val('todate');
if ($fromdate) {
$where .= ' h.event_date > ?';
$params[] = Flyspray::strtotime($fromdate) + 0;
}
if ($todate && $fromdate) {
$where .= ' AND h.event_date < ?';
$params[] = Flyspray::strtotime($todate) + 86400;
} else {
if ($todate) {
$where .= ' h.event_date < ?';
$params[] = Flyspray::strtotime($todate) + 86400;
}
}
}
$histories = array();
if (count(Get::val('events'))) {
if (Get::num('event_number') > 0) {
$db->setLimit(Get::num('event_number'));
}
$histories = $db->x->getAll("SELECT h.*, t.*, p.project_prefix\n FROM {history} h\n LEFT JOIN {tasks} t ON h.task_id = t.task_id\n LEFT JOIN {projects} p ON t.project_id = p.project_id\n WHERE {$where}\n ORDER BY {$orderby}", null, $params);
}
$page->assign('histories', $histories);
$page->assign('sort', $sort);
$page->pushTpl('reports.tpl');
}
示例2: dirname
require dirname(__FILE__) . '/header.php';
if (!$user->id && Get::val('user_id') && Get::val('auth')) {
$user = new User(Get::val('user_id'));
if (Get::val('auth') != md5($user->infos['user_pass'] . $user->infos['register_date'])) {
$user = new User();
}
}
$page = new FSTpl();
// Set up the basic XML head
header('Content-type: text/html; charset=utf-8');
$max_items = Get::num('num', 10) == 10 ? 10 : 20;
$sql_project = ' 1=1 ';
if ($proj->id) {
$sql_project = sprintf(' t.project_id = %d', $proj->id);
}
$feed_type = Get::enum('feed_type', array('rss1', 'rss2', 'atom'), 'rss2');
switch (Get::val('topic')) {
case 'clo':
$orderby = 'date_closed';
$closed = 't.is_closed = 1';
$topic = 1;
$title = 'Recently closed tasks';
break;
case 'edit':
$orderby = 'last_edited_time';
$closed = '1=1';
$topic = 2;
$title = 'Recently edited tasks';
break;
default:
$orderby = 'date_opened';