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


PHP date::getLastWeek方法代码示例

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


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

示例1: replaceDynamic

 /**
  Replace dynamic account and date. 
 * 
 * @param  string $query 
 * @access public
 * @return string 
 */
 public function replaceDynamic($query)
 {
     $this->app->loadClass('date');
     $lastWeek = date::getLastWeek();
     $thisWeek = date::getThisWeek();
     $lastMonth = date::getLastMonth();
     $thisMonth = date::getThisMonth();
     $yesterday = date::yesterday();
     $today = date::today();
     if (strpos($query, '$') !== false) {
         $query = str_replace('$@me', $this->app->user->account, $query);
         $query = str_replace("'\$lastMonth'", "'" . $lastMonth['begin'] . "' and '" . $lastMonth['end'] . "'", $query);
         $query = str_replace("'\$thisMonth'", "'" . $thisMonth['begin'] . "' and '" . $thisMonth['end'] . "'", $query);
         $query = str_replace("'\$lastWeek'", "'" . $lastWeek['begin'] . "' and '" . $lastWeek['end'] . "'", $query);
         $query = str_replace("'\$thisWeek'", "'" . $thisWeek['begin'] . "' and '" . $thisWeek['end'] . "'", $query);
         $query = str_replace("'\$yesterday'", "'" . $yesterday . "' and '" . $yesterday . "'", $query);
         $query = str_replace("'\$today'", "'" . $today . "' and '" . $today . "'", $query);
     }
     return $query;
 }
开发者ID:XMGmen,项目名称:zentao,代码行数:27,代码来源:model.php

示例2: 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;
 }
开发者ID:XMGmen,项目名称:zentao,代码行数:70,代码来源:model.php

示例3: 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;
 }
开发者ID:leowh,项目名称:colla,代码行数:82,代码来源:model.php


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