class form_tasks { public $tid; public $id; public $db_name; public function __construct($context) { $this->tid = $context['tid']; $this->id = $context['id']; $this->db_name = $context['db_name']; } public function set() { global $database; $tid = $this->tid; $id = $this->id; $db_name = $this->db_name; if(!empty($tid)) { $query = " SELECT * FROM $db_name"."tasks WHERE id = '$tid' LIMIT 1"; $results = $database->getRow($query); $this->status = $results['status']; $this->task_name = $results['task_name']; $this->rate = $results['rate']; $this->unit = $results['unit']; $this->department_id = $results['department_id']; /*$this->first_name = $results['first_name']; $this->last_name = $results['last_name']; $this->phone = $results['phone']; $this->group = $results['group_id']; $this->photo = $results['photo']; $this->company = $results['company_id']; $this->location = $results['location_id']; */ } if($_POST['Submit'] == "Save") { $this->task_name = $_POST['task_name']; $this->rate = $_POST['rate']; $this->unit = $_POST['unit']; $this->department_id = $_POST['department_id']; /*$this->first_name = $_POST['first_name']; $this->last_name = $_POST['last_name']; $this->phone = $_POST['phone']; $this->group = $_POST['group']; $this->photo = $_POST['photo']; $this->company = $_POST['company']; $this->location = $_POST['location']; */ } $this->config['task_name'] = array("id"=> $id,"value"=> $this->task_name, "input_name" => "task_name", "name" => "Task Name","rule" => "required"); $this->config['rate'] = array("id"=> $id,"value"=> $this->rate, "input_name" => "rate", "name" => "Rate","rule" => "required"); $this->config['unit'] = array("id"=> $id,"value"=> $this->unit, "input_name" => "unit", "name" => "Unit","rule" => "required"); $this->config['department_id'] = array("id"=> $id,"value"=> $this->id, "input_name" => "department_id", "name" => "Department Name","rule" => "required"); /*$this->config['first_name'] = array("id"=> $id,"value"=> $this->first_name, "input_name" => "first_name", "name" => "First Name","rule" => "required"); $this->config['last_name'] = array("id"=> $id,"value"=> $this->last_name, "input_name" => "last_name", "name" => "Last Name","rule" => "required"); $this->config['phone'] = array("id"=> $id,"value"=> $this->phone, "input_name" => "phone", "name" => "Phone","rule" => "required"); $this->config['group'] = array("id"=> $id,"value"=> $this->group, "input_name" => "group", "name" => "Group","rule" => "required|numeric"); $this->config['photo'] = array("id"=> $id,"value"=> $this->photo, "input_name" => "photo", "name" => "Photo","rule" => "picture"); $this->config['company'] = array("id"=> $id,"value"=> $this->company, "input_name" => "company", "name" => "Company","rule" => "required|numeric"); $this->config['location'] = array("id"=> $id,"value"=> $this->location, "input_name" => "location", "name" => "Location","rule" => "required|numeric"); */ self::run_validation(); } public function run_validation() { $tid = $this->tid; $static_function = (($_POST['Submit'] == "")) ? "initial" : "validate"; $this->validation['task_name'] = validation::$static_function($this->config['task_name']); $this->validation['unit'] = validation::$static_function($this->config['unit']); $this->validation['rate'] = validation::$static_function($this->config['rate']); $this->validation['department_id'] = validation::$static_function($this->config['department_id']); /*$this->validation['first_name'] = validation::$static_function($this->config['first_name']); $this->validation['last_name'] = validation::$static_function($this->config['last_name']); $this->validation['phone'] = validation::$static_function($this->config['phone']); $this->validation['company'] = validation::$static_function($this->config['company']); $this->validation['location'] = validation::$static_function($this->config['location']); $this->validation['group'] = validation::$static_function($this->config['group']); $this->validation['photo'] = validation::$static_function($this->config['photo']); */ $this->reasons = validation::formalise($this->validation); } public function form() { global $database; $tid = $this->tid; $id = $this->id; $id=$this->department_id; $config = $this->config; $validation = $this->validation; $task = $this->task; $my_group = $_SESSION['user']['groups']; $my_branch = $_SESSION['user']['branch_id']; $my_username = $_SESSION['user']['id']; $options = array("class" => "medium"); $select_options = array("class" => "medium"); ?>
Department: | //$tasks['results'] = common_department::get_all_department(); //$tasks['chosen'] = $id; //echo $department_name=common_department::department_name($id); //bug::bug_array('dept',$department_name); //echo forms::input_select($config['department_id'],$validation['department_id'],$tasks,$select_options); ?> |
Task Name: |