avail_status = $context['avail_status']; $this->avail_edit = $context['avail_edit']; $this->link_view = $context['link_view']; $this->link_edit = $context['link_edit']; $this->status = $context['status']; $this->order = (empty($context['order'])) ? "ASC" : $context['order']; $this->method = (empty($context['method'])) ? "id" : $context['method']; } public function get_data() { global $database; $db_name = $this->db_name; $status = $this->status; $results = common_templates::get_all_templates_by_status($status); $count = 0; $return_results = array(); foreach($results AS $result) { $id = $result['id']; $template_name = $result['template_name']; $company_name = $result['company_name']; $type = $result['type']; $submitter = $result['submitter']; $date_submitted = $result['date_submitted']; $return_results[] = array( "id" => $id, "template_name" => $template_name, "company_name" => $company_name, "template_type" => $type, "submitter" => common_users::full_name($submitter), "date_submitted" => $date_submitted ); } $this->final_results = $return_results; return $this; } public function get_material_templates($quote_id = ''){ global $database; $db_name = $this->db_name; $status = $this->status; $client = common_quotes::get_details($quote_id); $results = common_templates::get_all_templates_by_type('Material Costing',$client['client_id']); $count = 0; $return_results = array(); if($results){ foreach($results AS $result) { $id = $result['id']; $template_name = $result['template_name']; $company_name = $result['company_name']; $type = $result['type']; $submitter = $result['submitter']; $date_submitted = $result['date_submitted']; $return_results[] = array( "id" => $id, "template_name" => $template_name, "company_name" => $company_name, "template_type" => $type, "submitter" => common_users::full_name($submitter), "date_submitted" => $date_submitted ); } } $this->final_results = $return_results; return $this; } public function get_labour_templates($quote_id = ''){ global $database; $db_name = $this->db_name; $status = $this->status; $quote = common_quotes::get_details($quote_id); $results = common_templates::get_all_templates_by_client($quote['client_id']); $count = 0; $return_results = array(); foreach($results AS $result) { $id = $result['id']; $template_name = $result['template_name']; $company_name = $result['company_name']; $type = $result['type']; $submitter = $result['submitter']; $date_submitted = $result['date_submitted']; $return_results[] = array( "id" => $id, "template_name" => $template_name, "company_name" => $company_name, "template_type" => $type, "submitter" => common_users::full_name($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); 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($results AS $key => $value) $new_normalised_results[] = $key; ?> 0) { ?>
Edit ID # Template Name Client Name Submitter
edit