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


PHP ismoving函数代码示例

本文整理汇总了PHP中ismoving函数的典型用法代码示例。如果您正苦于以下问题:PHP ismoving函数的具体用法?PHP ismoving怎么用?PHP ismoving使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: print_container_start

         echo '<td style="width:' . $preferred_width_left . 'px" id="left-column">';
         print_container_start();
         blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
         print_container_end();
         echo '</td>';
     }
     break;
 case 'middle':
     /// Start main column
     echo '<td id="middle-column">';
     print_container_start();
     echo skip_main_destination();
     print_heading_block(get_string('weeklyoutline'), 'outline');
     echo '<table class="weeks" width="100%" summary="' . get_string('layouttable') . '">';
     /// If currently moving a file then show the current clipboard
     if (ismoving($course->id)) {
         $stractivityclipboard = strip_tags(get_string('activityclipboard', '', addslashes($USER->activitycopyname)));
         $strcancel = get_string('cancel');
         echo '<tr class="clipboard">';
         echo '<td colspan="3">';
         echo $stractivityclipboard . '&nbsp;&nbsp;(<a href="mod.php?cancelcopy=true&amp;sesskey=' . $USER->sesskey . '">' . $strcancel . '</a>)';
         echo '</td>';
         echo '</tr>';
     }
     /// Print Section 0 with general activities
     $section = 0;
     $thissection = $sections[$section];
     if ($thissection->summary or $thissection->sequence or isediting($course->id)) {
         echo '<tr id="section-0" class="section main">';
         echo '<td class="left side">&nbsp;</td>';
         echo '<td class="content">';
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:31,代码来源:format.php

示例2: ss_print_section

/**
 * Prints a section full of activity modules
 * @Overrides course/lib.php=>print_section
 */
function ss_print_section($course, $section, $mods, $modnamesused, $absolute=false, $width="100%", $hidecompletion=false) {
	#print_r($mods);
	
	global $CFG, $USER, $DB, $PAGE, $OUTPUT;

    static $initialised;

    static $groupbuttons;
    static $groupbuttonslink;
    static $isediting;
    static $ismoving;
    static $strmovehere;
    static $strmovefull;
    static $strunreadpostsone;
    static $usetracking;
    static $groupings;

    if (!isset($initialised)) {
        $groupbuttons     = ($course->groupmode or (!$course->groupmodeforce));
        $groupbuttonslink = (!$course->groupmodeforce);
        $isediting        = $PAGE->user_is_editing();
        $ismoving         = $isediting && ismoving($course->id);
        if ($ismoving) {
            $strmovehere  = get_string("movehere");
            $strmovefull  = strip_tags(get_string("movefull", "", "'$USER->activitycopyname'"));
        }
        include_once($CFG->dirroot.'/mod/forum/lib.php');
        if ($usetracking = forum_tp_can_track_forums()) {
            $strunreadpostsone = get_string('unreadpostsone', 'forum');
        }
        $initialised = true;
    }

    $labelformatoptions = new stdClass();
    $labelformatoptions->noclean = true;
    $labelformatoptions->overflowdiv = true;

/// Casting $course->modinfo to string prevents one notice when the field is null
    $modinfo = get_fast_modinfo($course);
    $completioninfo = new completion_info($course);

    //Accessibility: replace table with list <ul>, but don't output empty list.
    if (!empty($section->sequence)) {

        // Fix bug #5027, don't want style=\"width:$width\".
        echo "<ul class=\"section img-text\">\n";
        $sectionmods = explode(",", $section->sequence);

        foreach ($sectionmods as $modnumber) {
            if (empty($mods[$modnumber])) {
                continue;
            }

            $mod = $mods[$modnumber];
            
            if ($ismoving and $mod->id == $USER->activitycopy) {
                // do not display moving mod
                continue;
            }

            if (isset($modinfo->cms[$modnumber])) {
                // We can continue (because it will not be displayed at all)
                // if:
                // 1) The activity is not visible to users
                // and
                // 2a) The 'showavailability' option is not set (if that is set,
                //     we need to display the activity so we can show
                //     availability info)
                // or
                // 2b) The 'availableinfo' is empty, i.e. the activity was
                //     hidden in a way that leaves no info, such as using the
                //     eye icon.
                if (!$modinfo->cms[$modnumber]->uservisible &&
                    (empty($modinfo->cms[$modnumber]->showavailability) ||
                      empty($modinfo->cms[$modnumber]->availableinfo))) {
                    // visibility shortcut
                    continue;
                }
            } else {
                if (!file_exists("$CFG->dirroot/mod/$mod->modname/lib.php")) {
                    // module not installed
                    continue;
                }
                if (!coursemodule_visible_for_user($mod) &&
                    empty($mod->showavailability)) {
                    // full visibility check
                    continue;
                }
            }

            // In some cases the activity is visible to user, but it is
            // dimmed. This is done if viewhiddenactivities is true and if:
            // 1. the activity is not visible, or
            // 2. the activity has dates set which do not include current, or
            // 3. the activity has any other conditions set (regardless of whether
            //    current user meets them)
//.........这里部分代码省略.........
开发者ID:noisyjerm,项目名称:moodle-course_format_slides,代码行数:101,代码来源:lib.php

示例3: course_activity_clipboard

 /**
  * Show if something is on on the course clipboard (moving around)
  *
  * @param stdClass $course The course entry from DB
  * @param int $sectionno The section number in the coruse which is being dsiplayed
  * @return string HTML to output.
  */
 protected function course_activity_clipboard($course, $sectionno = null)
 {
     global $USER;
     $o = '';
     // If currently moving a file then show the current clipboard.
     if (ismoving($course->id)) {
         $url = new moodle_url('/course/mod.php', array('sesskey' => sesskey(), 'cancelcopy' => true, 'sr' => $sectionno));
         $o .= html_writer::start_tag('div', array('class' => 'clipboard'));
         $o .= strip_tags(get_string('activityclipboard', '', $USER->activitycopyname));
         $o .= ' (' . html_writer::link($url, get_string('cancel')) . ')';
         $o .= html_writer::end_tag('div');
     }
     return $o;
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:21,代码来源:renderer.php

示例4: course_section_cm_list

 /**
  * Renders HTML to display a list of course modules in a course section
  * Also displays "move here" controls in Javascript-disabled mode
  *
  * This function calls {@link core_course_renderer::course_section_cm()}
  *
  * @param stdClass $course course object
  * @param int|stdClass|section_info $section relative section number or section object
  * @param int $sectionreturn section number to return to
  * @param int $displayoptions
  * @return void
  */
 public function course_section_cm_list($course, $section, $sectionreturn = null, $displayoptions = array())
 {
     global $USER;
     $output = '';
     $modinfo = get_fast_modinfo($course);
     if (is_object($section)) {
         $section = $modinfo->get_section_info($section->section);
     } else {
         $section = $modinfo->get_section_info($section);
     }
     $completioninfo = new completion_info($course);
     // check if we are currently in the process of moving a module with JavaScript disabled
     $ismoving = $this->page->user_is_editing() && ismoving($course->id);
     if ($ismoving) {
         $movingpix = new pix_icon('movehere', get_string('movehere'), 'moodle', array('class' => 'movetarget'));
         $strmovefull = strip_tags(get_string("movefull", "", "'{$USER->activitycopyname}'"));
     }
     // Get the list of modules visible to user (excluding the module being moved if there is one)
     $moduleshtml = array();
     if (!empty($modinfo->sections[$section->section])) {
         foreach ($modinfo->sections[$section->section] as $modnumber) {
             $mod = $modinfo->cms[$modnumber];
             if ($ismoving and $mod->id == $USER->activitycopy) {
                 // do not display moving mod
                 continue;
             }
             if ($modulehtml = $this->course_section_cm_list_item($course, $completioninfo, $mod, $sectionreturn, $displayoptions)) {
                 $moduleshtml[$modnumber] = $modulehtml;
             }
         }
     }
     $sectionoutput = '';
     if (!empty($moduleshtml) || $ismoving) {
         foreach ($moduleshtml as $modnumber => $modulehtml) {
             if ($ismoving) {
                 $movingurl = new moodle_url('/course/mod.php', array('moveto' => $modnumber, 'sesskey' => sesskey()));
                 $sectionoutput .= html_writer::tag('li', html_writer::link($movingurl, $this->output->render($movingpix), array('title' => $strmovefull)), array('class' => 'movehere'));
             }
             $sectionoutput .= $modulehtml;
         }
         if ($ismoving) {
             $movingurl = new moodle_url('/course/mod.php', array('movetosection' => $section->id, 'sesskey' => sesskey()));
             $sectionoutput .= html_writer::tag('li', html_writer::link($movingurl, $this->output->render($movingpix), array('title' => $strmovefull)), array('class' => 'movehere'));
         }
     }
     // Always output the section module list.
     $output .= html_writer::tag('ul', $sectionoutput, array('class' => 'section img-text'));
     return $output;
 }
开发者ID:rushi963,项目名称:moodle,代码行数:61,代码来源:renderer.php

示例5: get_content

 /**
  * Parent class version of this function simply returns NULL This should be implemented by the derived class to return the content object.
  *
  * @return object The content object
  */
 public function get_content()
 {
     global $USER, $CFG, $DB, $OUTPUT;
     if ($this->content !== null) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->items = array();
     $this->content->icons = array();
     $this->content->footer = '';
     if (empty($this->instance)) {
         if (!isset($this->content)) {
             $this->content = new stdClass();
         }
         return $this->content;
     }
     if (!isset($this->config->title)) {
         if (!isset($this->config)) {
             $this->config = new stdClass();
         }
         $this->config->title = '';
     }
     $course = $this->page->course;
     require_once $CFG->dirroot . '/course/lib.php';
     $context = context_course::instance($course->id);
     $isediting = $this->page->user_is_editing() && has_capability('moodle/course:manageactivities', $context);
     // Create a new section for this block (if necessary).
     if (empty($this->config->section)) {
         require_once $CFG->dirroot . '/blocks/side_bar/locallib.php';
         if (null == ($section = block_side_bar_create_section($course))) {
             return $this->content;
         }
         $this->config->section = $section->section;
         $this->config->section_id = $section->id;
         parent::instance_config_commit();
     } else {
         if (empty($this->config->section_id)) {
             $params = array('course' => $course->id, 'section' => $this->config->section);
             $section = $DB->get_record('course_sections', $params);
             $this->config->section_id = $section->id;
             parent::instance_config_commit();
         } else {
             $section = $DB->get_record('course_sections', array('id' => $this->config->section_id));
             if (empty($section)) {
                 require_once $CFG->dirroot . '/blocks/side_bar/locallib.php';
                 if (null == ($section = block_side_bar_create_section($course))) {
                     return $this->content;
                 }
                 $this->config->section = $section->section;
                 $this->config->section_id = $section->id;
                 parent::instance_config_commit();
             }
         }
         // Double check that the section number hasn't been modified by something else.
         // Fixes problem found by Charlotte Owen when moving 'center column' course sections.
         if ($section->section != $this->config->section) {
             $section->section = $this->config->section;
             $DB->update_record('course_sections', $section);
         }
     }
     // extra fast view mode
     $modinfo = get_fast_modinfo($course);
     if (!$isediting) {
         if (!empty($modinfo->sections[$this->config->section])) {
             $options = array('overflowdiv' => true);
             foreach ($modinfo->sections[$this->config->section] as $cmid) {
                 $cm = $modinfo->cms[$cmid];
                 if (!$cm->uservisible) {
                     continue;
                 }
                 $content = $cm->get_formatted_content(array('overflowdiv' => true, 'noclean' => true));
                 $instancename = $cm->get_formatted_name();
                 if (!($url = $cm->url)) {
                     $this->content->items[] = $content;
                     $this->content->icons[] = '';
                 } else {
                     $linkcss = $cm->visible ? '' : ' class="dimmed" ';
                     // Accessibility: incidental image - should be empty Alt text
                     $icon = '<img src="' . $cm->get_icon_url() . '" class="icon" alt="" />&nbsp;';
                     $this->content->items[] = '<a title="' . $cm->modplural . '" ' . $linkcss . ' ' . $cm->extra . ' href="' . $url . '">' . $icon . $instancename . '</a>';
                 }
             }
         }
         return $this->content;
     }
     // slow & hacky editing mode
     $courserenderer = $this->page->get_renderer('core', 'course');
     $ismoving = ismoving($course->id);
     if (!($cs = $DB->get_record('course_sections', array('section' => $this->config->section, 'course' => $course->id)))) {
         debugging('Could not get course section record for section ' . $this->config->section, DEBUG_DEVELOPER);
         return $this->content;
     }
     $modinfo = get_fast_modinfo($course);
     $section = $modinfo->get_section_info($this->config->section);
     $modnames = get_module_types_names();
//.........这里部分代码省略.........
开发者ID:bostelm,项目名称:moodle-block_side_bar,代码行数:101,代码来源:block_side_bar.php

示例6: print_section_fn

 function print_section_fn(&$section, $absolute = false, $width = "100%")
 {
     /// Prints a section full of activity modules
     global $CFG, $USER, $THEME;
     static $initialised;
     static $groupbuttons;
     static $groupbuttonslink;
     static $isteacher, $isteacheredit;
     static $isediting;
     static $ismoving;
     static $strmovehere;
     static $strmovefull;
     static $strunreadpostsone;
     $labelformatoptions = new stdClass();
     if (!isset($isteacher)) {
         $groupbuttons = $this->course->groupmode;
         $groupbuttonslink = !$this->course->groupmodeforce;
         $isteacher = has_capability('moodle/grade:viewall', $this->context);
         $isteacheredit = has_capability('moodle/course:manageactivities', $this->context);
         $isediting = isediting($this->course->id);
         $ismoving = ismoving($this->course->id);
         if ($ismoving) {
             $strmovehere = get_string("movehere");
             $strmovefull = strip_tags(get_string("movefull", "", "'{$USER->activitycopyname}'"));
         }
     }
     if (!isset($initialised)) {
         include_once $CFG->dirroot . '/mod/forum/lib.php';
         if ($usetracking = forum_tp_can_track_forums()) {
             $strunreadpostsone = get_string('unreadpostsone', 'forum');
         }
         $initialised = true;
     }
     //  Replace this with language file changes (eventually).
     $link_title = array('resource' => 'Lesson', 'choice' => 'Opinion', 'lesson' => 'Reading');
     $labelformatoptions->noclean = true;
     $modinfo = unserialize($this->course->modinfo);
     echo "<table cellpadding=\"1\" cellspacing=\"0\" align=\"center\" width=\"{$width}\">\n";
     if (!empty($section->sequence)) {
         $sectionmods = explode(",", $section->sequence);
         foreach ($sectionmods as $modnumber) {
             if (empty($this->mods[$modnumber])) {
                 continue;
             }
             $mod = $this->mods[$modnumber];
             /// mrc - 20042312 - Begin G8 First Nations School Customization:
             ///     Added check for 'teacheredit' in order to hide invisible activities from
             ///     non-editing teachers.
             ///            if ($mod->visible or $isteacher) {
             if ($mod->visible or $isteacheredit) {
                 /// mrc - 20042312 - End G8 First Nations School Customization:
                 if (right_to_left()) {
                     $tdalign = 'right';
                 } else {
                     $tdalign = 'left';
                 }
                 echo "<tr><td align=\"{$tdalign}\" class=\"activity{$mod->modname}\" width=\"{$width}\">";
                 if ($ismoving) {
                     if ($mod->id == $USER->activitycopy) {
                         continue;
                     }
                     echo "<a title=\"{$strmovefull}\"" . " href=\"{$CFG->wwwroot}/course/mod.php?moveto={$mod->id}&amp;sesskey={$USER->sesskey}\">" . "<img height=\"16\" width=\"80\" src=\"{$CFG->pixpath}/movehere.gif\" " . " alt=\"{$strmovehere}\" border=\"0\"></a><br />\n";
                 }
                 $instancename = urldecode($modinfo[$modnumber]->name);
                 if (!empty($CFG->filterall)) {
                     $instancename = filter_text("<nolink>{$instancename}</nolink>", $this->course->id);
                 }
                 if (!empty($modinfo[$modnumber]->extra)) {
                     $extra = urldecode($modinfo[$modnumber]->extra);
                 } else {
                     $extra = "";
                 }
                 if (!empty($modinfo[$modnumber]->icon)) {
                     $icon = "{$CFG->pixpath}/" . urldecode($modinfo[$modnumber]->icon);
                 } else {
                     $icon = "{$CFG->modpixpath}/{$mod->modname}/icon.gif";
                 }
                 if ($mod->indent) {
                     print_spacer(12, 20 * $mod->indent, false);
                 }
                 //                /// If the questionnaire is mandatory
                 //                if (($mod->modname == 'questionnaire') && empty($mandatorypopup)) {
                 //                    $mandatorypopup = is_mod_mandatory($mod, $USER->id);
                 //                }
                 if ($mod->modname == "label") {
                     if (empty($this->course->usemandatory) || empty($mod->mandatory)) {
                         if (!$mod->visible) {
                             echo "<span class=\"dimmed_text\">";
                         }
                         echo format_text($extra, FORMAT_HTML, $labelformatoptions);
                         if (!$mod->visible) {
                             echo "</span>";
                         }
                     } else {
                         if ($isediting) {
                             $linkcss = $mod->visible ? "" : " class=\"dimmed\" ";
                             $alttext = isset($link_title[$mod->modname]) ? $link_title[$mod->modname] : $mod->modfullname;
                             echo "<img src=\"{$icon}\"" . " height=16 width=16 alt=\"{$alttext}\">" . " <font size=2><a title=\"{$alttext}\" {$linkcss} {$extra}" . " href=\"{$CFG->wwwroot}/mod/{$mod->modname}/view.php?id={$mod->id}\">{$instancename}</a></font>";
                         }
                     }
//.........这里部分代码省略.........
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:101,代码来源:course_format_fn.class.php

示例7: make_block_show_clipboard_if_file_moving

 /**
  * If currently moving a file then show the current clipboard.
  */
 private function make_block_show_clipboard_if_file_moving($course)
 {
     global $USER;
     if (is_object($course) && ismoving($course->id)) {
         $strcancel = get_string('cancel');
         $stractivityclipboard = clean_param(format_string(get_string('activityclipboard', '', $USER->activitycopyname)), PARAM_NOTAGS);
         $stractivityclipboard .= '&nbsp;&nbsp;(' . html_writer::link(new moodle_url('/mod.php', array('cancelcopy' => 'true', 'sesskey' => sesskey())), $strcancel);
         echo html_writer::tag('li', $stractivityclipboard, array('class' => 'clipboard'));
     }
 }
开发者ID:wiegerdeleur,项目名称:skillbox,代码行数:13,代码来源:grid_renderer.php

示例8: get_edit_controls_cancelmoving

 /**
  * Returns a control to exit the section moving mode
  *
  * @return null|format_flexsections_edit_control
  */
 public function get_edit_controls_cancelmoving()
 {
     global $USER;
     $controls = array();
     // cancel moving section
     $movingsection = $this->is_moving_section();
     if ($movingsection) {
         $cancelmovingurl = course_get_url($this->courseid, $this->get_viewed_section());
         $str = strip_tags(get_string('cancelmoving', 'format_flexsections', $this->get_section_name($movingsection)));
         $controls[] = new format_flexsections_edit_control('cancelmovingsection', $cancelmovingurl, $str);
     }
     // cancel moving activity
     if (ismoving($this->courseid)) {
         $cancelmovingurl = new moodle_url('/course/mod.php', array('sesskey' => sesskey(), 'cancelcopy' => true, 'sr' => $this->get_viewed_section));
         $str = strip_tags(get_string('cancelmoving', 'format_flexsections', $USER->activitycopyname));
         $controls[] = new format_flexsections_edit_control('cancelmovingactivity', $cancelmovingurl, $str);
     }
     return $controls;
 }
开发者ID:etarrillo,项目名称:pvflbl,代码行数:24,代码来源:lib.php

示例9: get_content

 function get_content()
 {
     global $USER, $CFG;
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->items = array();
     $this->content->icons = array();
     $this->content->footer = '';
     if (empty($this->instance)) {
         return $this->content;
     }
     $course = get_record('course', 'id', $this->instance->pageid);
     $context = get_context_instance(CONTEXT_COURSE, $course->id);
     $isediting = isediting($this->instance->pageid) && has_capability('moodle/course:manageactivities', $context);
     $ismoving = ismoving($this->instance->pageid);
     $sections = get_all_sections($this->instance->pageid);
     if (!empty($sections) && isset($sections[0])) {
         $section = $sections[0];
     }
     if (!empty($section) || $isediting) {
         get_all_mods($this->instance->pageid, $mods, $modnames, $modnamesplural, $modnamesused);
     }
     $groupbuttons = $course->groupmode;
     $groupbuttonslink = !$course->groupmodeforce;
     if ($ismoving) {
         $strmovehere = get_string('movehere');
         $strmovefull = strip_tags(get_string('movefull', '', "'{$USER->activitycopyname}'"));
         $strcancel = get_string('cancel');
         $stractivityclipboard = $USER->activitycopyname;
     }
     /// Casting $course->modinfo to string prevents one notice when the field is null
     $modinfo = unserialize((string) $course->modinfo);
     $editbuttons = '';
     if ($ismoving) {
         $this->content->icons[] = '<img src="' . $CFG->pixpath . '/t/move.gif" class="iconsmall" alt="" />';
         $this->content->items[] = $USER->activitycopyname . '&nbsp;(<a href="' . $CFG->wwwroot . '/course/mod.php?cancelcopy=true&amp;sesskey=' . $USER->sesskey . '">' . $strcancel . '</a>)';
     }
     if (!empty($section) && !empty($section->sequence)) {
         $sectionmods = explode(',', $section->sequence);
         foreach ($sectionmods as $modnumber) {
             if (empty($mods[$modnumber])) {
                 continue;
             }
             $mod = $mods[$modnumber];
             if ($isediting && !$ismoving) {
                 if ($groupbuttons) {
                     if (!($mod->groupmodelink = $groupbuttonslink)) {
                         $mod->groupmode = $course->groupmode;
                     }
                 } else {
                     $mod->groupmode = false;
                 }
                 $editbuttons = '<div class="buttons">' . make_editing_buttons($mod, true, true) . '</div>';
             } else {
                 $editbuttons = '';
             }
             if ($mod->visible || has_capability('moodle/course:viewhiddenactivities', $context)) {
                 if ($ismoving) {
                     if ($mod->id == $USER->activitycopy) {
                         continue;
                     }
                     $this->content->items[] = '<a title="' . $strmovefull . '" href="' . $CFG->wwwroot . '/course/mod.php?moveto=' . $mod->id . '&amp;sesskey=' . $USER->sesskey . '">' . '<img style="height:16px; width:80px; border:0px" src="' . $CFG->pixpath . '/movehere.gif" alt="' . $strmovehere . '" /></a>';
                     $this->content->icons[] = '';
                 }
                 $instancename = urldecode($modinfo[$modnumber]->name);
                 $instancename = format_string($instancename, true, $this->instance->pageid);
                 $linkcss = $mod->visible ? '' : ' class="dimmed" ';
                 if (!empty($modinfo[$modnumber]->extra)) {
                     $extra = urldecode($modinfo[$modnumber]->extra);
                 } else {
                     $extra = '';
                 }
                 if (!empty($modinfo[$modnumber]->icon)) {
                     $icon = $CFG->pixpath . '/' . urldecode($modinfo[$modnumber]->icon);
                 } else {
                     $icon = $CFG->modpixpath . '/' . $mod->modname . '/icon.gif';
                 }
                 if ($mod->modname == 'label') {
                     $this->content->items[] = format_text($extra, FORMAT_HTML) . $editbuttons;
                     $this->content->icons[] = '';
                 } else {
                     $this->content->items[] = '<a title="' . $mod->modfullname . '" ' . $linkcss . ' ' . $extra . ' href="' . $CFG->wwwroot . '/mod/' . $mod->modname . '/view.php?id=' . $mod->id . '">' . $instancename . '</a>' . $editbuttons;
                     //Accessibility: incidental image - should be empty Alt text
                     $this->content->icons[] = '<img src="' . $icon . '" class="icon" alt="" />';
                 }
             }
         }
     }
     if ($ismoving) {
         $this->content->items[] = '<a title="' . $strmovefull . '" href="' . $CFG->wwwroot . '/course/mod.php?movetosection=' . $section->id . '&amp;sesskey=' . $USER->sesskey . '">' . '<img style="height:16px; width:80px; border:0px" src="' . $CFG->pixpath . '/movehere.gif" alt="' . $strmovehere . '" /></a>';
         $this->content->icons[] = '';
     }
     if ($isediting && $modnames) {
         $this->content->footer = print_section_add_menus($course, 0, $modnames, true, true);
     } else {
         $this->content->footer = '';
     }
     return $this->content;
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:101,代码来源:block_site_main_menu.php

示例10: fn_display_category_content

/**
 * Function used by the site index page to display category specific information.
 */
function fn_display_category_content($course, $catid)
{
    global $USER, $CFG;
    $totcount = 99;
    $isteacher = isteacher($course->id);
    $isediting = isediting($course->id);
    $ismoving = ismoving($course->id);
    if (!($category = get_record('course_categories', 'id', $catid))) {
        error('Invalid category requested.');
    }
    $courses = get_courses_page($catid, 'c.sortorder ASC', 'c.id,c.sortorder,c.shortname,c.fullname,c.summary,c.visible,c.teacher,c.guest,c.password', $totcount);
    /// Store a course section per category id. Code it by using the 'catid' plus 10 as the section number.
    $sectnum = $catid + 10;
    if (!($section = get_record('course_sections', 'course', $course->id, 'section', $sectnum))) {
        $section = new stdClass();
        $section->course = $course->id;
        $section->section = $sectnum;
        $section->summary = $category->name;
        $section->sequence = '';
        $section->visible = 1;
        if (!($section->id = insert_record('course_sections', $section))) {
            error('Could not create section for category ' . $category->name);
        }
    }
    if (!empty($section) || $isediting) {
        get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
    }
    $groupbuttons = $course->groupmode;
    $groupbuttonslink = !$course->groupmodeforce;
    if ($ismoving) {
        $strmovehere = get_string('movehere');
        $strmovefull = strip_tags(get_string('movefull', '', "'{$USER->activitycopyname}'"));
        $strcancel = get_string('cancel');
        $stractivityclipboard = $USER->activitycopyname;
    }
    $modinfo = unserialize($course->modinfo);
    $editbuttons = '';
    print_simple_box_start("center", "100%", '', 5, "coursebox");
    echo '<table class="topics" width="100%">';
    echo '<tr id="section-' . $section . '" class="section main">';
    echo '<td class="content">';
    print_heading_block('<div align="center">' . $category->name . '</div>');
    echo '<table class="section" width="100%">';
    if (!empty($section) && !empty($section->sequence)) {
        $sectionmods = explode(',', $section->sequence);
        foreach ($sectionmods as $modnumber) {
            if (empty($mods[$modnumber])) {
                continue;
            }
            $mod = $mods[$modnumber];
            if ($isediting && !$ismoving) {
                if ($groupbuttons) {
                    if (!($mod->groupmodelink = $groupbuttonslink)) {
                        $mod->groupmode = $course->groupmode;
                    }
                } else {
                    $mod->groupmode = false;
                }
                $editbuttons = '<br />' . make_editing_buttons($mod, true, true);
            } else {
                $editbuttons = '';
            }
            if ($mod->visible || $isteacher) {
                echo '<tr><td class="activity ' . $mod->modname . '">';
                if ($ismoving) {
                    if ($mod->id == $USER->activitycopy) {
                        continue;
                    }
                    echo '<a title="' . $strmovefull . '" href="' . $CFG->wwwroot . '/course/mod.php?moveto=' . $mod->id . '&amp;sesskey=' . $USER->sesskey . '">' . '<img height="16" width="80" src="' . $CFG->pixpath . '/movehere.gif" alt="' . $strmovehere . '" border="0" /></a>';
                }
                $instancename = urldecode($modinfo[$modnumber]->name);
                $instancename = format_string($instancename, true, $course->id);
                $linkcss = $mod->visible ? '' : ' class="dimmed" ';
                if (!empty($modinfo[$modnumber]->extra)) {
                    $extra = urldecode($modinfo[$modnumber]->extra);
                } else {
                    $extra = '';
                }
                if (!empty($modinfo[$modnumber]->icon)) {
                    $icon = $CFG->pixpath . '/' . urldecode($modinfo[$modnumber]->icon);
                } else {
                    $icon = $CFG->modpixpath . '/' . $mod->modname . '/icon.gif';
                }
                if ($mod->modname == 'label') {
                    echo format_text($extra, FORMAT_HTML) . $editbuttons;
                } else {
                    echo '<img src="' . $icon . '" height="16" width="16" alt="' . $mod->modfullname . '" /> ' . '<a title="' . $mod->modfullname . '" ' . $linkcss . ' ' . $extra . ' href="' . $CFG->wwwroot . '/mod/' . $mod->modname . '/view.php?id=' . $mod->id . '">' . $instancename . '</a>' . $editbuttons;
                }
                echo "</td>";
                echo "</tr>";
            }
        }
    } else {
        echo "<tr><td></td></tr>";
        // needed for XHTML compatibility
    }
    if ($ismoving) {
//.........这里部分代码省略.........
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:101,代码来源:lib.php

示例11: page_frontpage_settings

/**
 * Called from {@link page_print_position()} and it is
 * supposed to print the front page settings in the
 * center column for the site course and only for
 * the default page (EG: the landing page).
 *
 * @return boolean
 **/
function page_frontpage_settings()
{
    global $CFG, $SESSION, $SITE, $PAGE, $COURSE;
    // Cheap check first - course ID
    if ($COURSE->id != SITEID) {
        return false;
    }
    // More expensive check - make sure we are viewing default page
    $default = page_get_default_page();
    $current = $PAGE->get_formatpage();
    if (empty($default->id) or empty($current->id) or $default->id != $current->id) {
        return false;
    }
    $editing = $PAGE->user_is_editing();
    /// START COPY/PASTE FROM INDEX.PHP
    print_container_start();
    /// Print Section
    if ($SITE->numsections > 0) {
        if (!($section = get_record('course_sections', 'course', $SITE->id, 'section', 1))) {
            delete_records('course_sections', 'course', $SITE->id, 'section', 1);
            // Just in case
            $section->course = $SITE->id;
            $section->section = 1;
            $section->summary = '';
            $section->sequence = '';
            $section->visible = 1;
            $section->id = insert_record('course_sections', $section);
        }
        if (!empty($section->sequence) or !empty($section->summary) or $editing) {
            print_box_start('generalbox sitetopic');
            /// If currently moving a file then show the current clipboard
            if (ismoving($SITE->id)) {
                $stractivityclipboard = strip_tags(get_string('activityclipboard', '', addslashes($USER->activitycopyname)));
                echo '<p><font size="2">';
                echo "{$stractivityclipboard}&nbsp;&nbsp;(<a href=\"course/mod.php?cancelcopy=true&amp;sesskey={$USER->sesskey}\">" . get_string('cancel') . '</a>)';
                echo '</font></p>';
            }
            $options = NULL;
            $options->noclean = true;
            echo format_text($section->summary, FORMAT_HTML, $options);
            if ($editing) {
                $streditsummary = get_string('editsummary');
                echo "<a title=\"{$streditsummary}\" " . " href=\"course/editsection.php?id={$section->id}\"><img src=\"{$CFG->pixpath}/t/edit.gif\" " . " class=\"iconsmall\" alt=\"{$streditsummary}\" /></a><br /><br />";
            }
            get_all_mods($SITE->id, $mods, $modnames, $modnamesplural, $modnamesused);
            print_section($SITE, $section, $mods, $modnamesused, true);
            if ($editing) {
                print_section_add_menus($SITE, $section->section, $modnames);
            }
            print_box_end();
        }
    }
    if (isloggedin() and !isguest() and isset($CFG->frontpageloggedin)) {
        $frontpagelayout = $CFG->frontpageloggedin;
    } else {
        $frontpagelayout = $CFG->frontpage;
    }
    foreach (explode(',', $frontpagelayout) as $v) {
        switch ($v) {
            /// Display the main part of the front page.
            case FRONTPAGENEWS:
                if ($SITE->newsitems) {
                    // Print forums only when needed
                    require_once $CFG->dirroot . '/mod/forum/lib.php';
                    if (!($newsforum = forum_get_course_forum($SITE->id, 'news'))) {
                        error('Could not find or create a main news forum for the site');
                    }
                    if (!empty($USER->id)) {
                        $SESSION->fromdiscussion = $CFG->wwwroot;
                        if (forum_is_subscribed($USER->id, $newsforum)) {
                            $subtext = get_string('unsubscribe', 'forum');
                        } else {
                            $subtext = get_string('subscribe', 'forum');
                        }
                        print_heading_block($newsforum->name);
                        echo '<div class="subscribelink"><a href="mod/forum/subscribe.php?id=' . $newsforum->id . '">' . $subtext . '</a></div>';
                    } else {
                        print_heading_block($newsforum->name);
                    }
                    forum_print_latest_discussions($SITE, $newsforum, $SITE->newsitems, 'plain', 'p.modified DESC');
                }
                break;
            case FRONTPAGECOURSELIST:
                if (isloggedin() and !has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)) and !isguest() and empty($CFG->disablemycourses)) {
                    print_heading_block(get_string('mycourses'));
                    print_my_moodle();
                } else {
                    if (!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)) and !isguest() or count_records('course') <= FRONTPAGECOURSELIMIT) {
                        // admin should not see list of courses when there are too many of them
                        print_heading_block(get_string('availablecourses'));
                        print_courses(0);
                    }
//.........这里部分代码省略.........
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:101,代码来源:lib.php

示例12: get_content

 function get_content()
 {
     global $USER, $CFG, $DB, $OUTPUT;
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->items = array();
     $this->content->icons = array();
     $this->content->footer = '';
     if (empty($this->instance)) {
         return $this->content;
     }
     $course = $this->page->course;
     $courserenderer = $this->page->get_renderer('core', 'course');
     require_once $CFG->dirroot . '/course/lib.php';
     $context = context_course::instance($course->id);
     $isediting = $this->page->user_is_editing() && has_capability('moodle/course:manageactivities', $context);
     $modinfo = get_fast_modinfo($course);
     /// extra fast view mode
     if (!$isediting) {
         if (!empty($modinfo->sections[0])) {
             foreach ($modinfo->sections[0] as $cmid) {
                 $cm = $modinfo->cms[$cmid];
                 if (!$cm->uservisible) {
                     continue;
                 }
                 if (!$cm->url) {
                     $content = $cm->get_formatted_content(array('overflowdiv' => true, 'noclean' => true));
                     $this->content->items[] = $content;
                     $this->content->icons[] = '';
                 } else {
                     $this->content->items[] = html_writer::div($courserenderer->course_section_cm_name($cm), 'activity');
                 }
             }
         }
         return $this->content;
     }
     // Slow & hacky editing mode.
     $ismoving = ismoving($course->id);
     $section = $modinfo->get_section_info(0);
     if ($ismoving) {
         $strmovehere = get_string('movehere');
         $strmovefull = strip_tags(get_string('movefull', '', "'{$USER->activitycopyname}'"));
         $strcancel = get_string('cancel');
     } else {
         $strmove = get_string('move');
     }
     if ($ismoving) {
         $this->content->icons[] = '&nbsp;<img align="bottom" src="' . $OUTPUT->pix_url('t/move') . '" class="iconsmall" alt="" />';
         $this->content->items[] = $USER->activitycopyname . '&nbsp;(<a href="' . $CFG->wwwroot . '/course/mod.php?cancelcopy=true&amp;sesskey=' . sesskey() . '">' . $strcancel . '</a>)';
     }
     if (!empty($modinfo->sections[0])) {
         foreach ($modinfo->sections[0] as $modnumber) {
             $mod = $modinfo->cms[$modnumber];
             if (!$mod->uservisible) {
                 continue;
             }
             if (!$ismoving) {
                 $actions = course_get_cm_edit_actions($mod, -1);
                 // Prepend list of actions with the 'move' action.
                 $actions = array('move' => new action_menu_link_primary(new moodle_url('/course/mod.php', array('sesskey' => sesskey(), 'copy' => $mod->id)), new pix_icon('t/move', $strmove, 'moodle', array('class' => 'iconsmall', 'title' => '')), $strmove)) + $actions;
                 $editbuttons = html_writer::tag('div', $courserenderer->course_section_cm_edit_actions($actions, $mod, array('donotenhance' => true)), array('class' => 'buttons'));
             } else {
                 $editbuttons = '';
             }
             if ($mod->visible || has_capability('moodle/course:viewhiddenactivities', $mod->context)) {
                 if ($ismoving) {
                     if ($mod->id == $USER->activitycopy) {
                         continue;
                     }
                     $this->content->items[] = '<a title="' . $strmovefull . '" href="' . $CFG->wwwroot . '/course/mod.php?moveto=' . $mod->id . '&amp;sesskey=' . sesskey() . '">' . '<img style="height:16px; width:80px; border:0px" src="' . $OUTPUT->pix_url('movehere') . '" alt="' . $strmovehere . '" /></a>';
                     $this->content->icons[] = '';
                 }
                 if (!$mod->url) {
                     $content = $mod->get_formatted_content(array('overflowdiv' => true, 'noclean' => true));
                     $this->content->items[] = $content . $editbuttons;
                     $this->content->icons[] = '';
                 } else {
                     $this->content->items[] = html_writer::div($courserenderer->course_section_cm_name($mod), 'activity') . $editbuttons;
                 }
             }
         }
     }
     if ($ismoving) {
         $this->content->items[] = '<a title="' . $strmovefull . '" href="' . $CFG->wwwroot . '/course/mod.php?movetosection=' . $section->id . '&amp;sesskey=' . sesskey() . '">' . '<img style="height:16px; width:80px; border:0px" src="' . $OUTPUT->pix_url('movehere') . '" alt="' . $strmovehere . '" /></a>';
         $this->content->icons[] = '';
     }
     $this->content->footer = $courserenderer->course_section_add_cm_control($course, 0, null, array('inblock' => true));
     return $this->content;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:91,代码来源:block_social_activities.php

示例13: print_section

/**
 * Prints a section full of activity modules
 */
function print_section($course, $section, $mods, $modnamesused, $absolute = false, $width = "100%", $hidecompletion = false)
{
    global $CFG, $USER, $DB, $PAGE, $OUTPUT;
    static $initialised;
    static $groupbuttons;
    static $groupbuttonslink;
    static $isediting;
    static $ismoving;
    static $strmovehere;
    static $strmovefull;
    static $strunreadpostsone;
    static $groupings;
    static $modulenames;
    if (!isset($initialised)) {
        $groupbuttons = ($course->groupmode or !$course->groupmodeforce);
        $groupbuttonslink = !$course->groupmodeforce;
        $isediting = $PAGE->user_is_editing();
        $ismoving = $isediting && ismoving($course->id);
        if ($ismoving) {
            $strmovehere = get_string("movehere");
            $strmovefull = strip_tags(get_string("movefull", "", "'{$USER->activitycopyname}'"));
        }
        $modulenames = array();
        $initialised = true;
    }
    $modinfo = get_fast_modinfo($course);
    $completioninfo = new completion_info($course);
    //Accessibility: replace table with list <ul>, but don't output empty list.
    if (!empty($section->sequence)) {
        // Fix bug #5027, don't want style=\"width:$width\".
        echo "<ul class=\"section img-text\">\n";
        $sectionmods = explode(",", $section->sequence);
        foreach ($sectionmods as $modnumber) {
            if (empty($mods[$modnumber])) {
                continue;
            }
            /**
             * @var cm_info
             */
            $mod = $mods[$modnumber];
            if ($ismoving and $mod->id == $USER->activitycopy) {
                // do not display moving mod
                continue;
            }
            if (isset($modinfo->cms[$modnumber])) {
                // We can continue (because it will not be displayed at all)
                // if:
                // 1) The activity is not visible to users
                // and
                // 2a) The 'showavailability' option is not set (if that is set,
                //     we need to display the activity so we can show
                //     availability info)
                // or
                // 2b) The 'availableinfo' is empty, i.e. the activity was
                //     hidden in a way that leaves no info, such as using the
                //     eye icon.
                if (!$modinfo->cms[$modnumber]->uservisible && (empty($modinfo->cms[$modnumber]->showavailability) || empty($modinfo->cms[$modnumber]->availableinfo))) {
                    // visibility shortcut
                    continue;
                }
            } else {
                if (!file_exists("{$CFG->dirroot}/mod/{$mod->modname}/lib.php")) {
                    // module not installed
                    continue;
                }
                if (!coursemodule_visible_for_user($mod) && empty($mod->showavailability)) {
                    // full visibility check
                    continue;
                }
            }
            if (!isset($modulenames[$mod->modname])) {
                $modulenames[$mod->modname] = get_string('modulename', $mod->modname);
            }
            $modulename = $modulenames[$mod->modname];
            // In some cases the activity is visible to user, but it is
            // dimmed. This is done if viewhiddenactivities is true and if:
            // 1. the activity is not visible, or
            // 2. the activity has dates set which do not include current, or
            // 3. the activity has any other conditions set (regardless of whether
            //    current user meets them)
            $canviewhidden = has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_MODULE, $mod->id));
            $accessiblebutdim = false;
            if ($canviewhidden) {
                $accessiblebutdim = !$mod->visible;
                if (!empty($CFG->enableavailability)) {
                    $accessiblebutdim = $accessiblebutdim || $mod->availablefrom > time() || $mod->availableuntil && $mod->availableuntil < time() || count($mod->conditionsgrade) > 0 || count($mod->conditionscompletion) > 0;
                }
            }
            $liclasses = array();
            $liclasses[] = 'activity';
            $liclasses[] = $mod->modname;
            $liclasses[] = 'modtype_' . $mod->modname;
            $extraclasses = $mod->get_extra_classes();
            if ($extraclasses) {
                $liclasses = array_merge($liclasses, explode(' ', $extraclasses));
            }
            echo html_writer::start_tag('li', array('class' => join(' ', $liclasses), 'id' => 'module-' . $modnumber));
//.........这里部分代码省略.........
开发者ID:numbas,项目名称:moodle,代码行数:101,代码来源:lib.php

示例14: get_content

 function get_content()
 {
     global $USER, $CFG, $DB, $OUTPUT;
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->items = array();
     $this->content->icons = array();
     $this->content->footer = '';
     if (empty($this->instance)) {
         return $this->content;
     }
     $course = $this->page->course;
     require_once $CFG->dirroot . '/course/lib.php';
     $context = context_course::instance($course->id);
     $isediting = $this->page->user_is_editing() && has_capability('moodle/course:manageactivities', $context);
     $modinfo = get_fast_modinfo($course);
     /// extra fast view mode
     if (!$isediting) {
         if (!empty($modinfo->sections[0])) {
             $options = array('overflowdiv' => true);
             foreach ($modinfo->sections[0] as $cmid) {
                 $cm = $modinfo->cms[$cmid];
                 if (!$cm->uservisible) {
                     continue;
                 }
                 $content = $cm->get_formatted_content(array('overflowdiv' => true, 'noclean' => true));
                 $instancename = $cm->get_formatted_name();
                 if (!($url = $cm->get_url())) {
                     $this->content->items[] = $content;
                     $this->content->icons[] = '';
                 } else {
                     $linkcss = $cm->visible ? '' : ' class="dimmed" ';
                     //Accessibility: incidental image - should be empty Alt text
                     $icon = '<img src="' . $cm->get_icon_url() . '" class="icon" alt="" />&nbsp;';
                     $this->content->items[] = '<a title="' . $cm->modplural . '" ' . $linkcss . ' ' . $cm->extra . ' href="' . $url . '">' . $icon . $instancename . '</a>';
                 }
             }
         }
         return $this->content;
     }
     // Slow & hacky editing mode.
     /** @var core_course_renderer $courserenderer */
     $courserenderer = $this->page->get_renderer('core', 'course');
     $ismoving = ismoving($course->id);
     $modinfo = get_fast_modinfo($course);
     $section = $modinfo->get_section_info(0);
     if ($ismoving) {
         $strmovehere = get_string('movehere');
         $strmovefull = strip_tags(get_string('movefull', '', "'{$USER->activitycopyname}'"));
         $strcancel = get_string('cancel');
         $stractivityclipboard = $USER->activitycopyname;
     }
     $editbuttons = '';
     if ($ismoving) {
         $this->content->icons[] = '&nbsp;<img align="bottom" src="' . $OUTPUT->pix_url('t/move') . '" class="iconsmall" alt="" />';
         $this->content->items[] = $USER->activitycopyname . '&nbsp;(<a href="' . $CFG->wwwroot . '/course/mod.php?cancelcopy=true&amp;sesskey=' . sesskey() . '">' . $strcancel . '</a>)';
     }
     if (!empty($modinfo->sections[0])) {
         $options = array('overflowdiv' => true);
         foreach ($modinfo->sections[0] as $modnumber) {
             $mod = $modinfo->cms[$modnumber];
             if (!$mod->uservisible) {
                 continue;
             }
             if (!$ismoving) {
                 $actions = course_get_cm_edit_actions($mod, -1);
                 $editbuttons = '<br />' . $courserenderer->course_section_cm_edit_actions($actions, $mod);
             } else {
                 $editbuttons = '';
             }
             if ($mod->visible || has_capability('moodle/course:viewhiddenactivities', $context)) {
                 if ($ismoving) {
                     if ($mod->id == $USER->activitycopy) {
                         continue;
                     }
                     $this->content->items[] = '<a title="' . $strmovefull . '" href="' . $CFG->wwwroot . '/course/mod.php?moveto=' . $mod->id . '&amp;sesskey=' . sesskey() . '">' . '<img style="height:16px; width:80px; border:0px" src="' . $OUTPUT->pix_url('movehere') . '" alt="' . $strmovehere . '" /></a>';
                     $this->content->icons[] = '';
                 }
                 $content = $mod->get_formatted_content(array('overflowdiv' => true, 'noclean' => true));
                 $instancename = $mod->get_formatted_name();
                 $linkcss = $mod->visible ? '' : ' class="dimmed" ';
                 if (!($url = $mod->get_url())) {
                     $this->content->items[] = $content . $editbuttons;
                     $this->content->icons[] = '';
                 } else {
                     //Accessibility: incidental image - should be empty Alt text
                     $icon = '<img src="' . $mod->get_icon_url() . '" class="icon" alt="" />&nbsp;';
                     $this->content->items[] = '<a title="' . $mod->modfullname . '" ' . $linkcss . ' ' . $mod->extra . ' href="' . $url . '">' . $icon . $instancename . '</a>' . $editbuttons;
                 }
             }
         }
     }
     if ($ismoving) {
         $this->content->items[] = '<a title="' . $strmovefull . '" href="' . $CFG->wwwroot . '/course/mod.php?movetosection=' . $section->id . '&amp;sesskey=' . sesskey() . '">' . '<img style="height:16px; width:80px; border:0px" src="' . $OUTPUT->pix_url('movehere') . '" alt="' . $strmovehere . '" /></a>';
         $this->content->icons[] = '';
     }
     $this->content->footer = $courserenderer->course_section_add_cm_control($course, 0, null, array('inblock' => true));
     return $this->content;
//.........这里部分代码省略.........
开发者ID:covex-nn,项目名称:moodle,代码行数:101,代码来源:block_social_activities.php

示例15: get_content

 function get_content()
 {
     global $USER, $CFG, $DB, $OUTPUT;
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->items = array();
     $this->content->icons = array();
     $this->content->footer = '';
     if (empty($this->instance)) {
         return $this->content;
     }
     $course = $this->page->course;
     require_once $CFG->dirroot . '/course/lib.php';
     $context = context_course::instance($course->id);
     $isediting = $this->page->user_is_editing() && has_capability('moodle/course:manageactivities', $context);
     $modinfo = get_fast_modinfo($course);
     /// extra fast view mode
     if (!$isediting) {
         if (!empty($modinfo->sections[0])) {
             $options = array('overflowdiv' => true);
             foreach ($modinfo->sections[0] as $cmid) {
                 $cm = $modinfo->cms[$cmid];
                 if (!$cm->uservisible) {
                     continue;
                 }
                 list($content, $instancename) = get_print_section_cm_text($cm, $course);
                 if (!($url = $cm->get_url())) {
                     $this->content->items[] = $content;
                     $this->content->icons[] = '';
                 } else {
                     $linkcss = $cm->visible ? '' : ' class="dimmed" ';
                     //Accessibility: incidental image - should be empty Alt text
                     $icon = '<img src="' . $cm->get_icon_url() . '" class="icon" alt="" />&nbsp;';
                     $this->content->items[] = '<a title="' . $cm->modplural . '" ' . $linkcss . ' ' . $cm->extra . ' href="' . $url . '">' . $icon . $instancename . '</a>';
                 }
             }
         }
         return $this->content;
     }
     /// slow & hacky editing mode
     $ismoving = ismoving($course->id);
     $section = get_course_section(0, $course->id);
     get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
     $groupbuttons = $course->groupmode;
     $groupbuttonslink = !$course->groupmodeforce;
     if ($ismoving) {
         $strmovehere = get_string('movehere');
         $strmovefull = strip_tags(get_string('movefull', '', "'{$USER->activitycopyname}'"));
         $strcancel = get_string('cancel');
         $stractivityclipboard = $USER->activitycopyname;
     }
     /// Casting $course->modinfo to string prevents one notice when the field is null
     $editbuttons = '';
     if ($ismoving) {
         $this->content->icons[] = '<img src="' . $OUTPUT->pix_url('t/move') . '" class="iconsmall" alt="" />';
         $this->content->items[] = $USER->activitycopyname . '&nbsp;(<a href="' . $CFG->wwwroot . '/course/mod.php?cancelcopy=true&amp;sesskey=' . sesskey() . '">' . $strcancel . '</a>)';
     }
     if (!empty($section->sequence)) {
         $sectionmods = explode(',', $section->sequence);
         $options = array('overflowdiv' => true);
         foreach ($sectionmods as $modnumber) {
             if (empty($mods[$modnumber])) {
                 continue;
             }
             $mod = $mods[$modnumber];
             if (!$ismoving) {
                 if ($groupbuttons) {
                     if (!($mod->groupmodelink = $groupbuttonslink)) {
                         $mod->groupmode = $course->groupmode;
                     }
                 } else {
                     $mod->groupmode = false;
                 }
                 $editbuttons = '<div class="buttons">' . make_editing_buttons($mod, true, true) . '</div>';
             } else {
                 $editbuttons = '';
             }
             if ($mod->visible || has_capability('moodle/course:viewhiddenactivities', $context)) {
                 if ($ismoving) {
                     if ($mod->id == $USER->activitycopy) {
                         continue;
                     }
                     $this->content->items[] = '<a title="' . $strmovefull . '" href="' . $CFG->wwwroot . '/course/mod.php?moveto=' . $mod->id . '&amp;sesskey=' . sesskey() . '">' . '<img style="height:16px; width:80px; border:0px" src="' . $OUTPUT->pix_url('movehere') . '" alt="' . $strmovehere . '" /></a>';
                     $this->content->icons[] = '';
                 }
                 list($content, $instancename) = get_print_section_cm_text($modinfo->cms[$modnumber], $course);
                 $linkcss = $mod->visible ? '' : ' class="dimmed" ';
                 if (!($url = $mod->get_url())) {
                     $this->content->items[] = $content . $editbuttons;
                     $this->content->icons[] = '';
                 } else {
                     //Accessibility: incidental image - should be empty Alt text
                     $icon = '<img src="' . $mod->get_icon_url() . '" class="icon" alt="" />&nbsp;';
                     $this->content->items[] = '<a title="' . $mod->modfullname . '" ' . $linkcss . ' ' . $mod->extra . ' href="' . $url . '">' . $icon . $instancename . '</a>' . $editbuttons;
                 }
             }
         }
     }
//.........这里部分代码省略.........
开发者ID:JP-Git,项目名称:moodle,代码行数:101,代码来源:block_site_main_menu.php


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