/** * Get Request Handler * * This method is called when a request is a GET * * @return array */ public function executeGet() { $valid = $this->hasRequiredParameters($this->requiredParams); if ($valid instanceof Frapi_Error) { return $valid; } $username = $this->getParam('username'); $password = $this->getParam('password'); // Attempt to login as user, a little bit of a hack as we currently // require the $_POST['login'] var to be set as well as a global AppUI $AppUI = new CAppUI(); $GLOBALS['AppUI'] = $AppUI; $_POST['login'] = '******'; if (!$AppUI->login($username, $password)) { throw new Frapi_Error('INVALID_LOGIN'); } $task = new CTask(); $tasks = $task->getAllowedRecords($AppUI->user_id); $return_tasks = array(); foreach ($tasks as $task_id => $task_name) { $temp_task = new CTask(); $temp_task->loadFull($AppUI, $task_id); unset($temp_task->_query, $temp_task->_error, $temp_task->_tbl_prefix, $temp_task->_tbl, $temp_task->_tbl_key, $temp_task->_tbl_module); $return_tasks[$task_id] = (array) $temp_task; } $this->data['tasks'] = $return_tasks; $this->data['success'] = true; $this->setTemplateFileName('TasksGet'); return $this->toArray(); }
} $task_id = (int) w2PgetParam($_GET, 'task_id', 0); $task_log_id = (int) w2PgetParam($_GET, 'task_log_id', 0); $reminded = (int) w2PgetParam($_GET, 'reminded', 0); // check permissions for this record $canRead = canView($m, $task_id); $canEdit = canEdit($m, $task_id); $canDelete = canDelete($m, $task_id); if (!$canRead) { $AppUI->redirect('m=public&a=access_denied'); } $perms =& $AppUI->acl(); // check if this record has dependencies to prevent deletion $msg = ''; $obj = new CTask(); $obj->loadFull(null, $task_id); if (!$obj) { $AppUI->setMsg('Task'); $AppUI->setMsg('invalidID', UI_MSG_ERROR, true); $AppUI->redirect(); } else { $AppUI->savePlace(); } if (!$obj->canAccess($AppUI->user_id)) { $AppUI->redirect('m=public&a=access_denied'); } // Clear any reminders if ($reminded) { $obj->clearReminder(); } $tab = $AppUI->processIntState('TaskLogVwTab', $_GET, 'tab', 0);
} $task_id = (int) w2PgetParam($_GET, 'task_id', 0); $task_log_id = (int) w2PgetParam($_GET, 'task_log_id', 0); $reminded = (int) w2PgetParam($_GET, 'reminded', 0); // check permissions for this record $canRead = canView($m, $task_id); $canEdit = canEdit($m, $task_id); $canDelete = canDelete($m, $task_id); if (!$canRead) { $AppUI->redirect('m=public&a=access_denied'); } $perms =& $AppUI->acl(); // check if this record has dependencies to prevent deletion $msg = ''; $obj = new CTask(); $obj->loadFull($AppUI, $task_id); if (!$obj) { $AppUI->setMsg('Task'); $AppUI->setMsg('invalidID', UI_MSG_ERROR, true); $AppUI->redirect(); } else { $AppUI->savePlace(); } if (!$obj->canAccess($AppUI->user_id)) { $AppUI->redirect('m=public&a=access_denied'); } // Clear any reminders if ($reminded) { $obj->clearReminder(); } $tab = $AppUI->processIntState('TaskLogVwTab', $_GET, 'tab', 0);
function getTaskTooltip($task_id, $starts = false, $ends = false, $tasks_tips) { global $AppUI; if (!$task_id) { return ''; } $df = $AppUI->getPref('SHDATEFORMAT'); $tf = $AppUI->getPref('TIMEFORMAT'); $task = new CTask(); // load the record data $task->loadFull($AppUI, $task_id); // load the event types $types = w2PgetSysVal('TaskType'); $assigned = $task->getAssigned(); $start_date = (int) $task->task_start_date ? new w2p_Utilities_Date($AppUI->formatTZAwareTime($task->task_start_date, '%Y-%m-%d %T')) : null; $end_date = (int) $task->task_end_date ? new w2p_Utilities_Date($AppUI->formatTZAwareTime($task->task_end_date, '%Y-%m-%d %T')) : null; // load the record data $task_project = $task->project_name; $task_company = $task->company_name; $tt = '<table border="0" cellpadding="0" cellspacing="0" width="96%">'; $tt .= '<tr>'; $tt .= ' <td valign="top" width="40%">'; $tt .= ' <strong>' . $AppUI->_('Details') . '</strong>'; $tt .= ' <table cellspacing="3" cellpadding="2" width="100%">'; $tt .= ' <tr>'; $tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;" align="right" nowrap="nowrap">' . $AppUI->_('Company') . '</td>'; $tt .= ' <td width="100%">' . $task_company . '</td>'; $tt .= ' </tr>'; $tt .= ' <tr>'; $tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;" align="right" nowrap="nowrap">' . $AppUI->_('Project') . '</td>'; $tt .= ' <td width="100%">' . $task_project . '</td>'; $tt .= ' </tr>'; $tt .= ' <tr>'; $tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;" align="right" nowrap="nowrap">' . $AppUI->_('Type') . '</td>'; $tt .= ' <td width="100%" nowrap="nowrap">' . $AppUI->_($types[$task->task_type]) . '</td>'; $tt .= ' </tr> '; $tt .= ' <tr>'; $tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;" align="right" nowrap="nowrap">' . $AppUI->_('Progress') . '</td>'; $tt .= ' <td width="100%" nowrap="nowrap"><strong>' . sprintf("%.1f%%", $task->task_percent_complete) . '</strong></td>'; $tt .= ' </tr> '; $tt .= ' <tr>'; $tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;" align="right" nowrap="nowrap">' . $AppUI->_('Starts') . '</td>'; $tt .= ' <td nowrap="nowrap">' . ($starts ? '<strong>' : '') . ($start_date ? $start_date->format($df . ' ' . $tf) : '-') . ($starts ? '</strong>' : '') . '</td>'; $tt .= ' </tr>'; $tt .= ' <tr>'; $tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;" align="right" nowrap="nowrap">' . $AppUI->_('Ends') . '</td>'; $tt .= ' <td nowrap="nowrap">' . ($ends ? '<strong>' : '') . ($end_date ? $end_date->format($df . ' ' . $tf) : '-') . ($ends ? '</strong>' : '') . '</td>'; $tt .= ' </tr>'; $tt .= ' <tr>'; $tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;" align="right" nowrap="nowrap">' . $AppUI->_('Assignees') . '</td>'; $tt .= ' <td nowrap="nowrap">'; if (is_array($assigned)) { $start = false; foreach ($assigned as $user) { if ($start) { $tt .= '<br/>'; } else { $start = true; } $tt .= $user['user_name'] . ' ' . $user['perc_assignment'] . '%'; } } $tt .= ' </tr>'; $tt .= ' </table>'; $tt .= ' </td>'; $tt .= ' <td width="60%" valign="top">'; $tt .= ' <strong>' . $AppUI->_('Description') . '</strong>'; $tt .= ' <table cellspacing="0" cellpadding="2" border="0" width="100%">'; $tt .= ' <tr>'; $tt .= ' <td style="border: 1px solid white;-moz-border-radius:3.5px;-webkit-border-radius:3.5px;">'; $tt .= ' ' . $task->task_description; $tt .= ' </td>'; $tt .= ' </tr>'; $tt .= ' </table>'; $tt .= ' </td>'; $tt .= '</tr>'; $tt .= '</table>'; return $tt; }
echo $AppUI->_('Actual Cost'); ?> </th> <th width="10px" align="center"><?php echo $AppUI->_('Difference'); ?> </th> </tr> <?php //TODO: rotate the headers by 90 degrees? $task = new CTask(); $taskList = $task->getAllowedTaskList(null, $project_id); $bcode = new CSystem_Bcode(); if (count($taskList)) { foreach ($taskList as $taskItem) { $task->loadFull(null, $taskItem['task_id']); $costs = $bcode->calculateTaskCost($taskItem['task_id'], $start_date->format(FMT_DATETIME_MYSQL), $end_date->format(FMT_DATETIME_MYSQL)); $tstart = new w2p_Utilities_Date($task->task_start_date); $tend = new w2p_Utilities_Date($task->task_end_date); $filterStart = $start_date; $filterEnd = $end_date; $workingDaysInSpans = $filterStart->findDaysInRangeOverlap($tstart, $tend, $filterStart, $filterEnd); $workingDaysForTask = $tstart->workingDaysInSpan($tend); $factor = $workingDaysInSpans / $workingDaysForTask; $factor = $factor > 1 ? 1 : $factor; ?> <tr> <td align="center"><?php echo sprintf('%.0f%%', $task->task_percent_complete); ?> </td>