本文整理匯總了PHP中w2p_Database_Query::dbfnDateAdd方法的典型用法代碼示例。如果您正苦於以下問題:PHP w2p_Database_Query::dbfnDateAdd方法的具體用法?PHP w2p_Database_Query::dbfnDateAdd怎麽用?PHP w2p_Database_Query::dbfnDateAdd使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類w2p_Database_Query
的用法示例。
在下文中一共展示了w2p_Database_Query::dbfnDateAdd方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getTaskList
public function getTaskList($userId, $days = 30)
{
/*
* This list of fields - id, name, description, startDate, endDate,
* updatedDate - are named specifically for the iCal creation.
* If you change them, it's probably going to break. So don't do that.
*/
$q = new w2p_Database_Query();
$q->addQuery('t.task_id as id');
$q->addQuery('task_name as name');
$q->addQuery('task_description as description');
$q->addQuery('task_start_date as startDate');
$q->addQuery('task_end_date as endDate');
$q->addQuery('task_updated as updatedDate');
$q->addQuery('CONCAT(\'' . W2P_BASE_URL . '/index.php?m=tasks&a=view&task_id=' . '\', t.task_id) as url');
$q->addQuery('p.project_id, p.project_name');
$q->addTable('tasks', 't');
$q->addWhere('(task_start_date < ' . $q->dbfnDateAdd($q->dbfnNow(), $days, 'DAY') . ' OR task_end_date < ' . $q->dbfnDateAdd($q->dbfnNow(), $days, 'DAY') . ')');
$q->addWhere('task_percent_complete < 100');
$q->addWhere('task_dynamic <> 1');
$q->innerJoin('user_tasks', 'ut', 'ut.task_id = t.task_id');
$q->addWhere('ut.user_id = ' . $userId);
$q->innerJoin('projects', 'p', 'p.project_id = t.task_project');
$q->addWhere('project_active > 0');
if (($template_status = w2PgetConfig('template_projects_status_id')) != '') {
$q->addWhere('project_status <> ' . $template_status);
}
$q->addOrder('task_start_date, task_end_date');
return $q->loadList();
}
示例2: getCalendarEvents
public function getCalendarEvents($userId, $days = 30)
{
/*
* This list of fields - id, name, description, startDate, endDate,
* updatedDate - are named specifically for the iCal creation.
* If you change them, it's probably going to break. So don't do that.
*/
$q = new w2p_Database_Query();
$q->addQuery('e.event_id as id');
$q->addQuery('event_title as name');
$q->addQuery('event_description as description');
$q->addQuery('event_start_date as startDate');
$q->addQuery('event_end_date as endDate');
$q->addQuery("'" . $q->dbfnNowWithTZ() . "' as updatedDate");
$q->addQuery('CONCAT(\'' . W2P_BASE_URL . '/index.php?m=calendar&a=view&event_id=' . '\', e.event_id) as url');
$q->addQuery('projects.project_id, projects.project_name');
$q->addTable('events', 'e');
$q->leftJoin('projects', 'projects', 'e.event_project = projects.project_id');
$q->addWhere('(event_start_date > ' . $q->dbfnNow() . ' OR event_end_date > ' . $q->dbfnNow() . ')');
$q->addWhere('(event_start_date < ' . $q->dbfnDateAdd($q->dbfnNow(), $days, 'DAY') . ' OR event_end_date < ' . $q->dbfnDateAdd($q->dbfnNow(), $days, 'DAY') . ')');
$q->innerJoin('user_events', 'ue', 'ue.event_id = e.event_id');
$q->addWhere('ue.user_id = ' . $userId);
$q->addOrder('event_start_date');
return $q->loadList();
}