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); }
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); } }
/** * @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'])); }