Exemplo n.º 1
0
 /**
  * get update page + update
  * @return ViewModel
  */
 public function editAction()
 {
     $err_msg = "";
     $this->init();
     $id = (int) $this->params()->fromRoute('id', 0);
     if (!$id) {
         return $this->redirect()->toUrl(BASE_URL);
     }
     $this->selfEditCheck();
     $db = new WorkUserEntity();
     // get update information from DB
     $postRequest = $this->container()->get('postRequest');
     if ($postRequest) {
         $this->container()->clear('postRequest');
         $row = get_array_object(json_decode($postRequest, true));
     } else {
         $work_no = $this->container()->get('work_no');
         $row = $db->db()->getFetchRow($id, $this->auth()->get('user_no'), $work_no);
     }
     $form = new WorkUserForm();
     $form->setEditForm($this->auth()->get('branch_no'));
     $filter = new WorkUserFilter();
     $success = false;
     // if not exist target record
     if (!$row || $row->deleted) {
         $this->flashMessenger()->addMessage('Target does not exist');
         //            $this->flashMessenger()->addMessage('指定レコードは存在しません。');
         return $this->redirect()->toRoute('app', array('controller' => 'failed', 'action' => 'index'));
     }
     $request = $this->getRequest();
     // get edit page
     if (!$request->isPost()) {
         $form->bind($row);
         $beforeData = make_before_data($row, 'tmp_user_no');
         if ($beforeData) {
             $form->bind($beforeData);
         }
     } else {
         $token_id = $this->container()->get('token_id');
         $this->container()->clear('token_id');
         $filter->setCreateToken($token_id);
         $form->setInputFilter($filter->getInputFilter());
         $form->setData($request->getPost());
         $success = $form->isValid();
         if ($success) {
             $success = check_change_data($request->getPost());
             $err_msg = $success ? '' : 'Not changed';
             //                $err_msg = $success ? '' : '変更を確認できません。';
         }
         if ($success) {
             $work_no = $this->container()->get('work_no');
             // update
             $stat = $request->getPost('login_id') != $request->getPost('before_login_id') ? true : false;
             $success = $db->updateRecord($this->auth()->get('user_no'), $form->getData(), $work_no, $stat);
         } else {
             // set result to form
             $data = $form->getInputFilter()->getValues();
             $form->bind(get_array_object($data));
         }
         if (false !== $success) {
             $this->flashMessenger()->addMessage("Success");
             //                $this->flashMessenger()->addMessage("成功しました。");
             return $this->redirect()->toRoute('app', array('controller' => 'work-user', 'action' => 'list'));
         }
     }
     $token_id = make_token_id();
     $this->container()->set('token_id', $token_id);
     $form->get('token_id')->setAttribute('value', $token_id);
     $form->get('submit')->setAttribute('value', 'Update');
     //        $form->get('submit')->setAttribute('value', '更新');
     $form->get('reset')->setAttribute('value', 'Reset');
     //        $form->get('reset')->setAttribute('value', 'リセット');
     $values = array('id' => $id, 'form' => $form, 'err_msg' => $err_msg);
     $view = new ViewModel($values);
     $view->setTemplate('/' . VIEW_DIR . '/work-user/edit.phtml');
     return $view;
 }
Exemplo n.º 2
0
 /**
  * re-issue password2
  * @return ViewModel
  */
 public function remindStoreAction()
 {
     $this->layout('layout/index');
     // get temporary id
     $id = (string) $this->params()->fromRoute('id');
     if (!$id) {
         $this->flashMessenger()->addMessage('Not allowed');
         //            $this->flashMessenger()->addMessage('許可されていません。');
         return $this->redirect()->toRoute('app', array('controller' => 'index'));
     }
     $tmp = new TemporaryIdTable();
     $row = $tmp->getFetchOne($id);
     if (!$row || !isset($row->create_user) || !$row->create_user) {
         $this->flashMessenger()->addMessage('Not allowed');
         //            $this->flashMessenger()->addMessage('許可されていません。');
         return $this->redirect()->toRoute('app', array('controller' => 'index'));
     }
     $success = false;
     $request = $this->getRequest();
     if ($request->isPost()) {
         $token_id = $this->container()->get('token_id');
         $this->container()->clear('token_id');
         if ($token_id != $request->getPost('token_id')) {
             $this->flashMessenger()->addMessage('Not allowed');
             //                $this->flashMessenger()->addMessage('許可されていません。');
             return $this->redirect()->toRoute('app', array('controller' => 'index'));
         }
         $db = new UserEntity();
         $chk = true;
         $i = 0;
         while ($chk) {
             $new_pw = make_rand_str(8, 3);
             $chk = $db->db()->checkLoginPw($row->create_user, $new_pw);
             ++$i;
             if (!$chk || 10 < $i) {
                 // avoid infinite loop
                 break;
             }
         }
         if (!$chk) {
             $success = $db->changePw($row->create_user, $new_pw, 1);
         }
         if ($success) {
             $mail = new Message();
             $mail->setEncoding("UTF-8");
             $mail->addFrom(AUTO_MAIL_FROM)->addTo($row->email)->setSubject($this->translator()->translate("About initialize password"));
             //                        ->setSubject($this->translator()->translate("パスワード初期化について"));
             $body_tpl = file_get_contents(APP_DIR . '/tpl/remind-store-mail.txt');
             $body_tpl = trim(str_replace("\r\n", "\n", $body_tpl));
             $body_tpl = $this->translator()->translate($body_tpl);
             $body_tpl .= "\n\n" . "PW:" . $new_pw;
             $body_tpl .= "\n\n\n" . "URL:" . BASE_URL;
             $mail->setBody($body_tpl);
             $transport = new SmtpTransport();
             $options = new SmtpOptions(array('host' => 'smtp.gmail.com', 'connection_class' => 'plain', 'connection_config' => array('ssl' => 'tls', 'username' => AUTO_MAIL_FROM, 'password' => AUTO_MAIL_FROM_PASSWORD), 'port' => 587));
             $transport->setOptions($options);
         }
         if ($success) {
             $success = $transport->send($mail);
         } else {
             if (IS_TEST) {
                 $logger = new \Zend\Log\Logger();
                 $writer = new \Zend\Log\Writer\Stream(APP_DIR . '/log/debug.txt');
                 $logger->addWriter($writer);
                 $logger->log(\Zend\Log\Logger::DEBUG, print_r($mail, 1));
             }
         }
         $tmp->finishRecord($id);
         $message = $success ? 'Please confirm e-mail' : 'Failed';
         //            $message = $success ? 'メールを確認してください。' : '処理失敗';
         $this->flashMessenger()->addMessage($message);
         return $this->redirect()->toRoute('app', array('controller' => 'index'));
     }
     // create token_id
     $token_id = make_token_id();
     $this->container()->set('token_id', $token_id);
     $values = array('token_id' => $token_id, 'id' => $id);
     $view = new ViewModel($values);
     $view->setTemplate('/' . VIEW_DIR . '/index/remind-store.phtml');
     return $view;
 }
Exemplo n.º 3
0
 /**
  * get update page + update processing
  * @return ViewModel
  */
 public function editAction()
 {
     $this->init();
     $err_msg = '';
     // check target and auth by id
     $id = (int) $this->params()->fromRoute('id', 0);
     if (!$id) {
         $success = false;
     } else {
         $success = 2 < $this->ctrlLv ? true : false;
     }
     // redirect to error page
     if (!$success) {
         return $this->redirect()->toRoute('app', array('controller' => 'failed', 'action' => 'forbidden'));
     }
     $form = new PositionForm();
     $form->setEditForm();
     $db = new PositionEntity();
     $filter = new PositionFilter();
     // get update information from DB
     $postRequest = $this->container()->get('postRequest');
     if ($postRequest) {
         $this->container()->clear('postRequest');
         $row = get_array_object(json_decode($postRequest, true));
     } else {
         $row = $db->db()->getFetchOne($id);
     }
     // if not exist target record
     $success = false;
     if (!$row || $row->deleted) {
         $this->flashMessenger()->addMessage('Target does not exist');
         //            $this->flashMessenger()->addMessage('指定レコードは存在しません。');
     } else {
         if (!$this->auth()->get('admin') && $this->auth()->get('branch_no') != $row->branch_no) {
             $this->flashMessenger()->addMessage('Not allowed');
             //            $this->flashMessenger()->addMessage('許可されていません。');
         } else {
             $success = true;
         }
     }
     if (!$success) {
         return $this->redirect()->toRoute('app', array('controller' => 'failed', 'action' => 'index'));
     }
     $request = $this->getRequest();
     // get update page
     if (!$request->isPost()) {
         $form->bind($row);
         $beforeData = make_before_data($row, 'position_no');
         if ($beforeData) {
             $form->bind($beforeData);
         }
     } else {
         // check belonging to branch
         if ($this->auth()->get('branch_no') != $this->params()->fromPost('branch_no') && !$this->auth()->get('admin')) {
             $this->flashMessenger()->addMessage('Not allowed');
             //                $this->flashMessenger()->addMessage('許可されていません。');
             return $this->redirect()->toRoute('app', array('controller' => 'failed', 'action' => 'index'));
         }
         $token_id = $this->container()->get('token_id');
         $this->container()->clear('token_id');
         $filter->setCreateToken($token_id);
         $form->setInputFilter($filter->getInputFilter());
         $form->setData($request->getPost());
         $success = $form->isValid();
         if ($success) {
             $success = check_change_data($request->getPost());
             $err_msg = $success ? '' : 'Not changed';
             //                $err_msg = $success ? '' : '変更を確認できません。';
         }
         if ($success) {
             // update
             $success = $db->updateRecord($this->auth()->get('user_no'), $form->getData());
         } else {
             // set result to form
             $data = $form->getInputFilter()->getValues();
             $form->bind(get_array_object($data));
         }
         if (false !== $success) {
             $this->flashMessenger()->addMessage("Success");
             //                $this->flashMessenger()->addMessage("成功しました。");
             return $this->redirect()->toRoute('app', array('controller' => 'position', 'action' => 'list'));
         }
     }
     $token_id = make_token_id();
     $this->container()->set('token_id', $token_id);
     $form->get('token_id')->setAttribute('value', $token_id);
     $form->get('submit')->setAttribute('value', 'Update');
     //        $form->get('submit')->setAttribute('value', '更新');
     $form->get('reset')->setAttribute('value', 'Reset');
     //        $form->get('reset')->setAttribute('value', 'リセット');
     if (!$this->auth()->get('admin')) {
         $form->setData(array('branch_no' => $this->auth()->get('branch_no')));
     }
     $values = array('id' => $id, 'action' => 'edit', 'form' => $form, 'admin' => $this->auth()->get('admin'), 'err_msg' => $err_msg);
     $view = new ViewModel($values);
     $view->setTemplate('/' . VIEW_DIR . '/position/edit.phtml');
     return $view;
 }
Exemplo n.º 4
0
 /**
  * get update page + update processing
  * @return ViewModel
  */
 public function editAction()
 {
     $this->init();
     $err_msg = "";
     // check auth by id
     $id = (int) $this->params()->fromRoute('id', 0);
     if (!$id) {
         $success = false;
     } else {
         if ($id == $this->auth()->get('user_no')) {
             $self = true;
             $success = true;
         } else {
             $self = false;
             $success = 2 < $this->ctrlLv ? true : false;
         }
     }
     // redirect to error page
     if (!$success) {
         return $this->redirect()->toRoute('app', array('controller' => 'failed', 'action' => 'forbidden'));
     }
     $db = new UserEntity();
     // get update information from DB
     $postRequest = $this->container()->get('postRequest');
     if ($postRequest) {
         $this->container()->clear('postRequest');
         $row = get_array_object(json_decode($postRequest, true));
     } else {
         $row = $db->db()->getFetchOne($id);
     }
     $form = new UserForm();
     if ($this->auth()->get('admin')) {
         $branch_no = $row->branch_no;
     } else {
         $branch_no = $this->auth()->get('branch_no');
     }
     $form->setEditForm(null, $branch_no);
     $filter = new UserFilter();
     $success = false;
     if (!$row || $row->deleted) {
         $this->flashMessenger()->addMessage('Target does not exist');
         //            $this->flashMessenger()->addMessage('指定レコードは存在しません。');
     } else {
         if (!$this->auth()->get('admin') && $this->auth()->get('branch_no') != $row->branch_no) {
             $this->flashMessenger()->addMessage('Not allowed');
             //            $this->flashMessenger()->addMessage('許可されていません。');
         } else {
             $success = true;
         }
     }
     if (!$success) {
         return $this->redirect()->toRoute('app', array('controller' => 'failed', 'action' => 'index'));
     }
     $request = $this->getRequest();
     // get update page
     if (!$request->isPost()) {
         $form->bind($row);
         $beforeData = make_before_data($row, 'user_no');
         if ($beforeData) {
             $form->bind($beforeData);
         }
     } else {
         // update only belonging branch
         // user can't update position and section
         if ($self && ($row->section_no != $this->params()->fromPost('section_no') || $row->position_no != $this->params()->fromPost('position_no')) || !$this->auth()->get('admin') && $this->auth()->get('branch_no') != $this->params()->fromPost('branch_no')) {
             $this->flashMessenger()->addMessage('Not allowed');
             //                $this->flashMessenger()->addMessage('許可されていません。');
             return $this->redirect()->toRoute('app', array('controller' => 'failed', 'action' => 'index'));
         }
         $token_id = $this->container()->get('token_id');
         $this->container()->clear('token_id');
         $filter->setCreateToken($token_id);
         $form->setInputFilter($filter->getInputFilter());
         $form->setData($request->getPost());
         $success = $form->isValid();
         if ($success) {
             $success = check_change_data($request->getPost());
             $success = true;
             // temporary hack
             $err_msg = $success ? '' : 'Not changed';
             //                $err_msg = $success ? '' : '変更を確認できません。';
         }
         if ($success) {
             // update
             $success = $db->updateUser($this->auth()->get('user_no'), $form->getData());
         } else {
             // set result to form
             $data = $form->getInputFilter()->getValues();
             $form->bind(get_array_object($data));
         }
         if (false !== $success && $self) {
             $this->container()->setContainer('user_auth');
             $this->container()->set('user_name', $request->getPost('user_name'));
             $this->container()->set('timezone', $request->getPost('timezone'));
             setcookie('timezone', $request->getPost('timezone'), time() + 60 * 60 * 24 * 30, '/', BASE_DOMAIN);
             $lang = new \App\Model\Table\LanguageTable();
             $row = $lang->getFetchOne($request->getPost('lang_no'));
             $this->container()->set('lang_id', $row->lang_id);
             $this->container()->set('resource_id', $row->resource_id);
             setcookie('lang_id', $row->lang_id, time() + 60 * 60 * 24 * 30, '/', BASE_DOMAIN);
             setcookie('resource_id', $row->resource_id, time() + 60 * 60 * 24 * 30, '/', BASE_DOMAIN);
         }
         if (false !== $success) {
             $this->flashMessenger()->addMessage("Success");
             //                $this->flashMessenger()->addMessage("成功しました。");
             return $this->redirect()->toRoute('app', array('controller' => 'user', 'action' => 'detail', 'id' => $id));
         }
     }
     $token_id = make_token_id();
     $this->container()->set('token_id', $token_id);
     $form->get('token_id')->setAttribute('value', $token_id);
     $form->get('submit')->setAttribute('value', 'Update');
     //        $form->get('submit')->setAttribute('value', '更新');
     $form->get('reset')->setAttribute('value', 'Reset');
     //        $form->get('reset')->setAttribute('value', 'リセット');
     if (!$this->auth()->get('admin')) {
         $form->setData(array('branch_no' => $this->auth()->get('branch_no')));
     }
     $values = array('id' => $id, 'self' => $self, 'action' => 'edit', 'form' => $form, 'admin' => $this->auth()->get('admin'), 'err_msg' => $err_msg);
     $view = new ViewModel($values);
     $view->setTemplate('/' . VIEW_DIR . '/user/edit.phtml');
     return $view;
 }
Exemplo n.º 5
0
 /**
  * set translate file
  * @return ViewModel
  */
 public function fileStoreAction()
 {
     $this->init();
     $request = $this->getRequest();
     if (!$request->isPost() || 2 > $this->ctrlLv) {
         exit;
     }
     $form = new LanguageForm();
     $form->setFileUpForm();
     $filter = new LanguageFilter();
     $token_id = $this->container()->get('token_id');
     $this->container()->clear('token_id');
     $filter->setCreateToken($token_id);
     $filter->setStoreInputFilter();
     $hydrator = new ObjectProperty();
     $post = $request->getPost();
     $file = $request->getFiles();
     $hydrator->hydrate($file->toArray(), $post);
     $form->setInputFilter($filter->getInputFilter());
     $form->setData($post);
     $success = $form->isValid();
     if (!$success) {
         $token_id = make_token_id();
         $this->container()->set('token_id', $token_id);
         $form->get('token_id')->setAttribute('value', $token_id);
         $values = array('controller' => 'language', 'action' => 'file-store', 'form' => $form, 'label' => 'Translate File', 'max_size' => 524288);
         $view = new ViewModel($values);
         $view->setTemplate('/common/file-upload.phtml');
         $view->setTerminal(true);
         return $view;
     }
     // ***** save file
     $dir_name = APP_DIR . '/module/App/language/';
     $file_name = gv('name', $file->upload_file);
     $tmp_name = gv('tmp_name', $file->upload_file);
     // delete file in server
     if (file_exists($dir_name . $file_name)) {
         unlink($dir_name . $file_name);
     }
     // re-set file
     $success = move_uploaded_file($tmp_name, $dir_name . $file_name);
     if ($success) {
         $cmd = "msgfmt -o {$dir_name}" . str_replace('.po', '.mo', $file_name) . " " . $dir_name . $file_name;
         system($cmd, $success);
     }
     if (0 === $success) {
         $message = 'Completed';
         //            $message = '処理完了';
     } else {
         $message = 'Failed';
         //            $message = '処理失敗';
     }
     $view = new ViewModel(array('message' => $message));
     $view->setTemplate('/common/message.phtml');
     $view->setTerminal(true);
     return $view;
 }
Exemplo n.º 6
0
 public function fileStoreAction()
 {
     $this->init();
     $request = $this->getRequest();
     if (!$request->isPost()) {
         exit;
     }
     $form = new ApprovalForm();
     $form->setAttachForm();
     $filter = new ApprovalFilter();
     $filter->setStoreInputFilter();
     $hydrator = new ObjectProperty();
     $post = $request->getPost();
     $file = $request->getFiles();
     $hydrator->hydrate($file->toArray(), $post);
     $form->setInputFilter($filter->getInputFilter());
     $form->setData($post);
     $success = $form->isValid();
     if (!$success) {
         $token_id = make_token_id();
         $this->container()->set('token_id', $token_id);
         $form->get('token_id')->setAttribute('value', $token_id);
         $values = array('controller' => 'approval', 'action' => 'fileStore', 'form' => $form);
         $view = new ViewModel($values);
         $view->setTemplate('/common/attachment.phtml');
         $view->setTerminal(true);
         return $view;
     }
     $dir_name = APP_UPLOAD_DIR;
     if (!file_exists($dir_name)) {
         mkdir($dir_name, 0777, true);
     }
     $file_name = gv('name', $file->upload_file);
     $tmp_name = gv('tmp_name', $file->upload_file);
     if (file_exists($dir_name . $file_name)) {
         unlink($dir_name . $file_name);
     } else {
         $path = tempnam(sys_get_temp_dir(), $file_name);
         $temp = explode(".", $file_name);
         $base_name = basename($file_name);
         $no_extension = preg_replace("/\\.[^.]+\$/", "", $base_name);
         $newfilename = $no_extension . '_' . round(microtime(true)) . '.' . end($temp);
         $success = move_uploaded_file($tmp_name, $dir_name . $newfilename);
         if ($success) {
             $message = 'Successfully uploaded';
         } else {
             $message = 'Failed to Upload File';
         }
     }
     $view = new ViewModel(array('message' => $message, 'filename' => $newfilename, 'dir' => $path));
     $view->setTemplate('/common/attach.phtml');
     $view->setTerminal(true);
     return $view;
 }
Exemplo n.º 7
0
 /**
  * get update page + update processing
  * @return ViewModel
  */
 public function editAction()
 {
     $this->init();
     $err_msg = '';
     // check auth by id
     $id = (int) $this->params()->fromRoute('id', 0);
     if (!$id) {
         $success = false;
     } else {
         $success = 2 < $this->ctrlLv ? true : false;
     }
     // redirect to error page
     if (!$success) {
         return $this->redirect()->toRoute('app', array('controller' => 'failed', 'action' => 'forbidden'));
     }
     $db = new RoleEntity();
     // get update information from db
     $postRequest = $this->container()->get('postRequest');
     if ($postRequest) {
         $this->container()->clear('postRequest');
         $row = get_array_object(json_decode($postRequest, true));
     } else {
         $row = $db->db()->getFetchOne($id);
     }
     // if not exist target record
     $success = false;
     if (!$row || $row->deleted) {
         $this->flashMessenger()->addMessage('Target does not exist');
         //            $this->flashMessenger()->addMessage('指定レコードは存在しません。');
     } else {
         if (!$this->auth()->get('admin') && $this->auth()->get('branch_no') != $row->branch_no) {
             $this->flashMessenger()->addMessage('Not allowed');
             //            $this->flashMessenger()->addMessage('許可されていません。');
         } else {
             $success = true;
         }
     }
     if (!$success) {
         return $this->redirect()->toRoute('app', array('controller' => 'failed', 'action' => 'index'));
     }
     $request = $this->getRequest();
     $branch_no = $this->auth()->get('branch_no');
     if ($this->auth()->get('admin')) {
         $branch_no = !$request->isPost() ? $row->branch_no : $request->getPost('branch_no');
     }
     $form_opt = array('name' => !$request->isPost() && !$postRequest ? 'edit' : 'faild', 'user_no' => isset($row->user_no) && $row->user_no ? $row->user_no : $request->getPost('user_no'), 'branch_no' => $branch_no, 'role_no' => (int) $id);
     $form = new RoleForm();
     $form->setEditForm($form_opt);
     $filter = new RoleFilter();
     // get update page
     if (!$request->isPost()) {
         $form->bind($row);
         $beforeData = make_before_data($row, 'role_no');
         if ($beforeData) {
             $form->bind($beforeData);
         }
         $users = array();
         $rows = $db->db()->getRoleUserPairs($id);
         $users = array_keys($rows);
         $levels = array();
         $ctrlList = $db->db()->getRoleCtrl($id)->toArray();
         foreach ($ctrlList as $r) {
             $levels[gv('controller_no', $r)] = gv('level', $r);
         }
         $beforeData = array('before_user_no' => $users, 'before_level' => $levels);
     } else {
         // check belonging branch
         if ($this->auth()->get('branch_no') != $this->params()->fromPost('branch_no') && !$this->auth()->get('admin')) {
             $this->flashMessenger()->addMessage('Not allowed');
             //                $this->flashMessenger()->addMessage('許可されていません。');
             return $this->redirect()->toRoute('app', array('controller' => 'failed', 'action' => 'index'));
         }
         $token_id = $this->container()->get('token_id');
         $this->container()->clear('token_id');
         $filter->setCreateToken($token_id);
         $form->setInputFilter($filter->getInputFilter());
         $form->setData($request->getPost());
         $success = $form->isValid();
         if ($success) {
             $success = check_change_data($request->getPost());
             $err_msg = $success ? '' : 'Not cahnged';
             //                $err_msg = $success ? '' : '変更を確認できません。';
         }
         if ($success) {
             // update
             $chg_user = $request->getPost('user_no') != $request->getPost('before_user_no');
             $chg_lv = $request->getPost('level') != $request->getPost('before_level');
             $chg = array('chg_user' => $chg_user, 'chg_lv' => $chg_lv);
             $success = $db->updateRecord($this->auth()->get('user_no'), $form->getData(), $chg);
         } else {
             // set result to form
             $data = $form->getInputFilter()->getValues();
             $form->bind(get_array_object($data));
         }
         if (false !== $success) {
             $this->flashMessenger()->addMessage("Success");
             //                $this->flashMessenger()->addMessage("成功しました。");
             return $this->redirect()->toRoute('app', array('controller' => 'role', 'action' => 'list'));
         }
         $beforeData = array('before_user_no' => $request->getPost('before_user_no'), 'before_level' => $request->getPost('before_level'));
         $ctrl = new ControllerTable();
         $ctrlList = $ctrl->search(array('deleted <> 1'), array('controller_no' => 'ASC'), null, null);
     }
     $token_id = make_token_id();
     $this->container()->set('token_id', $token_id);
     $form->get('token_id')->setAttribute('value', $token_id);
     $form->get('section_no')->setAttribute('value', '');
     $form->get('submit')->setAttribute('value', 'Update');
     //        $form->get('submit')->setAttribute('value', '更新');
     $form->get('reset')->setAttribute('value', 'Reset');
     //        $form->get('reset')->setAttribute('value', 'リセット');
     if (!$this->auth()->get('admin')) {
         $form->setData(array('branch_no' => $this->auth()->get('branch_no')));
     }
     $values = array('id' => $id, 'action' => 'edit', 'form' => $form, 'admin' => $this->auth()->get('admin'), 'err_msg' => $err_msg, 'ctrlList' => $ctrlList, 'form_level' => $request->getPost('level'), 'beforeData' => $beforeData);
     $view = new ViewModel($values);
     $view->setTemplate('/' . VIEW_DIR . '/role/edit.phtml');
     return $view;
 }