コード例 #1
0
 public function get_array_tpl_vars()
 {
     $category = $this->get_category();
     $contents = FormatingHelper::second_parse($this->contents);
     $description = $this->get_real_short_contents();
     $user = $this->get_author_user();
     $user_group_color = User::get_group_color($user->get_groups(), $user->get_level(), true);
     $number_comments = CommentsService::get_number_comments('download', $this->id);
     return array('C_VISIBLE' => $this->is_visible(), 'C_EDIT' => $this->is_authorized_to_edit(), 'C_DELETE' => $this->is_authorized_to_delete(), 'C_READ_MORE' => !$this->is_short_contents_enabled() && $description != $contents && strlen($description) >= DownloadConfig::NUMBER_CARACTERS_BEFORE_CUT, 'C_SIZE' => !empty($this->size), 'C_PICTURE' => $this->has_picture(), 'C_CUSTOM_AUTHOR_DISPLAY_NAME' => $this->is_author_display_name_enabled(), 'C_USER_GROUP_COLOR' => !empty($user_group_color), 'C_UPDATED_DATE' => $this->has_updated_date(), 'ID' => $this->id, 'NAME' => $this->name, 'SIZE' => $this->formated_size, 'CONTENTS' => $contents, 'DESCRIPTION' => $description, 'DATE' => $this->creation_date->format(Date::FORMAT_DAY_MONTH_YEAR), 'DATE_DAY' => $this->creation_date->get_day(), 'DATE_MONTH' => $this->creation_date->get_month(), 'DATE_YEAR' => $this->creation_date->get_year(), 'DATE_DAY_MONTH' => $this->creation_date->format(Date::FORMAT_DAY_MONTH), 'DATE_ISO8601' => $this->creation_date->format(Date::FORMAT_ISO8601), 'UPDATED_DATE' => $this->updated_date !== null ? $this->updated_date->format(Date::FORMAT_DAY_MONTH_YEAR) : '', 'UPDATED_DATE_ISO8601' => $this->updated_date !== null ? $this->updated_date->format(Date::FORMAT_ISO8601) : '', 'STATUS' => $this->get_status(), 'CUSTOM_AUTHOR_DISPLAY_NAME' => $this->author_display_name, 'C_AUTHOR_EXIST' => $user->get_id() !== User::VISITOR_LEVEL, 'PSEUDO' => $user->get_display_name(), 'USER_LEVEL_CLASS' => UserService::get_level_class($user->get_level()), 'USER_GROUP_COLOR' => $user_group_color, 'NUMBER_DOWNLOADS' => $this->number_downloads, 'L_DOWNLOADED_TIMES' => StringVars::replace_vars(LangLoader::get_message('downloaded_times', 'common', 'download'), array('number_downloads' => $this->number_downloads)), 'STATIC_NOTATION' => NotationService::display_static_image($this->get_notation()), 'NOTATION' => NotationService::display_active_image($this->get_notation()), 'C_COMMENTS' => !empty($number_comments), 'L_COMMENTS' => CommentsService::get_lang_comments('download', $this->id), 'NUMBER_COMMENTS' => CommentsService::get_number_comments('download', $this->id), 'C_ROOT_CATEGORY' => $category->get_id() == Category::ROOT_CATEGORY, 'CATEGORY_ID' => $category->get_id(), 'CATEGORY_NAME' => $category->get_name(), 'CATEGORY_DESCRIPTION' => $category->get_description(), 'CATEGORY_IMAGE' => $category->get_image()->rel(), 'U_EDIT_CATEGORY' => $category->get_id() == Category::ROOT_CATEGORY ? DownloadUrlBuilder::configuration()->rel() : DownloadUrlBuilder::edit_category($category->get_id())->rel(), 'U_SYNDICATION' => SyndicationUrlBuilder::rss('download', $this->id_category)->rel(), 'U_AUTHOR_PROFILE' => UserUrlBuilder::profile($this->get_author_user()->get_id())->rel(), 'U_LINK' => DownloadUrlBuilder::display($category->get_id(), $category->get_rewrited_name(), $this->id, $this->rewrited_name)->rel(), 'U_DOWNLOAD' => DownloadUrlBuilder::download($this->id)->rel(), 'U_DEADLINK' => DownloadUrlBuilder::dead_link($this->id)->rel(), 'U_CATEGORY' => DownloadUrlBuilder::display_category($category->get_id(), $category->get_rewrited_name())->rel(), 'U_EDIT' => DownloadUrlBuilder::edit($this->id)->rel(), 'U_DELETE' => DownloadUrlBuilder::delete($this->id)->rel(), 'U_PICTURE' => $this->get_picture()->rel(), 'U_COMMENTS' => DownloadUrlBuilder::display_comments($category->get_id(), $category->get_rewrited_name(), $this->id, $this->rewrited_name)->rel());
 }
コード例 #2
0
ファイル: News.class.php プロジェクト: AroundPBT/PHPBoost
 public function get_array_tpl_vars()
 {
     $news_config = NewsConfig::load();
     $category = $this->get_category();
     $contents = FormatingHelper::second_parse($this->contents);
     $description = $this->get_real_short_contents();
     $user = $this->get_author_user();
     $user_group_color = User::get_group_color($user->get_groups(), $user->get_level(), true);
     $number_comments = CommentsService::get_number_comments('news', $this->id);
     $sources = $this->get_sources();
     $nbr_sources = count($sources);
     return array('C_VISIBLE' => $this->is_visible(), 'C_EDIT' => $this->is_authorized_to_edit(), 'C_DELETE' => $this->is_authorized_to_delete(), 'C_PICTURE' => $this->has_picture(), 'C_USER_GROUP_COLOR' => !empty($user_group_color), 'C_AUTHOR_DISPLAYED' => $news_config->get_author_displayed(), 'C_READ_MORE' => !$this->get_short_contents_enabled() && $description != $contents && strlen($description) >= $news_config->get_number_character_to_cut(), 'C_SOURCES' => $nbr_sources > 0, 'ID' => $this->id, 'NAME' => $this->name, 'CONTENTS' => $contents, 'DESCRIPTION' => $description, 'DATE' => $this->creation_date->format(Date::FORMAT_DAY_MONTH_YEAR_HOUR_MINUTE_TEXT), 'DATE_DAY' => $this->creation_date->get_day(), 'DATE_MONTH' => $this->creation_date->get_month(), 'DATE_YEAR' => $this->creation_date->get_year(), 'DATE_ISO8601' => $this->creation_date->format(Date::FORMAT_ISO8601), 'DATE_DAY' => $this->creation_date->get_day(), 'DATE_MONTH' => $this->creation_date->get_month(), 'DATE_YEAR' => $this->creation_date->get_year(), 'STATUS' => $this->get_status(), 'C_AUTHOR_EXIST' => $user->get_id() !== User::VISITOR_LEVEL, 'PSEUDO' => $user->get_display_name(), 'USER_LEVEL_CLASS' => UserService::get_level_class($user->get_level()), 'USER_GROUP_COLOR' => $user_group_color, 'C_COMMENTS' => !empty($number_comments), 'L_COMMENTS' => CommentsService::get_lang_comments('news', $this->id), 'NUMBER_COMMENTS' => CommentsService::get_number_comments('news', $this->id), 'C_ROOT_CATEGORY' => $category->get_id() == Category::ROOT_CATEGORY, 'CATEGORY_ID' => $category->get_id(), 'CATEGORY_NAME' => $category->get_name(), 'CATEGORY_DESCRIPTION' => $category->get_description(), 'CATEGORY_IMAGE' => $category->get_image()->rel(), 'U_EDIT_CATEGORY' => $category->get_id() == Category::ROOT_CATEGORY ? NewsUrlBuilder::configuration()->rel() : NewsUrlBuilder::edit_category($category->get_id())->rel(), 'U_SYNDICATION' => SyndicationUrlBuilder::rss('news', $this->id_cat)->rel(), 'U_AUTHOR_PROFILE' => UserUrlBuilder::profile($this->get_author_user()->get_id())->rel(), 'U_LINK' => NewsUrlBuilder::display_news($category->get_id(), $category->get_rewrited_name(), $this->id, $this->rewrited_name)->rel(), 'U_CATEGORY' => NewsUrlBuilder::display_category($category->get_id(), $category->get_rewrited_name())->rel(), 'U_EDIT' => NewsUrlBuilder::edit_news($this->id)->rel(), 'U_DELETE' => NewsUrlBuilder::delete_news($this->id)->rel(), 'U_PICTURE' => $this->get_picture()->rel(), 'U_COMMENTS' => NewsUrlBuilder::display_comments_news($category->get_id(), $category->get_rewrited_name(), $this->id, $this->rewrited_name)->rel());
 }