Esempio n. 1
0
 function showForm()
 {
     $l = dibi::fetch("SELECT * FROM " . self::TABLE . " WHERE id_node=%i", $_GET['id_modul']);
     MT::addTemplate(dirname(__FILE__) . '/default.phtml', self::TABLE);
     MT::addVar(self::TABLE, 'l', $l);
     MT::addVar(self::TABLE, 'table', self::TABLE);
 }
Esempio n. 2
0
 function __construct()
 {
     //-----vytvorenie objektu menu
     $menu = new MenuItem();
     $menu->menuAction();
     //-----vytvorenie objektu node
     $node = new node();
     $node->nodeAction();
     MT::addContent($menu->render(), 'leftHolder');
     try {
         if (isset($_GET['id_menu_item']) or isset($_GET['addMenuItem']) or isset($_GET['changeMenuItem'])) {
             MT::addTemplate(APP_DIR . '/templates/admin/modulHolder.phtml', 'modulHolder');
             MT::addVar('modulHolder', 'type_modul', dibi::fetchAll("SELECT * FROM [type_modul] WHERE visible_for_user='******'"));
         }
         //zobrazenie zmeny polozky pre menu
         if (isset($_GET['changeMenuItem'])) {
             $menu->showChangeMenuItem($_GET['id_menu_item']);
         }
         if (isset($_GET['id_menu_item']) and !isset($_GET['changeMenuItem'])) {
             $node->showModul();
         }
         //pridanie polozky do menu
         if (isset($_GET['addMenuItem'])) {
             $menu->showAddMenuItem();
         }
         //zachytenie vynimie
     } catch (NodeException $e) {
         echo '<div style="border: 2px solid red; padding: 5px;">' . $e->getMessage() . '</div>';
         exit;
     }
 }
Esempio n. 3
0
 public static function show()
 {
     if (isset($_GET['ajax_action_section']) and $_GET['ajax_action_section'] == 'save_description') {
         dibi::query("\n  \t\t\tUPDATE [newsletter_emails] \n  \t\t\tSET description = %s", $_POST['description'], "WHERE id_newsletter_emails = %i", $_POST['id_newsletter_emails']);
         exit;
     }
     MT::addTemplate(APP_DIR . '/require_modules/newsletter/default.phtml', 'newsletter');
     $ds = NewsletterModel::getDatasource();
     if (isset($_GET['id_newsletter_delete'])) {
         NewsletterModel::delete($_GET['id_newsletter_delete']);
         header('location: admin.php?section=newsletter');
         exit;
     }
     if (isset($_GET['export'])) {
         $dse = clone $ds;
         MT::addVar('newsletter', 'export', $dse->where('active = 1 AND id_newsletter_emails IN %l', $_GET['id'])->fetchAll());
     }
     if (@$_GET['order_by'] == 'email') {
         $ds->orderBy('email');
     } else {
         $ds->orderBy('adddate');
     }
     //$vp = new MyPaginator($ds, 10);
     MT::addVar('newsletter', 'emails', $ds->fetchAll());
     //  	MT::addVar('newsletter', 'vp', $vp);
 }
Esempio n. 4
0
 function showForm()
 {
     $l = dibi::fetch("SELECT * FROM " . self::TABLE . " WHERE id_node=%i", $_GET['id_modul']);
     MT::addTemplate(dirname(__FILE__) . '/default.phtml', 'Home');
     MT::addVar('Home', 'l', $l);
     $f = new Promo(self::MODULE_NAME, $_GET['id_modul']);
     MT::addVar('Home', 'showPromo', $f->render());
 }
Esempio n. 5
0
 function showForm()
 {
     $l = dibi::fetch("SELECT * FROM article WHERE id_node=%i", $_GET['id_modul']);
     MT::addTemplate(dirname(__FILE__) . '/adminArticle.phtml', 'article');
     MT::addVar('article', 'l', $l);
     $f = new FilesNode(self::MODULE_NAME, $_GET['id_modul']);
     $f->type = 'all';
     MT::addVar('article', 'showMultiupload', $f->render());
     //    Admin_Comment::action(false);
     //    MT::addVar('article', 'comments', Admin_Comment::getCommentListForArticle($_GET['id_modul']));
 }
Esempio n. 6
0
 function showForm()
 {
     $l = dibi::fetch("SELECT * FROM [module_product] WHERE id_node=%i", $_GET['id_modul']);
     MT::addTemplate(dirname(__FILE__) . '/adminProduct.phtml', 'product');
     MT::addVar('product', 'l', $l);
     $f = new FilesNode(self::MODULE_NAME, $_GET['id_modul']);
     $f->type = 'all';
     $f->allowedExtensions = array('jpg', 'pdf', 'png');
     MT::addVar('product', 'showMultiupload', $f->render());
     //    $g = new Admin_GalleryMultiuploadControl();
     //    $g->action();
     //    $g->showForm($withOptions = false);
 }
Esempio n. 7
0
 function showLog()
 {
     $session = NEnvironment::getSession('Log');
     if (isset($_GET['order_by'])) {
         if ($_GET['order_by'] != "date" and $_GET['order_by'] != "id_user" and $_GET['order_by'] != "description" and $_GET['order_by'] != "value" and $_GET['order_by'] != "value" and $_GET['order_by'] != "id_type_modul" and $_GET['order_by'] != "ip") {
             $session['log_order_by'] = "date";
         } else {
             $session['log_order_by'] = $_GET['order_by'];
         }
     }
     if (!isset($session['log_order_by'])) {
         $session['log_order_by'] = "date";
     }
     $source = dibi::dataSource("\n\t\t\tSELECT log.*, user.login  \n\t\t\tFROM log LEFT JOIN user USING(id_user) \n\t\t\tWHERE\n\t\t\t\t%if", @$_GET['input_id_user'] != '', "login LIKE %s", '%' . @$_GET['input_id_user'] . '%', " AND %end\n\t\t      \t%if", @$_GET['input_date'] != '', "[date] > %s", @$_GET['input_date'], " AND %end\n\t\t\t    %if", @$_GET['input_description'] != '', "description LIKE %s", '%' . @$_GET['input_description'] . '%', " AND %end\n\t\t\t    %if", @$_GET['input_value'] != '', "value LIKE %s", '%' . @$_GET['input_value'] . '%', " AND %end\n\t\t\t    %if", @$_GET['input_id_type_modul'] != '', "name_modul LIKE %s", '%' . @$_GET['input_id_type_modul'] . '%', " AND %end\n\t\t\t    ip LIKE %s", '%' . @$_GET['input_ip'] . '%', " \n\t\t    \n\t\t    ORDER BY " . $session['log_order_by'] . " DESC");
     $p = new MyPaginator($source);
     MT::addTemplate(dirname(__FILE__) . '/log.phtml', 'log');
     MT::addVar('log', 'paginator', $p);
     MT::addVar('log', 'list', $p->getDataSourceItem()->fetchAll());
 }
Esempio n. 8
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);
 }
Esempio n. 9
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;
     }
 }
Esempio n. 10
0
    function showModul()
    {
        $list = dibi::fetchAll("SELECT * FROM node LEFT JOIN type_modul USING(id_type_modul) WHERE id_menu_item=%i", $_GET['id_menu_item'], " ORDER BY sequence DESC");
        try {
            if (!$list) {
                return false;
            }
        } catch (NodeException $e) {
            echo '<div style="border: 2px solid red; padding: 5px;">

          	' . $e->getMessage() . '

        </div>';
        }
        if (isset($_GET['id_type_modul']) and isset($_GET['id_modul'])) {
            $this->activeModul->showForm();
        } else {
            $array_list = array();
            foreach ($list as $l) {
                $l['title'] = $this->nodeFactory($l['id_type_modul'], $l['dir'])->showTitle($l['id_node'], $l['id_type_modul']);
                $array_list[] = $l;
            }
            MT::addTemplate(APP_DIR . '/templates/admin/showNode.phtml', 'showNode');
            //			print_r($array_list);
            MT::addVar('showNode', 'array_list', $array_list);
            //		print_r(NEnvironment::getConfig('variable'));
            MT::addVar('showNode', 'var', NEnvironment::getContext()->parameters);
        }
    }
Esempio n. 11
0
 public static function getCommentListForArticle($id_node)
 {
     self::doCommentTree($id_node);
     MT::addTemplate(dirname(__FILE__) . '/Admin_commentlist_edit.phtml', 'comment');
     MT::addVar('comment', 'comments_buffer', self::$bufferOutput);
 }
Esempio n. 12
0
        case "admin_modules":
            $t = new type_modul();
            $t->showForm();
            break;
        case "log":
            $l = new log();
            $l->showLog();
            break;
        case "file_manager":
            MT::addTemplate(APP_DIR . '/templates/admin/fileManagerIFrame.phtml', 'fileManager');
            break;
        case "groups":
            $a->showGroup();
            break;
        case "newsletter":
            Admin_Newsletter::show();
            break;
        case 'setting':
            $s = new Setting();
            $s->show();
            break;
        case 'comment':
            Admin_Comment::action();
            Admin_Comment::commentList();
            break;
    }
} catch (LogicException $e) {
    MT::addTemplate(APP_DIR . '/templates/admin/error_message.phtml', 'error_message');
    MT::addVar('error_message', 'error', $e->getMessage());
}
MT::render();
Esempio n. 13
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);
     }
 }
Esempio n. 14
0
 function showForm()
 {
     $l = dibi::fetch("SELECT * FROM user_form WHERE id_node=%i", $_GET['id_modul']);
     MT::addTemplate(dirname(__FILE__) . '/Admin_UserForm.phtml', 'user_form');
     MT::addVar('user_form', 'l', $l);
 }
 /**
  * @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']));
 }
Esempio n. 16
0
 function showChangeMenuItem($id_menu_item)
 {
     $l = dibi::fetch("SELECT * FROM menu_item WHERE id_menu_item=%i", $id_menu_item);
     if (!$l) {
         throw new Exception("Polozka v menu neexistuje");
     }
     MT::addTemplate(APP_DIR . '/templates/admin/menu/menuChangeItem.phtml', 'changeMenu');
     //----zistenie deti + priradenie do pomocnej pre sql dotaz
     $this->checkChild($id_menu_item);
     $id_menu_item_to_sql = "";
     $count_child = count($this->childs) - 1;
     foreach ($this->childs as $i => $child) {
         $id_menu_item_to_sql .= " AND ";
         $id_menu_item_to_sql .= " id_menu_item!='" . $child . "'";
     }
     $this->doTreeSelect = '';
     $this->doTreeSelect(0, 0, $l['parent'], $id_menu_item_to_sql);
     $f = new FilesNode('menu', $l['id_menu_item']);
     MT::addVar('changeMenu', 'showMultiupload', $f->render());
     MT::addVar('changeMenu', 'l', $l);
     MT::addVar('changeMenu', 'doTreeSelect', $this->doTreeSelect);
 }