示例#1
0
 public function screen_regist_add($auth = "")
 {
     $hope_start = array('Y' => date('Y'), 'm' => date('m'), 'd' => date('d'));
     $this->form->setDefaults(array('hope_start' => $hope_start));
     $this->make_member_regist_add_form();
     $this->make_form_project_area();
     $this->make_form_project_type();
     $btn1 = "";
     $btn2 = "";
     if (isset($_POST['re'])) {
         $data = $this->form->getSubmitValues();
     }
     if (isset($data)) {
         //エリア選択は3つまでできるので3を送る設定
         if (!$this->check_area($data, 3)) {
             $this->area = '希望のエリアを一つ以上選択してください';
             $this->action = "form";
         }
         if (!$this->check_project_member($data)) {
             $this->project = '希望の職種は一つ以上選択してください';
             $this->action = "form";
         }
         if (!$this->form->validate()) {
             $this->action = "form";
         }
     } else {
         $this->action = "form";
     }
     if ($this->action == "form") {
         if ($this->is_system) {
             $this->title = "補足情報";
             $this->message = "--追加情報の入力--";
         } else {
             $this->title = "お仕事探しまであと一歩!";
             $this->message = "最後に下記の項目を入力しよう!";
         }
         $this->file = "member_regist_add.tpl";
         $this->next_type = "regist_add";
         $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 = "member_regist_add_freeze.tpl";
             $this->next_type = "regist_add";
             $this->next_action = "complete";
             $btn1 = "OK";
             $btn2 = "戻る";
         } else {
             if ($this->action == "complete" && isset($_POST['submit2']) && $_POST['submit2'] == "戻る") {
                 if ($this->is_system) {
                     $this->title = "追加情報の入力";
                     $this->message = "プラスアルファの情報の入力";
                 } else {
                     $this->title = "お仕事探しまであと一歩!";
                     $this->message = "最後に下記の項目を入力しよう!";
                 }
                 $this->file = "member_regist_add.tpl";
                 $this->next_type = "regist_add";
                 $this->next_action = "confirm";
                 $btn1 = "確認";
                 $btn2 = "";
             } else {
                 if ($this->action == "complete" && isset($_POST['submit1']) && $_POST['submit1'] == "OK") {
                     $MemberModel = new MemberModel();
                     if ($this->is_system && isset($_SESSION['memberdata'])) {
                         $memberdata = $_SESSION['memberdata'];
                         $memberdata['birthday'] = sprintf("%04d%02d%02d", $memberdata['birthday']['Y'], $memberdata['birthday']['m'], $memberdata['birthday']['d']);
                         $memberdata['gender'] = sprintf("%1d", $memberdata['gender']['gender']);
                         $id = $MemberModel->regist_member_return_id($memberdata);
                         $_SESSION[_MEMBER_AUTHINFO]['id'] = $id;
                         unset($_SESSION['memberdata']);
                     }
                     $data['area_type'] = $this->data_area_input($data);
                     $data['project_type'] = $this->data_project_input($data);
                     $data['hope_start'] = sprintf('%04d%02d%02d', $data['hope_start']['Y'], $data['hope_start']['m'], $data['hope_start']['d']);
                     $id = $_SESSION[_MEMBER_AUTHINFO]['id'];
                     $MemberModel->regist_add_member($data, $id);
                     if ($this->is_system) {
                         $this->title = "会員情報の登録が完了しました";
                         $this->file = "message.tpl";
                     } else {
                         $mail = $_SESSION[_MEMBER_AUTHINFO]['mail'];
                         $memberdata = $MemberModel->get_member_authinfo($mail);
                         $this->auth->auth_member_ok($memberdata);
                         $this->screen_member();
                     }
                 }
             }
         }
     }
     $this->form->addElement('submit', 'submit1', $btn1);
     $this->form->addElement('submit', 'submit2', $btn2);
     $this->form->addElement('reset', 'reset', 'リセット');
     $this->view_display();
 }