Example #1
0
 public function screen_regist_project()
 {
     $day = array('Y' => date('Y'), 'm' => date('m'), 'd' => date('d'));
     $this->form->setDefaults(array('valid' => array('valid' => 1), 't_start' => $day, 't_end' => $day));
     $this->make_customer_regist_project();
     $this->make_select_form_project_type();
     $this->make_form_project_area();
     $btn1 = "";
     $btn2 = "";
     if (isset($_POST['re'])) {
         $data = $this->form->getSubmitValues();
     }
     if (isset($data)) {
         $this->check_screen_regist_project($data);
     } else {
         $this->action = "form";
     }
     if ($this->action == "form") {
         $this->title = "案件登録ページ";
         $this->file = "customer_regist_project.tpl";
         $this->next_type = "regist_project";
         $this->next_action = "confirm";
         $btn1 = "確認";
         $btn2 = "";
     } else {
         if ($this->action == "confirm" && isset($_POST['submit1']) && $_POST['submit1'] == "確認") {
             $this->form->freeze();
             $this->title = "案件登録ページ";
             $this->message = "下記でよろしいでしょうか?";
             $this->file = "customer_regist_project.tpl";
             $this->next_type = "regist_project";
             $this->next_action = "complete";
             $btn1 = "登録";
             $btn2 = "戻る";
         } else {
             if ($this->action == "complete" && isset($_POST['submit2']) && $_POST['submit2'] == "戻る") {
                 $this->title = "案件登録ページ";
                 $this->file = "customer_regist_project.tpl";
                 $this->next_type = "regist_project";
                 $this->next_action = "confirm";
                 $btn1 = "確認";
                 $btn2 = "";
             } else {
                 if ($this->action == "complete" && isset($_POST['submit1']) && $_POST['submit1'] == "登録") {
                     $data['t_start'] = sprintf("%04d%02d%02d", $data['t_start']['Y'], $data['t_start']['m'], $data['t_start']['d']);
                     $data['t_end'] = sprintf("%04d%02d%02d", $data['t_end']['Y'], $data['t_end']['m'], $data['t_end']['d']);
                     $data['shift_start'] = sprintf("%02d%02d", $data['shift_start']['H'], $data['shift_start']['i']);
                     $data['shift_end'] = sprintf("%02d%02d", $data['shift_end']['H'], $data['shift_end']['i']);
                     $data['valid'] = $data['valid']['valid'];
                     $data['company_id'] = $_SESSION[_CUSTOMER_AUTHINFO]['id'];
                     $CustomerModel = new CustomerModel();
                     $CustomerModel->regist_project($data);
                     if ($this->is_system) {
                         header("Location:http://localhost/system.php?type=list_project&flag=regist");
                         exit;
                     } else {
                         header("Location:http://localhost/customer.php?type=list_project&flag=regist");
                         exit;
                     }
                 }
             }
         }
     }
     $this->form->addElement('submit', 'submit1', $btn1);
     $this->form->addElement('submit', 'submit2', $btn2);
     $this->form->addElement('reset', 'reset', "");
     $this->view_display();
 }