public function fullAction($reception = null)
 {
     $this->view->setVar("TopMenuSelected", 'work');
     $this->view->setVar("MenuSelected", 'search');
     $this->view->setVar("MenuItemActive", $reception);
     if (!empty($reception)) {
         switch ($reception) {
             case 'package':
                 $this->view->setVar("StationsAll", Stations::getStations());
                 $this->view->setVar("PackageStatusAll", References::getPackageStatus());
                 $this->view->setVar("CountriesAll", References::getCountries());
                 $this->view->setVar("result_search", Package::getAll());
                 if ($this->request->get('submit')) {
                     $this->view->setVar("result_search", Package::findPackages($this->request->get(), Users::getStationId($this)));
                     $this->view->setVar("post", $this->request->get());
                     $view = 'form_' . $reception;
                 } else {
                     $view = 'form_' . $reception;
                 }
                 View::addJs($this, ['/js/async/jquery.mb.browser.js', '/js/async/jquery.mousewheel.js', '/js/async/calendar_date-time.js']);
                 View::addCss($this, ['/css/calendar_date-time.css']);
                 break;
         }
     }
     $this->view->pick('/search/' . $view);
 }
Пример #2
0
 public static function deleteStation($id)
 {
     $stations = new Stations();
     $links = Stations::getStations($id);
     if (count($links) > 0) {
         if ($links['from_users'] > 0 || $links['from_package_transport_history'] > 0 || $links['from_registry'] > 0 || $links['from_manifests'] > 0 || $links['from_persons_cache'] > 0) {
             return array('class' => 'alert-warning', 'text' => "<p>Запись <b> " . $links['name'] . " не</b> может быть <b>удалена</b>, так как связана с одной или несколькими записями. Необходимо <b>переопределить</b> или <b>удалить</b> эти связи, после чего повторите попытку.</p>");
         } else {
             $query = "DELETE FROM stations_list WHERE id = {$id}";
             $res = new Phalcon\Mvc\Model\Resultset\Simple(null, $stations, $stations->getReadConnection()->query($query));
             return array('class' => 'alert-success', 'text' => "<p>Удаление записи <b>" . $links['name'] . "</b> произошло успешно.</p>");
         }
     }
     return array('class' => 'alert-danger', 'text' => "<p>Запись не найдена.</p>");
 }
 public function personAction($reception = null, $item_id = null)
 {
     $this->view->setVar("TopMenuSelected", 'work');
     $this->view->setVar("MenuSelected", 'persons');
     $this->view->setVar("MenuItemActive", $reception);
     $messages = array();
     if (!empty($reception)) {
         $view = $reception;
         switch ($reception) {
             case 'add':
                 $this->view->setVar("CountriesAll", References::getCountries());
                 break;
             case 'preview-cache-station':
                 if ($this->request->isPost()) {
                     if ((bool) $this->request->getPost('add')) {
                         View::addMessages($this, [References::addPersonNew($this->request->getPost('full_name'), $this->request->getPost('address'), $this->request->getPost('country_id'), 3, $this->request->getPost('code'), 1, $this->request->getPost('phone'), Users::getStationId($this))]);
                     }
                 }
                 View::addMessages($this, [array('class' => 'alert-info', 'text' => "<p>Перечень записей Адресной книги кэшированных только для этой станции.</p>")]);
                 $this->view->setVar("PersonsCacheAll", References::getPersonsCache(Users::getStationId($this)));
                 break;
             case 'preview-cache':
                 if ($this->request->isPost()) {
                 }
                 View::addMessages($this, [array('class' => 'alert-info', 'text' => "<p>Перечень часто использующихся записей Адресной книги всех станций.</p>")]);
                 $this->view->setVar("PersonsCacheAll", References::getPersonsHot());
                 break;
             case 'preview':
                 if ($this->request->isPost()) {
                     //$messages[] = Users::addUser($this->request->getPost());
                     //$messages[] = Users::deleteUser($this->request->getPost('id'));
                 }
                 View::addMessages($this, [array('class' => 'alert-info', 'text' => "<p>Полный перечень записей Адресной книги всех станций.</p>")]);
                 $this->view->setVar("PersonsCacheAll", References::getPersonsAll());
                 break;
             case 'edit':
                 if (empty($item_id)) {
                     if ($this->request->isPost()) {
                         $this->response->redirect('/administration/user/edit/' . $this->request->getPost('user_id'), '/');
                     }
                     $messages[] = array('class' => 'alert-info', 'text' => "<p><b>Выберите</b> из выпадающего списка <b>профиль пользователя</b>, который нужно изменить.</p>");
                     $this->view->setVar("UsersAll", Users::getUsers());
                 } else {
                     if ($this->request->isPost()) {
                         $messages[] = Users::setUser($this->request->getPost());
                     }
                     $this->view->setVar("User", Users::getUsers($item_id));
                     $this->view->setVar("StationsAll", Stations::getStations());
                     $this->view->setVar("RolesAll", Roles::getRoles());
                     $this->view->setVar("LanguagesAll", References::getLanguages());
                     $this->view->setVar("CurrencyAll", References::getCurrency());
                     $this->view->setVar("Units1", References::getUnits(NULL, array(1))['units']);
                     $this->view->setVar("Units2", References::getUnits(NULL, array(3))['units']);
                     $this->view->setVar("Units3", References::getUnits(NULL, array(4))['units']);
                 }
                 break;
             case 'settings':
                 if ($this->request->isPost()) {
                     $messages[] = Users::addUser($this->request->getPost());
                     //$messages[] = Users::deleteUser($this->request->getPost('id'));
                 }
                 $this->view->setVar("UsersAll", Users::getUsers());
                 break;
         }
         $this->view->pick('/administration/' . "person_" . $view);
     }
     //$this->view->setVar("messages", $messages);
 }