Example #1
0
     $title = 'Forum';
     $q->addQuery('forum_id,forum_name');
     $q->addOrder('forum_name');
     break;
 case 'projects':
     $project_company = dPgetParam($_GET, 'project_company', 0);
     $title = 'Project';
     $obj =& new CProject();
     $q->addQuery('a.project_id, project_name');
     $q->addOrder('project_name');
     if ($user_id > 0) {
         $q->addTable('project_contacts', 'b');
         $q->addWhere('b.project_id = a.project_id');
         $q->addWhere("b.contact_id = {$user_id}");
     }
     $q->addWhere(selPermWhere($obj, 'project_id', 'project_name', 'a'));
     if ($project_company) {
         $q->addWhere("project_company = {$project_company}");
     }
     break;
 case "tasks":
     $task_project = dPgetParam($_GET, 'task_project', 0);
     $title = 'Task';
     $q->addQuery('task_id,task_name');
     $q->addOrder('task_name');
     if ($task_project) {
         $q->addWhere("task_project = {$task_project}");
     }
     break;
 case 'users':
     $title = 'User';
Example #2
0
$query_result = false;
switch ($table) {
    case 'companies':
        $obj = new CCompany();
        $title = 'Company';
        $q->addQuery('company_id, company_name');
        $q->addOrder('company_name');
        $q->addWhere(selPermWhere($obj, 'company_id', 'company_name'));
        $resultList = $q->loadHashList();
        break;
    case 'departments':
        // known issue: does not filter out denied companies
        $title = 'Department';
        $company_id = w2PgetParam($_GET, 'company_id', 0);
        $obj = new CDepartment();
        $q->addWhere(selPermWhere($obj, 'dept_id', 'dept_name'));
        $q->addWhere('dept_company = company_id ');
        $q->addTable('companies', 'b');
        $company = new CCompany();
        $allowed = $company->getAllowedRecords($AppUI->user_id, 'company_id, company_name');
        if (count($allowed)) {
            $q->addWhere('company_id IN (' . implode(',', array_keys($allowed)) . ') ');
        }
        $hide_company = w2PgetParam($_GET, 'hide_company', 0);
        $q->addQuery('dept_id');
        if ($hide_company == 1) {
            $q->addQuery('dept_name');
        } else {
            $q->addQuery('CONCAT_WS(\': \',company_name,dept_name) AS dept_name');
        }
        if ($company_id) {
Example #3
0
         $order = 'dept_name';
     } else {
         $order = 'company_name,dept_name';
     }
     break;
 case 'forums':
     $title = 'Forum';
     $select = 'forum_id,forum_name';
     $order = 'forum_name';
     break;
 case 'projects':
     $project_company = dPgetParam($_GET, 'project_company', 0);
     $title = 'Project';
     $select = 'project_id,project_name';
     $order = 'project_name';
     $where = selPermWhere('projects', 'project_id');
     $where .= $project_company ? "\nAND project_company = {$project_company}" : '';
     $table .= ", permissions";
     break;
 case 'tasks':
     $task_project = dPgetParam($_GET, 'task_project', 0);
     $title = 'Task';
     $select = 'task_id,task_name';
     $order = 'task_name';
     $where = $task_project ? "task_project = {$task_project}" : '';
     break;
 case 'users':
     $title = 'User';
     /*
     $select = "user_id,CONCAT_WS(' ',user_first_name,user_last_name)";
     $order = 'user_last_name, user_first_name';