Example #1
0
 public function get_row(midcom_core_dbaobject $task)
 {
     $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX);
     $task_url = $prefix . "task/{$task->guid}/";
     $celldata = $this->get_table_row_data($task, $this->_request_data);
     $manager_card = org_openpsa_widgets_contact::get($task->manager);
     $entry = array();
     $entry['id'] = $task->id;
     $entry['index_task'] = $task->title;
     $entry['task'] = '<a href="' . $task_url . '"><img class="status-icon" src="' . MIDCOM_STATIC_URL . '/stock-icons/16x16/' . $task->get_icon() . '" /> ' . $task->title . '</a>';
     if ($this->_request_data['view_identifier'] == 'my_tasks' || $this->_request_data['view_identifier'] == 'project_tasks') {
         $entry['status_control'] = org_openpsa_projects_workflow::render_status_control($task);
         $status_type = $this->_get_status_type($task);
         $entry['index_status'] = $this->_status_order[$status_type];
         $entry['status'] = $this->_l10n->get($status_type . ' tasks');
         $controls = $this->_render_workflow_controls($task);
         if ($controls != '') {
             $entry['task'] = '<div class="title">' . $entry['task'] . '</div><div class="details">' . $controls . '</div>';
         }
     }
     $entry['index_project'] = $celldata['index_parent'];
     $entry['project'] = $celldata['parent'];
     $entry['index_priority'] = $task->priority;
     $entry['priority'] = $task->priority;
     if (isset($this->_request_data['priority_array']) && array_key_exists($task->priority, $this->_request_data['priority_array'])) {
         $entry['priority'] = '<span title="' . $this->_l10n->get($this->_request_data['priority_array'][$task->priority]) . '">' . $task->priority . '</span>';
     }
     if ($this->_request_data['view_identifier'] != 'agreement') {
         $entry['index_customer'] = $celldata['index_customer'];
         $entry['customer'] = $celldata['customer'];
     }
     $entry['manager'] = $manager_card->show_inline();
     $entry['index_manager'] = preg_replace('/<span.*?class="uid".*?>.*?<\\/span>/', '', $entry['manager']);
     $entry['index_manager'] = strip_tags($entry['index_manager']);
     $entry['start'] = strftime('%Y-%m-%d', $task->start);
     $entry['end'] = strftime('%Y-%m-%d', $task->end);
     if ($this->_request_data['view_identifier'] != 'project_tasks') {
         $entry['index_reported'] = $task->reportedHours;
         $entry['reported'] = round($task->reportedHours, 2);
         if ($task->plannedHours > 0) {
             $entry['reported'] .= ' / ' . round($task->plannedHours, 2);
         }
     } else {
         $entry['planned_hours'] = $task->plannedHours;
         $entry['invoiced_hours'] = $task->invoicedHours;
         $entry['approved_hours'] = $task->approvedHours;
         $entry['reported_hours'] = $task->reportedHours;
     }
     return $entry;
 }