public function screen_company($auth = "") { $btn1 = ""; $btn2 = ""; if ($this->action == "view" && $this->is_system) { $CustomerModel = new CustomerModel(); $_SESSION[_CUSTOMER_AUTHINFO] = $CustomerModel->get_customer_authinfo_id($_GET['id']); } $setDefaults = array('company_name' => $_SESSION[_CUSTOMER_AUTHINFO]['company_name'], 'mail' => $_SESSION[_CUSTOMER_AUTHINFO]['mail'], 'tel' => $_SESSION[_CUSTOMER_AUTHINFO]['tel'], 'address' => $_SESSION[_CUSTOMER_AUTHINFO]['address'], 'appeal' => $_SESSION[_CUSTOMER_AUTHINFO]['appeal'], 'last_name' => $_SESSION[_CUSTOMER_AUTHINFO]['last_name'], 'first_name' => $_SESSION[_CUSTOMER_AUTHINFO]['first_name']); $this->form->setDefaults($setDefaults); $this->make_customer_modify_company(); if ($this->action == "view" && $this->is_system) { $this->form->freeze(); $this->title = "情報詳細"; $this->message = ""; $this->file = "customer_modify_company.tpl"; $this->next_type = "modify_or_delete_customer"; $this->next_action = "form"; $btn1 = "更新"; $btn2 = "削除"; } // 入力値が適切でなく かつ $this->actionがviewでない if (!$this->form->validate() && $this->action != "view") { $this->action = "form"; } if ($this->action == "form") { if ($this->is_system) { $this->title = "顧客情報更新"; } else { $this->title = "自社情報編集ページ"; } $this->file = "customer_modify_company.tpl"; $this->next_type = "company"; $this->next_action = "confirm"; $btn1 = "確認"; $btn2 = ""; } else { if ($this->action == "confirm" && $_POST['submit1'] && $_POST['submit1'] == "確認") { $this->form->freeze(); if ($this->is_system) { $this->title = "顧客情報更新"; } else { $this->title = "自社情報編集ページ"; } $this->message = "下記で宜しいですか?"; $this->file = "customer_modify_company.tpl"; $this->next_type = "company"; $this->next_action = "complete"; $btn1 = "更新"; $btn2 = "戻る"; } else { if ($this->action == "complete" && isset($_POST['submit2']) && $_POST['submit2'] == "戻る") { if ($this->is_system) { $this->title = "顧客情報更新"; } else { $this->title = "自社情報編集ページ"; } $this->file = "customer_modify_company.tpl"; $this->next_type = "company"; $this->next_action = "confirm"; $btn1 = "確認"; $btn2 = ""; } else { if ($this->action == "complete" && isset($_POST['submit1']) && $_POST['submit1'] == "更新") { $data = $this->form->getSubmitValues(); $data['id'] = $_SESSION[_CUSTOMER_AUTHINFO]['id']; $CustomerModel = new CustomerModel(); $CustomerModel->modify_customer_company($data); if ($this->is_system) { $this->title = "更新完了"; $this->message = "顧客情報の更新が完了しました"; $this->URL = "system.php?type=customer_list"; $this->URL .= $this->add_pageID(); $this->file = "message.tpl"; } else { $this->auth->auth_customer_ok($data); header("Location:http://localhost/customer.php?flag=company"); exit; } } } } } $this->form->addElement('submit', 'submit1', $btn1); $this->form->addElement('submit', 'submit2', $btn2); $this->form->addElement('reset', 'reset', ""); $this->view_display(); }