/** * @return CategoryObject */ public function add($name, $parentCategoryMigratorId = null) { $obj = new CategoryObject($this->_container()); $obj->setName($name); if (!empty($parentCategoryMigratorId)) { $obj->setParentCategoryMigratorId($parentCategoryMigratorId); } return $obj; }
function displayForm($isMainTab = true) { $this->loadJS_CSS(); //echo $home = __PS_BASE_URI__ . substr($_SERVER['PHP_SELF'], strlen(__PS_BASE_URI__)); global $currentIndex; parent::displayForm(); $this->displayErrors(); $obj = $this->loadObject(true); $row = $obj->getPostById(); echo ' <form name="plfrm_a" action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . $this->token . '" method="post" enctype="multipart/form-data"> ' . ($obj->id ? '<input type="hidden" name="id_' . $this->table . '" value="' . $obj->id . '" />' : '') . ' <fieldset><legend>' . $this->l('Post') . '</legend>'; $obj_category = new CategoryObject(true); echo '<label>' . $this->l('Category') . ' </label> <div class="margin-form"> <select name="id_pl_blog_category"> <option value="1">Home </option>'; $categories = $obj_category->getCategories(); $obj_category->recurseCategory($categories, $categories[0][1], 1, $this->getFieldValue($obj, 'id_pl_blog_category')); echo ' </select> <a href="' . $currentIndex . '&addpl_blog_category&token=' . $this->token . '" title="new category"> <img border="0" src="../img/admin/add.gif"> New category </a> </div>'; // echo ($description = ' <a href="'.$currentIndex.'&addpl_blog_category&token='.$this->token.'">New Category</a>'); // post_status $this->displayStatus('Status', 'post_status', $row['post_status']); // post_title $this->displayRowMultiLang($this->l('Title'), 'post_title', 'text', $obj, null, null, null, true, '<>;=#{}', $url_rewrite = true); // post_description $this->displayRowMultiLang($this->l('Content'), 'post_description', 'textarea', $obj, null, 90, 10, true); // url friendly $this->displayRowMultiLang($this->l('Friendly URL'), 'link_rewrite', 'text', $obj, null, null, null, false, '<>;=#{}', $link_rewrite = false, $str2url = true); // post meta title //$this->displayRow($this->l('Meta title'), 'post_meta_title', 'text', htmlentities($row['post_meta_title']), null, null, null, false, '<>;=#{}'); $this->displayRowMultiLang($title = $this->l('Meta title'), $name = 'post_meta_title', $type = 'text', $obj, $note = null, $cols = null, $rows = null, $sub = false, $str_help_box = '<>;=#{}'); // post meta description //$this->displayRow($this->l('Meta description'), 'post_meta_description', 'text', htmlentities($row['post_meta_description']), null, null, null, false, '<>;=#{}'); $this->displayRowMultiLang($title = $this->l('Meta description'), $name = 'post_meta_description', $type = 'text', $obj, $note = null, $cols = null, $rows = null, $sub = false, $str_help_box = '<>;=#{}'); // post meta keywords //$this->displayRow($this->l('Meta keywords'), 'post_meta_keywords', 'text', htmlentities($row['post_meta_keywords']), null, null, null, false, '<>;=#{}'); $this->displayRowMultiLang($title = $this->l('Meta keywords'), $name = 'post_meta_keywords', $type = 'text', $obj, $note = null, $cols = null, $rows = null, $sub = false, $str_help_box = '<>;=#{}'); // tags name $this->displayRowMultiLangTag($title = $this->l('Tags'), $name = 'id_pl_blog_tags', $type = 'text', $obj, $note = "Tags separated by commas (e.g., dvd, dvd player, hifi)", $cols = null, $rows = null, $sub = false, $str_help_box = '<>;=#{}'); // post_allow_comment $this->displayStatus($this->l('Allow comments'), 'post_allow_comment', $row['post_allow_comment']); // category_date_create $this->displayDate('post_date_create', $row['post_date_create']); // buton submit echo ' <div class="margin-form"> <input type="submit" value="' . $this->l(' Save ') . '" name="submitAdd' . $this->table . '" class="button" /> </div> <div class="small">' . $this->l('') . '</div> '; echo '</fieldset> </form>'; }