/**
  * @access public
  */
 public function showForm($withOptions = true)
 {
     MT::addTemplate(dirname(__FILE__) . "/show_form.phtml", 'gallery');
     $id_node = $_GET['id_modul'];
     $form = new NForm('saveGalleryForm');
     $form->getElementPrototype()->id = "formGallery";
     $form->addGroup('Nastavenie galérie');
     $form->addText('name', 'Názov');
     $form->addText('th_width', 'Šírka náhľadov');
     $form->addText('th_height', 'Výška náhľadov');
     $form->addText('width', 'Šírka obrázka');
     $form->addText('height', 'Výška obrázka');
     $form->addSelect('open_in_window', 'Otvárať do nového okna', array(1 => 'áno', 0 => 'nie'));
     $form->addSelect('type', 'Typ zobrazenia galérie', (array) NEnvironment::getConfig('gallery')->type);
     $form->addSubmit('saveGallery', 'Ulož');
     $form->onSubmit[] = array($this, 'save');
     $form->fireEvents();
     $defaults = self::get($id_node);
     if ($defaults != NULL) {
         $form->setDefaults($defaults);
     }
     $f = new FilesNode(self::MODULE_NAME, $_GET['id_modul']);
     MT::addVar('gallery', 'showMultiupload', $f->render());
     MT::addVar('gallery', 'galleryOptionsForm', $form);
     MT::addVar('gallery', 'withOptions', $withOptions);
     MT::addVar('gallery', 'gallery', self::get($_GET['id_modul']));
     MT::addVar('gallery', 'list', self::getAllFiles(self::MODULE_NAME, $_GET['id_modul']));
 }
Example #2
0
 protected function createComponentVyhledatOddilForm()
 {
     $form = new NForm();
     $form->addText('id', 'Vyhledat oddil');
     $form->addSubmit('send', 'Vyhledat');
     $form->onSuccess[] = callback($this, 'vyhledatOddilFormSubmitted');
     return $form;
 }
Example #3
0
 function showForm()
 {
     $l = dibi::fetch("SELECT * FROM gmap WHERE id_node=%i", $_GET['id_modul']);
     MT::addTemplate(dirname(__FILE__) . '/GMapAdmin.phtml', 'gmap');
     MT::addVar('gmap', 'l', $l);
     MT::addVar('gmap', 'node_info', dibi::fetch("SELECT * FROM [node] WHERE id_node=%i", $_GET['id_modul']));
     $form = new NForm();
     $form->addText('key', 'Kľúč')->getControlPrototype()->style = "width:400px;";
     $form->addText('width', 'Sirka')->getControlPrototype()->style = "width:80px;";
     $form->addText('height', 'Vyska')->getControlPrototype()->style = "width:80px;";
     $form->addText('lat', 'Latitude')->getControlPrototype()->style = "width:120px;";
     $form->addText('lon', 'Longitude')->getControlPrototype()->style = "width:120px;";
     $form->addTextarea('infoWindowText', 'Info Text');
     $form->addCheckbox('googleBar', 'Google bar');
     $form->addCheckbox('enableScrollWheelZoom', 'Skrolovanie koleckom na mysi');
     $form->addCheckbox('doubleClickZoom', 'Priblizenie dvojklikom');
     $form->addText('langLocation', 'Lokalizacia')->getControlPrototype()->style = "width:50px;";
     $form->addText('zoom', 'Priblizenie')->getControlPrototype()->style = "width:50px;";
     $form->addText('address', 'Adresa')->getControlPrototype()->style = "width:400px;";
     $form->addHidden('id_node', $_GET['id_modul']);
     $form->addSubmit('saveGMap', 'Ulozit');
     $form->setDefaults($l);
     MT::addVar('gmap', 'form', $form);
 }
Example #4
0
 function show()
 {
     MT::addTemplate(dirname(__FILE__) . '/menu.phtml', 'leftHolder');
     MT::addVar('leftHolder', 'dir', '/require_modules/Setting');
     MT::addCss('/require_modules/Setting/css/setting.css', 'settingCss');
     MT::addContent(MT::renderCurrentTemplate('leftHolder'), 'leftHolder');
     MT::addTemplate(dirname(__FILE__) . '/setting.phtml', 'setting');
     NDebug::fireLog('start Duplicate Tree');
     switch (@$_GET['setting_action']) {
         case 'lang':
             if (isset($_GET['ajax_action'])) {
                 switch ($_GET['ajax_action']) {
                     case "active_lang":
                         $active = dibi::fetchSingle("SELECT active FROM [lang] WHERE id_lang=%i", $_GET['id_lang']);
                         dibi::query("UPDATE [lang] SET active=%i", (bool) (!$active), "WHERE id_lang=%i", $_GET['id_lang']);
                         break;
                     case 'edit_name':
                         dibi::query("UPDATE [lang] SET name=%s", $_GET['name'], "WHERE id_lang=%i", $_GET['id_lang']);
                         break;
                     case 'edit_rate':
                         dibi::query("UPDATE [lang] SET rate=%s", $_GET['rate'], "WHERE id_lang=%i", $_GET['id_lang']);
                         break;
                     case 'edit_currency':
                         dibi::query("UPDATE [lang] SET currency=%s", $_GET['currency'], "WHERE id_lang=%i", $_GET['id_lang']);
                         break;
                 }
                 exit;
             }
             if (isset($_GET['id_lang_delete'])) {
                 dibi::query("DELETE FROM lang WHERE id_lang=%i", $_GET['id_lang_delete']);
                 header('Location: admin.php?setting_action=lang');
                 exit;
             }
             MT::addTemplate(dirname(__FILE__) . '/lang.phtml', 'lang');
             MT::addVar('lang', 'langs', dibi::fetchAll("SELECT * FROM lang"));
             $form = new NForm();
             $renderer = $form->getRenderer();
             //
             $renderer->wrappers['controls']['container'] = 'div';
             $renderer->wrappers['pair']['container'] = 'div';
             $renderer->wrappers['label']['container'] = 'span';
             $renderer->wrappers['control']['container'] = '';
             $form->addText('lang', 'Pridanie nového jazyka')->addRule(NForm::FILLED, 'Názov jazyka musí byť vyplnený.');
             $form->addText('iso', 'ISO')->addRule(NForm::FILLED, 'ISO jazyka musí byť vyplnený.');
             $form->addSubmit('add_lang', 'Pridať');
             $form->onSubmit[] = array($this, 'addLang');
             $form->fireEvents();
             MT::addVar('lang', 'lang_form', $form);
             break;
             /*
              * Duplicate
              */
         /*
          * Duplicate
          */
         case 'duplicate':
             MT::addTemplate(dirname(__FILE__) . '/duplicate/duplicate.phtml', 'duplicate');
             $form = new NForm();
             $form->addSelect('sourceLang', 'Zdrojový jazyk', dibi::query("SELECT iso,name FROM [lang]")->fetchPairs('iso', 'name'));
             $form->addSelect('destLang', 'Jazyk, do ktorého prekopírujeme všetky položky.', dibi::query("SELECT iso,name FROM [lang]")->fetchPairs('iso', 'name'));
             $form->addSubmit('duplicate_submit', 'Kopírovať');
             $form->onSubmit[] = array($this, 'duplicate');
             $form->fireEvents();
             MT::addVar('duplicate', 'duplicate_form', $form);
             break;
     }
 }
Example #5
0
 function showUsers()
 {
     $user = NEnvironment::getUser();
     if (!$user->isAllowed('manage_user', 'edit')) {
         throw new LogicException('Nemáte dostatočné oprávnenie na túto sekciu');
     }
     try {
         //uprava uzivatela
         if (isset($_GET['id_auth_user']) and $_GET['id_auth_user'] != "") {
             $form = new NForm();
             $form->addText('name', 'Meno');
             $form->addText('surname', 'Priezvisko');
             $form->addText('email', 'Email');
             $form->addText('login', 'Login')->addRule(NFORM::FILLED, 'Login musí byť vyplnený');
             $form->addPassword('password', 'Heslo');
             $role = dibi::query('SELECT id_auth_role, key_name FROM auth_role ORDER BY key_name')->fetchPairs('id_auth_role', 'key_name');
             $form->addPassword('password2', 'Znova heslo')->addConditionOn($form['password'], NForm::FILLED)->addRule(NForm::FILLED, 'Zadejte heslo pro kontrolu')->addRule(NForm::EQUAL, 'Hesla se musi shodovat', $form['password']);
             $form->addSelect('id_auth_role', 'Uživateľská skupina:', $role);
             $form->addSubmit('addUser', 'Upravit');
             $form->onSubmit[] = array($this, 'changeUser');
             if (!$form->isSubmitted()) {
                 // 	první zobrazení, nastavíme výchozí hodnoty
                 $form->setDefaults(dibi::fetch("SELECT *, id_auth_role FROM auth_user LEFT JOIN [auth_user_role] USING(id_auth_user) WHERE auth_user.id_auth_user=%i", $_GET['id_auth_user']));
             }
             $form->fireEvents();
             MT::addTemplate(APP_DIR . '/require_modules/authentication/editUser.phtml', 'editUser');
             MT::addVar('editUser', 'form', (string) $form);
         }
     } catch (Exception $e) {
         ?>
   <div style="border:2px solid red;padding:5px;">
     <?php 
         echo $e->getMessage();
         ?>
   </div><?php 
     }
     if (!isset($_GET['id_auth_user'])) {
         if (isset($_GET['id_delete_user'])) {
             $this->deleteUser();
         }
         $form = new NForm();
         $form->getElementPrototype()->id = 'formAddUser';
         $form->addText('name', 'Meno');
         $form->addText('surname', 'Priezvisko');
         $form->addText('email', 'Email');
         $form->addText('login', 'Login')->addRule(NFORM::FILLED, 'Login musí byť vyplnený');
         $form->addPassword('password', 'Heslo')->addRule(NForm::FILLED, 'Zadejte heslo');
         $role = dibi::query('SELECT id_auth_role, key_name FROM [auth_role] ORDER BY key_name')->fetchPairs('id_auth_role', 'key_name');
         $form->addPassword('password2', 'Znova heslo')->addRule(NForm::FILLED, 'Zadejte heslo pro kontrolu')->addRule(NForm::EQUAL, 'Hesla se musi shodovat', $form['password']);
         $form->addSelect('id_auth_role', 'Uživateľská skupina:', $role);
         $form->addSubmit('addUser', 'Pridať použivateľa');
         $form->onSubmit[] = array($this, 'addUser');
         $form->fireEvents();
         MT::addTemplate(APP_DIR . '/require_modules/authentication/showUsers.phtml', 'showUsers');
         $list = dibi::fetchAll("\n      \tSELECT \n      \t\t*\n      \tFROM \n      \t\tauth_user\n      \tORDER BY login");
         MT::addVar('showUsers', 'list', $list);
         MT::addVar('showUsers', 'form', $form);
     }
 }