public function pjActionCreate() { $this->setLayout('pjAdminSignUpLayout'); if (isset($_POST['user_singup'])) { $data = array(); $data['is_active'] = 'T'; $data['ip'] = $_SERVER['REMOTE_ADDR']; $id = pjUserModel::factory(array_merge($_POST, $data))->insert()->getInsertId(); if ($id !== false && (int) $id > 0) { $err = 'AU03'; } else { $err = 'AU04'; } //Let's check when or not coming from clover. if (empty($_SESSION['cloverData'])) { pjUtil::redirect($_SERVER['PHP_SELF'] . "?controller=pjAdmin&action=pjActionLogin"); } else { $_SESSION['user_id'] = $id; pjUtil::redirect($_SERVER['PHP_SELF'] . "?controller=pjAdminSignUp&action=pjActionMain&case=signup"); } } else { $this->set('role_arr', pjRoleModel::factory()->orderBy('t1.id ASC')->findAll()->getData()); $this->appendJs('jquery.validate.min.js', PJ_THIRD_PARTY_PATH . 'validate/'); $this->appendJs('pjAdminUsers.js'); } }
public function pjActionUpdate() { $this->checkLogin(); if ($this->isAdmin()) { if (isset($_POST['merchant_update'])) { pjMerchantModel::factory()->where('merchant_id', $_POST['id'])->limit(1)->modifyAll($_POST); pjUtil::redirect(PJ_INSTALL_URL . "index.php?controller=pjAdminMerchant&action=pjActionIndex&err=AU01"); } else { $arr = pjMerchantModel::factory()->find($_GET['id'])->getData(); if (count($arr) === 0) { pjUtil::redirect(PJ_INSTALL_URL . "index.php?controller=pjAdminMerchant&action=pjActionIndex&err=AU08"); } $this->set('arr', $arr); $this->set('role_arr', pjRoleModel::factory()->orderBy('t1.id ASC')->findAll()->getData()); $this->appendJs('jquery.validate.min.js', PJ_THIRD_PARTY_PATH . 'validate/'); $this->appendJs('pjAdminMerchant.js'); } } else { $this->set('status', 2); } }
public function pjActionUpdate() { $this->checkLogin(); if ($this->isAdmin()) { if (isset($_POST['client_update'])) { pjClientModel::factory()->where('id', $_POST['id'])->limit(1)->modifyAll($_POST); pjUtil::redirect(PJ_INSTALL_URL . "index.php?controller=pjAdminClients&action=pjActionIndex&err=AC01"); } else { $arr = pjClientModel::factory()->find($_GET['id'])->getData(); if (count($arr) === 0) { pjUtil::redirect(PJ_INSTALL_URL . "index.php?controller=pjAdminClients&action=pjActionIndex&err=AC08"); } $this->set('arr', $arr); $this->set('role_arr', pjRoleModel::factory()->orderBy('t1.id ASC')->findAll()->getData()); $country_arr = pjCountryModel::factory()->select('t1.id, t2.content AS country_title')->join('pjMultiLang', "t2.model='pjCountry' AND t2.foreign_id=t1.id AND t2.field='name' AND t2.locale='" . $this->getLocaleId() . "'", 'left outer')->orderBy('`country_title` ASC')->findAll()->getData(); $this->set('country_arr', $country_arr); $this->appendJs('chosen.jquery.js', PJ_THIRD_PARTY_PATH . 'harvest/chosen/'); $this->appendCss('chosen.css', PJ_THIRD_PARTY_PATH . 'harvest/chosen/'); $this->appendJs('jquery.validate.min.js', PJ_THIRD_PARTY_PATH . 'validate/'); $this->appendJs('pjAdminClients.js'); } } else { $this->set('status', 2); } }