Example #1
0
function upgrade_module_1_3_2_2($object)
{
    if (!Shop::isFeatureActive()) {
        $categories = SimpleBlogCategory::getCategories(Context::getContext()->language->id, false);
        foreach ($categories as $id_category => $category) {
            $instance = new SimpleBlogCategory($id_category, Context::getContext()->language->id);
            $instance->associateTo(Shop::getCompleteListOfShopsID());
            unset($instance);
        }
    }
    return true;
}
 public function initOptions()
 {
     $this->optionTitle = $this->l('Settings');
     $blogCategories = SimpleBlogCategory::getCategories($this->context->language->id);
     $simpleBlogCategories = array();
     $simpleBlogCategories[0] = $this->l('All categories');
     $simpleBlogCategories[9999] = $this->l('Featured only');
     foreach ($blogCategories as $key => $category) {
         $simpleBlogCategories[$category['id']] = $category['name'];
     }
     $recentPosts = array();
     if (Module::isInstalled('ph_recentposts')) {
         $recentPosts = array('recent_posts' => array('submit' => array('title' => $this->l('Update'), 'class' => 'button'), 'title' => $this->l('Recent Posts widget settings'), 'image' => '../img/t/AdminOrderPreferences.gif', 'fields' => array('PH_RECENTPOSTS_LAYOUT' => array('title' => $this->l('Recent Posts layout:'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => array('full' => $this->l('Full width with large images'), 'grid' => $this->l('Grid'))), 'PH_RECENTPOSTS_GRID_COLUMNS' => array('title' => $this->l('Grid columns:'), 'cast' => 'intval', 'desc' => $this->l('Working only with "Recent Posts layout:" setup to "Grid"'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => array('2' => $this->l('2 columns'), '3' => $this->l('3 columns'), '4' => $this->l('4 columns'))), 'PH_RECENTPOSTS_NB' => array('title' => $this->l('Number of displayed Recent Posts'), 'cast' => 'intval', 'desc' => $this->l('Default: 4'), 'type' => 'text', 'required' => true, 'validation' => 'isUnsignedId'), 'PH_RECENTPOSTS_CAT' => array('title' => $this->l('Category:'), 'cast' => 'intval', 'desc' => $this->l('If you not select any category then Recent Posts will displayed posts from all categories'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => $simpleBlogCategories))));
     }
     $relatedPosts = array();
     if (Module::isInstalled('ph_relatedposts')) {
         $relatedPosts = array('related_posts' => array('submit' => array('title' => $this->l('Update'), 'class' => 'button'), 'title' => $this->l('Related Posts widget settings'), 'image' => '../img/t/AdminOrderPreferences.gif', 'fields' => array('PH_RELATEDPOSTS_GRID_COLUMNS' => array('title' => $this->l('Grid columns:'), 'cast' => 'intval', 'desc' => $this->l('Working only with "Recent Posts layout:" setup to "Grid"'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => array('2' => $this->l('2 columns'), '3' => $this->l('3 columns'), '4' => $this->l('4 columns'))))));
     }
     $alert_class = $this->is_16 === true ? 'alert alert-info' : 'info';
     $standard_options = array('general' => array('title' => $this->l('PrestaHome SimpleBlog Settings'), 'image' => '../img/t/AdminOrderPreferences.gif', 'info' => '<a class="button btn btn-default" href="index.php?controller=AdminSimpleBlogSettings&token=' . Tools::getValue('token') . '&regenerateThumbnails=1" class="bold"><i class="process-icon-cogs"></i>' . $this->l('Regenerate thumbnails') . '</a><br /><br />', 'fields' => array('PH_BLOG_POSTS_PER_PAGE' => array('title' => $this->l('Posts per page:'), 'cast' => 'intval', 'desc' => $this->l('Number of blog posts displayed per page. Default is 10.'), 'type' => 'text', 'required' => true, 'validation' => 'isUnsignedId'), 'PH_BLOG_SLUG' => array('title' => $this->l('Blog main URL (by default: blog)'), 'validation' => 'isGenericName', 'required' => true, 'type' => 'text', 'size' => 40), 'PH_BLOG_MAIN_TITLE' => array('title' => $this->l('Blog title:'), 'validation' => 'isGenericName', 'type' => 'textLang', 'size' => 40), 'PH_BLOG_DATEFORMAT' => array('title' => $this->l('Blog default date format:'), 'desc' => $this->l('More details: http://php.net/manual/pl/function.date.php'), 'validation' => 'isGenericName', 'type' => 'text', 'size' => 40), 'PH_CATEGORY_SORTBY' => array('title' => $this->l('Sort categories by:'), 'desc' => $this->l('Select which method use to sort categories in SimpleBlog Categories Block'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => array('position' => $this->l('Position (1-9)'), 'name' => $this->l('Name (A-Z)'), 'id' => $this->l('ID (1-9)'))), 'PH_BLOG_FB_INIT' => array('title' => $this->l('Init Facebook?'), 'validation' => 'isBool', 'cast' => 'intval', 'desc' => $this->l('If you already use some Facebook widgets in your theme please select option to "No". If you select "Yes" then SimpleBlog will add facebook connect script on single post page.'), 'required' => true, 'type' => 'bool')), 'submit' => array('title' => $this->l('Update'), 'class' => 'button')), 'layout' => array('submit' => array('title' => $this->l('Update'), 'class' => 'button'), 'title' => $this->l('Appearance Settings - General'), 'image' => '../img/t/AdminOrderPreferences.gif', 'fields' => array('PH_BLOG_LAYOUT' => array('title' => $this->l('Main layout:'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => array('default' => $this->l('3 columns, enabled left column and right column'), 'left_sidebar' => $this->l('2 columns, enabled left column'), 'right_sidebar' => $this->l('2 columns, enabled right column'), 'full_width' => $this->l('Full width - Left and right column will be removed'))), 'PH_BLOG_DISPLAY_BREADCRUMBS' => array('title' => $this->l('Display breadcrumbs in center-column?'), 'validation' => 'isBool', 'cast' => 'intval', 'desc' => $this->l('Sometimes you want to remove breadcrumbs from center-column'), 'required' => true, 'type' => 'bool'), 'PH_BLOG_LIST_LAYOUT' => array('title' => $this->l('Posts list layout:'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => array('full' => $this->l('Full width with large images'), 'grid' => $this->l('Grid'))), 'PH_BLOG_GRID_COLUMNS' => array('title' => $this->l('Grid columns:'), 'cast' => 'intval', 'desc' => $this->l('Working only with "Posts list layout" setup to "Grid"'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => array('2' => $this->l('2 columns'), '3' => $this->l('3 columns'), '4' => $this->l('4 columns'))), 'PH_BLOG_CSS' => array('title' => $this->l('Custom CSS'), 'show' => true, 'required' => false, 'type' => 'textarea', 'cols' => '70', 'rows' => '10'))), 'single_post' => array('submit' => array('title' => $this->l('Update'), 'class' => 'button'), 'title' => $this->l('Appearance Settings - Single post'), 'image' => '../img/t/AdminOrderPreferences.gif', 'fields' => array('PH_BLOG_DISPLAY_LIKES' => array('title' => $this->l('Display "likes"?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_BLOG_FB_COMMENTS' => array('title' => $this->l('Use FB comments on single post page?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_BLOG_DISPLAY_SHARER' => array('title' => $this->l('Use share icons on single post page?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_BLOG_DISPLAY_AUTHOR' => array('title' => $this->l('Display post author?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool', 'desc' => $this->l('This option also applies to the list of posts from the category')), 'PH_BLOG_DISPLAY_DATE' => array('title' => $this->l('Display post creation date?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool', 'desc' => $this->l('This option also applies to the list of posts from the category')), 'PH_BLOG_DISPLAY_FEATURED' => array('title' => $this->l('Display post featured image?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_BLOG_DISPLAY_CATEGORY' => array('title' => $this->l('Display post category?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool', 'desc' => $this->l('This option also applies to the list of posts from the category')), 'PH_BLOG_DISPLAY_TAGS' => array('title' => $this->l('Display post tags?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool', 'desc' => $this->l('This option also applies to the list of posts from the category')))), 'category_page' => array('submit' => array('title' => $this->l('Update'), 'class' => 'button'), 'title' => $this->l('Appearance Settings - Post lists'), 'image' => '../img/t/AdminOrderPreferences.gif', 'fields' => array('PH_BLOG_DISPLAY_THUMBNAIL' => array('title' => $this->l('Display post thumbnails?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_BLOG_DISPLAY_DESCRIPTION' => array('title' => $this->l('Display post short description?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_BLOG_DISPLAY_CAT_DESC' => array('title' => $this->l('Display category description on category page?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_BLOG_DISPLAY_CATEGORY_IMAGE' => array('title' => $this->l('Display category image?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_CATEGORY_IMAGE_X' => array('title' => $this->l('Default category image width (px)'), 'cast' => 'intval', 'desc' => $this->l('Default: 535 (For PrestaShop 1.5), 870 (For PrestaShop 1.6)'), 'type' => 'text', 'required' => true, 'validation' => 'isUnsignedId'), 'PH_CATEGORY_IMAGE_Y' => array('title' => $this->l('Default category image height (px)'), 'cast' => 'intval', 'desc' => $this->l('Default: 150'), 'type' => 'text', 'required' => true, 'validation' => 'isUnsignedId'))), 'thumbnails' => array('submit' => array('title' => $this->l('Update'), 'class' => 'button'), 'title' => $this->l('Thumbnails Settings'), 'image' => '../img/t/AdminOrderPreferences.gif', 'info' => '<div class="' . $alert_class . '">' . $this->l('Remember to regenerate thumbnails after doing changes here') . '</div>', 'fields' => array('PH_BLOG_THUMB_METHOD' => array('title' => $this->l('Resize method:'), 'cast' => 'intval', 'desc' => $this->l('Select wich method use to resize thumbnail. Adaptive resize: What it does is resize the image to get as close as possible to the desired dimensions, then crops the image down to the proper size from the center.'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => array('1' => $this->l('Adaptive resize (recommended)'), '2' => $this->l('Crop from center'))), 'PH_BLOG_THUMB_X' => array('title' => $this->l('Default thumbnail width (px)'), 'cast' => 'intval', 'desc' => $this->l('Default: 255 (For PrestaShop 1.5), 420 (For PrestaShop 1.6)'), 'type' => 'text', 'required' => true, 'validation' => 'isUnsignedId'), 'PH_BLOG_THUMB_Y' => array('title' => $this->l('Default thumbnail height (px)'), 'cast' => 'intval', 'desc' => $this->l('Default: 200 (For PrestaShop 1.5 and 1.6)'), 'type' => 'text', 'required' => true, 'validation' => 'isUnsignedId'), 'PH_BLOG_THUMB_X_WIDE' => array('title' => $this->l('Default thumbnail width (wide version) (px)'), 'cast' => 'intval', 'desc' => $this->l('Default: 535 (For PrestaShop 1.5), 870 (For PrestaShop 1.6)'), 'type' => 'text', 'required' => true, 'validation' => 'isUnsignedId'), 'PH_BLOG_THUMB_Y_WIDE' => array('title' => $this->l('Default thumbnail height (wide version) (px)'), 'cast' => 'intval', 'desc' => $this->l('Default: 350 (For PrestaShop 1.5 and 1.6)'), 'type' => 'text', 'required' => true, 'validation' => 'isUnsignedId'))));
     $widgets_options = array();
     $widgets_options = array_merge($recentPosts, $relatedPosts);
     //$this->hide_multishop_checkbox = true;
     $this->fields_options = array_merge($standard_options, $widgets_options);
     return parent::renderOptions();
 }
 public function renderForm()
 {
     $this->initFormToolbar();
     if (!$this->loadObject(true)) {
         return;
     }
     $obj = $this->loadObject(true);
     $cover = false;
     $featured = false;
     if (isset($obj->id)) {
         $this->display = 'edit';
         $cover = ImageManager::thumbnail(_PS_MODULE_DIR_ . 'ph_simpleblog/covers/' . $obj->id . '.' . $obj->cover, 'ph_simpleblog_' . $obj->id . '.' . $obj->cover, 350, $obj->cover, false);
         $featured = ImageManager::thumbnail(_PS_MODULE_DIR_ . 'ph_simpleblog/featured/' . $obj->id . '.' . $obj->featured, 'ph_simpleblog_featured_' . $obj->id . '.' . $obj->featured, 350, $obj->featured, false);
     } else {
         $this->display = 'add';
     }
     $obj->tags = SimpleBlogTag::getPostTags($obj->id);
     $this->tpl_form_vars['PS_ALLOW_ACCENTED_CHARS_URL'] = (int) Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL');
     $this->tpl_form_vars['languages'] = $this->_languages;
     $this->tpl_form_vars['simpleblogpost'] = $obj;
     $this->tpl_form_vars['is_16'] = $this->is_16;
     $this->fields_value = array('cover' => $cover ? $cover : false, 'cover_size' => $cover ? filesize(_PS_MODULE_DIR_ . 'ph_simpleblog/covers/' . $obj->id . '.' . $obj->cover) / 1000 : false, 'featured' => $featured ? $featured : false, 'featured_size' => $featured ? filesize(_PS_MODULE_DIR_ . 'ph_simpleblog/featured/' . $obj->id . '.' . $obj->featured) / 1000 : false);
     $this->fields_form[0]['form'] = array('legend' => array('title' => $this->l('SimpleBlog Post'), 'image' => '../img/admin/tab-categories.gif'), 'input' => array(array('type' => 'text', 'label' => $this->l('Title:'), 'name' => 'meta_title', 'required' => true, 'lang' => true, 'id' => 'name', 'class' => 'copyNiceUrl'), array('type' => 'textarea', 'label' => $this->l('Description:'), 'name' => 'short_content', 'lang' => true, 'rows' => 5, 'cols' => 40, 'autoload_rte' => true), array('type' => 'textarea', 'label' => $this->l('Content:'), 'name' => 'content', 'lang' => true, 'rows' => 15, 'cols' => 40, 'autoload_rte' => true), array('type' => 'select', 'label' => $this->l('Category:'), 'name' => 'id_simpleblog_category', 'required' => true, 'options' => array('id' => 'id', 'query' => SimpleBlogCategory::getCategories($this->context->language->id), 'name' => 'name')), array('type' => 'text', 'label' => $this->l('Tags:'), 'desc' => $this->l('separate by comma for eg. ipod, apple, something'), 'name' => 'tags', 'display_tags' => true, 'required' => false, 'lang' => true), array('type' => 'text', 'label' => $this->l('Author:'), 'name' => 'author'), array('type' => 'radio', 'label' => $this->l('Featured?'), 'name' => 'is_featured', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'is_featured_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'is_featured_off', 'value' => 0, 'label' => $this->l('No')))), array('type' => 'radio', 'label' => $this->l('Displayed:'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'radio', 'label' => $this->l('For logged customers only?'), 'name' => 'logged', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'logged_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'logged_off', 'value' => 0, 'label' => $this->l('No'))))), 'submit' => array('title' => $this->l('Save and stay'), 'class' => 'button', 'stay' => true));
     $this->fields_form[1]['form'] = array('legend' => array('title' => $this->l('Post Images'), 'image' => $this->is_16 ? null : '../img/t/AdminImages.gif', 'icon' => 'icon-picture'), 'input' => array(array('type' => 'file', 'label' => $this->l('Post cover:'), 'display_image' => true, 'name' => 'cover', 'desc' => $this->l('Upload a image from your computer.')), array('type' => 'file', 'label' => $this->l('Post featured image:'), 'display_image' => true, 'name' => 'featured', 'desc' => $this->l('Upload a image from your computer. Featured image will be displayed only if you want on the single post page.'))), 'submit' => array('title' => $this->l('Save and stay'), 'class' => 'button', 'stay' => true));
     $this->fields_form[2]['form'] = array('legend' => array('title' => $this->l('SimpleBlog SEO'), 'image' => '../img/admin/tab-categories.gif'), 'input' => array(array('type' => 'text', 'label' => $this->l('Meta description:'), 'name' => 'meta_description', 'lang' => true), array('type' => 'text', 'label' => $this->l('Meta keywords:'), 'name' => 'meta_keywords', 'lang' => true), array('type' => 'text', 'label' => $this->l('Friendly URL:'), 'name' => 'link_rewrite', 'required' => true, 'lang' => true)), 'submit' => array('title' => $this->l('Save and stay'), 'class' => 'button', 'stay' => true));
     if (Shop::isFeatureActive()) {
         $this->fields_form[3]['form'] = array('legend' => array('title' => $this->l('Shop association:')), 'input' => array(array('type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso')));
     }
     $this->multiple_fieldsets = true;
     return parent::renderForm();
 }
 public function initOptions()
 {
     $this->optionTitle = $this->l('Settings');
     $blogCategories = SimpleBlogCategory::getCategories($this->context->language->id);
     $simpleBlogCategories = array();
     $simpleBlogCategories[0] = $this->l('All categories');
     $simpleBlogCategories[9999] = $this->l('Featured only');
     foreach ($blogCategories as $key => $category) {
         $simpleBlogCategories[$category['id']] = $category['name'];
     }
     $recentPosts = array();
     if (Module::isInstalled('ph_recentposts')) {
         $recentPosts = array('recent_posts' => array('submit' => array('title' => $this->l('Update'), 'class' => 'button'), 'title' => $this->l('Recent Posts widget settings'), 'image' => '../img/t/AdminOrderPreferences.gif', 'fields' => array('PH_RECENTPOSTS_LAYOUT' => array('title' => $this->l('Recent Posts layout:'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => array('full' => $this->l('Full width with large images'), 'grid' => $this->l('Grid'))), 'PH_RECENTPOSTS_GRID_COLUMNS' => array('title' => $this->l('Grid columns:'), 'cast' => 'intval', 'desc' => $this->l('Working only with "Recent Posts layout:" setup to "Grid"'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => array('2' => $this->l('2 columns'), '3' => $this->l('3 columns'), '4' => $this->l('4 columns'))), 'PH_RECENTPOSTS_NB' => array('title' => $this->l('Number of displayed Recent Posts'), 'cast' => 'intval', 'desc' => $this->l('Default: 4'), 'type' => 'text', 'required' => true, 'validation' => 'isUnsignedId'), 'PH_RECENTPOSTS_CAT' => array('title' => $this->l('Category:'), 'cast' => 'intval', 'desc' => $this->l('If you not select any category then Recent Posts will displayed posts from all categories'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => $simpleBlogCategories))));
     }
     $relatedPosts = array();
     if (Module::isInstalled('ph_relatedposts')) {
         $relatedPosts = array('related_posts' => array('submit' => array('title' => $this->l('Update'), 'class' => 'button'), 'title' => $this->l('Related Posts widget settings'), 'image' => '../img/t/AdminOrderPreferences.gif', 'fields' => array('PH_RELATEDPOSTS_GRID_COLUMNS' => array('title' => $this->l('Grid columns:'), 'cast' => 'intval', 'desc' => $this->l('Working only with "Recent Posts layout:" setup to "Grid"'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => array('2' => $this->l('2 columns'), '3' => $this->l('3 columns'), '4' => $this->l('4 columns'))))));
     }
     $timezones = array('Pacific/Midway' => "(GMT-11:00) Midway Island", 'US/Samoa' => "(GMT-11:00) Samoa", 'US/Hawaii' => "(GMT-10:00) Hawaii", 'US/Alaska' => "(GMT-09:00) Alaska", 'US/Pacific' => "(GMT-08:00) Pacific Time (US &amp; Canada)", 'America/Tijuana' => "(GMT-08:00) Tijuana", 'US/Arizona' => "(GMT-07:00) Arizona", 'US/Mountain' => "(GMT-07:00) Mountain Time (US &amp; Canada)", 'America/Chihuahua' => "(GMT-07:00) Chihuahua", 'America/Mazatlan' => "(GMT-07:00) Mazatlan", 'America/Mexico_City' => "(GMT-06:00) Mexico City", 'America/Monterrey' => "(GMT-06:00) Monterrey", 'Canada/Saskatchewan' => "(GMT-06:00) Saskatchewan", 'US/Central' => "(GMT-06:00) Central Time (US &amp; Canada)", 'US/Eastern' => "(GMT-05:00) Eastern Time (US &amp; Canada)", 'US/East-Indiana' => "(GMT-05:00) Indiana (East)", 'America/Bogota' => "(GMT-05:00) Bogota", 'America/Lima' => "(GMT-05:00) Lima", 'America/Caracas' => "(GMT-04:30) Caracas", 'Canada/Atlantic' => "(GMT-04:00) Atlantic Time (Canada)", 'America/La_Paz' => "(GMT-04:00) La Paz", 'America/Santiago' => "(GMT-04:00) Santiago", 'Canada/Newfoundland' => "(GMT-03:30) Newfoundland", 'America/Buenos_Aires' => "(GMT-03:00) Buenos Aires", 'Greenland' => "(GMT-03:00) Greenland", 'Atlantic/Stanley' => "(GMT-02:00) Stanley", 'Atlantic/Azores' => "(GMT-01:00) Azores", 'Atlantic/Cape_Verde' => "(GMT-01:00) Cape Verde Is.", 'Africa/Casablanca' => "(GMT) Casablanca", 'Europe/Dublin' => "(GMT) Dublin", 'Europe/Lisbon' => "(GMT) Lisbon", 'Europe/London' => "(GMT) London", 'Africa/Monrovia' => "(GMT) Monrovia", 'Europe/Amsterdam' => "(GMT+01:00) Amsterdam", 'Europe/Belgrade' => "(GMT+01:00) Belgrade", 'Europe/Berlin' => "(GMT+01:00) Berlin", 'Europe/Bratislava' => "(GMT+01:00) Bratislava", 'Europe/Brussels' => "(GMT+01:00) Brussels", 'Europe/Budapest' => "(GMT+01:00) Budapest", 'Europe/Copenhagen' => "(GMT+01:00) Copenhagen", 'Europe/Ljubljana' => "(GMT+01:00) Ljubljana", 'Europe/Madrid' => "(GMT+01:00) Madrid", 'Europe/Paris' => "(GMT+01:00) Paris", 'Europe/Prague' => "(GMT+01:00) Prague", 'Europe/Rome' => "(GMT+01:00) Rome", 'Europe/Sarajevo' => "(GMT+01:00) Sarajevo", 'Europe/Skopje' => "(GMT+01:00) Skopje", 'Europe/Stockholm' => "(GMT+01:00) Stockholm", 'Europe/Vienna' => "(GMT+01:00) Vienna", 'Europe/Warsaw' => "(GMT+01:00) Warsaw", 'Europe/Zagreb' => "(GMT+01:00) Zagreb", 'Europe/Athens' => "(GMT+02:00) Athens", 'Europe/Bucharest' => "(GMT+02:00) Bucharest", 'Africa/Cairo' => "(GMT+02:00) Cairo", 'Africa/Harare' => "(GMT+02:00) Harare", 'Europe/Helsinki' => "(GMT+02:00) Helsinki", 'Europe/Istanbul' => "(GMT+02:00) Istanbul", 'Asia/Jerusalem' => "(GMT+02:00) Jerusalem", 'Europe/Kiev' => "(GMT+02:00) Kyiv", 'Europe/Minsk' => "(GMT+02:00) Minsk", 'Europe/Riga' => "(GMT+02:00) Riga", 'Europe/Sofia' => "(GMT+02:00) Sofia", 'Europe/Tallinn' => "(GMT+02:00) Tallinn", 'Europe/Vilnius' => "(GMT+02:00) Vilnius", 'Asia/Baghdad' => "(GMT+03:00) Baghdad", 'Asia/Kuwait' => "(GMT+03:00) Kuwait", 'Africa/Nairobi' => "(GMT+03:00) Nairobi", 'Asia/Riyadh' => "(GMT+03:00) Riyadh", 'Asia/Tehran' => "(GMT+03:30) Tehran", 'Europe/Moscow' => "(GMT+04:00) Moscow", 'Asia/Baku' => "(GMT+04:00) Baku", 'Europe/Volgograd' => "(GMT+04:00) Volgograd", 'Asia/Muscat' => "(GMT+04:00) Muscat", 'Asia/Tbilisi' => "(GMT+04:00) Tbilisi", 'Asia/Yerevan' => "(GMT+04:00) Yerevan", 'Asia/Kabul' => "(GMT+04:30) Kabul", 'Asia/Karachi' => "(GMT+05:00) Karachi", 'Asia/Tashkent' => "(GMT+05:00) Tashkent", 'Asia/Kolkata' => "(GMT+05:30) Kolkata", 'Asia/Kathmandu' => "(GMT+05:45) Kathmandu", 'Asia/Yekaterinburg' => "(GMT+06:00) Ekaterinburg", 'Asia/Almaty' => "(GMT+06:00) Almaty", 'Asia/Dhaka' => "(GMT+06:00) Dhaka", 'Asia/Novosibirsk' => "(GMT+07:00) Novosibirsk", 'Asia/Bangkok' => "(GMT+07:00) Bangkok", 'Asia/Jakarta' => "(GMT+07:00) Jakarta", 'Asia/Krasnoyarsk' => "(GMT+08:00) Krasnoyarsk", 'Asia/Chongqing' => "(GMT+08:00) Chongqing", 'Asia/Hong_Kong' => "(GMT+08:00) Hong Kong", 'Asia/Kuala_Lumpur' => "(GMT+08:00) Kuala Lumpur", 'Australia/Perth' => "(GMT+08:00) Perth", 'Asia/Singapore' => "(GMT+08:00) Singapore", 'Asia/Taipei' => "(GMT+08:00) Taipei", 'Asia/Ulaanbaatar' => "(GMT+08:00) Ulaan Bataar", 'Asia/Urumqi' => "(GMT+08:00) Urumqi", 'Asia/Irkutsk' => "(GMT+09:00) Irkutsk", 'Asia/Seoul' => "(GMT+09:00) Seoul", 'Asia/Tokyo' => "(GMT+09:00) Tokyo", 'Australia/Adelaide' => "(GMT+09:30) Adelaide", 'Australia/Darwin' => "(GMT+09:30) Darwin", 'Asia/Yakutsk' => "(GMT+10:00) Yakutsk", 'Australia/Brisbane' => "(GMT+10:00) Brisbane", 'Australia/Canberra' => "(GMT+10:00) Canberra", 'Pacific/Guam' => "(GMT+10:00) Guam", 'Australia/Hobart' => "(GMT+10:00) Hobart", 'Australia/Melbourne' => "(GMT+10:00) Melbourne", 'Pacific/Port_Moresby' => "(GMT+10:00) Port Moresby", 'Australia/Sydney' => "(GMT+10:00) Sydney", 'Asia/Vladivostok' => "(GMT+11:00) Vladivostok", 'Asia/Magadan' => "(GMT+12:00) Magadan", 'Pacific/Auckland' => "(GMT+12:00) Auckland", 'Pacific/Fiji' => "(GMT+12:00) Fiji");
     $timezones_select = array();
     foreach ($timezones as $value => $name) {
         $timezones_select[] = array('id' => $value, 'name' => $name);
     }
     $pre_settings_content = '<button type="submit" name="regenerateThumbnails" class="button btn btn-default"><i class="process-icon-cogs"></i>' . $this->l('Regenerate thumbnails') . '</button>&nbsp;';
     $pre_settings_content .= '<button type="submit" name="submitExportSettings" class="button btn btn-default"><i class="process-icon-export"></i>' . $this->l('Export settings') . '</button>&nbsp;';
     $pre_settings_content .= '<br /><br />';
     $standard_options = array('general' => array('title' => $this->l('Blog for PrestaShop - Settings'), 'image' => '../img/t/AdminOrderPreferences.gif', 'info' => $pre_settings_content, 'fields' => array('PH_BLOG_TIMEZONE' => array('title' => $this->l('Timezone:'), 'desc' => $this->l('If you want to use future post publication date you need to setup your timezone'), 'type' => 'select', 'list' => $timezones_select, 'identifier' => 'id', 'required' => true, 'validation' => 'isGenericName'), 'PH_BLOG_POSTS_PER_PAGE' => array('title' => $this->l('Posts per page:'), 'cast' => 'intval', 'desc' => $this->l('Number of blog posts displayed per page. Default is 10.'), 'type' => 'text', 'required' => true, 'validation' => 'isUnsignedId'), 'PH_BLOG_SLUG' => array('title' => $this->l('Blog main URL (by default: blog)'), 'validation' => 'isGenericName', 'required' => true, 'type' => 'text', 'size' => 40), 'PH_BLOG_MAIN_TITLE' => array('title' => $this->l('Blog title:'), 'validation' => 'isGenericName', 'type' => 'textLang', 'size' => 40, 'desc' => $this->l('Meta Title for blog homepage')), 'PH_BLOG_MAIN_META_DESCRIPTION' => array('title' => $this->l('Blog description:'), 'validation' => 'isGenericName', 'type' => 'textLang', 'size' => 75, 'desc' => $this->l('Meta Description for blog homepage')), 'PH_BLOG_DATEFORMAT' => array('title' => $this->l('Blog default date format:'), 'desc' => $this->l('More details: http://php.net/manual/pl/function.date.php'), 'validation' => 'isGenericName', 'type' => 'text', 'size' => 40), 'PH_CATEGORY_SORTBY' => array('title' => $this->l('Sort categories by:'), 'desc' => $this->l('Select which method use to sort categories in SimpleBlog Categories Block'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => array('position' => $this->l('Position (1-9)'), 'name' => $this->l('Name (A-Z)'), 'id' => $this->l('ID (1-9)'))), 'PH_BLOG_FB_INIT' => array('title' => $this->l('Init Facebook?'), 'validation' => 'isBool', 'cast' => 'intval', 'desc' => $this->l('If you already use some Facebook widgets in your theme please select option to "No". If you select "Yes" then SimpleBlog will add facebook connect script on single post page.'), 'required' => true, 'type' => 'bool'), 'PH_BLOG_ADVERTISING' => array('title' => $this->l('Display ads and notifications in back-office?'), 'validation' => 'isBool', 'cast' => 'intval', 'desc' => $this->l('Sometimes you\'ll see notifications about module updates, our new products etc.'), 'required' => true, 'type' => 'bool')), 'submit' => array('title' => $this->l('Update'), 'class' => 'button')), 'layout' => array('submit' => array('title' => $this->l('Update'), 'class' => 'button'), 'title' => $this->l('Appearance Settings - General'), 'image' => '../img/t/AdminOrderPreferences.gif', 'fields' => array('PH_BLOG_DISPLAY_BREADCRUMBS' => array('title' => $this->l('Display breadcrumbs in center-column?'), 'validation' => 'isBool', 'cast' => 'intval', 'desc' => $this->l('Sometimes you want to remove breadcrumbs from center-column'), 'required' => true, 'type' => 'bool'), 'PH_BLOG_LIST_LAYOUT' => array('title' => $this->l('Posts list layout:'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => array('full' => $this->l('Full width with large images'), 'grid' => $this->l('Grid'))), 'PH_BLOG_GRID_COLUMNS' => array('title' => $this->l('Grid columns:'), 'cast' => 'intval', 'desc' => $this->l('Working only with "Posts list layout" setup to "Grid"'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => array('2' => $this->l('2 columns'), '3' => $this->l('3 columns'), '4' => $this->l('4 columns'))), 'PH_BLOG_MASONRY_LAYOUT' => array('title' => $this->l('Use Masonry layout?'), 'validation' => 'isBool', 'cast' => 'intval', 'desc' => $this->l('You can use masonry layout if you use Grid as a post list layout'), 'type' => 'bool'), 'PH_BLOG_CSS' => array('title' => $this->l('Custom CSS'), 'show' => true, 'required' => false, 'type' => 'textarea', 'cols' => '70', 'rows' => '10'))), 'single_post' => array('submit' => array('title' => $this->l('Update'), 'class' => 'button'), 'title' => $this->l('Appearance Settings - Single post'), 'image' => '../img/t/AdminOrderPreferences.gif', 'fields' => array('PH_BLOG_DISPLAY_LIKES' => array('title' => $this->l('Display "likes"?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_BLOG_DISPLAY_SHARER' => array('title' => $this->l('Use share icons on single post page?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_BLOG_DISPLAY_AUTHOR' => array('title' => $this->l('Display post author?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool', 'desc' => $this->l('This option also applies to the list of posts from the category')), 'PH_BLOG_DISPLAY_DATE' => array('title' => $this->l('Display post creation date?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool', 'desc' => $this->l('This option also applies to the list of posts from the category')), 'PH_BLOG_DISPLAY_FEATURED' => array('title' => $this->l('Display post featured image?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_BLOG_DISPLAY_CATEGORY' => array('title' => $this->l('Display post category?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool', 'desc' => $this->l('This option also applies to the list of posts from the category')), 'PH_BLOG_DISPLAY_TAGS' => array('title' => $this->l('Display post tags?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool', 'desc' => $this->l('This option also applies to the list of posts from the category')), 'PH_BLOG_DISPLAY_RELATED' => array('title' => $this->l('Display related products?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'))), 'category_page' => array('submit' => array('title' => $this->l('Update'), 'class' => 'button'), 'title' => $this->l('Appearance Settings - Post lists'), 'image' => '../img/t/AdminOrderPreferences.gif', 'fields' => array('PH_BLOG_DISPLAY_MORE' => array('title' => $this->l('Display "Read more"?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_BLOG_DISPLAY_THUMBNAIL' => array('title' => $this->l('Display post thumbnails?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_BLOG_DISPLAY_DESCRIPTION' => array('title' => $this->l('Display post short description?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_BLOG_DISPLAY_CAT_DESC' => array('title' => $this->l('Display category description on category page?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_BLOG_DISPLAY_CATEGORY_IMAGE' => array('title' => $this->l('Display category image?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_CATEGORY_IMAGE_X' => array('title' => $this->l('Default category image width (px)'), 'cast' => 'intval', 'desc' => $this->l('Default: 535 (For PrestaShop 1.5), 870 (For PrestaShop 1.6)'), 'type' => 'text', 'required' => true, 'validation' => 'isUnsignedId'), 'PH_CATEGORY_IMAGE_Y' => array('title' => $this->l('Default category image height (px)'), 'cast' => 'intval', 'desc' => $this->l('Default: 150'), 'type' => 'text', 'required' => true, 'validation' => 'isUnsignedId'))), 'comments' => array('submit' => array('title' => $this->l('Update'), 'class' => 'button'), 'title' => $this->l('Comments'), 'fields' => array('PH_BLOG_COMMENTS_SYSTEM' => array('title' => $this->l('Comments system:'), 'desc' => $this->l('What type of comments system do you want to use?'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => array('native' => $this->l('Default native comments'), 'facebook' => $this->l('Facebook comments'), 'disqus' => $this->l('Disqus comments'))), 'PH_BLOG_COMMENT_ALLOW' => array('title' => $this->l('Allow comments?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_BLOG_COMMENT_ALLOW_GUEST' => array('title' => $this->l('Allow comments for non logged in users?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_BLOG_COMMENT_NOTIFICATIONS' => array('title' => $this->l('Notify about new comments?'), 'validation' => 'isBool', 'desc' => $this->l('Only for native comment system'), 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_BLOG_COMMENT_NOTIFY_EMAIL' => array('title' => $this->l('E-mail for notifications'), 'type' => 'text', 'desc' => $this->l('Only for native comment system'), 'size' => 55, 'required' => false))), 'facebook_comments' => array('submit' => array('title' => $this->l('Update'), 'class' => 'button'), 'title' => $this->l('Facebook comments - settings'), 'fields' => array('PH_BLOG_FACEBOOK_MODERATOR' => array('title' => $this->l('Facebook comments moderator User ID'), 'type' => 'text', 'size' => 55), 'PH_BLOG_FACEBOOK_APP_ID' => array('title' => $this->l('Facebook application ID (may be required for comments moderation)'), 'type' => 'text', 'size' => 75), 'PH_BLOG_FACEBOOK_COLOR_SCHEME' => array('title' => $this->l('Faceboook comments color scheme'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => array('light' => $this->l('Light'), 'dark' => $this->l('Dark'))))), 'disqus_comments' => array('submit' => array('title' => $this->l('Update'), 'class' => 'button'), 'title' => $this->l('Disqus comments - settings'), 'fields' => array('PH_BLOG_DISQUS_SHORTNAME' => array('title' => $this->l('Shortname'), 'type' => 'text', 'size' => 55))), 'comments_spam_protection' => array('submit' => array('title' => $this->l('Update'), 'class' => 'button'), 'title' => $this->l('Comments - Spam Protection for native comments system'), 'info' => '<div class="alert alert-info">' . $this->l('Spam protection is provided by Google reCAPTCHA service, to gain keys:') . '
                 <ol>
                     <li>' . $this->l('Login to your Google Account and go to this page:') . ' https://www.google.com/recaptcha/admin</li>
                     <li>' . $this->l('Register a new site') . '</li>
                     <li>' . $this->l('Get Site Key and Secret Key and provide these keys here in Settings') . '</li>
                     <li>' . $this->l('Remember: if you do not specify the correct keys, the captcha will not work') . '</li>
                 </ol>
             </div>', 'fields' => array('PH_BLOG_COMMENTS_RECAPTCHA' => array('title' => $this->l('Enable spam protection?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_BLOG_COMMENTS_RECAPTCHA_SITE_KEY' => array('title' => $this->l('Site key:'), 'type' => 'text', 'size' => 255, 'required' => false), 'PH_BLOG_COMMENTS_RECAPTCHA_SECRET_KEY' => array('title' => $this->l('Secret key:'), 'type' => 'text', 'size' => 255, 'required' => false), 'PH_BLOG_COMMENTS_RECAPTCHA_THEME' => array('title' => $this->l('reCAPTCHA color scheme:'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => array('light' => $this->l('Light'), 'dark' => $this->l('Dark'))))), 'thumbnails' => array('submit' => array('title' => $this->l('Update'), 'class' => 'button'), 'title' => $this->l('Thumbnails Settings'), 'image' => '../img/t/AdminOrderPreferences.gif', 'info' => '<div class="alert alert-info">' . $this->l('Remember to regenerate thumbnails after doing changes here') . '</div>', 'fields' => array('PH_BLOG_THUMB_METHOD' => array('title' => $this->l('Resize method:'), 'cast' => 'intval', 'desc' => $this->l('Select wich method use to resize thumbnail. Adaptive resize: What it does is resize the image to get as close as possible to the desired dimensions, then crops the image down to the proper size from the center.'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => array('1' => $this->l('Adaptive resize (recommended)'), '2' => $this->l('Crop from center'))), 'PH_BLOG_THUMB_X' => array('title' => $this->l('Default thumbnail width (px)'), 'cast' => 'intval', 'desc' => $this->l('Default: 255 (For PrestaShop 1.5), 420 (For PrestaShop 1.6)'), 'type' => 'text', 'required' => true, 'validation' => 'isUnsignedId'), 'PH_BLOG_THUMB_Y' => array('title' => $this->l('Default thumbnail height (px)'), 'cast' => 'intval', 'desc' => $this->l('Default: 200 (For PrestaShop 1.5 and 1.6)'), 'type' => 'text', 'required' => true, 'validation' => 'isUnsignedId'), 'PH_BLOG_THUMB_X_WIDE' => array('title' => $this->l('Default thumbnail width (wide version) (px)'), 'cast' => 'intval', 'desc' => $this->l('Default: 535 (For PrestaShop 1.5), 870 (For PrestaShop 1.6)'), 'type' => 'text', 'required' => true, 'validation' => 'isUnsignedId'), 'PH_BLOG_THUMB_Y_WIDE' => array('title' => $this->l('Default thumbnail height (wide version) (px)'), 'cast' => 'intval', 'desc' => $this->l('Default: 350 (For PrestaShop 1.5 and 1.6)'), 'type' => 'text', 'required' => true, 'validation' => 'isUnsignedId'))), 'troubleshooting' => array('submit' => array('title' => $this->l('Update'), 'class' => 'button'), 'title' => $this->l('Troubleshooting'), 'fields' => array('PH_BLOG_RELATED_PRODUCTS_USE_DEFAULT_LIST' => array('title' => $this->l('Use product list from your theme for related products?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'desc' => $this->l('By default Blog for PrestaShop uses default-bootstrap product list markup for related products, you can switch this option to load your product-list.tpl instead.'), 'type' => 'bool'), 'PH_BLOG_LOAD_FONT_AWESOME' => array('title' => $this->l('Load FontAwesome from module?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'desc' => $this->l('Important: Blog for PrestaShop uses fa fa-iconname format instead of icon-iconname format used by default in PrestaShop.'), 'type' => 'bool'), 'PH_BLOG_LOAD_BXSLIDER' => array('title' => $this->l('Load BxSlider from module?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_BLOG_LOAD_MASONRY' => array('title' => $this->l('Load Masonry from module?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_BLOG_LOAD_FITVIDS' => array('title' => $this->l('Load FitVids from module?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'))));
     $widgets_options = array();
     $widgets_options = array_merge($recentPosts, $relatedPosts);
     $import_settings = array('import_settings' => array('submit' => array('title' => $this->l('Import settings'), 'class' => 'button'), 'title' => $this->l('Import settings'), 'fields' => array('PH_BLOG_IMPORT_SETTINGS' => array('title' => $this->l('Paste here content of your settings file to import'), 'show' => false, 'required' => false, 'type' => 'textarea', 'cols' => '70', 'rows' => '10'))));
     //$this->hide_multishop_checkbox = true;
     $this->fields_options = array_merge($standard_options, $widgets_options, $import_settings);
     return parent::renderOptions();
 }
Example #5
0
 public function move($direction)
 {
     $nb_cats = SimpleBlogCategory::getNbCats($this->id_parent);
     if ($direction != 'l' && $direction != 'r') {
         return false;
     }
     if ($nb_cats <= 1) {
         return false;
     }
     if ($direction == 'l' && $this->position <= 1) {
         return false;
     }
     if ($direction == 'r' && $this->position >= $nb_cats) {
         return false;
     }
     $new_position = $direction == 'l' ? $this->position - 1 : $this->position + 1;
     Db::getInstance()->execute('
         UPDATE `' . _DB_PREFIX_ . 'simpleblog_category` sbc
         SET position = ' . (int) $this->position . '
         WHERE id_parent = ' . (int) $this->id_parent . '
             AND position = ' . (int) $new_position);
     $this->position = $new_position;
     return $this->update();
 }
 public function deleteCover($id)
 {
     $object = new SimpleBlogCategory($id, Context::getContext()->language->id);
     $tmp_location = _PS_TMP_IMG_DIR_ . 'ph_simpleblog_cat_' . $object->id . '.' . $object->cover;
     if (file_exists($tmp_location)) {
         @unlink($tmp_location);
     }
     $orig_location = _PS_MODULE_DIR_ . 'ph_simpleblog/covers_cat/' . $object->id . '.' . $object->cover;
     if (file_exists($orig_location)) {
         @unlink($orig_location);
     }
     $object->cover = null;
     $object->update();
     Tools::redirectAdmin(self::$currentIndex . '&token=' . Tools::getAdminTokenLite('AdminSimpleBlogCategories') . '&conf=7');
 }
Example #7
0
 public function getObjectLink($id_lang)
 {
     return SimpleBlogCategory::getLink($this->link_rewrite);
     // $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);
 }
Example #8
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();
     }
 }
 protected function initFieldsForm()
 {
     $from = array();
     $from[] = array('name' => $this->l('Recent posts'), 'id' => 'recent');
     $from[] = array('name' => $this->l('Featured posts'), 'id' => 'featured');
     $from[] = array('name' => $this->l('Most viewed'), 'id' => 'viewed');
     $from[] = array('name' => $this->l('Most liked'), 'id' => 'liked');
     $layout = array();
     $layout[] = array('name' => $this->l('Default list'), 'id' => 'list');
     $layout[] = array('name' => $this->l('Simple list'), 'id' => 'simple_list');
     $available_categories = SimpleBlogCategory::getCategories($this->context->language->id, true, false);
     foreach ($available_categories as &$category) {
         $category['name'] = 'Category: ' . $category['name'];
         if ($category['is_child']) {
             $category['name'] = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $category['name'];
         }
         $from[] = array('name' => $category['name'], 'id' => $category['id']);
     }
     $this->fields_form[0]['form'] = array('legend' => array('title' => $this->displayName), 'input' => array(array('type' => 'text', 'label' => $this->l('Title of the block:'), 'name' => self::$cfg_prefix . 'TITLE', 'lang' => true, 'validation' => 'isCleanHtml'), array('type' => 'select', 'label' => $this->l('Display posts from:'), 'name' => self::$cfg_prefix . 'FROM', 'validation' => 'isAnything', 'options' => array('query' => $from, 'id' => 'id', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Layout:'), 'name' => self::$cfg_prefix . 'LAYOUT', 'validation' => 'isAnything', 'options' => array('query' => $layout, 'id' => 'id', 'name' => 'name')), array('type' => 'text', 'label' => $this->l('Number of posts:'), 'name' => self::$cfg_prefix . 'NB_POSTS', 'validation' => 'isUnsignedInt'), array('type' => 'text', 'label' => $this->l('Max width of the image:'), 'name' => self::$cfg_prefix . 'IMG_MAX_WIDTH', 'validation' => 'isUnsignedInt', 'suffix' => 'px', 'class' => 'fixed-width-xs'), array('type' => 'switch', 'label' => $this->l('Display visit blog button?'), 'name' => self::$cfg_prefix . 'VISIT_BLOG', 'validation' => 'isBool', 'values' => array(array('id' => self::$cfg_prefix . 'VISIT_BLOG_on', 'value' => 1), array('id' => self::$cfg_prefix . 'VISIT_BLOG_off', 'value' => 0)))), 'submit' => array('title' => $this->l('Save'), 'class' => 'button pull-right'));
 }
 public function prepareSimpleBlogCategories()
 {
     $this->context->smarty->assign(array('categories' => SimpleBlogCategory::getCategories($this->context->language->id)));
 }
Example #11
0
 public function initContent()
 {
     $id_lang = Context::getContext()->language->id;
     parent::initContent();
     $this->context->smarty->assign('is_16', (bool) (version_compare(_PS_VERSION_, '1.6.0', '>=') === true));
     $gridType = Configuration::get('PH_BLOG_COLUMNS');
     $gridColumns = Configuration::get('PH_BLOG_GRID_COLUMNS');
     $blogLayout = Configuration::get('PH_BLOG_LIST_LAYOUT');
     $gridHtmlCols = '';
     if ($blogLayout == 'full') {
         $gridHtmlCols = 'ph_col';
     }
     $this->context->smarty->assign(array('categories' => SimpleBlogCategory::getCategories($id_lang), 'latest_posts' => SimpleBlogPost::getPosts($id_lang, 5), 'blogMainTitle' => Configuration::get('PH_BLOG_MAIN_TITLE', $id_lang), 'grid' => Configuration::get('PH_BLOG_COLUMNS'), 'columns' => $gridColumns, 'gridHtmlCols' => $gridHtmlCols, 'blogLayout' => $blogLayout, 'module_dir' => _MODULE_DIR_ . 'ph_simpleblog/', 'tpl_path' => _PS_MODULE_DIR_ . 'ph_simpleblog/views/templates/front/', 'gallery_dir' => _MODULE_DIR_ . 'ph_simpleblog/galleries/'));
     $page = Tools::getValue('p', 0);
     // How many posts?
     $this->posts_per_page = Configuration::get('PH_BLOG_POSTS_PER_PAGE');
     // Is blog category, author or something else?
     $this->context->smarty->assign('is_category', false);
     $this->context->smarty->assign('is_search', false);
     // Category things
     if ($this->sb_category != '') {
         $this->context->smarty->assign('is_category', true);
         $SimpleBlogCategory = SimpleBlogCategory::getByRewrite($this->sb_category, $id_lang);
         // Category not found so now we looking for categories in same rewrite but other languages and if we found then we redirect 301
         if (!Validate::isLoadedObject($SimpleBlogCategory)) {
             $SimpleBlogCategory = SimpleBlogCategory::getByRewrite($this->sb_category, false);
             if (Validate::isLoadedObject($SimpleBlogCategory)) {
                 $SimpleBlogCategory = new SimpleBlogCategory($SimpleBlogCategory->id, $id_lang);
                 header('HTTP/1.1 301 Moved Permanently');
                 header('Location: ' . SimpleBlogCategory::getLink($SimpleBlogCategory->link_rewrite));
             } else {
                 header('HTTP/1.1 404 Not Found');
                 header('Status: 404 Not Found');
                 Tools::redirect($this->context->link->getPageLink('404'));
             }
         }
         if ($SimpleBlogCategory->id_parent > 0) {
             $parent = new SimpleBlogCategory($SimpleBlogCategory->id_parent, $id_lang);
             $this->context->smarty->assign('parent_category', $parent);
         }
         // @todo: More flexible
         if ($SimpleBlogCategory->meta_title != '') {
             $meta_title = $SimpleBlogCategory->meta_title;
         } else {
             $meta_title = $SimpleBlogCategory->name . ' - ' . $this->module->l('Blog');
         }
         if (!empty($SimpleBlogCategory->meta_description)) {
             $this->context->smarty->assign('meta_description', $SimpleBlogCategory->meta_description);
         }
         if (!empty($SimpleBlogCategory->meta_keywords)) {
             $this->context->smarty->assign('meta_keywords', $SimpleBlogCategory->meta_keywords);
         }
         if ($page > 1) {
             $meta_title .= ' (' . $page . ')';
         }
         $this->context->smarty->assign('meta_title', $meta_title);
         $posts = SimpleBlogPost::getPosts($id_lang, $this->posts_per_page, $SimpleBlogCategory->id, $page);
         $this->assignPagination($this->posts_per_page, sizeof(SimpleBlogPost::getPosts($id_lang, null, $SimpleBlogCategory->id)));
         $this->context->smarty->assign('blogCategory', $SimpleBlogCategory);
         $this->context->smarty->assign('posts', $posts);
         $this->context->smarty->assign('category_rewrite', $SimpleBlogCategory->link_rewrite);
         //$this->setTemplate('list-category.tpl');
     } elseif ($this->is_search) {
         // @todo: complete refactoring "authors" to 2.0.0
         // Posts by author
         $this->context->smarty->assign('is_search', true);
         // echo SimpleBlogPost::getSearchLink('author', 'kpodemski', $id_lang);
         // @todo: meta titles, blog title, specific layout
         switch ($this->simpleblog_search) {
             case 'author':
                 break;
             case 'tag':
                 break;
         }
         $this->context->smarty->assign('meta_title', $this->l('Posts by', 'list') . ' ' . $this->simpleblog_author . ' - ' . $this->l('Blog', 'list'));
         $posts = SimpleBlogPost::findPosts($this->simpleblog_search, $this->simpleblog_keyword, $id_lang, $this->posts_per_page, $page);
         $this->assignPagination($this->posts_per_page, sizeof(SimpleBlogPost::findPosts($this->simpleblog_search, $this->simpleblog_keyword, $id_lang)));
         $this->context->smarty->assign('posts', $posts);
     } else {
         // Home things
         $posts = SimpleBlogPost::getPosts($id_lang, $this->posts_per_page, null, $page);
         $this->assignPagination($this->posts_per_page, sizeof(SimpleBlogPost::getPosts($id_lang, null)));
         // @todo: More flexible
         $meta_title = Configuration::get('PH_BLOG_MAIN_TITLE', Context::getContext()->language->id) ? Configuration::get('PH_BLOG_MAIN_TITLE', Context::getContext()->language->id) : Configuration::get('PS_SHOP_NAME') . ' - Blog';
         $meta_description = Configuration::get('PH_BLOG_MAIN_META_DESCRIPTION', Context::getContext()->language->id) ? Configuration::get('PH_BLOG_MAIN_META_DESCRIPTION', Context::getContext()->language->id) : '';
         if ($page > 1) {
             $meta_title .= ' (' . $page . ')';
         }
         $this->context->smarty->assign('meta_title', $meta_title);
         $this->context->smarty->assign('meta_description', $meta_description);
         $this->context->smarty->assign('posts', $posts);
     }
     $this->setTemplate('list.tpl');
 }
 public function renderForm()
 {
     $this->initFormToolbar();
     if (!$this->loadObject(true)) {
         return;
     }
     $obj = $this->loadObject(true);
     /**
     
     
                 POST IMAGES
     
     
             **/
     $cover = false;
     $featured = false;
     if (isset($obj->id)) {
         $this->display = 'edit';
         $cover = ImageManager::thumbnail(_PS_MODULE_DIR_ . 'ph_simpleblog/covers/' . $obj->id . '.' . $obj->cover, 'ph_simpleblog_' . $obj->id . '.' . $obj->cover, 350, $obj->cover, false);
         $featured = ImageManager::thumbnail(_PS_MODULE_DIR_ . 'ph_simpleblog/featured/' . $obj->id . '.' . $obj->featured, 'ph_simpleblog_featured_' . $obj->id . '.' . $obj->featured, 350, $obj->featured, false);
     } else {
         $this->display = 'add';
     }
     $this->fields_value = array('cover' => $cover ? $cover : false, 'cover_size' => $cover ? filesize(_PS_MODULE_DIR_ . 'ph_simpleblog/covers/' . $obj->id . '.' . $obj->cover) / 1000 : false, 'featured' => $featured ? $featured : false, 'featured_size' => $featured ? filesize(_PS_MODULE_DIR_ . 'ph_simpleblog/featured/' . $obj->id . '.' . $obj->featured) / 1000 : false);
     /**
     
     
                 POST TAGS
                 
     
             **/
     $obj->tags = SimpleBlogTag::getPostTags($obj->id);
     /**
     
     
                 GLOBAL $
                 
     
             **/
     $this->tpl_form_vars['PS_ALLOW_ACCENTED_CHARS_URL'] = (int) Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL');
     $this->tpl_form_vars['languages'] = $this->_languages;
     $this->tpl_form_vars['simpleblogpost'] = $obj;
     $this->tpl_form_vars['is_16'] = $this->is_16;
     /**
     
     
                 POST ACCESS
                 
     
             **/
     if (isset($obj->id) && $obj->access) {
         $groupAccess = unserialize($obj->access);
         foreach ($groupAccess as $groupAccessID => $value) {
             $groupBox = 'groupBox_' . $groupAccessID;
             $this->fields_value[$groupBox] = $value;
         }
     } else {
         $groups = Group::getGroups($this->context->language->id);
         $preselected = array(Configuration::get('PS_UNIDENTIFIED_GROUP'), Configuration::get('PS_GUEST_GROUP'), Configuration::get('PS_CUSTOMER_GROUP'));
         foreach ($groups as $group) {
             $this->fields_value['groupBox_' . $group['id_group']] = in_array($group['id_group'], $preselected);
         }
     }
     /**
     
             Default publication date for new posts
     
             **/
     if (!isset($obj->id)) {
         $this->fields_value['date_add'] = date('Y-m-d H:i:s');
     }
     $available_categories = SimpleBlogCategory::getCategories($this->context->language->id, true, false);
     foreach ($available_categories as &$category) {
         if ($category['is_child']) {
             $category['name'] = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $category['name'];
         }
     }
     $i = 0;
     $this->fields_form[$i]['form'] = array('legend' => array('title' => $this->l('SimpleBlog Post'), 'icon' => 'icon-folder-close'), 'input' => array(array('type' => 'select', 'label' => $this->l('Post type:'), 'name' => 'id_simpleblog_post_type', 'required' => true, 'options' => array('id' => 'id_simpleblog_post_type', 'query' => SimpleBlogPostType::getAll(), 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Category:'), 'name' => 'id_simpleblog_category', 'required' => true, 'options' => array('id' => 'id', 'query' => $available_categories, 'name' => 'name')), array('type' => 'text', 'label' => $this->l('Author:'), 'name' => 'author'), array('type' => 'text', 'label' => $this->l('Title:'), 'name' => 'title', 'required' => true, 'lang' => true, 'id' => 'name', 'class' => 'copyNiceUrl'), array('type' => 'textarea', 'label' => $this->l('Short content:'), 'name' => 'short_content', 'lang' => true, 'rows' => 5, 'cols' => 40, 'autoload_rte' => true), array('type' => 'textarea', 'label' => $this->l('Full post content:'), 'name' => 'content', 'lang' => true, 'rows' => 15, 'cols' => 40, 'autoload_rte' => true), array('type' => 'tags', 'label' => $this->l('Tags:'), 'desc' => $this->l('separate by comma for eg. ipod, apple, something'), 'name' => 'tags', 'required' => false, 'lang' => true), array('type' => 'switch', 'label' => $this->l('Featured?'), 'name' => 'is_featured', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'is_featured_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'is_featured_off', 'value' => 0, 'label' => $this->l('No')))), array('type' => 'switch', 'label' => $this->l('Displayed:'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'radio', 'label' => $this->l('Allow comments?'), 'name' => 'allow_comments', 'required' => false, 'class' => 't', 'values' => array(array('id' => 'allow_comments_1', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'allow_comments_2', 'value' => 2, 'label' => $this->l('No')), array('id' => 'allow_comments_3', 'value' => 3, 'label' => $this->l('Use global setting'))))), 'submit' => array('title' => $this->l('Save and stay'), 'class' => 'button', 'stay' => true));
     $i++;
     if (isset($obj->id)) {
         $this->addjQueryPlugin(array('thickbox', 'ajaxfileupload'));
         // Get images
         $images = SimpleBlogPostImage::getAllById($obj->id);
         foreach ($images as $k => $image) {
             $images[$k] = new SimpleBlogPostImage($image['id_simpleblog_post_image']);
         }
         $image_uploader = new HelperImageUploader('file');
         $image_uploader->setMultiple(!(Tools::getUserBrowser() == 'Apple Safari' && Tools::getUserPlatform() == 'Windows'))->setUseAjax(true)->setUrl(Context::getContext()->link->getAdminLink('AdminSimpleBlogPosts') . '&ajax=1&id_simpleblog_post=' . (int) $obj->id . '&action=addPostImages');
         $this->tpl_form_vars['images'] = $images;
         $this->tpl_form_vars['image_uploader'] = $image_uploader->render();
         $this->fields_form[$i]['form'] = array('legend' => array('title' => $this->l('Post type options'), 'icon' => 'icon-folder-close'), 'input' => array(array('type' => 'text', 'label' => $this->l('External URL:'), 'name' => 'external_url', 'form_group_class' => 'simpleblog-post-type simpleblog-post-type-' . SimpleBlogPostType::getIdBySlug('url'), 'lang' => true), array('type' => 'textarea', 'label' => $this->l('Video embed code:'), 'name' => 'video_code', 'lang' => true, 'form_group_class' => 'simpleblog-post-type simpleblog-post-type-' . SimpleBlogPostType::getIdBySlug('video'), 'desc' => $this->l('Remember to "Allow iframes on HTML fields" in Preferences -> General')), array('type' => 'file', 'multiple' => true, 'ajax' => true, 'name' => 'post_images', 'label' => $this->l('Add images to gallery'), 'required' => false, 'lang' => false, 'form_group_class' => 'simpleblog-post-type simpleblog-post-type-' . SimpleBlogPostType::getIdBySlug('gallery'))), 'submit' => array('title' => $this->l('Save and stay'), 'class' => 'button', 'stay' => true));
         $i++;
     } else {
         $this->fields_form[$i]['form'] = array('legend' => array('title' => $this->l('Post type options'), 'icon' => 'icon-folder-close'), 'description' => $this->l('Specific post type options will be available after saving post'));
         $i++;
     }
     $this->fields_form[$i]['form'] = array('legend' => array('title' => $this->l('Post Images'), 'image' => $this->is_16 ? null : '../img/t/AdminImages.gif', 'icon' => 'icon-picture'), 'input' => array(array('type' => 'file', 'label' => $this->l('Post cover:'), 'display_image' => true, 'name' => 'cover', 'desc' => $this->l('Upload a image from your computer.')), array('type' => 'file', 'label' => $this->l('Post featured image:'), 'display_image' => true, 'name' => 'featured', 'desc' => $this->l('Upload a image from your computer. Featured image will be displayed only if you want on the single post page.'))), 'submit' => array('title' => $this->l('Save and stay'), 'class' => 'button', 'stay' => true));
     $i++;
     $available_products = self::getSimpleProducts($this->context->language->id);
     foreach ($available_products as &$available_related_product) {
         if (empty($available_related_product['product_name'])) {
             if (isset($available_related_product['name']) && !empty($available_related_product['name'])) {
                 $available_related_product['product_name'] = $available_related_product['name'];
             }
         }
     }
     $this->fields_form[$i]['form'] = array('legend' => array('title' => $this->l('Related products')), 'input' => array(array('type' => 'select', 'label' => $this->l('Product:'), 'name' => 'id_product[]', 'id' => 'select_product', 'multiple' => true, 'required' => false, 'options' => array('id' => 'id_product', 'query' => $available_products, 'name' => 'product_name'))), 'submit' => array('title' => $this->l('Save and stay'), 'class' => 'button', 'stay' => true));
     $i++;
     $this->fields_value['id_product[]'] = explode(',', $obj->id_product);
     $this->fields_form[$i]['form'] = array('legend' => array('title' => $this->l('SEO'), 'icon' => 'icon-folder-close'), 'input' => array(array('type' => 'text', 'label' => $this->l('Meta title:'), 'name' => 'meta_title', 'lang' => true), array('type' => 'text', 'label' => $this->l('Meta description:'), 'name' => 'meta_description', 'lang' => true), array('type' => 'text', 'label' => $this->l('Meta keywords:'), 'name' => 'meta_keywords', 'lang' => true), array('type' => 'text', 'label' => $this->l('Friendly URL:'), 'name' => 'link_rewrite', 'required' => true, 'lang' => true)), 'submit' => array('title' => $this->l('Save and stay'), 'class' => 'button', 'stay' => true));
     $i++;
     $unidentified = new Group(Configuration::get('PS_UNIDENTIFIED_GROUP'));
     $guest = new Group(Configuration::get('PS_GUEST_GROUP'));
     $default = new Group(Configuration::get('PS_CUSTOMER_GROUP'));
     $unidentified_group_information = sprintf($this->l('%s - All people without a valid customer account.'), '<b>' . $unidentified->name[$this->context->language->id] . '</b>');
     $guest_group_information = sprintf($this->l('%s - Customer who placed an order with the guest checkout.'), '<b>' . $guest->name[$this->context->language->id] . '</b>');
     $default_group_information = sprintf($this->l('%s - All people who have created an account on this site.'), '<b>' . $default->name[$this->context->language->id] . '</b>');
     $this->fields_form[$i]['form'] = array('legend' => array('title' => $this->l('Availability')), 'input' => array(array('type' => 'datetime', 'label' => $this->l('Publication date:'), 'name' => 'date_add', 'desc' => $this->l('Remember to set correctly your timezone in Simple Blog -> Settings. Current timezone:') . ' ' . Configuration::get('PH_BLOG_TIMEZONE') . ', ' . $this->l('current time with this setting:') . ' ' . SimpleBlogHelper::now(Configuration::get('PH_BLOG_TIMEZONE')), 'required' => true), array('type' => 'group', 'label' => $this->l('Group access'), 'name' => 'groupBox', 'values' => Group::getGroups(Context::getContext()->language->id), 'info_introduction' => $this->l('You now have three default customer groups.'), 'unidentified' => $unidentified_group_information, 'guest' => $guest_group_information, 'customer' => $default_group_information, 'hint' => $this->l('Mark all of the customer groups which you would like to have access to this category.'))), 'submit' => array('title' => $this->l('Save and stay'), 'class' => 'button', 'stay' => true));
     $i++;
     if (Shop::isFeatureActive()) {
         $this->fields_form[$i]['form'] = array('legend' => array('title' => $this->l('Shop association:')), 'input' => array(array('type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso')));
     }
     $this->multiple_fieldsets = true;
     return parent::renderForm();
 }
Example #13
0
File: list.php Project: OaSiis/LDDP
 public function initContent()
 {
     $sidebar = Configuration::get('PH_BLOG_LAYOUT');
     if ($sidebar == 'left_sidebar') {
         $this->display_column_left = true;
         $this->display_column_right = false;
     } elseif ($sidebar == 'right_sidebar') {
         $this->display_column_left = false;
         $this->display_column_right = true;
     } elseif ($sidebar == 'full_width') {
         $this->display_column_left = false;
         $this->display_column_right = false;
     } else {
         $this->display_column_left = true;
         $this->display_column_right = true;
     }
     $id_lang = Context::getContext()->language->id;
     parent::initContent();
     $this->context->smarty->assign('is_16', (bool) (version_compare(_PS_VERSION_, '1.6.0', '>=') === true));
     $gridType = Configuration::get('PH_BLOG_COLUMNS');
     $gridColumns = Configuration::get('PH_BLOG_GRID_COLUMNS');
     $blogLayout = Configuration::get('PH_BLOG_LIST_LAYOUT');
     $gridHtmlCols = '';
     $mainTemplate = '';
     // First attempts to support 1.6
     if ($gridType == 'prestashop') {
         $gridHtmlCols = 'ph_col ph_col_' . $gridColumns;
     } elseif ($gridType == 'bootstrap') {
         $mainTemplate = '-bootstrap';
     }
     if ($blogLayout == 'full') {
         $gridHtmlCols = 'ph_col';
     }
     $this->context->smarty->assign(array('categories' => SimpleBlogCategory::getCategories($id_lang), 'latest_posts' => SimpleBlogPost::getPosts($id_lang, 5), 'blogMainTitle' => Configuration::get('PH_BLOG_MAIN_TITLE', $id_lang), 'columns' => $gridColumns, 'grid' => Configuration::get('PH_BLOG_COLUMNS'), 'gridHtmlCols' => $gridHtmlCols, 'module_dir' => _MODULE_DIR_ . 'ph_simpleblog/', 'blogLayout' => $blogLayout));
     $page = Tools::getValue('p', 0);
     // How many posts?
     $this->posts_per_page = Configuration::get('PH_BLOG_POSTS_PER_PAGE');
     // Is blog category, author or something else?
     $this->context->smarty->assign('is_category', false);
     $this->context->smarty->assign('is_search', false);
     // Category things
     if ($this->sb_category != '') {
         $this->context->smarty->assign('is_category', true);
         $SimpleBlogCategory = SimpleBlogCategory::getByRewrite($this->sb_category, $id_lang);
         // Category not found so now we looking for categories in same rewrite but other languages and if we found then we redirect 301
         if (!Validate::isLoadedObject($SimpleBlogCategory)) {
             $SimpleBlogCategory = SimpleBlogCategory::getByRewrite($this->sb_category, false);
             if (Validate::isLoadedObject($SimpleBlogCategory)) {
                 $SimpleBlogCategory = new SimpleBlogCategory($SimpleBlogCategory->id, $id_lang);
                 header('HTTP/1.1 301 Moved Permanently');
                 header('Location: ' . SimpleBlogCategory::getLink($SimpleBlogCategory->link_rewrite));
             }
         }
         // @todo: More flexible
         if ($SimpleBlogCategory->meta_title != '') {
             $meta_title = $SimpleBlogCategory->meta_title;
         } else {
             $meta_title = $SimpleBlogCategory->name . ' - Blog';
         }
         if (!empty($SimpleBlogCategory->meta_description)) {
             $this->context->smarty->assign('meta_description', $SimpleBlogCategory->meta_description);
         }
         if (!empty($SimpleBlogCategory->meta_keywords)) {
             $this->context->smarty->assign('meta_keywords', $SimpleBlogCategory->meta_keywords);
         }
         if ($page > 1) {
             $meta_title .= ' (' . $page . ')';
         }
         $this->context->smarty->assign('meta_title', $meta_title);
         $posts = SimpleBlogPost::getPosts($id_lang, $this->posts_per_page, $SimpleBlogCategory->id, $page);
         $this->assignPagination($this->posts_per_page, sizeof(SimpleBlogPost::getPosts($id_lang, null, $SimpleBlogCategory->id)));
         $this->context->smarty->assign('blogCategory', $SimpleBlogCategory);
         $this->context->smarty->assign('posts', $posts);
         $this->context->smarty->assign('category_rewrite', $SimpleBlogCategory->link_rewrite);
         //$this->setTemplate('list-category.tpl');
     } elseif ($this->is_search) {
         $this->context->smarty->assign('is_search', true);
         // echo SimpleBlogPost::getSearchLink('author', 'kpodemski', $id_lang);
         // @todo: meta titles, blog title, specific layout
         switch ($this->simpleblog_search) {
             case 'author':
                 break;
             case 'tag':
                 break;
         }
         $this->context->smarty->assign('meta_title', $this->l('Posts by') . ' ' . $this->simpleblog_author . ' - Blog');
         $posts = SimpleBlogPost::findPosts($this->simpleblog_search, $this->simpleblog_keyword, $id_lang, $this->posts_per_page, $page);
         $this->assignPagination($this->posts_per_page, sizeof(SimpleBlogPost::findPosts($this->simpleblog_search, $this->simpleblog_keyword, $id_lang)));
         $this->context->smarty->assign('posts', $posts);
     } else {
         $posts = SimpleBlogPost::getPosts($id_lang, $this->posts_per_page, null, $page);
         $this->assignPagination($this->posts_per_page, sizeof(SimpleBlogPost::getPosts($id_lang)));
         // @todo: More flexible
         $meta_title = Configuration::get('PS_SHOP_NAME') . ' - Blog';
         if ($page > 1) {
             $meta_title .= ' (' . $page . ')';
         }
         $this->context->smarty->assign('meta_title', $meta_title);
         $this->context->smarty->assign('posts', $posts);
     }
     $this->setTemplate('list' . $mainTemplate . '.tpl');
 }