當前位置: 首頁>>代碼示例>>PHP>>正文


PHP grade_category::_fetch_course_tree_recursion方法代碼示例

本文整理匯總了PHP中grade_category::_fetch_course_tree_recursion方法的典型用法代碼示例。如果您正苦於以下問題:PHP grade_category::_fetch_course_tree_recursion方法的具體用法?PHP grade_category::_fetch_course_tree_recursion怎麽用?PHP grade_category::_fetch_course_tree_recursion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在grade_category的用法示例。


在下文中一共展示了grade_category::_fetch_course_tree_recursion方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _fetch_course_tree_recursion

 function _fetch_course_tree_recursion($category_array, &$sortorder)
 {
     // update the sortorder in db if needed
     if ($category_array['object']->sortorder != $sortorder) {
         $category_array['object']->set_sortorder($sortorder);
     }
     // store the grade_item or grade_category instance with extra info
     $result = array('object' => $category_array['object'], 'type' => $category_array['type'], 'depth' => $category_array['depth']);
     // reuse final grades if there
     if (array_key_exists('finalgrades', $category_array)) {
         $result['finalgrades'] = $category_array['finalgrades'];
     }
     // recursively resort children
     if (!empty($category_array['children'])) {
         $result['children'] = array();
         //process the category item first
         $cat_item_id = null;
         foreach ($category_array['children'] as $oldorder => $child_array) {
             if ($child_array['type'] == 'courseitem' or $child_array['type'] == 'categoryitem') {
                 $result['children'][$sortorder] = grade_category::_fetch_course_tree_recursion($child_array, $sortorder);
             }
         }
         foreach ($category_array['children'] as $oldorder => $child_array) {
             if ($child_array['type'] != 'courseitem' and $child_array['type'] != 'categoryitem') {
                 $result['children'][++$sortorder] = grade_category::_fetch_course_tree_recursion($child_array, $sortorder);
             }
         }
     }
     return $result;
 }
開發者ID:r007,項目名稱:PMoodle,代碼行數:30,代碼來源:grade_category.php

示例2: _fetch_course_tree_recursion

 /**
  * An internal function that recursively sorts grade categories within a course
  *
  * @param array $category_array The seed of the recursion
  * @param int   $sortorder The current sortorder
  * @return array An array containing 'object', 'type', 'depth' and optionally 'children'
  */
 private static function _fetch_course_tree_recursion($category_array, &$sortorder)
 {
     // update the sortorder in db if needed
     //NOTE: This leads to us resetting sort orders every time the categories and items page is viewed :(
     //if ($category_array['object']->sortorder != $sortorder) {
     //$category_array['object']->set_sortorder($sortorder);
     //}
     if (isset($category_array['object']->gradetype) && $category_array['object']->gradetype == GRADE_TYPE_NONE) {
         return null;
     }
     // store the grade_item or grade_category instance with extra info
     $result = array('object' => $category_array['object'], 'type' => $category_array['type'], 'depth' => $category_array['depth']);
     // reuse final grades if there
     if (array_key_exists('finalgrades', $category_array)) {
         $result['finalgrades'] = $category_array['finalgrades'];
     }
     // recursively resort children
     if (!empty($category_array['children'])) {
         $result['children'] = array();
         //process the category item first
         $child = null;
         foreach ($category_array['children'] as $oldorder => $child_array) {
             if ($child_array['type'] == 'courseitem' or $child_array['type'] == 'categoryitem') {
                 $child = grade_category::_fetch_course_tree_recursion($child_array, $sortorder);
                 if (!empty($child)) {
                     $result['children'][$sortorder] = $child;
                 }
             }
         }
         foreach ($category_array['children'] as $oldorder => $child_array) {
             if ($child_array['type'] != 'courseitem' and $child_array['type'] != 'categoryitem') {
                 $child = grade_category::_fetch_course_tree_recursion($child_array, $sortorder);
                 if (!empty($child)) {
                     $result['children'][++$sortorder] = $child;
                 }
             }
         }
     }
     return $result;
 }
開發者ID:covex-nn,項目名稱:moodle,代碼行數:47,代碼來源:grade_category.php


注:本文中的grade_category::_fetch_course_tree_recursion方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。