/** * Renders factor control report search results * * @param int $jobtypeid * @param float $factor * * @return string */ public function facontrolRenderSearch($jobtypeid, $factor) { $result = ''; $jobtypeid = vf($jobtypeid, 3); $messages = new UbillingMessageHelper(); $tmpArr = array(); $allTasks = ts_GetAllTasks(); if (!empty($this->allJobs)) { foreach ($this->allJobs as $io => $each) { if ($jobtypeid == $each['jobtypeid']) { if (isset($tmpArr[$each['taskid']])) { $tmpArr[$each['taskid']] += $each['factor']; } else { $tmpArr[$each['taskid']] = $each['factor']; } } } } if (!empty($tmpArr)) { if (isset($this->allJobUnits[$jobtypeid])) { $unit = $this->unitTypes[$this->allJobUnits[$jobtypeid]]; } else { $unit = __('No'); } $cells = wf_TableCell(__('Task')); $cells .= wf_TableCell(__('Address')); $cells .= wf_TableCell(__('Target date')); $cells .= wf_TableCell(__('Job type')); $cells .= wf_TableCell(__('Who should do')); $cells .= wf_TableCell(__('Factor') . ' (' . $unit . ')'); $rows = wf_TableRow($cells, 'row1'); foreach ($tmpArr as $taskid => $factorOverflow) { if ($factorOverflow > $factor) { $cells = wf_TableCell(wf_Link(self::URL_TS . $taskid, $taskid)); $cells .= wf_TableCell(@$allTasks[$taskid]['address']); $cells .= wf_TableCell(@$allTasks[$taskid]['startdate']); $cells .= wf_TableCell(@$this->allJobtypes[$jobtypeid]); $cells .= wf_TableCell(@$this->allEmployeeRaw[$allTasks[$taskid]['employee']]); $cells .= wf_TableCell($factorOverflow); $rows .= wf_TableRow($cells, 'row3'); } } $result .= wf_TableBody($rows, '100%', 0, 'sortable'); } else { $result = $messages->getStyledMessage(__('Nothing found'), 'info'); } return $result; }
/** * Loads all of existing taskman tasks into protected property * * @return void */ protected function loadAllTasks() { $this->allTasks = ts_GetAllTasks(); }