Beispiel #1
0
function getCompanyInfo($company_id)
{
    global $AppUI;
    $q = new DBQuery();
    $q->addTable('companies', 'c');
    $q->addJoin('users', 'u', 'u.user_id = c.company_owner');
    $q->addJoin('contacts', 'co', 'u.user_contact = co.contact_id');
    $q->addQuery('c.*, CONCAT(contact_first_name, " ", contact_last_name) AS contact_name');
    $q->addWhere('c.company_id = ' . $company_id);
    $company = $q->loadHash();
    if (!$company) {
        $AppUI->setMsg('Missing company ID', UI_MSG_ERROR);
        echo $AppUI->getMsg();
        return;
    }
    include 'modules/public/resources.info.php';
}
 function load($oid = null, $strip = true)
 {
     $result = parent::load($oid, $strip);
     if ($result && $oid) {
         $working_hours = dPgetConfig('daily_working_hours') ? dPgetConfig('daily_working_hours') : 8;
         $q = new DBQuery();
         $q->addTable('projects');
         $q->addQuery(" SUM(t1.task_duration * t1.task_percent_complete" . " * IF(t1.task_duration_type = 24, {$working_hours}, t1.task_duration_type))" . " / SUM(t1.task_duration * IF(t1.task_duration_type = 24, {$working_hours}" . ", t1.task_duration_type)) AS project_percent_complete");
         $q->addJoin('tasks', 't1', 'projects.project_id = t1.task_project');
         $q->addWhere(" project_id = {$oid} AND t1.task_id = t1.task_parent");
         $this->project_percent_complete = $q->loadResult();
     }
     return $result;
 }
Beispiel #3
0
 function load($oid = null, $strip = true)
 {
     $result = parent::load($oid, $strip);
     if ($result && $oid) {
         $working_hours = $dPconfig['daily_working_hours'] ? $dPconfig['daily_working_hours'] : 8;
         $q = new DBQuery();
         $q->addTable('projects');
         $q->addQuery(' SUM(t1.task_duration * t1.task_percent_complete' . ' * IF(t1.task_duration_type = 24, ' . $working_hours . ', t1.task_duration_type))' . ' / SUM(t1.task_duration * IF(t1.task_duration_type = 24, ' . $working_hours . ', t1.task_duration_type)) AS project_percent_complete');
         $q->addJoin('tasks', 't1', 'projects.project_id = t1.task_project');
         $q->addWhere(' project_id = ' . $oid . ' AND t1.task_id = t1.task_parent');
         $this->project_percent_complete = $q->loadResult();
     }
     return $result;
 }
 function load($oid = null, $strip = true)
 {
     $result = parent::load($oid, $strip);
     if ($result && $oid) {
         $q = new DBQuery();
         $q->addTable('projects');
         $q->addQuery('SUM(t1.task_duration*t1.task_duration_type*t1.task_percent_complete) / 
                                     SUM(t1.task_duration*t1.task_duration_type) 
                                     AS project_percent_complete');
         $q->addJoin('tasks', 't1', 'projects.project_id = t1.task_project');
         $q->addWhere(" project_id = {$oid}");
         $this->project_percent_complete = $q->loadResult();
     }
     return $result;
 }
Beispiel #5
0
function sendNewPass()
{
    global $AppUI;
    $_live_site = w2PgetConfig('base_url');
    $_sitename = w2PgetConfig('company_name');
    // ensure no malicous sql gets past
    $checkusername = trim(w2PgetParam($_POST, 'checkusername', ''));
    $checkusername = db_escape($checkusername);
    $confirmEmail = trim(w2PgetParam($_POST, 'checkemail', ''));
    $confirmEmail = strtolower(db_escape($confirmEmail));
    $q = new DBQuery();
    $q->addTable('users');
    $q->addJoin('contacts', '', 'user_contact = contact_id', 'inner');
    $q->addQuery('user_id');
    $q->addWhere('user_username = \'' . $checkusername . '\'');
    $q->addWhere('LOWER(contact_email) = \'' . $confirmEmail . '\'');
    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->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->addTable('users');
    $q->addUpdate('user_password', $newpass);
    $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();
    }
}
Beispiel #6
0
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;
}
Beispiel #7
0
$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);
    } else {
Beispiel #8
0
        $filter1[] = ' project_status = ' . $proFilter;
    }
}
if ($company_id != 0) {
    $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);
Beispiel #9
0
$messages = $q->loadList();
$x = false;
$date = new CDate();
$pdfdata = array();
$pdfhead = array('Date', 'User', 'Message');
$new_messages = array();
foreach ($messages as $row) {
    // Find the parent message - the topic.
    if ($row['message_id'] == $message_id) {
        $topic = $row['message_title'];
    }
    $q = new DBQuery();
    $q->addTable('forum_messages');
    $q->addTable('users', 'u');
    $q->addQuery('DISTINCT contact_email, contact_first_name, contact_last_name, user_username');
    $q->addJoin('contacts', 'con', 'contact_id = user_contact');
    $q->addWhere('u.user_id = ' . $row["message_editor"]);
    $editor = $q->loadList();
    $date = intval($row["message_date"]) ? new CDate($row["message_date"]) : null;
    $pdfdata[] = array($row['message_date'], $row['contact_first_name'] . ' ' . $row['contact_last_name'], '<b>' . $row['message_title'] . '</b>
		' . $row['message_body']);
}
$font_dir = DP_BASE_DIR . '/lib/ezpdf/fonts';
$temp_dir = DP_BASE_DIR . '/files/temp';
require $AppUI->getLibraryClass('ezpdf/class.ezpdf');
$pdf =& new Cezpdf($paper = 'A4', $orientation = 'portrait');
$pdf->ezSetCmMargins(1, 2, 1.5, 1.5);
$pdf->selectFont("{$font_dir}/Helvetica.afm");
$pdf->ezText('Project: ' . $forum['project_name'] . '   Forum: ' . $forum['forum_name']);
$pdf->ezText('Topic: ' . $topic);
$pdf->ezText('');
Beispiel #10
0
 function getEventsInWindow($start_date, $end_date, $start_time, $end_time, $users = null)
 {
     global $AppUI;
     if (!isset($users)) {
         return false;
     }
     if (!count($users)) {
         return false;
     }
     // Now build a query to find matching events.
     $q = new DBQuery();
     $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 >= '{$start_date}'" . " AND event_end_date <= '{$end_date}'" . " AND EXTRACT(HOUR_MINUTE FROM e.event_end_date) >= '{$start_time}'" . " AND EXTRACT(HOUR_MINUTE FROM e.event_start_date) <= '{$end_time}'" . ' AND (e.event_owner IN (' . implode(',', $users) . ')' . ' OR ue.user_id IN (' . implode(',', $users) . '))');
     $result = $q->exec();
     if (!$result) {
         return false;
     }
     $eventlist = array();
     while ($row = db_fetch_assoc($result)) {
         $eventlist[] = $row;
     }
     $q->clear();
     return $eventlist;
 }
Beispiel #11
0
$obj = new CCompany();
$allowedCompanies = $obj->getAllowedRecords($AppUI->user_id, 'company_id, company_name');
$company_type_filter = $currentTabId;
//Not Defined
$companiesType = true;
if ($currentTabName == "All Companies") {
    $companiesType = false;
}
if ($currentTabName == "Not Applicable") {
    $company_type_filter = 0;
}
// retrieve list of records
$q = new DBQuery();
$q->addTable('companies', 'c');
$q->addQuery('c.company_id, c.company_name, c.company_type, c.company_description, count(distinct p.project_id) as countp, count(distinct p2.project_id) as inactive, con.contact_first_name, con.contact_last_name');
$q->addJoin('projects', 'p', 'c.company_id = p.project_company AND p.project_status <> 7');
$q->addJoin('users', 'u', 'c.company_owner = u.user_id');
$q->addJoin('contacts', 'con', 'u.user_contact = con.contact_id');
$q->addJoin('projects', 'p2', 'c.company_id = p2.project_company AND p2.project_status = 7');
if (count($allowedCompanies) > 0) {
    $q->addWhere('c.company_id IN (' . implode(',', array_keys($allowedCompanies)) . ')');
}
if ($companiesType) {
    $q->addWhere('c.company_type = ' . $company_type_filter);
}
if ($search_string != "") {
    $q->addWhere("c.company_name LIKE '%{$search_string}%'");
}
if ($owner_filter_id > 0) {
    $q->addWhere("c.company_owner = {$owner_filter_id} ");
}
Beispiel #12
0
<?php

/* DEPARTMENTS $Id: addedit.php,v 1.24 2005/04/08 13:41:51 gregorerhardt Exp $ */
// Add / Edit Company
$dept_id = isset($_GET['dept_id']) ? $_GET['dept_id'] : 0;
$company_id = isset($_GET['company_id']) ? $_GET['company_id'] : 0;
// check permissions for this department
$canEdit = !getDenyEdit($m, $dept_id);
if (!$canEdit) {
    $AppUI->redirect("m=public&a=access_denied");
}
// pull data for this department
$q = new DBQuery();
$q->addTable('departments', 'dep');
$q->addQuery('dep.*, company_name');
$q->addJoin('companies', 'com', 'com.company_id = dep.dept_company');
$q->addWhere('dep.dept_id = ' . $dept_id);
$sql = $q->prepare();
$q->clear();
if (!db_loadHash($sql, $drow) && $dept_id > 0) {
    $titleBlock = new CTitleBlock('Invalid Department ID', 'users.gif', $m, "{$m}.{$a}");
    $titleBlock->addCrumb("?m=companies", "companies list");
    if ($company_id) {
        $titleBlock->addCrumb("?m=companies&a=view&company_id={$company_id}", "view this company");
    }
    $titleBlock->show();
} else {
    ##echo $sql.db_error();##
    $company_id = $dept_id ? $drow['dept_company'] : $company_id;
    // check if valid company
    $q = new DBQuery();
Beispiel #13
0
 function getAssignedProjectsInRows($userId)
 {
     $q = new DBQuery();
     $q->addQuery('project_id, project_status, project_name, project_description' . ', project_short_name');
     $q->addTable('projects');
     $q->addJoin('tasks', 't', 't.task_project = project_id');
     $q->addJoin('user_tasks', 'ut', 'ut.task_id = t.task_id');
     $q->addWhere('ut.user_id = ' . $userId);
     $q->addGroup('project_id');
     $q->addOrder('project_name');
     $this->setAllowedSQL($userId, $q);
     $allowedProjectRows = $q->exec();
     return $allowedProjectRows;
 }
            if ($boot_query_row) {
                $boot_user_session = $boot_query_row['session_id'];
                $boot_user_log_id = $boot_query_row['user_access_log_id'];
            } else {
                $r->clear();
            }
        }
    } while ($boot_query_row);
    $msg = $boot_user_name . ' logged out by ' . $AppUI->user_first_name . ' ' . $AppUI->user_last_name;
    $AppUI->setMsg($msg, UI_MSG_OK);
    $AppUI->redirect('m=admin&tab=3');
}
$q = new DBQuery();
$q->addTable('sessions', 's');
$q->addQuery('DISTINCT(session_id), user_access_log_id, u.user_id as u_user_id, user_username,' . ' contact_last_name, contact_first_name, company_name, contact_company,' . ' date_time_in, user_ip');
$q->addJoin('user_access_log', 'ual', 'session_user = user_access_log_id');
$q->addJoin('users', 'u', 'ual.user_id = u.user_id');
$q->addJoin('contacts', 'con', 'u.user_contact = contact_id');
$q->addJoin('companies', 'com', 'contact_company = company_id');
$q->addOrder($orderby);
$rows = $q->loadList();
$q->clear();
$tab = (int) dPgetParam($_REQUEST, 'tab', 0);
?>
<script language="JavaScript" type="text/javascript">
//<![CDATA[
  function logoutSession(sessionID, logID, userID, userName) {
  var frm;
  frm = document.getElementById("frmSessions");
  frm.out_session.value = sessionID;
  frm.out_user_log_id.value = logID;
Beispiel #15
0
	<th width="100%"><?php 
echo $AppUI->_('Comments');
?>
</th>
	<th></th>
</tr>
<?php 
// Winnow out the tasks we are not allowed to view.
$perms =& $AppUI->acl();
$project =& new CProject();
// Pull the task comments
$q = new DBQuery();
$q->addTable('task_log');
$q->addQuery('task_log.*, user_username, task_id');
$q->addQuery('billingcode_name as task_log_costcode');
$q->addJoin('users', 'u', 'user_id = task_log_creator');
$q->addJoin('tasks', 't', 'task_log_task = t.task_id');
$q->addJoin('billingcode', 'b', 'task_log.task_log_costcode = billingcode_id');
$q->addWhere('task_project = ' . $project_id);
if ($user_id > 0) {
    $q->addWhere('task_log_creator = ' . $user_id);
}
if ($hide_inactive) {
    $q->addWhere('task_status >= 0');
}
if ($hide_complete) {
    $q->addWhere('task_percent_complete < 100');
}
if ($cost_code != '0') {
    $q->addWhere('task_log_costcode = "' . $cost_code . '"');
}
Beispiel #16
0
$criticalTasks = $project_id > 0 ? $obj->getCriticalTasks($project_id) : NULL;
//get ProjectPriority from sysvals
$projectPriority = dPgetSysVal('ProjectPriority');
$projectPriorityColor = dPgetSysVal('ProjectPriorityColor');
$working_hours = $dPconfig['daily_working_hours'] ? $dPconfig['daily_working_hours'] : 8;
//check that project has tasks; otherwise run seperate query
$q->addTable('tasks');
$q->addQuery('COUNT(distinct tasks.task_id) AS total_tasks');
$q->addWhere('task_project = ' . $project_id);
$hasTasks = $q->loadResult();
$q->clear();
//load the record data
//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');
$q->addJoin('companies', 'com', 'com.company_id = project_company');
$q->addJoin('companies', 'com_internal', 'com_internal.company_id = project_company_internal');
$q->addJoin('users', 'u', 'user_id = project_owner');
$q->addJoin('contacts', 'con', 'contact_id = user_contact');
if ($hasTasks) {
    $q->addJoin('tasks', 't1', 'projects.project_id = t1.task_project');
    $q->addQuery('com.company_name AS company_name, com_internal.company_name' . ' AS company_name_internal' . ", CONCAT_WS(', ',contact_last_name,contact_first_name) user_name" . ', projects.*, SUM(t1.task_duration * t1.task_percent_complete' . " * IF(t1.task_duration_type = 24, {$working_hours}, t1.task_duration_type))" . " / SUM(t1.task_duration * IF(t1.task_duration_type = 24, {$working_hours}," . ' t1.task_duration_type)) AS project_percent_complete');
    $q->addWhere('t1.task_id = t1.task_parent');
} else {
    $q->addQuery('com.company_name AS company_name, com_internal.company_name' . ' AS company_name_internal' . ", CONCAT_WS(' ',contact_first_name,contact_last_name) user_name, projects.*, " . '(0.0) AS project_percent_complete');
}
$q->addWhere('project_id = ' . $project_id);
$q->addGroup('project_id');
$sql = $q->prepare();
$q->clear();
$obj = null;
Beispiel #17
0
function displayFiles($folder)
{
    global $m, $a, $tab, $AppUI, $xpg_min, $xpg_pagesize;
    global $deny1, $deny2, $project_id, $task_id, $showProject, $file_types, $cfObj;
    global $xpg_totalrecs, $xpg_total_pages, $page;
    global $company_id, $allowed_companies, $current_uri, $dPconfig;
    $canEdit = !getDenyEdit($m, $folder);
    $canRead = !getDenyRead($m, $folder);
    $df = $AppUI->getPref('SHDATEFORMAT');
    $tf = $AppUI->getPref('TIMEFORMAT');
    // SETUP FOR FILE LIST
    $q = new DBQuery();
    $q->addTable('files');
    $q->addQuery('files.*,count(file_version) as file_versions,round(max(file_version), 2) as file_lastversion,file_folder_id, file_folder_name,project_name, project_color_identifier,contact_first_name, contact_last_name,task_name,task_id');
    $q->addJoin('projects', 'p', 'p.project_id = file_project');
    $q->addJoin('users', 'u', 'u.user_id = file_owner');
    $q->addJoin('contacts', 'c', 'c.contact_id = u.user_contact');
    $q->addJoin('tasks', 't', 't.task_id = file_task');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = file_folder');
    $q->addWhere('file_folder = ' . $folder);
    if (count($deny1) > 0) {
        $q->addWhere('file_project NOT IN (' . implode(',', $deny1) . ')');
    }
    if (count($deny2) > 0) {
        $q->addWhere('file_task NOT IN (' . implode(',', $deny2) . ')');
    }
    if ($project_id) {
        $q->addWhere('file_project = ' . $project_id);
    }
    if ($task_id) {
        $q->addWhere('file_task = ' . $task_id);
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('company_id = ' . $company_id);
        $q->addWhere('company_id IN (' . $allowed_companies . ')');
    }
    $q->addGroup('file_folder');
    $q->addGroup('project_name');
    $q->addGroup('file_name');
    $q->addOrder('file_folder');
    $q->addOrder('project_name');
    $q->addOrder('file_name');
    $q->setLimit($xpg_pagesize, $xpg_min);
    $files_sql = $q->prepare();
    $q->clear();
    $q = new DBQuery();
    $q->addTable('files');
    $q->addQuery('files.file_id, file_version, file_project, file_name, file_task, file_description, user_username as file_owner, file_size, file_category, file_type, file_date, file_folder_name');
    $q->addJoin('projects', 'p', 'p.project_id = file_project');
    $q->addJoin('users', 'u', 'u.user_id = file_owner');
    $q->addJoin('tasks', 't', 't.task_id = file_task');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = file_folder');
    $q->addWhere('file_folder = ' . $folder);
    if ($project_id) {
        $q->addWhere('file_project = ' . $project_id);
    }
    if ($task_id) {
        $q->addWhere('file_task = ' . $task_id);
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('company_id = ' . $company_id);
        $q->addWhere('company_id IN (' . $allowed_companies . ')');
    }
    $file_versions_sql = $q->prepare();
    $q->clear();
    $files = array();
    $file_versions = array();
    if ($canRead) {
        $files = db_loadList($files_sql);
        $file_versions = db_loadList($file_versions_sql);
    }
    if ($files === array()) {
        return 0;
    }
    ?>
	<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
	<tr>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('File Name');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Description');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Versions');
    ?>
</th>
	    <th><?php 
    echo $AppUI->_('Category');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Task Name');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Owner');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Size');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Type');
    ?>
</a></th>
		<th><?php 
    echo $AppUI->_('Date');
    ?>
</th>
    	<th nowrap="nowrap"><?php 
    echo $AppUI->_('co Reason');
    ?>
</th>
    	<th><?php 
    echo $AppUI->_('co');
    ?>
</th>
		<th nowrap width="1"></th>
		<th nowrap width="1"></th>
	</tr>
<?php 
    $fp = -1;
    $file_date = new CDate();
    $id = 0;
    foreach ($files as $row) {
        $file_date = new CDate($row['file_date']);
        if ($fp != $row["file_project"]) {
            if (!$row["project_name"]) {
                $row["project_name"] = $AppUI->_('All Projects');
                $row["project_color_identifier"] = 'f4efe3';
            }
            if ($showProject) {
                $s = '<tr>';
                $s .= '<td colspan="20" style="background-color:#' . $row["project_color_identifier"] . '">';
                $s .= '<font color="' . bestColor($row["project_color_identifier"]) . '">';
                if ($row['file_project'] > 0) {
                    $href = './index.php?m=projects&a=view&project_id=' . $row['file_project'];
                } else {
                    $href = './index.php?m=projects';
                }
                $s .= '<a href="' . $href . '">' . $row["project_name"] . '</a>';
                $s .= '</font></td></tr>';
                echo $s;
            }
        }
        $fp = $row["file_project"];
        if ($row['file_versions'] > 1) {
            $file = last_file($file_versions, $row['file_name'], $row['file_project']);
        } else {
            $file = $row;
        }
        ?>
	<form name="frm_remove_file_<?php 
        echo $file['file_id'];
        ?>
" action="?m=files" method="post">
	<input type="hidden" name="dosql" value="do_file_aed" />
	<input type="hidden" name="del" value="1" />
	<input type="hidden" name="file_id" value="<?php 
        echo $file['file_id'];
        ?>
" />
	<input type="hidden" name="redirect" value="<?php 
        echo $current_uri;
        ?>
" />
	</form>		
	<form name="frm_duplicate_file_<?php 
        echo $file['file_id'];
        ?>
" action="?m=files" method="post">
	<input type="hidden" name="dosql" value="do_file_aed" />
	<input type="hidden" name="duplicate" value="1" />
	<input type="hidden" name="file_id" value="<?php 
        echo $file['file_id'];
        ?>
" />
	<input type="hidden" name="redirect" value="<?php 
        echo $current_uri;
        ?>
" />
	</form>		
	<tr>
		<td nowrap="8%">
			<?php 
        $file_icon = getIcon($row['file_type']);
        echo "<a href=\"./fileviewer.php?file_id={$file['file_id']}\" title=\"{$file['file_description']}\"><img border=\"0\" width=\"16\" heigth=\"16\" src=\"" . DP_BASE_URL . "/modules/files/images/{$file_icon}\" />&nbsp;{$row['file_name']}</a>";
        ?>
		</td>
		<td width="20%"><?php 
        echo $file['file_description'];
        ?>
</td>
		<td width="5%" nowrap="nowrap" align="center">
	        <?php 
        $hidden_table = '';
        echo $row['file_lastversion'];
        if ($row['file_versions'] > 1) {
            echo ' <a href="#" onClick="expand(\'versions_' . $file['file_id'] . '\'); ">(' . $row['file_versions'] . ')</a>';
            $hidden_table = '<tr><td colspan="20">
	<table style="display: none" id="versions_' . $file['file_id'] . '" width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
	<tr>
	        <th nowrap="nowrap">' . $AppUI->_('File Name') . '</th>
	        <th>' . $AppUI->_('Description') . '</th>
	        <th>' . $AppUI->_('Versions') . '</th>
	        <th>' . $AppUI->_('Category') . '</th>
	        <th nowrap="nowrap">' . $AppUI->_('Task Name') . '</th>
	        <th>' . $AppUI->_('Owner') . '</th>
	        <th>' . $AppUI->_('Size') . '</th>
	        <th>' . $AppUI->_('Type') . '</a></th>
	        <th>' . $AppUI->_('Date') . '</th>
    		<th nowrap="nowrap">' . $AppUI->_('co Reason') . '</th>
    		<th>' . $AppUI->_('co') . '</th>
	        <th nowrap width="1"></th>
	        <th nowrap width="1"></th>
	</tr>
	';
            foreach ($file_versions as $file_row) {
                if ($file_row['file_name'] == $row['file_name'] && $file_row['file_project'] == $row['file_project']) {
                    $file_icon = getIcon($file_row['file_type']);
                    $file_date = new CDate($file_row['file_date']);
                    $hidden_table .= '	
			<form name="frm_delete_sub_file_' . $file_row['file_id'] . '" action="?m=files" method="post">
			<input type="hidden" name="dosql" value="do_file_aed" />
			<input type="hidden" name="del" value="1" />
			<input type="hidden" name="file_id" value="' . $file_row['file_id'] . '" />
			<input type="hidden" name="redirect" value="' . $current_uri . '" />
			</form>';
                    $hidden_table .= '	
			<form name="frm_duplicate_sub_file_' . $file_row['file_id'] . '" action="?m=files" method="post">
			<input type="hidden" name="dosql" value="do_file_aed" />
			<input type="hidden" name="duplicate" value="1" />
			<input type="hidden" name="file_id" value="' . $file_row['file_id'] . '" />
			<input type="hidden" name="redirect" value="' . $current_uri . '" />
			</form>';
                    $hidden_table .= '
	        <tr>
	                <td nowrap="8%"><a href="./fileviewer.php?file_id=' . $file_row['file_id'] . '" 
	                        title="' . $file_row['file_description'] . '">' . "<img border=\"0\" width=\"16\" heigth=\"16\" src=\"" . DP_BASE_URL . "/modules/files/images/{$file_icon}\" />&nbsp;" . $file_row['file_name'] . '
	                </a></td>
	                <td width="20%">' . $file_row['file_description'] . '</td>
	                <td width="5%" nowrap="nowrap" align="center">' . $file_row['file_version'] . '</td>
	                <td width="10%" nowrap="nowrap" align="center"><a href="./index.php?m=' . $m . '&a=' . $a . '&tab=' . ($file_row['file_category'] + 1) . '">' . $file_types[$file_row['file_category'] + 1] . '</a></td>
	                <td width="5%" align="center"><a href="./index.php?m=tasks&a=view&task_id=' . $file_row["file_task"] . '">' . $row["task_name"] . '</a></td>
	                <td width="15%" nowrap="nowrap">' . $row["contact_first_name"] . ' ' . $row["contact_last_name"] . '</td>
	                <td width="5%" nowrap="nowrap" align="right">' . intval($file_row['file_size'] / 1024) . 'kb </td>
	                <td width="15%" nowrap="nowrap">' . $file_row['file_type'] . '</td>
	                <td width="15%" nowrap="nowrap" align="right">' . $file_date->format("{$df} {$tf}") . '</td>
        			<td width="10%">' . $row['file_co_reason'] . '</td>
        			<td nowrap="nowrap" align="center">';
                    if ($canEdit && empty($file_row['file_checkout'])) {
                        $hidden_table .= '<a href="?m=files&a=co&file_id=' . $file_row['file_id'] . '">' . dPshowImage('./modules/files/images/up.png', '16', '16', 'checkout', 'checkout file') . '</a>';
                    } else {
                        if ($row['file_checkout'] == $AppUI->user_id) {
                            $hidden_table .= '<a href="?m=files&a=addedit&ci=1&file_id=' . $file_row['file_id'] . '">' . dPshowImage('./modules/files/images/down.png', '16', '16', 'checkin', 'checkin file') . '</a>';
                        } else {
                            if ($file_row['file_checkout'] == 'final') {
                                $hidden_table .= 'final';
                            } else {
                                $q4 = new DBQuery();
                                $q4->addQuery("file_id, file_checkout, user_username as co_user, contact_first_name, contact_last_name");
                                $q4->addTable('files');
                                $q4->leftJoin('users', 'cu', 'cu.user_id = file_checkout');
                                $q4->leftJoin('contacts', 'co', 'co.contact_id = cu.user_contact');
                                $q4->addWhere('file_id = ' . $file_row['file_id']);
                                $co_user = array();
                                $co_user = $q4->loadList();
                                $co_user = $co_user[0];
                                $q4->clear();
                                $hidden_table .= $co_user['contact_first_name'] . ' ' . $co_user['contact_last_name'] . '<br>(' . $co_user['co_user'] . ')';
                            }
                        }
                    }
                    $hidden_table .= '</td>';
                    $hidden_table .= '<td nowrap="nowrap" align="right" width="48">';
                    if ($canEdit && (empty($file_row['file_checkout']) || $file_row['file_checkout'] == 'final' && ($canEdit || $row['project_owner'] == $AppUI->user_id))) {
                        $hidden_table .= '<a href="./index.php?m=files&a=addedit&file_id=' . $file_row["file_id"] . '">' . dPshowImage('./modules/files/images/kedit.png', '16', '16', 'edit file', 'edit file') . "</a>" . '<a href="#" onclick="document.frm_duplicate_sub_file_' . $file_row['file_id'] . '.submit()">' . dPshowImage('./modules/files/images/duplicate.png', '16', '16', 'duplicate file', 'duplicate file') . "</a>" . '<a href="#" onclick="if (confirm(\'Are you sure you want to delete this file?\')) {document.frm_delete_sub_file_' . $file_row['file_id'] . '.submit()}">' . dPshowImage('./modules/files/images/remove.png', '16', '16', 'delete file', 'delete file') . "</a>";
                    }
                    $hidden_table .= '</td>';
                    $hidden_table .= '<td nowrap="nowrap" align="right" width="1">';
                    if ($canEdit && (empty($row['file_checkout']) || $row['file_checkout'] == 'final' && ($canEdit || $row['project_owner'] == $AppUI->user_id))) {
                        $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $file_row['file_id'] . ') : removeBulkComponent(' . $file_row['file_id'] . ')"';
                        $hidden_table .= '<input type="checkbox" ' . $bulk_op . ' name="chk_sub_sel_file_' . $file_row['file_id'] . '" />';
                    }
                    $hidden_table .= '</td>';
                    $hidden_table .= '</tr>';
                }
            }
            $hidden_table .= '</table>';
            //$hidden_table .= '</span>';
        }
        ?>
	        </td>
	        <td width="10%" nowrap="nowrap" align="center"><a href="./index.php?m=<?php 
        echo $m;
        ?>
&a=<?php 
        echo $a;
        ?>
&view=categories&tab=<?php 
        echo $file['file_category'];
        ?>
"><?php 
        echo $file_types[$file["file_category"]];
        ?>
</a></td> 
		<td width="5%" align="center"><a href="./index.php?m=tasks&a=view&task_id=<?php 
        echo $file["task_id"];
        ?>
"><?php 
        echo $file["task_name"];
        ?>
</a></td>
		<td width="15%" nowrap="nowrap"><?php 
        echo $file["contact_first_name"] . ' ' . $file["contact_last_name"];
        ?>
</td>
		<td width="5%" nowrap="nowrap" align="right"><?php 
        echo intval($file["file_size"] / 1024);
        ?>
 kb</td>
		<td width="15%" nowrap="nowrap"><?php 
        echo $file["file_type"];
        ?>
</td>
		<td width="15%" nowrap="nowrap" align="right"><?php 
        echo $file_date->format("{$df} {$tf}");
        ?>
</td>
        <td width="10%"><?php 
        echo $file['file_co_reason'];
        ?>
</td>
        <td nowrap="nowrap" align="center">
        <?php 
        if ($canEdit && empty($row['file_checkout'])) {
            ?>
                <a href="?m=files&a=co&file_id=<?php 
            echo $file['file_id'];
            ?>
"><?php 
            echo dPshowImage('./modules/files/images/up.png', '16', '16', 'checkout', 'checkout file');
            ?>
</a>
        <?php 
        } else {
            if ($row['file_checkout'] == $AppUI->user_id) {
                ?>
                <a href="?m=files&a=addedit&ci=1&file_id=<?php 
                echo $file['file_id'];
                ?>
"><?php 
                echo dPshowImage('./modules/files/images/down.png', '16', '16', 'checkin', 'checkin file');
                ?>
</a>
        <?php 
            } else {
                if ($file['file_checkout'] == 'final') {
                    echo 'final';
                } else {
                    $q4 = new DBQuery();
                    $q4->addQuery("file_id, file_checkout, user_username as co_user, contact_first_name, contact_last_name");
                    $q4->addTable('files');
                    $q4->leftJoin('users', 'cu', 'cu.user_id = file_checkout');
                    $q4->leftJoin('contacts', 'co', 'co.contact_id = cu.user_contact');
                    $q4->addWhere('file_id = ' . $file['file_id']);
                    $co_user = array();
                    $co_user = $q4->loadList();
                    $co_user = $co_user[0];
                    $q4->clear();
                    echo $co_user['contact_first_name'] . ' ' . $co_user['contact_last_name'] . '<br>(' . $co_user['co_user'] . ')';
                }
            }
        }
        ?>
                
        </td>
		<td nowrap="nowrap" align="center" width="48">
		<?php 
        if ($canEdit && (empty($file['file_checkout']) || $file['file_checkout'] == 'final' && ($canEdit || $file['project_owner'] == $AppUI->user_id))) {
            echo '<a href="./index.php?m=files&a=addedit&file_id=' . $file["file_id"] . '">';
            echo dPshowImage('./modules/files/images/kedit.png', '16', '16', 'edit file', 'edit file');
            echo "</a>";
            echo '<a href="#" onclick="document.frm_duplicate_file_' . $file['file_id'] . '.submit()">' . dPshowImage('./modules/files/images/duplicate.png', '16', '16', 'duplicate file', 'duplicate file') . '</a>';
            echo '<a href="#" onclick="if (confirm(\'Are you sure you want to delete this file?\')) {document.frm_remove_file_' . $file['file_id'] . '.submit()}">' . dPshowImage('./modules/files/images/remove.png', '16', '16', 'delete file', 'delete file') . '</a>';
        }
        ?>
		<td nowrap="nowrap" align="center" width="1">
		<?php 
        if ($canEdit && (empty($file['file_checkout']) || $file['file_checkout'] == 'final' && ($canEdit || $file['project_owner'] == $AppUI->user_id))) {
            $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $file['file_id'] . ') : removeBulkComponent(' . $file['file_id'] . ')"';
            echo '<input type="checkbox" ' . $bulk_op . ' name="chk_sel_file_' . $file['file_id'] . '" />';
        }
        ?>
		
		</td>
	</tr>
	<?php 
        echo $hidden_table;
        ?>
	<?php 
        $hidden_table = '';
    }
    ?>
	</table>
	<?php 
    if ($xpg_totalrecs > $xpg_pagesize) {
        showfnavbar($xpg_totalrecs, $xpg_pagesize, $xpg_total_pages, $page, $folder);
    }
    echo "<br />";
}
Beispiel #18
0
 public function getTaskLogs($taskId, $problem = false)
 {
     $q = new DBQuery();
     $q->addTable('task_log');
     $q->addQuery('task_log.*, user_username, billingcode_name as task_log_costcode');
     $q->addQuery('CONCAT(contact_first_name, \' \', contact_last_name) AS real_name');
     $q->addWhere('task_log_task = ' . (int) $taskId . ($problem ? ' AND task_log_problem > 0' : ''));
     $q->addOrder('task_log_date');
     $q->leftJoin('billingcode', '', 'task_log.task_log_costcode = billingcode_id');
     $q->addJoin('users', '', 'task_log_creator = user_id', 'inner');
     $q->addJoin('contacts', 'ct', 'contact_id = user_contact', 'inner');
     return $q->loadList();
 }
Beispiel #19
0
//Pull forum information
$q = new DBQuery();
$q->addTable('forums');
$q->addTable('projects');
$q->addQuery('forum_name, forum_owner, forum_moderated, project_name, project_id');
$q->addWhere("forums.forum_id = {$forum_id}");
$q->addWhere('forums.forum_project = projects.project_id');
$res = $q->exec();
$forum_info = $q->fetchRow();
$q->clear();
echo db_error();
//pull message information
$q = new DBQuery();
$q->addTable('forum_messages');
$q->addQuery('forum_messages.*, user_username');
$q->addJoin('users', 'u', 'message_author = u.user_id');
$q->addWhere('message_id = ' . ($message_id ? $message_id : $message_parent));
$res = $q->exec();
echo db_error();
$message_info = $q->fetchRow();
$q->clear();
//pull message information from last response
if ($message_parent != -1) {
    $q->addTable('forum_messages');
    $q->addWhere('message_parent = ' . ($message_id ? $message_id : $message_parent));
    $q->addOrder('message_id DESC');
    // fetch last message first
    $q->setLimit(1);
    $res = $q->exec();
    echo db_error();
    $last_message_info = $q->fetchRow();
function displayFiles($folder_id)
{
    global $AppUI, $m, $a, $tab, $page;
    global $current_uri;
    global $canAccess, $canRead, $canEdit, $canAuthor, $canDelete;
    global $canAccess_folders, $canRead_folders, $canEdit_folders;
    global $canAuthor_folders, $canDelete_folders;
    global $company_id, $project_id, $task_id;
    global $allowedCompanies, $allowedProjects, $allowedTasks, $allowedFolders;
    global $showProject, $cfObj, $dPconfig;
    $df = $AppUI->getPref('SHDATEFORMAT');
    $tf = $AppUI->getPref('TIMEFORMAT');
    $file_types = dPgetSysVal('FileType');
    $xpg_pagesize = 30;
    //TODO?: Set by System Config Value ...
    $xpg_totalrecs = countFiles($folder_id);
    //get file count for folder
    $xpg_total_pages = $xpg_totalrecs > $xpg_pagesize ? ceil($xpg_totalrecs / $xpg_pagesize) : 1;
    $xpg_min = $xpg_pagesize * ($page - 1);
    // This is where we start our record set from
    $q = new DBQuery();
    // most recent version info per file_project and file_version_id
    $q->createTemp('files_count_max' . $folder_id);
    $q->addTable('files', 'f');
    $q->addQuery('DISTINCT count(f.file_id) as file_versions' . ', max(f.file_version) as file_lastversion' . ', file_version_id, f.file_project');
    $q->addJoin('projects', 'p', 'p.project_id = f.file_project');
    $q->addJoin('tasks', 't', 't.task_id = f.file_task');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = f.file_folder');
    $q->addWhere('f.file_folder = ' . $folder_id);
    if (count($allowedProjects)) {
        $q->addWhere('((' . implode(' AND ', $allowedProjects) . ') OR f.file_project = 0)');
    }
    if (count($allowedTasks)) {
        $q->addWhere('((' . implode(' AND ', $allowedTasks) . ') OR f.file_task = 0)');
    }
    if (count($allowedFolders)) {
        $q->addWhere('((' . implode(' AND ', $allowedFolders) . ') OR f.file_folder = 0)');
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('co.company_id = ' . $company_id);
        if (count($allowedCompanies)) {
            $q->addWhere('(' . implode(' AND ', $allowedCompanies) . ')');
        }
    }
    $q->addGroup('f.file_version_id');
    $q->addGroup('f.file_project');
    $file_version_max_counts = $q->exec();
    $q->clear();
    // most recent version
    $q->addTable('files', 'f');
    $q->addQuery('f.*, fmc.file_versions, round(fmc.file_lastversion, 2) as file_lastversion' . ', u.user_username as file_owner, ff.file_folder_name' . ', ff.file_folder_id, ff.file_folder_name, p.project_name' . ', p.project_color_identifier, p.project_owner, c.contact_first_name' . ', c.contact_last_name, t.task_name, u.user_username as file_owner' . ', cc.contact_first_name as checkout_first_name' . ', cc.contact_last_name as checkout_last_name');
    $q->addJoin('files_count_max' . $folder_id, 'fmc', '(fmc.file_lastversion=f.file_version AND fmc.file_version_id=f.file_version_id' . ' AND fmc.file_project=f.file_project)', 'inner');
    $q->addJoin('projects', 'p', 'p.project_id = f.file_project');
    $q->addJoin('users', 'u', 'u.user_id = f.file_owner');
    $q->addJoin('contacts', 'c', 'c.contact_id = u.user_contact');
    $q->addJoin('tasks', 't', 't.task_id = f.file_task');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = f.file_folder');
    $q->leftJoin('users', 'cu', 'cu.user_id = f.file_checkout');
    $q->leftJoin('contacts', 'cc', 'cc.contact_id = cu.user_contact');
    $q->addWhere('f.file_folder = ' . $folder_id);
    if (count($allowedProjects)) {
        $q->addWhere('((' . implode(' AND ', $allowedProjects) . ') OR f.file_project = 0)');
    }
    if (count($allowedTasks)) {
        $q->addWhere('((' . implode(' AND ', $allowedTasks) . ') OR f.file_task = 0)');
    }
    if (count($allowedFolders)) {
        $q->addWhere('((' . implode(' AND ', $allowedFolders) . ') OR f.file_folder = 0)');
    }
    if ($project_id) {
        $q->addWhere('f.file_project = ' . $project_id);
    }
    if ($task_id) {
        $q->addWhere('f.file_task = ' . $task_id);
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('co.company_id = ' . $company_id);
        if (count($allowedCompanies)) {
            $q->addWhere('(' . implode(' AND ', $allowedCompanies) . ')');
        }
    }
    $q->addOrder('p.project_name');
    $q->setLimit($xpg_pagesize, $xpg_min);
    $files_sql = $q->prepare();
    $q->clear();
    // all versions
    $q->addTable('files', 'f');
    $q->addQuery('f.*, ff.file_folder_id, ff.file_folder_name, p.project_name' . ', p.project_color_identifier, p.project_owner, c.contact_first_name' . ', c.contact_last_name, t.task_name, u.user_username as file_owner');
    $q->addJoin('projects', 'p', 'p.project_id = f.file_project');
    $q->addJoin('users', 'u', 'u.user_id = f.file_owner');
    $q->addJoin('contacts', 'c', 'c.contact_id = u.user_contact');
    $q->addJoin('tasks', 't', 't.task_id = f.file_task');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = f.file_folder');
    $q->addWhere('f.file_folder = ' . $folder_id);
    if (count($allowedProjects)) {
        $q->addWhere('((' . implode(' AND ', $allowedProjects) . ') OR f.file_project = 0)');
    }
    if (count($allowedTasks)) {
        $q->addWhere('((' . implode(' AND ', $allowedTasks) . ') OR f.file_task = 0)');
    }
    if (count($allowedFolders)) {
        $q->addWhere('((' . implode(' AND ', $allowedFolders) . ') OR f.file_folder = 0)');
    }
    if ($project_id) {
        $q->addWhere('f.file_project = ' . $project_id);
    }
    if ($task_id) {
        $q->addWhere('f.file_task = ' . $task_id);
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('co.company_id = ' . $company_id);
        if (count($allowedCompanies)) {
            $q->addWhere('(' . implode(' AND ', $allowedCompanies) . ')');
        }
    }
    $file_versions_sql = $q->prepare();
    $q->clear();
    //file arrays
    $files = array();
    $file_versions = array();
    if ($canRead) {
        $files = db_loadList($files_sql);
        $file_versions = db_loadHashList($file_versions_sql, 'file_id');
    }
    $q->dropTemp('files_count_max' . $folder_id);
    $q->exec();
    if ($files == array()) {
        return;
    }
    ?>
	<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
	<tr>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('File Name');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Description');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Versions');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Category');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Task Name');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Owner');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Size');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Date');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('co Reason');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('co');
    ?>
</th>
		<th nowrap width="1"></th>
		<th nowrap width="1"></th>
	</tr>
<?php 
    $fp = -1;
    $file_date = new CDate();
    $id = 0;
    foreach ($files as $row) {
        $file_date = new CDate($row['file_date']);
        $canEdit_file = getPermission('files', 'edit', $row['file_id']);
        //single file
        if ($fp != $row['file_project']) {
            if (!$row['file_project']) {
                $row['project_name'] = $AppUI->_('Not associated to projects');
                $row['project_color_identifier'] = 'f4efe3';
            }
            if ($showProject) {
                $style = 'background-color:#' . $row['project_color_identifier'] . ';color:' . bestColor($row['project_color_identifier']);
                ?>
<tr>
	<td colspan="20" style="border: outset 2px #eeeeee;<?php 
                echo $style;
                ?>
">
	<a href="?m=projects&a=view&project_id=<?php 
                echo $row['file_project'];
                ?>
">
	<span style="<?php 
                echo $style;
                ?>
"><?php 
                echo $row['project_name'];
                ?>
</span></a>
	</td>
</tr>
<?php 
            }
        }
        $fp = $row['file_project'];
        ?>
	<form name="frm_remove_file_<?php 
        echo $row['file_id'];
        ?>
" action="?m=files" 
	 method="post">
	<input type="hidden" name="dosql" value="do_file_aed" />
	<input type="hidden" name="del" value="1" />
	<input type="hidden" name="file_id" value="<?php 
        echo $row['file_id'];
        ?>
" />
	<input type="hidden" name="redirect" value="<?php 
        echo $current_uri;
        ?>
" />
	</form>		
	<form name="frm_duplicate_file_<?php 
        echo $row['file_id'];
        ?>
" action="?m=files" 
	 method="post">
	<input type="hidden" name="dosql" value="do_file_aed" />
	<input type="hidden" name="duplicate" value="1" />
	<input type="hidden" name="file_id" value="<?php 
        echo $row['file_id'];
        ?>
" />
	<input type="hidden" name="redirect" value="<?php 
        echo $current_uri;
        ?>
" />
	</form>		
	<tr>
		<td nowrap="8%">
<?php 
        $file_icon = getIcon($row['file_type']);
        ?>
		  <a href="./fileviewer.php?file_id=<?php 
        echo $row['file_id'];
        ?>
" 
		   title="<?php 
        echo $row['file_description'];
        ?>
"> 
		  <?php 
        echo dPshowImage(DP_BASE_URL . '/modules/files/images/' . $file_icon, '16', '16');
        ?>
		  &nbsp;<?php 
        echo $row['file_name'];
        ?>
 
		  </a>
		</td>
		<td width="20%"><?php 
        echo $row['file_description'];
        ?>
</td>
		<td width="5%" nowrap="nowrap" align="center">
<?php 
        $hidden_table = '';
        echo $row['file_lastversion'];
        if ($row['file_versions'] > 1) {
            ?>
	  <a href="#" onClick="expand('versions_<?php 
            echo $row['file_id'];
            ?>
');">
	  (<?php 
            echo $row['file_versions'];
            ?>
)
	  </a>
<?php 
        }
        ?>
		</td>
		<td width="10%" nowrap="nowrap" align="center">
		  <?php 
        echo $file_types[$row['file_category']];
        ?>
		</td>
		<td width="5%" align="center">
		  <a href="./index.php?m=tasks&a=view&task_id=<?php 
        echo $row['file_task'];
        ?>
">
		  <?php 
        echo $row['task_name'];
        ?>
		  </a>
		</td>
		<td width="15%" nowrap="nowrap">
		  <?php 
        echo $row["contact_first_name"] . ' ' . $row["contact_last_name"];
        ?>
		</td>
		<td width="5%" nowrap="nowrap" align="right">
		  <?php 
        echo file_size(intval($row['file_size']));
        ?>
		</td>
		<td width="15%" nowrap="nowrap" align="right">
		  <?php 
        echo $file_date->format($df . ' ' . $tf);
        ?>
		</td>
		<td width="10%"><?php 
        echo $row['file_co_reason'];
        ?>
</td>
		<td nowrap="nowrap" align="center">
		  
<?php 
        if ($canEdit && empty($row['file_checkout'])) {
            ?>
			  <a href="?m=files&a=co&file_id=<?php 
            echo $row['file_id'];
            ?>
">
			  <?php 
            echo dPshowImage(DP_BASE_URL . '/modules/files/images/up.png', '16', '16', 'checkout', 'checkout file');
            ?>
			  </a>
<?php 
        } else {
            if ($row['file_checkout'] == $AppUI->user_id) {
                ?>
			  <a href="?m=files&a=addedit&ci=1&file_id=<?php 
                echo $row['file_id'];
                ?>
">
			  <?php 
                echo dPshowImage(DP_BASE_URL . '/modules/files/images/down.png', '16', '16', 'checkin', 'checkin file');
                ?>
			  </a>
<?php 
            } else {
                if ($file['file_checkout'] == 'final') {
                    echo '			  ' . $AppUI->_('final');
                } else {
                    echo '	  ' . $row['checkout_first_name'] . ' ' . $row['checkout_last_name'] . '<br />(' . $row['co_user'] . ')';
                }
            }
        }
        ?>
		</td>
		<td nowrap="nowrap" align="right" width="48">
		  <?php 
        if (empty($row['file_checkout']) || $row['file_checkout'] == 'final') {
            // Edit File
            if ($canEdit || $row['project_owner'] == $AppUI->user_id) {
                ?>
		  <a href="./index.php?m=files&a=addedit&file_id=<?php 
                echo $row['file_id'];
                ?>
">
<?php 
                echo dPshowImage(DP_BASE_URL . '/modules/files/images/kedit.png', '16', '16', 'edit file', 'edit file');
                ?>
		  </a>
<?php 
            }
            // Duplicate File
            if ($canAuthor || $row['project_owner'] == $AppUI->user_id) {
                ?>
		  <a href="#" 
		   onclick="document.frm_duplicate_file_<?php 
                echo $row['file_id'];
                ?>
.submit()">
<?php 
                echo dPshowImage(DP_BASE_URL . '/modules/files/images/duplicate.png', '16', '16', 'duplicate file', 'duplicate file');
                ?>
		  </a>
<?php 
            }
            // Delete File
            if ($canDelete || $row['project_owner'] == $AppUI->user_id) {
                ?>
		  <a href="#" 
		   onclick="if (confirm('Are you sure you want to delete this file?')) {document.frm_remove_file_<?php 
                echo $row['file_id'];
                ?>
.submit()}">
<?php 
                echo dPshowImage(DP_BASE_URL . '/modules/files/images/remove.png', '16', '16', 'delete file', 'delete file');
                ?>
		  </a>
<?php 
            }
        }
        ?>
		</td>
		<td nowrap="nowrap" align="center" width="1">
<?php 
        if ((empty($row['file_checkout']) || $row['file_checkout'] == 'final') && ($canEdit || $row['project_owner'] == $AppUI->user_id)) {
            $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $row['file_id'] . ') : removeBulkComponent(' . $row['file_id'] . ')"';
            ?>
			<input type="checkbox" <?php 
            echo $bulk_op;
            ?>
 
			 name="chk_sub_sel_file_<?php 
            echo $file_row['file_id'];
            ?>
" />
<?php 
        }
        ?>
		</td>
</tr>



<?php 
        if ($row['file_versions'] > 1) {
            ?>

	  <tr><td colspan="20">
		<table style="display: none" id="versions_<?php 
            echo $row['file_id'];
            ?>
" 
		 width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
		  <tr>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('File Name');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Description');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Versions');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Category');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Task Name');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Owner');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Size');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Type');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Date');
            ?>
</th>
			<th nowrap="nowrap"width="1">&nbsp;</th>
			<th nowrap="nowrap"width="1">&nbsp;</th>
		  </tr>
<?php 
            foreach ($file_versions as $file) {
                if ($file['file_version_id'] == $row['file_version_id']) {
                    $file_icon = getIcon($file['file_type']);
                    $file_version_date = new Date($file['file_date']);
                    ?>

		  <form name="frm_delete_sub_file_<?php 
                    echo $file['file_id'];
                    ?>
" 
		   action="?m=files" method="post">
		  <input type="hidden" name="dosql" value="do_file_aed" />
		  <input type="hidden" name="del" value="1" />
		  <input type="hidden" name="file_id" value="<?php 
                    echo $file['file_id'];
                    ?>
" />
		  <input type="hidden" name="redirect" value="<?php 
                    echo $current_uri;
                    ?>
" />
		  </form>		
		  <form name="frm_duplicate_sub_file_<?php 
                    echo $file['file_id'];
                    ?>
" 
		   action="?m=files" method="post">
		  <input type="hidden" name="dosql" value="do_file_aed" />
		  <input type="hidden" name="duplicate" value="1" />
		  <input type="hidden" name="file_id" value="<?php 
                    echo $file['file_id'];
                    ?>
" />
		  <input type="hidden" name="redirect" value="<?php 
                    echo $current_uri;
                    ?>
" />
		  </form>
		  <tr>
			<td nowrap="8%">
			  <a href="./fileviewer.php?file_id=<?php 
                    echo $file['file_id'];
                    ?>
" 
			   title="<?php 
                    echo $file['file_description'];
                    ?>
">
			  <?php 
                    echo dPshowImage(DP_BASE_URL . '/modules/files/images/' . $file_icon, '16', '16');
                    ?>
			  <?php 
                    echo $file['file_name'];
                    ?>
 
			  </a>
			</td>
			<td width="20%"><?php 
                    echo $file['file_description'];
                    ?>
</td>
			<td width="5%" nowrap="nowrap" align="center"><?php 
                    echo $file['file_version'];
                    ?>
</td>
			<td width="10%" nowrap="nowrap" align="center">
			  <?php 
                    echo $file_types[$file['file_category']];
                    ?>
			</td>
			<td width="5%" align="center">
			  <a href="./index.php?m=tasks&a=view&task_id=<?php 
                    echo $file['file_task'];
                    ?>
">
			  <?php 
                    echo $file['task_name'];
                    ?>
			  </a>
			</td>
			<td width="15%" nowrap="nowrap">
			  <?php 
                    echo $file["contact_first_name"] . ' ' . $file["contact_last_name"];
                    ?>
			</td>
			<td width="5%" nowrap="nowrap" align="right">
			  <?php 
                    echo file_size(intval($file['file_size']));
                    ?>
			</td>
			<td nowrap="nowrap">
			  <?php 
                    echo $row['file_type'];
                    ?>
			</td>
			<td width="15%" nowrap="nowrap" align="right">
			  <?php 
                    echo $file_version_date->format($df . ' ' . $tf);
                    ?>
			</td>
			
			<td nowrap="nowrap" align="right" width="48">
			  <?php 
                    if (empty($file['file_checkout']) || $file['file_checkout'] == 'final') {
                        // Edit File
                        if ($canEdit || $row['project_owner'] == $AppUI->user_id) {
                            ?>
			  <a href="./index.php?m=files&a=addedit&file_id=<?php 
                            echo $row['file_id'];
                            ?>
">
<?php 
                            echo dPshowImage(DP_BASE_URL . '/modules/files/images/kedit.png', '16', '16', 'edit file', 'edit file');
                            ?>
			  </a>
<?php 
                        }
                        // Duplicate File
                        if ($canAuthor) {
                            ?>
			  <a href="#" 
			   onclick="document.frm_duplicate_file_<?php 
                            echo $row['file_id'];
                            ?>
.submit()">
<?php 
                            echo dPshowImage(DP_BASE_URL . '/modules/files/images/duplicate.png', '16', '16', 'duplicate file', 'duplicate file');
                            ?>
			  </a>
<?php 
                        }
                        // Delete File
                        if ($canDelete) {
                            ?>
			  <a href="#" 
			   onclick="if (confirm('<?php 
                            echo $AppUI->_('Are you sure you want to delete this file?');
                            ?>
')) {document.frm_remove_file_<?php 
                            echo $row['file_id'];
                            ?>
.submit()}">
<?php 
                            echo dPshowImage(DP_BASE_URL . '/modules/files/images/remove.png', '16', '16', 'delete file', $AppUI->_('delete file'));
                            ?>
			  </a>
<?php 
                        }
                    }
                    ?>
			</td>
			<td nowrap="nowrap" align="center" width="1">
<?php 
                    if ((empty($row['file_checkout']) || $row['file_checkout'] == 'final') && ($canEdit || $row['project_owner'] == $AppUI->user_id)) {
                        $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $row['file_id'] . ') : removeBulkComponent(' . $row['file_id'] . ')"';
                        ?>
			  <input type="checkbox" <?php 
                        echo $bulk_op;
                        ?>
 
			   name="chk_sub_sel_file_<?php 
                        echo $file_row['file_id'];
                        ?>
" />
<?php 
                    }
                    ?>
			  </td>
			</tr>
<?php 
                }
            }
            ?>
		</table>
	  </td></tr>
<?php 
        }
    }
    ?>

	</table>
	<?php 
    shownavbar($xpg_totalrecs, $xpg_pagesize, $xpg_total_pages, $page, $folder_id);
    echo "<br />";
}
Beispiel #21
0
        build_date_list($projTasksWithEndDates, $sub_task);
    }
}
// let's iterate root tasks
foreach ($root_tasks as $root_task) {
    build_date_list($projTasksWithEndDates, $root_task);
    if ($root_task['task_id'] != $task_id) {
        constructTaskTree($root_task, $parents, $all_tasks);
    }
}
$project = new CProject();
$sprojects = $project->getAllowedRecords($AppUI->user_id, 'project_id,project_name', 'project_name', null, $extra);
$q = new DBQuery();
$q->addTable('projects');
$q->addQuery('project_id, company_name');
$q->addJoin("companies", 'co', 'co.company_id = project_company');
$idx_companies = $q->loadHashList();
$q->clear();
foreach ($sprojects as $prj_id => $prj_name) {
    $sprojects[$prj_id] = $idx_companies[$prj_id] . ': ' . $prj_name;
}
asort($sprojects);
$sprojects = arrayMerge(array('' => '(' . $AppUI->_('Move to Project', UI_OUTPUT_RAW) . ')'), $sprojects);
//lets addthe reference to percent
@(include_once "./functions/tasks_func.php");
$spercent = arrayMerge(array('' => '(Progress)'), $percent);
?>
            <form name='frm_bulk' method='POST' action='?m=projectdesigner&a=do_task_bulk_aed'>
	      <input type="hidden" name="project_id" value="<?php 
echo $project_id;
?>
Beispiel #22
0
 public function notifyContacts($notifyContacts)
 {
     global $AppUI, $w2Pconfig, $locale_char_set;
     if ($notifyContacts == '1') {
         //if no project specified than we will not do anything
         if ($this->file_project != 0) {
             $this->_project = new CProject();
             $this->_project->load($this->file_project);
             $mail = new Mail();
             if ($this->file_task == 0) {
                 //notify all developers
                 $mail->Subject($AppUI->_('Project') . ': ' . $this->_project->project_name . '::' . $this->file_name, $locale_char_set);
             } else {
                 //notify all assigned users
                 $this->_task = new CTask();
                 $this->_task->load($this->file_task);
                 $mail->Subject($AppUI->_('Project') . ': ' . $this->_project->project_name . '::' . $this->_task->task_name . '::' . $this->file_name, $locale_char_set);
             }
             $body = $AppUI->_('Project') . ': ' . $this->_project->project_name;
             $body .= "\n" . $AppUI->_('URL') . ':     ' . W2P_BASE_URL . '/index.php?m=projects&a=view&project_id=' . $this->_project->project_id;
             if (intval($this->_task->task_id) != 0) {
                 $body .= "\n\n" . $AppUI->_('Task') . ':    ' . $this->_task->task_name;
                 $body .= "\n" . $AppUI->_('URL') . ':     ' . W2P_BASE_URL . '/index.php?m=tasks&a=view&task_id=' . $this->_task->task_id;
                 $body .= "\n" . $AppUI->_('Description') . ":\n" . $this->_task->task_description;
                 $q = new DBQuery();
                 $q->addTable('project_contacts', 'pc');
                 $q->addQuery('c.contact_email as contact_email, c.contact_first_name as contact_first_name, c.contact_last_name as contact_last_name');
                 $q->addJoin('contacts', 'c', 'c.contact_id = pc.contact_id');
                 $q->addWhere('pc.project_id = ' . (int) $this->_project->project_id);
                 $sql = '(' . $q->prepare() . ')';
                 $q->clear();
                 $sql .= ' UNION ';
                 $q->addTable('task_contacts', 'tc');
                 $q->addQuery('c.contact_email as contact_email, c.contact_first_name as contact_first_name, c.contact_last_name as contact_last_name');
                 $q->addJoin('contacts', 'c', 'c.contact_id = tc.contact_id');
                 $q->addWhere('tc.task_id = ' . (int) $this->_task->task_id);
                 $sql .= '(' . $q->prepare() . ')';
                 $q->clear();
                 $this->_users = $q->loadList();
             } else {
                 $q = new DBQuery();
                 $q->addTable('project_contacts', 'pc');
                 $q->addQuery('pc.project_id, pc.contact_id');
                 $q->addQuery('c.contact_email as contact_email, c.contact_first_name as contact_first_name, c.contact_last_name as contact_last_name');
                 $q->addJoin('contacts', 'c', 'c.contact_id = pc.contact_id');
                 $q->addWhere('pc.project_id = ' . (int) $this->file_project);
                 $this->_users = $q->loadList();
                 $q->clear();
             }
             $body .= "\n\nFile " . $this->file_name . ' was ' . $this->_message . ' by ' . $AppUI->user_first_name . ' ' . $AppUI->user_last_name;
             if ($this->_message != 'deleted') {
                 $body .= "\n" . $AppUI->_('URL') . ':     ' . W2P_BASE_URL . '/fileviewer.php?file_id=' . $this->file_id;
                 $body .= "\n" . $AppUI->_('Description') . ":\n" . $this->file_description;
             }
             //send mail
             $mail->Body($body, isset($GLOBALS['locale_char_set']) ? $GLOBALS['locale_char_set'] : '');
             foreach ($this->_users as $row) {
                 if ($mail->ValidEmail($row['contact_email'])) {
                     $mail->To($row['contact_email'], true);
                     $mail->Send();
                 }
             }
             return '';
         }
     }
 }
Beispiel #23
0
		<input class="button" type="submit" name="do_report" value="<?php 
echo $AppUI->_('submit');
?>
" />
	</td>
</tr>
</table>
</form>

<?php 
if ($do_report) {
    // Let's figure out which users we have
    $q = new DBQuery();
    $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');
    $user_list = $q->loadHashList('user_id');
    $q->clear();
    $q = new DBQuery();
    $q->addTable('tasks', 't');
    $q->addTable('user_tasks', 'ut');
    $q->addTable('projects', 'p');
    $q->addQuery('t.*, ut.*, p.project_name');
    $q->addWhere("( task_start_date\n\t\t\t   BETWEEN \"" . $start_date->format(FMT_DATETIME_MYSQL) . "\"\n\t                AND \"" . $end_date->format(FMT_DATETIME_MYSQL) . "\"\n\t           OR task_end_date\tBETWEEN \"" . $start_date->format(FMT_DATETIME_MYSQL) . "\"\n\t                AND \"" . $end_date->format(FMT_DATETIME_MYSQL) . "\"\n\t\t   OR ( task_start_date <= \"" . $start_date->format(FMT_DATETIME_MYSQL) . "\"\n\t                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'");
    $q->addWhere('task_start_date IS NOT NULL');
    $q->addWhere("task_start_date != '0000-00-00 00:00:00'");
    $q->addWhere("task_dynamic !='1'");
    $q->addWhere("task_milestone = '0'");
    $q->addWhere('task_duration  > 0');
Beispiel #24
0
require_once $AppUI->getModuleClass('projects');
$project =& new CProject();
$max_msg_length = 30;
/* Query modified by Fergus McDonald 2005/08/12 to address slow join issue */
$q = new DBQuery();
$q->addTable('forums');
$q->addTable('projects', 'p');
$q->addTable('users', 'u');
$q->addQuery("forum_id, forum_project, forum_description, forum_owner, forum_name");
$q->addQuery("forum_moderated, forum_create_date, forum_last_date");
$q->addQuery("sum(if(c.message_parent=-1,1,0)) as forum_topics, sum(if(c.message_parent>0,1,0)) as forum_replies");
$q->addQuery("user_username, project_name, project_color_identifier");
$q->addQuery("SUBSTRING(l.message_body,1,{$max_msg_length}) message_body");
$q->addQuery("LENGTH(l.message_body) message_length, watch_user, l.message_parent, l.message_id");
$q->addQuery("count(distinct v.visit_message) as visit_count, count(distinct c.message_id) as message_count");
$q->addJoin('forum_messages', 'l', 'l.message_id = forum_last_id');
$q->addJoin('forum_messages', 'c', 'c.message_forum = forum_id');
$q->addJoin('forum_watch', 'w', "watch_user = {$AppUI->user_id} AND watch_forum = forum_id");
$q->addJoin('forum_visits', 'v', "visit_user = {$AppUI->user_id} AND visit_forum = forum_id and visit_message = c.message_id");
$project->setAllowedSQL($AppUI->user_id, $q);
$forum->setAllowedSQL($AppUI->user_id, $q);
$q->addWhere("user_id = forum_owner AND project_id = forum_project");
switch ($f) {
    case 1:
        $q->addWhere("project_status <> 7 AND forum_owner = {$AppUI->user_id}");
        break;
    case 2:
        $q->addWhere("project_status <> 7 AND watch_user IS NOT NULL");
        break;
    case 3:
        $q->addWhere("project_status <> 7 AND project_owner = {$AppUI->user_id}");
Beispiel #25
0
    foreach ($depts as $dept_id => $dept_info) {
        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 
Beispiel #26
0
<?php

/* COMPANIES $Id: vw_depts.php,v 1.15.2.1 2006/07/31 11:54:15 nybod Exp $ */
##
##	Companies: View Projects sub-table
##
global $AppUI, $company_id, $canEdit;
$q = new DBQuery();
$q->addTable('departments');
$q->addQuery('departments.*, COUNT(contact_department) dept_users');
$q->addJoin('contacts', 'c', 'c.contact_department = dept_id');
$q->addWhere('dept_company = ' . $company_id);
$q->addGroup('dept_id');
$q->addOrder('dept_parent, dept_name');
$sql = $q->prepare();
$q->clear();
// function renamed to avoid naming clash
function showchilddept_comp(&$a, $level = 0)
{
    global $AppUI;
    $s = '
	<td>
		<a href="index.php?m=departments&a=addedit&dept_id=' . $a['dept_id'] . '" title="' . $AppUI->_('edit') . '">
			' . dPshowImage('images/edit.gif', 12, 12, '') . '
	</td>
	<td>';
    for ($y = 0; $y < $level; $y++) {
        if ($y + 1 == $level) {
            $s .= '<img src="images/corner-dots.gif" width="16" height="12" border="0">';
        } else {
            $s .= '<img src="images/shim.gif" width="16" height="12" border="0">';
Beispiel #27
0
     $dur *= $w2Pconfig['daily_working_hours'];
 }
 if ($showWork == '1') {
     $work_hours = 0;
     $q = new DBQuery();
     $q->addTable('tasks', 't');
     $q->addJoin('user_tasks', 'u', 't.task_id = u.task_id', 'inner');
     $q->addQuery('ROUND(SUM(t.task_duration*u.perc_assignment/100),2) AS wh');
     $q->addWhere('t.task_duration_type = 24');
     $q->addWhere('t.task_id = ' . (int) $a['task_id']);
     $wh = $q->loadResult();
     $work_hours = $wh * $w2Pconfig['daily_working_hours'];
     $q->clear();
     $q = new DBQuery();
     $q->addTable('tasks', 't');
     $q->addJoin('user_tasks', 'u', 't.task_id = u.task_id', 'inner');
     $q->addQuery('ROUND(SUM(t.task_duration*u.perc_assignment/100),2) AS wh');
     $q->addWhere('t.task_duration_type = 1');
     $q->addWhere('t.task_id = ' . (int) $a['task_id']);
     $wh2 = $q->loadResult();
     $work_hours += $wh2;
     $q->clear();
     //due to the round above, we don't want to print decimals unless they really exist
     $dur = $work_hours;
 }
 $dur .= ' h';
 $enddate = new CDate($end);
 $startdate = new CDate($start);
 //$gantt->addBar($name, $start, $end, $actual_end, $caption, 0.6, $p['project_color_identifier'], $p['project_active'], $progress);
 if ($caller == 'todo') {
     $bar = new GanttBar($row++, array($name, $pname, $dur, $startdate->format($df), $enddate->format($df)), substr($start, 2, 8), substr($end, 2, 8), $cap, $a['task_dynamic'] == 1 ? 0.1 : 0.6);
Beispiel #28
0
function getUsersArray()
{
    $q = new DBQuery();
    $q->addTable('users');
    $q->addQuery('user_id, user_username, contact_first_name, contact_last_name');
    $q->addJoin('contacts', 'con', 'contact_id = user_contact');
    $q->addOrder('contact_first_name, contact_last_name');
    return $q->loadHashList("user_id");
}
Beispiel #29
0
    $canEdit = $perms->checkModuleItem($m, "edit", $company_id);
} else {
    $canEdit = $perms->checkModule($m, "add");
}
if (!$canEdit) {
    $AppUI->redirect("m=public&a=access_denied");
}
// load the company types
$types = dPgetSysVal('CompanyType');
// load the record data
$q = new DBQuery();
$q->addTable('companies');
$q->addQuery('companies.*');
$q->addQuery('con.contact_first_name');
$q->addQuery('con.contact_last_name');
$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');
Beispiel #30
0
if (in_array($project_id, $denied)) {
    $AppUI->redirect("m=public&a=access_denied");
}
$canDelete = $obj->canDelete($msg, $project_id);
// get critical tasks (criteria: task_end_date)
$criticalTasks = $project_id > 0 ? $obj->getCriticalTasks($project_id) : NULL;
// get ProjectPriority from sysvals
$projectPriority = dPgetSysVal('ProjectPriority');
$projectPriorityColor = dPgetSysVal('ProjectPriorityColor');
$working_hours = $dPconfig['daily_working_hours'];
// load the record data
// GJB: Note that we have to special case duration type 24 and this refers to the hours in a day, NOT 24 hours
$q = new DBQuery();
$q->addTable('projects');
$q->addQuery("company_name,\n\tCONCAT_WS(' ',contact_first_name,contact_last_name) user_name,\n\tprojects.*,\n\tSUM(t1.task_duration * t1.task_percent_complete * IF(t1.task_duration_type = 24, " . $working_hours . ", t1.task_duration_type))/\n\t\tSUM(t1.task_duration * IF(t1.task_duration_type = 24, " . $working_hours . ", t1.task_duration_type)) AS project_percent_complete");
$q->addJoin('companies', 'com', 'company_id = project_company');
$q->addJoin('users', 'u', 'user_id = project_owner');
$q->addJoin('contacts', 'con', 'contact_id = user_contact');
$q->addJoin('tasks', 't1', 'projects.project_id = t1.task_project');
$q->addWhere('project_id = ' . $project_id);
$q->addGroup('project_id');
$sql = $q->prepare();
$q->clear();
$obj = null;
if (!db_loadObject($sql, $obj)) {
    $AppUI->setMsg('Project');
    $AppUI->setMsg("invalidID", UI_MSG_ERROR, true);
    $AppUI->redirect();
} else {
    $AppUI->savePlace();
}