status = $context['status']; $this->method = (empty($context['method'])) ? "ordering" : $context['method']; $this->order = ASC; } public function get_data() { global $database; $status = $this->status; $results = common_jobs::get_all_active_jobs_for_tablet_sort_ordering(); $users = common_users::get_all_names_link(); $locations = common_location::get_locations(); $quote_types = common_quotes::get_all_quotes(); $job_type[0] = "Single Site"; $job_type[1] = "Single Site"; $job_type[2] = "Multi Site"; $job_type[3] = "LED Media"; $job_type[4] = "Cost Plus"; $priorities[0] = "Medium"; $priorities[1] = "High"; $priorities[2] = "Medium"; $priorities[3] = "Low"; $context_workflow = array( "readonly" => false, "show_all" => true ); $context_workflow['table'] = 'jobs'; $context_workflow['list_config'] = array( "method" => "date_created", "order" => $_GET['order'], "avail_edit" => false, "avail_status" => false, "link_view" => "", "link_edit" => "", "show_search" => false, "show_pagination" => false, "sortable" => false ); $return_results = array(); foreach($results AS $result) { $result['client_name'] = common_ref_client::get_client_name($result['client_id']); $result['site_location'] = $locations[$result['location_id']]['name']; $result['submitter'] = $users[$result['submitter']]; $result['job_type'] = $job_type[$quote_types[$result['quote_id']]['name']]; $result['star'] = ($result['parent_job'] == 1) ? "*" : ""; $result['priority'] = $priorities[$result['priority']]; $result['ordering'] = $result['ordering']; $stat = ""; $stat_count = 1; $context_workflow['foreign_id'] = $result['id']; $context_workflow['foreign_status'] = $result['status']; $context_workflow['status'] = 0; $result['departments'] = ""; $allocate_to = ""; $tasks = new list_workflow_tasks($context_workflow); $tasks->get_data(); $tasks_list = $tasks->final_results; if(count($tasks_list) > 0) foreach($tasks_list AS $task) { $stat .= $stat_count.".".$task['description']." - task
"; $result['departments'] .= $task['department'].","; $allocate_to .= (!empty($task['allocate_link'])) ? $task['allocate_link']."," : $task['owner'].","; $stat_count++; } $context_workflow['status'] = 1; $context_workflow['main_status'] = 0; $approvals = new list_workflow_tasks_approvals($context_workflow); $approvals->get_data(); $approval_list = $approvals->final_results; if(count($approval_list) > 0) foreach($approval_list AS $approval) { $stat .= $stat_count.".".$approval['description']." - approval
"; $result['departments'] .= $approval['department'].","; $allocate_to .= $approval['owner'].","; $stat_count++; } $context_workflow['direction'] = ""; $actions = new list_workflow_actions($context_workflow); $actions->get_data(); $action_list = $actions->final_results; if(count($action_list) > 0) foreach($action_list AS $action) { $stat .= $stat_count.".".$action['description']." - decision
"; $result['departments'] .= $action['department'].","; $allocate_to .= $action['owner'].","; $stat_count++; } $allocate_to = substr($allocate_to,0,strlen($allocate_to) - 1); $allocate_arr = explode(",",$allocate_to); $new_allocate_arr = array_unique($allocate_arr); $result['allocate_to'] = implode(",",$new_allocate_arr); $result['departments'] = substr($result['departments'],0,strlen($result['departments']) - 1); $result['workflow_status'] = (empty($stat)) ? "-" : $stat; $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) { ?> list_footer(); } return $this; } public function get_data_all() { global $database; $results =common_jobs::get_all_active_jobs_for_tablet(); $count = 0; $return_results = array(); foreach($results AS $result) { $id = $result['id']; $job_id = $result['job_id']; $client_id = $result['client_id']; $client_name = common_clients::get_client_name($client_id); $job_name = $result['job_name']; $job_number = $result['job_number']; $description = $result['description']; $location_id = $result['location_id']; $stage_id = $result['stage_id']; $depts = explode(':',$result['department_id']); $dept_id = $result['department_id']; $status = explode(':',$result['status']); $cnt= count($status); $dept_array=array_map(null,$depts,$status); $submitter = $result['submitter']; $date_submitted = $result['date_submitted']; $return_results[] = array( "id" => $id, "client_id" => $client_id, "client_name" => $client_name, "department_id" => $department_id, "dept_id" => $dept_id, "job_id" => $job_id , "job_name" => $job_name, "job_number" => $job_number, "description" => $description, "location_id" => $location_id, "company_name" => $company_name, "department_name" => $department_name, "stage_name" => $stage_name, "status" => $status, "status1" => $status1, "status_name" => $status_name, "status_name1" => $status_name1, "submitter" => $submitter, "date_submitted" => $date_submitted ); } $this->final_results = $return_results; return $this; } public function show() { global $database; $order = $this->order; $method = $this->method; $results = $this->final_results; $avail_status = $this->avail_status; $avail_edit = $this->avail_edit; $link_view = $this->link_view; $link_edit = $this->link_edit; $normalised_results = filter::sort_results($method,$order,$results); $normalise_get = filter::normalise_get($order); $pagination_results = filter::pagination($normalised_results,$normalise_get); $pagination_results['show_pagination'] = $this->show_pagination; $pagination_results['show_search'] = $this->show_search; filter::pagination_html($pagination_results); $pagination = $pagination_results['pagination']; $start = $pagination_results['start']; $size = $pagination_results['size']; $total_results = $pagination_results['total_results']; $max_size = $pagination_results['max_size']; $order = ($order == "ASC") ? "DESC" : "ASC"; $normalise_get = filter::normalise_get($order); $new_normalised_results = array(); foreach($normalised_results AS $key => $value) $new_normalised_results[] = $key; ?> 0) { ?>
Edit Job # Client Job Name Stage Department Status Submitter
edit
                  
order; $method = $this->method; $results = $this->final_results; $avail_status = $this->avail_status; $avail_edit = $this->avail_edit; $link_view = $this->link_view; $link_edit = $this->link_edit; $normalised_results = filter::sort_results($method,$order,$results); $normalise_get = filter::normalise_get($order); $pagination_results = filter::pagination($normalised_results,$normalise_get); //filter::pagination_html($pagination_results); //$pagination = $pagination_results['pagination']; $start = $pagination_results['start']; $size = $pagination_results['size']; $total_results = $pagination_results['total_results']; $max_size = $pagination_results['max_size']; $order = ($order == "ASC") ? "DESC" : "ASC"; $normalise_get = filter::normalise_get($order); $new_normalised_results = array(); foreach($normalised_results AS $key => $value) $new_normalised_results[] = $key; ?>
0) { ?>
Job ID Client Description