function _fetchCustomRecordTypes()
 {
     switch ($this->custom_record_type) {
         case "TaskCustomFields":
             $field_types = "TaskType";
             break;
         case "CompanyCustomFields":
             $field_types = "CompanyType";
             break;
     }
     $this->custom_record_types = dPgetSysVal($field_types);
 }
Ejemplo n.º 2
0
// 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;
    var $item_calltype = NULL;
    var $item_source = NULL;
    var $item_os = NULL;
    var $item_application = NULL;
    var $item_priority = NULL;
    var $item_severity = NULL;
    var $item_status = NULL;
    var $item_project_id = NULL;
Ejemplo n.º 3
0
ini_set('memory_limit', $dPconfig['reset_memory_limit']);
include $AppUI->getLibraryClass('jpgraph/src/jpgraph');
include $AppUI->getLibraryClass('jpgraph/src/jpgraph_gantt');
// get the prefered date format
$df = $AppUI->getPref('SHDATEFORMAT');
$user_id = intval(dPgetParam($_REQUEST, 'user_id', $AppUI->user_id));
$proFilter = dPgetParam($_REQUEST, 'proFilter', '-1');
$company_id = intval(dPgetParam($_REQUEST, 'company_id', 0));
$department = intval(dPgetParam($_REQUEST, 'department', 0));
$showLabels = dPgetParam($_REQUEST, 'showLabels', 0);
$showInactive = dPgetParam($_REQUEST, 'showInactive', 0);
$sortTasksByName = dPgetParam($_REQUEST, 'sortTasksByName', 0);
$addPwOiD = dPgetParam($_REQUEST, 'addPwOiD', 0);
$m_orig = dPgetParam($_REQUEST, 'm_orig', $m);
$a_orig = dPgetParam($_REQUEST, 'a_orig', $a);
$projectStatus = dPgetSysVal('ProjectStatus');
$projectStatus = arrayMerge(array('-2' => $AppUI->_('All w/o in progress'), '-3' => $AppUI->_($AppUI->user_id == $user_id ? 'My projects' : "User's projects")), $projectStatus);
$pjobj =& new CProject();
$working_hours = $dPconfig['daily_working_hours'];
$q = new DBQuery();
/* 
 * Load department info for the case where one
 * wants to see the ProjectsWithOwnerInDeparment (PwOiD)
 * instead of the projects related to the given department.
 */
$owner_ids = array();
if ($addPwOiD && $department > 0) {
    $q->addTable('users');
    $q->addQuery('user_id');
    $q->addJoin('contacts', 'c', 'c.contact_id = user_contact');
    $q->addWhere('c.contact_department = ' . $department);
Ejemplo n.º 4
0
$titleBlock = new CTitleBlock('Files', 'folder5.png', $m, $m . '.' . $a);
$titleBlock->addCell($AppUI->_('Filter') . ':');
$titleBlock->addCell(arraySelect($projects, 'project_id', 'onchange="javascript:document.pickProject.submit()" size="1" class="text"', $project_id), '', '<form name="pickProject" action="?m=files" method="post">', '</form>');
/*
 * override the file module's $canEdit variable passed from the main index.php 
 * in order to check on file folder permissions
 */
$canAuthor_folders = getPermission('file_folders', 'add');
if ($canAuthor) {
    $titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new file') . '" />', '', '<form action="?m=files&amp;a=addedit&amp;folder=' . $folder . '" method="post">', '</form>');
}
if ($canAuthor_folders) {
    $titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new folder') . '" />', '', '<form action="?m=files&amp;a=addedit_folder" method="post">', '</form>');
}
$titleBlock->show();
$file_types = dPgetSysVal('FileType');
$fts = $file_types;
if ($tab != -1) {
    array_unshift($file_types, 'All Files');
}
$tabBox = new CTabBox('?m=files', DP_BASE_DIR . '/modules/files/', $tab);
$tabbed = $tabBox->isTabbed();
$i = 0;
foreach ($file_types as $file_type) {
    $tabBox->add('index_table', $file_type);
    ++$i;
}
if ($canAccess_folders) {
    $tabBox->add('folders_table', 'Folder Explorer');
}
$tabBox->show();
Ejemplo n.º 5
0
}
$tab = $AppUI->getState('LinkIdxTab') !== NULL ? $AppUI->getState('LinkIdxTab') : 0;
$active = intval(!$AppUI->getState('LinkIdxTab'));
require_once $AppUI->getModuleClass('projects');
// get the list of visible companies
$extra = array('from' => 'links', 'where' => 'project_id = link_project');
$project = new CProject();
$projects = $project->getAllowedRecords($AppUI->user_id, 'project_id,project_name', 'project_name', null, $extra);
$projects = arrayMerge(array('0' => $AppUI->_('All', UI_OUTPUT_JS)), $projects);
// setup the title block
$titleBlock = new CTitleBlock('Links', 'folder5.png', $m, "{$m}.{$a}");
$titleBlock->addCell($AppUI->_('Search') . ':');
$titleBlock->addCell('<input type="text" class="text" size="10" name="search" onchange="javascript:document.searchfilter.submit();" value=' . "'{$search}'" . 'title="' . $AppUI->_('Search in name and description fields', UI_OUTPUT_JS) . '"/>', '', '<form action="?m=links" method="post" id="searchfilter">', '</form>');
$titleBlock->addCell($AppUI->_('Filter') . ':');
$titleBlock->addCell(arraySelect($projects, 'project_id', 'onchange="javascript:document.pickProject.submit()" size="1" class="text"', $project_id), '', '<form name="pickProject" action="?m=links" method="post">', '</form>');
if ($canEdit) {
    $titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new link') . '" />', '', '<form action="?m=links&amp;a=addedit" method="post">', '</form>');
}
$titleBlock->show();
$link_types = dPgetSysVal('LinkType');
if ($tab != -1) {
    array_unshift($link_types, 'All Links');
}
array_map(array($AppUI, '_'), $link_types);
$tabBox = new CTabBox('?m=links', DP_BASE_DIR . '/modules/links/', $tab);
$i = 0;
foreach ($link_types as $link_type) {
    $tabBox->add('index_table', $link_type);
    ++$i;
}
$tabBox->show();
Ejemplo n.º 6
0
}
$tab = $AppUI->getState('ProjVwTab') !== NULL ? $AppUI->getState('ProjVwTab') : 0;
// check if this record has dependencies to prevent deletion
$msg = '';
$obj = new CProject();
// Now check if the proect is editable/viewable.
$denied = $obj->getDeniedRecords($AppUI->user_id);
if (in_array($project_id, $denied)) {
    $AppUI->redirect("m=public&a=access_denied");
}
$canDelete = $obj->canDelete($msg, $project_id);
// get critical tasks (criteria: task_end_date)
$criticalTasks = $project_id > 0 ? $obj->getCriticalTasks($project_id) : NULL;
// get ProjectPriority from sysvals
$projectPriority = dPgetSysVal('ProjectPriority');
$projectPriorityColor = dPgetSysVal('ProjectPriorityColor');
$working_hours = $dPconfig['daily_working_hours'] ? $dPconfig['daily_working_hours'] : 8;
$q = new DBQuery();
//check that project has tasks; otherwise run seperate query
$q->addTable('tasks');
$q->addQuery("COUNT(distinct tasks.task_id) AS total_tasks");
$q->addWhere('task_project = ' . $project_id);
$hasTasks = $q->loadResult();
$q->clear();
// load the record data
// GJB: Note that we have to special case duration type 24 and this refers to the hours in a day, NOT 24 hours
if ($hasTasks) {
    $q->addTable('projects');
    $q->addQuery("company_name, CONCAT_WS(', ',contact_last_name,contact_first_name) user_name, projects.*," . " SUM(t1.task_duration * t1.task_percent_complete" . " * IF(t1.task_duration_type = 24, {$working_hours}, t1.task_duration_type))" . " / SUM(t1.task_duration * IF(t1.task_duration_type = 24, {$working_hours}, t1.task_duration_type))" . " AS project_percent_complete");
    $q->addJoin('companies', 'com', 'company_id = project_company');
    $q->addJoin('users', 'u', 'user_id = project_owner');
Ejemplo n.º 7
0
 function notify($assignees, $update = false, $clash = false)
 {
     global $AppUI, $locale_char_set, $dPconfig;
     $mail_owner = $AppUI->getPref('MAILALL');
     $assignee_list = explode(",", $assignees);
     $owner_is_assigned = in_array($this->event_owner, $assignee_list);
     if ($mail_owner && !$owner_is_assigned && $this->event_owner) {
         array_push($assignee_list, $this->event_owner);
     }
     // Remove any empty elements otherwise implode has a problem
     foreach ($assignee_list as $key => $x) {
         if (!$x) {
             unset($assignee_list[$key]);
         }
     }
     if (!count($assignee_list)) {
         return;
     }
     $q = new DBQuery();
     $q->addTable('users', 'u');
     $q->addTable('contacts', 'con');
     $q->addQuery('user_id, contact_first_name,contact_last_name, contact_email');
     $q->addWhere('u.user_contact = con.contact_id');
     $q->addWhere("user_id in (" . implode(',', $assignee_list) . ")");
     $users = $q->loadHashList('user_id');
     $date_format = $AppUI->getPref('SHDATEFORMAT');
     $time_format = $AppUI->getPref('TIMEFORMAT');
     $fmt = $date_format . ' ' . $time_format;
     $start_date =& new CDate($this->event_start_date);
     $end_date =& new CDate($this->event_end_date);
     $mail =& new Mail();
     $type = $update ? $AppUI->_('Updated') : $AppUI->_('New');
     $subject_title = $clash ? $AppUI->_('Requested Event') : $type . " " . $AppUI->_('Event');
     $mail->Subject($subject_title . ": " . $this->event_title, $locale_char_set);
     $mail->From('"' . $AppUI->user_first_name . " " . $AppUI->user_last_name . '" <' . $AppUI->user_email . '>');
     $body = '';
     if ($clash) {
         $body .= 'You have been invited to an event by ' . $AppUI->user_first_name . ' ' . $AppUI->user_last_name . "\n";
         $body .= 'However, either you or another intended invitee has a competing event' . "\n";
         $body .= $AppUI->user_first_name . ' ' . $AppUI->user_last_name . ' has requested that you reply to this message' . "\n";
         $body .= 'and confirm if you can or can not make the requested time.' . "\n\n";
     }
     $body .= $AppUI->_('Event') . ":\t" . $this->event_title . "\n";
     if (!$clash) {
         $body .= $AppUI->_('URL') . ":\t" . $dPconfig['base_url'] . "/index.php?m=calendar&a=view&event_id=" . $this->event_id . "\n";
     }
     $body .= $AppUI->_('Starts') . ":\t" . $start_date->format($fmt) . "\n";
     $body .= $AppUI->_('Ends') . ":\t" . $end_date->format($fmt) . "\n";
     // Find the project name.
     if ($this->event_project) {
         $prj = array();
         $q = new DBQuery();
         $q->addTable('projects', 'p');
         $q->addQuery('project_name');
         $q->addWhere('p.project_id =' . $this->event_project);
         $sql = $q->prepare();
         $q->clear();
         if (db_loadHash($sql, $prj)) {
             $body .= $AppUI->_('Project') . ":\t" . $prj['project_name'] . "\n";
         }
     }
     $types = dPgetSysVal('EventType');
     $body .= $AppUI->_('Type') . ":\t" . $AppUI->_($types[$this->event_type]) . "\n";
     $body .= $AppUI->_('Attendees') . ":\t";
     $body_attend = '';
     foreach ($users as $user) {
         $body_attend .= ($body_attend ? ', ' : '') . $user['contact_first_name'] . ' ' . $user['contact_last_name'];
     }
     $body .= $body_attend . "\n\n" . $this->event_description . "\n";
     $mail->Body($body, $locale_char_set);
     foreach ($users as $user) {
         if (!$mail_owner && $user['user_id'] == $this->event_owner) {
             continue;
         }
         $mail->To($user['contact_email'], true);
         $mail->Send();
     }
 }
Ejemplo n.º 8
0
//for getting permissions for records related to projects
$obj_project = new CProject();
// collect the full (or filtered) projects list data via function in projects.class.php
projects_list_data();
// setup the title block
$titleBlock = new CTitleBlock('Projects', 'applet3-48.png', $m, $m . '.' . $a);
$titleBlock->addCell($AppUI->_('Owner') . ':');
$titleBlock->addCell('<form action="?m=projects" method="post" name="pickUser">' . "\n" . $bufferUser . "\n" . '</form>' . "\n");
$titleBlock->addCell($AppUI->_('Company') . '/' . $AppUI->_('Division') . ':');
$titleBlock->addCell('<form action="?m=projects" method="post" name="pickCompany">' . "\n" . $cBuffer . "\n" . '</form>' . "\n");
$titleBlock->addCell();
if ($canAuthor) {
    $titleBlock->addCell('<form action="?m=projects&amp;a=addedit" method="post">' . "\n" . '<input type="submit" class="button" value="' . $AppUI->_('new project') . '" />' . "\n" . '</form>' . "\n");
}
$titleBlock->show();
$project_types = dPgetSysVal('ProjectStatus');
// count number of projects per project_status
$q->addTable('projects', 'p');
$q->addQuery('p.project_status, COUNT(p.project_id) as count');
$obj_project->setAllowedSQL($AppUI->user_id, $q, null, 'p');
if ($owner > 0) {
    $q->addWhere('p.project_owner = ' . $owner);
}
if (isset($department)) {
    $q->addJoin('project_departments', 'pd', 'pd.project_id = p.project_id');
    if (!$addPwOiD) {
        $q->addWhere('pd.department_id in (' . implode(',', $dept_ids) . ')');
    }
} else {
    if ($company_id && !$addPwOiD) {
        $q->addWhere('p.project_company = ' . $company_id);
Ejemplo n.º 9
0
// check if this record has dependencies to prevent deletion
$msg = '';
$obj = new CProject();
// Now check if the project is editable/viewable.
$denied = $obj->getDeniedRecords($AppUI->user_id);
if (in_array($project_id, $denied)) {
    $AppUI->redirect("m=public&a=access_denied");
}
$canDeleteProject = $obj->canDelete($msg, $project_id);
// get critical tasks (criteria: task_end_date)
$criticalTasks = $project_id > 0 ? $obj->getCriticalTasks($project_id) : NULL;
// get ProjectPriority from sysvals
$projectPriority = dPgetSysVal('ProjectPriority');
$projectPriorityColor = dPgetSysVal('ProjectPriorityColor');
$pstatus = dPgetSysVal('ProjectStatus');
$ptype = dPgetSysVal('ProjectType');
$working_hours = $dPconfig['daily_working_hours'] ? $dPconfig['daily_working_hours'] : 8;
$q = new DBQuery();
//check that project has tasks; otherwise run seperate query
$q->addTable('tasks');
$q->addQuery("COUNT(distinct tasks.task_id) AS total_tasks");
$q->addWhere('task_project = ' . $project_id);
$hasTasks = $q->loadResult();
$q->clear();
// load the record data
// GJB: Note that we have to special case duration type 24 and this refers to the hours in a day, NOT 24 hours
if ($hasTasks) {
    $q->addTable('projects');
    $q->addQuery("company_name, CONCAT_WS(' ',contact_first_name,contact_last_name) user_name, projects.*," . " SUM(t1.task_duration * t1.task_percent_complete" . " * IF(t1.task_duration_type = 24, {$working_hours}, t1.task_duration_type))" . " / SUM(t1.task_duration * IF(t1.task_duration_type = 24, {$working_hours}, t1.task_duration_type))" . " AS project_percent_complete");
    $q->addJoin('companies', 'com', 'company_id = project_company');
    $q->addJoin('users', 'u', 'user_id = project_owner');
if ($canEdit) {
    $titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new task') . '">', '', '<form action="?m=tasks&a=addedit&task_project=' . $obj->task_project . '&task_parent=' . $task_id . '" method="post">', '</form>');
    $titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new file') . '">', '', '<form action="?m=files&a=addedit&project_id=' . $obj->task_project . '&file_task=' . $obj->task_id . '" method="post">', '</form>');
}
$titleBlock->addCrumb("?m=tasks", "tasks list");
if ($canReadProject) {
    $titleBlock->addCrumb("?m=projects&a=view&project_id={$obj->task_project}", "view this project");
}
if ($perms->checkModule('tasks', 'edit')) {
    $titleBlock->addCrumb("?m=tasks&a=addedit&task_id={$task_id}", "edit this task");
}
if ($canDelete) {
    $titleBlock->addCrumbDelete('delete task', $canDelete, $msg);
}
$titleBlock->show();
$task_types = dPgetSysVal("TaskType");
?>

<script language="JavaScript">
var calendarField = '';

function popCalendar( field ){
	calendarField = field;
	idate = eval( 'document.editFrm.task_' + field + '.value' );
	window.open( 'index.php?m=public&a=calendar&dialog=1&callback=setCalendar&date=' + idate, 'calwin', 'width=250, height=220, scollbars=false' );
}

/**
 *	@param string Input date in the format YYYYMMDD
 *	@param string Formatted date
 */
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();
echo "</td></tr></table>";
echo "<div align=right><input type=button onClick='document.pickCompany.submit()' class='button' value='Buscar'></form></div>";
$project_types = dPgetSysVal("ProjectStatus");
$active = 0;
$complete = 0;
$archive = 0;
$proposed = 0;
foreach ($project_types as $key => $value) {
    $counter[$key] = 0;
    if (is_array($projects)) {
        foreach ($projects as $p) {
            if ($p['project_status'] == $key && $p['project_active'] > 0) {
                ++$counter[$key];
            }
        }
    }
    $project_types[$key] = $AppUI->_($project_types[$key], UI_OUTPUT_RAW) . ' (' . $counter[$key] . ')';
}
Ejemplo n.º 12
0
								<br /><?php 
echo $AppUI->_('Web Address');
?>
								<br /><input type="text" class="text" name="task_related_url" value="<?php 
echo @$obj->task_related_url;
?>
" size="40" maxlength="255" />

							</td>
							<td valign='top'>
								<?php 
echo $AppUI->_("Task Type");
?>
								<br />
								<?php 
$task_types = dPgetSysVal('TaskType');
echo arraySelect($task_types, "task_type", "class='text'", $obj->task_type, false);
?>
								<br /><br />
					<?php 
if ($AppUI->isActiveModule('contacts') && $perms->checkModule('contacts', 'view')) {
    echo "<input type='button' class='button' value='" . $AppUI->_("Select contacts...") . "' onclick='javascript:popContacts();' />";
}
// Let's check if the actual company has departments registered
if ($department_selection_list != "") {
    ?>
								<br />
								<?php 
    echo $AppUI->_("Departments");
    ?>
<br />
Ejemplo n.º 13
0
if (!defined('DP_BASE_DIR')) {
    die('You should not access this file directly.');
}
$callback = dPgetCleanParam($_GET, 'callback', '');
?>
<script language="javascript">
	function setClose(color) {
		window.opener.<?php 
echo $callback;
?>
(color);
		window.close();
	}
</script>
<?php 
$colors = dPgetSysVal('ProjectColors');
if ($dPconfig['restrict_color_selection']) {
    ?>
<table border="0" cellpadding="1" cellspacing="2" width="292" align="center">
	<tr>
		<td valign="top" colspan="2">
			<strong><?php 
    echo $AppUI->_('Color Selector');
    ?>
</strong>
		</td>
	</tr>
	<?php 
    foreach ($colors as $key => $value) {
        ?>
	<tr>
Ejemplo n.º 14
0
<?php

if (!defined('DP_BASE_DIR')) {
    die('You should not access this file directly.');
}
// user types
$utypes = dPgetSysVal('UserType');
##
##	NOTE: the user_type field in the users table must be changed to a TINYINT
##
Ejemplo n.º 15
0
global $this_day, $event_filter, $event_filter_list;
require_once $AppUI->getModuleClass('calendar');
$perms =& $AppUI->acl();
$user_id = $AppUI->user_id;
$other_users = false;
$no_modify = false;
$start_date = isset($start_date) ? $start_date : new CDate('0000-00-00 00:00:00');
$end_date = isset($end_date) ? $end_date : new CDate('9999-12-31 23:59:59');
// assemble the links for the events
$events = CEvent::getEventsForPeriod($start_date, $end_date, 'all', null, $project_id);
//echo '<pre>' . print_r($events, true) .  '</pre>';
$start_hour = dPgetConfig('cal_day_start');
$end_hour = dPgetConfig('cal_day_end');
$tf = $AppUI->getPref('TIMEFORMAT');
$df = $AppUI->getPref('SHDATEFORMAT');
$types = dPgetSysVal('EventType');
?>
<table cellspacing="1" cellpadding="2" border="0" width="100%" class="tbl">
	<tr>
		<th><?php 
echo $AppUI->_('Date');
?>
</th>
		<th><?php 
echo $AppUI->_('Type');
?>
</th>
		<th><?php 
echo $AppUI->_('Event');
?>
</th>
Ejemplo n.º 16
0
}
$tab = $AppUI->getState('LinkIdxTab') !== NULL ? $AppUI->getState('LinkIdxTab') : 0;
$active = intval(!$AppUI->getState('LinkIdxTab'));
require_once $AppUI->getModuleClass('projects');
// get the list of visible companies
$extra = array('from' => 'links', 'where' => 'project_id = link_project');
$project = new CProject();
$projects = $project->getAllowedRecords($AppUI->user_id, 'project_id,project_name', 'project_name', null, $extra);
$projects = arrayMerge(array('0' => $AppUI->_('All', UI_OUTPUT_JS)), $projects);
// setup the title block
$titleBlock = new CTitleBlock('Links', 'folder5.png', $m, "{$m}.{$a}");
$titleBlock->addCell($AppUI->_('Search') . ':');
$titleBlock->addCell('<input type="text" class="text" SIZE="10" name="search" onChange="document.searchfilter.submit();" value=' . "'{$search}'" . 'title="' . $AppUI->_('Search in name and description fields', UI_OUTPUT_JS) . '"/>', '', '<form action="?m=links" method="post" id="searchfilter">', '</form>');
$titleBlock->addCell($AppUI->_('Filter') . ':');
$titleBlock->addCell(arraySelect($projects, 'project_id', 'onChange="document.pickProject.submit()" size="1" class="text"', $project_id), '', '<form name="pickProject" action="?m=links" method="post">', '</form>');
if ($canEdit) {
    $titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new link') . '">', '', '<form action="?m=links&a=addedit" method="post">', '</form>');
}
$titleBlock->show();
$link_types = dPgetSysVal("LinkType");
if ($tab != -1) {
    array_unshift($link_types, "All Links");
}
array_map(array($AppUI, '_'), $link_types);
$tabBox = new CTabBox("?m=links", DP_BASE_DIR . '/modules/links/', $tab);
$i = 0;
foreach ($link_types as $link_type) {
    $tabBox->add("index_table", $link_type);
    ++$i;
}
$tabBox->show();
Ejemplo n.º 17
0
 /**
  * Email the task log to assignees, task contacts, project contacts, and others
  * based upon the information supplied by the user.
  */
 function email_log(&$log, $assignees, $task_contacts, $project_contacts, $others, $extras)
 {
     global $AppUI, $locale_char_set, $dPconfig;
     $mail_recipients = array();
     $q = new DBQuery();
     if (isset($assignees) && $assignees == 'on') {
         $q->addTable('user_tasks', 'ut');
         $q->leftJoin('users', 'ua', 'ua.user_id = ut.user_id');
         $q->leftJoin('contacts', 'c', 'c.contact_id = ua.user_contact');
         $q->addQuery('c.contact_email, c.contact_first_name, c.contact_last_name');
         $q->addWhere('ut.task_id = ' . $this->task_id);
         if (!$AppUI->getPref('MAILALL')) {
             $q->addWhere('ua.user_id <>' . $AppUI->user_id);
         }
         $req =& $q->exec(QUERY_STYLE_NUM);
         for ($req; !$req->EOF; $req->MoveNext()) {
             list($email, $first, $last) = $req->fields;
             if (!isset($mail_recipients[$email])) {
                 $mail_recipients[$email] = trim($first) . ' ' . trim($last);
             }
         }
         $q->clear();
     }
     if (isset($task_contacts) && $task_contacts == 'on') {
         $q->addTable('task_contacts', 'tc');
         $q->leftJoin('contacts', 'c', 'c.contact_id = tc.contact_id');
         $q->addQuery('c.contact_email, c.contact_first_name, c.contact_last_name');
         $q->addWhere('tc.task_id = ' . $this->task_id);
         $req =& $q->exec(QUERY_STYLE_NUM);
         for ($req; !$req->EOF; $req->MoveNext()) {
             list($email, $first, $last) = $req->fields;
             if (!isset($mail_recipients[$email])) {
                 $mail_recipients[$email] = $first . ' ' . $last;
             }
         }
         $q->clear();
     }
     if (isset($project_contacts) && $project_contacts == 'on') {
         $q->addTable('project_contacts', 'pc');
         $q->leftJoin('contacts', 'c', 'c.contact_id = pc.contact_id');
         $q->addQuery('c.contact_email, c.contact_first_name, c.contact_last_name');
         $q->addWhere('pc.project_id = ' . $this->task_project);
         $req =& $q->exec(QUERY_STYLE_NUM);
         for ($req; !$req->EOF; $req->MoveNext()) {
             list($email, $first, $last) = $req->fields;
             if (!isset($mail_recipients[$email])) {
                 $mail_recipients[$email] = $first . ' ' . $last;
             }
         }
         $q->clear();
     }
     if (isset($others)) {
         $others = trim($others, " \r\n\t,");
         // get rid of empty elements.
         if (mb_strlen($others) > 0) {
             $q->addTable('contacts', 'c');
             $q->addQuery('c.contact_email, c.contact_first_name, c.contact_last_name');
             $q->addWhere('c.contact_id in (' . $others . ')');
             $req =& $q->exec(QUERY_STYLE_NUM);
             for ($req; !$req->EOF; $req->MoveNext()) {
                 list($email, $first, $last) = $req->fields;
                 if (!isset($mail_recipients[$email])) {
                     $mail_recipients[$email] = $first . ' ' . $last;
                 }
             }
             $q->clear();
         }
     }
     if (isset($extras) && $extras) {
         // Search for semi-colons, commas or spaces and allow any to be separators
         $extra_list = preg_split('/[\\s,;]+/', $extras);
         foreach ($extra_list as $email) {
             if ($email && !isset($mail_recipients[$email])) {
                 $mail_recipients[$email] = $email;
             }
         }
     }
     $q->clear();
     // Reset to the default state.
     if (count($mail_recipients) == 0) {
         return false;
     }
     // Build the email and send it out.
     $char_set = isset($locale_char_set) ? $locale_char_set : '';
     $mail = new Mail();
     // Grab the subject from user preferences
     $prefix = $AppUI->getPref('TASKLOGSUBJ');
     $mail->Subject($prefix . ' ' . $log->task_log_name, $char_set);
     $q->addTable('projects');
     $q->addQuery('project_name');
     $q->addWhere('project_id=' . $this->task_project);
     $sql = $q->prepare();
     $q->clear();
     $projname = htmlspecialchars_decode(db_loadResult($sql));
     $body = $AppUI->_('Project', UI_OUTPUT_RAW) . ': ' . $projname . "\n";
     if ($this->task_parent != $this->task_id) {
         $q->addTable('tasks');
         $q->addQuery('task_name');
         $q->addWhere('task_id = ' . $this->task_parent);
         $req =& $q->exec(QUERY_STYLE_NUM);
         if ($req) {
             $body .= $AppUI->_('Parent Task', UI_OUTPUT_RAW) . ': ' . htmlspecialchars_decode($req->fields[0]) . "\n";
         }
         $q->clear();
     }
     $body .= $AppUI->_('Task', UI_OUTPUT_RAW) . ': ' . $this->task_name . "\n";
     $task_types = dPgetSysVal('TaskType');
     $body .= $AppUI->_('Task Type', UI_OUTPUT_RAW) . ':' . $task_types[$this->task_type] . "\n";
     $body .= $AppUI->_('URL', UI_OUTPUT_RAW) . ': ' . DP_BASE_URL . '/index.php?m=tasks&a=view&task_id=' . $this->task_id . "\n\n";
     $body .= $AppUI->_('Hours', UI_OUTPUT_RAW) . ': ' . $log->task_log_hours . $AppUI->_('h', UI_OUTPUT_RAW) . "\n\n";
     $body .= $AppUI->_('Summary', UI_OUTPUT_RAW) . ': ' . $log->task_log_name . "\n\n";
     $body .= $log->task_log_description;
     // Append the user signature to the email - if it exists.
     $q->addTable('users');
     $q->addQuery('user_signature');
     $q->addWhere('user_id = ' . $AppUI->user_id);
     if ($res = $q->exec()) {
         if ($res->fields['user_signature']) {
             $body .= "\n--\n" . $res->fields['user_signature'];
         }
     }
     $q->clear();
     $mail->Body($body, $char_set);
     $mail->From($AppUI->user_first_name . ' ' . $AppUI->user_last_name . ' <' . $AppUI->user_email . '>');
     $recipient_list = '';
     foreach ($mail_recipients as $email => $name) {
         if ($mail->ValidEmail($email)) {
             $mail->To($email);
             $recipient_list .= $email . ' (' . $name . ")\n";
         } else {
             $recipient_list .= "Invalid email address '{$email}' for {$name}, not sent\n";
         }
     }
     $mail->Send();
     // Now update the log
     $save_email = @$AppUI->getPref('TASKLOGNOTE');
     if ($save_email) {
         $log->task_log_description .= "\nEmailed " . date('d/m/Y H:i:s') . " to:\n{$recipient_list}";
         return true;
     }
     return false;
     // No update needed.
 }
Ejemplo n.º 18
0
<?php

/* TASKS $Id$ */
if (!defined('DP_BASE_DIR')) {
    die('You should not access this file directly.');
}
global $AppUI, $task_id, $df, $m;
if (!getPermission('task_log', 'access')) {
    $AppUI->redirect('m=public&a=access_denied');
}
$problem = intval(dPgetParam($_GET, 'problem', null));
// get sysvals
$taskLogReference = dPgetSysVal('TaskLogReference');
$taskLogReferenceImage = dPgetSysVal('TaskLogReferenceImage');
?>
<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
$canView = getPermission('task_log', 'view');
$canEdit = getPermission('task_log', 'edit');
$canDelete = getPermission('task_log', 'delete');
if ($canDelete) {
    ?>
function delIt2(id) {
	if (confirm("<?php 
    echo $AppUI->_('doDelete', UI_OUTPUT_JS) . ' ' . $AppUI->_('Task Log', UI_OUTPUT_JS) . '?';
    ?>
")) {
		document.frmDelete2.task_log_id.value = id;
if (dPgetParam($_GET, 'tab', -1) != -1) {
    $AppUI->setState('FileIdxTab', dPgetParam($_GET, 'tab'));
}
$tab = $AppUI->getState('FileIdxTab', 0);
$active = intval(!$AppUI->getState('FileIdxTab'));
require_once $AppUI->getModuleClass('projects');
// get the list of visible companies
$extra = array('from' => 'files', 'where' => 'project_id = file_project');
$project = new CProject();
$projects = $project->getAllowedRecords($AppUI->user_id, 'project_id,project_name', 'project_name', null, $extra);
$allowedProjects = array_keys($projects);
$projects = arrayMerge(array('0' => $AppUI->_('All', UI_OUTPUT_RAW)), $projects);
// setup the title block
$titleBlock = new CTitleBlock('Files', 'folder5.png', $m, "{$m}.{$a}");
$titleBlock->addCell($AppUI->_('Filter') . ':');
$titleBlock->addCell(arraySelect($projects, 'project_id', 'onChange="document.pickProject.submit()" size="1" class="text"', $project_id), '', '<form name="pickProject" action="?m=files" method="post">', '</form>');
if ($canEdit) {
    $titleBlock->addCell('<input type="submit" class="button" value="' . $AppUI->_('new file') . '">', '', '<form action="?m=files&a=addedit" method="post">', '</form>');
}
$titleBlock->show();
$file_types = dPgetSysVal("FileType");
if ($tab != -1) {
    array_unshift($file_types, "All Files");
}
$tabBox = new CTabBox("?m=files", "{$dPconfig['root_dir']}/modules/files/", $tab);
$i = 0;
foreach ($file_types as $file_type) {
    $tabBox->add("index_table", $file_type);
    ++$i;
}
$tabBox->show();
Ejemplo n.º 20
0
$q->addQuery('t.*, p.project_name, p.project_id, p.project_color_identifier');
if ($project_id) {
    $q->addWhere('p.project_id = ' . $project_id);
}
if (count($allowedTasks)) {
    $q->addWhere($allowedTasks);
}
if (count($allowedProjects)) {
    $q->addWhere($allowedProjects);
}
$q->addGroup('t.task_id');
$q->addOrder($sort . ', t.task_priority DESC');
//echo ('<pre>' . $q->prepare(); . '</pre>');
$tasks = $q->loadList();
$priorities = array('1' => 'high', '0' => 'normal', '-1' => 'low');
$durnTypes = dPgetSysVal('TaskDurationType');
if (!@$min_view) {
    $titleBlock = new CTitleBlock('Organize Tasks', 'applet-48.png', $m, "{$m}.{$a}");
    $titleBlock->addCrumb('?m=tasks', 'tasks list');
    if ($project_id) {
        $titleBlock->addCrumb('?m=projects&a=view&project_id=' . $project_id, 'view project');
    }
    $titleBlock->show();
}
function showchildren($id, $level = 1)
{
    global $tasks;
    $t = $tasks;
    //otherwise, $tasks is accessed from a static context and doesn't work.
    foreach ($t as $task) {
        //echo $id . '==> ' . $task['task_parent'] . '==' . $id . '<br>';
Ejemplo n.º 21
0
 $message .= "\t\t<TD bgcolor=white><font face=arial,san-serif size=2>" . $AppUI->_('Author') . ":</font></TD>\n";
 $message .= "\t\t<TD bgcolor=white><font face=arial,san-serif size=2>" . str_replace(">", "&gt;", str_replace("<", "&lt;", str_replace('"', '', $author))) . "</font></TD>\n";
 $message .= "\t</tr>\n";
 $message .= "\t<TR>\n";
 $message .= "\t\t<TD bgcolor=white><font face=arial,san-serif size=2>" . $AppUI->_('Subject') . ":</font></TD>\n";
 $message .= "\t\t<TD bgcolor=white><font face=arial,san-serif size=2>{$subject}</font></TD>\n";
 $message .= "\t</tr>\n";
 $message .= "\t<TR>\n";
 $message .= "\t\t<TD bgcolor=white nowrap><font face=arial,san-serif size=2>" . $AppUI->_('View') . ":</font></TD>\n";
 $message .= "\t\t<TD bgcolor=white nowrap><a href=\"" . DP_BASE_URL . "/index.php?m=ticketsmith&a=view&ticket={$ticket}\"><font face=arial,sans-serif size=2>" . DP_BASE_URL . "/index.php?m=ticketsmith&a=view&ticket={$ticket}</font></a></TD>\n";
 $message .= "\t</tr>\n";
 $message .= "</TABLE>\n";
 $message .= "</body>\n";
 $message .= "</html>\n";
 $message .= "\n--{$boundary}--\n";
 $ticketNotification = dPgetSysVal('TicketNotify');
 if (count($ticketNotification) > 0) {
     mail($ticketNotification[$priority], $AppUI->_('Trouble ticket') . " #{$ticket} ", $message, "From: " . $CONFIG['reply_to'] . "\nContent-type: multipart/alternative; boundary=\"{$boundary}\"\nMime-Version: 1.0");
 }
 if (@$assignment_toggle != @$orig_assignment) {
     $mailinfo = query2hash("SELECT contact_first_name, contact_last_name, contact_email from users u LEFT JOIN contacts ON u.user_contact = contact_id WHERE user_id = {$assignment_toggle}");
     if (@$mailinfo['contact_email']) {
         $boundary = "_lkqwkASDHASK89271893712893";
         $message = "--{$boundary}\n";
         $message .= "Content-disposition: inline\n";
         $message .= "Content-type: text/plain\n\n";
         $message .= $AppUI->_('Trouble ticket assigned to you') . ".\n\n";
         $message .= "Ticket ID: {$ticket}\n";
         $message .= "Author   : {$author}\n";
         $message .= "Subject  : {$subject}\n";
         $message .= "View     : " . DP_BASE_URL . "/index.php?m=ticketsmith&a=view&ticket={$ticket}\n";
Ejemplo n.º 22
0
*/
$proj =& new CProject();
$proj->load($obj->task_project);
$sql = "SELECT billingcode_id, billingcode_name\n        FROM billingcode\n        WHERE billingcode_status=0\n        AND (company_id='{$proj->project_company}' OR company_id = 0)\n        ORDER BY billingcode_name";
$task_log_costcodes[0] = '';
$ptrc = db_exec($sql);
echo db_error();
$nums = 0;
if ($ptrc) {
    $nums = db_num_rows($ptrc);
}
for ($x = 0; $x < $nums; $x++) {
    $row = db_fetch_assoc($ptrc);
    $task_log_costcodes[$row["billingcode_id"]] = $row["billingcode_name"];
}
$taskLogReference = dPgetSysVal('TaskLogReference');
// Task Update Form
$df = $AppUI->getPref('SHDATEFORMAT');
$log_date = new CDate($log->task_log_date);
?>

<!-- TIMER RELATED SCRIPTS -->
<script language="JavaScript">
	// please keep these lines on when you copy the source
	// made by: Nicolas - http://www.javascript-page.com
	// adapted by: Juan Carlos Gonzalez jcgonz@users.sourceforge.net
	
	var timerID       = 0;
	var tStart        = null;
    var total_minutes = -1;
	
Ejemplo n.º 23
0
$log_all = (bool) dPgetParam($_POST, 'log_all', true);
$use_period = (int) dPgetParam($_POST, 'use_period', 0);
$show_orphaned = (int) dPgetParam($_POST, 'show_orphaned', 0);
$display_week_hours = (int) dPgetParam($_POST, 'display_week_hours', 0);
$max_levels = dPgetCleanParam($_POST, 'max_levels', '');
$log_userfilter = (int) dPgetParam($_POST, 'log_userfilter', 0);
$company_id = dPgetCleanParam($_POST, 'company_id', 'all');
$project_id = dPgetCleanParam($_POST, 'project_id', 'all');
require_once $AppUI->getModuleClass('projects');
require_once $AppUI->getModuleClass('tasks');
$proj = new CProject();
// filtering by companies
$projects = $proj->getAllowedRecords($AppUI->user_id, 'project_id,project_name', 'project_name');
$projFilter = arrayMerge(array('all' => $AppUI->_('All Projects')), $projects);
$durnTypes = dPgetSysVal('TaskDurationType');
$taskPriority = dPgetSysVal('TaskPriority');
// create Date objects from the datetime fields
$start_date = intval($log_start_date) ? new CDate($log_start_date) : new CDate();
$end_date = intval($log_end_date) ? new CDate($log_end_date) : new CDate();
$now = new CDate();
if (!$log_start_date) {
    $start_date->subtractSpan(new Date_Span('14,0,0,0'));
}
$end_date->setTime(23, 59, 59);
?>

<script language="javascript">
var calendarField = '';

function popCalendar(field) {
	calendarField = field;
Ejemplo n.º 24
0
function displayFiles($folder_id)
{
    global $AppUI, $m, $a, $tab, $page;
    global $current_uri;
    global $canAccess, $canRead, $canEdit, $canAuthor, $canDelete;
    global $canAccess_folders, $canRead_folders, $canEdit_folders;
    global $canAuthor_folders, $canDelete_folders;
    global $company_id, $project_id, $task_id;
    global $allowedCompanies, $allowedProjects, $allowedTasks, $allowedFolders;
    global $showProject, $cfObj, $dPconfig;
    $df = $AppUI->getPref('SHDATEFORMAT');
    $tf = $AppUI->getPref('TIMEFORMAT');
    $file_types = dPgetSysVal('FileType');
    $xpg_pagesize = 30;
    //TODO?: Set by System Config Value ...
    $xpg_totalrecs = countFiles($folder_id);
    //get file count for folder
    $xpg_total_pages = $xpg_totalrecs > $xpg_pagesize ? ceil($xpg_totalrecs / $xpg_pagesize) : 1;
    $xpg_min = $xpg_pagesize * ($page - 1);
    // This is where we start our record set from
    $q = new DBQuery();
    // most recent version info per file_project and file_version_id
    $q->createTemp('files_count_max' . $folder_id);
    $q->addTable('files', 'f');
    $q->addQuery('DISTINCT count(f.file_id) as file_versions' . ', max(f.file_version) as file_lastversion' . ', file_version_id, f.file_project');
    $q->addJoin('projects', 'p', 'p.project_id = f.file_project');
    $q->addJoin('tasks', 't', 't.task_id = f.file_task');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = f.file_folder');
    $q->addWhere('f.file_folder = ' . $folder_id);
    if (count($allowedProjects)) {
        $q->addWhere('((' . implode(' AND ', $allowedProjects) . ') OR f.file_project = 0)');
    }
    if (count($allowedTasks)) {
        $q->addWhere('((' . implode(' AND ', $allowedTasks) . ') OR f.file_task = 0)');
    }
    if (count($allowedFolders)) {
        $q->addWhere('((' . implode(' AND ', $allowedFolders) . ') OR f.file_folder = 0)');
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('co.company_id = ' . $company_id);
        if (count($allowedCompanies)) {
            $q->addWhere('(' . implode(' AND ', $allowedCompanies) . ')');
        }
    }
    $q->addGroup('f.file_version_id');
    $q->addGroup('f.file_project');
    $file_version_max_counts = $q->exec();
    $q->clear();
    // most recent version
    $q->addTable('files', 'f');
    $q->addQuery('f.*, fmc.file_versions, round(fmc.file_lastversion, 2) as file_lastversion' . ', u.user_username as file_owner, ff.file_folder_name' . ', ff.file_folder_id, ff.file_folder_name, p.project_name' . ', p.project_color_identifier, p.project_owner, c.contact_first_name' . ', c.contact_last_name, t.task_name, u.user_username as file_owner' . ', cc.contact_first_name as checkout_first_name' . ', cc.contact_last_name as checkout_last_name');
    $q->addJoin('files_count_max' . $folder_id, 'fmc', '(fmc.file_lastversion=f.file_version AND fmc.file_version_id=f.file_version_id' . ' AND fmc.file_project=f.file_project)', 'inner');
    $q->addJoin('projects', 'p', 'p.project_id = f.file_project');
    $q->addJoin('users', 'u', 'u.user_id = f.file_owner');
    $q->addJoin('contacts', 'c', 'c.contact_id = u.user_contact');
    $q->addJoin('tasks', 't', 't.task_id = f.file_task');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = f.file_folder');
    $q->leftJoin('users', 'cu', 'cu.user_id = f.file_checkout');
    $q->leftJoin('contacts', 'cc', 'cc.contact_id = cu.user_contact');
    $q->addWhere('f.file_folder = ' . $folder_id);
    if (count($allowedProjects)) {
        $q->addWhere('((' . implode(' AND ', $allowedProjects) . ') OR f.file_project = 0)');
    }
    if (count($allowedTasks)) {
        $q->addWhere('((' . implode(' AND ', $allowedTasks) . ') OR f.file_task = 0)');
    }
    if (count($allowedFolders)) {
        $q->addWhere('((' . implode(' AND ', $allowedFolders) . ') OR f.file_folder = 0)');
    }
    if ($project_id) {
        $q->addWhere('f.file_project = ' . $project_id);
    }
    if ($task_id) {
        $q->addWhere('f.file_task = ' . $task_id);
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('co.company_id = ' . $company_id);
        if (count($allowedCompanies)) {
            $q->addWhere('(' . implode(' AND ', $allowedCompanies) . ')');
        }
    }
    $q->addOrder('p.project_name');
    $q->setLimit($xpg_pagesize, $xpg_min);
    $files_sql = $q->prepare();
    $q->clear();
    // all versions
    $q->addTable('files', 'f');
    $q->addQuery('f.*, ff.file_folder_id, ff.file_folder_name, p.project_name' . ', p.project_color_identifier, p.project_owner, c.contact_first_name' . ', c.contact_last_name, t.task_name, u.user_username as file_owner');
    $q->addJoin('projects', 'p', 'p.project_id = f.file_project');
    $q->addJoin('users', 'u', 'u.user_id = f.file_owner');
    $q->addJoin('contacts', 'c', 'c.contact_id = u.user_contact');
    $q->addJoin('tasks', 't', 't.task_id = f.file_task');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = f.file_folder');
    $q->addWhere('f.file_folder = ' . $folder_id);
    if (count($allowedProjects)) {
        $q->addWhere('((' . implode(' AND ', $allowedProjects) . ') OR f.file_project = 0)');
    }
    if (count($allowedTasks)) {
        $q->addWhere('((' . implode(' AND ', $allowedTasks) . ') OR f.file_task = 0)');
    }
    if (count($allowedFolders)) {
        $q->addWhere('((' . implode(' AND ', $allowedFolders) . ') OR f.file_folder = 0)');
    }
    if ($project_id) {
        $q->addWhere('f.file_project = ' . $project_id);
    }
    if ($task_id) {
        $q->addWhere('f.file_task = ' . $task_id);
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('co.company_id = ' . $company_id);
        if (count($allowedCompanies)) {
            $q->addWhere('(' . implode(' AND ', $allowedCompanies) . ')');
        }
    }
    $file_versions_sql = $q->prepare();
    $q->clear();
    //file arrays
    $files = array();
    $file_versions = array();
    if ($canRead) {
        $files = db_loadList($files_sql);
        $file_versions = db_loadHashList($file_versions_sql, 'file_id');
    }
    $q->dropTemp('files_count_max' . $folder_id);
    $q->exec();
    if ($files == array()) {
        return;
    }
    ?>
	<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
	<tr>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('File Name');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Description');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Versions');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Category');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Task Name');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Owner');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Size');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Date');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('co Reason');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('co');
    ?>
</th>
		<th nowrap width="1"></th>
		<th nowrap width="1"></th>
	</tr>
<?php 
    $fp = -1;
    $file_date = new CDate();
    $id = 0;
    foreach ($files as $row) {
        $file_date = new CDate($row['file_date']);
        $canEdit_file = getPermission('files', 'edit', $row['file_id']);
        //single file
        if ($fp != $row['file_project']) {
            if (!$row['file_project']) {
                $row['project_name'] = $AppUI->_('Not associated to projects');
                $row['project_color_identifier'] = 'f4efe3';
            }
            if ($showProject) {
                $style = 'background-color:#' . $row['project_color_identifier'] . ';color:' . bestColor($row['project_color_identifier']);
                ?>
<tr>
	<td colspan="20" style="border: outset 2px #eeeeee;<?php 
                echo $style;
                ?>
">
	<a href="?m=projects&a=view&project_id=<?php 
                echo $row['file_project'];
                ?>
">
	<span style="<?php 
                echo $style;
                ?>
"><?php 
                echo $row['project_name'];
                ?>
</span></a>
	</td>
</tr>
<?php 
            }
        }
        $fp = $row['file_project'];
        ?>
	<form name="frm_remove_file_<?php 
        echo $row['file_id'];
        ?>
" action="?m=files" 
	 method="post">
	<input type="hidden" name="dosql" value="do_file_aed" />
	<input type="hidden" name="del" value="1" />
	<input type="hidden" name="file_id" value="<?php 
        echo $row['file_id'];
        ?>
" />
	<input type="hidden" name="redirect" value="<?php 
        echo $current_uri;
        ?>
" />
	</form>		
	<form name="frm_duplicate_file_<?php 
        echo $row['file_id'];
        ?>
" action="?m=files" 
	 method="post">
	<input type="hidden" name="dosql" value="do_file_aed" />
	<input type="hidden" name="duplicate" value="1" />
	<input type="hidden" name="file_id" value="<?php 
        echo $row['file_id'];
        ?>
" />
	<input type="hidden" name="redirect" value="<?php 
        echo $current_uri;
        ?>
" />
	</form>		
	<tr>
		<td nowrap="8%">
<?php 
        $file_icon = getIcon($row['file_type']);
        ?>
		  <a href="./fileviewer.php?file_id=<?php 
        echo $row['file_id'];
        ?>
" 
		   title="<?php 
        echo $row['file_description'];
        ?>
"> 
		  <?php 
        echo dPshowImage(DP_BASE_URL . '/modules/files/images/' . $file_icon, '16', '16');
        ?>
		  &nbsp;<?php 
        echo $row['file_name'];
        ?>
 
		  </a>
		</td>
		<td width="20%"><?php 
        echo $row['file_description'];
        ?>
</td>
		<td width="5%" nowrap="nowrap" align="center">
<?php 
        $hidden_table = '';
        echo $row['file_lastversion'];
        if ($row['file_versions'] > 1) {
            ?>
	  <a href="#" onClick="expand('versions_<?php 
            echo $row['file_id'];
            ?>
');">
	  (<?php 
            echo $row['file_versions'];
            ?>
)
	  </a>
<?php 
        }
        ?>
		</td>
		<td width="10%" nowrap="nowrap" align="center">
		  <?php 
        echo $file_types[$row['file_category']];
        ?>
		</td>
		<td width="5%" align="center">
		  <a href="./index.php?m=tasks&a=view&task_id=<?php 
        echo $row['file_task'];
        ?>
">
		  <?php 
        echo $row['task_name'];
        ?>
		  </a>
		</td>
		<td width="15%" nowrap="nowrap">
		  <?php 
        echo $row["contact_first_name"] . ' ' . $row["contact_last_name"];
        ?>
		</td>
		<td width="5%" nowrap="nowrap" align="right">
		  <?php 
        echo file_size(intval($row['file_size']));
        ?>
		</td>
		<td width="15%" nowrap="nowrap" align="right">
		  <?php 
        echo $file_date->format($df . ' ' . $tf);
        ?>
		</td>
		<td width="10%"><?php 
        echo $row['file_co_reason'];
        ?>
</td>
		<td nowrap="nowrap" align="center">
		  
<?php 
        if ($canEdit && empty($row['file_checkout'])) {
            ?>
			  <a href="?m=files&a=co&file_id=<?php 
            echo $row['file_id'];
            ?>
">
			  <?php 
            echo dPshowImage(DP_BASE_URL . '/modules/files/images/up.png', '16', '16', 'checkout', 'checkout file');
            ?>
			  </a>
<?php 
        } else {
            if ($row['file_checkout'] == $AppUI->user_id) {
                ?>
			  <a href="?m=files&a=addedit&ci=1&file_id=<?php 
                echo $row['file_id'];
                ?>
">
			  <?php 
                echo dPshowImage(DP_BASE_URL . '/modules/files/images/down.png', '16', '16', 'checkin', 'checkin file');
                ?>
			  </a>
<?php 
            } else {
                if ($file['file_checkout'] == 'final') {
                    echo '			  ' . $AppUI->_('final');
                } else {
                    echo '	  ' . $row['checkout_first_name'] . ' ' . $row['checkout_last_name'] . '<br />(' . $row['co_user'] . ')';
                }
            }
        }
        ?>
		</td>
		<td nowrap="nowrap" align="right" width="48">
		  <?php 
        if (empty($row['file_checkout']) || $row['file_checkout'] == 'final') {
            // Edit File
            if ($canEdit || $row['project_owner'] == $AppUI->user_id) {
                ?>
		  <a href="./index.php?m=files&a=addedit&file_id=<?php 
                echo $row['file_id'];
                ?>
">
<?php 
                echo dPshowImage(DP_BASE_URL . '/modules/files/images/kedit.png', '16', '16', 'edit file', 'edit file');
                ?>
		  </a>
<?php 
            }
            // Duplicate File
            if ($canAuthor || $row['project_owner'] == $AppUI->user_id) {
                ?>
		  <a href="#" 
		   onclick="document.frm_duplicate_file_<?php 
                echo $row['file_id'];
                ?>
.submit()">
<?php 
                echo dPshowImage(DP_BASE_URL . '/modules/files/images/duplicate.png', '16', '16', 'duplicate file', 'duplicate file');
                ?>
		  </a>
<?php 
            }
            // Delete File
            if ($canDelete || $row['project_owner'] == $AppUI->user_id) {
                ?>
		  <a href="#" 
		   onclick="if (confirm('Are you sure you want to delete this file?')) {document.frm_remove_file_<?php 
                echo $row['file_id'];
                ?>
.submit()}">
<?php 
                echo dPshowImage(DP_BASE_URL . '/modules/files/images/remove.png', '16', '16', 'delete file', 'delete file');
                ?>
		  </a>
<?php 
            }
        }
        ?>
		</td>
		<td nowrap="nowrap" align="center" width="1">
<?php 
        if ((empty($row['file_checkout']) || $row['file_checkout'] == 'final') && ($canEdit || $row['project_owner'] == $AppUI->user_id)) {
            $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $row['file_id'] . ') : removeBulkComponent(' . $row['file_id'] . ')"';
            ?>
			<input type="checkbox" <?php 
            echo $bulk_op;
            ?>
 
			 name="chk_sub_sel_file_<?php 
            echo $file_row['file_id'];
            ?>
" />
<?php 
        }
        ?>
		</td>
</tr>



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

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

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

	</table>
	<?php 
    shownavbar($xpg_totalrecs, $xpg_pagesize, $xpg_total_pages, $page, $folder_id);
    echo "<br />";
}
Ejemplo n.º 25
0
/**
* Sub-function to collect tasks within a period
*
* @param Date the starting date of the period
* @param Date the ending date of the period
* @param array by-ref an array of links to append new items to
* @param int the length to truncate entries by
* @param int the company id to filter by
* @author Andrew Eddie <*****@*****.**>
*/
function getTaskLinks($startPeriod, $endPeriod, &$links, $strMaxLen, $company_id = 0)
{
    global $a, $AppUI, $dPconfig;
    $tasks = CTask::getTasksForPeriod($startPeriod, $endPeriod, $company_id, $AppUI->user_id, true);
    $durnTypes = dPgetSysVal('TaskDurationType');
    $link = array();
    $sid = 3600 * 24;
    // assemble the links for the tasks
    foreach ($tasks as $row) {
        // the link
        $link['href'] = "?m=tasks&a=view&task_id=" . $row['task_id'];
        $link['alt'] = $row['project_name'] . ":\n" . $row['task_name'];
        // the link text
        if (strlen($row['task_name']) > $strMaxLen) {
            $row['task_name'] = substr($row['task_name'], 0, $strMaxLen) . '...';
        }
        $link['text'] = '<span style="color:' . bestColor($row['color']) . ';background-color:#' . $row['color'] . '">' . $row['task_name'] . '</span>';
        // determine which day(s) to display the task
        $start = new CDate($row['task_start_date']);
        $end = $row['task_end_date'] ? new CDate($row['task_end_date']) : null;
        $durn = $row['task_duration'];
        $durnType = $row['task_duration_type'];
        if (($start->after($startPeriod) || $start->equals($startPeriod)) && ($start->before($endPeriod) || $start->equals($endPeriod))) {
            $temp = $link;
            $temp['alt'] = "START [" . $row['task_duration'] . ' ' . $AppUI->_($durnTypes[$row['task_duration_type']]) . "]\n" . $link['alt'];
            if ($a != 'day_view') {
                $temp['text'] = dPshowImage(dPfindImage('block-start-16.png')) . $temp['text'];
            }
            $links[$start->format(FMT_TIMESTAMP_DATE)][] = $temp;
        }
        if ($end && $end->after($startPeriod) && $end->before($endPeriod) && $start->before($end)) {
            $temp = $link;
            $temp['alt'] = "FINISH\n" . $link['alt'];
            if ($a != 'day_view') {
                $temp['text'] .= dPshowImage(dPfindImage('block-end-16.png'));
            }
            $links[$end->format(FMT_TIMESTAMP_DATE)][] = $temp;
        }
        // convert duration to days
        if ($durnType < 24.0) {
            if ($durn > $dPconfig['daily_working_hours']) {
                $durn /= $dPconfig['daily_working_hours'];
            } else {
                $durn = 0.0;
            }
        } else {
            $durn *= $durnType / 24.0;
        }
        // fill in between start and finish based on duration
        // notes:
        // start date is not in a future month, must be this or past month
        // start date is counted as one days work
        // business days are not taken into account
        $target = $start;
        $target->addSeconds($durn * $sid);
        if (Date::compare($target, $startPeriod) < 0) {
            continue;
        }
        if (Date::compare($start, $startPeriod) > 0) {
            $temp = $start;
            $temp->addSeconds($sid);
        } else {
            $temp = $startPeriod;
        }
        // Optimised for speed, AJD.
        while (Date::compare($endPeriod, $temp) > 0 && Date::compare($target, $temp) > 0 && ($end == null || $temp->before($end))) {
            $links[$temp->format(FMT_TIMESTAMP_DATE)][] = $link;
            $temp->addSeconds($sid);
        }
    }
}
Ejemplo n.º 26
0
	                  start_date = eval( "document." + frm_name + "." + "add_task_" + f_date.replace("end_date","start_date") );
	                  duration_fld = eval( "document." + frm_name + "." + "add_task_" + f_date.replace("end_date","duration") );
	                  durntype_fld = eval( "document." + frm_name + "." + "add_task_" + f_date.replace("end_date","durntype") );
                     }
	               calcDuration(document.editFrm, start_date, end_date, duration_fld, durntype_fld);
                  }
      	}
	} else {
      	fld_task_date.value = "";
	}
}
</script>
<?php 
    $priorities = dPgetsysval('TaskPriority');
    $types = dPgetsysval('TaskType');
    $durntype = dPgetSysVal('TaskDurationType');
    include_once $AppUI->getModuleClass('tasks');
    global $task_access;
    $extra = array(0 => '(none)', 1 => 'Milestone', 2 => 'Dynamic Task', 3 => 'Inactive Task');
    $sel_priorities = arraySelect($priorities, 'add_task_priority0', 'style="width:80px" class="text"', '');
    $sel_types = arraySelect($types, 'add_task_type0', 'style="width:80px" class="text"', '');
    $sel_access = arraySelect($task_access, 'add_task_access0', 'style="width:80px" class="text"', '');
    $sel_extra = arraySelect($extra, 'add_task_extra0', 'style="width:80px" class="text"', '');
    $sel_durntype = arraySelect($durntype, 'add_task_durntype0', 'style="width:80px" class="text"', '', true);
    ?>
<script language="javascript">
var sel_priorities = "<?php 
    echo str_replace(chr(10), '', str_replace('"', "'", $sel_priorities));
    ?>
";
var sel_types = "<?php 
Ejemplo n.º 27
0
<?php

/* HELPDESK $Id: list.php,v 1.78 2005/12/28 20:02:49 theideaman Exp $ */
include_once dPgetConfig('root_dir') . '/modules/helpdesk/helpdesk.functions.php';
include_once "./modules/helpdesk/config.php";
$allowedCompanies = getAllowedCompanies();
$allowedProjects = getAllowedProjects();
$ipr = dPgetSysVal('HelpDeskPriority');
$ist = dPgetSysVal('HelpDeskStatus');
$AppUI->savePlace();
$df = $AppUI->getPref('SHDATEFORMAT');
$tf = $AppUI->getPref('TIMEFORMAT');
$format = $df . " " . $tf;
// check sort order
if (isset($_GET['orderby'])) {
    $AppUI->setState('HelpDeskIdxOrderBy', $_GET['orderby']);
}
$orderby = $AppUI->getState('HelpDeskIdxOrderBy') ? $AppUI->getState('HelpDeskIdxOrderBy') : 'item_id';
// check sort order way (asc/desc)
if (isset($_GET['orderdesc'])) {
    $AppUI->setState('HelpDeskIdxOrderDesc', $_GET['orderdesc']);
}
$orderdesc = $AppUI->getState('HelpDeskIdxOrderDesc') ? $AppUI->getState('HelpDeskIdxOrderDesc') : 0;
if (isset($_GET['page'])) {
    $AppUI->setState('HelpDeskListPage', $_GET['page']);
} else {
    // If page isn't mentioned, we need to reset
    $AppUI->setState('HelpDeskListPage', 0);
}
$page = $AppUI->getState('HelpDeskListPage') ? $AppUI->getState('HelpDeskListPage') : 0;
$tarr = array();
Ejemplo n.º 28
0
?>
";
	}
	if (f.project_actual_end_date.value > 0 && f.project_actual_end_date.value < f.project_start_date.value) {
		msg += "\n<?php 
echo $AppUI->_('projectsBadEndDate2');
?>
";
	}
	*/

	<?php 
/*
 ** Automatic required fields generated from System Values
 */
$requiredFields = dPgetSysVal('ProjectRequiredFields');
echo dPrequiredFields($requiredFields);
?>

	if (msg.length < 1) {
		f.submit();
	} else {
		alert(msg);
	}
}

var selected_contacts_id = "<?php 
echo implode(',', $selected_contacts);
?>
";
Ejemplo n.º 29
0
}
$company_id = intval(dPgetParam($_GET, "company_id", 0));
// check permissions for this company
$perms =& $AppUI->acl();
// If the company exists we need edit permission,
// If it is a new company we need add permission on the module.
if ($company_id) {
    $canEdit = $perms->checkModuleItem($m, "edit", $company_id);
} else {
    $canEdit = $perms->checkModule($m, "add");
}
if (!$canEdit) {
    $AppUI->redirect("m=public&a=access_denied");
}
// load the company types
$types = dPgetSysVal('CompanyType');
// load the record data
$q = new DBQuery();
$q->addTable('companies');
$q->addQuery('companies.*');
$q->addQuery('con.contact_first_name');
$q->addQuery('con.contact_last_name');
$q->addJoin('users', 'u', 'u.user_id = companies.company_owner');
$q->addJoin('contacts', 'con', 'u.user_contact = con.contact_id');
$q->addWhere('companies.company_id = ' . $company_id);
$sql = $q->prepare();
$q->clear();
$obj = null;
if (!db_loadObject($sql, $obj) && $company_id > 0) {
    // $AppUI->setMsg( '	$qid =& $q->exec(); Company' ); // What is this for?
    $AppUI->setMsg("invalidID", UI_MSG_ERROR, true);
<?php

/* tasks_func.php, 2006/02/23 18:22:31 Attest sw-libre@attest.es Exp $*/
//ina $percent = array(0=>'0',5=>'5',10=>'10',15=>'15',20=>'20',25=>'25',30=>'30',35=>'35',40=>'40',45=>'45',50=>'50',55=>'55',60=>'60',65=>'65',70=>'70',75=>'75',80=>'80',85=>'85',90=>'90',95=>'95',100=>'100');
$percent = array(0 => '0', 25 => '25', 50 => '50', 75 => '75', 100 => 'Finalizada');
// patch 2.12.04 add all finished last 7 days, my finished last 7 days
$filters = array('my' => 'My Tasks', 'myunfinished' => 'My Unfinished Tasks', 'allunfinished' => 'All Unfinished Tasks', 'myproj' => 'My Projects', 'mycomp' => 'All Tasks for my Company', 'unassigned' => 'All Tasks (unassigned)', 'taskcreated' => 'All Tasks I Have Created', 'all' => 'All Tasks');
//'allfinished7days' => 'All Tasks Finished Last 7 Days',
//'myfinished7days'  => 'My Tasks Finished Last 7 Days'
$status = dPgetSysVal('TaskStatus');
$priority = array(-1 => 'low', 0 => 'normal', 1 => 'high');