public function renderForm() { $img_desc = ''; $img_desc .= $this->l('Upload a Avatar from your computer.<br/>N.B : Only jpg image is allowed'); if (Tools::getvalue('id_smart_blog_category') != '' && Tools::getvalue('id_smart_blog_category') != NULL) { $img_desc .= '<br/><img style="height:auto;width:300px;clear:both;border:1px solid black;" alt="" src="' . __PS_BASE_URI__ . 'modules/smartblog/images/category/' . Tools::getvalue('id_smart_blog_category') . '.jpg" /><br />'; } $this->fields_form = array('legend' => array('title' => $this->l('Blog Category')), 'input' => array(array('type' => 'text', 'label' => $this->l('Meta Title'), 'name' => 'meta_title', 'size' => 60, 'required' => true, 'desc' => $this->l('Enter Your Category Name'), 'lang' => true), array('type' => 'textarea', 'label' => $this->l('Description'), 'name' => 'description', 'lang' => true, 'rows' => 10, 'cols' => 62, 'class' => 'rte', 'autoload_rte' => true, 'required' => false, 'desc' => $this->l('Enter Your Category Description')), array('type' => 'file', 'label' => $this->l('Category Image:'), 'name' => 'category_image', 'display_image' => false, 'desc' => $img_desc), array('type' => 'text', 'label' => $this->l('Meta Keyword'), 'name' => 'meta_keyword', 'lang' => true, 'size' => 60, 'required' => false, 'desc' => $this->l('Enter Your Category Meta Keyword. Separated by comma(,)')), array('type' => 'textarea', 'label' => $this->l('Meta Description'), 'name' => 'meta_description', 'rows' => 10, 'cols' => 62, 'lang' => true, 'required' => false, 'desc' => $this->l('Enter Your Category Meta Description')), array('type' => 'text', 'label' => $this->l('Link Rewrite'), 'name' => 'link_rewrite', 'size' => 60, 'lang' => true, 'required' => true, 'desc' => $this->l('Enetr Your Category Slug. Use In SEO Friendly URL')), array('type' => 'select', 'label' => $this->l('Parent Category'), 'name' => 'id_parent', 'options' => array('query' => BlogCategory::getCategory(), 'id' => 'id_smart_blog_category', 'name' => 'meta_title'), 'desc' => $this->l('Select Your Parent Category')), array('type' => 'radio', 'label' => $this->l('Status'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active', 'value' => 0, 'label' => $this->l('Disabled'))))), 'submit' => array('title' => $this->l('Save'), 'class' => 'button')); if (Shop::isFeatureActive()) { $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso'); } if (!($BlogCategory = $this->loadObject(true))) { return; } $this->fields_form['submit'] = array('title' => $this->l('Save '), 'class' => 'button'); return parent::renderForm(); }
public function hookLeftColumn($params) { if (Module::isInstalled('smartblog') != 1) { $this->smarty->assign(array('smartmodname' => $this->name)); return $this->display(__FILE__, 'views/templates/front/install_required.tpl'); } else { if (!$this->isCached('smartblogcategories.tpl', $this->getCacheId())) { $view_data = array(); $id_lang = $this->context->language->id; $BlogCategory = new BlogCategory(); $categories = $BlogCategory->getCategory(1, $id_lang); $i = 0; foreach ($categories as $category) { $categories[$i]['count'] = $BlogCategory->getPostByCategory($category['id_smart_blog_category']); $i++; } $this->smarty->assign(array('categories' => $categories)); } return $this->display(__FILE__, 'views/templates/front/smartblogcategories.tpl', $this->getCacheId()); } }
public function smartblogcategoriesHookLeftColumn($params) { if (!$this->isCached('plugins/smartblogcategories.tpl')) { $view_data = array(); $id_lang = $this->context->language->id; $BlogCategory = new BlogCategory(); $categories = $BlogCategory->getCategory(1, $id_lang); $i = 0; foreach ($categories as $category) { $categories[$i]['count'] = $BlogCategory->getPostByCategory($category['id_smart_blog_category']); $i++; } $protocol_link = Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://'; $protocol_content = (isset($useSSL) and $useSSL and Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://'; $smartbloglink = new SmartBlogLink($protocol_link, $protocol_content); $this->smarty->assign(array('smartbloglink' => $smartbloglink, 'categories' => $categories)); } return $this->display(__FILE__, 'views/templates/front/plugins/smartblogcategories.tpl'); }
public function renderForm() { $img_desc = ''; $img_desc .= $this->l('Upload a Feature Image from your computer.<br/>N.B : Only jpg image is allowed'); if (Tools::getvalue('id_smart_blog_post') != '' && Tools::getvalue('id_smart_blog_post') != NULL) { $img_desc .= '<br/><img style="height:auto;width:300px;clear:both;border:1px solid black;" alt="" src="' . __PS_BASE_URI__ . 'modules/smartblog/images/' . Tools::getvalue('id_smart_blog_post') . '.jpg" /><br />'; } if (!($obj = $this->loadObject(true))) { return; } $image = _MODULE_SMARTBLOG_DIR_ . $obj->id . '.jpg'; $image_url = ImageManager::thumbnail($image, $this->table . '_' . Tools::getvalue('id_smart_blog_post') . '.jpg', 200, 'jpg', true, true); $image_size = file_exists($image) ? filesize($image) / 1000 : false; $this->fields_form = array('legend' => array('title' => $this->l('Blog Post')), 'input' => array(array('type' => 'hidden', 'name' => 'post_type', 'default_value' => 0), array('type' => 'text', 'label' => $this->l('Blog Title'), 'name' => 'meta_title', 'id' => 'name', 'class' => 'copyMeta2friendlyURL', 'size' => 60, 'required' => true, 'desc' => $this->l('Enter Your Blog Post Title'), 'lang' => true), array('type' => 'textarea', 'label' => $this->l('Description'), 'name' => 'content', 'lang' => true, 'rows' => 10, 'cols' => 62, 'class' => 'rte', 'autoload_rte' => true, 'required' => true, 'hint' => array($this->l('Enter Your Post Description'), $this->l('Invalid characters:') . ' <>;=#{}')), array('type' => 'file', 'label' => $this->l('Feature Image:'), 'name' => 'image', 'display_image' => true, 'image' => $image_url ? $image_url : false, 'size' => $image_size, 'delete_url' => self::$currentIndex . '&' . $this->identifier . '=' . Tools::getvalue('id_smart_blog_post') . '&token=' . $this->token . '&deleteImage=1', 'hint' => $this->l('Upload a feature image from your computer.')), array('type' => 'select', 'label' => $this->l('Blog Category'), 'name' => 'id_category', 'options' => array('query' => BlogCategory::getCategory(), 'id' => 'id_smart_blog_category', 'name' => 'meta_title'), 'desc' => $this->l('Select Your Parent Category')), array('type' => 'tags', 'label' => $this->l('Meta keywords'), 'name' => 'meta_keywords', 'lang' => true, 'hint' => array($this->l('To add "tags" click in the field, write something, and then press "Enter."'), $this->l('Invalid characters:') . ' <>;=#{}')), array('type' => 'textarea', 'label' => $this->l('Short Description'), 'name' => 'short_description', 'rows' => 10, 'cols' => 62, 'lang' => true, 'required' => true, 'hint' => array($this->l('Enter Your Post Short Description'))), array('type' => 'textarea', 'label' => $this->l('Meta Description'), 'name' => 'meta_description', 'rows' => 10, 'cols' => 62, 'lang' => true, 'required' => false, 'desc' => $this->l('Enter Your Post Meta Description')), array('type' => 'text', 'label' => $this->l('Link Rewrite'), 'name' => 'link_rewrite', 'size' => 60, 'lang' => true, 'required' => false, 'hint' => $this->l('Only letters and the hyphen (-) character are allowed.')), array('type' => 'tags', 'label' => $this->l('Tag'), 'name' => 'tags', 'size' => 60, 'lang' => true, 'required' => false, 'hint' => array($this->l('To add "tags" click in the field, write something, and then press "Enter."'), $this->l('Invalid characters:') . ' <>;=#{}')), array('type' => 'radio', 'label' => $this->l('Comment Status'), 'name' => 'comment_status', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active', 'value' => 0, 'label' => $this->l('Disabled'))), 'desc' => $this->l('You Can Enable or Disable Your Comments')), array('type' => 'radio', 'label' => $this->l('Status'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'radio', 'label' => $this->l('Is Featured?'), 'name' => 'is_featured', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'is_featured', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'is_featured', 'value' => 0, 'label' => $this->l('Disabled'))))), 'submit' => array('title' => $this->l('Save'), 'class' => 'button')); if (Shop::isFeatureActive()) { $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso'); } if (!($SmartBlogPost = $this->loadObject(true))) { return; } $this->fields_form['submit'] = array('title' => $this->l('Save '), 'class' => 'button'); $image = ImageManager::thumbnail(_MODULE_SMARTBLOG_DIR_ . $SmartBlogPost->id_smart_blog_post . '.jpg', $this->table . '_' . (int) $SmartBlogPost->id_smart_blog_post . '.' . $this->imageType, 350, $this->imageType, true); $this->fields_value = array('image' => $image ? $image : false, 'size' => $image ? filesize(_MODULE_SMARTBLOG_DIR_ . $SmartBlogPost->id_smart_blog_post . '.jpg') / 1000 : false); if (Tools::getvalue('id_smart_blog_post') != '' && Tools::getvalue('id_smart_blog_post') != NULL) { foreach (Language::getLanguages(false) as $lang) { $this->fields_value['tags'][(int) $lang['id_lang']] = SmartBlogPost::getProductTagsBylang((int) Tools::getvalue('id_smart_blog_post'), (int) $lang['id_lang']); } } $this->tpl_form_vars['PS_ALLOW_ACCENTED_CHARS_URL'] = (int) Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL'); return parent::renderForm(); }
public function renderForm() { $img_desc = ''; $img_desc .= $this->l('Upload a Feature Image from your computer.<br/>N.B : Only jpg image is allowed'); if (Tools::getvalue('id_smart_blog_post') != '' && Tools::getvalue('id_smart_blog_post') != NULL) { $img_desc .= '<br/><img style="height:auto;width:300px;clear:both;border:1px solid black;" alt="" src="' . __PS_BASE_URI__ . 'modules/smartblog/images/' . Tools::getvalue('id_smart_blog_post') . '.jpg" /><br />'; } $this->fields_form = array('legend' => array('title' => $this->l('Blog Post')), 'input' => array(array('type' => 'hidden', 'name' => 'post_type', 'default_value' => 0), array('type' => 'text', 'label' => $this->l('Blog Title'), 'name' => 'meta_title', 'size' => 60, 'required' => true, 'desc' => $this->l('Enter Your Blog Post Title'), 'lang' => true), array('type' => 'textarea', 'label' => $this->l('Description'), 'name' => 'content', 'lang' => true, 'rows' => 10, 'cols' => 62, 'class' => 'rte', 'autoload_rte' => true, 'required' => true, 'desc' => $this->l('Enter Your Post Description')), array('type' => 'file', 'label' => $this->l('Feature Image:'), 'name' => 'image', 'display_image' => false, 'desc' => $img_desc), array('type' => 'select', 'label' => $this->l('Blog Category'), 'name' => 'id_category', 'options' => array('query' => BlogCategory::getCategory(), 'id' => 'id_smart_blog_category', 'name' => 'meta_title'), 'desc' => $this->l('Select Your Parent Category')), array('type' => 'text', 'label' => $this->l('Meta Keyword'), 'name' => 'meta_keyword', 'lang' => true, 'size' => 60, 'required' => false, 'desc' => $this->l('Enter Your Post Meta Keyword. Separated by comma(,)')), array('type' => 'textarea', 'label' => $this->l('Short Description'), 'name' => 'short_description', 'rows' => 10, 'cols' => 62, 'lang' => true, 'required' => true, 'desc' => $this->l('Enter Your Post Short Description')), array('type' => 'textarea', 'label' => $this->l('Meta Description'), 'name' => 'meta_description', 'rows' => 10, 'cols' => 62, 'lang' => true, 'required' => false, 'desc' => $this->l('Enter Your Post Meta Description')), array('type' => 'text', 'label' => $this->l('Link Rewrite'), 'name' => 'link_rewrite', 'size' => 60, 'lang' => true, 'required' => false, 'desc' => $this->l('Enetr Your Post Slug. Use In SEO Friendly URL')), array('type' => 'text', 'label' => $this->l('Tag'), 'name' => 'tags', 'size' => 60, 'lang' => true, 'required' => false, 'desc' => $this->l('Enter Your Post Meta Tag. Separated by comma(,)')), array('type' => 'radio', 'label' => $this->l('Comment Status'), 'name' => 'comment_status', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active', 'value' => 0, 'label' => $this->l('Disabled'))), 'desc' => $this->l('You Can Enable or Disable Your Comments')), array('type' => 'radio', 'label' => $this->l('Status'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'radio', 'label' => $this->l('Is Featured?'), 'name' => 'is_featured', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'is_featured', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'is_featured', 'value' => 0, 'label' => $this->l('Disabled'))))), 'submit' => array('title' => $this->l('Save'), 'class' => 'button')); if (Shop::isFeatureActive()) { $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso'); } if (!($SmartBlogPost = $this->loadObject(true))) { return; } $this->fields_form['submit'] = array('title' => $this->l('Save '), 'class' => 'button'); $image = ImageManager::thumbnail(_MODULE_SMARTBLOG_DIR_ . $SmartBlogPost->id_smart_blog_post . '.jpg', $this->table . '_' . (int) $SmartBlogPost->id_smart_blog_post . '.' . $this->imageType, 350, $this->imageType, true); $this->fields_value = array('image' => $image ? $image : false, 'size' => $image ? filesize(_MODULE_SMARTBLOG_DIR_ . $SmartBlogPost->id_smart_blog_post . '.jpg') / 1000 : false); if (Tools::getvalue('id_smart_blog_post') != '' && Tools::getvalue('id_smart_blog_post') != NULL) { foreach (Language::getLanguages(false) as $lang) { $this->fields_value['tags'][(int) $lang['id_lang']] = SmartBlogPost::getProductTagsBylang((int) Tools::getvalue('id_smart_blog_post'), (int) $lang['id_lang']); } } return parent::renderForm(); }