예제 #1
0
 public function getAllowedRecords($uid)
 {
     global $AppUI;
     $q = new w2p_Database_Query();
     $q->addTable('file_folders');
     $q->addQuery('*');
     $q->addOrder('file_folder_parent');
     $q->addOrder('file_folder_name');
     return $q->loadHashList();
 }
예제 #2
0
 /**
  * Tests resetting project parents.
  */
 public function testResetProjectParents()
 {
     global $AppUI;
     $st_projects = array(0 => '');
     $q = new w2p_Database_Query();
     $q->addTable('projects');
     $q->addQuery('project_id, project_name, project_parent');
     $q->addOrder('project_name');
     $st_projects = $q->loadHashList('project_id');
     reset_project_parents($st_projects);
     $this->assertEquals(4, count($st_projects));
     $this->assertEquals(1, $st_projects[1]['project_id']);
     $this->assertEquals('Test Project', $st_projects[1]['project_name']);
     $this->assertEquals(1, $st_projects[1]['project_parent']);
     $this->assertEquals(1, $st_projects[1][0]);
     $this->assertEquals('Test Project', $st_projects[1][1]);
     $this->assertEquals('', $st_projects[1][2]);
     $this->assertEquals(2, $st_projects[2]['project_id']);
     $this->assertEquals('Test Project 2', $st_projects[2]['project_name']);
     $this->assertEquals(1, $st_projects[2]['project_parent']);
     $this->assertEquals(2, $st_projects[2][0]);
     $this->assertEquals('Test Project 2', $st_projects[2][1]);
     $this->assertEquals(1, $st_projects[2][2]);
     $this->assertEquals(3, $st_projects[3]['project_id']);
     $this->assertEquals('Test Project 3', $st_projects[3]['project_name']);
     $this->assertEquals(1, $st_projects[3]['project_parent']);
     $this->assertEquals(3, $st_projects[3][0]);
     $this->assertEquals('Test Project 3', $st_projects[3][1]);
     $this->assertEquals(1, $st_projects[3][2]);
     $this->assertEquals(4, $st_projects[4]['project_id']);
     $this->assertEquals('Test Project 4', $st_projects[4]['project_name']);
     $this->assertEquals(1, $st_projects[4]['project_parent']);
     $this->assertEquals(4, $st_projects[4][0]);
     $this->assertEquals('Test Project 4', $st_projects[4][1]);
     $this->assertEquals(1, $st_projects[4][2]);
 }
예제 #3
0
    $q->addQuery('t.task_id, round(t.task_duration * IF(t.task_duration_type = 24, ' . $working_hours . ', t.task_duration_type)/count(ut.task_id),2) as hours_allocated');
    $q->addWhere('t.task_id = ut.task_id');
    $q->addWhere('t.task_milestone = 0');
    $q->addWhere('project_active = 1');
    if (($template_status = w2PgetConfig('template_projects_status_id')) != '') {
        $q->addWhere('project_status <> ' . (int) $template_status);
    }
    if ($project_id != 0) {
        $q->addWhere('t.task_project = ' . (int) $project_id);
    }
    if (!$log_all) {
        $q->addWhere('t.task_start_date >= \'' . $start_date->format(FMT_DATETIME_MYSQL) . '\'');
        $q->addWhere('t.task_start_date <= \'' . $end_date->format(FMT_DATETIME_MYSQL) . '\'');
    }
    $q->addGroup('t.task_id');
    $task_list = $q->loadHashList('task_id');
    $q->clear();
    ?>

<table cellspacing="1" cellpadding="4" border="0" class="tbl">
	<tr>
		<th colspan='2'><?php 
    echo $AppUI->_('User');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Hours allocated');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Hours worked');
예제 #4
0
//Lets load the users panel viewing options
$q = new w2p_Database_Query();
$q->addTable('project_designer_options', 'pdo');
$q->addQuery('pdo.*');
$q->addWhere('pdo.pd_option_user = '******'project_id', 0);
$project_id = (int) w2PgetParam($_GET, 'project_id', $project_id);
$extra = array('where' => 'project_active = 1');
$project = new CProject();
$projects = $project->getAllowedRecords($AppUI->user_id, 'projects.project_id,project_name', 'project_name', null, $extra, 'projects');
$q = new w2p_Database_Query();
$q->addTable('projects');
$q->addQuery('projects.project_id, company_name');
$q->addJoin('companies', 'co', 'co.company_id = project_company');
$idx_companies = $q->loadHashList();
$q->clear();
foreach ($projects as $prj_id => $prj_name) {
    $projects[$prj_id] = $idx_companies[$prj_id] . ': ' . $prj_name;
}
asort($projects);
$projects = arrayMerge(array('0' => $AppUI->_('(None)', UI_OUTPUT_RAW)), $projects);
$extra = array();
$task = new CTask();
$tasks = $task->getAllowedRecords($AppUI->user_id, 'task_id,task_name', 'task_name', null, $extra);
$tasks = arrayMerge(array('0' => $AppUI->_('(None)', UI_OUTPUT_RAW)), $tasks);
if (!$project_id) {
    // setup the title block
    $ttl = 'ProjectDesigner';
    $titleBlock = new w2p_Theme_TitleBlock($ttl, 'projectdesigner.png', $m, $m . '.' . $a);
    $titleBlock->addCrumb('?m=projects', 'projects list');
예제 #5
0
$perms =& $AppUI->acl();
if (!canEdit('system')) {
    $AppUI->redirect('m=public&a=access_denied');
}
$q = new w2p_Database_Query();
$q->addTable('billingcode', 'bc');
$q->addQuery('billingcode_id, billingcode_name, billingcode_value, billingcode_desc, billingcode_status');
$q->addOrder('billingcode_name ASC');
$q->addWhere('company_id = ' . (int) $company_id);
$billingcodes = $q->loadList();
$q->clear();
$q = new w2p_Database_Query();
$q->addTable('companies', 'c');
$q->addQuery('company_id, company_name');
$q->addOrder('company_name ASC');
$company_list = $q->loadHashList();
$company_list[0] = $AppUI->_('Select Company');
$q->clear();
$company_name = $company_list[$company_id];
$titleBlock = new CTitleBlock('Edit Billing Codes', 'myevo-weather.png', $m, $m . '.' . $a);
$titleBlock->addCrumb('?m=system', 'system admin');
$titleBlock->show();
?>
<script language="javascript" type="text/javascript">
<!--
function submitIt(){
	var form = document.changeuser;
	form.submit();
}

function changeIt() {
예제 #6
0
function showcompany($company, $restricted = false)
{
    global $AppUI, $allpdfdata, $log_start_date, $log_end_date, $log_all;
    $q = new w2p_Database_Query();
    $q->addTable('projects');
    $q->addQuery('project_id, project_name');
    $q->addWhere('project_company = ' . (int) $company);
    $projects = $q->loadHashList();
    $q->clear();
    $q->addTable('companies');
    $q->addQuery('company_name');
    $q->addWhere('company_id = ' . (int) $company);
    $company_name = $q->loadResult();
    $q->clear();
    $table = '<h2>Company: ' . $company_name . '</h2>
    	<table cellspacing="1" cellpadding="4" border="0" class="tbl">';
    $project_row = '
        <tr>
                <th>' . $AppUI->_('Project') . '</th>';
    $pdfth[] = $AppUI->_('Project');
    $project_row .= '<th>' . $AppUI->_('Total') . '</th></tr>';
    $pdfth[] = $AppUI->_('Total');
    $pdfdata[] = $pdfth;
    $hours = 0.0;
    $table .= $project_row;
    foreach ($projects as $project => $name) {
        $pdfproject = array();
        $pdfproject[] = $name;
        $project_hours = 0;
        $project_row = '<tr><td>' . $name . '</td>';
        $q->addTable('projects');
        $q->addTable('tasks');
        $q->addTable('task_log');
        $q->addQuery('task_log_costcode, SUM(task_log_hours) as hours');
        $q->addWhere('project_id = ' . (int) $project);
        $q->addWhere('project_active = 1');
        if (($template_status = w2PgetConfig('template_projects_status_id')) != '') {
            $q->addWhere('project_status <> ' . (int) $template_status);
        }
        if ($log_start_date != 0 && !$log_all) {
            $q->addWhere('task_log_date >=' . $log_start_date);
        }
        if ($log_end_date != 0 && !$log_all) {
            $q->addWhere('task_log_date <=' . $log_end_date);
        }
        if ($restricted) {
            $q->addWhere('task_log_creator = ' . (int) $AppUI->user_id);
        }
        $q->addWhere('project_id = task_project');
        $q->addWhere('task_id = task_log_task');
        $q->addGroup('project_id');
        $task_logs = $q->loadHashList();
        $q->clear();
        foreach ($task_logs as $task_log) {
            $project_hours += $task_log;
        }
        $project_row .= '<td style="text-align:right;">' . sprintf('%.2f', round($project_hours, 2)) . '</td></tr>';
        $pdfproject[] = round($project_hours, 2);
        $hours += $project_hours;
        if ($project_hours > 0) {
            $table .= $project_row;
            $pdfdata[] = $pdfproject;
        }
    }
    if ($hours > 0) {
        $pdfdata[] = array($AppUI->_('Total'), round($hours, 2));
        $allpdfdata[$company_name] = $pdfdata;
        echo $table;
        echo '<tr><td>' . $AppUI->_('Total') . '</td><td style="text-align:right;">' . sprintf('%.2f', round($hours, 2)) . '</td></tr></table>';
    }
    return $hours;
}
예제 #7
0
 public function getUsersWithRole()
 {
     $q = new w2p_Database_Query();
     $q->addTable($this->_db_acl_prefix . 'groups_aro_map', 'g');
     $q->addQuery('DISTINCT(g.aro_id)');
     $result = $q->loadHashList();
     $q->clear();
     if (count($result)) {
         return $result;
     } else {
         return false;
     }
 }
예제 #8
0
$callback = w2PgetParam($_GET, 'callback', 0);
$table = w2PgetParam($_GET, 'table', 0);
$user_id = w2PgetParam($_GET, 'user_id', 0);
$ok = $callback & $table;
$title = 'Generic Selector';
$q = new w2p_Database_Query();
$q->addTable($table);
$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);
예제 #9
0
 public static function getSettings($module, $configName = '')
 {
     $q = new w2p_Database_Query();
     $q->addTable('module_config');
     $q->addQuery('module_config_value, module_config_text');
     $q->addWhere("module_name = '{$module}'");
     if ('' != $configName) {
         $q->addWhere("module_config_name = '{$configName}'");
     }
     $q->addOrder('module_config_order, module_config_value ASC');
     return $q->loadHashList();
 }
예제 #10
0
 /**
  * Find a queue record (or records) based upon the
  *
  */
 public function find($module, $type, $id = 0)
 {
     $q = new w2p_Database_Query();
     $q->addTable($this->table);
     $q->addWhere("queue_module = '{$module}'");
     $q->addWhere("queue_type = '{$type}'");
     if ($id) {
         $q->addWhere("queue_origin_id = {$id}");
     }
     return $q->loadHashList('queue_id');
 }
예제 #11
0
 public function checkClash($userlist = null)
 {
     global $AppUI;
     if (!isset($userlist)) {
         return false;
     }
     $users = explode(',', $userlist);
     // Now, remove the owner from the list, as we will always clash on this.
     $key = array_search($AppUI->user_id, $users);
     if (isset($key) && $key !== false) {
         // Need both for change in php 4.2.0
         unset($users[$key]);
     }
     if (!count($users)) {
         return false;
     }
     $start_date = new w2p_Utilities_Date($this->event_start_date);
     $end_date = new w2p_Utilities_Date($this->event_end_date);
     // Now build a query to find matching events.
     $q = new w2p_Database_Query();
     $q->addTable('events', 'e');
     $q->addQuery('e.event_owner, ue.user_id, e.event_cwd, e.event_id, e.event_start_date, e.event_end_date');
     $q->addJoin('user_events', 'ue', 'ue.event_id = e.event_id');
     $q->addWhere('event_start_date <= \'' . $end_date->format(FMT_DATETIME_MYSQL) . '\'');
     $q->addWhere('event_end_date >= \'' . $start_date->format(FMT_DATETIME_MYSQL) . '\'');
     $q->addWhere('(e.event_owner IN (' . implode(',', $users) . ') OR ue.user_id IN (' . implode(',', $users) . ') )');
     $q->addWhere('e.event_id <>' . $this->event_id);
     $result = $q->exec();
     if (!$result) {
         return false;
     }
     $clashes = array();
     while ($row = $q->fetchRow()) {
         array_push($clashes, $row['event_owner']);
         if ($row['user_id']) {
             array_push($clashes, $row['user_id']);
         }
     }
     $clash = array_unique($clashes);
     $q->clear();
     if (count($clash)) {
         $q->addTable('users', 'u');
         $q->addTable('contacts', 'con');
         $q->addQuery('user_id');
         $q->addQuery('CONCAT_WS(\' \',contact_first_name,contact_last_name)');
         $q->addWhere('user_id IN (' . implode(',', $clash) . ')');
         $q->addWhere('user_contact = contact_id');
         return $q->loadHashList();
     } else {
         return false;
     }
 }
예제 #12
0
 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;
 }
예제 #13
0
function get_dependencies_pd($task_id)
{
    // Pull tasks dependencies
    $q = new w2p_Database_Query();
    $q->addTable('tasks', 't');
    $q->addTable('task_dependencies', 'td');
    $q->addQuery('t.task_id, t.task_name');
    $q->addWhere('td.dependencies_task_id = ' . (int) $task_id);
    $q->addWhere('t.task_id = td.dependencies_req_task_id');
    $taskDep = $q->loadHashList();
}
예제 #14
0
$q3->leftJoin('project_departments', 'project_departments', 'p.project_id = project_departments.project_id OR project_departments.project_id IS NULL');
$q3->leftJoin('departments', 'departments', 'departments.dept_id = project_departments.department_id OR dept_id IS NULL');
if (count($allowedProjects)) {
    $q3->addWhere('( ( ' . implode(' AND ', $allowedProjects) . ') OR file_project = 0 )');
}
if (count($allowedTasks)) {
    $q3->addWhere('( ( ' . implode(' AND ', $allowedTasks) . ') OR file_task = 0 )');
}
if ($catsql) {
    $q3->addWhere($catsql);
}
$files = array();
$file_versions = array();
if ($canRead) {
    $files = $q2->loadList();
    $file_versions = $q3->loadHashList('file_id');
}
// counts total recs from selection
$xpg_totalrecs = count($q->loadList());
//TODO: I don't like the ++$tab construct here... seems kludgy.
echo buildPaginationNav($AppUI, $m, $tab, $xpg_totalrecs, $xpg_pagesize, $page);
?>
<script language="javascript" type="text/javascript">
function expand(id){
  var element = document.getElementById(id);
  element.style.display = (element.style.display == '' || element.style.display == 'none') ? 'block' : 'none';
}
</script>

<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
<tr>
예제 #15
0
    if (function_exists('styleRenderBoxBottom')) {
        echo styleRenderBoxBottom();
    }
    echo '<br />';
    if (function_exists('styleRenderBoxTop')) {
        echo styleRenderBoxTop();
    }
    echo '<table cellspacing="0" cellpadding="4" border="0" width="100%" class="std">
<tr>
	<td>';
    // Let's figure out which users we have
    $q = new w2p_Database_Query();
    $q->addTable('users', 'u');
    $q->addQuery('u.user_id, u.user_username, contact_first_name, contact_last_name');
    $q->addJoin('contacts', 'c', 'u.user_contact = contact_id', 'inner');
    $user_list = $q->loadHashList('user_id');
    $q->clear();
    $q = new w2p_Database_Query();
    $q->addTable('tasks', 't');
    $q->addTable('user_tasks', 'ut');
    $q->addTable('projects', 'pr');
    $q->addQuery('t.*, ut.*, pr.project_name');
    $q->addWhere('( task_start_date
			   BETWEEN \'' . $start_date->format(FMT_DATETIME_MYSQL) . '\' 
	                AND \'' . $end_date->format(FMT_DATETIME_MYSQL) . '\' 
	           OR task_end_date	BETWEEN \'' . $start_date->format(FMT_DATETIME_MYSQL) . '\' 
	                AND \'' . $end_date->format(FMT_DATETIME_MYSQL) . '\' 
		   OR ( task_start_date <= \'' . $start_date->format(FMT_DATETIME_MYSQL) . '\'
	                AND task_end_date >= \'' . $end_date->format(FMT_DATETIME_MYSQL) . '\') )');
    $q->addWhere('task_end_date IS NOT NULL');
    $q->addWhere('task_end_date <> \'0000-00-00 00:00:00\'');
예제 #16
0
 public function getPermissionableModuleList()
 {
     $q = new w2p_Database_Query();
     $q->addTable('modules', 'm');
     $q->addQuery('mod_id, mod_name, permissions_item_table, permissions_item_field, permissions_item_label');
     $q->addWhere('permissions_item_table is not null');
     $q->addWhere("permissions_item_table <> ''");
     return $q->loadHashList('mod_name');
 }
예제 #17
0
 public function getCompanies(CAppUI $AppUI)
 {
     $q = new w2p_Database_Query();
     $q->addTable('companies');
     $q->addQuery('company_id, company_name');
     $where = $this->getAllowedSQL($AppUI->user_id, 'company_id');
     $q->addWhere($where);
     return $q->loadHashList('company_id');
 }
예제 #18
0
function getProjects()
{
    global $AppUI;
    $st_projects = array(0 => '');
    $q = new w2p_Database_Query();
    $q->addTable('projects');
    $q->addQuery('project_id, project_name, project_parent');
    $q->addOrder('project_name');
    $st_projects = $q->loadHashList('project_id');
    reset_project_parents($st_projects);
    return $st_projects;
}
예제 #19
0
/**
 * @return array
 */
function __extract_from_vw_actions()
{
    $q = new w2p_Database_Query();
    $q->addTable('projects');
    $q->addQuery('projects.project_id, company_name');
    $q->addJoin('companies', 'co', 'co.company_id = project_company');
    return $q->loadHashList();
}
예제 #20
0
## add or edit a user preferences
##
$user_id = (int) w2PgetParam($_GET, 'user_id', '0');
$perms =& $AppUI->acl();
// check permissions for this record
$canEdit = canEdit('system');
// Check permissions
if (!$canEdit && $user_id != $AppUI->user_id) {
    $AppUI->redirect('m=public&a=access_denied');
}
// load the preferences
$q = new w2p_Database_Query();
$q->addTable('user_preferences');
$q->addQuery('pref_name, pref_value');
$q->addWhere('pref_user = '******'Default';
}
$titleBlock = new w2p_Theme_TitleBlock('Edit User Preferences', 'myevo-weather.png', $m, $m . '.' . $a);
$perms =& $AppUI->acl();
if ($canEdit) {
    $titleBlock->addCrumb('?m=system', 'system admin');
    $titleBlock->addCrumb('?m=system&a=systemconfig', 'system configuration');
}
$titleBlock->show();
?>
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// Grab a list of the other resources, determine how they are allocated,
// and if there is a clash between this and other tasks.
global $AppUI, $task_id, $obj;
$resource = new CResource();
$q = new w2p_Database_Query();
$q->addQuery('a.*');
$q->addQuery('b.percent_allocated');
$q->addQuery('c.resource_type_name');
$q->addTable('resources', 'a');
$q->addJoin('resource_tasks', 'b', 'b.resource_id = a.resource_id', 'inner');
$q->addJoin('resource_types', 'c', 'c.resource_type_id = a.resource_type', 'inner');
$q->addWhere('b.task_id = ' . (int) $task_id);
$resources = $q->loadHashList('resource_id');
// Determine any other clashes.
$resource_tasks = array();
if (count($resources)) {
    $q->clear();
    $q->addQuery('b.resource_id, sum(b.percent_allocated) as total_allocated');
    $q->addTable('tasks', 'a');
    $q->addJoin('resource_tasks', 'b', 'b.task_id = a.task_id', 'inner');
    $q->addWhere('b.resource_id IN (' . implode(',', array_keys($resources)) . ')');
    $q->addWhere('task_start_date <= \'' . $obj->task_end_date . '\'');
    $q->addWhere('task_end_date >= \'' . $obj->task_start_date . '\'');
    $q->addGroup('resource_id');
    $resource_tasks = $q->loadHashList();
}
?>
<table class="std" width="100%" cellpadding="4" cellspacing="1">
예제 #22
0
 public static function getOwners()
 {
     $q = new w2p_Database_Query();
     $q->addTable('projects', 'p');
     $q->addQuery('user_id, contact_display_name');
     $q->leftJoin('users', 'u', 'u.user_id = p.project_owner');
     $q->leftJoin('contacts', 'c', 'c.contact_id = u.user_contact');
     $q->addOrder('contact_first_name, contact_last_name');
     $q->addWhere('user_id > 0');
     $q->addWhere('p.project_owner IS NOT NULL');
     return $q->loadHashList();
 }
예제 #23
0
function w2PgetUsersHashList($stub = null, $where = null, $orderby = 'contact_first_name, contact_last_name')
{
    global $AppUI;
    $q = new w2p_Database_Query();
    $q->addTable('users');
    $q->addQuery('DISTINCT(user_id), user_username, contact_last_name, contact_first_name,
		 company_name, contact_company, dept_id, dept_name, CONCAT(contact_first_name,\' \',contact_last_name) contact_name, user_type');
    $q->addJoin('contacts', 'con', 'con.contact_id = user_contact', 'inner');
    if ($stub) {
        $q->addWhere('(UPPER(user_username) LIKE \'' . $stub . '%\' or UPPER(contact_first_name) LIKE \'' . $stub . '%\' OR UPPER(contact_last_name) LIKE \'' . $stub . '%\')');
    } elseif ($where) {
        $where = $q->quote('%' . $where . '%');
        $q->addWhere('(UPPER(user_username) LIKE ' . $where . ' OR UPPER(contact_first_name) LIKE ' . $where . ' OR UPPER(contact_last_name) LIKE ' . $where . ')');
    }
    $q->addQuery('contact_email');
    $q->addGroup('user_id');
    $q->addOrder($orderby);
    // get CCompany() to filter by company
    $obj = new CCompany();
    $companies = $obj->getAllowedSQL($AppUI->user_id, 'company_id');
    $q->addJoin('companies', 'com', 'company_id = contact_company');
    if ($companies) {
        $q->addWhere('(' . implode(' OR ', $companies) . ' OR contact_company=\'\' OR contact_company IS NULL OR contact_company = 0)');
    }
    $dpt = new CDepartment();
    $depts = $dpt->getAllowedSQL($AppUI->user_id, 'dept_id');
    $q->addJoin('departments', 'dep', 'dept_id = contact_department');
    if ($depts) {
        $q->addWhere('(' . implode(' OR ', $depts) . ' OR contact_department=0)');
    }
    return $q->loadHashList('user_id');
}
예제 #24
0
}
if ($where_dept) {
    // Don't assume where is set. Change needed to fix Mantis Bug 0002056
    $q->addWhere($where_dept);
}
$oCpy = new CCompany();
$aCpies = $oCpy->getAllowedRecords($AppUI->user_id, 'company_id, company_name', 'company_name');
$where = $oCpy->getAllowedSQL($AppUI->user_id, 'contact_company');
$q->addWhere($where);
$oDpt = new CDepartment();
$where = $oDpt->getAllowedSQL($AppUI->user_id, 'contact_department');
$q->addWhere($where);
$q->addWhere('(contact_owner = ' . (int) $AppUI->user_id . ' OR contact_private = 0)');
$q->addOrder('company_name, contact_company, dept_name, contact_department, contact_last_name');
// May need to review this.
$contacts = $q->loadHashList('contact_id');
?>

<form action="index.php?m=public&a=contact_selector&dialog=1&<?php 
if (!is_null($call_back)) {
    echo 'call_back=' . $call_back . '&';
}
?>
company_id=<?php 
echo $company_id;
?>
" method="post" name="frmContactSelect" accept-charset="utf-8">

	<?php 
$actual_department = '';
$actual_company = '';
예제 #25
0
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// check permissions
$perms =& $AppUI->acl();
if (!canEdit('system')) {
    $AppUI->redirect('m=public&a=access_denied');
}
global $fixedSysVals;
$AppUI->savePlace();
// pull all the key types
$q = new w2p_Database_Query();
$q->addTable('syskeys');
$q->addQuery('syskey_id,syskey_name');
$q->addOrder('syskey_name');
$keys = arrayMerge(array(0 => '- Select Type -'), $q->loadHashList());
$q->clear();
$q = new w2p_Database_Query();
$q->addTable('syskeys');
$q->addTable('sysvals');
$q->addQuery('DISTINCT sysval_title, sysval_key_id, syskeys.*');
$q->addWhere('sysval_key_id = syskey_id');
$q->addOrder('sysval_title');
$q->addOrder('sysval_id');
$values = $q->loadList();
$q->clear();
$q = new w2p_Database_Query();
$q->addTable('sysvals');
$q->addTable('syskeys');
$q->addQuery('sysval_title, sysval_value_id, sysval_value, syskey_sep1, syskey_sep2');
$q->addWhere('sysval_key_id = syskey_id');
예제 #26
0
 public function getAssigned()
 {
     $q = new w2p_Database_Query();
     $q->addTable('users', 'u');
     $q->addTable('user_tasks', 'ut');
     $q->addTable('contacts', 'con');
     $q->addQuery('u.user_id, CONCAT_WS(\' \',contact_first_name, contact_last_name) AS user_name, perc_assignment');
     $q->addWhere('ut.task_id = ' . (int) $this->task_id);
     $q->addWhere('user_contact = contact_id');
     $q->addWhere('ut.user_id = u.user_id');
     $assigned = $q->loadHashList('user_id');
     return $assigned;
 }
예제 #27
0
    if ($user_id > 0) {
        $q->addTable('user_tasks', 'ut');
        $q->addWhere('ut.user_id =' . $user_id);
        $q->addWhere('ut.task_id = t.task_id');
    }
    if ($project_id != 0) {
        $q->addWhere('task_project =' . $project_id);
    }
    $q->addWhere('p.project_id   = t.task_project');
    $q->addWhere('t.task_dynamic = 0');
    $q->addWhere('t.task_owner = u.user_id');
    $q->addWhere('task_end_date >= \'' . $start_date->format(FMT_DATETIME_MYSQL) . '\'');
    $q->addWhere('task_end_date <= \'' . $end_date->format(FMT_DATETIME_MYSQL) . '\'');
    $q->addOrder('project_name ASC');
    $q->addOrder('task_end_date ASC');
    $tasks = $q->loadHashList('task_id');
    $q->clear();
    $first_task = current($tasks);
    $actual_project_id = 0;
    $first_task = true;
    $task_log = array();
    if (function_exists('styleRenderBoxBottom')) {
        echo styleRenderBoxBottom();
    }
    echo '<br />';
    if (function_exists('styleRenderBoxTop')) {
        echo styleRenderBoxTop();
    }
    echo '<table cellspacing="0" cellpadding="4" border="0" width="100%" class="std">
<tr>
	<td>';
예제 #28
0
 }
 if ($project_id != 0) {
     $q->addWhere('task_project=' . $project_id);
 }
 $proj = new CProject();
 $obj = new CTask();
 $allowedProjects = $proj->getAllowedSQL($AppUI->user_id, 'task_project');
 $allowedTasks = $obj->getAllowedSQL($AppUI->user_id);
 if (count($allowedProjects)) {
     $q->addWhere(implode(' AND ', $allowedProjects));
 }
 if (count($allowedTasks)) {
     $q->addWhere(implode(' AND ', $allowedTasks));
 }
 $q->addOrder('task_end_date');
 $task_list_hash = $q->loadHashList('task_id');
 $q->clear();
 $task_list = array();
 $task_assigned_users = array();
 $i = 0;
 foreach ($task_list_hash as $task_id => $task_data) {
     $task = new CTask();
     $task->bind($task_data);
     $task_list[$i] = $task;
     $task_assigned_users[$i] = $task->assignees($task_id);
     $i++;
 }
 $Ntasks = $i;
 $user_usage = array();
 $task_dates = array();
 $actual_date = $start_date;
예제 #29
0
// Pull tasks dependencies
$deps = false;
if ($deps) {
    $q = new w2p_Database_Query();
    $q->addTable('tasks');
    $q->addQuery('task_id, task_name');
    $q->addWhere('task_id IN (' . $deps . ')');
} else {
    $q = new w2p_Database_Query();
    $q->addTable('tasks', 't');
    $q->addTable('task_dependencies', 'td');
    $q->addQuery('t.task_id, t.task_name');
    $q->addWhere('td.dependencies_task_id = ' . (int) $task_id);
    $q->addWhere('t.task_id = td.dependencies_req_task_id');
}
$taskDep = $q->loadHashList();
$q->clear();
?>
<form name="dependFrm" action="?m=tasks&a=addedit&task_project=<?php 
echo $task_project;
?>
" method="post" accept-charset="utf-8">
    <input name="dosql" type="hidden" value="do_task_aed" />
    <input name="task_id" type="hidden" value="<?php 
echo $task_id;
?>
" />
    <input type="hidden" name="hdependencies" />

    <table width="100%" border="0" cellpadding="4" cellspacing="0" class="std addedit">
        <?php