Example #1
0
 public function screen_customer_regist()
 {
     $btn1 = "";
     $btn2 = "";
     $this->make_system_regist_customer_form();
     $password = "******";
     $password .= "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
     $password .= "0123456789";
     $password .= "_-!?#\$%&";
     $password = substr(str_shuffle($password), 0, 8);
     $this->form->setDefaults(array('password' => $password));
     // 入力値が適切でなく かつ $this->actionがviewでない
     if (!$this->form->validate()) {
         $this->action = "form";
     }
     if ($this->action == "form") {
         $this->title = "新規:顧客発行";
         $this->file = "system_customer_regist.tpl";
         $this->next_type = "customer_regist";
         $this->next_action = "confirm";
         $btn1 = "確認";
         $btn2 = "";
     } else {
         if ($this->action == "confirm" && $_POST['submit1'] && $_POST['submit1'] == "確認") {
             $this->form->freeze();
             $this->title = "新規:顧客発行";
             $this->message = "下記で宜しいですか?";
             $this->file = "system_customer_regist.tpl";
             $this->next_type = "customer_regist";
             $this->next_action = "complete";
             $btn1 = "発行";
             $btn2 = "戻る";
         } else {
             if ($this->action == "complete" && isset($_POST['submit2']) && $_POST['submit2'] == "戻る") {
                 $this->title = "新規:顧客発行";
                 $this->file = "system_customer_regist.tpl";
                 $this->next_type = "customer_regist";
                 $this->next_action = "confirm";
                 $btn1 = "確認";
                 $btn2 = "";
             } else {
                 if ($this->action == "complete" && isset($_POST['submit1']) && $_POST['submit1'] == "発行") {
                     $data = $this->form->getSubmitValues();
                     $data['password'] = $this->auth->get_hash_password($data['password']);
                     $CustomerModel = new CustomerModel();
                     $CustomerModel->regist_customer($data);
                     $this->title = "発行完了";
                     $this->message = "新規顧客の発行が完了しました";
                     $this->file = "message.tpl";
                 }
             }
         }
     }
     $this->form->addElement('submit', 'submit1', $btn1);
     $this->form->addElement('submit', 'submit2', $btn2);
     $this->form->addElement('reset', 'reset', "リセット");
     $this->view_display();
 }