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


PHP print_course函数代码示例

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


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

示例1: print_entry

 function print_entry($course)
 {
     global $CFG, $USER;
     $strloginto = get_string("loginto", "", $course->shortname);
     $strcourses = get_string("courses");
     $teacher = get_teacher($course->id);
     if ((double) $course->cost < 0) {
         $cost = (double) $CFG->enrol_cost;
     } else {
         $cost = (double) $course->cost;
     }
     if (abs($cost) < 0.01) {
         // no cost, default to base class entry to course
         $manual = enrolment_factory::factory('manual');
         $manual->print_entry($course);
     } else {
         $navlinks = array();
         $navlinks[] = array('name' => $strcourses, 'link' => "{$CFG->wwwroot}/course", 'type' => 'misc');
         $navlinks[] = array('name' => $strloginto, 'link' => null, 'type' => 'misc');
         $navigation = build_navigation($navlinks);
         print_header($strloginto, $course->fullname, $navigation);
         print_course($course, "80%");
         if ($course->password) {
             // Presenting two options
             print_heading(get_string('costorkey', 'enrol_paypal'), 'center');
         }
         print_simple_box_start("center");
         if ($USER->username == 'guest') {
             // force login only for guest user, not real users with guest role
             if (empty($CFG->loginhttps)) {
                 $wwwroot = $CFG->wwwroot;
             } else {
                 // This actually is not so secure ;-), 'cause we're
                 // in unencrypted connection...
                 $wwwroot = str_replace("http://", "https://", $CFG->wwwroot);
             }
             echo '<div align="center"><p>' . get_string('paymentrequired') . '</p>';
             echo '<p><b>' . get_string('cost') . ": {$CFG->enrol_currency} {$cost}" . '</b></p>';
             echo '<p><a href="' . $wwwroot . '/login/">' . get_string('loginsite') . '</a></p>';
             echo '</div>';
         } else {
             //Sanitise some fields before building the PayPal form
             $coursefullname = $course->fullname;
             $courseshortname = $course->shortname;
             $userfullname = fullname($USER);
             $userfirstname = $USER->firstname;
             $userlastname = $USER->lastname;
             $useraddress = $USER->address;
             $usercity = $USER->city;
             include $CFG->dirroot . '/enrol/paypal/enrol.html';
         }
         print_simple_box_end();
         if ($course->password) {
             // Second option
             $password = '';
             include $CFG->dirroot . '/enrol/manual/enrol.html';
         }
         print_footer();
     }
 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:60,代码来源:enrol.php

示例2: print_entry

 /**
 * Prints the entry form/page for this enrolment
 *
 * This is only called from course/enrol.php
 * Most plugins will probably override this to print payment
 * forms etc, or even just a notice to say that manual enrolment
 * is disabled
 *
 * @param    course  current course object
 */
 function print_entry($course)
 {
     global $CFG, $USER, $SESSION, $THEME;
     $strloginto = get_string('loginto', '', $course->shortname);
     $strcourses = get_string('courses');
     /// Automatically enrol into courses without password
     $context = get_context_instance(CONTEXT_SYSTEM);
     $navlinks = array();
     $navlinks[] = array('name' => $strcourses, 'link' => ".", 'type' => 'misc');
     $navlinks[] = array('name' => $strloginto, 'link' => null, 'type' => 'misc');
     $navigation = build_navigation($navlinks);
     if ($course->password == '') {
         // no password, so enrol
         if (has_capability('moodle/legacy:guest', $context, $USER->id, false)) {
             add_to_log($course->id, 'course', 'guest', 'view.php?id=' . $course->id, getremoteaddr());
         } else {
             if (empty($_GET['confirm']) && empty($_GET['cancel'])) {
                 print_header($strloginto, $course->fullname, $navigation);
                 echo '<br />';
                 notice_yesno(get_string('enrolmentconfirmation'), "enrol.php?id={$course->id}&amp;confirm=1", "enrol.php?id={$course->id}&amp;cancel=1");
                 print_footer();
                 exit;
             } else {
                 if (!empty($_GET['confirm'])) {
                     if (!enrol_into_course($course, $USER, 'manual')) {
                         print_error('couldnotassignrole');
                     }
                     // force a refresh of mycourses
                     unset($USER->mycourses);
                     if (!empty($SESSION->wantsurl)) {
                         $destination = $SESSION->wantsurl;
                         unset($SESSION->wantsurl);
                     } else {
                         $destination = "{$CFG->wwwroot}/course/view.php?id={$course->id}";
                     }
                     redirect($destination);
                 } else {
                     if (!empty($_GET['cancel'])) {
                         unset($SESSION->wantsurl);
                         if (!empty($SESSION->enrolcancel)) {
                             $destination = $SESSION->enrolcancel;
                             unset($SESSION->enrolcancel);
                         } else {
                             $destination = $CFG->wwwroot;
                         }
                         redirect($destination);
                     }
                 }
             }
         }
     }
     // if we get here we are going to display the form asking for the enrolment key
     // and (hopefully) provide information about who to ask for it.
     if (!isset($password)) {
         $password = '';
     }
     print_header($strloginto, $course->fullname, $navigation, "form.password");
     print_course($course, "80%");
     include "{$CFG->dirroot}/enrol/manual/enrol.html";
     print_footer();
 }
开发者ID:kai707,项目名称:ITSA-backup,代码行数:71,代码来源:enrol.php

示例3: print_entry

 /**
  * Presents registration forms.
  *
  * @param object $course Course info
  * @access public
  */
 function print_entry($course)
 {
     global $CFG, $USER, $form;
     $zerocost = zero_cost($course);
     if ($zerocost) {
         $manual = enrolment_factory::factory('manual');
         if (!empty($this->errormsg)) {
             $manual->errormsg = $this->errormsg;
         }
         $manual->print_entry($course);
         return;
     }
     prevent_double_paid($course);
     httpsrequired();
     if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] != 443) {
         // MDL-9836
         if (empty($CFG->loginhttps)) {
             print_error('httpsrequired', 'enrol_authorize');
         } else {
             $wwwsroot = str_replace('http:', 'https:', $CFG->wwwroot);
             redirect("{$wwwsroot}/course/enrol.php?id={$course->id}");
             exit;
         }
     }
     $strcourses = get_string('courses');
     $strloginto = get_string('loginto', '', $course->shortname);
     $navlinks = array();
     $navlinks[] = array('name' => $strcourses, 'link' => "{$CFG->wwwroot}/course/", 'type' => 'misc');
     $navlinks[] = array('name' => $strloginto, 'link' => null, 'type' => 'misc');
     $navigation = build_navigation($navlinks);
     print_header($strloginto, $course->fullname, $navigation);
     print_course($course, '80%');
     if ($course->password) {
         print_heading(get_string('choosemethod', 'enrol_authorize'), 'center');
     }
     print_simple_box_start('center', '80%');
     if ($USER->username == 'guest') {
         // only real guest user, not for users with guest role
         $curcost = get_course_cost($course);
         echo '<div class="mdl-align">';
         echo '<p>' . get_string('paymentrequired') . '</p>';
         echo '<p><b>' . get_string('cost') . ": {$curcost['currency']} {$curcost['cost']}" . '</b></p>';
         echo '<p><a href="' . $CFG->httpswwwroot . '/login/">' . get_string('loginsite') . '</a></p>';
         echo '</div>';
     } else {
         require_once $CFG->dirroot . '/enrol/authorize/enrol_form.php';
         $frmenrol = new enrol_authorize_form('enrol.php', compact('course'));
         if ($frmenrol->get_data()) {
             $authorizeerror = '';
             switch ($form->paymentmethod) {
                 case AN_METHOD_CC:
                     $authorizeerror = $this->cc_submit($form, $course);
                     break;
                 case AN_METHOD_ECHECK:
                     $authorizeerror = $this->echeck_submit($form, $course);
                     break;
             }
             if (!empty($authorizeerror)) {
                 error($authorizeerror);
             }
         }
         $frmenrol->display();
     }
     print_simple_box_end();
     if ($course->password) {
         $password = '';
         include $CFG->dirroot . '/enrol/manual/enrol.html';
     }
     print_footer();
 }
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:76,代码来源:enrol.php

示例4: print_my_moodle

/**
 * Prints custom user information on the home page.
 * Over time this can include all sorts of information
 */
function print_my_moodle()
{
    global $USER, $CFG, $DB, $OUTPUT;
    if (!isloggedin() or isguestuser()) {
        print_error('nopermissions', '', '', 'See My Moodle');
    }
    $courses = enrol_get_my_courses('summary', 'visible DESC,sortorder ASC');
    $rhosts = array();
    $rcourses = array();
    if (!empty($CFG->mnet_dispatcher_mode) && $CFG->mnet_dispatcher_mode === 'strict') {
        $rcourses = get_my_remotecourses($USER->id);
        $rhosts = get_my_remotehosts();
    }
    if (!empty($courses) || !empty($rcourses) || !empty($rhosts)) {
        if (!empty($courses)) {
            echo '<ul class="unlist">';
            foreach ($courses as $course) {
                if ($course->id == SITEID) {
                    continue;
                }
                echo '<li>';
                print_course($course);
                echo "</li>\n";
            }
            echo "</ul>\n";
        }
        // MNET
        if (!empty($rcourses)) {
            // at the IDP, we know of all the remote courses
            foreach ($rcourses as $course) {
                print_remote_course($course, "100%");
            }
        } elseif (!empty($rhosts)) {
            // non-IDP, we know of all the remote servers, but not courses
            foreach ($rhosts as $host) {
                print_remote_host($host, "100%");
            }
        }
        unset($course);
        unset($host);
        if ($DB->count_records("course") > count($courses) + 1) {
            // Some courses not being displayed
            echo "<table width=\"100%\"><tr><td align=\"center\">";
            print_course_search("", false, "short");
            echo "</td><td align=\"center\">";
            echo $OUTPUT->single_button("{$CFG->wwwroot}/course/index.php", get_string("fulllistofcourses"), "get");
            echo "</td></tr></table>\n";
        }
    } else {
        if ($DB->count_records("course_categories") > 1) {
            echo $OUTPUT->box_start("categorybox");
            print_whole_category_list();
            echo $OUTPUT->box_end();
        } else {
            print_courses(0);
        }
    }
}
开发者ID:numbas,项目名称:moodle,代码行数:62,代码来源:lib.php

示例5: sesskey

         $modulelink = "&amp;blocklist=" . $blocklist . "&amp;sesskey=" . sesskey();
     }
 }
 print_navigation_bar($totalcount, $page, $perpage, $encodedsearch, $modulelink);
 // Show list of courses
 if (!$adminediting) {
     //Not editing mode
     foreach ($courses as $course) {
         // front page don't belong to any category and block can exist.
         if ($course->category > 0) {
             $course->summary .= "<br /><p class=\"category\">";
             $course->summary .= "{$strcategory}: <a href=\"category.php?id={$course->category}\">";
             $course->summary .= $displaylist[$course->category];
             $course->summary .= "</a></p>";
         }
         print_course($course, $search);
         echo $OUTPUT->spacer(array('height' => 5, 'width' => 5, 'br' => true));
         // should be done with CSS instead
     }
 } else {
     // Editing mode
     echo "<form id=\"movecourses\" action=\"search.php\" method=\"post\">\n";
     echo "<div><input type=\"hidden\" name=\"sesskey\" value=\"" . sesskey() . "\" />\n";
     echo "<input type=\"hidden\" name=\"search\" value=\"" . s($search) . "\" />\n";
     echo "<input type=\"hidden\" name=\"page\" value=\"{$page}\" />\n";
     echo "<input type=\"hidden\" name=\"perpage\" value=\"{$perpage}\" /></div>\n";
     if (!empty($modulelist) and confirm_sesskey()) {
         echo "<input type=\"hidden\" name=\"modulelist\" value=\"{$modulelist}\" /></div>\n";
     } else {
         if (!empty($blocklist) and confirm_sesskey()) {
             echo "<input type=\"hidden\" name=\"blocklist\" value=\"{$blocklist}\" /></div>\n";
开发者ID:vinoth4891,项目名称:clinique,代码行数:31,代码来源:search.php

示例6: get_string

// If only one anchor is present, no <a href /> is needed
if ($countanchors == 0) {
    echo '<div class="relatedpages"><p>' . get_string('noresultsfor', 'tag', $tagname) . '</p></div>';
} elseif ($countanchors > 1) {
    echo '<div class="relatedpages"><p>' . $relatedpageslink . '</p></div>';
}
// Display courses tagged with the tag
if (!empty($courses)) {
    $totalcount = count($courses);
    echo $OUTPUT->box_start('generalbox', 'tag-blogs');
    //could use an id separate from tag-blogs, but would have to copy the css style to make it look the same
    $heading = get_string('courses') . ' ' . get_string('taggedwith', 'tag', $tagname) . ': ' . $totalcount;
    echo "<a name='course'></a>";
    echo $OUTPUT->heading($heading, 3);
    foreach ($courses as $course) {
        print_course($course);
    }
    echo $OUTPUT->box_end();
}
// Print up to 10 previous blogs entries
if (!empty($blogs)) {
    echo $OUTPUT->box_start('generalbox', 'tag-blogs');
    $heading = get_string('relatedblogs', 'tag', $tagname) . ' ' . get_string('taggedwith', 'tag', $tagname);
    echo "<a name='blog'></a>";
    echo $OUTPUT->heading($heading, 3);
    echo '<ul id="tagblogentries">';
    foreach ($blogs as $blog) {
        if ($blog->publishstate == 'draft') {
            $class = 'class="dimmed"';
        } else {
            $class = '';
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:31,代码来源:index.php

示例7: print_my_moodle

function print_my_moodle()
{
    /// Prints custom user information on the home page.
    /// Over time this can include all sorts of information
    global $USER, $CFG;
    if (empty($USER->id)) {
        error("It shouldn't be possible to see My Moodle without being logged in.");
    }
    $courses = get_my_courses($USER->id, 'visible DESC,sortorder ASC', array('summary'));
    $rhosts = array();
    $rcourses = array();
    if (!empty($CFG->mnet_dispatcher_mode) && $CFG->mnet_dispatcher_mode === 'strict') {
        $rcourses = get_my_remotecourses($USER->id);
        $rhosts = get_my_remotehosts();
    }
    if (!empty($courses) || !empty($rcourses) || !empty($rhosts)) {
        if (!empty($courses)) {
            echo '<ul class="unlist">';
            foreach ($courses as $course) {
                if ($course->id == SITEID) {
                    continue;
                }
                echo '<li>';
                print_course($course);
                echo "</li>\n";
            }
            echo "</ul>\n";
        }
        // MNET
        if (!empty($rcourses)) {
            // at the IDP, we know of all the remote courses
            foreach ($rcourses as $course) {
                print_remote_course($course, "100%");
            }
        } elseif (!empty($rhosts)) {
            // non-IDP, we know of all the remote servers, but not courses
            foreach ($rhosts as $host) {
                print_remote_host($host, "100%");
            }
        }
        unset($course);
        unset($host);
        if (count_records("course") > count($courses) + 1) {
            // Some courses not being displayed
            echo "<table width=\"100%\"><tr><td align=\"center\">";
            print_course_search("", false, "short");
            echo "</td><td align=\"center\">";
            print_single_button("{$CFG->wwwroot}/course/index.php", NULL, get_string("fulllistofcourses"), "get");
            echo "</td></tr></table>\n";
        }
    } else {
        if (count_records("course_categories") > 1) {
            print_simple_box_start("center", "100%", "#FFFFFF", 5, "categorybox");
            print_whole_category_list();
            print_simple_box_end();
        } else {
            print_courses(0);
        }
    }
}
开发者ID:arshanam,项目名称:Moodle-ITScholars-LMS,代码行数:60,代码来源:lib.php

示例8: fn_display_category_content


//.........这里部分代码省略.........
        $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) {
        echo '<tr><td><a title="' . $strmovefull . '" href="' . $CFG->wwwroot . '/course/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>';
    }
    if ($isediting && $modnames) {
        echo '<tr><td>';
        print_section_add_menus($course, $section->section, $modnames, true);
        echo '</td></tr>';
    }
    echo "</table>\n\n";
    echo '</td></tr></table>';
    print_simple_box_end();
    if (empty($courses)) {
        print_heading(FN_translate_course_string(get_string("nocoursesyet")));
    } else {
        foreach ($courses as $course) {
            print_course($course);
        }
    }
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:101,代码来源:lib.php

示例9: confirmed_request

 function confirmed_request($course, $message)
 {
     global $CFG, $USER, $SESSION, $THEME;
     $strloginto = get_string('loginto', '', $course->shortname);
     $strcourses = get_string('courses');
     $navlinks = array();
     $navlinks[] = array('name' => $strcourses, 'link' => ".", 'type' => 'misc');
     $navlinks[] = array('name' => $strloginto, 'link' => null, 'type' => 'misc');
     $navigation = build_navigation($navlinks);
     print_header($strloginto, $course->fullname, $navigation, "form.password");
     print_course($course, "80%");
     //include("$CFG->dirroot/enrol/manual/enrol.html");
     echo $message;
     print_footer();
 }
开发者ID:arshanam,项目名称:Moodle-ITScholars-LMS,代码行数:15,代码来源:enrol.php


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