Example #1
0
 public function screen_delete_project()
 {
     $this->title = "削除ページ";
     $this->file = "customer_top.tpl";
     $btn1 = "";
     $btn2 = "";
     if (isset($_POST['id'])) {
         $id = $_POST['id'];
         $_SESSION['id'] = $id;
         $CustomerModel = new CustomerModel();
         $project_data = $CustomerModel->get_project_raw($id);
         $default_t_start = array('Y' => substr($project_data['t_start'], 0, 4), 'm' => substr($project_data['t_start'], 4, 2), 'd' => substr($project_data['t_start'], 6, 2));
         $default_t_end = array('Y' => substr($project_data['t_end'], 0, 4), 'm' => substr($project_data['t_end'], 4, 2), 'd' => substr($project_data['t_end'], 6, 2));
         $default_shift_start = array('H' => substr($project_data['shift_start'], 0, 2), 'i' => substr($project_data['shift_start'], 2, 2));
         $default_shift_end = array('H' => substr($project_data['shift_end'], 0, 2), 'i' => substr($project_data['shift_end'], 2, 2));
         $setDefaults = array('valid' => $project_data['valid'], 'project_type' => $project_data['project_type'], 't_start' => $default_t_start, 't_end' => $default_t_end, 'shift_start' => $default_shift_start, 'shift_end' => $default_shift_end, 'title' => $project_data['title'], 'project_content' => $project_data['project_content'], 'area_type1' => $project_data['area_type'], 'salary_per_hour' => $project_data['salary_per_hour'], 'transportation' => $project_data['transportation'], 'valid' => array('valid' => $project_data['valid']));
         $this->form->setDefaults($setDefaults);
     }
     $this->make_form_project_area();
     $this->make_customer_regist_project();
     $this->make_select_form_project_type();
     if ($this->action == "form") {
         $this->form->freeze();
         $this->title = "削除ページ";
         $this->message = "削除して宜しいですか?";
         $this->next_type = "delete_project";
         $this->next_action = "complete";
         $this->file = "customer_regist_project.tpl";
         $btn1 = "削除";
     } else {
         if ($this->action == "complete" && isset($_POST['submit1']) && $_POST['submit1'] == "削除") {
             $id = $_SESSION['id'];
             unset($_SESSION['id']);
             $CustomerModel = new CustomerModel();
             $CustomerModel->delete_project($id);
             if ($this->is_system) {
                 header("Location:http://localhost/system.php?type=list_project&flag=delete");
                 exit;
             } else {
                 header("Location:http://localhost/customer.php?type=list_project&flag=delete");
                 exit;
             }
         }
     }
     $this->form->addElement('submit', 'submit1', $btn1);
     $this->form->addElement('submit', 'submit2', $btn2);
     $this->form->addElement('reset', 'reset', "");
     $this->view_display();
 }