function __construct($id_menu = NULL, $lang = NULL) { $this->session = NEnvironment::getSession('Menu'); $this->pageModel = PageModel::init(); if ($id_menu == NULL) { if (isset($_GET["id_menu"])) { $this->session['id_menu'] = $_GET["id_menu"]; } if (!isset($this->session['id_menu'])) { $this->session['id_menu'] = NEnvironment::getVariable('ADMIN_DEFAULT_IDMENU'); } $this->id_menu = $this->session['id_menu']; } else { $this->id_menu = $id_menu; } if (@$lang == NULL) { if (!isset(NEnvironment::getSession('Page')->lang)) { $this->lang = NEnvironment::getVariable('ADMIN_DEFAULT_LANG'); } $this->lang = NEnvironment::getSession('Page')->lang; } else { $this->lang = $lang; } $this->var = NEnvironment::getConfig('ADMINMENU'); }
function renderDefault() { $this['header']['css']->addFile('../jscripts/tabella/nette.tabella.css'); $this['header']['js']->addFile('/tabella/nette.tabella.js'); // $this['header']['css']->addFile('../jscripts/tabella_v2/maite.tabella.css'); // $this['header']['js']->addFile('/tabella_v2/maite.tabella.js'); $session = NEnvironment::getSession("Admin_Eshop"); $session['back_url'] = $_SERVER['REQUEST_URI']; // ProductModel::repairAllProductSequence(); }
function renderList($categories) { $this->template->blog_box = dibi::fetchAll("SELECT * FROM `menu_item` \nLEFT JOIN node USING (id_menu_item)\nLEFT JOIN article USING (id_node)\nWHERE \nmenu_item.url_identifier = %s", $categories, "\nORDER BY id_node DESC\n"); foreach ($this->template->blog_box as $article) { $article['url'] = $this->getPresenter()->link('Blog:current', array('categories' => $categories, 'url_identifier' => $article->url_identifier)); if ($image = FilesNode::getOneFirstFile('article', $article->id_node)) { $article['image_url'] = Files::gURL($image->src, $image->ext, 220, 160, 6); } } $session = NEnvironment::getSession("Front_List"); $session['back_url'] = $_SERVER['REQUEST_URI']; }
/** * (non-phpDoc) * * @see Nette\Application\Control#render() */ public function render($params = array()) { $order_info = NEnvironment::getSession('user_order_info'); $this->template->delivery = (isset($params['delivery']) and $params['delivery'] == true) ? $order_info['values']['id_delivery'] : false; $this->template->payment = (isset($params['delivery']) and $params['delivery'] == true) ? $order_info['values']['id_payment'] : false; $this->template->cart_info = OrderModel::getCartInfo($this->session->products, $this->template->delivery, $this->template->payment, $this->getPresenter()->context, $isCache = true); // dump($this->template->cart_info); $this->template->controls = (isset($params['controls']) and $params['controls'] == false) ? false : true; $this->template->setFile(dirname(__FILE__) . '/default.phtml'); $this->template->render(); // $session = NEnvironment::getSession('cart'); }
function save($values, $id_node) { $tmp = dibi::fetch("SELECT * FROM " . self::TABLE . " WHERE id_node=%i", $id_node); // print_r($tmp); unset($values['id_node']); //odstranenie premennych ktore niesu v databaze foreach ($values as $key => $v) { if (!array_key_exists($key, $tmp)) { unset($values[$key]); } } // print_r($values); dibi::query("UPDATE " . self::TABLE . " SET ", $values, " WHERE id_node=%i", $id_node); Log::addLog($this, "Uprava contact form", "Menil:" . NEnvironment::getSession('Authentication')->login_form, '', $id_node); }
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()); }
protected function getNodeSession() { return NEnvironment::getSession()->getNamespace('Nette.Extras.TreeView/' . $this->getTreeView()->getName() . '/' . $this->getName()); }
public static function init() { return new self(NEnvironment::getSession(get_class())); }
function nodeAction() { $node = NodeModel::init(); //-------------------------------// //--------AJAX REQUEST-----------// //------------------------------// if (@$_GET['ajax_change_modul_position']) { if (is_numeric(@$_GET['id_node_ajax']) and is_numeric($_GET['position'])) { dibi::query("UPDATE node SET position=%i", $_GET['position'], " WHERE id_node=%i", $_GET['id_node_ajax']); $node->invalidateCache(); } exit; } if (@$_GET['ajax_change_modul_visible']) { if (is_numeric(@$_GET['id_node_ajax']) and is_numeric($_GET['modul_visible'])) { dibi::query("UPDATE node SET visible=%s", $_GET['modul_visible'], " WHERE id_node=%i", $_GET['id_node_ajax']); } $node->invalidateCache(); // echo dibi::$sql; exit; } //------SITE MAP pre premiestnenie modulu if (isset($_GET['ajax_show_site_map_for_modul'])) { $m = new MenuItem(); $m->doTreeSelectMoveModul(0, 0, $_GET['id_menu_item'], $_GET['id_type_modul']); echo '<form action="" method="post"> <select name="id_menu_item_for_change">'; echo $m->doTreeSelectMoveModulText; echo '<input type="hidden" name="id_type_modul" value="' . htmlspecialchars($_GET['id_type_modul']) . '" /> <input type="hidden" name="id_node" value="' . htmlspecialchars($_GET['id_node']) . '" /> <input type="submit" name="changeModulParent" value="Ulož" /> </form>'; exit; } if (isset($_POST['changeModulParent'])) { $this->changeModulParent(); $node->invalidateCache(); header("Location: ?id_menu_item=" . $_POST['id_menu_item_for_change'] . "&showModulsOnPage=1"); exit; } if (isset($_GET['id_menu_item']) and isset($_GET['id_type_modul']) and isset($_GET['id_modul'])) { if (!dibi::fetchSingle("SELECT COUNT(*) FROM node WHERE id_menu_item=%i", $_GET['id_menu_item'], " AND id_type_modul=%i", $_GET['id_type_modul'], " AND id_node=%i", $_GET['id_modul'])) { header("Location:admin.php"); exit; } } if (isset($_GET['addnode']) and isset($_GET['id_type_modul']) or isset($_POST['addModulToMenu'])) { if (isset($_POST['addModulToMenu'])) { $id_type_modul = $_POST['id_type_modul']; } else { $id_type_modul = $_GET['id_type_modul']; } $sequence = dibi::fetchSingle("SELECT MAX(sequence) FROM node WHERE id_menu_item=%i", $_GET['id_menu_item']) + 1; $session = NEnvironment::getSession('Authentication'); $config = NEnvironment::getConfig(); $arr = array('id_user' => NEnvironment::getUser()->getIdentity()->id, 'id_menu_item' => $_GET['id_menu_item'], 'sequence' => $sequence, 'id_type_modul' => $id_type_modul, 'visible' => $config['NODE_VISIBLE']); dibi::query("INSERT INTO node ", $arr); $this->addModul(dibi::insertId(), $id_type_modul); $node->invalidateCache(); } //zmenenie poradia if (isset($_GET['modul_id_up']) or isset($_GET['modul_id_down'])) { $this->changeOrderNode(); $node->invalidateCache(); header("Location: admin.php?id_menu_item=" . $_GET['id_menu_item'] . "&showModulsOnPage=1"); exit; } //ak je iba jeden modul, hned sa zobrazi ale iba ak nieje setnuta section a showModulsOnPage if (isset($_GET['id_menu_item']) and !isset($_GET['id_type_modul']) and !isset($_GET['section']) and !isset($_GET['showModulsOnPage']) and !isset($_GET['changeMenuItem'])) { $l = dibi::fetch("SELECT *, COUNT(*) as node_count FROM node WHERE id_menu_item=%i", $_GET['id_menu_item'], " ORDER BY sequence"); if ($l['node_count'] == 1) { header("Location: admin.php?id_menu_item=" . $_GET['id_menu_item'] . "&id_type_modul=" . $l['id_type_modul'] . "&id_modul=" . $l['id_node']); exit; } } //pridanie do premenej activeModul instanciu objektu if (isset($_GET['id_type_modul']) and isset($_GET['id_modul'])) { $this->activeModul = $this->nodeFactory($_GET['id_type_modul']); $this->activeModul->action(); } if (isset($_GET['id_modul_del']) and is_numeric($_GET['id_modul_del'])) { $this->deleteNode(NULL, $_GET['id_modul_del']); $node->invalidateCache(); header("Location: admin.php?id_menu_item=" . $_GET['id_menu_item']); exit; } }
public static function init() { return new self(new SessionMapper(\NEnvironment::getSession('cart'))); }
protected function getSession() { return NEnvironment::getSession(); }
function createComponent($name) { switch ($name) { /* * newsletterTabella */ case 'newsletterTabella': $grid = new Tabella(NewsletterModel::getFluent()->toDataSource(), array('sorting' => 'desc', 'order' => 'adddate', 'id_table' => 'id', 'limit' => 100, 'onSuccess' => function ($values) { NewsletterModel::edit($values, $values['id_newsletter_emails']); }, 'onDelete' => function ($id_newsletter_emails) { NewsletterModel::delete($id_newsletter_emails); })); $el = NHtml::el("div"); $session = NEnvironment::getSession('checked_emails'); $grid->addColumn($el, "", array("editable" => false, 'filter' => false, "width" => 20, "renderer" => function ($row) use($session) { $el = NHtml::el("td"); $checked = isset($session->emails[$row['id_newsletter_emails']]) ? 'checked="checked"' : ''; $el->add('<input class="checked_emails" type="checkbox" name="se[]" value="' . $row['id_newsletter_emails'] . '" ' . $checked . '/>'); return $el; })); $grid->addColumn("Id", "id_newsletter_emails", array("width" => 30, 'editable' => false)); $grid->addColumn("Email", "email", array("width" => 50, 'editable' => false)); // $grid->addColumn( "Popis", "description", array( 'editable'=>true ) ); $grid->addColumn("Dátum registrácie ", "adddate", array("width" => 100)); /*$grid->addColumn( "Aktívny", "active", array( "width" => 50, 'type'=> Tabella::SELECT, "editable" => true, "filter" => array( 1=>'áno', 0=>'nie'), 'renderer' => function($row){ $active = ($row['active'] == 1)?'áno':'nie'; $el = NHtml::el( "td" )->setHtml($active); return $el; } ) ); $grid->addColumn("", "", array( "width" => 30, 'filter'=>NULL, "options" => '', "renderer" => function( $row ) { $el = NHtml::el( "td" ); $el->add( NHtml::el( 'a' )->href( NEnvironment::getApplication()->getPresenter()->link( 'deleteEmail!' , array('id'=>$row->id_newsletter_emails)) )->addClass( 'deleteIcon' ) ); $span = NHtml::el('span'); $el->add($span); return $el; } ) ); */ $this->addComponent($grid, $name); break; /* * newslette text */ /* * newslette text */ case 'newsletterTextForm': $last_newsletter = dibi::fetch("SELECT * FROM [newsletter_sended_msg] ORDER BY [date] DESC LIMIT 1"); $f = new MyForm($this, $name); $f->addText('subject', 'Predmet')->addRule(NForm::FILLED, 'Predmet musí byť vyplnený.'); $f->addTextArea('text', ''); $f->addText('my_email', 'Testovací email'); $f->addSubmit('btn_send_emails', 'Odoslať všetkým')->onClick[] = array($this, 'actionSendEmails'); $f->addSubmit('btn_send_to_me', 'Odoslať testovací email')->onClick[] = array($this, 'actionSendTestingEmail'); if (!$last_newsletter) { $email_template = new NFileTemplate(); $email_template->registerFilter(new NLatteFilter()); $email_template->setFile(WWW_DIR . '/newsletter/templates/1/1.phtml'); $email_template->text = ''; $values['text'] = (string) $email_template; } else { $values = $last_newsletter; } $f->setDefaults($values); return $f; break; case 'addForm': $f = new MyForm(); $f->addText('emails', 'Email'); $f->addSubmit('btn', 'Pridať'); $f->onSuccess[] = array($this, 'handleAddEmail'); return $f; break; default: return parent::createComponent($name); break; } }
public static function renderTopMenu() { self::getInstance()->topmenu_template->setFile(APP_DIR . '/templates/admin/menu/menuHolder.phtml'); $session = NEnvironment::getSession('page'); self::getInstance()->topmenu_template->langs = Setting::getLangs(); self::getInstance()->topmenu_template->section = $session['section']; // $t->setFile ( APP_DIR . '/templates/admin/menu/menuHolder.phtml' ); return (string) self::getInstance()->topmenu_template; }
function handleCreateOrder() { $order_info = NEnvironment::getSession('user_order_info'); $values = $order_info['values']; // dump($values);exit; //presmerovanie ak nieco nieje v poriadku $session = NEnvironment::getSession('cart'); if (empty($session->products)) { $this->redirect('default'); } if (empty($order_info['values'])) { $this->redirect('step2'); } //znama polick login na email $values['email'] = $values['login']; $values['id_lang'] = $this->id_lang; //odstranenie loginu unset($values['login']); //odstranenie terms_and_conditions unset($values['terms_and_conditions']); //odstranenie discount_hash // $discount_hash = $values['discount_hash']; if ($values['type'] == NULL) { $values['type'] = 0; } $values['user_discount'] = 0; // ak je prihlaseny setni id_user if ($this->user->isLoggedIn()) { $values['id_user'] = $this->user->getIdentity()->data['user_id']; $values['user_discount'] = $this->user->getIdentity()->data['discount']; } $cart_info = OrderModel::getCartInfo($session->products, $order_info['values']['id_delivery'], $order_info['values']['id_payment'], $this->context, false); $values['total_price'] = $cart_info['total_sum']; $values['total_price_with_tax'] = $cart_info['total_sum_with_tax']; $values['delivery_title'] = $cart_info['delivery_title']; $values['delivery_price'] = $cart_info['delivery_price']['price']; $values['delivery_tax'] = $cart_info['delivery_price']['tax']; $values['payment_title'] = $cart_info['payment_title']; $values['payment_price'] = $cart_info['payment_price']['price']; $values['payment_tax'] = $cart_info['payment_price']['tax']; //odstranenie id_delivery unset($values['id_delivery']); //odstranenie id_payment unset($values['id_payment']); $values['rate'] = Lang::get($this->id_lang)->rate; try { $id_order = OrderModel::createOrder($values, $session->products, $this->id_lang, $this->user); $conf = $this->context->parameters; $template = $this->template; $template->setFile(APP_DIR . '/FrontModule/templates/Order/OrderEmail.phtml'); $template->discount = false; $template->o = OrderModel::get($id_order); $mail = new MyMail(); $mail->addTo($values['email']); $mail->addBcc($conf['client_email']); $mail->setSubject(_('Objednávka č. ') . $id_order); $mail->setTemplate($template); $mail->send(); if ($conf['HEUREKA']['ENABLE'] == 1) { try { $overeno = new HeurekaOvereno($conf['HEURELA']['API_KEY'], HeurekaOvereno::LANGUAGE_SK); $overeno->setEmail($values['email']); foreach ($session->products as $id_product_param => $p) { $product = ProductModel::getProductIdentifyByParam($id_product_param, $this->id_lang, $this->user); $overeno->addProduct($product->name); } $overeno->send(); } catch (Exception $e) { } } //vymazanie z kosika $session = NEnvironment::getSession('cart'); unset($session->products); //vymazanie info o uzivatelovi unset($order_info['values']); $this->redirect('Cart:success'); } catch (OrderException $e) { $form->addError($e); } }
private function __construct() { $this->session = NEnvironment::getSession('Page'); $this->flashes = NEnvironment::getSession('flash'); }
//if(!isset($_SESSION['lang'])){$_SESSION['lang']=ADMIN_DEFAULT_LANG;} //-----------jazyk--------------------- //if(isset($_GET['id_menu'])){$_SESSION['id_menu']=$_GET['id_menu'];} //if(!isset($_SESSION['id_menu'])){$_SESSION['id_menu']=0;} MT::addCss('/templates/admin/css/index.css'); MT::addScripts('/jscripts/mootools/mootools-1.2.4-core-nc.js', 'mootools'); MT::addScripts('/jscripts/mootools/mootools-1.2.4.4-more.js', 'mootools_adds'); MT::addScripts('/jscripts/mootools/mootools_listener.js', 'mootools_listener'); MT::addScripts('/jscripts/tableHighlighter.js', 'tableHighlighter'); MT::addTextScripts(' function confl(message, url) { if(confirm(message)) location.href = url; } ', 'conf'); $auth = new Authentication(); $session = NEnvironment::getSession("Authentication"); //NDebug::dump(NEnvironment::getUser()->getIdentity()); /* * Skontrolovanie prav na adresare a subory * v pripade nespravnych - opravenie */ if (isset($_GET['checkAndRepairPermission'])) { echo 'Run checkAndRepairPermission'; $error = array(); if (!chmod("./app/temp/", 0777)) { $error[] = 'temp is not writeable ' . "/app/temp/"; } if (!chmod("./app/log/", 0777)) { $error[] = 'log is not writeable'; } if (!chmod("./app/sessions/", 0777)) {
$loader->addDirectory(WWW_DIR . '/require_modules'); $loader->addDirectory(WWW_DIR . '/classes'); //$loader->addDirectory ( WWW_DIR.'/app/models' ); //$loader->addDirectory ( WWW_DIR.'/app/components' ); $loader->register(); // 2b) load configuration from config.ini file $config = NEnvironment::loadConfig(APP_NETTE_DIR . '/config/config.neon'); $neon = new NConfigNeonAdapter(); $n = $neon->load(APP_NETTE_DIR . '/config/config.db.neon'); $database = $n['common']['parameters']; foreach ($database as $k => $p) { NEnvironment::setVariable($k, $p); } //var_dump($d);exit; //$config = NEnvironment::loadConfig(APP_NETTE_DIR.'/config/config.db.neon'); $session = NEnvironment::getSession(); //$session->setSavePath(APP_NETTE_DIR . '/sessions'); //$session->setExpiration("1 day"); $session->start(); try { dibi::connect(NEnvironment::getConfig()->database); } catch (Exception $e) { // echo $e->getMessage(); echo "Nepodarilo sa pripojit"; exit; } $cache = NEnvironment::getCache(); if (!isset($cache['acl'])) { $cache['acl'] = new Acl(); } //print_r($cache['acl']);
// $journal = $container->getService('nette.cacheJournal'); // $mem = new NMemcachedStorage('localhost', 11211, '', $journal); // // return new NCache($mem,'MyMemcache'); //}, NULL); if (!$configurator->isProductionMode()) { CallbackPanel::register(); } //print_r($container->parameters['database']);exit; try { dibi::connect($container->parameters['database']); } catch (Exception $e) { echo "Nepodarilo sa pripojit"; exit; } $session = NEnvironment::getSession('cart'); if (!isset($session->products)) { $session->products = array(); } NRoute::addStyle('lang', NULL); NRoute::setStyleProperty('lang', NRoute::PATTERN, '[a-z0-9]{1,2}'); // tohle je mozna i ted zbytecne, NRoute::addStyle('paginator-page', NULL); NRoute::setStyleProperty('paginator-page', NRoute::PATTERN, '[0-9]{1,5}'); // tohle je mozna i ted zbytecne, //NRoute::$styles['id_category'] = array( // NRoute::PATTERN => '.*?', //); NRoute::addStyle('#cat'); NRoute::setStyleProperty('#cat', NRoute::PATTERN, '[\\/a-z0-9^-]+'); NRoute::setStyleProperty('#cat', NRoute::FILTER_IN, callback('CategoryModel::slugToId'));
function saveGMap($values, $id_node) { $tmp = dibi::fetch("SELECT * FROM [gmap] WHERE id_node=%i", $id_node); unset($values['id_node']); unset($values['saveGMap']); //odstranenie premennych ktore niesu v databaze $tmp = (array) $tmp; foreach ($values as $key => $v) { if (!array_key_exists($key, $tmp)) { unset($values[$key]); } } $values['googleBar'] = (int) $values['googleBar']; $values['enableScrollWheelZoom'] = (int) $values['enableScrollWheelZoom']; $values['doubleClickZoom'] = (int) $values['doubleClickZoom']; if (isset($values['modul_visible'])) { node::changeVisibility($id_node, $values['modul_visible']); } dibi::query("UPDATE gmap SET ", $values, " WHERE id_node=%i", $id_node); Log::addLog($this, "Uprava gmap", "Menil:" . NEnvironment::getSession('Authentication')->login_form, '', $id_node); }
function save(NFORM $form) { $values = $form->getValues(); $langs = Setting::getLangs(); $id_product = $values['id_product']; $table_product_cols = Tools::getCollum('product'); $table_product_lang_cols = Tools::getCollum('product_lang'); //ulozenie jazuka foreach ($langs as $l) { $save_val = array(); foreach ($table_product_lang_cols as $k => $c) { if (isset($values[$c . CategoryFormControl::$_separator . $l['iso']])) { $save_val[$c] = $values[$c . CategoryFormControl::$_separator . $l['iso']]; } } //pridanie linky rewrite if ($save_val['link_rewrite'] == '') { $save_val['link_rewrite'] = NStrings::webalize($values['name' . CategoryFormControl::$_separator . $l['iso']]); } else { $save_val['link_rewrite'] = NStrings::webalize($save_val['link_rewrite']); } ProductModel::save($save_val, $id_product, $l['id_lang']); } //ulozenie zakladnych hodnot $save_val = array(); foreach ($table_product_cols as $p) { if (isset($values[$p])) { $save_val[$p] = $values[$p]; } } ProductModel::save($save_val, $id_product, $l['id_lang']); //ulozit param /* * Iba ak je product bez parametrov */ $val_product_param = Tools::getValuesForTable('product_param', $values); //prvy parameter $id_product_param = dibi::fetchSingle("SELECT id_product_param FROM [product_param] WHERE id_product = %i", $id_product, "ORDER BY sequence"); ProductModel::setProductParamValue($val_product_param, $id_product_param); ProductModel::saveProductAlternative($id_product, $values['product_alternative']); dibi::begin(); ProductModel::deleteProductFromCategories($id_product); ProductModel::addProductToCategory($values['id_categories'], $id_product); dibi::commit(); ProductModel::invalidateCache(); $this->flashMessage(_('Produkt bol uložený')); if ($form['btn_save']->isSubmittedBy()) { $s = NEnvironment::getSession("Admin_Eshop"); $back_url = $s['back_url']; if ($back_url != '') { $this->redirectUrl($back_url); } else { $this->redirect('Eshop:default'); } } else { $this->redirect('this'); } }
function showForm() { $session = NEnvironment::getSession('Authentication'); if ($session["superadmin"] != 1) { header("Location: admin.php"); exit; } try { if (isset($_POST['addModul'])) { $this->addModul(); } if (isset($_POST['load_modul'])) { $this->loadModulFile(); } if (isset($_GET['id_type_modul'])) { $this->deleteModul(); } } catch (Exception $e) { ?> <div style="border:2px solid red;padding:5px;"> <?php echo $e->getMessage(); ?> </div><?php } ?> <form method="post" enctype="multipart/form-data" action=""> <label>Nahratie nového modulu (.zip)</label> <input type="file" name="modul_file_zip" /> <input type="submit" name="load_modul" value="Nahrať" /> </form> <form id="formAddModul" action="" method="post" style="padding:5px 0px;"> <label>Meno modulu</label> <input type="text" name="name" value="" /> Modul: <select name="dir"> <?php $dir = "moduls/"; echo filetype($dir); if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if ($file != "." and $file != "..") { ?> <option value="<?php echo $file; ?> "><?php echo $file; ?> </option><?php } } closedir($dh); } } ?> </select> Zobraziť <select style="width:50px;" name="visible_for_user"><option value="1">áno</option><option value="0">nie</option></select> <input type="submit" class="sub" name="addModul" value="Pridat" /> </form> <form action="" method="post"> <table id="highlight"> <thead><tr><th></th><th>Názov</th><th>Modul</th><th>Zobraziť</th><th>Zmazať</th></tr></thead> <tbody> <?php $list = dibi::fetchAll("SELECT * FROM type_modul ORDER BY name"); foreach ($list as $l) { ?> <tr> <td><img src="/moduls/<?php echo $l['dir']; ?> /icon.gif" alt="<?php echo $l['name']; ?> " /></td><td><?php echo $l['name']; ?> </td><td><?php echo $l['dir']; ?> </td><td><?php echo $l['visible_for_user']; ?> </td><td><a href="javascript:confl('Naozaj chcete odstrániť <?php echo $l['name']; ?> ','?section=admin_modules&id_type_modul=<?php echo $l['id_type_modul']; ?> ');"><img src="<?php echo RELATIVE_PATH; ?> templates/global_img/delete.gif" alt="Zmazat" /></a></td> </tr><?php } ?> </tbody> </table> <script type="text/javascript"> var th = new tableHighlighter( 'highlight' ); </script> </form> <?php }
function saveProduct($values, $id_node) { $collums = Tools::getCollum('module_product'); foreach ($values as $k => $v) { if (!in_array($k, $collums)) { unset($values[$k]); } } $newname = ""; $name = $values['title']; $i = 0; while ($i < 50) { if ($i == 0) { $newname = $name; } else { $newname = NStrings::webalize($name . $i); } $s = dibi::fetchSingle("SELECT COUNT(id_node) FROM [module_product] WHERE url_identifier=%s", $newname, " AND id_node!=%i", $id_node); if ($s == 0) { break; } else { $i++; } } $values['url_identifier'] = $newname; dibi::query("UPDATE [module_product] SET ", $values, " WHERE id_node=%i", $id_node); Log::addLog($this, "Uprava produktu", "Menil:" . NEnvironment::getSession('Authentication')->login_form, $values['title'], $id_node); }