id = $context['id']; $this->status_table = $context['status_table']; $this->status_id = $context['status']; $this->department_id = $context['department_id']; $this->sign_counter = 0; } public function set() { global $database; $id = $this->id; $pager = parse_url($_SERVER['HTTP_REFERER']); $pages = $pager['query']; $this->client_type = 1; if(!empty($id)) { if(preg_match('/quote_/',$pages)) { $request = common_quotes::get_quotes_details($id); } else { $request = common_jobs::get_jobs_details($id); } $this->company_id = $request['client_id']; $this->primary_location_id = $request['primary_location_id']; $location_details = common_ref_client::get_client_location($this->primary_location_id); $this->address = $location_details['address']; $this->suburb = $location_details['suburb']; $this->state = $location_details['state']; $this->post_code = $location_details['post_code']; $this->phone = $request['phone']; $this->job_number = $request['job_number']; $this->company = $request['company_name']; $this->address = $request['address']; $this->job_name = $request['job_name']; $this->description = $request['description']; $this->phone = $request['phone']; $this->flag = $request['flag']; $this->jobtypes= unserialize($request['jobtype']); if(is_array($this->jobtypes)) { foreach($this->jobtypes as $k ) { $newk = explode('=>',$k); $this->$newk[0] = $newk[1]; $this->config{$newk[0]} = array("id"=> $id,"value"=> $newk[1], "input_name" => $newk[0], "name" => $newk[0],"rule" => ""); } } } if($_POST['Submit'] == "Save") { $this->company_name = $_POST['company_name']; $this->company_id = $_POST['company_id']; $this->address = $_POST['address']; $this->job_number = $_POST['job_number']; $this->description = $_POST['description']; $this->job_type = $_POST['jobtype']; $this->company = $_POST['company']; $this->flag =$_POST['flag']; foreach($_POST as $post => $pp) { if (preg_match("/jobtype/i", $post)) { //echo $post; $this->$post = $pp; } } foreach($_POST as $sign => $ss) { if (preg_match("/signtype/i", $sign)) { //echo $post; $this->$sign = $ss; } } if($this->sign_counter > 0) { $this->reasons .= "Required at least one"; } } $this->config['company_name'] = array("id"=> $id,"value"=> $this->company_name, "input_name" => "company_name", "name" => "Company Name","rule" => ""); $this->config['company'] = array("id"=> $id,"value"=> $this->company, "input_name" => "company", "name" => "Company Name","rule" => "required"); $this->config['company_id'] = array("id"=> $id,"value"=> $this->company_id, "input_name" => "company_id", "name" => "Company ID","rule" => ""); $this->config['address'] = array("id"=> $id,"value"=> $this->address, "input_name" => "address", "name" => "Address","rule" => "required"); $this->config['job_number'] = array("id"=> $id,"value"=> $this->job_number, "input_name" => "job_number", "name" => "Job Number","rule" => "required"); $this->config['description'] = array("id"=> $id,"value"=> $this->description, "input_name" => "description", "name" => "Description","rule" => "required"); $this->config['jobtype_id'] = array("id"=> $id,"value"=> $this->jobtype_id, "input_name" => "jobtype_id", "name" => "Job Type ID","rule" => ""); foreach($_POST as $post => $pp) { if (preg_match("/jobtype/i", $post)) { //echo $post; $this->config{$post} = array("id"=> $id,"value"=> $pp, "input_name" => $post, "name" => $post,"rule" => ""); } } foreach($_POST as $sign => $ss) { if (preg_match("/signtype/i", $sign)) { //echo $post; $this->config{$sign} = array("id"=> $id,"value"=> $ss, "input_name" => $sign, "name" => $sign,"rule" => "required"); } } self::run_validation(); } public function run_validation() { $static_function = (($_POST['Submit'] == "")) ? "initial" : "validate"; $this->validation['company_name'] = validation::$static_function($this->config['company_name']); $this->validation['company'] = validation::$static_function($this->config['company']); $this->validation['company_id'] = validation::$static_function($this->config['company_id']); $this->validation['address'] = validation::$static_function($this->config['address']); $this->validation['job_number'] = validation::$static_function($this->config['job_number']); $this->validation['description'] = validation::$static_function($this->config['description']); foreach($_POST as $post => $pp) { if (preg_match("/jobtype/i", $post)) { //echo $post; $this->validation{$post} = validation::$static_function($this->config{$post}); } } foreach($_POST as $sign => $ss) { if (preg_match("/signtype/i", $sign)) { //echo $post; $this->sign_counter++; $this->validation{$sign} = validation::$static_function($this->config{$sign}); } } $this->validation['jobtype_id'] = validation::$static_function($this->config['jobtype_id']); $this->reasons = validation::formalise($this->validation); } public function form() { global $database; $id = $this->id; $status_table = $this->status_table; $status_id = $this->status_id; $department_id = $this->department_id; $flag = $this->flag; $company = $this->company; $job_number = $this->job_number; $company_id = $this->company_id; $address = $this->address; $job_name = $this->job_name; $description = $this->description; $phone = $this->phone; $fax = $this->fax; $jobtypes=$this->jobtypes; ?>
',$k); $this->$newk[0] = $newk[1]; $config{$newk[0]} = array("id"=> $id,"value"=> $newk[1], "input_name" => $newk[0], "name" => $newk[0],"rule" => ""); } ?> $val) { $validation['input_name']= 'signtype_'.$key; $checked = $config['signtype_'.$key]['value']; if($checked == 1) { $checked =''; $result['results'] = array(array("id"=> "yes", "name"=> "Yes"),array("id" =>"no","name"=>"No")); echo ''; } $subs= common_jobtypes::get_all_subjobtypes($key); if(common_jobtypes::is_signtype($key )==0 && common_jobtypes::is_signtype($key +1)==1) { echo ''; } if(count($subs) > 0 ) { foreach($subs as $k=>$v) { $validation['input_name'] = 'jobtype_'.$k; if($config['jobtype_'.$k]['value'] == "") { $result['chosen'] = "0"; } else { $result['chosen'] = $config['jobtype_'.$k]['value']; } $result['results'] = array(array("id"=> "yes", "name"=> "Yes"),array("id" =>"no","name"=>"No")); if($result['chosen'] == '1') { $checked =' '; echo ''; } $subs_level2= common_jobtypes::get_all_subjobtypes($k); //bug::bug_array('',$subs_level2); if(count($subs_level2) > 0) { echo ''; foreach($subs_level2 as $k2=>$v2) { $validation['input_name'] = 'jobtype_'.$k2; if($config['jobtype_'.$k2]['value'] == "") { $result['chosen'] = "0"; } else { $result['chosen'] = $config['jobtype_'.$k2]['value']; } $result['results'] = array(array("id"=> "yes", "name"=> "Yes"),array("id" =>"no","name"=>"No")); if($result['chosen'] == '1') { $checked =' '; echo ''; } //$result['chosen'] = $config['jobtype_'.$k2]['value']; $checked3 = $config['jobtype_'.$k2]['value']; $result['results'] = array(array("id"=> "yes", "name"=> "Yes"),array("id" =>"no","name"=>"No")); if(!$checked2) { $options3['attr'] = array("disabled" =>"disabled"); } $options3['class'] = 'class="signclass_'.$k.'"'; if($checked3) { $show2 = 'block'; } else { $show2 = 'none'; } } echo ''; } } } } $config['value']=$_GET['id']; $validation['input_name'] = "request_id"; ?>
'. $checked .'   '.$val.'
Sign Type
         '.$checked.''.$v.'
               '.$checked.''.$v2.'