本文整理汇总了PHP中date::now方法的典型用法代码示例。如果您正苦于以下问题:PHP date::now方法的具体用法?PHP date::now怎么用?PHP date::now使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类date
的用法示例。
在下文中一共展示了date::now方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: batchEdit
/**
* Batch edit todo.
*
* @param string $from example:myTodo, todoBatchEdit.
* @param string $type
* @param string $account
* @param string $status
* @access public
* @return void
*/
public function batchEdit($from = '', $type = 'today', $account = '', $status = 'all')
{
/* Get form data for my-todo. */
if ($from == 'myTodo') {
/* Initialize vars. */
$editedTodos = array();
$todoIDList = array();
$columns = 7;
$showSuhosinInfo = false;
if ($account == '') {
$account = $this->app->user->account;
}
$bugs = $this->bug->getUserBugPairs($account);
$tasks = $this->task->getUserTaskPairs($account, $status);
$allTodos = $this->todo->getList($type, $account, $status);
if ($this->post->todoIDList) {
$todoIDList = $this->post->todoIDList;
}
/* Initialize todos whose need to edited. */
foreach ($allTodos as $todo) {
if (in_array($todo->id, $todoIDList)) {
$editedTodos[$todo->id] = $todo;
}
}
foreach ($editedTodos as $todo) {
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 = str_replace(':', '', $todo->begin);
$todo->end = str_replace(':', '', $todo->end);
}
/* Judge whether the edited todos is too large. */
$showSuhosinInfo = $this->loadModel('common')->judgeSuhosinSetting(count($editedTodos), $columns);
/* Set the sessions. */
$this->app->session->set('showSuhosinInfo', $showSuhosinInfo);
/* Assign. */
$title = $this->lang->todo->common . $this->lang->colon . $this->lang->todo->batchEdit;
$position[] = html::a($this->createLink('my', 'todo'), $this->lang->my->todo);
$position[] = $this->lang->todo->common;
$position[] = $this->lang->todo->batchEdit;
if ($showSuhosinInfo) {
$this->view->suhosinInfo = $this->lang->suhosinInfo;
}
$this->view->bugs = $bugs;
$this->view->tasks = $tasks;
$this->view->editedTodos = $editedTodos;
$this->view->times = date::buildTimeList($this->config->todo->times->begin, $this->config->todo->times->end, $this->config->todo->times->delta);
$this->view->time = date::now();
$this->view->title = $title;
$this->view->position = $position;
$this->display();
} elseif ($from == 'todoBatchEdit') {
$allChanges = $this->todo->batchUpdate();
foreach ($allChanges as $todoID => $changes) {
if (empty($changes)) {
continue;
}
$actionID = $this->loadModel('action')->create('todo', $todoID, 'edited');
$this->action->logHistory($actionID, $changes);
}
die(js::locate($this->session->todoList, 'parent'));
}
}
示例2: batchCreate
/**
* Batch create todo
*
* @param string $date
* @access public
* @return void
*/
public function batchCreate($date = 'today')
{
if ($date == 'today') {
$date = date(DT_DATE1, time());
}
if (!empty($_POST)) {
$this->todo->batchCreate();
if (dao::isError()) {
$this->send(array('result' => 'fail', 'message' => dao::getError()));
}
/* Locate the browser. */
$date = str_replace('-', '', $this->post->date);
if ($date == '') {
$date = 'future';
} else {
if ($date == date('Ymd')) {
$date = 'today';
}
}
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('todo', 'calendar', "date={$date}")));
}
$this->view->title = $this->lang->todo->common . $this->lang->colon . $this->lang->todo->batchCreate;
$this->view->date = (int) $date == 0 ? $date : date('Y-m-d', strtotime($date));
$this->view->times = date::buildTimeList($this->config->todo->times->begin, $this->config->todo->times->end, $this->config->todo->times->delta);
$this->view->time = date::now();
$this->view->users = $this->loadModel('user')->getPairs('noclosed,nodeleted');
$this->view->modalWidth = '85%';
$this->display();
}