8 require_once(dirname(__FILE__) .
'/../../lib/View.php');
9 require_once(dirname(__FILE__) .
'/../../lib/Controller.php');
10 require_once(dirname(__FILE__) .
'/AccountModel.php');
12 define(
'PAGER_RPP', 10);
26 if ($_SESSION[
'minfo'][
'role'] !=
'root') {
27 $this->viewName =
'account_err';
34 $this->view =
new View();
36 $this->param[
'base'] = dirname(__FILE__);
38 if (empty($this->param[
'act'])) {
41 switch ($this->param[
'act']) {
42 case 'create': $this->
_create();
break;
43 case 'drop': $this->
_drop();
break;
44 case 'edit': $this->
_edit();
break;
45 case 'remember': $this->
_remember();
break;
46 case 'search': $this->
_search();
break;
47 case 'check': $this->
_check();
break;
48 case 'regist': $this->
_regist();
break;
49 default: $this->
_list();
break;
56 $this->viewName =
'account_list';
61 'pager' => [
'page' => 1,
'rpp' =>
PAGER_RPP],
64 $this->dat[
'list'] = $this->model->getList($this->dat[
'cnd']);
66 $_SESSION[
'account_list_cnd'] = $this->dat[
'cnd'];
71 $this->viewName =
'account_list';
74 'cnd_name' => $this->param[
'cnd_name'],
75 'cnd_login_id' => $this->param[
'cnd_login_id'],
76 'pager' => [
'page' => $this->param[
'page_curr'],
'rpp' =>
PAGER_RPP],
79 $this->dat[
'list'] = $this->model->getList($this->dat[
'cnd']);
81 $_SESSION[
'account_list_cnd'] = $this->dat[
'cnd'];
86 $this->viewName =
'account_list';
87 $this->dat[
'cnd'] = $_SESSION[
'account_list_cnd'];
88 $this->dat[
'list'] = $this->model->getList($this->dat[
'cnd']);
93 $this->viewName =
'account_edit';
94 $this->dat = $this->model->getData($this->param[
'mid']);
101 $insert = (empty($this->param[
'insert'])) ?
false :
true;
102 $name = $this->param[
'name'];
103 $role = $this->param[
'role'];
104 $email = $this->param[
'email'];
105 $tel = $this->param[
'tel'];
106 $login_id = $this->param[
'login_id'];
107 $passwd0 = $this->param[
'passwd0'];
108 $passwd1 = $this->param[
'passwd1'];
111 $err[] =
'メンバー名は必須です。';
114 if (empty($login_id)) {
115 $err[] =
'アカウントは必須です。';
118 if ($this->model->chkDup($login_id)) {
119 $err[] =
'既に存在するアカウントです。';
125 if (empty($passwd0)) {
126 $err[] =
'パスワードは必須です。';
130 if (!empty($passwd1)) {
131 if ($passwd0 != $passwd1) {
132 $err[] =
'パスワードが不正です。';
137 $this->rest = json_encode([
'sts' =>
'OK']);
139 $this->rest = json_encode([
'sts' =>
'NG',
'err' => $err]);
145 $insert = (empty($this->param[
'insert'])) ?
false :
true;
148 $err = $this->model->insert($this->param);
150 $err = $this->model->regist($this->param);
154 $this->rest = json_encode([
'sts' =>
'NG',
'err' => $err]);
158 $this->rest = json_encode([
'sts' =>
'OK']);
163 $this->viewName =
'account_create';
168 $err = $this->model->delete($this->param);
171 $this->rest = json_encode([
'sts' =>
'NG',
'err' => $err]);
175 $this->rest = json_encode([
'sts' =>
'OK']);