function fetchResults(&$permissions) { global $AppUI; $sql = $this->_buildQuery(); $results = db_loadList($sql); $outstring = "<th nowrap='nowrap' STYLE='background: #08245b' >" . $AppUI->_('Projects') . "</th>\n"; require_once $AppUI->getModuleClass("projects"); if ($results) { foreach ($results as $records) { if ($permissions->checkModuleItem($this->table, "view", $records["project_id"])) { $obj = new CProject(); if (!in_array($records["project_id"], $obj->getDeniedRecords($AppUI->user_id))) { $outstring .= "<tr>"; $outstring .= "<td>"; $outstring .= "<a href = \"index.php?m=projects&a=view&project_id=" . $records["project_id"] . "\">" . $records["project_name"] . "</a>\n"; $outstring .= "</td>\n"; } } } $outstring .= "</tr>"; } else { $outstring .= "<tr>" . "<td>" . $AppUI->_('Empty') . "</td>" . "</tr>"; } return $outstring; }
function getAllowedProjectsForJavascript() { global $HELPDESK_CONFIG, $AppUI; $allowedProjects = getAllowedProjects(); //if there are none listed, make sure that sql returns nothing if (!$allowedProjects) { return ""; } if ($HELPDESK_CONFIG['use_project_perms']) { $whereclause = array_keys($allowedProjects); } else { foreach ($allowedProjects as $p) { $whereclause[] = $p['project_id']; } } $whereclause = "project_id in (" . implode(", ", $whereclause) . ")"; $sql = "SELECT project_id, project_name, company_name, company_id\n FROM projects\n LEFT JOIN companies ON company_id = projects.project_company\n WHERE (" . $whereclause . ") ORDER BY project_name"; $allowedCompanyProjectList = db_loadList($sql); /* Build array of company/projects for output to javascript Adding slashes in case special characters exist */ foreach ($allowedCompanyProjectList as $row) { $projects[] = "[{$row['company_id']},{$row['project_id']},'" . addslashes($row['project_name']) . "']"; $reverse[$row['project_id']] = $row['company_id']; } return $projects; }
function fetchResults(&$permissions) { global $AppUI; if (!$permissions->checkModule('files', 'view')) { return "<tr>" . "<td>" . $AppUI->_('Empty') . "</td>" . "</tr>"; } $sql = $this->_buildQuery(); $results = db_loadList($sql); $outstring = "<tr><th nowrap='nowrap' STYLE='background: #08245b' >" . $AppUI->_('Files Content') . "</th></tr>\n"; if ($results) { foreach ($results as $records) { $outstring .= "<tr>"; $outstring .= "<td>"; if ($permissions->checkModuleItem('files', "edit", $records["file_id"])) { $outstring .= "<a href = \"index.php?m=files&a=addedit&file_id=" . $records["file_id"] . "\">" . dPshowImage('./images/icons/stock_edit-16.png', '16', '16') . '</a>'; } $outstring .= '<a href="' . $this->follow_up_link . $records['file_id'] . '">' . $records["file_name"] . ' v.' . $records['file_version'] . "</a> (word {$records['word_placement']})" . '   --   ' . $records["file_description"]; $outstring .= "</td>\n"; $outstring .= "</tr>"; } } else { $outstring .= "<tr>" . "<td>" . $AppUI->_('Empty') . "</td>" . "</tr>"; } return $outstring; }
function getExactContractBeginDate($given_time) { $company_id = $_REQUEST['company_id']; $sql = "SELECT application_date from companies WHERE company_id='{$company_id}'"; $rows = db_loadList($sql, NULL); $au_expiration_date = $rows[0]['application_date']; $before_one_year = date("m/d/Y", strtotime($au_expiration_date) - 3600 * 24 * 365); $present_given_time = date("m/d/Y", strtotime($given_time)); //client is kind of confused. return strtotime($au_expiration_date) > strtotime($given_time) ? date("m/d/Y", strtotime($given_time)) : $present_given_time; }
function fetchResults(&$permissions, &$record_count) { global $AppUI; $sql = $this->_buildQuery(); $results = db_loadList($sql); if ($results) { $record_count += count($results); $outstring = "<tr><th><b>" . $AppUI->_($this->table_title) . ' (' . count($results) . ')' . "</b></th></tr> \n"; foreach ($results as $records) { if ($permissions->checkModuleItem($this->table_module, "view", $records[preg_replace('/^.*\\.([^\\.]+)$/', '$1', $this->table_key)])) { // --MSy- $ii = 0; $display_val = ""; foreach ($this->display_fields as $fld) { $ii++; if (!($this->search_options['display_all_flds'] == "on") && $ii > 2) { break; } $display_val = $display_val . " " . $records[preg_replace('/^.*\\.([^\\.]+)$/', '$1', $fld)]; } //--MSy- $tmplink = ""; if (isset($this->table_link) && isset($this->table_key)) { $tmplink = $this->table_link . $records[preg_replace('/^.*\\.([^\\.]+)$/', '$1', $this->table_key)]; } if (isset($this->table_link2) && isset($this->table_key2)) { $tmplink = $this->table_link . $records[preg_replace('/^.*\\.([^\\.]+)$/', '$1', $this->table_key)] . $this->table_link2 . $records[preg_replace('/^.*\\.([^\\.]+)$/', '$1', $this->table_key2)]; } //--MSy-- $outstring .= "<tr>"; $outstring .= "<td>"; $outstring .= "<a href = \" " . $tmplink . "\">" . highlight($display_val, $this->keywords) . "</a>\n"; $outstring .= "</td>\n"; $outstring .= "</tr>"; } } } else { if ($this->search_options['show_empty'] == "on") { $outstring = "<tr><th><b>" . $AppUI->_($this->table_title) . ' (' . count($results) . ')' . "</b></th></tr> \n"; $outstring .= "<tr>" . "<td>" . $AppUI->_('Empty') . "</td>" . "</tr>"; } } return $outstring; }
function fetchResults(&$permissions) { global $AppUI; $sql = $this->_buildQuery(); $results = db_loadList($sql); $outstring = "<th nowrap='nowrap' STYLE='background: #08245b' >" . $AppUI->_('Contacts') . "</th>\n"; if ($results) { foreach ($results as $records) { if ($permissions->checkModuleItem($this->table, "view", $records["contact_id"])) { $outstring .= "<tr>"; $outstring .= "<td>"; $outstring .= "<a href = \"index.php?m=contacts&a=addedit&contact_id=" . $records["contact_id"] . "\">" . $records["contact_first_name"] . " " . $records["contact_last_name"] . "</a>\n"; $outstring .= "</td>\n"; } } $outstring .= "</tr>"; } else { $outstring .= "<tr>" . "<td>" . $AppUI->_('Empty') . "</td>" . "</tr>"; } return $outstring; }
function fetchResults(&$permissions) { global $AppUI; $sql = $this->_buildQuery(); $results = db_loadList($sql); $outstring = "<th nowrap='nowrap' STYLE='background: #08245b' >" . $AppUI->_('Task Log') . "</th>\n"; if ($results) { foreach ($results as $records) { if ($permissions->checkModuleItem("tasks", "view", $records["task_log_task"])) { $outstring .= "<tr>"; $outstring .= "<td>"; $outstring .= "<a href = \"index.php?m=tasks&a=view&task_id=" . $records["task_log_task"] . "&tab=1&task_log_id=" . $records["task_log_id"] . "\">" . $records["task_log_name"] . "</a>\n"; $outstring .= "</td>"; } } $outstring .= "</tr>"; } else { $outstring .= "<tr>" . "<td>" . $AppUI->_('Empty') . "</td>" . "</tr>"; } return $outstring; }
function fetchResults(&$permissions) { global $AppUI; $sql = $this->_buildQuery(); $results = db_loadList($sql); $outstring = "<th nowrap='nowrap' STYLE='background: #cccccc' >" . $AppUI->_('Helpdesk') . "</th>\n"; if ($results) { foreach ($results as $records) { if ($permissions->checkModuleItem("helpdesk", "view", $records["item_id"])) { $outstring .= "<tr>"; $outstring .= "<td>"; $outstring .= "<a href = \"index.php?m=helpdesk&a=view&item_id=" . $records["item_id"] . "\">" . $records["item_title"] . "</a>\n"; $outstring .= "</td>\n"; } } $outstring .= "</tr>"; } else { $outstring .= "<tr>" . "<td>" . $AppUI->_('Empty') . "</td>" . "</tr>"; } return $outstring; }
function fetchResults(&$permissions) { global $AppUI; $sql = $this->_buildQuery(); $results = db_loadList($sql); $outstring = "<th nowrap='nowrap' STYLE='background: #08245b' >" . $AppUI->_('Forum Messages') . "</th>\n"; if ($results) { foreach ($results as $records) { if ($permissions->checkModuleItem($this->table, "view", $records["message_id"])) { $outstring .= "<tr>"; $outstring .= "<td>"; $outstring .= "<a href = \"index.php?m=forums&a=view&forum_id=" . $records["message_forum"] . "&message_id=" . $records["message_id"] . "\">" . $records["message_title"] . "</a>\n"; $outstring .= "</td>\n"; } } $outstring .= "</tr>"; } else { $outstring .= "<tr>" . "<td>" . $AppUI->_('Empty') . "</td>" . "</tr>"; } return $outstring; }
function fetchResults(&$permissions) { global $AppUI; $sql = $this->_buildQuery(); $results = db_loadList($sql); $outstring = "<th nowrap='nowrap' STYLE='background: #08245b' >" . $AppUI->_('Tickets') . "</th>\n"; if ($results) { foreach ($results as $records) { if ($permissions->checkModuleItem($this->table, "view", $records["ticket"])) { $outstring .= "<tr>"; $outstring .= "<td>"; $outstring .= "<a href = \"index.php?m=ticketsmith&a=view&ticket=" . $records["ticket"] . "\">" . $records["subject"] . "</a>\n"; $outstring .= "</td>\n"; } } $outstring .= "</tr>"; } else { $outstring .= "<tr>" . "<td>" . $AppUI->_('Empty') . "</td>" . "</tr>"; } return $outstring; }
function fetchResults(&$permissions) { global $AppUI; $sql = $this->_buildQuery(); $results = db_loadList($sql); $outstring = "<th nowrap='nowrap' STYLE='background: #08245b' >" . $AppUI->_('Files') . "</th>\n"; if ($results) { foreach ($results as $records) { if ($permissions->checkModuleItem($this->table, "edit", $records["file_id"])) { $outstring .= "<tr>"; $outstring .= "<td>"; $outstring .= "<a href = \"index.php?m=files&a=addedit&file_id=" . $records["file_id"] . "\">" . $records["file_name"] . "</a>" . '   --   ' . $records["file_description"]; $outstring .= "</td>\n"; } } $outstring .= "</tr>"; } else { $outstring .= "<tr>" . "<td>" . $AppUI->_('Empty') . "</td>" . "</tr>"; } return $outstring; }
function getAllowedDepartmentsForJavascript() { global $AppUI; $allowedDepartments = getAllowedDepartments(); //if there are none listed, make sure that sql returns nothing if (!$allowedDepartments) { return ""; } foreach ($allowedDepartments as $d) { $whereclause[] = $d['dept_id']; } $whereclause = "dept_id in (" . implode(", ", $whereclause) . ")"; $sql = "SELECT dept_id, dept_name, company_name, company_id\n FROM departments\n LEFT JOIN companies ON company_id = departments.dept_company\n WHERE (" . $whereclause . ") ORDER BY dept_name"; $allowedCompanyDepartmentList = db_loadList($sql); /* Build array of company/departments for output to javascript Adding slashes in case special characters exist */ foreach ($allowedCompanyDepartmentList as $row) { $departments[] = "[{$row['company_id']},{$row['dept_id']},'" . addslashes($row['dept_name']) . "']"; $reverse[$row['dept_id']] = $row['company_id']; } return $departments; }
// Responsable de tarea $perms->add_acl($viewINA_perms, null, array($resp_role), null, array($admin_mods), 1, 1, null, null, "user"); $perms->add_acl($view_perms, null, array($resp_role), null, array($non_admin_mods), 1, 1, null, null, "user"); $perms->add_acl($all_perms, null, array($resp_role), null, array($log_tareas), 1, 1, null, null, "user"); // Consultor $perms->add_acl($view_perms, null, array($cons_role), null, array($non_admin_mods), 1, 1, null, null, "user"); $perms->add_acl($viewINA_perms, null, array($cons_role), null, array($admin_mods), 1, 1, null, null, "user"); dPmsg("Converting admin user permissions to Administrator Role"); // Now we have the basics set up we need to create objects for all users $sql = "SELECT user_id, user_username, permission_id from users\nLEFT JOIN permissions ON permission_user = users.user_id and permission_grant_on = 'all' \nAND permission_item = -1 and permission_value = -1"; $res = db_exec($sql); if ($res) { while ($row = db_fetch_assoc($res)) { // Add the basic ARO $perms->add_object("user", $row["user_username"], $row["user_id"], 1, 0, "aro"); if ($row["permission_id"]) { $perms->add_group_object($admin_role, "user", $row["user_id"], "aro"); } } } dPmsg("Searching for add-on modules to add to new permissions"); // Upgrade permissions for custom modules $sql = "SELECT mod_directory, mod_name, permissions_item_table\n\tFROM modules\n\tWHERE mod_ui_active = 1\n\tAND mod_type = 'user'"; $custom_modules = db_loadList($sql); foreach ($custom_modules as $mod) { $perms->addModule($mod['mod_directory'], $mod['mod_name']); $perms->addGroupItem($mod['mod_directory'], "non_admin"); if (isset($mod['permissions_item_table']) && $mod['permissions_item_table']) { $perms->addModuleSection($mod['permissions_item_table']); } }
if (!defined('DP_BASE_DIR')) { die('You should not access this file directly. Instead, run the Installer in install/index.php.'); } /** * This script iterates all contacts and verify if the contact_company * field has a text value; if it does, it searches of the company in the * companies table, if it finds it then the contact is related to it by its id. * If it doesn't find it, the it creates the company (only the name) and then it * relates it to the contact using the new company's id. */ dPmsg('Fetching companies list'); $q = new DBQuery(); $q->addTable('contacts'); $q->addQuery('*'); $sql = $q->prepare(true); foreach (db_loadList($sql) as $contact) { $contact_company = $contact['contact_company']; if (is_numeric($contact_company)) { if (!checkCompanyId($contact_company)) { dPmsg('Error found in contact_company in the contact ' . getContactGeneralInformation($contact)); } } else { if ($contact_company != "") { $company_id = fetchCompanyId($contact_company); // If we find company_id if (!$company_id) { // We need to create the new company $company_id = insertCompany($contact_company); } if ($company_id) { updateContactCompany($contact, $company_id);
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'); ?> <?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"> </th> <th nowrap="nowrap"width="1"> </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 />"; }
foreach ($result as $row) { $people[$row['user_id']] = $row; $users[$row['user_id']] = $row['name']; } unset($result); $sql = "\r\n select distinct(project_id), project_name from task_log\r\n left join tasks on tasks.task_id = task_log.task_log_task\r\n left join projects on projects.project_id = tasks.task_project\r\n where\r\n task_log_date >= '" . $start_report->format(FMT_DATETIME_MYSQL) . "'\r\n and task_log_date <= '" . $end_report->format(FMT_DATETIME_MYSQL) . "'\r\n and task_log_task != 0\r\n and task_log_creator = " . $user_id . "\r\n order by project_name\r\n\t\t"; # echo $sql; $projects = array(); $result = db_loadList($sql); foreach ($result as $row) { $projects[$row['project_id']] = $row['project_name']; } unset($result); foreach ($projects as $id => $project_name) { $sql = "\r\n select sum(task_log.task_log_hours) as sum, task_log.task_log_date from task_log\r\n left join tasks on tasks.task_id = task_log.task_log_task\r\n left join projects on projects.project_id = tasks.task_project\r\n where\r\n task_log_date >= '" . $start_report->format(FMT_DATETIME_MYSQL) . "'\r\n and task_log_date <= '" . $end_report->format(FMT_DATETIME_MYSQL) . "'\r\n and task_log_task != 0\r\n and task_log_creator = " . $user_id . "\r\n and project_id = " . $id . "\r\n group by date(task_log_date)\r\n order by task_log_date\r\n "; $result = db_loadList($sql); foreach ($result as $row) { $date_insert = new CDate($row['task_log_date']); $projects_hours[$id][$date_insert->format('%Y-%m-%d')] = $row['sum']; $user_by_day[$date_insert->format('%Y-%m-%d')] += $projects_hours[$id][$date_insert->format('%Y-%m-%d')]; } unset($result); } $months = array('1' => $AppUI->_('January'), '2' => $AppUI->_('February'), '3' => $AppUI->_('March'), '4' => $AppUI->_('April'), '5' => $AppUI->_('Mai'), '6' => $AppUI->_('June'), '7' => $AppUI->_('July'), '8' => $AppUI->_('August'), '9' => $AppUI->_('September'), '10' => $AppUI->_('October'), '11' => $AppUI->_('November'), '12' => $AppUI->_('December')); $years = array('2000' => '2000', '2001' => '2001', '2002' => '2002', '2003' => '2003', '2004' => '2004', '2005' => '2005', '2006' => '2006', '2007' => '2007', '2008' => '2008', '2009' => '2009', '2010' => '2010', '2011' => '2011', '2012' => '2012', '2013' => '2013', '2014' => '2014', '2015' => '2015', '2016' => '2016', '2017' => '2017', '2018' => '2018', '2019' => '2019', '2020' => '2020'); ?> <form name="frmSelect" action="" method="get"> <input type="hidden" name="m" value="timecard"> <input type="hidden" name="report_type" value="monthly_by_user"> <input type="hidden" name="tab" value="<?php
?> </th> <th width="100"><?php echo $AppUI->_('Cost Code'); ?> </th> <th width="100%"><?php echo $AppUI->_('Comments'); ?> </th> <th></th> </tr> <?php // Pull the task comments $sql = 'SELECT tl.*, u.user_username, bc.billingcode_name as task_log_costcode' . ' FROM task_log AS tl' . ' LEFT JOIN billingcode AS bc ON bc.billingcode_id = tl.task_log_costcode' . ' LEFT JOIN users AS u ON u.user_id = tl.task_log_creator' . ' WHERE task_log_task = ' . $task_id . ($problem ? ' AND task_log_problem > 0' : '') . ' ORDER BY tl.task_log_date'; $logs = $canView ? db_loadList($sql) : array(); $s = ''; $hrs = 0; foreach ($logs as $row) { $task_log_date = intval($row['task_log_date']) ? new CDate($row['task_log_date']) : null; $style = $row['task_log_problem'] ? 'background-color:#cc6666;color:#ffffff' : ''; $s .= '<tr bgcolor="white" valign="top">'; $s .= "\n\t<td>"; if ($canEdit) { $s .= "\n\t\t" . '<a href="?m=tasks&a=view&task_id=' . $task_id . '&tab=' . ($tab == -1 ? $AppUI->getState('TaskLogVwTab') : '1') . '&task_log_id=' . @$row['task_log_id'] . '#log">' . "\n\t\t\t" . dPshowImage('./images/icons/stock_edit-16.png', 16, 16, '') . "\n\t\t</a>"; } $s .= "\n\t</td>"; $s .= '<td nowrap="nowrap">' . ($task_log_date ? $task_log_date->format($df) : '-') . '</td>'; /* $s .= ('<td align="center" valign="middle">' . (($row['task_log_problem'] ? dPshowImage('./images/icons/mark-as-important-16.png',
<?php /* SYSKEYS $Id$ */ if (!defined('DP_BASE_DIR')) { die('You should not access this file directly.'); } $AppUI->savePlace(); // pull all the key types $sql = "SELECT syskey_id,syskey_name FROM syskeys ORDER BY syskey_name"; $keys = arrayMerge(array(0 => '- Select Type -'), db_loadHashList($sql)); $sql = "SELECT * FROM syskeys, sysvals WHERE sysval_key_id = syskey_id ORDER BY sysval_title"; $values = db_loadList($sql); $sysval_id = isset($_GET['sysval_id']) ? $_GET['sysval_id'] : 0; $titleBlock = new CTitleBlock('System Lookup Values', 'myevo-weather.png', $m, "{$m}.{$u}.{$a}"); $titleBlock->addCrumb("?m=system", "System Admin"); $titleBlock->show(); ?> <script language="javascript"> <?php // security improvement: // some javascript functions may not appear on client side in case of user not having write permissions // else users would be able to arbitrarily run 'bad' functions if ($canEdit) { ?> function delIt(id, name) { if (confirm('Are you sure you want to delete \'' + name + '\'?')) { f = document.sysValFrm; f.del.value = 1; f.sysval_id.value = id; f.submit(); }
if (!empty($project_id)) { $sql .= ' WHERE project_id = ' . $project_id; } $all_tasks = db_loadList($sql); $sql = ' SELECT *, round(sum(task_log_hours),2) as work FROM projects LEFT JOIN tasks ON task_project = project_id LEFT JOIN user_tasks ON user_tasks.task_id = tasks.task_id LEFT JOIN users ON user_tasks.user_id = users.user_id LEFT JOIN task_log ON task_log_task = tasks.task_id AND task_log_creator = users.user_id'; if (!empty($project_id)) { $sql .= ' WHERE project_id = ' . $project_id; } $sql .= ' GROUP BY tasks.task_id, users.user_id'; $users_all = db_loadList($sql); foreach ($users_all as $user) { $users_per_task[$user['task_id']][] = $user['user_id']; $users[$user['user_id']]['all'][$user['task_id']] = $user; $users[$user['user_id']]['name'] = !empty($user['user_username']) ? $user['user_username'] : $user['user_id']; $users[$user['user_id']]['hours'] = 0; $users[$user['user_id']]['completed'] = array(); $users[$user['user_id']]['inprogress'] = array(); $users[$user['user_id']]['pending'] = array(); $users[$user['user_id']]['overdue'] = array(); } $tasks['hours'] = 0; $tasks['inprogress'] = array(); $tasks['completed'] = array(); $tasks['pending'] = array(); $tasks['overdue'] = array();
} $AppUI->savePlace(); $canEdit = getPermission($m, 'edit'); $canRead = getPermission($m, 'view'); if (!$canRead) { $AppUI->redirect('m=public&a=access_denied'); } $hidden_modules = array('public', 'install'); $q = new DBQuery(); $q->addQuery('*'); $q->addTable('modules'); foreach ($hidden_modules as $no_show) { $q->addWhere('mod_directory != \'' . $no_show . '\''); } $q->addOrder('mod_ui_order'); $modules = db_loadList($q->prepare()); // get the modules actually installed on the file system $modFiles = $AppUI->readDirs('modules'); $titleBlock = new CTitleBlock('Modules', 'power-management.png', $m, $m . "." . $a); $titleBlock->addCrumb('?m=system', 'System Admin'); $titleBlock->show(); ?> <table border="0" cellpadding="2" cellspacing="1" width="98%" class="tbl"> <tr> <th colspan="2"><?php echo $AppUI->_('Module'); ?> </th> <th><?php echo $AppUI->_('Status');
<table width="100%" border="0" cellpadding="1" cellspacing="0"> <tr> <td width="50%"> <?php if ($other_users) { $q->addTable('users', 'u'); $q->innerJoin('contacts', 'c', 'c.contact_id = u.user_contact'); $q->addQuery('u.user_id, u.user_username, c.contact_first_name, c.contact_last_name'); $q->addOrder('contact_last_name'); $usersql = $q->prepare(); $q->clear(); echo $AppUI->_('Show Todo for:'); ?> <select name="show_user_todo" onchange="javascript:document.form_buttons.submit();"> <?php if ($rows = db_loadList($usersql, NULL)) { foreach ($rows as $row) { $selected = $user_id == $row['user_id'] ? ' selected="selected"' : ''; echo '<option value="' . $row['user_id'] . '"' . $selected . '>' . $row['contact_last_name'] . ', ' . $row['contact_first_name'] . '</option>' . "\n"; } } } ?> </select> </td> </tr> </table> </form> <?php $min_view = true; include DP_BASE_DIR . '/modules/tasks/viewgantt.php';
$buf = ''; $buf = '<select name = "fmoldista" class="text">' . '<option value="no"></option>'; foreach ($ar_mold as $ar) { $buf .= '<option value = ' . $ar["company_id"] . ' '; if ($ar["company_id"] == $fmoldista) { $buf .= 'selected'; } $buf .= '>' . $ar["company_name"] . '</option>'; } $titleBlock->addCell($buf, "", ""); //////////////////////////////////////////////////////////////////////////////////////////////////////////// $titleBlock->show(); $titleBlock = new CTitleBlock(''); $titleBlock->addCell($AppUI->_('etiq_Cliente') . ':'); $sql = "select company_name, company_id from companies where company_type = 2"; $ar_mold = db_loadList($sql); $buf = ''; $buf = '<select name = "fcliente" class="text">' . '<option value="no"></option>'; foreach ($ar_mold as $ar) { $buf .= '<option value = ' . $ar["company_id"] . ' '; if ($ar["company_id"] == $fcliente) { $buf .= ' selected '; } $buf .= '>' . $ar["company_name"] . '</option>'; } $titleBlock->addCell($buf, "", "", ""); $buf = '<input type="text" name="alias_string" size=12 value="' . $alias_string . '" class="text"> '; $titleBlock->addCell($AppUI->_('etiq_Referencia') . ':'); $titleBlock->addCell($buf, '', '', ''); $titleBlock->show();
} ?> </td> </tr> </table> <table width="100%" border="0" cellpadding="2" cellspacing="0" class="list"> <tr><th> </th><th width="100%"><?php echo $AppUI->_('Name'); ?> </th><th><?php echo $AppUI->_('Users'); ?> </th></tr> <tr class="second"> <?php $rows = db_loadList($sql, NULL); if (!count($rows)) { echo '<td colspan="3">' . $AppUI->_('No data available') . '</td>'; } ?> </tr> <?php foreach ($rows as $row) { if ($row["dept_parent"] == 0) { showchilddept_comp($row); findchilddept_comp($rows, $row["dept_id"]); } } ?> </table>
/** * @param Date Start date of the period * @param Date End date of the period * @param integer The target company */ function getTasksForPeriod($start_date, $end_date, $company_id = 0, $user_id = null, $filter_proj_archived = false, $filter_proj_completed = false) { global $AppUI; $q = new DBQuery(); // convert to default db time stamp $db_start = $start_date->format(FMT_DATETIME_MYSQL); $db_end = $end_date->format(FMT_DATETIME_MYSQL); // Allow for possible passing of user_id 0 to stop user filtering if (!isset($user_id)) { $user_id = $AppUI->user_id; } // filter tasks for not allowed projects $tasks_filter = ''; // check permissions on projects $proj = new CProject(); $task_filter_where = $proj->getAllowedSQL($AppUI->user_id, 't.task_project'); // exclude read denied projects $deny = $proj->getDeniedRecords($AppUI->user_id); // check permissions on tasks $obj = new CTask(); $allow = $obj->getAllowedSQL($AppUI->user_id, 't.task_id'); $parent_task_allow = $obj->getAllowedSQL($AppUI->user_id, 't.task_parent'); $q->addTable('tasks', 't'); if ($user_id) { $q->innerJoin('user_tasks', 'ut', 't.task_id=ut.task_id'); } $q->innerJoin('projects', 'p', 't.task_project = p.project_id'); $q->addQuery('DISTINCT t.task_id, t.task_name, t.task_start_date, t.task_end_date' . ', t.task_duration, t.task_duration_type' . ', p.project_color_identifier AS color, p.project_name'); $q->addWhere('task_status > -1' . " AND ((task_start_date <= '{$db_end}'" . " AND (task_end_date >= '{$db_start}'" . " OR task_end_date = '0000-00-00 00:00:00' OR task_end_date = NULL)" . " OR task_start_date BETWEEN '{$db_start}' AND '{$db_end}'))"); if ($user_id) { $q->addWhere("ut.user_id = '{$user_id}'"); } if ($company_id) { $q->addWhere('p.project_company = ' . $company_id); } if (count($task_filter_where) > 0) { $q->addWhere('(' . implode(' AND ', $task_filter_where) . ')'); } if (count($deny) > 0) { $q->addWhere('(t.task_project NOT IN (' . implode(', ', $deny) . '))'); } if (count($allow) > 0) { $q->addWhere('(' . implode(' AND ', $allow) . ')'); } if (count($parent_task_allow) > 0) { $q->addWhere('(' . implode(' AND ', $parent_task_allow) . ')'); } if ($filter_proj_archived) { $q->addWhere('p.project_status <> 7'); } if ($filter_proj_archived) { $q->addWhere('p.project_status <> 5'); } $q->addOrder('t.task_start_date'); // assemble query $sql = $q->prepare(); $q->clear(); //echo "<pre>$sql</pre>"; // execute and return return db_loadList($sql); }
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}\" /> {$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}\" /> " . $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 />"; }
<?php /* SYSKEYS $Id$*/ if (!defined('DP_BASE_DIR')) { die('You should not access this file directly.'); } $sql = "SELECT * FROM syskeys ORDER BY syskey_name"; $keys = db_loadList($sql); $syskey_id = isset($_GET['syskey_id']) ? $_GET['syskey_id'] : 0; $titleBlock = new CTitleBlock('System Lookup Keys', 'myevo-weather.png', $m, "{$m}.{$a}"); $titleBlock->addCrumb("?m=system", "System Admin"); $titleBlock->show(); ?> <script language="javascript"> <?php // security improvement: // some javascript functions may not appear on client side in case of user not having write permissions // else users would be able to arbitrarily run 'bad' functions if ($canEdit) { ?> function delIt(id, name) { if (confirm('Are you sure you want to delete \'' + name + '\'?')) { f = document.sysKeyFrm; f.del.value = 1; f.syskey_id.value = id; f.submit(); } } <?php } ?>
if (!$log_all) { $sql .= "\n\tAND task_log_date >= '" . $start_date->format(FMT_DATETIME_MYSQL) . "'" . "\n\tAND task_log_date <= '" . $end_date->format(FMT_DATETIME_MYSQL) . "'"; } if ($log_ignore) { $sql .= "\n\tAND task_log_hours > 0"; } if ($log_userfilter) { $sql .= "\n\tAND task_log_creator = {$log_userfilter}"; } echo $sql; $proj =& new CProject(); $allowedProjects = $proj->getAllowedSQL($AppUI->user_id, 'task_project'); if (count($allowedProjects)) { $sql .= "\n AND " . implode(" AND ", $allowedProjects); } $sql .= " ORDER BY task_log_date"; //echo "<pre>$sql</pre>"; $logs = db_loadList($sql); echo db_error(); $hours = 0.0; $pdfdata = array(); foreach ($logs as $log) { $date = new CDate($log['task_log_date']); $hours += $log['task_log_hours']; $pdfdata[] = array($log['creator'], $log['task_log_name'], $log['task_log_description'], $date->format($df), sprintf("%.2f", $log['task_log_hours']), $log['task_log_costcode']); echo $date->format($df); printf("%.2f", $log['task_log_hours']); } $pdfdata[] = array('', '', '', $AppUI->_('Total Hours') . ':', sprintf("%.2f", $hours), ''); echo " Total de Horas"; printf("%.2f", $hours);
?> "> <input type="hidden" name="show_form" value="1" /> <table width="100%" border="0" cellpadding="1" cellspacing="0"> <tr> <td width="50%"> <?php if ($other_users) { echo $AppUI->_("Show Todo for:") . '<select name="show_user_todo" onchange="document.form_buttons.submit()">'; $q->addTable('users', 'u'); $q->innerJoin('contacts', 'c', 'c.contact_id = u.user_contact'); $q->addQuery('u.user_id, u.user_username, c.contact_first_name, c.contact_last_name'); $q->addOrder('c.contact_last_name'); $usersql = $q->prepare(true); if ($rows = db_loadList($usersql)) { foreach ($rows as $row) { echo '<option value="' . $row['user_id'] . '"' . ($user_id == $row["user_id"] ? ' selected="selected"' : '') . '>' . $row['contact_last_name'] . ', ' . $row["contact_first_name"]; } } } ?> </select> </td> <td align="right" width="50%"><?php echo $AppUI->_('Show'); ?> :</td> <td> <input type="checkbox" name="show_pinned" id="show_pinned" onclick="document.form_buttons.submit()"<?php echo $showPinned ? 'checked="checked"' : '';
$sql .= "hi.{$orderby}"; } // Ascending or Descending if ($orderdesc) { $sql .= " DESC"; } // Pagination $items_per_page = $HELPDESK_CONFIG['items_per_page']; // Figure out number of total results, but do not retrieve $total_results = db_num_rows(db_exec($sql)); // Figure out the offset $offset = $page * $items_per_page; // Limit the results to enable pagination $sql .= " LIMIT {$offset},{$items_per_page}"; // Get the actual, paginated results $rows = db_loadList($sql); // Setup the title block if (!$_REQUEST['project_id'] && !$_REQUEST['company_id']) { $titleBlock = new CTitleBlock('Help Desk', 'helpdesk.png', $m, 'ID_HELP_HELPDESK_IDX'); if (hditemCreate()) { $titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new item') . '" />', '', '<form action="?m=helpdesk&a=addedit" method="post">', '</form>'); } $titleBlock->addCrumb("?m=helpdesk", "home"); $titleBlock->addCrumb("?m=helpdesk&a=list", "list"); $titleBlock->addCrumb("?m=helpdesk&a=reports", "reports"); $titleBlock->show(); } ?> <script language="javascript"> function changeList() { document.filterFrm.submit();
$q->addWhere("ta.task_start_date != '' AND ta.task_start_date != '0000-00-00 00:00:00'"); } if (count($allowedTasks)) { $q->addWhere($allowedTasks); } if (count($allowedProjects)) { $q->addWhere($allowedProjects); } $q->addGroup('ta.task_id'); $q->addOrder('ta.task_end_date'); $q->addOrder('task_priority DESC'); $sql = $q->prepare(); //echo "<pre>$sql</pre>"; $q->clear(); global $tasks; $tasks = db_loadList($sql); /* we have to calculate the end_date via start_date+duration for ** end='0000-00-00 00:00:00' */ for ($j = 0, $xj = count($tasks); $j < $xj; $j++) { if ($tasks[$j]['task_end_date'] == '0000-00-00 00:00:00' || $tasks[$j]['task_end_date'] == '') { if ($tasks[$j]['task_start_date'] == '0000-00-00 00:00:00' || $tasks[$j]['task_start_date'] == '') { //just to be sure start date is "zeroed" $tasks[$j]['task_start_date'] = '0000-00-00 00:00:00'; $tasks[$j]['task_end_date'] = '0000-00-00 00:00:00'; } else { $tasks[$j]['task_end_date'] = calcEndByStartAndDuration($tasks[$j]); } } } global $priorities;