當前位置: 首頁>>代碼示例>>PHP>>正文


PHP w2p_Database_Query::dbfnDateDiff方法代碼示例

本文整理匯總了PHP中w2p_Database_Query::dbfnDateDiff方法的典型用法代碼示例。如果您正苦於以下問題:PHP w2p_Database_Query::dbfnDateDiff方法的具體用法?PHP w2p_Database_Query::dbfnDateDiff怎麽用?PHP w2p_Database_Query::dbfnDateDiff使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在w2p_Database_Query的用法示例。


在下文中一共展示了w2p_Database_Query::dbfnDateDiff方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: CProject

        echo db_error();
        $q->clear();
    }
}
$AppUI->savePlace();
$proj = new CProject();
$tobj = new CTask();
$allowedProjects = $proj->getAllowedSQL($AppUI->user_id, 'pr.project_id');
$allowedTasks = $tobj->getAllowedSQL($AppUI->user_id, 'ta.task_id');
// query my sub-tasks (ignoring task parents)
$q = new w2p_Database_Query();
$q->addQuery('ta.*');
$q->addQuery('project_name, pr.project_id, project_color_identifier');
$q->addQuery('tp.task_pinned');
$q->addQuery('ut.user_task_priority');
$dateDiffString = $q->dbfnDateDiff('ta.task_end_date', $q->dbfnNow()) . ' AS task_due_in';
$q->addQuery($dateDiffString);
$q->addTable('projects', 'pr');
$q->addTable('tasks', 'ta');
$q->addTable('user_tasks', 'ut');
$q->leftJoin('user_task_pin', 'tp', 'tp.task_id = ta.task_id and tp.user_id = ' . (int) $user_id);
$q->leftJoin('project_departments', 'project_departments', 'pr.project_id = project_departments.project_id OR project_departments.project_id IS NULL');
$q->leftJoin('departments', 'departments', 'departments.dept_id = project_departments.department_id OR dept_id IS NULL');
$q->addWhere('ut.task_id = ta.task_id');
$q->addWhere('ut.user_id = ' . (int) $user_id);
$q->addWhere('( ta.task_percent_complete < 100 or ta.task_percent_complete is null)');
$q->addWhere('ta.task_status = 0');
$q->addWhere('pr.project_id = ta.task_project');
if (!$showArcProjs) {
    $q->addWhere('project_active = 1');
    if (($template_status = w2PgetConfig('template_projects_status_id')) != '') {
開發者ID:,項目名稱:,代碼行數:31,代碼來源:

示例2: __extract_from_todo

/**
 * @param $user_id
 * @param $showArcProjs
 * @param $showLowTasks
 * @param $showInProgress
 * @param $showHoldProjs
 * @param $showDynTasks
 * @param $showPinned
 * @param $showEmptyDate
 * @param $task_type
 * @param $allowedTasks
 * @param $allowedProjects
 *
 * @return Array
 */
function __extract_from_todo($user_id, $showArcProjs, $showLowTasks, $showInProgress, $showHoldProjs, $showDynTasks, $showPinned, $showEmptyDate, $task_type, $allowedTasks, $allowedProjects)
{
    // query my sub-tasks (ignoring task parents)
    $q = new w2p_Database_Query();
    $q->addQuery('distinct(ta.task_id), ta.*, ta.task_start_date as task_start_datetime, ta.task_end_date as task_end_datetime');
    $q->addQuery('project_name, pr.project_id, project_color_identifier');
    $q->addQuery('tp.task_pinned');
    $q->addQuery('ut.user_task_priority');
    $dateDiffString = $q->dbfnDateDiff('ta.task_end_date', $q->dbfnNow()) . ' AS task_due_in';
    $q->addQuery($dateDiffString);
    $q->addTable('projects', 'pr');
    $q->addTable('tasks', 'ta');
    $q->addTable('user_tasks', 'ut');
    $q->leftJoin('user_task_pin', 'tp', 'tp.task_id = ta.task_id and tp.user_id = ' . (int) $user_id);
    $q->addWhere('ut.task_id = ta.task_id');
    $q->addWhere('ut.user_id = ' . (int) $user_id);
    $q->addWhere('( ta.task_percent_complete < 100 or ta.task_percent_complete is null)');
    $q->addWhere('ta.task_status = 0');
    $q->addWhere('pr.project_id = ta.task_project');
    if (!$showArcProjs) {
        $q->addWhere('project_active = 1');
        if (($template_status = w2PgetConfig('template_projects_status_id')) != '') {
            $q->addWhere('project_status <> ' . (int) $template_status);
        }
    }
    if (!$showLowTasks) {
        $q->addWhere('task_priority >= 0');
    }
    if ($showInProgress) {
        $q->addWhere('project_status = 3');
    }
    if (!$showHoldProjs) {
        if (($on_hold_status = w2PgetConfig('on_hold_projects_status_id')) != '') {
            $q->addWhere('project_status <> ' . (int) $on_hold_status);
        }
    }
    if (!$showDynTasks) {
        $q->addWhere('task_dynamic <> 1');
    }
    if ($showPinned) {
        $q->addWhere('task_pinned = 1');
    }
    if (!$showEmptyDate) {
        $q->addWhere('ta.task_start_date <> \'\' AND ta.task_start_date <> \'0000-00-00 00:00:00\'');
    }
    if ($task_type != '') {
        $q->addWhere('ta.task_type = ' . (int) $task_type);
    }
    if (count($allowedTasks)) {
        $q->addWhere($allowedTasks);
    }
    if (count($allowedProjects)) {
        $q->addWhere($allowedProjects);
    }
    $q->addOrder('task_end_date, task_start_date, task_priority');
    $tasks = $q->loadList();
    return $tasks;
}
開發者ID:illuminate3,項目名稱:web2project,代碼行數:73,代碼來源:cleanup_functions.php


注:本文中的w2p_Database_Query::dbfnDateDiff方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。