예제 #1
0
 public function getProjectTaskLinksByCategory($AppUI, $project_id = 0, $task_id = 0, $category_id = 0, $search = '')
 {
     // load the following classes to retrieved denied records
     $project = new CProject();
     $task = new CTask();
     // SETUP FOR LINK LIST
     $q = new DBQuery();
     $q->addQuery('links.*');
     $q->addQuery('contact_first_name, contact_last_name');
     $q->addQuery('project_name, project_color_identifier, project_status');
     $q->addQuery('task_name, task_id');
     $q->addTable('links');
     $q->leftJoin('users', 'u', 'user_id = link_owner');
     $q->leftJoin('contacts', 'c', 'user_contact = contact_id');
     if ($search != '') {
         $q->addWhere('(link_name LIKE \'%' . $search . '%\' OR link_description LIKE \'%' . $search . '%\')');
     }
     if ($project_id > 0) {
         // Project
         $q->addWhere('link_project = ' . (int) $project_id);
     }
     if ($task_id > 0) {
         // Task
         $q->addWhere('link_task = ' . (int) $task_id);
     }
     if ($category_id >= 0) {
         // Category
         $q->addWhere('link_category = ' . $category_id);
     }
     // Permissions
     $project->setAllowedSQL($AppUI->user_id, $q, 'link_project');
     $task->setAllowedSQL($AppUI->user_id, $q, 'link_task and task_project = link_project');
     $q->addOrder('project_name, link_name');
     return $q->loadList();
 }
예제 #2
0
 public function getProjectTaskLinksByCategory($notUsed = null, $project_id = 0, $task_id = 0, $category_id = 0, $search = '')
 {
     // load the following classes to retrieved denied records
     $project = new CProject();
     $project->overrideDatabase($this->_query);
     $task = new CTask();
     $task->overrideDatabase($this->_query);
     // SETUP FOR LINK LIST
     $q = $this->_getQuery();
     $q->addQuery('links.*');
     $q->addTable('links');
     $q->leftJoin('projects', 'pr', 'project_id = link_project');
     $q->leftJoin('tasks', 't', 'task_id = link_task');
     if ($search != '') {
         $q->addWhere('(link_name LIKE \'%' . $search . '%\' OR link_description LIKE \'%' . $search . '%\')');
     }
     if ($project_id > 0) {
         // Project
         $q->addQuery('project_name, project_color_identifier, project_status');
         $q->addWhere('link_project = ' . (int) $project_id);
     }
     if ($task_id > 0) {
         // Task
         $q->addQuery('task_name, task_id');
         $q->addWhere('link_task = ' . (int) $task_id);
     }
     if ($category_id >= 0) {
         // Category
         $q->addWhere('link_category = ' . $category_id);
     }
     // Permissions
     $q = $project->setAllowedSQL($this->_AppUI->user_id, $q, 'link_project');
     $q = $task->setAllowedSQL($this->_AppUI->user_id, $q, 'link_task and task_project = link_project');
     $q->addOrder('project_name, link_name');
     return $q->loadList();
 }
예제 #3
0
} else {
    if (is_array($projects)) {
        //pull all tasks into an array keyed by the project id, and get the tasks in hierarchy
        if ($showAllGantt) {
            // insert tasks into Gantt Chart
            // select for tasks for each project
            // pull tasks
            $q = new w2p_Database_Query();
            $q->addTable('tasks', 't');
            $q->addQuery('t.task_id, task_parent, task_name, task_start_date, task_end_date, task_duration, task_duration_type, task_priority, task_percent_complete, task_order, task_project, task_milestone, project_id, project_name, task_dynamic');
            $q->addJoin('projects', 'p', 'project_id = t.task_project');
            $q->addOrder('project_id, task_start_date');
            $q->addWhere('project_original_parent = ' . (int) $original_project_id);
            //$tasks = $q->loadList();
            $task = new CTask();
            $task->setAllowedSQL($AppUI->user_id, $q);
            $proTasks = $q->loadHashList('task_id');
            $orrarr[] = array('task_id' => 0, 'order_up' => 0, 'order' => '');
            $end_max = '0000-00-00 00:00:00';
            $start_min = date('Y-m-d H:i:s');
            //pull the tasks into an array
            foreach ($proTasks as $rec) {
                if ($rec['task_start_date'] == '0000-00-00 00:00:00') {
                    $rec['task_start_date'] = date('Y-m-d H:i:s');
                }
                $tsd = new w2p_Utilities_Date($rec['task_start_date']);
                if ($tsd->before(new w2p_Utilities_Date($start_min))) {
                    $start_min = $rec['task_start_date'];
                }
                // calculate or set blank task_end_date if unset
                if ($rec['task_end_date'] == '0000-00-00 00:00:00') {
예제 #4
0
 $proj = new CProject();
 $task = new CTask();
 $ss = $start_date->format(FMT_DATETIME_MYSQL);
 $se = $end_date->format(FMT_DATETIME_MYSQL);
 $query->addTable('tasks', 't');
 $query->leftJoin('projects', 'p', 'p.project_id = t.task_project');
 $query->addQuery('t.*');
 if ($use_period) {
     $query->addWhere("((task_start_date >= '{$ss}' AND task_start_date <= '{$se}') " . " OR (task_end_date <= '{$se}' AND task_end_date >= '{$ss}'))");
 }
 if ($project_id) {
     $query->addWhere('t.task_project = ' . $project_id);
 }
 // Now add the required restrictions.
 $proj->setAllowedSQL($AppUI->user_id, $query, null, 'p');
 $task->setAllowedSQL($AppUI->user_id, $query, null, 't');
 $query->addOrder('task_end_date');
 $task_list_hash = $query->loadHashList('task_id');
 $query->clear();
 $task_list = array();
 $task_assigned_users = array();
 foreach ($task_list_hash as $task_id => $task_data) {
     $task = new CTask();
     $task->bind($task_data);
     $task_list[$task_id] = $task;
     $task_assigned_users[$task_id] = $task->getAssignedUsers();
 }
 $user_usage = array();
 $task_dates = array();
 $actual_date = $start_date;
 $days_header = '';
예제 #5
0
$q->addWhere('a.task_project = pr.project_id');
$q->addJoin('users', 'b', 'a.task_owner = b.user_id', 'inner');
$q->addJoin('contacts', 'ct', 'ct.contact_id = b.user_contact', 'inner');
$q->addWhere('task_percent_complete < 100');
$q->addWhere('pr.project_active = 1');
if (($template_status = w2PgetConfig('template_projects_status_id')) != '') {
    $q->addWhere('pr.project_status <> ' . (int) $template_status);
}
if ($project_id != 0) {
    $q->addWhere('task_project = ' . (int) $project_id);
}
$q->addWhere('task_end_date BETWEEN \'' . $date->format(FMT_DATETIME_MYSQL) . '\' AND \'' . $next_week->format(FMT_DATETIME_MYSQL) . '\'');
$proj = new CProject();
$proj->setAllowedSQL($AppUI->user_id, $q, null, 'pr');
$obj = new CTask();
$obj->setAllowedSQL($AppUI->user_id, $q);
$tasks = $q->loadHashList('task_id');
if ($err = db_error()) {
    $AppUI->setMsg($err, UI_MSG_ERROR);
    $AppUI->redirect();
}
// Now grab the resources allocated to the tasks.
$task_list = array_keys($tasks);
$assigned_users = array();
// Build the array
foreach ($task_list as $tid) {
    $assigned_users[$tid] = array();
}
if (count($tasks)) {
    $q->clear();
    $q->addQuery('a.task_id, a.perc_assignment, b.*, c.*');
예제 #6
0
$q->addTable('files', 'f');
if ($catsql) {
    $q->addWhere($catsql);
}
if ($company_id) {
    $q->addWhere("project_company = {$company_id}");
}
if ($project_id) {
    $q->addWhere("file_project = {$project_id}");
}
if ($task_id) {
    $q->addWhere("file_task = {$task_id}");
}
$q->addGroup("file_version_id");
$project->setAllowedSQL($AppUI->user_id, $q, 'file_project');
$task->setAllowedSQL($AppUI->user_id, $q, 'file_task');
// SETUP FOR FILE LIST
$q2 = new DBQuery();
$q2->addQuery(array('f.*', 'max(f.file_id) as  latest_id', 'count(f.file_version) as file_versions', 'round(max(f.file_version),2) as file_lastversion'));
$q2->addTable('files', 'f');
//$q2->leftJoin('users', 'cu', 'cu.user_id = f.file_checkout');
//$q2->leftJoin('users', 'u', 'u.user_id = f.file_owner');
//$q2->leftJoin('contacts', 'cont', 'cont.contact_id = u.user_contact');
$project->setAllowedSQL($AppUI->user_id, $q2, 'file_project');
$task->setAllowedSQL($AppUI->user_id, $q2, 'file_task');
if ($catsql) {
    $q2->addWhere($catsql);
}
if ($company_id) {
    $q2->addWhere("project_company = {$company_id}");
}
예제 #7
0
}
if ($project_id) {
    // Project
    $q->addWhere('link_project = ' . $project_id);
}
if ($task_id) {
    // Task
    $q->addWhere('link_task = ' . $task_id);
}
if ($catsql) {
    // Category
    $q->addWhere($catsql);
}
// Permissions
$project->setAllowedSQL($AppUI->user_id, $q, 'link_project');
$task->setAllowedSQL($AppUI->user_id, $q, 'link_task and task_project = link_project');
$q->addOrder('project_name, link_name');
//LIMIT ' . $xpg_min . ', ' . $xpg_pagesize ;
if ($canRead) {
    $links = $q->loadList();
} else {
    if ($canAccess) {
        $links = array();
    } else {
        $AppUI->redirect('m=public&a=access_denied');
    }
}
// counts total recs from selection
$xpg_totalrecs = count($links);
// How many pages are we dealing with here ??
$xpg_total_pages = $xpg_totalrecs > $xpg_pagesize ? ceil($xpg_totalrecs / $xpg_pagesize) : 0;
예제 #8
0
/**
 * @param $project_id
 * @param $AppUI
 *
 * @return Associative
 */
function __extract_from_tasks_viewgantt($project_id, $AppUI)
{
    $q = new w2p_Database_Query();
    $q->addTable('tasks', 't');
    $q->addJoin('projects', 'p', 'p.project_id = t.task_project');
    $q->addQuery('t.task_id, task_parent, task_name, task_start_date, task_end_date' . ', task_duration, task_duration_type, task_priority, task_percent_complete' . ', task_order, task_project, task_milestone, project_name, task_dynamic');
    $q->addWhere('project_status != 7 AND task_dynamic = 1');
    if ($project_id) {
        $q->addWhere('task_project = ' . $project_id);
    }
    $task = new CTask();
    $q = $task->setAllowedSQL($AppUI->user_id, $q);
    $proTasks = $q->loadHashList('task_id');
    return $proTasks;
}