all() public method

public all ( $name = "" )
 public function setOption($varName, RequestParams $allParams)
 {
     $value = $allParams->all($varName);
     $arParams = ['value' => $value, 'codeName' => $this->variableName, 'groupName' => $this->groupName];
     $event = new BaseContainerEvent($this->c, $arParams);
     $event = $this->c->dispatcher->dispatch('middleware.' . $varName . '.before', $event);
     $value = $event->getParams()['value'] ? $event->getParams()['value'] : $allParams->all($this->variableName);
     $result = $this->storeParams($value, $varName);
     $arParams = ['result' => $result, 'allParams' => $allParams];
     $event = new BaseContainerEvent($this->c, $arParams);
     $this->c->dispatcher->dispatch('middleware.' . $varName . '.after', $event);
 }
 public function setOption($value, RequestParams $allParams)
 {
     $this->groupName = $this->groupName . basename($allParams->getRequest()->getUri()->getPath());
     $arParams = ['value' => $value, 'codeName' => $this->variableName, 'groupName' => $this->groupName];
     $event = new BaseContainerEvent($this->c, $arParams);
     $event = $this->c->dispatcher->dispatch('middleware.itemparpage.before', $event);
     $value = $event->getParams()['value'] ? $event->getParams()['value'] : $allParams->all($this->variableName);
     $result = $this->storeParams($value);
     Session::push('admin_panel.count_page', $allParams->all($this->variableName));
     $arParams = ['result' => $result, 'allParams' => $allParams];
     $event = new BaseContainerEvent($this->c, $arParams);
     $this->c->dispatcher->dispatch('middleware.itemparpage.after', $event);
 }
Example #3
0
 public function registerRoute()
 {
     $this->app->get('/', function ($req, $res) {
         $res->getBody()->write("Please <a href=\"\\install-system\">install</a> system");
     })->setName('home');
     $this->app->get('/install-system', function ($req, $res, $args) {
         return $this->view->render($res, 'admin\\install.twig', ['step' => 1, 'view' => '1']);
     })->setName('installer');
     $parentClass = $this;
     $this->app->post('/install-system', function ($req, $res, $args) use($parentClass) {
         $request = new RequestParams($req);
         $_allParams = $request->all();
         unset($_allParams['step']);
         $allParams = array();
         if ('finish' == $request->post('step')) {
             $parentClass->installSystem($_allParams);
             return $res->withStatus(301)->withHeader('Location', $this->router->pathFor('home'));
         }
         foreach ($_allParams as $k => $item) {
             if (is_array($item)) {
                 foreach ($item as $_k => $_v) {
                     $allParams[$k . "[{$_k}]"] = $_v;
                 }
             } else {
                 $allParams[$k] = $item;
             }
         }
         return $this->view->render($res, 'admin\\install.twig', ['prevData' => $allParams, 'step' => $request->post("step"), 'view' => $request->post("step")]);
     })->setName('installer-step');
     $this->app->post('/install-system/checkdb', function ($req, $res, $args) {
         $request = new RequestParams($req);
         if ($request->isXhr()) {
             $checkdb = false;
             $config = [];
             if ($request->post('dbType') == 'mysql') {
                 $config = ['driver' => 'mysql', 'host' => $request->post('dbHost'), 'database' => $request->post('dbName'), 'username' => $request->post('dbLogin'), 'password' => $request->post('dbPassword'), 'charset' => 'utf8', 'collation' => 'utf8_general_ci', 'prefix' => ''];
                 $checkdb = true;
             } elseif ($request->post('dbType') == 'sqlite') {
                 if (!$request->post('dbFileName')) {
                     $data = array('type' => 'error', 'msg' => "Please insert DB name");
                     return $res->withJson($data);
                 }
                 $file = RESOURCE_PATH . 'database/' . strtolower($request->post('dbFileName')) . '.sqlite';
                 if (file_exists($file)) {
                     $data = array('type' => 'error', 'msg' => "File exist, please insert other DB name");
                 } else {
                     $data = array('type' => 'success', 'msg' => "Step the next stage");
                     $checkdb = false;
                 }
                 $config = ['driver' => 'sqlite', 'database' => $file, 'prefix' => ''];
             }
             if ($checkdb) {
                 $capsule = new Capsule();
                 $capsule->addConnection($config);
                 $capsule->setAsGlobal();
                 $capsule->bootEloquent();
                 try {
                     $capsule->schema()->hasTable("options");
                     $data = array('type' => 'success', 'msg' => "Step the next stage");
                 } catch (\PDOException $e) {
                     $data = array('type' => 'error', 'msg' => "DB not exist");
                 }
             }
             return $res->withJson($data);
         } else {
             $data = array('type' => 'error', 'msg' => "Request type error");
             return $res->withJson($data);
         }
     });
 }