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


PHP make_editing_buttons函数代码示例

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


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

示例1: 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

示例2: ss_print_section


//.........这里部分代码省略.........
                        }
                        echo " <span class=\"groupinglabel\">(".format_string($groupings[$mod->groupingid]->name).')</span>';
                    }
                } else {
                    // Display greyed-out text of link
                    echo '<span class="dimmed_text" '.$extra.' ><span class="accesshide">'.
                        get_string('notavailableyet','condition').': </span>'.
                        '<img src="'.$icon.'" class="activityicon" alt="'.get_string('modulename', $mod->modname).'" /> <span>'.
                        $instancename.$altname.'</span></span>';
                }
            }
            if ($usetracking && $mod->modname == 'forum') {
                if ($unread = forum_tp_count_forum_unread_posts($mod, $course)) {
                    echo '<span class="unread"> <a href="'.$CFG->wwwroot.'/mod/forum/view.php?id='.$mod->id.'">';
                    if ($unread == 1) {
                        echo $strunreadpostsone;
                    } else {
                        print_string('unreadpostsnumber', 'forum', $unread);
                    }
                    echo '</a></span>';
                }
            }

            if ($isediting) {
                if ($groupbuttons and plugin_supports('mod', $mod->modname, FEATURE_GROUPS, 0)) {
                    if (! $mod->groupmodelink = $groupbuttonslink) {
                        $mod->groupmode = $course->groupmode;
                    }

                } else {
                    $mod->groupmode = false;
                }
                echo '&nbsp;&nbsp;';
                echo make_editing_buttons($mod, $absolute, true, $mod->indent, $section->section);
                hook_make_edit_icon_button($mod, $OUTPUT);
                
            }

            // Completion
            $completion = $hidecompletion
                ? COMPLETION_TRACKING_NONE
                : $completioninfo->is_enabled($mod);
            if ($completion!=COMPLETION_TRACKING_NONE && isloggedin() &&
                !isguestuser() && $mod->uservisible) {
                $completiondata = $completioninfo->get_data($mod,true);
                $completionicon = '';
                if ($isediting) {
                    switch ($completion) {
                        case COMPLETION_TRACKING_MANUAL :
                            $completionicon = 'manual-enabled'; break;
                        case COMPLETION_TRACKING_AUTOMATIC :
                            $completionicon = 'auto-enabled'; break;
                        default: // wtf
                    }
                } else if ($completion==COMPLETION_TRACKING_MANUAL) {
                    switch($completiondata->completionstate) {
                        case COMPLETION_INCOMPLETE:
                            $completionicon = 'manual-n'; break;
                        case COMPLETION_COMPLETE:
                            $completionicon = 'manual-y'; break;
                    }
                } else { // Automatic
                    switch($completiondata->completionstate) {
                        case COMPLETION_INCOMPLETE:
                            $completionicon = 'auto-n'; break;
                        case COMPLETION_COMPLETE:
开发者ID:noisyjerm,项目名称:moodle-course_format_slides,代码行数:67,代码来源:lib.php

示例3: print_section


//.........这里部分代码省略.........
                } else {
                    $textcss = '';
                }
                $accesstext = '<span class="accesshide">' . get_string('notavailableyet', 'condition') . ': </span>';
                if ($url = $mod->get_url()) {
                    // Display greyed-out text of link
                    echo '<div ' . $textcss . $mod->extra . ' >' . '<img src="' . $mod->get_icon_url() . '" class="activityicon" alt="' . $modulename . '" /> <span>' . $instancename . $altname . '</span></div>';
                    // Do not display content after link when it is greyed out like this.
                } else {
                    // No link, so display only content (also greyed)
                    $contentpart = '<div ' . $textcss . $mod->extra . '>' . $accesstext . $content . '</div>';
                }
            }
            // Module can put text after the link (e.g. forum unread)
            echo $mod->get_after_link();
            // If there is content but NO link (eg label), then display the
            // content here (BEFORE any icons). In this case cons must be
            // displayed after the content so that it makes more sense visually
            // and for accessibility reasons, e.g. if you have a one-line label
            // it should work similarly (at least in terms of ordering) to an
            // activity.
            if (empty($url)) {
                echo $contentpart;
            }
            if ($isediting) {
                if ($groupbuttons and plugin_supports('mod', $mod->modname, FEATURE_GROUPS, 0)) {
                    if (!($mod->groupmodelink = $groupbuttonslink)) {
                        $mod->groupmode = $course->groupmode;
                    }
                } else {
                    $mod->groupmode = false;
                }
                echo '&nbsp;&nbsp;';
                echo make_editing_buttons($mod, $absolute, true, $mod->indent, $section->section);
                echo $mod->get_after_edit_icons();
            }
            // Completion
            $completion = $hidecompletion ? COMPLETION_TRACKING_NONE : $completioninfo->is_enabled($mod);
            if ($completion != COMPLETION_TRACKING_NONE && isloggedin() && !isguestuser() && $mod->uservisible) {
                $completiondata = $completioninfo->get_data($mod, true);
                $completionicon = '';
                if ($isediting) {
                    switch ($completion) {
                        case COMPLETION_TRACKING_MANUAL:
                            $completionicon = 'manual-enabled';
                            break;
                        case COMPLETION_TRACKING_AUTOMATIC:
                            $completionicon = 'auto-enabled';
                            break;
                        default:
                            // wtf
                    }
                } else {
                    if ($completion == COMPLETION_TRACKING_MANUAL) {
                        switch ($completiondata->completionstate) {
                            case COMPLETION_INCOMPLETE:
                                $completionicon = 'manual-n';
                                break;
                            case COMPLETION_COMPLETE:
                                $completionicon = 'manual-y';
                                break;
                        }
                    } else {
                        // Automatic
                        switch ($completiondata->completionstate) {
                            case COMPLETION_INCOMPLETE:
开发者ID:numbas,项目名称:moodle,代码行数:67,代码来源:lib.php

示例4: print_section_newsroom


//.........这里部分代码省略.........
                if ('resource' == $mod->modname) {
                    if (!empty($modinfo->cms[$modnumber]->icon)) {
                        $possaltname = $modinfo->cms[$modnumber]->icon;
                        $mimetype = mimeinfo_from_icon('type', $possaltname);
                        $altname = get_mimetype_description($mimetype);
                    } else {
                        $altname = $mod->modfullname;
                    }
                } else {
                    $altname = $mod->modfullname;
                }
                // Avoid unnecessary duplication.
                if (false !== stripos($instancename, $altname)) {
                    $altname = '';
                }
                // File type after name, for alphabetic lists (screen reader).
                if ($altname) {
                    $altname = get_accesshide(' ' . $altname);
                }
                $linkcss = $mod->visible ? "" : " class=\"dimmed\" ";
                echo '<a ' . $linkcss . ' ' . $extra . ' href="' . $CFG->wwwroot . '/mod/' . $mod->modname . '/view.php?id=' . $mod->id . '">' . '<img src="' . $icon . '" class="activityicon" alt="" /> <span>' . $instancename . $altname . '</span></a>';
                //echo " $mod->modname ";
                // Special NEWSPAPER magic ... show summry from resource and blog's 200 chars from each post OUBlog (nadavkav)
                if ($mod->modname == 'resource') {
                    $article = get_record('resource', 'id', $mod->instance);
                    //print_r($article );
                    echo "{$article->summary}";
                }
                if ($mod->modname == 'oublog') {
                    require_once $CFG->dirroot . '/mod/oublog/locallib.php';
                    $oublog = get_record('oublog', 'id', $mod->instance);
                    if (!($oublogcm = get_coursemodule_from_instance('oublog', $oublog->id))) {
                        //error("Course module ID was incorrect");
                    }
                    $oublogcontext = get_context_instance(CONTEXT_MODULE, $oublogcm->id);
                    //oublog_check_view_permissions($oublog, $oublogcontext, $oublogcm);
                    $currentgroup = oublog_get_activity_group($oublogcm, true);
                    echo '<br/>';
                    /// Get Posts
                    list($posts, $recordcount) = oublog_get_posts($oublog, $oublogcontext, 0, $oublogcm, $currentgroup);
                    //, -1, $oubloguser->id, $tag, $canaudit);
                    $i = 0;
                    foreach ($posts as $post) {
                        if ($i < 3) {
                            echo '<a href="' . $CFG->wwwroot . '/mod/oublog/viewpost.php?blog=' . $oublog->id . '&post=' . $post->id . '">' . $post->title . '</a><br/>';
                            $summaryformatoptions->noclean = false;
                            echo mb_substr(format_text($post->message, FORMAT_HTML, $summaryformatoptions), 1, 600) . "<hr/>";
                        }
                        if ($i > 2 and $i < 6) {
                            echo '<a href="' . $CFG->wwwroot . '/mod/oublog/viewpost.php?blog=' . $oublog->id . '&post=' . $post->id . '">' . $post->title . '</a><br/>';
                        }
                        $i++;
                    }
                    //print_r($article );
                    //echo "$article->summary";
                    echo '<br/><a ' . $linkcss . ' ' . $extra . ' href="' . $CFG->wwwroot . '/mod/' . $mod->modname . '/view.php?id=' . $mod->id . '">' . '<img src="' . $icon . '" class="activityicon" alt="" /> <span>' . get_string('more', 'format_newsroom') . '</span></a>';
                }
                if (!empty($CFG->enablegroupings) && !empty($mod->groupingid) && has_capability('moodle/course:managegroups', get_context_instance(CONTEXT_COURSE, $course->id))) {
                    if (!isset($groupings)) {
                        $groupings = groups_get_all_groupings($course->id);
                    }
                    echo " <span class=\"groupinglabel\">(" . format_string($groupings[$mod->groupingid]->name) . ')</span>';
                }
            }
            if ($usetracking && $mod->modname == 'forum') {
                if ($unread = forum_tp_count_forum_unread_posts($mod, $course)) {
                    echo '<span class="unread"> <a href="' . $CFG->wwwroot . '/mod/forum/view.php?id=' . $mod->id . '">';
                    if ($unread == 1) {
                        echo $strunreadpostsone;
                    } else {
                        print_string('unreadpostsnumber', 'forum', $unread);
                    }
                    echo '</a></span>';
                }
            }
            if ($isediting) {
                // TODO: we must define this as mod property!
                if ($groupbuttons and $mod->modname != 'label' and $mod->modname != 'resource' and $mod->modname != 'glossary') {
                    if (!($mod->groupmodelink = $groupbuttonslink)) {
                        $mod->groupmode = $course->groupmode;
                    }
                } else {
                    $mod->groupmode = false;
                }
                echo '&nbsp;&nbsp;';
                echo make_editing_buttons($mod, $absolute, true, $mod->indent, $section->section);
            }
            echo "</li>\n";
        }
    } elseif ($ismoving) {
        echo "<ul class=\"section\">\n";
    }
    if ($ismoving) {
        echo '<li><a title="' . $strmovefull . '"' . ' href="' . $CFG->wwwroot . '/course/mod.php?movetosection=' . $section->id . '&amp;sesskey=' . $USER->sesskey . '">' . '<img class="movetarget" src="' . $CFG->pixpath . '/movehere.gif" ' . ' alt="' . $strmovehere . '" /></a></li>
             ';
    }
    if (!empty($section->sequence) || $ismoving) {
        echo "</ul><!--class='section'-->\n\n";
    }
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:101,代码来源:format.php

示例5: send_response

 /**
  * Send the details of the newly created activity back to the client browser
  *
  * @param cm_info $mod details of the mod just created
  */
 protected function send_response($mod)
 {
     global $OUTPUT;
     $resp = new stdClass();
     $resp->error = self::ERROR_OK;
     $resp->icon = $mod->get_icon_url()->out();
     $resp->name = $mod->name;
     $resp->link = $mod->get_url()->out();
     $resp->elementid = 'module-' . $mod->id;
     $resp->commands = make_editing_buttons($mod, true, true, 0, $mod->sectionnum);
     $resp->onclick = $mod->get_on_click();
     // if using groupings, then display grouping name
     if (!empty($mod->groupingid) && has_capability('moodle/course:managegroups', $this->context)) {
         $groupings = groups_get_all_groupings($this->course->id);
         $resp->groupingname = format_string($groupings[$mod->groupingid]->name);
     }
     echo $OUTPUT->header();
     echo json_encode($resp);
     die;
 }
开发者ID:vinoth4891,项目名称:clinique,代码行数:25,代码来源:dnduploadlib.php

示例6: 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

示例7: send_response

 /**
  * Send the details of the newly created activity back to the client browser
  *
  * @param cm_info $mod details of the mod just created
  */
 protected function send_response($mod)
 {
     global $OUTPUT;
     $resp = new stdClass();
     $resp->error = self::ERROR_OK;
     $resp->icon = $mod->get_icon_url()->out();
     $resp->name = $mod->name;
     $resp->link = $mod->get_url()->out();
     $resp->elementid = 'module-' . $mod->id;
     $resp->commands = make_editing_buttons($mod, true, true, 0, $mod->sectionnum);
     $resp->onclick = $mod->get_on_click();
     echo $OUTPUT->header();
     echo json_encode($resp);
     die;
 }
开发者ID:nicusX,项目名称:moodle,代码行数:20,代码来源:dnduploadlib.php

示例8: 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

示例9: stdClass

}
// END UCLA MOD - CCLE-2769
// Trigger mod_created event with information about this module.
$eventdata = new stdClass();
$eventdata->modulename = $data->modulename;
$eventdata->name = $data->name;
$eventdata->cmid = $data->coursemodule;
$eventdata->courseid = $course->id;
$eventdata->userid = $USER->id;
events_trigger('mod_created', $eventdata);
add_to_log($course->id, "course", "add mod", "../mod/{$data->modulename}/view.php?id={$data->coursemodule}", "{$data->modulename} {$data->instance}");
add_to_log($course->id, $data->modulename, "add", "view.php?id={$data->coursemodule}", "{$data->instance}", $data->coursemodule);
rebuild_course_cache($course->id);
$resp = new stdClass();
$resp->error = 0;
$resp->icon = $icon;
$resp->name = $displayname;
$resp->link = new moodle_url("/mod/{$data->modulename}/view.php", array('id' => $data->coursemodule)) . '';
$resp->elementid = 'module-' . $data->coursemodule;
// START UCLA MOD - CCLE-2769 - Drag and drop file upload block on M2
// get name of grouping (if any)
if (!empty($groupingid)) {
    $groupings = groups_get_all_groupings($course->id);
    $resp->groupname = format_string($groupings[$groupingid]->name);
}
// END UCLA MOD - CCLE-2769
$data->id = $data->coursemodule;
$data->groupmodelink = false;
// Resources never have group modes
$resp->commands = make_editing_buttons($data, true, true, 0, $section);
echo json_encode($resp);
开发者ID:rlorenzo,项目名称:moodle-block_dndupload,代码行数:31,代码来源:upload.php

示例10: print_section_fn


//.........这里部分代码省略.........
                         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>";
                         }
                     }
                 } else {
                     if (!$isediting && $mod->modname == 'forum' && isset($this->course->expforumsec) && $this->course->expforumsec == $section->section) {
                         $page = optional_param('page', 0, PARAM_INT);
                         $changegroup = isset($_GET['group']) ? $_GET['group'] : -1;
                         // Group change requested?
                         $forum = get_record("forum", "id", $mod->instance);
                         $groupmode = groupmode($this->course, $mod);
                         // Groups are being used
                         $currentgroup = get_and_set_current_group($this->course, $groupmode, $changegroup);
                         forum_print_latest_discussions($this->course, $forum, $CFG->forum_manydiscussions, 'header', '', $currentgroup, $groupmode, $page);
                     } else {
                         // Normal activity
                         if (!$isteacher && !empty($this->course->activitytracking)) {
                             $act_compl = is_activity_complete($mod, $USER->id);
                             if ($act_compl === false) {
                                 echo ' <img src="' . $CFG->wwwroot . '/course/format/' . $this->course->format . '/pix/incomplete.gif" ' . 'height="16" width="16" alt="Activity Not Completed" hspace="10" ' . 'title="Activity Not Completed">';
                             } else {
                                 if ($act_compl === true || is_int($act_compl) && $act_compl >= 50) {
                                     echo ' <img src="' . $CFG->wwwroot . '/course/format/' . $this->course->format . '/pix/completed.gif" ' . 'height="16" width="16" alt="Activity Completed" hspace="10" ' . 'title="Activity Completed">';
                                 } else {
                                     if (is_int($act_compl)) {
                                         echo ' <img src="' . $CFG->wwwroot . '/course/format/' . $this->course->format . '/pix/completedpoor.gif" ' . 'height="16" width="16" alt="Activity Completed Poorly" hspace="10" ' . 'title="Activity Completed Poorly">';
                                     } else {
                                         if ($act_compl == 'submitted') {
                                             echo ' <img src="' . $CFG->wwwroot . '/course/format/' . $this->course->format . '/pix/submitted.gif" ' . 'height="16" width="16" alt="Activity Submitted" hspace="10" ' . 'title="Activity Submitted">';
                                         }
                                     }
                                 }
                             }
                         }
                         $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>";
                     }
                 }
                 if ($usetracking && $mod->modname == 'forum') {
                     if ($unread = forum_tp_count_forum_unread_posts($mod, $this->course)) {
                         echo '<span class="unread"> <a href="' . $CFG->wwwroot . '/mod/forum/view.php?id=' . $mod->id . '">';
                         if ($unread == 1) {
                             echo $strunreadpostsone;
                         } else {
                             print_string('unreadpostsnumber', 'forum', $unread);
                         }
                         echo '</a></span>';
                     }
                 }
                 if ($isediting) {
                     // TODO: we must define this as mod property!
                     if ($groupbuttons and $mod->modname != 'label' and $mod->modname != 'resource' and $mod->modname != 'glossary') {
                         if (!($mod->groupmodelink = $groupbuttonslink)) {
                             $mod->groupmode = $course->groupmode;
                         }
                     } else {
                         $mod->groupmode = false;
                     }
                     echo "&nbsp;&nbsp;";
                     echo make_editing_buttons($mod, $absolute, true, $mod->indent, $section->section);
                     //                        echo make_editing_buttons($mod, $absolute, true, $mod->indent);
                     if (isadmin()) {
                         if (empty($THEME->custompix)) {
                             $pixpath = $CFG->wwwroot . '/pix';
                         } else {
                             $pixpath = $CFG->wwwroot . '/theme/' . $CFG->theme . '/pix';
                         }
                         if ($mod->hideingradebook) {
                             echo '<a title="Show Grades" href="' . $CFG->wwwroot . '/course/view.php?id=' . $this->course->id . '&hidegrades=0&mid=' . $mod->id . '&amp;sesskey=' . $USER->sesskey . '">' . '<img src="' . $CFG->wwwroot . '/course/format/' . $this->course->format . '/pix/hidegrades.gif" hspace="2" height="11" width="11" border="0" /></a>';
                         } else {
                             echo '<a title="Hide Grades" href="' . $CFG->wwwroot . '/course/view.php?id=' . $this->course->id . '&hidegrades=1&mid=' . $mod->id . '&amp;sesskey=' . $USER->sesskey . '">' . '<img src="' . $CFG->wwwroot . '/course/format/' . $this->course->format . '/pix/showgrades.gif" hspace="2" height="11" width="11" border="0" /></a>';
                         }
                         if (!empty($this->course->usemandatory)) {
                             if ($mod->mandatory) {
                                 echo '<a title="Mandatory off" href="' . $CFG->wwwroot . '/course/format/' . $this->course->format . '/mod.php?mandatory=0&id=' . $mod->id . '&amp;sesskey=' . $USER->sesskey . '">' . '<img src="' . $CFG->wwwroot . '/course/format/' . $this->course->format . '/pix/lock.gif" hspace="2" height="11" width="11" border="0" /></a>';
                             } else {
                                 echo '<a title="Mandatory on" href="' . $CFG->wwwroot . '/course/format/' . $this->course->format . '/mod.php?mandatory=1&id=' . $mod->id . '&amp;sesskey=' . $USER->sesskey . '">' . '<img src="' . $CFG->wwwroot . '/course/format/' . $this->course->format . '/pix/unlock.gif" hspace="2" height="11" width="11" border="0" /></a>';
                             }
                         }
                     }
                 }
                 echo "</td>";
                 echo "</tr>";
             }
         }
     }
     if ($ismoving) {
         echo "<tr><td><a title=\"{$strmovefull}\"" . " href=\"mod.php?movetosection={$section->id}" . '&amp;sesskey=' . $USER->sesskey . '">' . "<img height=\"16\" width=\"80\" src=\"{$CFG->pixpath}/movehere.gif\" " . " alt=\"{$strmovehere}\" border=\"0\"></a></td></tr>\n";
     }
     echo "</table>\n\n";
     //    return $mandatorypopup;
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:101,代码来源:course_format_fn.class.php

示例11: print_section_dblistview


//.........这里部分代码省略.........
                // Avoid unnecessary duplication.
                if (false !== stripos($instancename, $altname)) {
                    $altname = '';
                }
                // File type after name, for alphabetic lists (screen reader).
                if ($altname) {
                    $altname = get_accesshide(' ' . $altname);
                }
                $linkcss = $mod->visible ? "" : " class=\"dimmed\" ";
                if ($mod->modname != 'data') {
                    echo '<a ' . $linkcss . ' ' . $extra . ' href="' . $CFG->wwwroot . '/mod/' . $mod->modname . '/view.php?id=' . $mod->id . '">' . '<img src="' . $icon . '" class="activityicon" alt="" /> <span>' . $instancename . $altname . '</span></a>';
                }
                //echo " $mod->modname ";
                // Special DBLISTVIEW magic ... show summry from resource and blog's 200 chars from each post OUBlog (nadavkav)
                if ($mod->modname == 'resource') {
                    $article = get_record('resource', 'id', $mod->instance);
                    //print_r($article );
                    echo "{$article->summary}";
                }
                if ($mod->modname == 'data') {
                    require_once $CFG->dirroot . '/mod/data/lib.php';
                    if (!($data = get_record('data', 'id', $mod->instance))) {
                        //error('Course module is incorrect');
                    }
                    $sort = 0;
                    $what = ' DISTINCT r.id, r.approved, r.timecreated, r.timemodified, r.userid, u.firstname, u.lastname ';
                    $count = ' COUNT(DISTINCT c.recordid) ';
                    $tables = $CFG->prefix . 'data_content c,' . $CFG->prefix . 'data_records r,' . $CFG->prefix . 'data_content cs, ' . $CFG->prefix . 'user u ';
                    $where = 'WHERE c.recordid = r.id AND r.dataid = ' . $data->id . ' AND r.userid = u.id ';
                    $sortorder = ' ORDER BY r.id ASC ';
                    $searchselect = '';
                    // If requiredentries is not reached, only show current user's entries
                    //if (!$requiredentries_allowed) {
                    //    $where .= ' AND u.id = ' . $USER->id;
                    //}
                    /// To actually fetch the records
                    //$fromsql    = "FROM $tables $advtables $where $advwhere $groupselect $approveselect $searchselect $advsearchselect";
                    $fromsql = "FROM {$tables} {$where} ";
                    $sqlselect = "SELECT {$what} {$fromsql} {$sortorder}";
                    /// Get the actual records
                    if (!($records = get_records_sql($sqlselect))) {
                        // Nothing to show!
                    }
                    if (empty($data->listtemplate)) {
                        //notify(get_string('nolisttemplate','data'));
                        //data_generate_default_template($data, 'listtemplate', 0, false, false);
                    }
                    echo $data->listtemplateheader;
                    data_print_template('listtemplate', $records, $data);
                    echo $data->listtemplatefooter;
                    //print_r($article );
                    //echo "$article->summary";
                    echo '<hr/><a ' . $linkcss . ' ' . $extra . ' href="' . $CFG->wwwroot . '/mod/' . $mod->modname . '/view.php?id=' . $mod->id . '">' . '<img src="' . $icon . '" class="activityicon" alt="" /> <span>' . get_string('more', 'format_dblistview') . '</span></a>';
                    if (!empty($data->csstemplate)) {
                        echo '<style>' . $data->csstemplate . '</style>';
                    }
                }
                if (!empty($CFG->enablegroupings) && !empty($mod->groupingid) && has_capability('moodle/course:managegroups', get_context_instance(CONTEXT_COURSE, $course->id))) {
                    if (!isset($groupings)) {
                        $groupings = groups_get_all_groupings($course->id);
                    }
                    echo " <span class=\"groupinglabel\">(" . format_string($groupings[$mod->groupingid]->name) . ')</span>';
                }
            }
            if ($usetracking && $mod->modname == 'forum') {
                if ($unread = forum_tp_count_forum_unread_posts($mod, $course)) {
                    echo '<span class="unread"> <a href="' . $CFG->wwwroot . '/mod/forum/view.php?id=' . $mod->id . '">';
                    if ($unread == 1) {
                        echo $strunreadpostsone;
                    } else {
                        print_string('unreadpostsnumber', 'forum', $unread);
                    }
                    echo '</a></span>';
                }
            }
            if ($isediting) {
                // TODO: we must define this as mod property!
                if ($groupbuttons and $mod->modname != 'label' and $mod->modname != 'resource' and $mod->modname != 'glossary') {
                    if (!($mod->groupmodelink = $groupbuttonslink)) {
                        $mod->groupmode = $course->groupmode;
                    }
                } else {
                    $mod->groupmode = false;
                }
                echo '&nbsp;&nbsp;';
                echo make_editing_buttons($mod, $absolute, true, $mod->indent, $section->section);
            }
            echo "</li>\n";
        }
    } elseif ($ismoving) {
        echo "<ul class=\"section\">\n";
    }
    if ($ismoving) {
        echo '<li><a title="' . $strmovefull . '"' . ' href="' . $CFG->wwwroot . '/course/mod.php?movetosection=' . $section->id . '&amp;sesskey=' . $USER->sesskey . '">' . '<img class="movetarget" src="' . $CFG->pixpath . '/movehere.gif" ' . ' alt="' . $strmovehere . '" /></a></li>
             ';
    }
    if (!empty($section->sequence) || $ismoving) {
        echo "</ul><!--class='section'-->\n\n";
    }
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:101,代码来源:format.php


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