当前位置: 首页>>代码示例>>PHP>>正文


PHP steam_factory::get_attributes方法代码示例

本文整理汇总了PHP中steam_factory::get_attributes方法的典型用法代码示例。如果您正苦于以下问题:PHP steam_factory::get_attributes方法的具体用法?PHP steam_factory::get_attributes怎么用?PHP steam_factory::get_attributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在steam_factory的用法示例。


在下文中一共展示了steam_factory::get_attributes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: print_entries

 public function print_entries($date_objects = array(), $show_dates = TRUE)
 {
     $t = Weblog::getInstance()->loadTemplate("weblog_entries.template.html");
     //$t = new HTML_TEMPLATE_IT();
     //$t->loadTemplateFile( PATH_EXTENSIONS . "weblog/ui/html/weblog_entries.template.html" );
     $user = lms_steam::get_current_user();
     if (count($date_objects) == 0) {
         $date_objects = $this->get_date_objects();
         usort($date_objects, "sort_dates_ascending");
     }
     if (count($date_objects) == 0) {
         $t->setVariable("LABEL_NO_ENTRY_FOUND", "<h3>" . gettext("No posts yet.") . "</h3>");
         $this->set_main_html($t->get());
         return NULL;
     }
     $ld = 0;
     // TODO FIX IT !!!
     $data_tnr = array();
     foreach ($date_objects as $date_object) {
         $data_tnr[$date_object->get_id()] = array();
         $data_tnr[$date_object->get_id()]["comments"] = $date_object->get_annotations(FALSE, TRUE);
         $data_tnr[$date_object->get_id()]["creator"] = $date_object->get_creator(TRUE);
         $data_tnr[$date_object->get_id()]["is_writer"] = $date_object->check_access_write($user, TRUE);
         $data_tnr[$date_object->get_id()]["attributes"] = $date_object->get_attributes(array("DATE_TITLE", "DATE_DESCRIPTION", "DATE_START_DATE", "DATE_CATEGORY", "DATE_PODCAST", "OBJ_KEYWORDS"), TRUE);
     }
     $data_result = $GLOBALS["STEAM"]->buffer_flush();
     $creator = FALSE;
     $category = FALSE;
     $creators = array();
     $categories = array();
     foreach ($date_objects as $date_object) {
         $creator = $data_result[$data_tnr[$date_object->get_id()]["creator"]];
         $creators[$creator->get_id()] = $creator;
         $category = $data_result[$data_tnr[$date_object->get_id()]["attributes"]]["DATE_CATEGORY"];
         if (is_object($category)) {
             $categories[$category->get_id()] = $category;
         }
     }
     $creator_data = steam_factory::get_attributes($GLOBALS["STEAM"]->get_id(), array_values($creators), array(OBJ_NAME, USER_FIRSTNAME, USER_FULLNAME));
     $category_data = steam_factory::get_attributes($GLOBALS["STEAM"]->get_id(), array_values($categories), array(OBJ_NAME));
     foreach ($date_objects as $date_object) {
         $t->setCurrentBlock("BLOCK_ARTICLE");
         $entry = $data_result[$data_tnr[$date_object->get_id()]["attributes"]];
         $comments = $data_result[$data_tnr[$date_object->get_id()]["comments"]];
         $cd = strftime("%G%m%d", $entry["DATE_START_DATE"]);
         if (($cd != $ld || $ld == 0) && $show_dates) {
             $t->setCurrentBlock("BLOCK_DATE");
             $t->setVariable("VALUE_DATE", strftime("%d. %B %G", $entry["DATE_START_DATE"]));
             $t->parse("BLOCK_DATE");
         }
         $t->setVariable("VALUE_ARTICLE_SUBJECT", h($entry["DATE_TITLE"]));
         $t->setVariable("VALUE_ARTICLE_TEXT", get_formatted_output($entry["DATE_DESCRIPTION"]));
         $creator = $data_result[$data_tnr[$date_object->get_id()]["creator"]];
         $t->setVariable("VALUE_POSTED_BY", str_replace("%NAME", "<a href=\"" . PATH_URL . "user/" . $creator_data[$creator->get_id()][OBJ_NAME] . "/\">" . h($creator_data[$creator->get_id()][USER_FIRSTNAME]) . " " . h($creator_data[$creator->get_id()][USER_FULLNAME]) . "</a>", gettext("Posted by %NAME")));
         if ($show_dates) {
             $date_or_time = strftime("%R", $entry["DATE_START_DATE"]);
         } else {
             $date_or_time = strftime("%x %R", $entry["DATE_START_DATE"]);
         }
         $t->setVariable("VALUE_DATE_TIME", $date_or_time);
         $t->setVariable('POST_ID', $date_object->get_id());
         $t->setVariable('POST_PERMALINK', PATH_URL . 'weblog/' . $this->steam_weblog->get_id() . '/#comment' . $date_object->get_id());
         $t->setVariable("POST_PERMALINK_LABEL", gettext("permalink"));
         if ($data_result[$data_tnr[$date_object->get_id()]["is_writer"]]) {
             $t->setCurrentBlock("BLOCK_OWN_POST");
             $t->setVariable("POST_LINK_DELETE", PATH_URL . "weblog/entrydelete/" . $date_object->get_id() . "/");
             $t->setVariable("POST_LABEL_DELETE", gettext("delete"));
             $t->setVariable("POST_LINK_EDIT", PATH_URL . "weblog/entryedit/" . $date_object->get_id() . "/");
             $t->setVariable("POST_LABEL_EDIT", gettext("edit"));
             $t->parse("BLOCK_OWN_POST");
         }
         $category = $entry["DATE_CATEGORY"];
         if (is_object($category)) {
             $t->setVariable("LABEL_IN", gettext("in"));
             $t->setVariable("VALUE_CATEGORY", "<a href=\"" . PATH_URL . "weblog/" . $category->get_id() . "/\">" . h($category_data[$category->get_id()][OBJ_NAME]) . "</a>");
         } else {
             $t->setVariable("VALUE_CATEGORY", gettext("no category"));
         }
         $t->setVariable("LINK_COMMENTS", PATH_URL . "weblog/comments/" . $date_object->get_id() . "/");
         $t->setVariable("LABEL_COMMENTS", count($comments) . " " . (count($comments) == 1 ? gettext("comment") : gettext("comments")));
         $t->parse("BLOCK_ARTICLE");
         $ld = $cd;
     }
     $this->set_main_html($t->get());
 }
开发者ID:rolwi,项目名称:koala,代码行数:85,代码来源:lms_weblog.class.php


注:本文中的steam_factory::get_attributes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。