本文整理汇总了PHP中helper::today方法的典型用法代码示例。如果您正苦于以下问题:PHP helper::today方法的具体用法?PHP helper::today怎么用?PHP helper::today使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helper
的用法示例。
在下文中一共展示了helper::today方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEfforts
/**
* Get efforts.
*
* @param string $account
* @param int $date
* @param string $project
* @access public
* @return void
*/
public function getEfforts($account = 'all', $date, $project = '', $begin = '', $end = '')
{
$this->loadModel('todo');
$efforts = array();
if ($date == 'today') {
$begin = $this->todo->today();
$end = $begin;
} elseif ($date == 'thisweek') {
extract($this->todo->getThisWeek());
} elseif ($date == 'lastweek') {
extract($this->todo->getLastWeek());
} elseif ($date == 'thismonth') {
extract($this->todo->getThisMonth());
} elseif ($date == 'lastmonth') {
extract($this->todo->getLastMonth());
} elseif ($date == 'select') {
if ($begin == '') {
$begin = helper::today();
}
if ($end == '') {
$end = helper::today();
}
} elseif ($date == 'all') {
$begin = '1970-01-01';
$end = '2109-01-01';
} else {
$begin = $end = $date;
}
$efforts = $this->dao->select('*')->from(TABLE_SUNEFFORTEVERYDAY)->where('account')->eq($this->app->user->account)->andWhere("date >= '{$begin}'")->andWhere("date <= '{$end}'")->beginIF($project != '')->andWhere('project')->eq($project)->fi()->beginIF($account != 'all')->andWhere('account')->eq($account)->fi()->fetchAll('id');
return $efforts;
}
示例2: todo
/**
* Todos of a user.
*
* @param string $account
* @param string $type the todo type, today|lastweek|thisweek|all|undone, or a date.
* @param string $status
* @param string $orderBy
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
public function todo($account, $type = 'today', $status = 'all', $orderBy = 'date,status,begin', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
/* Set thie url to session. */
$uri = $this->app->getURI(true);
$this->session->set('todoList', $uri);
$this->session->set('bugList', $uri);
$this->session->set('taskList', $uri);
/* Load pager. */
$this->app->loadClass('pager', $static = true);
$pager = pager::init($recTotal, $recPerPage, $pageID);
/* Append id for secend sort. */
$sort = $this->loadModel('common')->appendOrder($orderBy);
/* Get user, totos. */
$user = $this->user->getById($account);
$account = $user->account;
$todos = $this->todo->getList($type, $account, $status, 0, $pager, $sort);
$date = (int) $type == 0 ? helper::today() : $type;
/* set menus. */
$this->lang->set('menugroup.user', 'company');
$this->view->userList = $this->user->setUserList($this->user->getPairs('noempty|noclosed|nodeleted'), $account);
$this->view->title = $this->lang->user->common . $this->lang->colon . $this->lang->user->todo;
$this->view->position[] = $this->lang->user->todo;
$this->view->tabID = 'todo';
$this->view->date = $date;
$this->view->todos = $todos;
$this->view->user = $user;
$this->view->account = $account;
$this->view->type = $type;
$this->view->status = $status;
$this->view->orderBy = $orderBy;
$this->view->pager = $pager;
$this->display();
}
示例3: createSingleJSON
/**
* Create json data of single charts
* @param array $sets
* @param array $dateList
* @return string the json string
*/
public function createSingleJSON($sets, $dateList)
{
$today = helper::today();
$data = '[';
foreach ($dateList as $i => $date) {
$date = date('Y-m-d', strtotime($date));
// $data .= isset($sets[$date]) ? "{$sets[$date]->value}," : "'',";
if ($date <= $today) {
$data .= isset($sets[$date]) ? "{$sets[$date]->value}," : "'',";
}
}
$data = rtrim($data, ',');
$data .= ']';
return $data;
}
示例4: ajaxUpload
/**
* AJAX: get upload request from the web editor.
*
* @access public
* @return void
*/
public function ajaxUpload()
{
$file = $this->file->getUpload('imgFile');
$file = $file[0];
if ($file) {
if (@move_uploaded_file($file['tmpname'], $this->file->savePath . $file['pathname'])) {
$url = $this->file->webPath . $file['pathname'];
$file['addedBy'] = $this->app->user->account;
$file['addedDate'] = helper::today();
unset($file['tmpname']);
$this->dao->insert(TABLE_FILE)->data($file)->exec();
die(json_encode(array('error' => 0, 'url' => $url)));
} else {
$error = strip_tags(sprintf($this->lang->file->errorCanNotWrite, $this->file->savePath, $this->file->savePath));
die(json_encode(array('error' => 1, 'message' => $error)));
}
}
}
示例5: saveUpload
/**
* Save upload.
*
* @param string $objectType
* @param string $objectID
* @param string $extra
* @access public
* @return array
*/
public function saveUpload($objectType = '', $objectID = '', $extra = '')
{
$fileTitles = array();
$now = helper::today();
$files = $this->getUpload();
foreach ($files as $id => $file) {
move_uploaded_file($file['tmpname'], $this->savePath . $file['pathname']);
$file['objectType'] = $objectType;
$file['objectID'] = $objectID;
$file['addedBy'] = $this->app->user->account;
$file['addedDate'] = $now;
$file['extra'] = $extra;
unset($file['tmpname']);
$this->dao->insert(TABLE_FILE)->data($file)->exec();
$fileTitles[$this->dao->lastInsertId()] = $file['title'];
}
return $fileTitles;
}
示例6: manageMembers
public function manageMembers($planID)
{
extract($_POST);
// $accounts = array_unique($accounts);
foreach ($accounts as $key => $account) {
if (empty($account)) {
continue;
}
$member = new stdclass();
$member->role = $roles[$key];
$member->days = $days[$key];
$member->hours = $hours[$key];
$member->project = $projs[$key];
$member->plan = (int) $planID;
$member->account = $account;
$member->join = helper::today();
$this->dao->delete()->from(TABLE_TEAM)->where('plan')->eq($member->plan)->andWhere('account')->eq($account)->andWhere('project')->eq('0')->exec();
//$this->dao->delete()->from(TABLE_TEAM)
// ->where('project')->eq($member->project)
// ->andWhere('account')->eq($account)->exec();
$this->dao->insert(TABLE_TEAM)->data($member)->exec();
// $mode = $modes[$key];
// if($mode == 'update')
// {
// $this->dao->update(TABLE_TEAM)
// ->data($member)
// ->where('plan')->eq((int)$planID)
// ->andWhere('account')->eq($account)
// ->exec();
// }
// else
// {
// // $member->plan = (int)$planID;
// $member->account = $account;
// $member->join = helper::today();
// $this->dao->insert(TABLE_TEAM)->data($member)->exec();
// }
}
}
示例7: 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;
}
示例8: createAsset
public function createAsset()
{
$skipFields = '';
$skipFields .= $this->loadModel('custom')->dealWithCustomArrayField();
$now = helper::now();
$today = helper::today();
$address = fixer::input('post')->get('address');
$extendaddress = fixer::input('post')->get('extendaddress');
$devicenumber = fixer::input('post')->get('devicenumber');
$code = fixer::input('post')->get('code');
$module = $this->loadModel('info')->getAllChildId(fixer::input('post')->cleanInt('module')->setDefault('module', 0)->get('module'), 'asset');
$result1 = $this->dao->select('*')->from(TABLE_INFOASSET)->where('address')->eq($extendaddress)->andWhere('address')->ne('IP Format Error')->andWhere('address')->ne('Conflict!')->andWhere('address')->ne('')->beginIF($module)->andWhere('module')->in($module)->fi()->fetchAll();
$result2 = $this->dao->select('*')->from(TABLE_INFOASSET)->where('extendaddress')->eq($address)->andWhere('extendaddress')->ne('IP Format Error')->andWhere('extendaddress')->ne('Conflict!')->andWhere('extendaddress')->ne('')->beginIF($module)->andWhere('module')->in($module)->fi()->fetchAll();
$asset = fixer::input('post')->cleanInt('module')->setDefault('module', 0)->add('createdBy', $this->app->user->account)->add('createdDate', $now)->add('lastEditedDate', $now)->add('registdate', $today)->setDefault('module', 0)->setDefault('lenddate', '0000-00-00')->setDefault('returndate', '0000-00-00')->setDefault('product', '0')->setDefault('project', '0')->setIF(!(strlen(trim($extendaddress)) == 0) && !validater::checkIP($extendaddress), 'extendaddress', 'IP Format Error')->setIF(!(strlen(trim($address)) == 0) && !validater::checkIP($address), 'address', 'IP Format Error')->removeIF(trim($address) == trim($extendaddress), 'extendaddress')->setIF($result1, 'extendaddress', 'Conflict!')->setIF($result2, 'address', 'Conflict!')->get();
$condition = "`lib` = '{$asset->lib}' AND module = '{$asset->module}'";
$conditionaddress = $condition . " and address != 'IP Format Error' and address != 'Conflict!'";
$conditionextaddress = $condition . " and extendaddress != 'IP Format Error' and extendaddress != 'Conflict!'";
$this->dao->insert(TABLE_INFOASSET)->data($asset)->autoCheck($skipFields)->batchCheck($this->config->asset->create->requiredFields, 'notempty')->check('hostname', 'unique', $condition)->checkIF(!(strlen(trim($address)) == 0), 'address', 'unique', $conditionaddress)->checkIF(!(strlen(trim($extendaddress)) == 0), 'extendaddress', 'unique', $conditionextaddress)->checkIF(!(strlen(trim($devicenumber)) == 0), 'devicenumber', 'unique', $condition)->checkIF(!(strlen(trim($code)) == 0), 'code', 'unique', $condition)->exec();
if (!dao::isError()) {
$assetID = $this->dao->lastInsertID();
return $assetID;
}
return false;
}
示例9:
<th><?php
echo $lang->task->assignedTo;
?>
</th>
<td><?php
echo html::select('assignedTo', $members, $task->openedBy, "class='form-control chosen'");
?>
</td><td></td>
</tr>
<tr>
<th><?php
echo $lang->task->finishedDate;
?>
</th>
<td><div class='datepicker-wrapper'><?php
echo html::input('finishedDate', helper::today(), "class='form-control form-date'");
?>
</div></td><td></td>
</tr>
<tr>
<th><?php
echo $lang->comment;
?>
</th>
<td colspan='2'><?php
echo html::textarea('comment', '', "rows='6' class='w-p98'");
?>
</td>
</tr>
<tr>
示例10:
?>
';
</script>
<form method='post' target='hiddenwin'>
<table class='table-1'>
<caption><?php
echo $sql->title;
?>
</caption>
<tr>
<th class='w-100px rowhead'><?php
echo $lang->story->reviewedDate;
?>
</th>
<td><?php
echo html::input('reviewedDate', helper::today(), 'class=text-3');
?>
</td>
</tr>
<tr>
<th class='rowhead'><?php
echo $lang->story->reviewResult;
?>
</th>
<td><?php
echo html::select('result', $lang->story->reviewResultList, '', 'class=select-3 onchange="switchShow(this.value)"');
?>
</td>
</tr>
<tr id='rejectedReasonBox' class='hidden'>
<th class='rowhead'><?php
示例11: linkContact
/**
* Link contact.
*
* @param int $customerID
* @access public
* @return bool
*/
public function linkContact($customerID)
{
$this->loadModel('action');
$this->loadModel('contact');
if (!$this->post->selectContact) {
$contact = fixer::input('post')->add('customer', $customerID)->add('createdBy', $this->app->user->account)->add('createdDate', helper::now())->remove('contact')->get();
return $this->contact->create($contact);
}
if ($this->post->contact) {
$contactID = $this->post->contact;
$contact = $this->contact->getByID($contactID);
$contacts = $this->contact->getPairs();
if ($contact->customer != $customerID or $contact->left != '' and strtotime($contact->left) <= strtotime(helper::today())) {
$resume = new stdclass();
$resume->customer = $customerID;
$resume->contact = $contactID;
$resumeID = $this->loadModel('resume')->create($contactID, $resume);
if ($resumeID) {
$changes[] = array('field' => 'customer', 'old' => $contact->customer, 'new' => $customerID, 'diff' => '');
$actionID = $this->action->create('contact', $contactID, 'Edited');
$this->action->logHistory($actionID, $changes);
}
$this->loadModel('action')->create('customer', $customerID, 'linkContact', '', $this->post->newcontact ? $this->post->realname : $contacts[$this->post->contact]);
return array('result' => 'success', 'message' => $this->lang->saveSuccess);
}
}
return array('result' => 'fail', 'message' => dao::getError());
}
示例12: pasteImage
/**
* Paste image in kindeditor at firefox and chrome.
*
* @param string $data
* @param string $uid
* @access public
* @return string
*/
public function pasteImage($data, $uid)
{
$data = str_replace('\\"', '"', $data);
if (!$this->checkSavePath()) {
return false;
}
ini_set('pcre.backtrack_limit', strlen($data));
preg_match_all('/<img src="(data:image\\/(\\S+);base64,(\\S+))" .+ \\/>/U', $data, $out);
foreach ($out[3] as $key => $base64Image) {
$imageData = base64_decode($base64Image);
$imageSize = array('width' => 0, 'height' => 0);
$file['extension'] = $out[2][$key];
$file['pathname'] = $this->setPathName($key, $file['extension']);
$file['size'] = strlen($imageData);
$file['addedBy'] = $this->app->user->account;
$file['addedDate'] = helper::today();
$file['title'] = basename($file['pathname']);
$file['editor'] = 1;
file_put_contents($this->savePath . $file['pathname'], $imageData);
$this->compressImage($this->savePath . $file['pathname']);
$imageSize = $this->getImageSize($this->savePath . $file['pathname']);
$file['width'] = $imageSize['width'];
$file['height'] = $imageSize['height'];
$this->dao->insert(TABLE_FILE)->data($file)->exec();
$_SESSION['album'][$uid][] = $this->dao->lastInsertID();
$data = str_replace($out[1][$key], $this->webPath . $file['pathname'], $data);
}
return $data;
}
示例13: processAttend
/**
* Process attend, add dayName, comput today's status.
*
* @param object $attend
* @access public
* @return object
*/
public function processAttend($attend)
{
/* Compute status and remove signOut if date is today. */
if ($attend->date == helper::today()) {
if (time() < strtotime("{$attend->date} {$this->config->attend->signOutLimit}")) {
$attend->signOut = '00:00:00';
}
$status = $this->computeStatus($attend);
$attend->status = $status;
if ($status == 'early') {
$attend->status = 'normal';
}
if ($status == 'both') {
$attend->status = 'late';
}
}
if ($attend->status == '') {
$attend->status = $this->computeStatus($attend);
}
/* Remove time. */
if ($attend->signIn == '00:00:00') {
$attend->signIn = '';
}
if ($attend->signOut == '00:00:00') {
$attend->signOut = '';
}
if ($attend->manualIn == '00:00:00') {
$attend->manualIn = '';
}
if ($attend->manualOut == '00:00:00') {
$attend->manualOut = '';
}
$dayIndex = date('w', strtotime($attend->date));
$attend->dayName = $this->lang->datepicker->dayNames[$dayIndex];
return $attend;
}
示例14: processBurnData
/**
* Process burndown datas when the sets is smaller than the itemCounts.
*
* @param array $sets
* @param int $itemCounts
* @param date $begin
* @param date $end
* @param string $mode
* @access public
* @return array
*/
public function processBurnData($sets, $itemCounts, $begin, $end, $mode = 'noempty')
{
$burnCounts = count($sets);
$current = helper::today();
if ($end != '0000-00-00') {
$period = helper::diffDate($end, $begin) + 1;
$counts = $period > $itemCounts ? $itemCounts : $period;
} else {
$counts = $itemCounts;
}
for ($i = 0; $i < $counts - $burnCounts; $i++) {
if (helper::diffDate($current, $end) > 0) {
break;
}
if (!isset($sets[$current]) and $mode != 'noempty') {
$sets[$current]->name = $current;
$sets[$current]->value = '';
}
$nextDay = date(DT_DATE1, strtotime('next day', strtotime($current)));
$current = $nextDay;
}
return $sets;
}
示例15: foreach
</th>
<th class='w-status'><?php
echo $lang->statusAB;
?>
</th>
</tr>
</thead>
<tbody>
<?php
foreach ($allBugs as $bug) {
?>
<?php
if (isset($planBugs[$bug->id])) {
continue;
}
if ($bug->plan and helper::diffDate($plans[$bug->plan], helper::today()) > 0) {
continue;
}
?>
<tr>
<td class='text-left'>
<input class='ml-10px' type='checkbox' name='bugs[]' value='<?php
echo $bug->id;
?>
'/>
<?php
echo html::a($this->createLink('bug', 'view', "bugID={$bug->id}"), $bug->id);
?>
</td>
<td><span class='<?php
echo 'pri' . zget($lang->bug->priList, $bug->pri, $bug->pri);