Ejemplo n.º 1
0
 public function actionConfig()
 {
     $this->model->authAdmin();
     if ($this->isPost()) {
         if ($this->request->deletAdmin !== '') {
             $chengAdmin = Model_Admin::getByField('Model_Admin', 'admin', "email", $this->request->deletAdmin);
             $chengAdmin->delete();
             //app::redirect($_SERVER['HTTP_REFERER']);
         }
         if ($this->request->emailAdmin !== '' && $this->request->passAdmin !== '') {
             $newAdmin = new Model_Admin();
             $newAdmin->email = $this->request->emailAdmin;
             $newAdmin->password = password_hash($this->request->passAdmin, PASSWORD_BCRYPT);
             $newAdmin->create = time();
             $newAdmin->save();
             //app::redirect($_SERVER['HTTP_REFERER']);
         }
         if ($this->request->action != "") {
             $action = $this->request->action;
             switch ($action) {
                 case "addCat":
                     $name = $this->request->addCategory;
                     AbstractModel::insert('category', compact('name'));
                     //app::redirect($_SERVER['HTTP_REFERER']);
                     break;
                 case "delCat":
                     $id = (int) $this->request->deletCategory;
                     AbstractModel::deleteOnId("category", $id);
                     //app::redirect($_SERVER['HTTP_REFERER']);
                     break;
             }
         }
     }
     $this->view->categorys = Model_Category::getAll('Model_Category', "category");
     $this->view->admins = Model_Admin::getAll('Model_Admin', "admin");
     $this->view->render('config');
     $this->view->display();
 }
Ejemplo n.º 2
0
 /**
  * it just delete lot by id
  *
  * @throws Exception
  */
 public function actionDelete()
 {
     if ($this->request->delete != "") {
         $id = (int) $this->request->delete;
         AbstractModel::deleteOnId("lot", $id);
     }
     App::redirect("/user/mylots");
 }