コード例 #1
0
ファイル: article.php プロジェクト: oaki/demoshop
 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']));
 }
コード例 #2
0
ファイル: GalleryControl.php プロジェクト: oaki/demoshop
 public static function getImages($id_node)
 {
     $images = FilesNode::getAllFiles(self::MODULE_NAME, $id_node);
     foreach ($images as $k => $image) {
         $images[$k]['thumb'] = Files::gURL($image['src'], $image['ext'], 220, 165, 5);
         $images[$k]['big'] = Files::gURL($image['src'], $image['ext'], 800, 600);
     }
     return $images;
 }
コード例 #3
0
ファイル: SlideShowModel.php プロジェクト: oaki/demoshop
 public function getFiles($id_node)
 {
     $files = FilesNode::getAllFiles('Home', $id_node);
     foreach ($files as $k => $l) {
         $i = dibi::fetch("SELECT title, link, alt, link_name FROM [promo_text] WHERE id_file = %i", $l['id_file']);
         $files[$k]['title'] = $i['title'];
         $files[$k]['link'] = $i['link'];
         $files[$k]['alt'] = $i['alt'];
         $files[$k]['link_name'] = $i['link_name'];
     }
     return $files;
 }
コード例 #4
0
ファイル: Front_BlogPresenter.php プロジェクト: oaki/demoshop
 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'];
 }
コード例 #5
0
ファイル: CategoryModel.php プロジェクト: oaki/demoshop
 static function get($id_category, $id_lang)
 {
     $key = 'get(' . $id_category . ',' . $id_lang . ')';
     $value = self::getCache($key);
     if ($value) {
         return $value;
     }
     $value = self::getFluent()->where('id_category = %i', $id_category, 'AND id_lang = %i', $id_lang)->fetch();
     $value['files'] = FilesNode::getAllFiles('category', $id_category);
     $value['first_file'] = isset($value['files'][0]) ? $value['files'][0] : array('src' => 'no-image', 'ext' => 'jpg');
     return self::setCache($key, $value);
 }
コード例 #6
0
ファイル: SearchingPresenter.php プロジェクト: oaki/demoshop
 function renderDefault($query)
 {
     $this->template->query = $query;
     if ($query != '') {
         $vp = new VisualPaginator($this, 'vp');
         try {
             $datasource = ProductModel::searching($this->id_lang, $query);
             $paginator = $vp->getPaginator();
             $paginator->itemsPerPage = 2;
             $paginator->itemCount = $itemsCount = count($datasource);
             if ($itemsCount == 0) {
                 throw new ProductException(_('Hľadaný výraz sa nenašiel.'));
             }
             $this->template->searchingItems = $datasource->applyLimit($paginator->itemsPerPage, $paginator->offset)->fetchAll();
             //zisti pre kazdy clanok url_identifier
             foreach ($this->template->searchingItems as $k => $i) {
                 $this->template->searchingItems[$k]['url'] = $this->getPresenter()->link('Eshop:current', array('categories' => $i['category_link_rewrite'], 'url_identifier' => $i['link_rewrite']));
                 $image = FilesNode::getOneFirstFile('product', $i['id_product']);
                 if ($image) {
                     $image['thumbs'] = Files::gURL($image['src'], $image['ext'], 100, 70, 5);
                     $this->template->searchingItems[$k]['image'] = $image;
                 }
             }
         } catch (ProductException $e) {
             $this->flashMessage($e->getMessage());
         }
     } else {
         $this->redirect('Homepage');
     }
     //
     //		try{
     //
     //			$this->template->searching_list = ProductModel::searching($this->lang, $query)->fetchAll();
     //			if(empty($this->template->searching_list)){
     //				$this->flashMessage('Hľadaný výraz sa nenašiel.');
     //			}
     //			foreach($this->template->searching_list as $k=>$l){
     //
     //				$this->template->searching_list[$k]['url'] = $this->link('List:current',
     //					array('categories'=> MenuModel::getUrl($l['id_menu_item']) ,
     //					'url_identifier'=>$l['url_identifier']) );
     //
     //			}
     //
     //		}catch(ProductException $e){
     //			$this->flashMessage($e->getMessage());
     //		}
     //
 }
コード例 #7
0
ファイル: Admin_Promo.php プロジェクト: oaki/demoshop
 function action()
 {
     parent::action();
     if (isset($_GET['ajax_save_promo']) and $_GET['ajax_save_promo'] == 1) {
         $arr = Tools::getValuesForTable('promo_text', $_POST);
         //zisti ci existuje
         $id_file = dibi::fetchSingle("SELECT id_file FROM [promo_text] WHERE id_file = %i", $_POST['id_file']);
         //
         //			$arr = array(
         //				'title'=>$_POST['title'],
         //				'alt'=>$_POST['alt'],
         //				'link'=>$_POST['link'],
         //				'link_name'=>$_POST['link_name'],
         //			);
         if ($id_file) {
             dibi::query("UPDATE promo_text SET ", $arr, "WHERE id_file = %i", $id_file);
         } else {
             $arr['id_file'] = $_POST['id_file'];
             dibi::query("INSERT INTO promo_text ", $arr);
         }
         exit;
     }
 }
コード例 #8
0
ファイル: Setting.php プロジェクト: oaki/demoshop
 function recursionAddMenuItem($parent = 0, $values, $new_parent = 0)
 {
     //skopirovanie menu
     $sourceMenu = dibi::fetchAll("SELECT * FROM [menu_item] WHERE lang = %s", $values['sourceLang'], "AND parent = %i", $parent, "ORDER BY sequence");
     foreach ($sourceMenu as $sm) {
         $tmp_id_menu_item = $sm['id_menu_item'];
         unset($sm['id_menu_item']);
         $sm['parent'] = $new_parent;
         $menuInstance = new MenuItem($sm['id_menu'], $values['destLang']);
         $dest_new_parent = $menuInstance->AddItemToSql($sm);
         $id_file_node = FilesNode::getFileNode('menu', $tmp_id_menu_item);
         if ($id_file_node) {
             FilesNode::copyTo($id_file_node, 'menu', $dest_new_parent);
         }
         self::duplicateNode($tmp_id_menu_item, $dest_new_parent);
         self::recursionAddMenuItem($tmp_id_menu_item, $values, $dest_new_parent);
         unset($menuInstance);
     }
 }
コード例 #9
0
ファイル: ArticleModel.php プロジェクト: oaki/demoshop
 public static function getFiles($id_node)
 {
     return FilesNode::getAllFiles(self::MODULE_NAME, $id_node, 'all');
     //		return FilesNode::getAllFiles(self::MODULE_NAME, $id_node);
 }
コード例 #10
0
ファイル: ProductControl.php プロジェクト: oaki/demoshop
 public static function getImage($id_node)
 {
     $image = FilesNode::getOneFirstFile(self::MODULE_NAME, $id_node);
     $image['thumb'] = Files::gURL(@$image['src'], @$image['ext'], 220, 160, 6);
     $image['big'] = Files::gURL(@$image['src'], @$image['ext'], 800, 600);
     return $image;
 }
コード例 #11
0
ファイル: Admin_Product.php プロジェクト: oaki/demoshop
 public static function duplicate($id_node, $new_id_node)
 {
     // nacitanie, co ma skopirovat
     $values = dibi::fetch("SELECT * FROM [module_product] WHERE id_node = %i", $id_node);
     //vytvorenie
     self::add($new_id_node);
     self::saveProduct($values, $new_id_node);
     $id_file_node = FilesNode::getFileNode(self::MODULE_NAME, $id_node);
     if ($id_file_node) {
         FilesNode::copyTo($id_file_node, self::MODULE_NAME, $new_id_node);
     }
 }
コード例 #12
0
ファイル: ProductModel.php プロジェクト: oaki/demoshop
 public static function getFiles($id_product)
 {
     $key = 'getFiles(' . $id_product . ')';
     $files = self::loadCache($key);
     if (!$files) {
         $files = self::saveCache($key, FilesNode::getAllFiles(self::MODULE_NAME, $id_product, 'all'));
     }
     return $files;
 }
コード例 #13
0
 /**
  * @access public
  * @param $id_node
  * @param $new_id_node
  * @static
  * @ParamType $id_node 
  * @ParamType $new_id_node 
  */
 public static function duplicate($id_node, $new_id_node)
 {
     dibi::begin();
     $tmp = self::get($id_node);
     unset($tmp['id_node']);
     self::add($new_id_node);
     self::saveGallery($tmp, $new_id_node);
     $vars = NEnvironment::getConfig()->gallery;
     $tmp = parent::getAll($id_node);
     $dir = $vars['dir_abs'] . '/original';
     foreach ($tmp as $t) {
         $t['id_node'] = $new_id_node;
         unset($t['id_gallery_image']);
         $new_filename = self::doNameFile($vars['dir_abs'] . '/original', $t['src'], $t['ext']);
         //duplikovanie suboru
         $source = $t['src'] . '.' . $t['ext'];
         if (!copy($dir . '/' . $source, $dir . '/' . $new_filename . '.' . $t['ext'])) {
             echo 'Nepodarilo sa subor skopirovat: ' . $dir . '/' . $source . ' do :' . $dir . '/' . $new_filename . '.' . $t['ext'];
         }
         $t['src'] = $new_filename;
         Files::addFile($t);
     }
     dibi::commit();
 }
コード例 #14
0
ファイル: menu_class.php プロジェクト: oaki/demoshop
 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);
 }