Exemple #1
0
		</tr>
		<tr>
			<td <?php 
echo $style;
?>
 align="center">
			<div id="idToolbarContainer">
			<div id="idToolbarSlider"<?php 
echo $top;
?>
>
				<table id="idToolbarTray" border="0" cellpadding="2" cellspacing="2" width="100%">
				<?php 
foreach ($nav as $module) {
    $dir = $module['mod_directory'];
    if (!getDenyRead($dir)) {
        $icon = $module['mod_ui_icon'];
        $name = $AppUI->_($module['mod_ui_name']);
        $sel = '';
        if ($m == $dir) {
            define('DP_CURRENT_MODULE_ICON', $icon);
            $name = '<b>' . $name . '</b>';
            $sel = ' id="idSelected"';
        }
        ?>
					<tr<?php 
        echo $sel;
        ?>
 onclick="go('index.php?m=<?php 
        echo $dir;
        ?>
}
// retrieve any state parameters
if (isset($_GET['tab'])) {
    $AppUI->setState('TaskLogVwTab', $_GET['tab']);
}
$tab = $AppUI->getState('TaskLogVwTab') !== NULL ? $AppUI->getState('TaskLogVwTab') : 0;
// get the prefered date format
$df = $AppUI->getPref('SHDATEFORMAT');
//Also view the time
$df .= " " . $AppUI->getPref('TIMEFORMAT');
$start_date = intval($obj->task_start_date) ? new CDate($obj->task_start_date) : null;
$end_date = intval($obj->task_end_date) ? new CDate($obj->task_end_date) : null;
$start_date_ir = intval($obj->task_start_date_ir) ? new CDate($obj->task_start_date_ir) : null;
$end_date_ir = intval($obj->task_end_date_ir) ? new CDate($obj->task_end_date_ir) : null;
//check permissions for the associated project
$canReadProject = !getDenyRead('projects', $obj->task_project);
// get the users on this task
$q->addTable('users', 'u');
$q->addTable('user_tasks', 't');
$q->leftJoin('contacts', 'c', 'user_contact = contact_id');
$q->addQuery('u.user_id, u.user_username, contact_email');
$q->addWhere('t.task_id = ' . $task_id);
$q->addWhere('t.user_id = u.user_id');
$q->addOrder('u.user_username');
$sql = $q->prepare();
$q->clear();
$users = db_loadList($sql);
$durnTypes = dPgetSysVal('TaskDurationType');
// setup the title block
$titleBlock = new CTitleBlock('View Task', 'applet-48.png', $m, "{$m}.{$a}");
$titleBlock->addCell();
Exemple #3
0
//grab hours per day from config
$min_hours_day = $AppUI->cfg['daily_working_hours'];
$can_edit_other_timesheets = $TIMECARD_CONFIG['minimum_edit_level'] >= $AppUI->user_type;
$show_other_worksheets = $TIMECARD_CONFIG['minimum_see_level'] >= $AppUI->user_type;
$show_possible_hours_worked = $TIMECARD_CONFIG['show_possible_hours_worked'];
//print "<pre>";
//print_r($AppUI);
//print "</pre>";
//compute hours/week from config
$min_hours_week = count(explode(",", dPgetConfig("cal_working_days"))) * $min_hours_day;
// get date format
$df = $AppUI->getPref('SHDATEFORMAT');
if (isset($_GET['user_id'])) {
    $sql = "SELECT user_company FROM users WHERE user_id = " . $_GET['user_id'];
    $company_id = db_loadResult($sql);
    if (getDenyRead("companies", $company_id)) {
        $AppUI->setMsg('Access denied', UI_MSG_ERROR);
        $AppUI->redirect();
    }
    $AppUI->setState('TimecardSelectedUser', $_GET['user_id']);
}
$user_id = $AppUI->getState('TimecardSelectedUser') ? $AppUI->getState('TimecardSelectedUser') : $AppUI->user_id;
$AppUI->savePlace();
if (isset($_GET['start_date'])) {
    $AppUI->setState('TimecardStartDate', $_GET['start_date']);
}
$start_day = new CDate($AppUI->getState('TimecardStartDate') ? $AppUI->getState('TimecardStartDate') : NULL);
//set the time to noon to combat a php date() function bug that was adding an hour.
$date = $start_day->format('%Y-%m-%d') . ' 12:00:00';
$start_day->setDate($date, DATE_FORMAT_ISO);
$today_weekday = $start_day->getDayOfWeek();
Exemple #4
0
<?php

/* HELPDESK $Id: index.php,v 1.30 2005/11/10 22:03:20 pedroix Exp $ */
// check permissions for this module
$canReadModule = !getDenyRead($m);
if (!$canReadModule) {
    $AppUI->redirect("m=public&a=access_denied");
}
$AppUI->savePlace();
if (isset($_GET['tab'])) {
    $AppUI->setState('HelpDeskIdxTab', $_GET['tab']);
}
$tab = $AppUI->getState('HelpDeskIdxTab') !== NULL ? $AppUI->getState('HelpDeskIdxTab') : 0;
// Setup the title block
$titleBlock = new CTitleBlock('Help Desk', 'helpdesk.png', $m, 'ID_HELP_HELPDESK_IDX');
if ($canEdit) {
    $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();
$item_perms = getItemPerms();
$sql = "SELECT COUNT(item_id)\n        FROM helpdesk_items\n        WHERE {$item_perms}";
$numtotal = db_loadResult($sql);
/*
 * Unassigned = 0
 * Open = 1
 * Closed = 2
 * On hold = 3
 * Delete = 4
<?php

// check access to files module
if (!defined('DP_BASE_DIR')) {
    die('You should not access this file directly');
}
global $AppUI, $m, $obj, $task_id;
if (!getDenyRead('links')) {
    if (!getDenyEdit('links')) {
        echo '<a href="./index.php?m=links&a=addedit&project_id=' . $obj->task_project . '&link_task=' . $task_id . '">' . $AppUI->_('Attach a link') . '</a>';
    }
    echo dPshowImage(dPfindImage('stock_attach-16.png', $m), 16, 16, '');
    $showProject = false;
    $project_id = $obj->task_project;
    include DP_BASE_DIR . '/modules/links/index_table.php';
}
Exemple #6
0
$obj = new CCompany();
$companies = $obj->getAllowedRecords($AppUI->user_id, 'company_id,company_name', 'company_name');
$filters2 = arrayMerge(array('all' => $AppUI->_('All Companies', UI_OUTPUT_RAW)), $companies);
// setup the title block
$titleBlock = new CTitleBlock('Tasks', 'applet-48.png', $m, "{$m}.{$a}");
// patch 2.12.04 text to search entry box
if (isset($_POST['searchtext'])) {
    $AppUI->setState('searchtext', $_POST['searchtext']);
}
$search_text = $AppUI->getState('searchtext') ? $AppUI->getState('searchtext') : '';
$search_text = dPformSafe($search_text, true);
$titleBlock->addCell('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $AppUI->_('Search') . ':');
$titleBlock->addCell('<input type="text" class="text" SIZE="20" name="searchtext" onChange="document.searchfilter.submit();" value=' . "'{$search_text}'" . 'title="' . $AppUI->_('Search in name and description fields') . '"/>
       	<!--<input type="submit" class="button" value=">" title="' . $AppUI->_('Search in name and description fields') . '"/>-->', '', '<form action="?m=tasks" method="post" id="searchfilter">', '</form>');
// Let's see if this user has admin privileges
if (!getDenyRead("admin")) {
    $titleBlock->addCell();
    $titleBlock->addCell($AppUI->_("User") . ":");
    $user_list = $perms->getPermittedUsers('tasks');
    $titleBlock->addCell(arraySelect($user_list, "user_id", "size='1' class='text' onChange='document.userIdForm.submit();'", $user_id, false), "", "<form action='?m=tasks' method='post' name='userIdForm'>", "</form>");
}
$titleBlock->addCell();
$titleBlock->addCell($AppUI->_('Company') . ':');
$titleBlock->addCell(arraySelect($filters2, 'f2', 'size=1 class=text onChange="document.companyFilter.submit();"', $f2, false), '', '<form action="?m=tasks" method="post" name="companyFilter">', '</form>');
$titleBlock->addCell();
if ($canEdit && $project_id) {
    $titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new task') . '">', '', '<form action="?m=tasks&a=addedit&task_project=' . $project_id . '" method="post">', '</form>');
}
$titleBlock->show();
if (dPgetParam($_GET, 'inactive', '') == 'toggle') {
    $AppUI->setState('inactive', $AppUI->getState('inactive') == -1 ? 0 : -1);
Exemple #7
0
 public function canAccess($user_id)
 {
     $q = new DBQuery();
     // Let's see if this user has admin privileges
     if (!getDenyRead('admin')) {
         return true;
     }
     switch ($this->task_access) {
         case self::ACCESS_PUBLIC:
             $retval = true;
             break;
         case self::ACCESS_PROTECTED:
             $q->addTable('users');
             $q->addQuery('user_company');
             $q->addWhere('user_id=' . (int) $user_id . ' OR user_id=' . (int) $this->task_owner);
             $user_owner_companies = $q->loadColumn();
             $q->clear();
             $company_match = true;
             foreach ($user_owner_companies as $current_company) {
                 $company_match = $company_match && (!isset($last_company) || $last_company == $current_company);
                 $last_company = $current_company;
             }
         case self::ACCESS_PARTICIPANT:
             $company_match = isset($company_match) ? $company_match : true;
             $q->addTable('user_tasks');
             $q->addQuery('COUNT(task_id)');
             $q->addWhere('user_id=' . (int) $user_id . ' AND task_id=' . (int) $this->task_id);
             $count = $q->loadResult();
             $q->clear();
             $retval = $company_match && $count > 0 || $this->task_owner == $user_id;
             break;
         case self::ACCESS_PRIVATE:
             $retval = $this->task_owner == $user_id;
             break;
         default:
             $retval = false;
             break;
     }
     return $retval;
 }
Exemple #8
0
<?php

/* $Id: viewer.php,v 1.25.6.4 2007/03/28 15:00:52 cyberhorse Exp $ */
if (!defined('DP_BASE_DIR')) {
    die('You should not access this file directly.');
}
//view posts
$forum_id = isset($_GET["forum_id"]) ? (int) $_GET["forum_id"] : 0;
$message_id = isset($_GET["message_id"]) ? (int) $_GET["message_id"] : 0;
$post_message = isset($_GET["post_message"]) ? $_GET["post_message"] : 0;
$f = dpGetParam($_POST, 'f', 0);
// check permissions
$canRead = !getDenyRead($m, $forum_id);
$canEdit = !getDenyEdit($m, $forum_id);
if (!$canRead || $post_message & !$canEdit) {
    $AppUI->redirect("m=public&a=access_denied");
}
$df = $AppUI->getPref('SHDATEFORMAT');
$tf = $AppUI->getPref('TIMEFORMAT');
$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,
	forum_create_date, forum_last_date, forum_message_count, forum_moderated,
	user_username, contact_first_name, contact_last_name,
	project_name, project_color_identifier');
$q->addJoin('contacts', 'con', 'contact_id = user_contact');
$q->addWhere("user_id = forum_owner");
$q->addWhere("forum_id = {$forum_id}");
$q->addWhere("forum_project = project_id");
Exemple #9
0
    die('You should not access this file directly.');
}
// load the companies class
require_once $AppUI->getModuleClass('companies');
if (isset($_POST['company_id'])) {
    $AppUI->setState('DeptIdxCompany', intval($_POST['company_id']));
}
$company = $company_id = $AppUI->getState('DeptIdxCompany') !== NULL ? $AppUI->getState('DeptIdxCompany') : $AppUI->user_company;
$company_prefix = 'company_';
if (isset($_POST['department'])) {
    $AppUI->setState('DeptIdxDepartment', $_POST['department']);
    //if department is set, ignore the company_id field
    unset($company_id);
}
$department = $AppUI->getState('DeptIdxDepartment') !== NULL ? $AppUI->getState('DeptIdxDepartment') : ($AppUI->user_department > 0 ? $AppUI->user_department : $company_prefix . $AppUI->user_company);
$canRead = !getDenyRead($m, $department);
if (!$canRead) {
    $AppUI->redirect('m=public&a=access_denied');
}
$AppUI->savePlace();
//if $department contains the $company_prefix string that it's requesting a company and not a department.  So, clear the
// $department variable, and populate the $company_id variable.
if (!(strpos($department, $company_prefix) === false)) {
    $company_id = substr($department, strlen($company_prefix));
    $AppUI->setState('DeptIdxCompany', $company_id);
    unset($department);
}
$obj = new CCompany();
$q = new DBQuery();
$q->addTable('companies');
$q->addQuery('company_id, company_name');
function get_actual_end_date_pd($task_id, $task)
{
    global $AppUI;
    $q = new DBQuery();
    $mods = $AppUI->getActiveModules();
    if (!empty($mods['history']) && !getDenyRead('history')) {
        $q->addQuery('MAX(history_date) as actual_end_date');
        $q->addTable('history');
        $q->addWhere('history_table=\'tasks\' AND history_item=' . $task_id);
    } else {
        $q->addQuery('MAX(task_log_date) AS actual_end_date');
        $q->addTable('task_log');
        $q->addWhere('task_log_task = ' . $task_id);
    }
    $task_log_end_date = $q->loadResult();
    $edate = $task_log_end_date;
    $edate = $edate > $task->task_end_date || $task->task_percent_complete == 100 ? $edate : $task->task_end_date;
    return $edate;
}
Exemple #11
0
<tr>
	<td valign="top">
<?php 
if (!$dialog) {
    // left side navigation menu
    ?>
		<table cellspacing=0 cellpadding=2 border=0 height="600">
		<tr>
			<td><img src="images/shim.gif" width="70" height="3"></td>
			<td rowspan="100"><img src="images/shim.gif" width="10" height="100"></td>
		</tr>
	<?php 
    $nav = $AppUI->getMenuModules();
    $s = '';
    foreach ($nav as $module) {
        if (!getDenyRead($module['mod_directory'])) {
            $s .= '<tr><td align="center" valign="middle" class="nav">' . '<table cellspacing=0 cellpadding=0 border=0><tr><td class="clsBtnOff">' . '<a href="?m=' . $module['mod_directory'] . '">' . '<img src="' . dPfindImage($module['mod_ui_icon'], $module['mod_directory']) . '" alt="" border="0" width="30" height="30"></a></td></tr></table>' . $AppUI->_($module['mod_ui_name']) . "</td></tr>\n";
        }
    }
    echo $s;
    ?>
		<tr height="100%">
			<td>&nbsp;<img src="images/shim.gif" width="7" height="10"></td>
		</tr>
		</table>	
<?php 
}
// END DIALOG
?>
	</td>
<td valign="top" align="left" width="100%">
Exemple #12
0
<?php

if (!defined('DP_BASE_DIR')) {
    die('You should not access this file directly.');
}
// Add / Edit contact
$risk_id = dPgetParam($_GET, 'risk_id', 0);
// check permissions
$denyView = getDenyRead($m, $risk_id);
if ($denyView) {
    $AppUI->redirect("m=help&a=access_denied");
}
$riskProbability = dPgetSysVal('RiskProbability');
$riskStatus = dPgetSysVal('RiskStatus');
$riskImpact = dPgetSysVal('RiskImpact');
$riskDuration = array(1 => 'Hours', 24 => 'Days', 168 => 'Weeks');
$q = new DBQuery();
$q->addQuery('user_id');
$q->addQuery('CONCAT( contact_first_name, \' \', contact_last_name)');
$q->addTable('users');
$q->leftJoin('contacts', 'c', 'user_contact = contact_id');
$q->addOrder('contact_first_name, contact_last_name');
$users = $q->loadHashList();
//$users = db_loadHashList( $sql );
$q->clear();
$q->addQuery('project_id, project_name');
$q->addTable('projects');
$projects = $q->loadHashList();
$projects[0] = '';
//Pull contact information
$q->clear();
 function canAccess($user_id)
 {
     //echo intval($this->task_access);
     // Let's see if this user has admin privileges
     if (!getDenyRead("admin")) {
         return true;
     }
     switch ($this->task_access) {
         case 0:
             // public
             return true;
             break;
         case 1:
             // protected
             $sql = "SELECT user_company FROM users WHERE user_id={$user_id}";
             $user_company = db_loadResult($sql);
             $sql = "SELECT user_company FROM users WHERE user_id={$this->task_owner}";
             $owner_company = db_loadResult($sql);
             //echo "$user_company,$owner_company";die;
             $sql = "SELECT COUNT(*) FROM user_tasks WHERE user_id={$user_id} AND task_id={$this->task_id}";
             $count = db_loadResult($sql);
             return $owner_company == $user_company && $count > 0 || $this->task_owner == $user_id;
             break;
         case 2:
             // participant
             $sql = "SELECT COUNT(*) FROM user_tasks WHERE user_id={$user_id} AND task_id={$this->task_id}";
             $count = db_loadResult($sql);
             return $count > 0 || $this->task_owner == $user_id;
             break;
         case 3:
             // private
             return $this->task_owner == $user_id;
             break;
     }
 }
Exemple #14
0
 function canAccess($user_id)
 {
     $q =& new DBQuery();
     // Let's see if this user has admin privileges
     if (!getDenyRead('admin')) {
         return true;
     }
     switch ($this->task_access) {
         case 0:
             // public
             $retval = true;
             break;
         case 1:
             // protected
             $q->addTable('users');
             $q->addQuery('user_company');
             $q->addWhere('user_id=' . $user_id . ' OR user_id=' . $this->task_owner);
             $sql = $q->prepare();
             $q->clear();
             $user_owner_companies = db_loadColumn($sql);
             $company_match = true;
             foreach ($user_owner_companies as $current_company) {
                 $company_match = $company_match && (!isset($last_company) || $last_company == $current_company);
                 $last_company = $current_company;
             }
         case 2:
             // participant
             $company_match = isset($company_match) ? $company_match : true;
             $q->addTable('user_tasks');
             $q->addQuery('COUNT(*)');
             $q->addWhere('user_id=' . $user_id . ' AND task_id=' . $this->task_id);
             $sql = $q->prepare();
             $q->clear();
             $count = db_loadResult($sql);
             $retval = $company_match && $count > 0 || $this->task_owner == $user_id;
             break;
         case 3:
             // private
             $retval = $this->task_owner == $user_id;
             break;
         default:
             $retval = false;
             break;
     }
     return $retval;
 }
 /**
 * The constructor
 *
 * Assigns the title, icon, module and help reference.  If the user does not
 * have permission to view the help module, then the context help icon is
 * not displayed.
 */
 function CTitleBlock_core($title, $icon = '', $module = '', $helpref = '')
 {
     $this->title = $title;
     $this->icon = $icon;
     $this->module = $module;
     $this->helpref = $helpref;
     $this->cells1 = array();
     $this->cells2 = array();
     $this->crumbs = array();
     $this->showhelp = !getDenyRead('help');
 }
Exemple #16
0
<?php

/* HELPDESK $Id: index.php,v 1.8 2007/08/22 07:17:43 arcoz67 Exp $ */
// Register position of New Task Log tab so we can call it correctly from the vw_timecard report
// If you change the tab order you'll need to modify this global in two places below
// (There is probably a better way to do this...)
global $newTLogTabNum;
$newTLogTabNum = 3;
// check permissions
$denyRead = getDenyRead($m);
$denyEdit = getDenyEdit($m);
if ($denyRead) {
    $AppUI->redirect("m=help&a=access_denied");
}
$TIMECARD_CONFIG = array();
require_once "./modules/timecard/config.php";
// setup the title block
$titleBlock = new CTitleBlock('Time Card', 'TimeCard.png', $m, "{$m}.{$a}");
$titleBlock->show();
if (isset($_GET['tab'])) {
    $AppUI->setState('TimecardVwTab', $_GET['tab']);
}
$tab = $AppUI->getState('TimecardVwTab') ? $AppUI->getState('TimecardVwTab') : 0;
$tabBox = new CTabBox("?m=timecard", "./modules/timecard/", $tab);
$tabBox->add('vw_timecard', 'Weekly Time Card');
$tabBox->add('vw_calendar_by_user', 'Task Logs by Date');
if ($TIMECARD_CONFIG['minimum_report_level'] >= $AppUI->user_type) {
    $tabBox->add('vw_weekly_by_user', 'Summary by User');
    $tabBox->add('vw_weekly_by_project', 'Summary by Project');
    $newTLogTabNum = 5;
}
Exemple #17
0
<?php

/* DEPARTMENTS $Id: view.php,v 1.21.6.7 2007/09/12 23:22:58 merlinyoda Exp $ */
if (!defined('DP_BASE_DIR')) {
    die('You should not access this file directly.');
}
global $department, $min_view;
$dept_id = isset($_GET['dept_id']) ? $_GET['dept_id'] : (isset($department) ? $department : 0);
// check permissions
$canRead = !getDenyRead($m, $dept_id);
$canEdit = !getDenyEdit($m, $dept_id);
if (!$canRead) {
    $AppUI->redirect('m=public&a=access_denied');
}
$AppUI->savePlace();
if (isset($dept_id) && $dept_id > 0) {
    $AppUI->setState('DeptIdxDepartment', $dept_id);
}
$dept_id = $AppUI->getState('DeptIdxDepartment') !== NULL ? $AppUI->getState('DeptIdxDepartment') : ($AppUI->user_department > 0 ? $AppUI->user_department : $company_prefix . $AppUI->user_company);
if (isset($_GET['tab'])) {
    $AppUI->setState('DeptVwTab', $_GET['tab']);
}
$tab = $AppUI->getState('DeptVwTab') !== NULL ? $AppUI->getState('DeptVwTab') : 0;
if ($dept_id > 0) {
    // pull data
    $q = new DBQuery();
    $q->addTable('companies', 'com');
    $q->addTable('departments', 'dep');
    $q->addQuery('dep.*, company_name');
    $q->addQuery('con.contact_first_name');
    $q->addQuery('con.contact_last_name');
Exemple #18
0
<?php

// get GETPARAMETER for contact_id
$contact_id = 1;
$canRead = !getDenyRead('contacts');
if (!$canRead) {
    $AppUI->redirect("m=public&a=access_denied");
}
if (1 == 1) {
    // Fields 1 - 5
    $text = sprintf("%s", "\"Title\",\"First Name\",\"Middle Name\",\"Last Name\",\"Suffix\",");
    // Fields 6 - 10
    $text .= sprintf("%s", "\"Company\",\"Department\",\"Job Title\",\"Business Street\",\"Business Street 2\",");
    // Fields 11 - 15
    $text .= sprintf("%s", "\"Business Street 3\",\"Business City\",\"Business State\",\"Business Postal Code\",\"Business Country\",");
    // Fields 16 - 20
    $text .= sprintf("%s", "\"Home Street\",\"Home Street 2\",\"Home Street 3\",\"Home City\",\"Home State\",");
    // Fields 21 - 25
    $text .= sprintf("%s", "\"Home Postal Code\",\"Home Country\",\"Other Street\",\"Other Street 2\",\"Other Street 3\",");
    // Fields 26 - 30
    $text .= sprintf("%s", "\"Other City\",\"Other State\",\"Other Postal Code\",\"Other Country\",\"Assistant's Phone\",");
    // Fields 31 - 35
    $text .= sprintf("%s", "\"Business Fax\",\"Business Phone\",\"Business Phone 2\",\"Callback\",\"Car Phone\",");
    // Fields 36 - 40
    $text .= sprintf("%s", "\"Company Main Phone\",\"Home Fax\",\"Home Phone\",\"Home Phone 2\",\"ISDN\",");
    // Fields 41 - 45
    $text .= sprintf("%s", "\"Mobile Phone\",\"Other Fax\",\"Other Phone\",\"Pager\",\"Primary Phone\",");
    // Fields 46 - 50
    $text .= sprintf("%s", "\"Radio Phone\",\"TTY/TDD Phone\",\"Telex\",\"Account\",\"Anniversary\",");
    // Fields 51 - 55
    $text .= sprintf("%s", "\"Assistant's Name\",\"Billing Information\",\"Birthday\",\"Categories\",\"Children\",");
<?php

// check access to files module
global $AppUI, $m, $company_id, $dPconfig;
if (!getDenyRead('files')) {
    if (!getDenyEdit('files')) {
        echo '<a href="./index.php?m=files&a=addedit">' . $AppUI->_('Attach a file') . '</a>';
    }
    echo dPshowImage(dPfindImage('stock_attach-16.png', $m), 16, 16, '');
    $showProject = true;
    include $dPconfig['root_dir'] . '/modules/files/index_table.php';
}
<?php

/* HELPDESK $Id: helpdesk.class.php,v 1.58 2005/04/25 19:04:55 zibas Exp $ */
require_once $AppUI->getSystemClass('dp');
require_once $AppUI->getSystemClass('libmail');
require_once "helpdesk.functions.php";
require_once "./modules/helpdesk/config.php";
global $m;
// Make sure we can read the module
if (getDenyRead($m)) {
    $AppUI->redirect("m=public&a=access_denied");
}
// Define log types
define("STATUS_LOG", 1);
define("TASK_LOG", 2);
// Pull in some standard arrays
$ict = dPgetSysVal('HelpDeskCallType');
$ics = dPgetSysVal('HelpDeskSource');
$ios = dPgetSysVal('HelpDeskOS');
$iap = dPgetSysVal('HelpDeskApplic');
$ipr = dPgetSysVal('HelpDeskPriority');
$isv = dPgetSysVal('HelpDeskSeverity');
$ist = dPgetSysVal('HelpDeskStatus');
$isa = dPgetSysVal('HelpDeskAuditTrail');
$field_event_map = array(1 => "item_title", 2 => "item_requestor", 3 => "item_requestor_email", 4 => "item_requestor_phone", 5 => "item_assigned_to", 6 => "item_notify", 7 => "item_company_id", 8 => "item_project_id", 9 => "item_calltype", 10 => "item_source", 11 => "item_status", 12 => "item_priority", 13 => "item_severity", 14 => "item_os", 15 => "item_application", 16 => "item_summary");
// Help Desk class
class CHelpDeskItem extends CDpObject
{
    var $item_id = NULL;
    var $item_title = NULL;
    var $item_summary = NULL;
Exemple #21
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 />";
}
Exemple #22
0
<?php

$AppUI->savePlace();
$canEdit = !getDenyEdit($m);
$canRead = !getDenyRead($m);
if (!$canRead) {
    $AppUI->setMsg('Access denied', UI_MSG_ERROR);
    $AppUI->redirect();
}
$sql_table = 'contacts';
//Modify this mapping to match your LDAP->contact structure
//For instance, of you want the contact_phone2 field to be populated out of, say telephonenumber2 then you would just modify
//	'physicaldeliveryofficename' => 'contact_phone2',
// ro
//	'telephonenumber2' => 'contact_phone2',
$sql_ldap_mapping = array('givenname' => 'contact_first_name', 'sn' => 'contact_last_name', 'title' => 'contact_title', 'companyname' => 'contact_company', 'department' => 'contact_department', 'employeeid' => 'contact_type', 'mail' => 'contact_email', 'telephonenumber' => 'contact_phone', 'physicaldeliveryofficename' => 'contact_phone2', 'postaladdress' => 'contact_address1', 'l' => 'contact_city', 'st' => 'contact_state', 'postalcode' => 'contact_zip', 'c' => 'contact_country');
$titleBlock = new CTitleBlock('Import Contacts from LDAP Directory');
$titleBlock->addButton('Main page', '?m=system');
$titleBlock->show();
if (isset($_POST['server'])) {
    $AppUI->setState('LDAPServer', $_POST['server']);
}
$server = $AppUI->getState('LDAPServer', '');
if (isset($_POST['bind_name'])) {
    $AppUI->setState('LDAPBindName', $_POST['bind_name']);
}
$bind_name = $AppUI->getState('LDAPBindName', '');
$bind_password = dPgetParam($_POST, 'bind_password', '');
if (isset($_POST['port'])) {
    $AppUI->setState('LDAPPort', $_POST['port']);
}
Exemple #23
0
$q->addQuery('task_priority, task_percent_complete');
$q->addQuery('task_duration, task_duration_type');
$q->addQuery('task_project');
$q->addQuery('task_access, task_type');
$q->addQuery('task_description, task_owner, task_status');
$q->addQuery('usernames.user_username, usernames.user_id');
$q->addQuery('assignees.user_username as assignee_username');
$q->addQuery('count(distinct assignees.user_id) as assignee_count');
$q->addQuery('co.contact_first_name, co.contact_last_name');
$q->addQuery('task_milestone');
$q->addQuery('count(distinct f.file_task) as file_count');
$q->addQuery('tlog.task_log_problem');
$q->addQuery('evtq.queue_id');
$q->addTable('tasks');
$mods = $AppUI->getActiveModules();
if (!empty($mods['history']) && !getDenyRead('history')) {
    $q->addQuery('MAX(history_date) as last_update');
    $q->leftJoin('history', 'h', 'history_item = tasks.task_id AND history_table=\'tasks\'');
}
$q->leftJoin('projects', 'projects', 'projects.project_id = task_project');
$q->leftJoin('users', 'usernames', 'task_owner = usernames.user_id');
$q->leftJoin('user_tasks', 'ut', 'ut.task_id = tasks.task_id');
$q->leftJoin('users', 'assignees', 'assignees.user_id = ut.user_id');
$q->leftJoin('contacts', 'co', 'co.contact_id = usernames.user_contact');
$q->leftJoin('task_log', 'tlog', 'tlog.task_log_task = tasks.task_id AND tlog.task_log_problem > 0');
$q->leftJoin('files', 'f', 'tasks.task_id = f.file_task');
$q->leftJoin('user_task_pin', 'pin', 'tasks.task_id = pin.task_id AND pin.user_id = ' . (int) $AppUI->user_id);
$q->leftJoin('event_queue', 'evtq', 'tasks.task_id = evtq.queue_origin_id AND evtq.queue_module = "tasks"');
$q->leftJoin('project_departments', 'project_departments', 'projects.project_id = project_departments.project_id OR project_departments.project_id IS NULL');
$q->leftJoin('departments', 'departments', 'departments.dept_id = project_departments.department_id OR dept_id IS NULL');
$q->addWhere('task_project = ' . (int) $project_id);
Exemple #24
0
// get CCompany() to filter tasks by company
$obj = new CCompany();
$companies = $obj->getAllowedRecords($AppUI->user_id, 'company_id,company_name', 'company_name');
$filters2 = arrayMerge(array('all' => $AppUI->_('All Companies', UI_OUTPUT_RAW)), $companies);
// setup the title block
$titleBlock = new CTitleBlock('Tasks', 'applet-48.png', $m, $m . '.' . $a);
// patch 2.12.04 text to search entry box
if (isset($_POST['searchtext'])) {
    $AppUI->setState('searchtext', $_POST['searchtext']);
}
$search_text = $AppUI->getState('searchtext') ? $AppUI->getState('searchtext') : '';
$search_text = w2PformSafe($search_text, true);
$titleBlock->addCell('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $AppUI->_('Search') . ':');
$titleBlock->addCell('<input type="text" class="text" size="20" name="searchtext" onChange="document.searchfilter.submit();" value="' . $search_text . '" title="' . $AppUI->_('Search in name and description fields') . '"/>', '', '<form action="?m=tasks" method="post" id="searchfilter" accept-charset="utf-8">', '</form>');
// Let's see if this user has admin privileges
if (!getDenyRead('admin')) {
    $titleBlock->addCell();
    $titleBlock->addCell($AppUI->_('User') . ':');
    $user_list = $perms->getPermittedUsers('tasks');
    $titleBlock->addCell(arraySelect($user_list, 'user_id', 'size="1" class="text" onChange="document.userIdForm.submit();"', $user_id, false), '', '<form action="?m=tasks" method="post" name="userIdForm" accept-charset="utf-8">', '</form>');
}
$titleBlock->addCell();
$titleBlock->addCell($AppUI->_('Company') . ':');
$titleBlock->addCell(arraySelect($filters2, 'f2', 'size=1 class=text onChange="document.companyFilter.submit();"', $f2, false), '', '<form action="?m=tasks" method="post" name="companyFilter" accept-charset="utf-8">', '</form>');
$titleBlock->addCell();
if ($canEdit && $project_id) {
    $titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new task') . '">', '', '<form action="?m=tasks&a=addedit&task_project=' . $project_id . '" method="post" accept-charset="utf-8">', '</form>');
}
$titleBlock->show();
if (w2PgetParam($_GET, 'inactive', '') == 'toggle') {
    $AppUI->setState('inactive', $AppUI->getState('inactive') == -1 ? 0 : -1);