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


PHP IPSLib::knatsort方法代码示例

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


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

示例1: getForumList

 /**
  * Returns a list of all forums
  *
  * @return	array
  */
 public function getForumList()
 {
     /* Get the forums */
     $this->DB->build(array('select' => 'f.*', 'from' => array('forums' => 'f'), 'add_join' => array(array('select' => 'p.*', 'from' => array('permission_index' => 'p'), 'where' => "p.perm_type='forum' AND p.app='forums' AND p.perm_type_id=f.id", 'type' => 'left'), $this->registry->classItemMarking->getSqlJoin(array('item_app_key_1' => 'f.id')))));
     $q = $this->DB->execute();
     /* Loop through and build an array of forums */
     $forums_list = array();
     $update_seo = array();
     $tempForums = array();
     while ($f = $this->DB->fetch($q)) {
         $tempForums[$f['parent_id'] . '.' . $f['position'] . '.' . $f['id']] = $f;
     }
     /* Sort in PHP */
     $tempForums = IPSLib::knatsort($tempForums);
     foreach ($tempForums as $posData => $f) {
         $fr = array();
         /* Add back into topic markers */
         $f = $this->registry->classItemMarking->setFromSqlJoin($f, 'forums');
         /**
          * This is here in case the SEO name isn't stored for some reason.
          * We'll parse it and then update the forums table - should only happen once
          */
         if (!$f['name_seo']) {
             /* SEO name */
             $f['name_seo'] = IPSText::makeSeoTitle($f['name']);
             $update_seo[$f['id']] = $f['name_seo'];
         }
         /* Reformat the array for a category */
         if ($f['parent_id'] == -1) {
             $fr = $f;
             $fr['parent_id'] = 'root';
             $fr['hide_last_info'] = 0;
             $fr['can_view_others'] = 0;
         } else {
             $fr = $f;
             $fr['description'] = isset($f['description']) ? $f['description'] : '';
         }
         $fr = array_merge($fr, $this->registry->permissions->parse($f));
         /* Unpack bitwise fields */
         $_tmp = IPSBWOptions::thaw($fr['forums_bitoptions'], 'forums', 'forums');
         if (count($_tmp)) {
             foreach ($_tmp as $k => $v) {
                 /* Trigger notice if we have DB field */
                 if (isset($fr[$k])) {
                     trigger_error("Thawing bitwise options for FORUMS: Bitwise field '{$k}' has overwritten DB field '{$k}'", E_USER_WARNING);
                 }
                 $fr[$k] = $v;
             }
         }
         /* Add... */
         $forums_list[$fr['id']] = $fr;
     }
     $this->allForums = $forums_list;
     /**
      * Update forums table if SEO name wasn't cached yet
      */
     if (count($update_seo)) {
         foreach ($update_seo as $k => $v) {
             $this->DB->update('forums', array('name_seo' => $v), 'id=' . $k);
         }
     }
     return $forums_list;
 }
开发者ID:ConnorChristie,项目名称:GrabViews-Live,代码行数:68,代码来源:class_forums.php


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