Beispiel #1
0
 public function getTaskDepartments(CAppUI $AppUI = null, $taskId)
 {
     global $AppUI;
     if ($AppUI->isActiveModule('departments')) {
         $q = new w2p_Database_Query();
         $q->addTable('departments', 'd');
         $q->addTable('task_departments', 't');
         $q->addWhere('t.department_id = d.dept_id');
         $q->addWhere('t.task_id = ' . (int) $taskId);
         $q->addQuery('dept_id, dept_name, dept_phone');
         $department = new CDepartment();
         $department->setAllowedSQL($AppUI->user_id, $q);
         return $q->loadHashList('dept_id');
     }
 }
    public static function getForums(CAppUI $AppUI = null, $projectId)
    {
        global $AppUI;
        if ($AppUI->isActiveModule('forums') && canView('forums')) {
            $q = new w2p_Database_Query();
            $q->addTable('forums');
            $q->addQuery('forum_id, forum_project, forum_description, forum_owner, forum_name, forum_message_count,
				DATE_FORMAT(forum_last_date, "%d-%b-%Y %H:%i" ) forum_last_date,
				project_name, project_color_identifier, project_id');
            $q->addJoin('projects', 'p', 'project_id = forum_project', 'inner');
            $q->addWhere('forum_project = ' . (int) $projectId);
            $q->addOrder('forum_project, forum_name');
            return $q->loadHashList('forum_id');
        }
    }
 public static function getDepartments(CAppUI $AppUI, $companyId)
 {
     $perms = $AppUI->acl();
     if ($AppUI->isActiveModule('departments') && canView('departments')) {
         $q = new w2p_Database_Query();
         $q->addTable('departments');
         $q->addQuery('departments.*, COUNT(contact_department) dept_users');
         $q->addJoin('contacts', 'c', 'c.contact_department = dept_id');
         $q->addWhere('dept_company = ' . (int) $companyId);
         $q->addGroup('dept_id');
         $q->addOrder('dept_parent, dept_name');
         $department = new CDepartment();
         $department->setAllowedSQL($AppUI->user_id, $q);
         return $q->loadList();
     }
 }
Beispiel #4
0
 public function getTaskContacts(CAppUI $AppUI = null, $taskId)
 {
     global $AppUI;
     $perms = $AppUI->acl();
     if ($AppUI->isActiveModule('contacts') && $perms->checkModule('contacts', 'view')) {
         $q = new DBQuery();
         $q->addTable('contacts', 'c');
         $q->addJoin('task_contacts', 'tc', 'tc.contact_id = c.contact_id', 'inner');
         $q->leftJoin('departments', 'd', 'dept_id = contact_department');
         $q->addWhere('tc.task_id = ' . (int) $taskId);
         $q->addQuery('c.contact_id, contact_first_name, contact_last_name, contact_email');
         $q->addQuery('contact_phone, dept_name');
         $q->addWhere('(contact_owner = ' . (int) $AppUI->user_id . ' OR contact_private = 0)');
         $department = new CDepartment();
         $department->setAllowedSQL($AppUI->user_id, $q);
         return $q->loadHashList('contact_id');
     }
 }
 public static function getContactList(CAppUI $AppUI = null, $deptId)
 {
     global $AppUI;
     if ($AppUI->isActiveModule('contacts') && canView('contacts') && (int) $deptId > 0) {
         $q = new w2p_Database_Query();
         $q->addTable('contacts', 'con');
         $q->addQuery('con.contact_id, con.contact_first_name');
         $q->addQuery('con.contact_last_name');
         $q->addWhere('contact_department = ' . (int) $deptId);
         $q->addWhere('(contact_owner = ' . (int) $AppUI->user_id . ' OR contact_private = 0)');
         $q->addOrder('contact_first_name');
         $results = $q->loadHashList('contact_id');
     }
     return $results;
 }