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


PHP format_base::is_section_current方法代碼示例

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


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

示例1: is_section_current

 /**
  * Is the section passed in the current section?
  *
  * @param stdClass $section The course_section entry from the DB
  * @return bool true if the section is current
  */
 public function is_section_current($section)
 {
     $tcsettings = $this->get_settings();
     if ($tcsettings['layoutstructure'] == 2 || $tcsettings['layoutstructure'] == 3) {
         if ($section->section < 1) {
             return false;
         }
         $timenow = time();
         $dates = $this->format_collblct_get_section_dates($section, $this->get_course());
         return $timenow >= $dates->start && $timenow < $dates->end;
     } else {
         if ($tcsettings['layoutstructure'] == 5) {
             if ($section->section < 1) {
                 return false;
             }
             $timenow = time();
             $day = $this->format_collblct_get_section_day($section, $this->get_course());
             $onedayseconds = 86400;
             return $timenow >= $day && $timenow < $day + $onedayseconds;
         } else {
             return parent::is_section_current($section);
         }
     }
 }
開發者ID:MoodleMetaData,項目名稱:MoodleMetaData,代碼行數:30,代碼來源:lib.php

示例2: is_section_current

    /**
     * Is the section passed in the current section?
     *
     * @param stdClass $section The course_section entry from the DB
     * @return bool true if the section is current
     */
    public function is_section_current($section) {
        $tcsettings = $this->get_settings();
        if (($tcsettings['layoutstructure'] == 2) || ($tcsettings['layoutstructure'] == 3)) {
            if ($section->section < 1) {
                return false;
            }

            $timenow = time();
            $dates = $this->format_topcoll_get_section_dates($section, $this->get_course());

            return (($timenow >= $dates->start) && ($timenow < $dates->end));
        } else if ($tcsettings['layoutstructure'] == 5) {
            if ($section->section < 1) {
                return false;
            }

            $timenow = time();
            $day = $this->format_topcoll_get_section_day($section, $this->get_course());
            $onedayseconds = 86400;
            return (($timenow >= $day) && ($timenow < ($day + $onedayseconds)));
        } else {
            return parent::is_section_current($section);
        }
    }
開發者ID:narasimhaeabyas,項目名稱:tataaiapro,代碼行數:30,代碼來源:lib.php

示例3: set_chapters

 protected function set_chapters()
 {
     $this->chapters = (object) [];
     $this->chapters->listlarge = $this->course->numsections > 9 ? 'list-large' : '';
     $this->chapters->chapters = [];
     $canviewhidden = has_capability('moodle/course:viewhiddensections', context_course::instance($this->course->id));
     $modinfo = get_fast_modinfo($this->course);
     foreach ($modinfo->get_section_info_all() as $section => $thissection) {
         if ($section > $this->course->numsections) {
             continue;
         }
         // Students - If course hidden sections completely invisible & section is hidden, and you cannot
         // see hidden things, bale out.
         if ($this->course->hiddensections && !$thissection->visible && !$canviewhidden) {
             continue;
         }
         $conditional = $this->is_section_conditional($thissection);
         $chapter = new course_toc_chapter();
         $chapter->outputlink = true;
         if ($canviewhidden) {
             // Teachers.
             if ($conditional) {
                 $chapter->availabilityclass = 'text-danger';
                 $chapter->availabilitystatus = get_string('conditional', 'theme_snap');
             }
             if (!$thissection->visible) {
                 $chapter->availabilityclass = 'text-warning';
                 $chapter->availabilitystatus = get_string('notpublished', 'theme_snap');
             }
         } else {
             // Students.
             if ($conditional && !$thissection->uservisible && !$thissection->availableinfo) {
                 // Conditional section, totally hidden from user so skip.
                 continue;
             }
             if ($conditional && $thissection->availableinfo) {
                 $chapter->availabilityclass = 'text-danger';
                 $chapter->availabilitystatus = get_string('conditional', 'theme_snap');
             }
             if (!$conditional && !$thissection->visible) {
                 // Hidden section collapsed, so show as text in TOC.
                 $chapter->outputlink = false;
                 $chapter->availabilityclass = 'text-warning';
                 $chapter->availabilitystatus = get_string('notavailable');
             }
         }
         $chapter->title = get_section_name($this->course, $section);
         if ($chapter->title == get_string('general')) {
             $chapter->title = get_string('introduction', 'theme_snap');
         }
         if ($this->format->is_section_current($section)) {
             $chapter->iscurrent = true;
         }
         if ($chapter->outputlink) {
             $singlepage = $this->course->format !== 'folderview';
             if ($singlepage) {
                 $chapter->url = '#section-' . $section;
             } else {
                 if ($section > 0) {
                     $chapter->url = course_get_url($this->course, $section, ['navigation' => true, 'sr' => $section]);
                 } else {
                     // We need to create the url for section 0, or a hash will get returned.
                     $chapter->url = new moodle_url('/course/view.php', ['id' => $this->course->id, 'section' => $section]);
                 }
             }
         }
         $chapter->progress = new course_toc_progress($this->course, $thissection);
         $this->chapters->chapters[] = $chapter;
     }
 }
開發者ID:pramithkm,項目名稱:moodle-theme_snap,代碼行數:70,代碼來源:course_toc.php


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