class form_job_checklist { public $id; public $user_id; public $config; public $validation; public $reasons; public function __construct($context) { $this->id = $context['id']; } public function set() { global $database; $id = $this->id; //$database->debug = true; if(!empty($id)) { $checklist = common_jobs::get_checklist($id); if(empty($checklist)) { $quote_id = common_quotes::get_quote_id($id); $checklist = common_quotes::get_checklist($quote_id); } $this->form_date = common_leaves::change_date_format($checklist['form_date']); $this->start_date = common_leaves::change_date_format($checklist['start_date']); $this->completion_date = common_leaves::change_date_format($checklist['completion_date']); $this->installation_method = $checklist['installation_method']; $this->ground_scan = $checklist['ground_scan']; $this->powerlines = $checklist['powerlines']; $this->spotter = $checklist['spotter']; $this->traffic_management = $checklist['traffic_management']; $this->town_planning_permit = $checklist['town_planning_permit']; $this->footway_permit = $checklist['footway_permit']; $this->hotworks = $checklist['hotworks']; $this->reporting = $checklist['reporting']; $this->assumptions = $checklist['assumptions']; $this->special_requirement = $checklist['special_requirement']; } if($_POST['Submit'] == "Save") { $this->form_date = $_POST['form_date']; $this->start_date = $_POST['start_date']; $this->completion_date = $_POST['completion_date']; $this->installation_method = $_POST['installation_method']; $this->ground_scan = $_POST['ground_scan']; $this->powerlines = $_POST['powerlines']; $this->spotter = $_POST['spotter']; $this->traffic_management = $_POST['traffic_management']; $this->town_planning_permit = $_POST['town_planning_permit']; $this->footway_permit = $_POST['footway_permit']; $this->hotworks = $_POST['hotworks']; $this->reporting = $_POST['reporting']; $this->assumptions = $_POST['assumptions']; $this->special_requirement = $_POST['special_requirement']; } $this->config['form_date'] = array("id"=> $id,"value"=> $this->form_date, "input_name" => "form_date", "name" => "Dated","rule" => "required"); $this->config['start_date'] = array("id"=> $id,"value"=> $this->start_date, "input_name" => "start_date", "name" => "Required delivery/on site start date","rule" => ""); $this->config['completion_date'] = array("id"=> $id,"value"=> $this->completion_date, "input_name" => "completion_date", "name" => "Required completion date","rule" => ""); $this->config['installation_method'] = array("id"=> $id,"value"=> $this->installation_method, "input_name" => "installation_method", "name" => "Installation","rule" => ""); $this->config['ground_scan'] = array("id"=> $id,"value"=> $this->ground_scan, "input_name" => "ground_scan", "name" => "Ground Scan","rule" => ""); $this->config['powerlines'] = array("id"=> $id,"value"=> $this->powerlines, "input_name" => "powerlines", "name" => "Powerlines","rule" => ""); $this->config['spotter'] = array("id"=> $id,"value"=> $this->spotter, "input_name" => "spotter", "name" => "Spotter","rule" => ""); $this->config['traffic_management'] = array("id"=> $id,"value"=> $this->traffic_management, "input_name" => "traffic_management", "name" => "Trafc Management","rule" => ""); $this->config['town_planning_permit'] = array("id"=> $id,"value"=> $this->town_planning_permit, "input_name" => "town_planning_permit", "name" => "Town Planning Permit","rule" => ""); $this->config['footway_permit'] = array("id"=> $id,"value"=> $this->footway_permit, "input_name" => "footway_permit", "name" => "Footway Permit","rule" => ""); $this->config['hotworks'] = array("id"=> $id,"value"=> $this->hotworks, "input_name" => "hotworks", "name" => "Hotworks","rule" => ""); $this->config['reporting'] = array("id"=> $id,"value"=> $this->reporting, "input_name" => "reporting", "name" => "External and internal reporting requirement","rule" => ""); $this->config['assumptions'] = array("id"=> $id,"value"=> $this->assumptions, "input_name" => "assumptions", "name" => "Project assumptions made during pricing proces","rule" => ""); $this->config['special_requirement'] = array("id"=> $id,"value"=> $this->special_requirement, "input_name" => "special_requirement", "name" => "Other special requirements / instructions","rule" => ""); self::run_validation(); } public function run_validation() { $static_function = (($_POST['Submit'] == "")) ? "initial" : "validate"; $this->validation['form_date'] = validation::$static_function($this->config['form_date']); $this->validation['start_date'] = validation::$static_function($this->config['start_date']); $this->validation['completion_date'] = validation::$static_function($this->config['completion_date']); $this->validation['installation_method'] = validation::$static_function($this->config['installation_method']); $this->validation['ground_scan'] = validation::$static_function($this->config['ground_scan']); $this->validation['powerlines'] = validation::$static_function($this->config['powerlines']); $this->validation['spotter'] = validation::$static_function($this->config['spotter']); $this->validation['traffic_management'] = validation::$static_function($this->config['traffic_management']); $this->validation['town_planning_permit'] = validation::$static_function($this->config['town_planning_permit']); $this->validation['footway_permit'] = validation::$static_function($this->config['footway_permit']); $this->validation['hotworks'] = validation::$static_function($this->config['hotworks']); $this->validation['reporting'] = validation::$static_function($this->config['reporting']); $this->validation['assumptions'] = validation::$static_function($this->config['assumptions']); $this->validation['special_requirement'] = validation::$static_function($this->config['special_requirement']); $this->reasons = validation::formalise($this->validation); } public function form() { global $database; $id = $this->id; $config = $this->config; $validation = $this->validation; $options = array("class" => "medium"); $options_large = array("class" => "large"); $options_small = array("class" => "small"); $options_select = array("class" => "medium form"); $options_very_small = array("style" => "width:25px;"); $disabled = true; $table_class = (empty($form_type)) ? "tab_form" : ""; ?>
Date: |