• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_course_category函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: approve

 /**
  * This function approves the request turning it into a course
  *
  * This function converts the course request into a course, at the same time
  * transferring any files used in the summary to the new course and then removing
  * the course request and the files associated with it.
  *
  * @return int The id of the course that was created from this request
  */
 public function approve()
 {
     global $CFG, $DB, $USER;
     $user = $DB->get_record('user', array('id' => $this->properties->requester, 'deleted' => 0), '*', MUST_EXIST);
     $category = get_course_category($CFG->defaultrequestcategory);
     $courseconfig = get_config('moodlecourse');
     // Transfer appropriate settings
     $data = clone $this->properties;
     unset($data->id);
     unset($data->reason);
     unset($data->requester);
     // Set category
     $data->category = $category->id;
     $data->sortorder = $category->sortorder;
     // place as the first in category
     // Set misc settings
     $data->requested = 1;
     // Apply course default settings
     $data->format = $courseconfig->format;
     $data->numsections = $courseconfig->numsections;
     $data->hiddensections = $courseconfig->hiddensections;
     $data->newsitems = $courseconfig->newsitems;
     $data->showgrades = $courseconfig->showgrades;
     $data->showreports = $courseconfig->showreports;
     $data->maxbytes = $courseconfig->maxbytes;
     $data->groupmode = $courseconfig->groupmode;
     $data->groupmodeforce = $courseconfig->groupmodeforce;
     $data->visible = $courseconfig->visible;
     $data->visibleold = $data->visible;
     $data->lang = $courseconfig->lang;
     $course = create_course($data);
     $context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
     // add enrol instances
     if (!$DB->record_exists('enrol', array('courseid' => $course->id, 'enrol' => 'manual'))) {
         if ($manual = enrol_get_plugin('manual')) {
             $manual->add_default_instance($course);
         }
     }
     // enrol the requester as teacher if necessary
     if (!empty($CFG->creatornewroleid) and !is_viewing($context, $user, 'moodle/role:assign') and !is_enrolled($context, $user, 'moodle/role:assign')) {
         enrol_try_internal_enrol($course->id, $user->id, $CFG->creatornewroleid);
     }
     $this->delete();
     $a = new stdClass();
     $a->name = format_string($course->fullname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
     $a->url = $CFG->wwwroot . '/course/view.php?id=' . $course->id;
     $this->notify($user, $USER, 'courserequestapproved', get_string('courseapprovedsubject'), get_string('courseapprovedemail2', 'moodle', $a));
     return $course->id;
 }
开发者ID:numbas,项目名称:moodle,代码行数:58,代码来源:lib.php


示例2: require_login

require_once $CFG->dirroot . '/course/lib.php';
require_once $CFG->dirroot . '/course/request_form.php';
require_login();
require_capability('moodle/site:approvecourse', get_context_instance(CONTEXT_SYSTEM));
$approve = optional_param('approve', 0, PARAM_INT);
$reject = optional_param('reject', 0, PARAM_INT);
$baseurl = $CFG->wwwroot . '/course/pending.php';
admin_externalpage_setup('coursespending');
/// Process approval of a course.
if (!empty($approve) and confirm_sesskey()) {
    /// Load the request.
    if (!($course = $DB->get_record('course_request', array('id' => $approve)))) {
        print_error('unknowncourserequest');
    }
    /// Get the category courses are added to.
    $category = get_course_category($CFG->defaultrequestcategory);
    /// Build up a course record based on the request.
    $course->category = $category->id;
    $course->sortorder = $category->sortorder;
    // place as the first in category
    $course->requested = 1;
    unset($course->reason);
    unset($course->id);
    $teacherid = $course->requester;
    unset($course->requester);
    if (!empty($CFG->restrictmodulesfor) && $CFG->restrictmodulesfor != 'none' && !empty($CFG->restrictbydefault)) {
        $course->restrictmodules = 1;
    }
    /// Insert the record.
    if ($courseid = $DB->insert_record('course', $course)) {
        $course = $DB->get_record('course', array('id' => $courseid));
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:31,代码来源:pending.php


示例3: xmldb_main_install

function xmldb_main_install()
{
    global $CFG, $DB, $SITE, $OUTPUT;
    /// make sure system context exists
    $syscontext = get_system_context(false);
    if ($syscontext->id != 1) {
        throw new moodle_exception('generalexceptionmessage', 'error', '', 'Unexpected new system context id!');
    }
    /// create site course
    $newsite = new stdClass();
    $newsite->fullname = '';
    $newsite->shortname = '';
    $newsite->summary = NULL;
    $newsite->newsitems = 3;
    $newsite->numsections = 0;
    $newsite->category = 0;
    $newsite->format = 'site';
    // Only for this course
    $newsite->timecreated = time();
    $newsite->timemodified = $newsite->timecreated;
    $newsite->id = $DB->insert_record('course', $newsite);
    $SITE = get_site();
    if ($newsite->id != 1 or $SITE->id != 1) {
        throw new moodle_exception('generalexceptionmessage', 'error', '', 'Unexpected new site course id!');
    }
    /// make sure site course context exists
    get_context_instance(CONTEXT_COURSE, $SITE->id);
    /// create default course category
    $cat = get_course_category();
    $defaults = array('rolesactive' => '0', 'auth' => 'email', 'auth_pop3mailbox' => 'INBOX', 'enrol_plugins_enabled' => 'manual,guest,self,cohort', 'theme' => theme_config::DEFAULT_THEME, 'filter_multilang_converted' => 1, 'siteidentifier' => random_string(32) . get_host_from_url($CFG->wwwroot), 'backup_version' => 2008111700, 'backup_release' => '2.0 dev', 'mnet_dispatcher_mode' => 'off', 'sessiontimeout' => 7200, 'stringfilters' => '', 'filterall' => 0, 'texteditors' => 'tinymce,textarea');
    foreach ($defaults as $key => $value) {
        set_config($key, $value);
    }
    /// bootstrap mnet
    $mnethost = new stdClass();
    $mnethost->wwwroot = $CFG->wwwroot;
    $mnethost->name = '';
    $mnethost->name = '';
    $mnethost->public_key = '';
    if (empty($_SERVER['SERVER_ADDR'])) {
        // SERVER_ADDR is only returned by Apache-like webservers
        preg_match("@^(?:http[s]?://)?([A-Z0-9\\-\\.]+).*@i", $CFG->wwwroot, $matches);
        $my_hostname = $matches[1];
        $my_ip = gethostbyname($my_hostname);
        // Returns unmodified hostname on failure. DOH!
        if ($my_ip == $my_hostname) {
            $mnethost->ip_address = 'UNKNOWN';
        } else {
            $mnethost->ip_address = $my_ip;
        }
    } else {
        $mnethost->ip_address = $_SERVER['SERVER_ADDR'];
    }
    $mnetid = $DB->insert_record('mnet_host', $mnethost);
    set_config('mnet_localhost_id', $mnetid);
    // Initial insert of mnet applications info
    $mnet_app = new stdClass();
    $mnet_app->name = 'moodle';
    $mnet_app->display_name = 'Moodle';
    $mnet_app->xmlrpc_server_url = '/mnet/xmlrpc/server.php';
    $mnet_app->sso_land_url = '/auth/mnet/land.php';
    $mnet_app->sso_jump_url = '/auth/mnet/jump.php';
    $moodleapplicationid = $DB->insert_record('mnet_application', $mnet_app);
    $mnet_app = new stdClass();
    $mnet_app->name = 'mahara';
    $mnet_app->display_name = 'Mahara';
    $mnet_app->xmlrpc_server_url = '/api/xmlrpc/server.php';
    $mnet_app->sso_land_url = '/auth/xmlrpc/land.php';
    $mnet_app->sso_jump_url = '/auth/xmlrpc/jump.php';
    $DB->insert_record('mnet_application', $mnet_app);
    // Set up the probably-to-be-removed-soon 'All hosts' record
    $mnetallhosts = new stdClass();
    $mnetallhosts->wwwroot = '';
    $mnetallhosts->ip_address = '';
    $mnetallhosts->public_key = '';
    $mnetallhosts->public_key_expires = 0;
    $mnetallhosts->last_connect_time = 0;
    $mnetallhosts->last_log_id = 0;
    $mnetallhosts->deleted = 0;
    $mnetallhosts->name = 'All Hosts';
    $mnetallhosts->applicationid = $moodleapplicationid;
    $mnetallhosts->id = $DB->insert_record('mnet_host', $mnetallhosts, true);
    set_config('mnet_all_hosts_id', $mnetallhosts->id);
    /// Create guest record - do not assign any role, guest user get's the default guest role automatically on the fly
    $guest = new stdClass();
    $guest->auth = 'manual';
    $guest->username = 'guest';
    $guest->password = hash_internal_user_password('guest');
    $guest->firstname = get_string('guestuser');
    $guest->lastname = ' ';
    $guest->email = 'root@localhost';
    $guest->description = get_string('guestuserinfo');
    $guest->mnethostid = $CFG->mnet_localhost_id;
    $guest->confirmed = 1;
    $guest->lang = $CFG->lang;
    $guest->timemodified = time();
    $guest->id = $DB->insert_record('user', $guest);
    if ($guest->id != 1) {
        echo $OUTPUT->notification('Unexpected id generated for the Guest account. Your database configuration or clustering setup may not be fully supported', 'notifyproblem');
    }
//.........这里部分代码省略.........
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:101,代码来源:install.php


示例4: create_course

 function create_course($course_ext, $skip_fix_course_sortorder = 0)
 {
     global $CFG, $DB, $OUTPUT;
     // override defaults with template course
     if (!empty($CFG->enrol_ldap_template)) {
         $course = $DB->get_record("course", array('shortname' => $CFG->enrol_ldap_template));
         unset($course->id);
         // so we are clear to reinsert the record
         unset($course->sortorder);
     } else {
         // set defaults
         $course = new object();
         $course->format = 'topics';
     }
     // override with required ext data
     $course->idnumber = $course_ext[$CFG->enrol_ldap_course_idnumber][0];
     $course->fullname = $course_ext[$CFG->enrol_ldap_course_fullname][0];
     $course->shortname = $course_ext[$CFG->enrol_ldap_course_shortname][0];
     if (empty($course->idnumber) || empty($course->fullname) || empty($course->shortname)) {
         // we are in trouble!
         error_log("Cannot create course: missing required data from the LDAP record!");
         error_log(var_export($course, true));
         return false;
     }
     $course->summary = empty($CFG->enrol_ldap_course_summary) || empty($course_ext[$CFG->enrol_ldap_course_summary][0]) ? '' : $course_ext[$CFG->enrol_ldap_course_summary][0];
     $category = get_course_category($CFG->enrol_db_category);
     // put at the end of category
     $course->sortorder = $category->sortorder + MAX_COURSES_IN_CATEGORY - 1;
     // override with local data
     $course->startdate = time();
     $course->timecreated = time();
     $course->visible = 1;
     // store it and log
     if ($newcourseid = $DB->insert_record("course", $course)) {
         // Set up new course
         $section = new object();
         $section->course = $newcourseid;
         // Create a default section.
         $section->section = 0;
         $section->id = $DB->insert_record("course_sections", $section);
         $course = $DB->get_record('course', array('id' => $newcourseid));
         blocks_add_default_course_blocks($course);
         if (!$skip_fix_course_sortorder) {
             fix_course_sortorder();
         }
         add_to_log($newcourseid, "course", "new", "view.php?id={$newcourseid}", "enrol/ldap auto-creation");
     } else {
         error_log("Could not create new course from LDAP from DN:" . $course_ext['dn']);
         echo $OUTPUT->notification("Serious Error! Could not create the new course!");
         return false;
     }
     return $newcourseid;
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:53,代码来源:enrol.php


示例5: restore_create_new_course

function restore_create_new_course($restore, &$course_header)
{
    global $CFG, $DB;
    $status = true;
    $fullname = $course_header->course_fullname;
    $shortname = $course_header->course_shortname;
    $currentfullname = "";
    $currentshortname = "";
    $counter = 0;
    //Iteratere while the name exists
    do {
        if ($counter) {
            $suffixfull = " " . get_string("copyasnoun") . " " . $counter;
            $suffixshort = "_" . $counter;
        } else {
            $suffixfull = "";
            $suffixshort = "";
        }
        $currentfullname = $fullname . $suffixfull;
        // Limit the size of shortname - database column accepts <= 100 chars
        $currentshortname = substr($shortname, 0, 100 - strlen($suffixshort)) . $suffixshort;
        $coursefull = $DB->get_record("course", array("fullname" => $currentfullname));
        $courseshort = $DB->get_record("course", array("shortname" => $currentshortname));
        $counter++;
    } while ($coursefull || $courseshort);
    //New name = currentname
    $course_header->course_fullname = $currentfullname;
    $course_header->course_shortname = $currentshortname;
    // first try to get it from restore
    if ($restore->restore_restorecatto) {
        $category = $DB->get_record('course_categories', array('id' => $restore->restore_restorecatto));
    }
    // else we try to get it from the xml file
    //Now calculate the category
    if (empty($category)) {
        $category = $DB->get_record("course_categories", array("id" => $course_header->category->id, "name" => $course_header->category->name));
    }
    //If no exists, try by name only
    if (!$category) {
        $category = $DB->get_record("course_categories", array("name" => $course_header->category->name));
    }
    //If no exists, get default category
    if (!$category) {
        $category = get_course_category();
    }
    $course_header->category->id = $category->id;
    $course_header->category->name = $category->name;
    //Create the course_object
    if ($status) {
        $course = new object();
        $course->category = $course_header->category->id;
        $course->password = $course_header->course_password;
        $course->fullname = $course_header->course_fullname;
        $course->shortname = $course_header->course_shortname;
        $course->idnumber = $course_header->course_idnumber;
        $course->idnumber = '';
        //$course_header->course_idnumber; // we don't want this at all.
        $course->summary = $course_header->course_summary;
        $course->format = $course_header->course_format;
        $course->showgrades = $course_header->course_showgrades;
        $course->newsitems = $course_header->course_newsitems;
        $course->guest = $course_header->course_guest;
        $course->startdate = $course_header->course_startdate;
        $course->startdate += $restore->course_startdateoffset;
        $course->numsections = $course_header->course_numsections;
        //$course->showrecent = $course_header->course_showrecent;   INFO: This is out in 1.3
        $course->maxbytes = $course_header->course_maxbytes;
        $course->showreports = $course_header->course_showreports;
        if (isset($course_header->course_groupmode)) {
            $course->groupmode = $course_header->course_groupmode;
        }
        if (isset($course_header->course_groupmodeforce)) {
            $course->groupmodeforce = $course_header->course_groupmodeforce;
        }
        if (isset($course_header->course_defaultgroupingid)) {
            //keep the original now - convert after groupings restored
            $course->defaultgroupingid = $course_header->course_defaultgroupingid;
        }
        $course->lang = $course_header->course_lang;
        $course->theme = $course_header->course_theme;
        $course->cost = $course_header->course_cost;
        $course->currency = isset($course_header->course_currency) ? $course_header->course_currency : '';
        $course->marker = $course_header->course_marker;
        $course->visible = $course_header->course_visible;
        $course->hiddensections = $course_header->course_hiddensections;
        $course->timecreated = $course_header->course_timecreated;
        $course->timemodified = $course_header->course_timemodified;
        $course->metacourse = $course_header->course_metacourse;
        $course->expirynotify = isset($course_header->course_expirynotify) ? $course_header->course_expirynotify : 0;
        $course->notifystudents = isset($course_header->course_notifystudents) ? $course_header->course_notifystudents : 0;
        $course->expirythreshold = isset($course_header->course_expirythreshold) ? $course_header->course_expirythreshold : 0;
        $course->enrollable = isset($course_header->course_enrollable) ? $course_header->course_enrollable : 1;
        $course->enrolstartdate = isset($course_header->course_enrolstartdate) ? $course_header->course_enrolstartdate : 0;
        if ($course->enrolstartdate) {
            //Roll course dates
            $course->enrolstartdate += $restore->course_startdateoffset;
        }
        $course->enrolenddate = isset($course_header->course_enrolenddate) ? $course_header->course_enrolenddate : 0;
        if ($course->enrolenddate) {
            //Roll course dates
//.........这里部分代码省略.........
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:101,代码来源:restorelib.php


示例6: xmldb_main_install

function xmldb_main_install()
{
    global $CFG, $DB, $SITE;
    /// make sure system context exists
    $syscontext = get_system_context(false);
    if ($syscontext->id != 1) {
        throw new moodle_exception('generalexceptionmessage', 'error', '', 'Unexpected system context id created!');
    }
    // create site course
    $newsite = new object();
    $newsite->fullname = "";
    $newsite->shortname = "";
    $newsite->summary = NULL;
    $newsite->newsitems = 3;
    $newsite->numsections = 0;
    $newsite->category = 0;
    $newsite->format = 'site';
    // Only for this course
    $newsite->teacher = get_string("defaultcourseteacher");
    $newsite->teachers = get_string("defaultcourseteachers");
    $newsite->student = get_string("defaultcoursestudent");
    $newsite->students = get_string("defaultcoursestudents");
    $newsite->timemodified = time();
    $DB->insert_record('course', $newsite);
    $SITE = get_site();
    if ($SITE->id != 1) {
        throw new moodle_exception('generalexceptionmessage', 'error', '', 'Unexpected site course id created!');
    }
    /// make sure site course context exists
    get_context_instance(CONTEXT_COURSE, $SITE->id);
    /// create default course category
    $cat = get_course_category();
    $defaults = array('rolesactive' => '0', 'auth' => 'email', 'auth_pop3mailbox' => 'INBOX', 'enrol' => 'manual', 'enrol_plugins_enabled' => 'manual', 'style' => 'default', 'template' => 'default', 'theme' => 'standardwhite', 'filter_multilang_converted' => 1, 'siteidentifier' => random_string(32) . get_host_from_url($CFG->wwwroot), 'backup_version' => 2008111700, 'backup_release' => '2.0 dev', 'blocks_version' => 2007081300, 'mnet_dispatcher_mode' => 'off', 'sessiontimeout' => 7200, 'stringfilters' => '', 'filterall' => 0, 'texteditors' => 'tinymce,textarea');
    foreach ($defaults as $key => $value) {
        set_config($key, $value);
    }
    /// bootstrap mnet
    $mnethost = new object();
    $mnethost->wwwroot = $CFG->wwwroot;
    $mnethost->name = '';
    $mnethost->name = '';
    $mnethost->public_key = '';
    if (empty($_SERVER['SERVER_ADDR'])) {
        // SERVER_ADDR is only returned by Apache-like webservers
        preg_match("@^(?:http[s]?://)?([A-Z0-9\\-\\.]+).*@i", $CFG->wwwroot, $matches);
        $my_hostname = $matches[1];
        $my_ip = gethostbyname($my_hostname);
        // Returns unmodified hostname on failure. DOH!
        if ($my_ip == $my_hostname) {
            $mnethost->ip_address = 'UNKNOWN';
        } else {
            $mnethost->ip_address = $my_ip;
        }
    } else {
        $mnethost->ip_address = $_SERVER['SERVER_ADDR'];
    }
    $mnetid = $DB->insert_record('mnet_host', $mnethost);
    set_config('mnet_localhost_id', $mnetid);
    // Initial insert of mnet applications info
    $mnet_app = new object();
    $mnet_app->name = 'moodle';
    $mnet_app->display_name = 'Moodle';
    $mnet_app->xmlrpc_server_url = '/mnet/xmlrpc/server.php';
    $mnet_app->sso_land_url = '/auth/mnet/land.php';
    $mnet_app->sso_jump_url = '/auth/mnet/land.php';
    $DB->insert_record('mnet_application', $mnet_app);
    $mnet_app = new object();
    $mnet_app->name = 'mahara';
    $mnet_app->display_name = 'Mahara';
    $mnet_app->xmlrpc_server_url = '/api/xmlrpc/server.php';
    $mnet_app->sso_land_url = '/auth/xmlrpc/land.php';
    $mnet_app->sso_jump_url = '/auth/xmlrpc/jump.php';
    $DB->insert_record('mnet_application', $mnet_app);
    /// insert log entries - replaces statements section in install.xml
    update_log_display_entry('user', 'view', 'user', 'CONCAT(firstname,\' \',lastname)');
    update_log_display_entry('course', 'user report', 'user', 'CONCAT(firstname,\' \',lastname)');
    update_log_display_entry('course', 'view', 'course', 'fullname');
    update_log_display_entry('course', 'update', 'course', 'fullname');
    update_log_display_entry('course', 'enrol', 'course', 'fullname');
    update_log_display_entry('course', 'unenrol', 'course', 'fullname');
    update_log_display_entry('course', 'report log', 'course', 'fullname');
    update_log_display_entry('course', 'report live', 'course', 'fullname');
    update_log_display_entry('course', 'report outline', 'course', 'fullname');
    update_log_display_entry('course', 'report participation', 'course', 'fullname');
    update_log_display_entry('course', 'report stats', 'course', 'fullname');
    update_log_display_entry('message', 'write', 'user', 'CONCAT(firstname,\' \',lastname)');
    update_log_display_entry('message', 'read', 'user', 'CONCAT(firstname,\' \',lastname)');
    update_log_display_entry('message', 'add contact', 'user', 'CONCAT(firstname,\' \',lastname)');
    update_log_display_entry('message', 'remove contact', 'user', 'CONCAT(firstname,\' \',lastname)');
    update_log_display_entry('message', 'block contact', 'user', 'CONCAT(firstname,\' \',lastname)');
    update_log_display_entry('message', 'unblock contact', 'user', 'CONCAT(firstname,\' \',lastname)');
    update_log_display_entry('group', 'view', 'groups', 'name');
    /// Create guest record
    $guest = new object();
    $guest->auth = 'manual';
    $guest->username = 'guest';
    $guest->password = hash_internal_user_password('guest');
    $guest->firstname = get_string('guestuser');
    $guest->lastname = ' ';
    $guest->email = 'root@localhost';
//.........这里部分代码省略.........
开发者ID:ajv,项目名称:Offline-Caching,代码行数:101,代码来源:install.php


示例7: create_course

 function create_course($course, $skip_fix_course_sortorder = 0)
 {
     global $CFG, $DB;
     // define a template
     if (!empty($CFG->enrol_db_template)) {
         $template = $DB->get_record("course", array('shortname' => $CFG->enrol_db_template));
         $template = (array) $template;
     } else {
         $site = get_site();
         $template = array('startdate' => time() + 3600 * 24, 'summary' => get_string("defaultcoursesummary"), 'format' => "weeks", 'password' => "", 'guest' => 0, 'numsections' => 10, 'idnumber' => '', 'cost' => '', 'newsitems' => 5, 'showgrades' => 1, 'groupmode' => 0, 'groupmodeforce' => 0);
     }
     // overlay template
     foreach (array_keys($template) as $key) {
         if (empty($course->{$key})) {
             $course->{$key} = $template[$key];
         }
     }
     $category = get_course_category($CFG->enrol_db_category);
     // put at the end of category
     $course->sortorder = $category->sortorder + MAX_COURSES_IN_CATEGORY - 1;
     // override with local data
     $course->startdate = time() + 3600 * 24;
     $course->timecreated = time();
     $course->visible = 1;
     // clear out id just in case
     unset($course->id);
     // truncate a few key fields
     $course->idnumber = substr($course->idnumber, 0, 100);
     $course->shortname = substr($course->shortname, 0, 100);
     // store it and log
     if ($newcourseid = $DB->insert_record("course", $course)) {
         // Set up new course
         $section = new object();
         $section->course = $newcourseid;
         // Create a default section.
         $section->section = 0;
         $section->id = $DB->insert_record("course_sections", $section);
         $course = $DB->get_record('course', array('id' => $newcourseid));
         blocks_add_default_course_blocks($course);
         if (!$skip_fix_course_sortorder) {
             fix_course_sortorder();
         }
         add_to_log($newcourseid, "course", "new", "view.php?id={$newcourseid}", "enrol/database auto-creation");
     } else {
         trigger_error("Could not create new course {$extcourse} from  from database");
         notify("Serious Error! Could not create the new course!");
         return false;
     }
     return $newcourseid;
 }
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:50,代码来源:enrol.php


示例8: Object

     }
     $newsite = new Object();
     $newsite->fullname = $sitefullname;
     $newsite->shortname = $siteshortname;
     $newsite->summary = $sitesummary;
     $newsite->newsitems = $sitenewsitems;
     $newsite->numsections = 0;
     $newsite->category = 0;
     $newsite->format = 'site';
     // Only for this course
     $newsite->timemodified = time();
     if ($newid = $DB->insert_record('course', $newsite)) {
         // Site created, add blocks for it
         blocks_add_default_course_blocks($DB->get_record('course', array('id' => $newid)));
         // create default course category
         $cat = get_course_category();
     }
 }
 /// Define the unique site ID code if it isn't already
 if (empty($CFG->siteidentifier)) {
     // Unique site identification code
     set_config('siteidentifier', random_string(32) . $_SERVER['HTTP_HOST']);
 }
 /// Check if the guest user exists.  If not, create one.
 if (!$DB->record_exists("user", array("username" => "guest"))) {
     if (!($guest = create_guest_record())) {
         notify("Could not create guest user record !!!");
     }
 }
 /// Set up the admin user
 if (empty($CFG->rolesactive)) {
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:31,代码来源:cliupgrade.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_course_category_tree函数代码示例发布时间:2022-05-15
下一篇:
PHP get_course_and_cm_from_instance函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap