direction = $context['direction']; $this->foreign_status = $context['foreign_status']; $this->foreign_id = $context['foreign_id']; $this->table = $context['table']; $this->readonly = $context['readonly']; $this->show_all = $context['show_all']; parent::set_data($context); $this->method = (empty($context['list_config']['method'])) ? "date_created" : $context['list_config']['method']; } public function get_data() { global $database; $direction = $this->direction; $foreign_id = $this->foreign_id; $table = $this->table; $show_all = $this->show_all; $readonly = $this->readonly; $my_departments = $_SESSION['user']['department_id']; $my_group = $_SESSION['user']['group_id']; $foreign_types['quotes'] = "Quote"; $foreign_types['jobs'] = "Job"; $priorities[0] = "Medium"; $priorities[1] = "High"; $priorities[2] = "Medium"; $priorities[3] = "Low"; $active_status = $this->foreign_status; $where_sql = ""; $where_sql .= (empty($table)) ? "" : " AND `table` = '$table' "; $where_sql .= (empty($foreign_id)) ? "" : " AND foreign_id = '$foreign_id' "; $tasks_groups = common_workflow::get_all_workflow_groups(); $tasks_departments = common_workflow::get_all_workflow_departments(); $departments = common_department::get_all_department(); $users = common_users::get_all_names_link(); $sql =" SELECT * FROM project_workflow WHERE direction = '$direction' $where_sql "; $results = $database->query($sql); $count = 0; $return_results = array(); $workflows = common_workflow::get_all_workflow(); foreach($results AS $result) { $current_status = ($result['table'] == "jobs") ? common_jobs::get_status($result['foreign_id']) : common_quotes::get_status($result['foreign_id']); if($current_status == $active_status) { $result['description'] = $workflows[$result['workflow_id']]['name']; $result['submitter'] = $users[$result['submitter']]; $result['type'] = $foreign_types[$result['table']]; $result['id_type'] = $foreign_types[$result['table']]." #".$result['foreign_id']; $result['client_name'] = common_project_actions::get_client_name($result['foreign_id'],$result['table']); $foreign_details = common_project_actions::get_foreign_details($result['foreign_id'],$result['table']); if($result['table'] == "quotes") { $result['job_id'] = $foreign_details['job_id']; $result['quote_id'] = $result['foreign_id']; } else if($result['table'] == "jobs") { $result['job_id'] = $result['foreign_id']; $result['quote_id'] = $foreign_details['quote_id']; } $result['job_name'] = $foreign_details['job_name']; $result['job_type'] = $foreign_details['job_type']; $result['priority'] = $priorities[$foreign_details['priority']]; $task_departments = $tasks_departments[$result['workflow_id']]; $task_groups = $tasks_groups[$result['workflow_id']]; $result['department'] = common_project_actions::get_departments(array("task_departments" => $task_departments,"departments" => $departments)); $result['owner'] = common_project_actions::get_owners(array("groups" => $task_groups,"departments" => $task_departments)); $job_allocate_to = common_quotes::get_sales_alloc($result['quote_id']); if($my_group==43){ $permission = true; }else{ $permission = common_project_tasks::check_permission(array("my_group" => $my_group, "my_departments" => $my_departments, "tasks_groups" => $task_groups, "tasks_departments" => $task_departments, "user_alloc"=>$job_allocate_to)); } if($show_all == false) { if($permission) $return_results[] = $result; } else { if(!$permission) $result['action'] = "Pending Decision"; if($readonly) $result['action'] = ""; $return_results[] = $result; } } } $this->final_results = $return_results; self::prepare(); return $this; } public function list_body() { $results = $this->final_results; $avail_status = $this->avail_status; $avail_edit = $this->avail_edit; $link_view = $this->link_view; $link_edit = $this->link_edit; $columns = $this->columns; $sortable = $this->sortable; $pagination = $this->pagination; $start = $this->start; $size = $this->size; $total_results = $this->total_results; $max_size = $this->max_size; $normalise_get = $this->normalise_get; $new_normalised_results = $this->normalised_results; $count = 0; if(count($results) > 0) { ?>edit $value) { if($value['view'] == true) { ?>New list_footer(); } return $this; } public function show_as_divs() { $foreign_types['quotes'] = "Quote"; $foreign_types['jobs'] = "Job"; $results = $this->final_results; $avail_status = $this->avail_status; $avail_edit = $this->avail_edit; $link_view = $this->link_view; $link_edit = $this->link_edit; $columns = $this->columns; $sortable = $this->sortable; $pagination = $this->pagination; $start = $this->start; $size = $this->size; $total_results = $this->total_results; $max_size = $this->max_size; $normalise_get = $this->normalise_get; $new_normalised_results = $this->normalised_results; $count_results = 0; $count = 0; if(count($results) > 0) { for($i = $start; $i < $max_size; $i++) { $key = $new_normalised_results[$i]; $id = $results[$key]['id']; $table = $results[$key]['table']; $foreign_id = $results[$key]['foreign_id']; $workflow_id = $results[$key]['workflow_id']; $description = $results[$key]['description']; ?>
# -     readonly == false) { ?>yes / no
Nothing to see here!