Ejemplo n.º 1
0
 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 DBQuery();
     $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($q->dbfnNow() . ' 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 = 0');
     $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();
 }
Ejemplo n.º 2
0
 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 DBQuery();
     $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->dbfnNow() . ' 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();
 }