Example #1
1
 public function getObjectLink($id_lang)
 {
     $url = ph_simpleblog::myRealUrl();
     $dispatcher = Dispatcher::getInstance();
     $params = array();
     $params['sb_category'] = $this->link_rewrite;
     return $url . $dispatcher->createUrl('module-ph_simpleblog-category', $id_lang, $params);
 }
 public function initPageHeaderToolbar()
 {
     $this->page_header_toolbar_title = $this->l('Posts');
     if ($this->display == 'add' || $this->display == 'edit') {
         $this->page_header_toolbar_btn['back_to_list'] = array('href' => Context::getContext()->link->getAdminLink('AdminSimpleBlogPosts'), 'desc' => $this->l('Back to list', null, null, false), 'icon' => 'process-icon-back');
         if (Tools::getValue('id_simpleblog_post', 0)) {
             if ($this->loadObject(true)) {
                 $obj = $this->loadObject(true);
             }
             $SimpleBlogPost = new SimpleBlogPost($obj->id, $this->context->language->id);
             $this->page_header_toolbar_btn['preview_post'] = array('href' => Context::getContext()->link->getModuleLink('ph_simpleblog', 'single', array('rewrite' => $SimpleBlogPost->link_rewrite, 'sb_category' => $SimpleBlogPost->category_rewrite)), 'desc' => $this->l('View post', null, null, false), 'icon' => 'process-icon-preview', 'target' => true);
         }
     }
     if (!isset($this->display)) {
         $this->page_header_toolbar_btn['new_post'] = array('href' => self::$currentIndex . '&addsimpleblog_post&token=' . $this->token, 'desc' => $this->l('Add new post', null, null, false), 'icon' => 'process-icon-new');
         $this->page_header_toolbar_btn['go_to_blog'] = array('href' => ph_simpleblog::getLink(), 'desc' => $this->l('Go to blog', null, null, false), 'icon' => 'process-icon-plus', 'target' => true);
     }
     parent::initPageHeaderToolbar();
 }
Example #3
0
 public static function getLink($tag, $id_lang = null, $id_shop = null)
 {
     $url = ph_simpleblog::myRealUrl();
     $dispatcher = Dispatcher::getInstance();
     $params = array();
     $params['tag'] = $tag;
     return $url . $dispatcher->createUrl('ph_simpleblog_tag', $id_lang, $params);
 }
Example #4
0
 public static function getPaginationLink($nb = false, $sort = false, $pagination = true, $array = false)
 {
     $vars = array();
     $vars_nb = array('n', 'search_query');
     $vars_sort = array('orderby', 'orderway');
     $vars_pagination = array('p');
     $url = ph_simpleblog::myRealUrl();
     foreach ($_GET as $k => $value) {
         if (Configuration::get('PS_REWRITING_SETTINGS') && ($k == 'isolang' || $k == 'id_lang')) {
             continue;
         }
         $if_nb = !$nb || $nb && !in_array($k, $vars_nb);
         $if_sort = !$sort || $sort && !in_array($k, $vars_sort);
         $if_pagination = !$pagination || $pagination && !in_array($k, $vars_pagination);
         if ($if_nb && $if_sort && $if_pagination) {
             if (!is_array($value)) {
                 $vars[urlencode($k)] = $value;
             } else {
                 foreach (explode('&', http_build_query(array($k => $value), '', '&')) as $key => $val) {
                     $data = explode('=', $val);
                     $vars[urldecode($data[0])] = $data[1];
                 }
             }
         }
     }
     if (!$array) {
         if (count($vars)) {
             return $url . (Configuration::get('PS_REWRITING_SETTINGS') == 1 ? '?' : '&') . http_build_query($vars, '', '&');
         } else {
             return $url;
         }
     }
     $vars['requestUrl'] = $url;
     return $vars;
 }
    function content_56d607e8e69fe0_38192124($_smarty_tpl)
    {
        ?>
<div id="ph_simpleblog_categories" class="block informations_block_left">
	<p class="title_block"><a href="<?php 
        echo htmlspecialchars(ph_simpleblog::getLink(), ENT_QUOTES, 'UTF-8', true);
        ?>
" title="<?php 
        echo smartyTranslate(array('s' => 'Blog', 'mod' => 'ph_simpleblog'), $_smarty_tpl);
        ?>
"><?php 
        echo smartyTranslate(array('s' => 'Blog', 'mod' => 'ph_simpleblog'), $_smarty_tpl);
        ?>
</a></p>
	<div class="block_content list-block">
		<ul>
			<?php 
        $_smarty_tpl->tpl_vars['category'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['category']->_loop = false;
        $_from = $_smarty_tpl->tpl_vars['categories']->value;
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['category']->key => $_smarty_tpl->tpl_vars['category']->value) {
            $_smarty_tpl->tpl_vars['category']->_loop = true;
            ?>
				<li><a href="<?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['category']->value['url'], ENT_QUOTES, 'UTF-8', true);
            ?>
" title="<?php 
            echo smartyTranslate(array('s' => 'Link to', 'mod' => 'ph_simpleblog'), $_smarty_tpl);
            ?>
 <?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['category']->value['name'], ENT_QUOTES, 'UTF-8', true);
            ?>
"><?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['category']->value['name'], ENT_QUOTES, 'UTF-8', true);
            ?>
</a>
					<?php 
            if (isset($_smarty_tpl->tpl_vars['category']->value['childrens'])) {
                ?>
					<ul class="child_categories">
						<?php 
                $_smarty_tpl->tpl_vars['child_category'] = new Smarty_Variable();
                $_smarty_tpl->tpl_vars['child_category']->_loop = false;
                $_from = $_smarty_tpl->tpl_vars['category']->value['childrens'];
                if (!is_array($_from) && !is_object($_from)) {
                    settype($_from, 'array');
                }
                foreach ($_from as $_smarty_tpl->tpl_vars['child_category']->key => $_smarty_tpl->tpl_vars['child_category']->value) {
                    $_smarty_tpl->tpl_vars['child_category']->_loop = true;
                    ?>
						<li><a href="<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['link']->value->getModuleLink('ph_simpleblog', 'category', array('sb_category' => $_smarty_tpl->tpl_vars['child_category']->value['link_rewrite'])), ENT_QUOTES, 'UTF-8', true);
                    ?>
" title="<?php 
                    echo smartyTranslate(array('s' => 'Link to', 'mod' => 'ph_simpleblog'), $_smarty_tpl);
                    ?>
 <?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['child_category']->value['name'], ENT_QUOTES, 'UTF-8', true);
                    ?>
"><?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['child_category']->value['name'], ENT_QUOTES, 'UTF-8', true);
                    ?>
</a>
						<?php 
                }
                ?>
					</ul>
					<?php 
            }
            ?>
				</li>
			<?php 
        }
        ?>
		</ul>
	</div>
</div><?php 
    }