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 #2
0
 public static function getPageLink($page_nb, $type = false, $rewrite = false)
 {
     $url = ph_simpleblog::myRealUrl();
     $id_lang = Context::getContext()->language->id;
     $dispatcher = Dispatcher::getInstance();
     $params = array();
     $params['p'] = $page_nb;
     if ($type == 'category') {
         if ($page_nb == 1 && isset($rewrite)) {
             return SimpleBlogCategory::getLink($rewrite, $id_lang);
         }
         if (isset($rewrite)) {
             $params['sb_category'] = $rewrite;
             return $url . $dispatcher->createUrl('module-ph_simpleblog-categorypage', $id_lang, $params);
         }
     }
     if ($page_nb > 1) {
         return $url . $dispatcher->createUrl('module-ph_simpleblog-page', $id_lang, $params);
     } else {
         return ph_simpleblog::getLink();
     }
 }
    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 
    }