本文整理汇总了PHP中date::getThisWeek方法的典型用法代码示例。如果您正苦于以下问题:PHP date::getThisWeek方法的具体用法?PHP date::getThisWeek怎么用?PHP date::getThisWeek使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类date
的用法示例。
在下文中一共展示了date::getThisWeek方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getList
/**
* Get customer list.
*
* @param string $mode
* @param mix $param
* @param string $relation client|provider
* @param string $orderBy
* @param object $pager
* @access public
* @return array
*/
public function getList($mode = 'all', $param = null, $relation = 'client', $orderBy = 'id_desc', $pager = null)
{
$customerIdList = $this->getCustomersSawByMe();
if (empty($customerIdList)) {
return array();
}
$this->app->loadClass('date', $static = true);
$thisMonth = date::getThisMonth();
$thisWeek = date::getThisWeek();
if ($this->session->customerQuery == false) {
$this->session->set('customerQuery', ' 1 = 1');
}
$customerQuery = $this->loadModel('search', 'sys')->replaceDynamic($this->session->customerQuery);
if (strpos($orderBy, 'id') === false) {
$orderBy .= ', id_desc';
}
return $this->dao->select('*')->from(TABLE_CUSTOMER)->where('deleted')->eq(0)->beginIF($relation == 'client')->andWhere('relation')->ne('provider')->beginIF($relation == 'provider')->andWhere('relation')->ne('client')->beginIF($mode == 'field')->andWhere('mode')->eq($param)->fi()->beginIF($mode == 'past')->andWhere('nextDate')->lt(helper::today())->fi()->beginIF($mode == 'today')->andWhere('nextDate')->eq(helper::today())->fi()->beginIF($mode == 'tomorrow')->andWhere('nextDate')->eq(formattime(date::tomorrow(), DT_DATE1))->fi()->beginIF($mode == 'thisweek')->andWhere('nextDate')->between($thisWeek['begin'], $thisWeek['end'])->fi()->beginIF($mode == 'thismonth')->andWhere('nextDate')->between($thisMonth['begin'], $thisMonth['end'])->fi()->beginIF($mode == 'public')->andWhere('public')->eq('1')->fi()->beginIF($mode == 'assignedTo')->andWhere('assignedTo')->eq($this->app->user->account)->fi()->beginIF($mode == 'query')->andWhere($param)->fi()->beginIF($mode == 'bysearch')->andWhere($customerQuery)->fi()->beginIF(strpos('all, bysearch, public, assignedTo, query', $mode) === false)->andWhere('nextDate')->ne('0000-00-00')->fi()->andWhere('id')->in($customerIdList)->orderBy($orderBy)->page($pager)->fetchAll('id');
}
示例2: getList
/**
* Get order list.
*
* @param string $mode
* @param mix $param
* @param string $orderBy
* @param object $pager
* @access public
* @return array
*/
public function getList($mode = 'all', $param = null, $owner = '', $orderBy = 'id_desc', $pager = null)
{
$customerIdList = $this->loadModel('customer')->getCustomersSawByMe();
if (empty($customerIdList)) {
return array();
}
$products = $this->loadModel('product')->getPairs();
$this->app->loadClass('date', $static = true);
$thisMonth = date::getThisMonth();
$thisWeek = date::getThisWeek();
/* Process search condition. */
if ($this->session->orderQuery == false) {
$this->session->set('orderQuery', ' 1 = 1');
}
$orderQuery = $this->loadModel('search', 'sys')->replaceDynamic($this->session->orderQuery);
if (strpos($orderBy, 'status') !== false) {
$orderBy .= ', closedReason';
}
if (strpos($orderBy, 'id') === false) {
$orderBy .= ', id_desc';
}
$userList = $this->loadModel('user')->getSubUsers($this->app->user);
$orders = $this->dao->select('o.*, c.name as customerName, c.level as level')->from(TABLE_ORDER)->alias('o')->leftJoin(TABLE_CUSTOMER)->alias('c')->on("o.customer=c.id")->where('o.deleted')->eq(0)->beginIF($userList != '')->andWhere()->markLeft(1)->where('o.assignedTo')->in($userList)->orWhere('o.createdBy')->in($userList)->orWhere('o.editedBy')->in($userList)->orWhere('o.signedBy')->in($userList)->markRight(1)->fi()->beginIF($mode == 'past')->andWhere('o.nextDate')->andWhere('o.nextDate')->lt(helper::today())->fi()->beginIF($mode == 'today')->andWhere('o.nextDate')->eq(helper::today())->fi()->beginIF($mode == 'tomorrow')->andWhere('o.nextDate')->eq(formattime(date::tomorrow(), DT_DATE1))->fi()->beginIF($mode == 'thisweek')->andWhere('o.nextDate')->between($thisWeek['begin'], $thisWeek['end'])->fi()->beginIF($mode == 'thismonth')->andWhere('o.nextDate')->between($thisMonth['begin'], $thisMonth['end'])->fi()->beginIF($mode == 'public')->andWhere('public')->eq('1')->fi()->beginIF($mode == 'assignedTo')->andWhere('o.assignedTo')->eq($this->app->user->account)->fi()->beginIF($mode == 'createdBy')->andWhere('o.createdBy')->eq($this->app->user->account)->fi()->beginIF($mode == 'signedBy')->andWhere('o.signedBy')->eq($this->app->user->account)->fi()->beginIF($mode == 'query')->andWhere($param)->fi()->beginIF($mode == 'bysearch')->andWhere($orderQuery)->fi()->andWhere('o.customer')->in($customerIdList)->orderBy($orderBy)->page($pager)->fetchAll('id');
foreach ($orders as $order) {
$order->products = array();
$productList = explode(',', $order->product);
foreach ($productList as $product) {
if (isset($products[$product])) {
$order->products[] = $products[$product];
}
}
}
foreach ($orders as $order) {
$productName = count($order->products) > 1 ? current($order->products) . $this->lang->etc : current($order->products);
$order->title = sprintf($this->lang->order->titleLBL, $order->customerName, $productName, date('Y-m-d', strtotime($order->createdDate)));
}
return $orders;
}
示例3: 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;
}
示例4: 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;
}
示例5: ajaxGetTodoList
/**
* ajax get orders this week need conect.
*
* @param string $account not used.
* @param string $id
* @param string $type select|json|board
* @access public
* @return void
*/
public function ajaxGetTodoList($account = '', $id = '', $type = 'select')
{
$this->app->loadClass('date', $static = true);
$customerIdList = $this->loadModel('customer', 'crm')->getCustomersSawByMe();
$products = $this->loadModel('product')->getPairs();
$thisWeek = date::getThisWeek();
$orders = array();
if ($account == '') {
$account = $this->app->user->account;
}
$sql = $this->dao->select('o.id, o.product, o.createdDate, c.name as customerName, t.id as todo')->from(TABLE_ORDER)->alias('o')->leftJoin(TABLE_CUSTOMER)->alias('c')->on("o.customer=c.id")->leftJoin(TABLE_TODO)->alias('t')->on("t.type='order' and o.id=t.idvalue")->where('o.deleted')->eq(0)->andWhere('o.assignedTo')->eq($account)->andWhere('o.nextDate')->between($thisWeek['begin'], $thisWeek['end'])->andWhere('o.customer')->in($customerIdList)->orderBy('o.id_desc');
$stmt = $sql->query();
while ($order = $stmt->fetch()) {
if ($order->todo) {
continue;
}
$order->products = array();
$productList = explode(',', $order->product);
foreach ($productList as $product) {
if (isset($products[$product])) {
$order->products[] = $products[$product];
}
}
$productName = count($order->products) > 1 ? current($order->products) . $this->lang->etc : current($order->products);
$order->title = sprintf($this->lang->order->titleLBL, $order->customerName, $productName, date('Y-m-d', strtotime($order->createdDate)));
$orders[$order->id] = $order->title;
}
if ($type == 'select') {
if ($id) {
die(html::select("idvalues[{$id}]", $orders, '', 'class="form-control"'));
}
die(html::select('idvalue', $orders, '', 'class=form-control'));
}
if ($type == 'board') {
die($this->loadModel('todo', 'oa')->buildBoardList($orders, 'order'));
}
die(json_encode($orders));
}
示例6: 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;
}
示例7: printCustomerBlock
/**
* Print customer block.
*
* @access public
* @return void
*/
public function printCustomerBlock()
{
$this->app->loadLang('customer', 'crm');
$params = $this->get->param;
$params = json_decode(base64_decode($params));
if (!isset($params->type)) {
$params->type = '';
}
$this->app->loadClass('date');
$thisWeek = date::getThisWeek();
$this->session->set('customerList', $this->createLink('crm.dashboard', 'index'));
if ($this->get->app == 'sys') {
$this->session->set('customerList', 'javascript:$.openEntry("home")');
}
$customerIdList = $this->loadModel('customer', 'crm')->getCustomersSawByMe();
if (empty($customerIdList)) {
$customers = array();
} else {
$customers = $this->dao->select('*')->from(TABLE_CUSTOMER)->where('deleted')->eq(0)->andWhere('id')->in($customerIdList)->beginIF($params->type and $params->type == 'today')->andWhere('nextDate')->eq(helper::today())->fi()->beginIF($params->type and $params->type == 'thisweek')->andWhere('nextDate')->between($thisWeek['begin'], $thisWeek['end'])->fi()->orderBy($params->orderBy)->limit($params->num)->fetchAll('id');
}
$this->view->sso = base64_decode($this->get->sso);
$this->view->code = $this->get->blockid;
$this->view->customers = $customers;
$this->display();
}