本文整理汇总了PHP中date::getThisYear方法的典型用法代码示例。如果您正苦于以下问题:PHP date::getThisYear方法的具体用法?PHP date::getThisYear怎么用?PHP date::getThisYear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类date
的用法示例。
在下文中一共展示了date::getThisYear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getList
/**
* Get todo list of a user.
*
* @param date $date
* @param string $account
* @param string $status all|today|thisweek|lastweek|before, or a date.
* @param int $limit
* @access public
* @return void
*/
public function getList($date = 'today', $account = '', $status = 'all', $limit = 0, $pager = null, $orderBy = "date, status, begin")
{
$this->app->loadClass('date');
$todos = array();
$date = strtolower($date);
if ($date == 'today') {
$begin = date::today();
$end = $begin;
} elseif ($date == 'yesterday') {
$begin = date::yesterday();
$end = $begin;
} elseif ($date == 'thisweek') {
extract(date::getThisWeek());
} elseif ($date == 'lastweek') {
extract(date::getLastWeek());
} elseif ($date == 'thismonth') {
extract(date::getThisMonth());
} elseif ($date == 'lastmonth') {
extract(date::getLastMonth());
} elseif ($date == 'thisseason') {
extract(date::getThisSeason());
} elseif ($date == 'thisyear') {
extract(date::getThisYear());
} elseif ($date == 'future') {
$begin = '2030-01-01';
$end = $begin;
} elseif ($date == 'all') {
$begin = '1970-01-01';
$end = '2109-01-01';
} elseif ($date == 'before') {
$begin = '1970-01-01';
$end = date::yesterday();
} else {
$begin = $end = $date;
}
if ($account == '') {
$account = $this->app->user->account;
}
$stmt = $this->dao->select('*')->from(TABLE_TODO)->where('account')->eq($account)->andWhere("date >= '{$begin}'")->andWhere("date <= '{$end}'")->beginIF($status != 'all' and $status != 'undone')->andWhere('status')->in($status)->fi()->beginIF($status == 'undone')->andWhere('status')->ne('done')->fi()->orderBy($orderBy)->beginIF($limit > 0)->limit($limit)->fi()->page($pager)->query();
/* Set session. */
$sql = explode('WHERE', $this->dao->get());
$sql = explode('ORDER', $sql[1]);
$this->session->set('todoReportCondition', $sql[0]);
while ($todo = $stmt->fetch()) {
if ($todo->type == 'task') {
$todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_TASK)->fetch('name');
}
if ($todo->type == 'bug') {
$todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_BUG)->fetch('title');
}
$todo->begin = date::formatTime($todo->begin);
$todo->end = date::formatTime($todo->end);
/* If is private, change the title to private. */
if ($todo->private and $this->app->user->account != $todo->account) {
$todo->name = $this->lang->todo->thisIsPrivate;
}
$todos[] = $todo;
}
return $todos;
}
示例2: getList
/**
* Get todo list of a user.
*
* @param string $mode all|self|assignedToOther|assignedToMe
* @param string $account
* @param date $date all|today|thisweek|lastweek|before, or a date.
* @param string $status
* @param string $orderBy
* @param object $pager
* @access public
* @return void
*/
public function getList($mode = 'self', $account = '', $date = 'all', $status = 'all', $orderBy = "date, status, begin", $pager = null)
{
if ($account == '') {
$account = $this->app->user->account;
}
$mode = strtolower($mode);
$this->app->loadClass('date');
$todos = array();
if (!is_array($date)) {
$date = strtolower($date);
}
if (is_array($date)) {
$begin = strtolower($date['begin']);
$end = strtolower($date['end']);
} elseif ($date == 'today') {
$begin = date::today();
$end = $begin;
} elseif ($date == 'yesterday') {
$begin = date::yesterday();
$end = $begin;
} elseif ($date == 'thisweek') {
extract(date::getThisWeek());
} elseif ($date == 'lastweek') {
extract(date::getLastWeek());
} elseif ($date == 'thismonth') {
extract(date::getThisMonth());
} elseif ($date == 'lastmonth') {
extract(date::getLastMonth());
} elseif ($date == 'thisseason') {
extract(date::getThisSeason());
} elseif ($date == 'thisyear') {
extract(date::getThisYear());
} elseif ($date == 'future') {
$begin = '0000-00-00';
$end = '1970-01-01';
} elseif ($date == 'all') {
$begin = '1970-01-01';
$end = '2109-01-01';
} elseif ($date == 'before') {
$begin = '1970-01-01';
$end = date::yesterday();
} else {
$begin = $end = $date;
}
$stmt = $this->dao->select('*')->from(TABLE_TODO)->where('1=1')->beginIF($mode == 'self')->andWhere()->markLeft()->where('account')->eq($account)->orWhere('assignedTo')->eq($account)->markRight()->fi()->beginIF($mode == 'assignedtoother')->andWhere('account')->eq($account)->andWhere('assignedTo')->ne($account)->andWhere('assignedTo')->ne('')->fi()->beginIF($mode == 'assignedtome')->andWhere('account')->ne($account)->andWhere('assignedTo')->eq($account)->fi()->andWhere("date >= '{$begin}'")->andWhere("date <= '{$end}'")->beginIF($status != 'all' and $status != 'undone' and $status != 'unclosed')->andWhere('status')->in($status)->fi()->beginIF($status == 'undone')->andWhere('status')->notin('done,closed')->fi()->beginIF($status == 'unclosed')->andWhere('status')->ne('closed')->fi()->orderBy($orderBy)->page($pager)->query();
/* Set session. */
$sql = explode('WHERE', $this->dao->get());
$sql = explode('ORDER', $sql[1]);
$this->session->set('todoReportCondition', $sql[0]);
while ($todo = $stmt->fetch()) {
if ($todo->type == 'task') {
$todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_TASK)->fetch('name');
}
if ($todo->type == 'customer') {
$todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_CUSTOMER)->fetch('name');
}
if ($todo->type == 'order') {
$order = $this->dao->select('c.name, o.createdDate')->from(TABLE_ORDER)->alias('o')->leftJoin(TABLE_CUSTOMER)->alias('c')->on('o.customer=c.id')->where('o.id')->eq($todo->idvalue)->fetch();
$todo->name = $order->name . '|' . date('Y-m-d', strtotime($order->createdDate));
}
$todo->begin = date::formatTime($todo->begin);
$todo->end = date::formatTime($todo->end);
/* If is private, change the title to private. */
if ($todo->private and $this->app->user->account != $todo->account) {
$todo->name = $this->lang->todo->thisIsPrivate;
}
$todos[] = $todo;
}
return $todos;
}