Ejemplo n.º 1
0
 public function getMenu($menuKey, $getParams = array())
 {
     $menusConfJson = file_get_contents(Container::get('params')->getConfigDir() . '/' . 'menus.json');
     $menusConf = json_decode($menusConfJson, true);
     $menu = array();
     foreach ($menusConf['rows'] as $key => $row) {
         if (!empty($row['text_id']) && $row['text_id'] == $menuKey) {
             if (!empty($getParams)) {
                 foreach ($row['children'] as $childNum => $child) {
                     $row['children'][$childNum]['url'] = Router::buildUrl($child['url'], $getParams);
                 }
             }
             $menu = $row;
         }
     }
     return $menu;
     $menuData = $this->select($this->table, array('menu_key' => $menuKey), array('id'));
     if (!empty($menuData)) {
         $menuItemsData = Container::get('Main/MenuItemModel')->selectEntity(array('menu_id' => $menuData['0']['id']), array('parent_id', 'title', 'url'), array('columns' => 'weight', 'type' => 'ASC'));
         foreach ($menuItemsData as $key => $row) {
             $menuItemsData[$key]['url'] = Router::buildUrl($row['url']);
         }
         return $menuItemsData;
     }
 }
Ejemplo n.º 2
0
 protected function finishEvent($vars = array())
 {
     if (!empty($vars['parent_id'])) {
         Container::get('router')->redirect(explode('?', $_SESSION[$this->formName]['action'])[0] . '?id=' . $vars['parent_id']);
     }
     Container::get('router')->redirect($_SESSION[$this->formName]['action']);
 }
Ejemplo n.º 3
0
 public function pdfEditorAction(Request $request)
 {
     if ($request->query->has('entity') && $request->query->has('option') && $request->query->has('pdf')) {
         if (Container::registered($request->query->get('entity'))) {
             $entity = Container::get($request->query->get('entity'));
         }
         $pdfVarsMethod = 'Pdf' . ucfirst($request->query->get('option'));
         $pdf = $request->query->get('pdf');
         $pdfVars = $entity->{$pdfVarsMethod}($request);
         if ($request->request->has('body')) {
             return Container::get('Pdf/PdfEntityModel')->outEditedPdf($request->request->get('body'), $pdf, $pdfVars);
         }
         $formConf = array('action' => '/pdf/editor');
         $pdf = Container::get('Pdf/PdfEntityModel')->outPdfRaw($pdf, $pdfVars);
         $request->request->set('pdf', $pdf);
         $jsTop = array('jQuery' => '/Src/Modules/Pdf/Forms/Elements/PdfCKEditor/js/jquery-1.7.1.min.js', 'jsPdfDbg' => '/Src/Modules/Pdf/Forms/Elements/PdfCKEditor/js/jspdf.debug.js', 'jsPdfRequire' => '/Src/Modules/Pdf/Forms/Elements/PdfCKEditor/js/require.js', 'jsPdfConfig' => '/Src/Modules/Pdf/Forms/Elements/PdfCKEditor/js/config.js', 'jsPdf' => '/Src/Modules/Pdf/Forms/Elements/PdfCKEditor/js/basic.js', 'jsPdfPng' => '/Src/Modules/Pdf/Forms/Elements/PdfCKEditor/js/png_support/png.js', 'jsPdfZlib' => '/Src/Modules/Pdf/Forms/Elements/PdfCKEditor/js/png_support/zlib.js', 'jsPdfCssColors' => '/Src/Modules/Pdf/Forms/Elements/PdfCKEditor/js/css_colors.js', 'jsPdfCssFonts' => '/Src/Modules/Pdf/Forms/Elements/PdfCKEditor/js/standard_fonts_metrics.js', 'jsPdfSplitTextToSize' => '/Src/Modules/Pdf/Forms/Elements/PdfCKEditor/js/split_text_to_size.js', 'jsPdfCanvas' => '/Src/Modules/Pdf/Forms/Elements/PdfCKEditor/js/canvas.js', 'jsPdfHtml2Canvas' => '/Src/Modules/Pdf/Forms/Elements/PdfCKEditor/js/html2canvas.js', 'jsPdfAddImage' => '/Src/Modules/Pdf/Forms/Elements/PdfCKEditor/js/addimage.js', 'jsPdfPngSupport' => '/Src/Modules/Pdf/Forms/Elements/PdfCKEditor/js/png_support.js', 'jsPdfAnnotations' => '/Src/Modules/Pdf/Forms/Elements/PdfCKEditor/js/annotations.js', 'jsPdfContext2d' => '/Src/Modules/Pdf/Forms/Elements/PdfCKEditor/js/context2d.js', 'html2pdf' => '/Src/Modules/Pdf/Forms/Elements/PdfCKEditor/js/html2pdf.js');
         Container::get('params')->setThemeData(array('jsTop' => $jsTop));
         $this->useForm(new \Src\Modules\Pdf\Forms\PdfEditor('create'), $formConf, $request, 'block3');
         return $this->render();
         //$pdf = Container::get('Pdf/PdfEntityModel')->outPdfRaw($pdf, $pdfVars);
         //return $this->renderTwig('/Src/Modules/Pdf/Views/editor.html.twig', array('pdf'=>$pdf));
     } else {
         return new Response('Error');
     }
 }
Ejemplo n.º 4
0
 public function outEditedPdf($tpl, $key, $vars)
 {
     $entity = $this->selectEntity(array('key' => $key));
     $configModel = Container::get('Pdf/PdfConfigModel');
     $config = $configModel->selectEntity(array('id' => $entity[0]['config_id']));
     return $this->generate(Container::get('twigStr')->render($tpl, $vars), $config[0]);
 }
Ejemplo n.º 5
0
 public function setLanguageAction(Request $request)
 {
     $_SESSION['language'] = $request->request->get('language');
     $variable = $_SESSION['language'] ? 1 : 2;
     echo $variable;
     echo "<br>";
     print_r(Container::get('params')->langArray['main']);
 }
Ejemplo n.º 6
0
 protected function securityFormProcess($form, $request, $config)
 {
     if ($this->operation == 'check_password') {
         $form->addElement(new Element\HTML("<legend>" . Container::get('params')->langArray['enter_password'] . "</legend>"));
         $form->addElement(new Element\Password(Container::get('params')->langArray['password'] . ':', 'password', array('required' => 1, "validation" => new Md5("/" . Container::get('params')->adminPassword . "/", "Error: " . Container::get('params')->langArray['wrong_pass']))));
         $form->addElement(new Element\Captcha(Container::get('params')->langArray['captcha'] . ':', array('required' => 1)));
     }
     $this->addControls($form, $request);
     return $form;
 }
Ejemplo n.º 7
0
 protected function finishEvent($vars = array())
 {
     if ($this->operation == 'create') {
         if (!empty($vars['id'])) {
             Container::get('router')->redirect('/admin/menu/item/create', array('id' => $vars['id']));
         }
     } else {
         parent::finishEvent($vars);
     }
 }
Ejemplo n.º 8
0
 public static function registerServices()
 {
     Container::register('form_generator', function () {
         require_once 'vendor/php-form-generator/fg/load.php';
     });
     Container::register('pdf', function () {
         include Container::get('params')->getMPdfLocation();
         $pdf = new Pdf();
         //left, right, top, bottom
         $pdf->getMPDF(new mPDF('utf-8', 'A4', '8', '', 25, 15, 20, 20, 10, 10));
         return $pdf;
     });
     Container::register('errors', function () {
         return Errors::getInstance();
     });
     Container::register('params', function () {
         return Parameters::getInstance();
     });
     Container::register('twig', function () {
         $loader = new Twig_Loader_Filesystem(Container::get('params')->getViewDir());
         $cacheConfJson = file_get_contents(Container::get('params')->getConfigDir() . '/' . 'cache.json');
         $cacheConf = json_decode($cacheConfJson, true);
         if ($cacheConf['enable_cache']) {
             return new Nmzd_Twig_Environment($loader, array('cache' => Container::get('params')->getCacheDir()));
         } else {
             return new Nmzd_Twig_Environment($loader);
         }
     });
     Container::register('twigStr', function () {
         $loader = new Twig_Loader_String();
         $twig = new Twig_Environment($loader);
         $function = new Twig_SimpleFunction("form_text", function ($name, $id, $value = "", $class = "form_text") {
             require_once 'Src/Modules/Ajax/Libs/PhpLiveX/PHPLiveX.php';
             $ajax = new \PHPLiveX();
             require_once 'Src/Modules/Ajax/Controllers/MainController.php';
             $myClass = new \Src\Modules\Ajax\Controllers\MainController();
             $ajax->AjaxifyObjectMethods(array('myClass' => array('validateEmail')));
             $ajax->Run();
             echo '<input type="text" name="' . $name . '" id="' . $id . '" value="' . $value . '" class="' . $class . '">';
         });
         $twig->addFunction($function);
         return $twig;
     });
     Container::register('theme_settings', function () {
         $themeData = Container::get('params')->getThemeData();
         require_once 'Src/Views/Themes/' . $themeData['theme'] . '/ThemeSettings.php';
         $themeSettings = 'Src\\Views\\Themes\\' . $themeData['theme'] . '\\ThemeSettings';
         $themeSettingsInstance = new $themeSettings();
         $themeSettings = $themeSettingsInstance->getSettings();
         return $themeSettings;
     });
     Container::register('router', function () {
         return new \App\Core\Router();
     });
 }
Ejemplo n.º 9
0
 private static function initDbConnection()
 {
     try {
         $db = new PDO('pgsql:host=' . Container::get('params')->getDbData('host') . ';dbname=' . Container::get('params')->getDbData('db'), Container::get('params')->getDbData('user'), Container::get('params')->getDbData('pass'));
         $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
         static::$db = $db;
     } catch (PDOException $e) {
         echo $e->getMessage('Can\'t connect to database.');
     }
     return;
 }
Ejemplo n.º 10
0
 public function getSettings()
 {
     $themeData = Container::get('params')->getThemeData();
     $themeData['items']['block1']['main_menu'] = array('view' => '/Src/Views/Themes/Bootstrap/Components/navbar_top_black.html.twig', 'vars' => array('list' => Container::get('Main/MenuModel')->getMenu('main_menu')));
     $themeData['items']['block4']['footer'] = array('view' => '/Src/Views/Themes/Bootstrap/Components/footer_gray.html.twig', 'vars' => array('copyright' => 'ЧНУ ім.Богдана Хмельницького, 2014р.'));
     $themeData['css'][] = '/Src/Views/Themes/Bootstrap/css/bootstrap.min.css';
     $themeData['css'][] = '/Src/Views/Themes/Bootstrap/css/main.min.css';
     $themeData['jsTop']['jQuery'] = '/Src/Views/Themes/Bootstrap/js/jquery-1.9.1.min.js';
     $themeData['jsTop']['bootstrap'] = '/Src/Views/Themes/Bootstrap/js/bootstrap.min.js';
     return $themeData;
 }
Ejemplo n.º 11
0
 public function getThemeData($keys = array())
 {
     $defaults = array('global_vars' => array('base_url' => Container::get('params')->getProtocol() . Container::get('params')->getBaseUrl(), 'base_dir' => Container::get('params')->getViewDir(), 'brand' => 'EMSD', 'current_url' => $_SERVER['REQUEST_URI']));
     $themeData = array_merge($defaults, $this->themeData);
     if (empty($keys)) {
         return $themeData;
     } else {
         $data = $this->findThemeData($keys);
         $data = array_merge($this->themeData, $data);
         return $data;
     }
 }
Ejemplo n.º 12
0
 /**
  * Defines module services in service container. Fires on every request.
  */
 public function init()
 {
     Container::register('Pdf/PdfConfigModel', function () {
         return new \Src\Modules\Pdf\Models\PdfConfigModel();
     });
     Container::register('Pdf/PdfTemplateModel', function () {
         return new \Src\Modules\Pdf\Models\PdfTemplateModel();
     });
     Container::register('Pdf/PdfEntityModel', function () {
         return new \Src\Modules\Pdf\Models\PdfEntityModel();
     });
 }
Ejemplo n.º 13
0
 public function submit(Request $request, $form)
 {
     $enableCache = $request->request->get('enable_cache');
     $cacheConfJson = file_get_contents(Container::get('params')->getConfigDir() . '/' . 'cache.json');
     $cacheConf = json_decode($cacheConfJson, true);
     $cacheConf = array_fill_keys(array_keys($cacheConf), false);
     if (empty($enableCache)) {
         $cacheConf['enable_cache'] = false;
     } else {
         $cacheConf['enable_cache'] = true;
     }
     file_put_contents(Container::get('params')->getConfigDir() . '/' . 'cache.json', json_encode($cacheConf, JSON_UNESCAPED_UNICODE));
     Container::get('router')->redirect('/admin');
 }
Ejemplo n.º 14
0
 protected function setAction($controllerPath, $method, $params, $secure = false)
 {
     $basePath = Container::get('params')->getBasePath();
     require_once $basePath . '/' . $controllerPath . '.php';
     $space = $this->pathToNamespace($controllerPath);
     $controller = new $space();
     $action = $method . 'Action';
     if ($secure) {
         if (empty($_SESSION['security_access']) || $_SESSION['security_access'] == false) {
             require_once $basePath . '/Src/Modules/Main/Controllers/MainController.php';
             $space = $this->pathToNamespace('Src/Modules/Main/Controllers/MainController');
             $controller = new $space();
             $action = 'securityAction';
         }
     }
     return $controller->{$action}($params);
 }
Ejemplo n.º 15
0
 public function submit(Request $request)
 {
     $menuTitle = $request->request->get('title');
     $menuKey = $request->request->get('menu_key');
     $model = Container::get('Main/MenuModel');
     if ($this->operation == 'create') {
         $model->createMenu(array('title' => $menuTitle, 'menu_key' => $menuKey), 'menu_key');
     }
     if ($this->operation == 'update') {
         $id = $request->query->get('id');
         $model->updateMenu(array('title' => $menuTitle, 'menu_key' => $menuKey), array('id' => $id));
     }
     $step = $request->request->get('step');
     if ($step == 'finish') {
         Container::get('router')->redirect($_SESSION[$this->formName]['action']);
     }
 }
Ejemplo n.º 16
0
 protected function defineFields($form, $values = array(), $operation)
 {
     $request = Request::createFromGlobals();
     if ($operation == 'delete') {
         $form->addElement(new Element\HTML('<legend>' . Container::get('params')->langArray['remove_menu'] . '</legend>'));
         $form->addElement(new Element\Button(Container::get('params')->langArray['cancel'], 'button', array('onclick' => 'history.go(-1);')));
         $form->addElement(new Element\Button(Container::get('params')->langArray['delete']));
     } else {
         $form->addElement(new Element\Hidden('id', $request->query->get('id')));
         $form->addElement(new Element\HTML('<legend>' . Container::get('params')->langArray['creating_new_menu'] . '</legend>'));
         $form->addElement(new Element\Textbox(Container::get('params')->langArray['name'] . ':', 'title', array('required' => 1, 'value' => empty($values['title']) ? '' : $values['title'])));
         $form->addElement(new Element\Textbox(Container::get('params')->langArray['id'] . ':', 'menu_key', array('required' => 1, 'value' => empty($values['menu_key']) ? '' : $values['menu_key'])));
         $form->addElement(new Element\Button(Container::get('params')->langArray['cancel'], 'button', array('onclick' => 'history.go(-1);')));
         $form->addElement(new Element\Button(Container::get('params')->langArray['save']));
     }
     return $form;
 }
Ejemplo n.º 17
0
 protected function defineFields($form, $values = array(), $operation)
 {
     if ($operation == 'delete') {
         $form->addElement(new Element\HTML('<legend>' . Container::get('params')->langArray['remove_discipline'] . '?</legend>'));
         $form->addElement(new Element\Button(Container::get('params')->langArray['cancel'], 'button', array('onclick' => 'history.go(-1);')));
         $form->addElement(new Element\Button(Container::get('params')->langArray['delete']));
     } else {
         $form->addElement(new Element\HTML('<legend>' . Container::get('params')->langArray['creation_new_discipline'] . '</legend>'));
         $form->addElement(new Element\Textbox(Container::get('params')->langArray['name'] . ':', 'title', array('required' => 1, 'value' => empty($values['title']) ? '' : $values['title'])));
         $form->addElement(new Element\Number(Container::get('params')->langArray['semester'], 'semester', array('required' => 1, 'value' => empty($values['semester']) ? '' : $values['semester'])));
         $form->addElement(new Element\Number(Container::get('params')->langArray['id_direction'] . ':', 'id_speciality', array('value' => empty($values['id_speciality']) ? '' : $values['id_speciality'], 'min' => '-1', 'max' => '9999', 'maxlength' => '4')));
         $form->addElement(new Element\Textbox(Container::get('params')->langArray['id_subspeciality'], 'id_subspeciality', array('required' => 1, 'value' => empty($values['id_subspeciality']) ? '' : $values['id_subspeciality'])));
         $form->addElement(new Element\Button(Container::get('params')->langArray['cancel'], 'button', array('onclick' => 'history.go(-1);')));
         $form->addElement(new Element\Button(Container::get('params')->langArray['save']));
     }
     return $form;
 }
Ejemplo n.º 18
0
 /**
  * Aggregates routes for all enabled modules.
  */
 public static function getAll()
 {
     $request = Request::createFromGlobals();
     $uri = $request->getRequestUri();
     $uriArr = explode('/', ltrim(strtok($uri, '?'), '/'));
     $routes = new RouteCollection();
     $modules = static::getModules();
     foreach ($modules as $name => $state) {
         if (!$state) {
             continue;
         }
         $path = '/Src/Modules/' . ucfirst($name);
         if (!file_exists(Container::get('params')->getBasePath() . $path . '/Module.php')) {
             continue;
         }
         $instance = static::pathToNamespace($path . '/Module');
         $module = new $instance();
         $module->init();
         $module->boot();
     }
     $modulePath = 'Src/Modules/Main/Module';
     $moduleSpace = static::pathToNamespace($modulePath);
     $module = new $moduleSpace();
     $module->init();
     $module->boot();
     $routes->add('home', new Route('', array('_controller' => function (Request $request) {
         $controllerPath = 'Src/Modules/Main/Controllers/MainController';
         $space = static::pathToNamespace($controllerPath);
         $controller = new $space();
         $action = 'indexAction';
         return $controller->{$action}($request);
     })));
     if (!empty($uriArr[0])) {
         $path = '/Src/Modules/' . ucfirst($uriArr[0]);
         $instance = static::pathToNamespace($path . '/Module');
         $module = new $instance();
         $moduleRoutes = $module->getRoutes();
         if (!empty($moduleRoutes)) {
             foreach ($moduleRoutes as $id => $params) {
                 $routes->add(str_replace('-', '_', ucfirst($uriArr[0])) . '_' . $id, new Route('/' . $uriArr[0] . $params['uri'], $params['settings']));
             }
         }
     }
     return $routes;
 }
Ejemplo n.º 19
0
 /**
  * Defines module services in service container. Fires on every request.
  */
 public function init()
 {
     Container::register('Nmkd/DisciplineModel', function () {
         return new \Src\Modules\Nmkd\Models\DisciplineModel();
     });
     Container::register('Nmkd/LabModel', function () {
         return new \Src\Modules\Nmkd\Models\LabModel();
     });
     Container::register('Nmkd/TypesModel', function () {
         return new \Src\Modules\Nmkd\Models\TypesModel();
     });
     Container::register('Nmkd/NmkdModel', function () {
         return new \Src\Modules\Nmkd\Models\NmkdModel();
     });
     Container::register('Nmkd/TestModel', function () {
         return new \Src\Modules\Nmkd\Models\TestModel();
     });
 }
Ejemplo n.º 20
0
 public function indexAction($request)
 {
     $jsTop = array('jQuery' => '/Src/Views/Themes/Bootstrap/js/jquery-1.9.1.js', 'aje' => '/Src/Views/Themes/Bootstrap/js/aje.js');
     $jsBottom = array('autosave' => '/Src/Modules/Nmkd/Forms/js/autosave.js');
     $data = array();
     $data['script'] = new Response("\$(`.ajecontainer`).aje().setData({`msg`:`ololo`,`block`:`block2`,`component`:`aje_test`}).setMenu(`.testMenu`);");
     $collectedComponent = array('top_menu' => array('view' => '/Src/Views/Themes/Bootstrap/Components/horizontal_pills.html.twig', 'vars' => array('list' => array('children' => array(array('title' => Container::get('params')->langArray['create'], 'url' => Router::buildUrl('/discipline/create')))))), 'aje_test' => array('view' => '/Src/Views/Themes/Bootstrap/Components/ajax.html.twig', 'vars' => array('url' => Router::buildUrl('/ajax/test'), 'script' => $data['script'])));
     $formConf = array('action' => $this->entityUrl, 'prevent' => array('bootstrap', 'jQuery'));
     $form = $this->useForm(new $this->form('update'), $formConf, $request, $this->block);
     if ($request->isXmlHttpRequest()) {
         //$formConf = array('action' => '/nmkd/nmkd/edit');
         //$form = $this->useForm(new $this->form('update'), $formConf, $request, $this->block);
         $twig = Container::get('twig');
         //$response = $twig->render($form['view'], $form['vars']);
         //return new Response($form['vars']['form']);
         //return new Response($response);
     }
     //$collectedComponent['rules']['ajemenu'] = array('topMenu'=>'aje_test');
     Container::get('params')->setThemeData(array('jsTop' => $jsTop));
     Container::get('params')->setThemeData(array('jsBottom' => $jsBottom));
     Container::get('params')->setThemeData(array('items' => array('block2' => $collectedComponent)));
     return $this->render($data);
 }
Ejemplo n.º 21
0
 public function init()
 {
     Container::register('Main/MenuModel', function () {
         return new \Src\Modules\Main\Models\MenuModel();
     });
     Container::register('Main/MenuItemModel', function () {
         return new \Src\Modules\Main\Models\MenuItemModel();
     });
     /*Container::get('params')->setMenus('main_menu', array(
           'home' => array(
               'title' => 'Головна',
               'uri' => Router::buildUrl('/'),
               'weight' => 0,
           ),
       ));*/
     /*Container::get('params')->registerMenu('nmkd_menu', array(
           'nmkd' => array(
               'title' => 'Головна',
               'uri' => Router::buildUrl('/'),
               'weight' => 0,
           ),
       ));*/
 }
Ejemplo n.º 22
0
 public function deleteAction($request)
 {
     Container::get('params')->setThemeData('layout', '3-9');
     Container::get('params')->setThemeData(array('items' => array('block2' => array('admin_menu' => array('view' => '/Src/Views/Themes/Bootstrap/Components/nav_vertical_pills.html.twig', 'vars' => array('list' => Container::get('Main/MenuModel')->getMenu('admin_menu')))))));
     return parent::deleteAction($request);
 }
Ejemplo n.º 23
0
 public function pdfTestAction(Request $request)
 {
     Container::get('params')->setThemeData(array('items' => array('block2' => array('admin_menu' => array('view' => '/Src/Views/Themes/Bootstrap/Components/nav_vertical_pills.html.twig', 'vars' => array('list' => Container::get('Main/MenuModel')->getMenu('nmkd_pdf_menu', array('id' => $request->query->get('id')))))))));
     return $this->render();
 }
Ejemplo n.º 24
0
 public function ViewSavedTicketsAction()
 {
     //        header("Content-type: text/html; charset=utf-8");
     //        echo "<pre>";
     //        print_r(Container::get('Nmkd/TestModel')->ExecuteFromDB());
     $TicketSessions = Container::get('Nmkd/TestModel')->ExecuteFromDB();
     //        foreach ($TicketSessions as $number=>$session)// для каждой сессии
     //        {
     //
     //            foreach ($session as $key=>$question )
     //            {
     //                if ($key<$maxValue)
     //                {
     //                    $questionsArray[]=$question;
     //                }
     //                else
     //                {
     //                    $maxValue+=$quantity_questions_on_ticket;
     //                    $TicketsArray[]=$questionsArray;
     //                    $questionsArray=array();
     //                }
     //
     //            }
     //            $SessionsArray[]=$TicketsArray;
     //            $TicketsArray=array();
     //        }
     $twig = Container::get('twig');
     $view = '/Src/Views/archiveTickets.html.twig';
     $viewVars = array('array' => $TicketSessions);
     $response = $twig->render($view, $viewVars);
     return new Response($response);
 }
Ejemplo n.º 25
0
 /**
  * @param $request
  * @return \Symfony\Component\HttpFoundation\Response
  * @throws \Exception
  */
 public function viewAllAction($request)
 {
     $parent = Container::get($this->entity)->getParent();
     if (empty($parent)) {
         $menuList = Container::get($this->entity)->getEntityList();
     } else {
         $menuList = Container::get($this->entity)->getParentEntityList($request->query->get('id'));
     }
     $list = array();
     $titles = array(Container::get('params')->langArray['list'], Container::get('params')->langArray['options']);
     foreach ($menuList as $row) {
         $list[$row['title']] = array(Container::get('params')->langArray['edit'] => Router::buildUrl($this->entityUrl . '/edit', array('id' => $row['id'])), Container::get('params')->langArray['delete'] => Router::buildUrl($this->entityUrl . '/delete', array('id' => $row['id'])));
     }
     /*$topMenuComponent = '/Src/Views/Themes/Bootstrap/Components/horizontal_pills.html.twig';
             $topMenuVars = array(
                         'list' => array(
                             'children' => array(
                                 array(
                                     'title' => 'Створити',
                                     'url' => (empty($parent)) ?
                                         Router::buildUrl($this->entityUrl . '/create') :
                                         Router::buildUrl($this->entityUrl . '/create', array('id' => $request->query->get('id'))),
                                 )
                             ),
                         ),
                     );
             $disciplinesListComponent = '/Src/Views/Themes/Bootstrap/Components/list_with_options.html.twig';
             $disciplinesListVars = array(
                         'list' => $list,
                         'titles' => $titles,
                     );
             
             
     
             Container::get('params')->setThemeData(
                 array(
                     'items' => array(
                         $this->block => array(
                             'menus_top_menu' => array(
                                 'view' => $topMenuComponent,
                                 'vars' => $topMenuVars,
                             ),
                             'menus_list' => array(
                                 'view' => $disciplinesListComponent,
                                 'vars' => $disciplinesListVars,
                             ),
                         )
                     )
                 )
             );*/
     $view = '/Src/Views/Themes/Bootstrap/Components/entity_list.html.twig';
     $viewVars = array('entity' => array('isAjax' => $request->isXmlHttpRequest() ? true : false, 'topMenu' => array('children' => array(array('title' => Container::get('params')->langArray['create'], 'url' => empty($parent) ? Router::buildUrl($this->entityUrl . '/create') : Router::buildUrl($this->entityUrl . '/create', array('id' => $request->query->get('id')))))), 'table' => array('list' => $list, 'titles' => $titles)));
     Container::get('params')->setThemeData(array('items' => array($this->block => array('entity_list' => array('view' => $view, 'vars' => $viewVars)))));
     if ($request->isXmlHttpRequest()) {
         $twig = Container::get('twig');
         $response = '';
         $response .= $twig->render($view, $viewVars);
         //$response .= $twig->render($disciplinesListComponent, $disciplinesListVars);
         return new Response($response);
     }
     return $this->render();
 }
Ejemplo n.º 26
0
 public function saveSession($step, $idDiscipline)
 {
     $sessionData = Container::get('session_storage')->getAll();
     $sessionData['step'] = $step;
     if ($this->sessionExists($idDiscipline)) {
         $sessionQuery = self::$db->prepare("UPDATE sessions SET\n                                                session_data = :session_data\n                                                WHERE id_disc = :id_disc ");
     } else {
         $sessionQuery = self::$db->prepare("INSERT INTO sessions(session_data, id_disc)\n                                      VALUES (:session_data, :id_disc) ");
     }
     self::$db->beginTransaction();
     $sessionQuery->bindValue(':session_data', serialize($sessionData));
     $sessionQuery->bindValue(':id_disc', $idDiscipline);
     $sessionQuery->execute();
     self::$db->commit();
     print_r($sessionData);
 }
Ejemplo n.º 27
0
 protected function finishEvent($vars = array())
 {
     Container::get('router')->redirect('/admin/menu/view', array('id' => $vars['parent_id']));
 }
Ejemplo n.º 28
0
 protected function preProcessView()
 {
     Container::get('params')->setThemeData('layout', '3-9');
     Container::get('params')->setThemeData(array('items' => array('block2' => array('admin_menu' => array('view' => '/Src/Views/Themes/Bootstrap/Components/nav_vertical_pills.html.twig', 'vars' => array('list' => Container::get('Main/MenuModel')->getMenu('admin_menu')))))));
 }
Ejemplo n.º 29
0
 protected function finishEvent($vars = array())
 {
     Container::get('router')->redirect($_SESSION[$this->formName]['action']);
 }
Ejemplo n.º 30
0
 protected function params()
 {
     return Container::get('params');
 }