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


PHP grade_object::set_hidden方法代碼示例

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


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

示例1: set_hidden

 /**
  * Sets the grade_item's hidden variable and updates the grade_item.
  *
  * Overrides grade_item::set_hidden() to add cascading of the hidden value to grade items in this grade category
  *
  * @param int $hidden 0 mean always visible, 1 means always hidden and a number > 1 is a timestamp to hide until
  * @param bool $cascade apply to child objects too
  */
 public function set_hidden($hidden, $cascade = false)
 {
     $this->load_grade_item();
     //this hides the associated grade item (the course total)
     $this->grade_item->set_hidden($hidden, $cascade);
     //this hides the category itself and everything it contains
     parent::set_hidden($hidden, $cascade);
     if ($cascade) {
         if ($children = grade_item::fetch_all(array('categoryid' => $this->id))) {
             foreach ($children as $child) {
                 if ($child->can_control_visibility()) {
                     $child->set_hidden($hidden, $cascade);
                 }
             }
         }
         if ($children = grade_category::fetch_all(array('parent' => $this->id))) {
             foreach ($children as $child) {
                 $child->set_hidden($hidden, $cascade);
             }
         }
     }
     //if marking category visible make sure parent category is visible MDL-21367
     if (!$hidden) {
         $category_array = grade_category::fetch_all(array('id' => $this->parent));
         if ($category_array && array_key_exists($this->parent, $category_array)) {
             $category = $category_array[$this->parent];
             //call set_hidden on the category regardless of whether it is hidden as its parent might be hidden
             //if($category->is_hidden()) {
             $category->set_hidden($hidden, false);
             //}
         }
     }
 }
開發者ID:covex-nn,項目名稱:moodle,代碼行數:41,代碼來源:grade_category.php

示例2: set_hidden

 /**
  * Set the hidden status of grade_item and all grades.
  *
  * 0 mean always visible, 1 means always hidden and a number > 1 is a timestamp to hide until
  *
  * @param int $hidden new hidden status
  * @param bool $cascade apply to child objects too
  */
 public function set_hidden($hidden, $cascade = false)
 {
     parent::set_hidden($hidden, $cascade);
     if ($cascade) {
         if ($grades = grade_grade::fetch_all(array('itemid' => $this->id))) {
             foreach ($grades as $grade) {
                 $grade->grade_item =& $this;
                 $grade->set_hidden($hidden, $cascade);
             }
         }
     }
     //if marking item visible make sure category is visible MDL-21367
     if (!$hidden) {
         $category_array = grade_category::fetch_all(array('id' => $this->categoryid));
         if ($category_array && array_key_exists($this->categoryid, $category_array)) {
             $category = $category_array[$this->categoryid];
             //call set_hidden on the category regardless of whether it is hidden as its parent might be hidden
             //if($category->is_hidden()) {
             $category->set_hidden($hidden, false);
             //}
         }
     }
 }
開發者ID:mongo0se,項目名稱:moodle,代碼行數:31,代碼來源:grade_item.php


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