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


PHP news::sortArticleList方法代码示例

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


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

示例1: DrawArticleList

 public static function DrawArticleList($mode = "htabs")
 {
     $stdout = "";
     self::initiateNewsClass();
     // -----------------------------------------------------------
     // -- Obtain existing code as initial data
     // -----------------------------------------------------------
     // --> $dataArticle[article_id] = article_record
     $dataArticle = $GLOBALS["newsClass"]->getArticle(NEWS_ANYUNPUBLISHED);
     // --> $dataArticleSorted[section_id] = array(int=>article_id)
     $dataArticleSorted = news::sortArticleList($dataArticle);
     // --> $sections[section_id] = section_label
     $sections = array();
     foreach ($GLOBALS["newsClass"]->getLookup("section") as $arr) {
         $sections[$arr["section_id"]] = $arr["section"];
     }
     // -----------------------------------------------------------
     if (empty($dataArticle)) {
         return functions::boxMessage("error", "There are currently no unpublished articles.", 1) . self::drawButtonYoufirstneedto("WRITE NEW ARTICLES", "edit_article/single");
     } else {
         $stdout .= "<p><span style='font-size:1.4em;font-weight:normal;padding-right:0.5em' " . "class='fake-contentheading red'>EITHER:</span> " . "<a href='" . str_replace("/index.php", "", $_SERVER["PHP_SELF"]) . "/single/index.php' " . "class='fakenewsbutton'" . ">WRITE NEW ARTICLES</a></p>\r\n" . PADDED_HR . "<h3 class='bottommargin'><span class='red'>OR:</span> EDIT ARTICLES THAT HAVE NOT YET BEEN PUBLISHED:</h3>\r\n" . "\r\n";
     }
     // -----------------------------------------------------------
     switch ($mode) {
         // -----------------------------------------------------------
         /* ACCORDION LIST -- didn't work very well
         
             $useaccordion = true;
             $brief = false;
         
             $stdout .= "<p>&nbsp;</p>\r\n";
         
             foreach ($dataArticleSorted as $section_id => $data) {
         
               $stdout .=
                 "<div class='newslist xcol left2of3'>\r\n" .
                 "  <h2>" . $sections[$section_id] . "</h2>\r\n" .
                 "  <div class='accordion'>\r\n" .
                 "\r\n";
         
               foreach ($data as $article_id) {
                 $stdout .=
                   //"    <legend>Article #" . $id . "</legend>\r\n" .
                   news::drawArticle($dataArticle[$article_id],$useaccordion,$brief) .
                   //"  </fieldset>\r\n" .
                   "";
               }
         
               $stdout .=
                 "  </div>\r\n" .
                 "</div>\r\n" .
                 "\r\n";
             }
         */
         // -----------------------------------------------------------
         case "htabs":
         case "vtabs":
             // -----------------------------------------------------------
             $useaccordion = false;
             $brief = true;
             $stdout .= "<div id='jtabs' class='" . ($mode == "htabs" ? "htabs" : "vtabs") . "'>\r\n" . "  <ul>\r\n";
             foreach ($dataArticleSorted as $section_id => $data) {
                 if (isset($sections[$section_id])) {
                     $stdout .= "    <li style='font-size:1.2em'><a href='" . $_SERVER["PHP_SELF"] . "#s" . $section_id . "'>" . $sections[$section_id] . "</a></li>\r\n";
                 }
             }
             $stdout .= (!empty($dataArticleSorted[NEWS_NOSECTION]) ? "    <li style='font-size:1.2em'><a href='" . $_SERVER["PHP_SELF"] . "#s0'>[Articles In No Section]</a></li>\r\n" : "") . "  </ul>\r\n" . "\r\n";
             foreach ($dataArticleSorted as $section_id => $data) {
                 $stdout .= "  <div id='s" . $section_id . "'>\r\n" . "\r\n";
                 //if ($mode=="vtabs") $stdout .= "    <h2>".$sections[$section_id]."</h2>\r\n\r\n";
                 $i = 0;
                 $count = ceil(count($data) / 2);
                 if ($mode == "htabs") {
                     $stdout .= "    <div class='col c1of2'>\r\n";
                 }
                 foreach ($data as $article_id) {
                     $stdout .= "      <fieldset style='border:1px solid #ccc'>\r\n" . "        <legend>Article #" . $article_id . " <span style='color:#ccc'>&mdash;</span> " . ($dataArticle[$article_id]["articlestatus_id"] ? " [<span class='green'>Ready to be published</span>]" : " [<span class='red'>Needs further editing</span>]") . "</legend>\r\n" . news::drawArticle($dataArticle[$article_id], $useaccordion, $brief) . "      <p style='text-align:right;margin-bottom:0'>" . "<a href='" . str_replace("/index.php", "", $_SERVER["PHP_SELF"]) . "/single/index.php?aid=" . $article_id . "' " . "class='fakenewsbutton'>EDIT THIS ARTICLE</a></p>\r\n" . "      </fieldset>\r\n" . "\r\n";
                     if ($mode == "htabs") {
                         $i++;
                         $stdout .= $i % 2 ? "    </div> <div class='col c2of2'>\r\n" : "    </div> <div class='col c1of2'>\r\n";
                     }
                 }
                 if ($mode == "htabs") {
                     $stdout .= "    </div><div style='clear:both'><br></div>\r\n";
                 }
                 $stdout .= "  </div>\r\n" . "\r\n";
             }
             $stdout .= "</div>\r\n" . "\r\n";
             break;
             // -----------------------------------------------------------
         // -----------------------------------------------------------
         case "full":
             // -----------------------------------------------------------
             $useaccordion = false;
             $brief = false;
             $stdout .= "<p>&nbsp;</p>\r\n";
             foreach ($dataArticle as $id => $data) {
                 $stdout .= "<div class='newslist col left2of3'>\r\n" . "  <fieldset style='width:105%;border:1px solid #ccc'>\r\n" . "    <legend>Article #" . $id . "</legend>\r\n" . news::drawArticle($data, $useaccordion, $brief) . "  </fieldset>\r\n" . "</div> <div class='col-content-right1third'>\r\n" . "\r\n";
                 $stdout .= "<p><a href='" . str_replace("/index.php", "", $_SERVER["PHP_SELF"]) . "/single/index.php?aid=" . $id . "' " . "class='fakenewsbutton'>EDIT THIS ARTICLE</a></p>\r\n";
                 if (isset($data["section"])) {
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


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