本文整理汇总了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();
}