コード例 #1
0
ファイル: SimpleBlogPost.php プロジェクト: evgrishin/se1614
 public function __construct($id_simpleblog_post = null, $id_lang = null, $id_shop = null)
 {
     parent::__construct($id_simpleblog_post, $id_lang, $id_shop);
     $category = new SimpleBlogCategory($this->id_simpleblog_category, $id_lang);
     $this->category = $category->name;
     $this->category_rewrite = $category->link_rewrite;
     $this->url = self::getLink($this->link_rewrite, $this->category_rewrite, $id_lang);
     $this->category_url = SimpleBlogCategory::getLink($category->link_rewrite, $id_lang);
     if ($category->id_parent > 0) {
         $parent = new SimpleBlogCategory($category->id_parent, $id_lang);
         $this->parent_category = $parent;
     }
     if (file_exists(_PS_MODULE_DIR_ . 'ph_simpleblog/covers/' . $this->id_simpleblog_post . '.' . $this->cover)) {
         $this->banner = _MODULE_DIR_ . 'ph_simpleblog/covers/' . $this->id_simpleblog_post . '.' . $this->cover;
         $this->banner_thumb = _MODULE_DIR_ . 'ph_simpleblog/covers/' . $this->id_simpleblog_post . '-thumb.' . $this->cover;
         $this->banner_wide = _MODULE_DIR_ . 'ph_simpleblog/covers/' . $this->id_simpleblog_post . '-wide.' . $this->cover;
     }
     if (file_exists(_PS_MODULE_DIR_ . 'ph_simpleblog/featured/' . $this->id_simpleblog_post . '.' . $this->featured)) {
         $this->featured_image = _MODULE_DIR_ . 'ph_simpleblog/featured/' . $this->id_simpleblog_post . '.' . $this->featured;
     }
     if ($this->id) {
         $tags = SimpleBlogTag::getPostTags((int) $this->id);
         $this->tags = $tags;
         if (isset($tags) && isset($tags[$id_lang])) {
             $this->tags_list = $tags[$id_lang];
         }
         $this->comments = SimpleBlogComment::getCommentsCount((int) $this->id);
         $this->post_type = SimpleBlogPostType::getSlugById((int) $this->id_simpleblog_post_type);
         if ($this->post_type == 'gallery') {
             $this->gallery = SimpleBlogPostImage::getAllById((int) $this->id);
         }
     }
 }