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(); }
function _buildQuery() { $q = new DBQuery(); $q->addTable($this->table); $q->addQuery('ticket'); $q->addQuery('subject'); $sql = ''; foreach ($this->search_fields as $field) { $sql .= " {$field} LIKE '%{$this->keyword}%' or "; } $sql = substr($sql, 0, -4); $q->addWhere($sql); return $q->prepare(true); }
function _buildQuery() { $q = new DBQuery(); $q->addTable($this->table); $q->addQuery('task_id'); $q->addQuery('task_name'); $q->addWhere('task_project != 0'); $sql = ''; foreach ($this->search_fields as $field) { $sql .= " {$field} LIKE '%{$this->keyword}%' or "; } $sql = substr($sql, 0, -4); $q->addWhere("({$sql})"); return $q->prepare(true); }
function setComplete($id) { global $AppUI; $task = new CTask(); if ($task->load($id)) { $q = new DBQuery(); $q->addTable('user_tasks'); $q->addQuery('user_id'); $q->addWhere('task_id = ' . $id); $q->addWhere('user_id = ' . $AppUI->user_id); $r = $q->loadResult(); if ($r != $AppUI->user_id) { $p = new CProject($task->task_project); if (!$p->project_id || $p->getManager() != $AppUI->user_id) { return 'Error'; } } $q->addTable('tasks'); $q->addUpdate('task_percent_complete', '100'); $q->addWhere('task_id = ' . $id); $q->exec(); return 'OK'; } return 'Error'; }
function dPsessionWrite($id, $data) { global $AppUI; $q = new DBQuery(); $q->addQuery('count(*) as row_count'); $q->addTable('sessions'); $q->addWhere("session_id = '{$id}'"); if (($qid =& $q->exec()) && (@$qid->fields['row_count'] > 0 || @$qid->fields[0] > 0)) { dprint(__FILE__, __LINE__, 11, "Updating session {$id}"); $q->query = null; $q->addUpdate('session_data', $data); if (isset($AppUI)) { $q->addUpdate('session_user', $AppUI->last_insert_id); } } else { dprint(__FILE__, __LINE__, 11, "Creating new session {$id}"); $q->query = null; $q->where = null; $q->addInsert('session_id', $id); $q->addInsert('session_data', $data); $q->addInsert('session_created', date('Y-m-d H:i:s')); } $q->exec(); $q->clear(); return true; }
function store() { $msg = $this->check(); if ($msg) { return get_class($this) . "::store-check failed"; } $q = new DBQuery(); if ($this->user_id) { // save the old password $perm_func = "updateLogin"; $q->addTable('users'); $q->addQuery('user_password'); $q->addWhere("user_id = {$this->user_id}"); $pwd = $q->loadResult(); if ($pwd != $this->user_password) { $this->user_password = md5($this->user_password); addHistory($this->_tbl, $this->user_id, 'password changed', 'Password changed from IP ' . $_SERVER['REMOTE_ADDR']); } else { $this->user_password = null; } $ret = db_updateObject('users', $this, 'user_id', false); } else { $perm_func = "addLogin"; $this->user_password = md5($this->user_password); $ret = db_insertObject('users', $this, 'user_id'); } if (!$ret) { return get_class($this) . "::store failed <br />" . db_error(); } else { $acl =& $GLOBALS['AppUI']->acl(); $acl->{$perm_func}($this->user_id, $this->user_username); return NULL; } }
function delete() { $q = new DBQuery(); $q->addTable('departments', 'dep'); $q->addQuery('dep.*'); $q->addWhere('dep.dept_parent = ' . $this->dept_id); $res = $q->exec(); if (db_num_rows($res)) { $q->clear(); return "deptWithSub"; } $q->clear(); $q->addTable('projects', 'p'); $q->addQuery('p.*'); $q->addWhere('p.project_department = ' . $this->dept_id); $res = $q->exec(); if (db_num_rows($res)) { $q->clear(); return "deptWithProject"; } // $sql = "DELETE FROM departments WHERE dept_id = $this->dept_id"; $q->clear(); $q->addQuery('*'); $q->setDelete('departments'); $q->addWhere('dept_id = ' . $this->dept_id); if (!$q->exec()) { $result = db_error(); } else { $result = NULL; } $q->clear(); return $result; }
function getCompanyDepartment($company_id) { global $AppUI; $q = new DBQuery(); $q->addTable('companies'); $q->addQuery('company_name'); $q->addWhere('company_id = ' . $company_id); $company_name = $q->loadResult(); if (!$company_name) { $AppUI->setMsg('Company not found', UI_MSG_ERROR); echo $AppUI->getMsg(); return; } $q->addTable('departments'); $q->addQuery('dept_id,dept_parent,dept_name'); $q->addWhere('dept_company = ' . $company_id); $q->addOrder('dept_parent, dept_name'); $depts = $q->loadHashList('dept_id'); if (!$depts) { $AppUI->setMsg('Company [ ' . $company_name . ' ] has no department', UI_MSG_WARNING); echo $AppUI->getMsg(); return; } include 'modules/public/resources.info.php'; }
function checkCompanyId($company_id) { $q = new DBQuery(); $q->addTable('companies'); $q->addQuery('count(*)'); $q->addWhere("company_id = '{$company_id}'"); return db_loadResult($q->prepare()); }
function _buildQuery() { $q = new DBQuery(); $q->addTable($this->table); $q->addQuery('company_id'); $q->addQuery('company_name'); $sql = array(); foreach ($this->search_fields as $field) { $sql[] = "{$field} LIKE '%{$this->keyword}%'"; } if (count($sql)) { $q->addWhere(implode(' OR ', $sql)); } $result = $q->prepare(); $q->clear(); return $result; }
function testUpdateBD() { $q = new DBQuery(); $q->addTable('eap'); $q->addQuery("id,nome,linha,coluna"); $q->addUpdate(nome, 'Dot Project'); $q->addWhere("id = 1"); $q->prepareUpdate(); $this->assertEqual($q->exec(), true); $q->clear(); }
function store() { $msg = $this->check(); if ($msg) { return get_class($this) . "::store-check failed"; } $q = new DBQuery(); if ($this->user_id) { // save the old password $perm_func = "updateLogin"; $q->addTable('users'); $q->addQuery('user_password'); $q->addWhere("user_id = {$this->user_id}"); $pwd = $q->loadResult(); if ($pwd != $this->user_password) { $this->user_password = md5($this->user_password); } else { $this->user_password = null; } $ret = db_updateObject('users', $this, 'user_id', false); } else { $perm_func = "addLogin"; $this->user_password = md5($this->user_password); $ret = db_insertObject('users', $this, 'user_id'); } if (!$ret) { return get_class($this) . "::store failed <br />" . db_error(); } else { $acl =& $GLOBALS['AppUI']->acl(); $acl->{$perm_func}($this->user_id, $this->user_username); //Insert Default Preferences //Lets check if the user has allready default users preferences set, if not insert the default ones $q->addTable('user_preferences', 'upr'); $q->addWhere("upr.pref_user = {$this->user_id}"); $uprefs = $q->loadList(); $q->clear(); if (!count($uprefs) && $this->user_id > 0) { //Lets get the default users preferences $q->addTable('user_preferences', 'dup'); $q->addWhere("dup.pref_user = 0"); $dprefs = $q->loadList(); $q->clear(); foreach ($dprefs as $dprefskey => $dprefsvalue) { $q->addTable('user_preferences', 'up'); $q->addInsert('pref_user', $this->user_id); $q->addInsert('pref_name', $dprefsvalue['pref_name']); $q->addInsert('pref_value', $dprefsvalue['pref_value']); $q->exec(); $q->clear(); } } return NULL; } }
function listCompaniesByType($type) { global $AppUI; $q = new DBQuery(); $q->addQuery('company_id, company_name'); $q->addTable('companies'); foreach ($type as $t) { $q->addWhere('company_type =' . $t); } $this->setAllowedSQL($AppUI->user_id, $q); $q->addOrder('company_name'); return $q->loadHashList(); }
function getFolderSelectList() { global $AppUI; $folders = array(0 => ''); $q = new DBQuery(); $q->addTable('file_folders'); $q->addQuery('file_folder_id, file_folder_name, file_folder_parent'); $q->addOrder('file_folder_name'); $sql = $q->prepare(); // $sql = "SELECT file_folder_id, file_folder_name, file_folder_parent FROM file_folders"; $vfolders = arrayMerge(array('0' => array(0, $AppUI->_('Root'), -1)), db_loadHashList($sql, 'file_folder_id')); $folders = array_filter($vfolders, "check_perm"); return $folders; }
function _fetchPreviousData() { $q = new DBQuery(); $q->addTable($this->table_name); $q->addQuery($this->field_name); $q->addWhere("{$this->id_field_name} = {$this->row_id}"); $previous_data = $q->loadResult(); if ($previous_data != "") { $previous_data = unserialize($previous_data); $previous_data = !is_array($previous_data) ? array() : $previous_data; } else { $previous_data = array(); } $this->previous_data = $previous_data; }
function _buildQuery() { $q = new DBQuery(); $q->addTable($this->table); $q->addTable('files'); $q->addQuery('*'); $q->addWhere("files.file_id = {$this->table}.file_id"); $sql = ''; foreach ($this->search_fields as $field) { $sql .= " {$field} LIKE '%{$this->keyword}%' or "; } $sql = substr($sql, 0, -4); $q->addWhere("({$sql})"); $q->addGroup('files.file_id'); return $q->prepare(true); }
function canDelete(&$msg, $oid = null, $joins = null) { global $AppUI; if ($oid) { //Check to see if there is a user $q = new DBQuery(); $q->addTable('users'); $q->addQuery('count(*) as user_count'); $q->addWhere('user_contact = ' . (int) $oid); $user_count = $q->loadResult(); if ($user_count > 0) { $msg = $AppUI->_('contactsDeleteUserError'); return false; } } return parent::canDelete($msg, $oid, $joins); }
function sendNewPass() { global $AppUI; $_live_site = dPgetConfig('base_url'); $_sitename = dPgetConfig('company_name'); // ensure no malicous sql gets past $checkusername = trim(dPgetParam($_POST, 'checkusername', '')); $checkusername = db_escape($checkusername); $confirmEmail = trim(dPgetParam($_POST, 'checkemail', '')); $confirmEmail = mb_strtolower(db_escape($confirmEmail)); $q = new DBQuery(); $q->addTable('users', 'u'); $q->addQuery('u.user_id'); $q->addWhere('user_username=\'' . $checkusername . '\' AND LOWER(contact_email)=\'' . $confirmEmail . '\''); $q->leftJoin('contacts', 'c', 'u.user_contact = c.contact_id'); if (!($user_id = $q->loadResult()) || !$checkusername || !$confirmEmail) { $AppUI->setMsg('Invalid username or email.', UI_MSG_ERROR); $AppUI->redirect(); } $newpass = makePass(); $message = $AppUI->_('sendpass0', UI_OUTPUT_RAW) . ' ' . $checkusername . ' ' . $AppUI->_('sendpass1', UI_OUTPUT_RAW) . ' ' . $_live_site . ' ' . $AppUI->_('sendpass2', UI_OUTPUT_RAW) . ' ' . $newpass . ' ' . $AppUI->_('sendpass3', UI_OUTPUT_RAW); $subject = "{$_sitename} :: " . $AppUI->_('sendpass4', UI_OUTPUT_RAW) . " - {$checkusername}"; $m = new Mail(); // create the mail $m->From("dotProject@" . dPgetConfig('site_domain')); $m->To($confirmEmail); $m->Subject($subject); $m->Body($message, isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : ""); // set the body $m->Send(); // send the mail $newpass = md5($newpass); $q->clear(); $q->addTable('users'); $q->addUpdate('user_password', $newpass, true); $q->addWhere('user_id=\'' . $user_id . '\''); $cur = $q->exec(); if (!$cur) { die('SQL error' . $database->stderr(true)); } else { $AppUI->setMsg('New User Password created and emailed to you'); $AppUI->redirect(); } }
function getAllUsersGroupByDept() { $q = new DBQuery(); $q->addTable('users'); $q->addQuery('user_id, contact_department, concat_ws(", ", contact_last_name, contact_first_name) as contact_name'); $q->addJoin('contacts', 'con', 'contact_id = user_contact'); $q->addOrder('contact_last_name'); $res = $q->exec(); $userlist = array(); while ($row = $q->fetchRow()) { if ($row['contact_department'] == null) { $row['contact_department'] = 0; } if (!isset($userlist[$row['contact_department']])) { $userlist[$row['contact_department']] = array(); } $userlist[$row['contact_department']][$row['user_id']] = $row['contact_name']; } $q->clear(); return $userlist; }
protected function _deDynamicLeafNodes($projectId) { $q = new DBQuery(); $q->addUpdate('task_dynamic', 0); $q->addWhere("task_project = {$projectId}"); $q->addTable('tasks'); $q->exec(); $q->addQuery('distinct(task_parent)'); $q->addTable('tasks'); $q->addWhere("task_project = {$projectId}"); $q->addWhere("task_id <> task_parent"); $taskList = $q->loadHashList(); foreach ($taskList as $id => $nothing) { $dynamicTasks .= $id . ','; } $dynamicTasks .= '0'; $q->clear(); $q->addUpdate('task_dynamic', 1); $q->addWhere("task_project = {$projectId}"); $q->addWhere("task_id IN ({$dynamicTasks})"); $q->addTable('tasks'); $q->exec(); }
$q->addJoin('users', 'u', 'u.user_id = companies.company_owner'); $q->addJoin('contacts', 'con', 'u.user_contact = con.contact_id'); $q->addWhere('companies.company_id = ' . $company_id); $sql = $q->prepare(); $q->clear(); $obj = null; if (!db_loadObject($sql, $obj) && $company_id > 0) { // $AppUI->setMsg( ' $qid =& $q->exec(); Company' ); // What is this for? $AppUI->setMsg("invalidID", UI_MSG_ERROR, true); $AppUI->redirect(); } // collect all the users for the company owner list $q = new DBQuery(); $q->addTable('users', 'u'); $q->addTable('contacts', 'con'); $q->addQuery('user_id'); $q->addQuery('CONCAT_WS(", ",contact_last_name,contact_first_name)'); $q->addOrder('contact_last_name'); $q->addWhere('u.user_contact = con.contact_id'); $owners = $q->loadHashList(); // setup the title block $ttl = $company_id > 0 ? "Edit Company" : "Add Company"; $titleBlock = new CTitleBlock($ttl, 'handshake.png', $m, "{$m}.{$a}"); $titleBlock->addCrumb("?m=companies", "companies list"); if ($company_id != 0) { $titleBlock->addCrumb("?m=companies&a=view&company_id={$company_id}", "view this company"); } $titleBlock->show(); ?> <script language="javascript">
$AppUI->setMsg('Access denied', UI_MSG_ERROR); $AppUI->redirect(); } // retrieve any state parameters if (isset($_GET['tab'])) { $AppUI->setState('CompVwTab', $_GET['tab']); } $tab = $AppUI->getState('CompVwTab') !== NULL ? $AppUI->getState('CompVwTab') : 0; // check if this record has dependencies to prevent deletion $msg = ''; $obj = new CCompany(); $canDelete = $obj->canDelete($msg, $company_id); // load the record data $q = new DBQuery(); $q->addTable('companies', 'c'); $q->addQuery('c.*, u.user_id'); $q->addQuery('CONCAT(co.contact_first_name, " ", co.contact_last_name) AS contact_name'); $q->addJoin('users', 'u', 'u.user_id = c.company_owner'); $q->addJoin('contacts', 'co', 'u.user_contact = co.contact_id'); $q->addWhere('c.company_id = ' . $company_id); $sql = $q->prepare(); $q->clear(); $obj = null; if (!db_loadObject($sql, $obj)) { $AppUI->setMsg('Company'); $AppUI->setMsg("invalidID", UI_MSG_ERROR, true); $AppUI->redirect(); } else { $AppUI->savePlace(); } // load the list of project statii and company types
$m_orig = dPgetParam($_REQUEST, 'm_orig', $m); $a_orig = dPgetParam($_REQUEST, 'a_orig', $a); $projectStatus = dPgetSysVal('ProjectStatus'); $projectStatus = arrayMerge(array('-2' => $AppUI->_('All w/o in progress'), '-3' => $AppUI->_($AppUI->user_id == $user_id ? 'My projects' : "User's projects")), $projectStatus); $pjobj =& new CProject(); $working_hours = $dPconfig['daily_working_hours']; $q = new DBQuery(); /* * Load department info for the case where one * wants to see the ProjectsWithOwnerInDeparment (PwOiD) * instead of the projects related to the given department. */ $owner_ids = array(); if ($addPwOiD && $department > 0) { $q->addTable('users'); $q->addQuery('user_id'); $q->addJoin('contacts', 'c', 'c.contact_id = user_contact'); $q->addWhere('c.contact_department = ' . $department); $owner_ids = $q->loadColumn(); $q->clear(); } // pull valid projects and their percent complete information // GJB: Note that we have to special case duration type 24 and this refers to the hours in a day, NOT 24 hours $q->addTable('projects', 'p'); $q->addQuery('DISTINCT p.project_id, project_color_identifier, project_name, project_start_date' . ', project_end_date, max(t1.task_end_date) AS project_actual_end_date' . ', SUM(task_duration * task_percent_complete * IF(task_duration_type = 24, ' . $working_hours . ', task_duration_type))' . ' / SUM(task_duration * IF(task_duration_type = 24, ' . $working_hours . ', task_duration_type)) AS project_percent_complete' . ', project_status'); $q->addJoin('tasks', 't1', 'p.project_id = t1.task_project'); $q->addJoin('companies', 'c1', 'p.project_company = c1.company_id'); if ($department > 0) { $q->addJoin('project_departments', 'pd', 'pd.project_id = p.project_id'); if (!$addPwOiD) { $q->addWhere('pd.department_id = ' . $department);
$filter1[] = ' project_company = ' . $company_id; } if ($showInactive != '1') { $filter1[] = ' project_status <> 7'; } $pjobj =& new CProject(); $allowed_projects = $pjobj->getAllowedSQL($AppUI->user_id); $where = array_merge($filter1, $allowed_projects); // pull valid projects and their percent complete information $q = new DBQuery(); $q->addTable('tasks', 't'); $q->addJoin('user_tasks', 'ut', 't.task_id = ut.task_id'); $q->addJoin('users', 'u', 'u.user_id = ut.user_id'); $q->addJoin('projects', 'p', 'p.project_id = t.task_project'); $q->addJoin('companies', 'c', 'p.project_company = c.company_id'); $q->addQuery('u.user_username, t.task_name, t.task_start_date, t.task_milestone' . ', ut.perc_assignment, t.task_end_date, t.task_dynamic' . ', p.project_color_identifier, p.project_name'); $q->addOrder('t.task_name, t.task_start_date, t.task_end_date, ut.perc_assignment'); $tasks = $q->loadList(); $q->clear(); $q->addTable('user_tasks', 'ut'); $q->innerJoin('users', 'u', 'u.user_id = ut.user_id'); $q->innerJoin('tasks', 't', 't.task_id = ut.task_id'); $q->addQuery('min(t.task_start_date) AS task_min_date, max(t.task_end_date) AS task_max_date'); $taskMinMax = $q->loadList(); $q->clear(); $width = dPgetParam($_GET, 'width', 600); $start_date = dPgetParam($_GET, 'start_date', 0); $end_date = dPgetParam($_GET, 'end_date', 0); $showTaskGantt = dPgetParam($_GET, 'showTaskGantt', 0); $graph2 = new GanttGraph($width); $graph2->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK);
if (is_file(TTF_DIR . 'FreeSans.ttf')) { $bar->caption->SetFont(FF_CUSTOM, FS_NORMAL, 8); } // show tasks which are both finished and past in (dark)gray if ($progress >= 100 && $end_date->isPast() && get_class($bar) == 'ganttbar') { $bar->caption->SetColor('darkgray'); $bar->title->SetColor('darkgray'); $bar->setColor('darkgray'); $bar->SetFillColor('darkgray'); $bar->SetPattern(BAND_SOLID, 'gray'); $bar->progress->SetFillColor('darkgray'); $bar->progress->SetPattern(BAND_SOLID, 'gray', 98); } $q = new DBQuery(); $q->addTable('task_dependencies'); $q->addQuery('dependencies_task_id'); $q->addWhere('dependencies_req_task_id=' . (int) $a['task_id']); $query = $q->loadList(); foreach ($query as $dep) { // find row num of dependencies for ($d = 0, $d_cmp = count($gantt_arr); $d < $d_cmp; $d++) { if ($gantt_arr[$d][0]['task_id'] == $dep['dependencies_task_id']) { $bar->SetConstrain($d, CONSTRAIN_ENDSTART); } } } unset($query); $q->clear(); $graph->Add($bar); } unset($gantt_arr);
// check permissions for this record $canEdit = !getDenyEdit($m, $task_log_id); if (!$canEdit) { $AppUI->redirect("m=public&a=access_denied"); } // use the object oriented design of dP for loading the log that should be edited // therefore create a new instance of the Timesheet Class $obj = new CTimesheet(); $df = $AppUI->getPref('SHDATEFORMAT'); // pull users // pull users $q = new DBQuery(); $q->addTable('tasks', 't'); $q->addTable('projects', 'p'); $q->addTable('user_tasks', 'u'); $q->addQuery('t.task_id'); $q->addQuery('CONCAT_WS(" - ",p.project_short_name, t.task_name)'); $q->addOrder('p.project_short_name, t.task_name'); $q->addWhere('t.task_project = p.project_id and t.task_dynamic = 0 and t.task_percent_complete!=100 and u.task_id=t.task_id and u.user_id=' . $user_id); //Devido a possibilidade de edição de registros, as tarefas de projetos arquivados e em espera serão apresentadas. //$q->addWhere('p.project_status!=7 and p.project_status!=4');//[7] Projetos Arquivados e [4] Projetos Em Espera $tasks = $q->loadHashList(); // load the record data in case of that this script is used to edit the log qith task_log_id (transmitted via GET) if (!$obj->load($task_log_id, false) && $task_log_id > 0) { // show some error messages using the dPFramework if loadOperation failed // these error messages are nicely integrated with the frontend of dP // use detailed error messages as often as possible $AppUI->setMsg('Timesheet'); $AppUI->setMsg("invalidID", UI_MSG_ERROR, true); $AppUI->redirect(); // go back to the calling location
$task_project = $project_id; $task_sort_item1 = w2PgetParam($_GET, 'task_sort_item1', ''); $task_sort_type1 = w2PgetParam($_GET, 'task_sort_type1', ''); $task_sort_item2 = w2PgetParam($_GET, 'task_sort_item2', ''); $task_sort_type2 = w2PgetParam($_GET, 'task_sort_type2', ''); $task_sort_order1 = intval(w2PgetParam($_GET, 'task_sort_order1', 0)); $task_sort_order2 = intval(w2PgetParam($_GET, 'task_sort_order2', 0)); if (isset($_POST['show_task_options'])) { $AppUI->setState('TaskListShowIncomplete', w2PgetParam($_POST, 'show_incomplete', 0)); } $showIncomplete = $AppUI->getState('TaskListShowIncomplete', 0); $project = new CProject(); // $allowedProjects = $project->getAllowedRecords($AppUI->user_id, 'project_id, project_name'); $allowedProjects = $project->getAllowedSQL($AppUI->user_id); $working_hours = $w2Pconfig['daily_working_hours'] ? $w2Pconfig['daily_working_hours'] : 8; $q->addQuery('projects.project_id, project_color_identifier, project_name'); $q->addQuery('SUM(task_duration * task_percent_complete * IF(task_duration_type = 24, ' . $working_hours . ', task_duration_type)) / SUM(task_duration * IF(task_duration_type = 24, ' . $working_hours . ', task_duration_type)) AS project_percent_complete'); $q->addQuery('company_name'); $q->addTable('projects'); $q->leftJoin('tasks', 't1', 'projects.project_id = t1.task_project'); $q->leftJoin('companies', 'c', 'company_id = project_company'); $q->leftJoin('project_departments', 'project_departments', 'projects.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('t1.task_id = t1.task_parent'); $q->addWhere('projects.project_id=' . $project_id); if (count($allowedProjects)) { $q->addWhere($allowedProjects); } $q->addGroup('projects.project_id'); $q2 = new DBQuery(); $q2 = $q;
?> " /> </td> </tr> </table> </form> <?php echo $AppUI->_('P') . ' = ' . $AppUI->_('User specific Task Priority'); if ($do_report) { // get Users with all Allocation info (e.g. their freeCapacity) $tempoTask = new CTask(); $userAlloc = $tempoTask->getAllocation("user_id"); // Let's figure out which users we have $sql = new DBQuery(); $sql->addTable('users'); $sql->addQuery('user_id, user_username'); if ($log_userfilter != 0) { $sql->addWhere('user_id = ' . $log_userfilter); } $sql->addOrder('user_username'); $user_list = $sql->loadHashList('user_id'); $sql->clear(); $ss = $start_date->format(FMT_DATETIME_MYSQL); $se = $end_date->format(FMT_DATETIME_MYSQL); $sql->addTable('tasks', 't'); $sql->innerJoin('projects', 'p', 'p.project_id = t.task_project'); if ($log_userfilter != 0) { $sql->innerJoin('user_tasks', 'ut', 'ut.task_id = t.task_id'); } $sql->addQuery('t.*'); if ($use_period) {
// delete row from forum_watch for unorcing Watch $q->setDelete('forum_watch'); $q->addWhere('watch_user = 0'); $q->addWhere('watch_forum = 0'); $q->addWhere('watch_topic = 0'); if (!$q->exec()) { $AppUI->setMsg(db_error(), UI_MSG_ERROR); } else { $AppUI->setMsg("Watch Unforced", UI_MSG_OK); } $q->clear(); $AppUI->redirect('m=forums&a=configure'); } // SQL-Query to check if the message should be delivered to all users (forced) (checkbox) $q->addTable('forum_watch'); $q->addQuery('*'); $q->addWhere('watch_user = 0'); $q->addWhere('watch_forum = 0'); $q->addWhere('watch_topic = 0'); $resAll = $q->exec(); if (db_num_rows($resAll) >= 1) { $watchAll = true; } $q->clear(); // setup the title block $titleBlock = new CTitleBlock('Configure Forums Module', 'support.png', $m, "{$m}.{$a}"); $titleBlock->addCrumb("?m=system", "system admin"); $titleBlock->addCrumb("?m=system&a=viewmods", "modules list"); $titleBlock->show(); ?>
echo "<div>" . $dept_info["dept_name"]; if ($dept_info["dept_phone"] != "") { echo "( " . $dept_info["dept_phone"] . " )"; } echo "</div>"; } ?> </td> </tr> <?php } $q = new DBQuery(); $q->addTable('contacts', 'a'); $q->addTable('project_contacts', 'b'); $q->addJoin('departments', 'c', 'a.contact_department = c.dept_id', 'left outer'); $q->addQuery('a.contact_id, a.contact_first_name, a.contact_last_name, a.contact_email, a.contact_phone, c.dept_name'); $q->addWhere("a.contact_id = b.contact_id and b.project_id = {$project_id}\n\t\t\t\t\tand (contact_owner = '{$AppUI->user_id}' or contact_private='0')"); $contacts = $q->loadHashList("contact_id"); if (count($contacts) > 0) { ?> <tr> <td><strong><?php echo $AppUI->_("Contacts"); ?> </strong></td> </tr> <tr> <td colspan='3' class="hilite"> <?php echo "<table cellspacing='1' cellpadding='2' border='0' width='100%' class='tbl'>"; echo "<tr><th>" . $AppUI->_("Name") . "</th><th>" . $AppUI->_("Email") . "</th><th>" . $AppUI->_("Phone") . "</th><th>" . $AppUI->_("Department") . "</th></tr>";