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


PHP enrolment_factory类代码示例

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


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

示例1: get_access_icons

 /**
  * Gets access icons.
  *
  * @param object $course
  * @return string
  * @access public
  */
 function get_access_icons($course)
 {
     $manual = enrolment_factory::factory('manual');
     $str = $manual->get_access_icons($course);
     $curcost = get_course_cost($course);
     if (abs($curcost['cost']) > 0.0) {
         $strrequirespayment = get_string("requirespayment");
         $strcost = get_string("cost");
         $currency = $curcost['currency'];
         switch ($currency) {
             case 'USD':
                 $currency = 'US$';
                 break;
             case 'CAD':
                 $currency = 'C$';
                 break;
             case 'EUR':
                 $currency = '€';
                 break;
             case 'GBP':
                 $currency = '£';
                 break;
             case 'JPY':
                 $currency = '¥';
                 break;
         }
         $str .= '<div class="cost" title="' . $strrequirespayment . '">' . $strcost . ': ';
         $str .= $currency . ' ' . $curcost['cost'] . '</div>';
     }
     return $str;
 }
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:38,代码来源:enrol.php

示例2: dirname

<?php

// $Id: enr_course_enrol.php,v 1.8.4.1 2007/11/26 04:42:23 scyrma Exp $
// enrol_config.php - allows admin to edit all enrollment variables
//                    Yes, enrol is correct English spelling.
require_once dirname(__FILE__) . "/../../config.php";
require_once $CFG->libdir . '/adminlib.php';
include_once $CFG->dirroot . '/mnet/xmlrpc/client.php';
if (!confirm_sesskey()) {
    error(get_string('confirmsesskeybad', 'error'));
}
admin_externalpage_setup('mnetenrol');
$CFG->pagepath = 'admin/mnet';
require_once "{$CFG->dirroot}/enrol/enrol.class.php";
/// Open the factory class
$enrolment = enrolment_factory::factory('mnet');
$mnethostid = required_param('host', PARAM_INT);
$courseid = required_param('courseid', PARAM_INT);
$mnet_peer = new mnet_peer();
if (!$mnet_peer->set_id($mnethostid)) {
    print_error('hostcoursenotfound', 'mnet');
}
$course = get_record('mnet_enrol_course', 'id', $courseid, 'hostid', $mnet_peer->id);
if (empty($course)) {
    print_error('hostcoursenotfound', 'mnet');
}
define("MAX_USERS_PER_PAGE", 5000);
$add = optional_param('add', 0, PARAM_BOOL);
$remove = optional_param('remove', 0, PARAM_BOOL);
$showall = optional_param('showall', 0, PARAM_BOOL);
$searchtext = optional_param('searchtext', '', PARAM_RAW);
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:31,代码来源:enr_course_enrol.php

示例3: admin_externalpage_setup

<?php

// $Id: enrol_config.php,v 1.15.4.1 2008/04/02 06:09:57 dongsheng Exp $
// enrol_config.php - allows admin to edit all enrollment variables
//                    Yes, enrol is correct English spelling.
require_once "../config.php";
require_once $CFG->libdir . '/adminlib.php';
admin_externalpage_setup('enrolment');
$enrol = required_param('enrol', PARAM_ALPHA);
$CFG->pagepath = 'enrol/' . $enrol;
require_once "{$CFG->dirroot}/enrol/enrol.class.php";
/// Open the factory class
$enrolment = enrolment_factory::factory($enrol);
/// If data submitted, then process and store.
if ($frm = data_submitted()) {
    if (!confirm_sesskey()) {
        print_error('confirmsesskeybad', 'error');
    }
    if ($enrolment->process_config($frm)) {
        redirect("enrol.php?sesskey={$USER->sesskey}", get_string("changessaved"), 1);
    }
} else {
    $frm = $CFG;
}
/// Otherwise fill and print the form.
/// get language strings
$str = get_strings(array('enrolmentplugins', 'configuration', 'users', 'administration'));
unset($options);
$modules = get_list_of_plugins("enrol");
foreach ($modules as $module) {
    $options[$module] = get_string("enrolname", "enrol_{$module}");
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:31,代码来源:enrol_config.php

示例4: main_upgrade


//.........这里部分代码省略.........
    }
    if ($oldversion < 2005100300) {
        table_column('course', '', 'expirynotify', 'tinyint', '1');
        table_column('course', '', 'expirythreshold', 'int', '10');
        table_column('course', '', 'notifystudents', 'tinyint', '1');
        $new = new stdClass();
        $new->name = 'lastexpirynotify';
        $new->value = 0;
        insert_record('config', $new);
    }
    if ($oldversion < 2005100400) {
        table_column('course', '', 'enrollable', 'tinyint', '1', 'unsigned', '1');
        table_column('course', '', 'enrolstartdate', 'int');
        table_column('course', '', 'enrolenddate', 'int');
    }
    if ($oldversion < 2005101200) {
        // add enrolment key to course_request.
        table_column('course_request', '', 'password', 'varchar', 50);
    }
    if ($oldversion < 2006030800) {
        # add extra indexes to log (see bug #4112)
        modify_database('', "ALTER TABLE prefix_log ADD INDEX userid (userid);");
        modify_database('', "ALTER TABLE prefix_log ADD INDEX info (info);");
    }
    if ($oldversion < 2006030900) {
        table_column('course', '', 'enrol', 'varchar', '20', '', '');
        if ($CFG->enrol == 'internal' || $CFG->enrol == 'manual') {
            set_config('enrol_plugins_enabled', 'manual');
            set_config('enrol', 'manual');
        } else {
            set_config('enrol_plugins_enabled', 'manual,' . $CFG->enrol);
        }
        require_once "{$CFG->dirroot}/enrol/enrol.class.php";
        $defaultenrol = enrolment_factory::factory($CFG->enrol);
        if (!method_exists($defaultenrol, 'print_entry')) {
            // switch enrollable to off for all courses in this case
            modify_database('', 'UPDATE prefix_course SET enrollable = 0');
        }
        execute_sql("UPDATE {$CFG->prefix}user_students SET enrol='manual' WHERE enrol='' OR enrol='internal'");
        execute_sql("UPDATE {$CFG->prefix}user_teachers SET enrol='manual' WHERE enrol=''");
    }
    if ($oldversion < 2006031000) {
        modify_database("", "CREATE TABLE prefix_post (\n          `id` int(10) unsigned NOT NULL auto_increment,\n          `userid` int(10) unsigned NOT NULL default '0',\n          `courseid` int(10) unsigned NOT NULL default'0',\n          `groupid` int(10) unsigned NOT NULL default'0',\n          `moduleid` int(10) unsigned NOT NULL default'0',\n          `coursemoduleid` int(10) unsigned NOT NULL default'0',\n          `subject` varchar(128) NOT NULL default '',\n          `summary` longtext,\n          `content` longtext,\n          `uniquehash` varchar(128) NOT NULL default '',\n          `rating` int(10) unsigned NOT NULL default'0',\n          `format` int(10) unsigned NOT NULL default'0',\n          `publishstate` enum('draft','site','public') NOT NULL default 'draft',\n          `lastmodified` int(10) unsigned NOT NULL default '0',\n          `created` int(10) unsigned NOT NULL default '0',\n          PRIMARY KEY  (`id`),\n          UNIQUE KEY `id_user_idx` (`id`, `userid`),\n          KEY `post_lastmodified_idx` (`lastmodified`),\n          KEY `post_subject_idx` (`subject`)\n        ) TYPE=MyISAM  COMMENT='New moodle post table. Holds data posts such as forum entries or blog entries.';");
        modify_database("", "CREATE TABLE prefix_tags (\n          `id` int(10) unsigned NOT NULL auto_increment,\n          `type` varchar(255) NOT NULL default 'official',\n          `userid` int(10) unsigned NOT NULL default'0',\n          `text` varchar(255) NOT NULL default '',\n          PRIMARY KEY  (`id`)\n        ) TYPE=MyISAM COMMENT ='tags structure for moodle.';");
        modify_database("", "CREATE TABLE prefix_blog_tag_instance (\n          `id` int(10) unsigned NOT NULL auto_increment,\n          `entryid` int(10) unsigned NOT NULL default'0',\n          `tagid` int(10) unsigned NOT NULL default'0',\n          `groupid` int(10) unsigned NOT NULL default'0',\n          `courseid` int(10) unsigned NOT NULL default'0',\n          `userid` int(10) unsigned NOT NULL default'0',\n          PRIMARY KEY  (`id`)\n          ) TYPE=MyISAM COMMENT ='tag instance for blogs.';");
    }
    if ($oldversion < 2006031400) {
        require_once "{$CFG->dirroot}/enrol/enrol.class.php";
        $defaultenrol = enrolment_factory::factory($CFG->enrol);
        if (!method_exists($defaultenrol, 'print_entry')) {
            set_config('enrol', 'manual');
        }
    }
    if ($oldversion < 2006031600) {
        execute_sql(" ALTER TABLE `{$CFG->prefix}grade_category` CHANGE `weight` `weight` decimal(5,2) default '0.00';");
    }
    if ($oldversion < 2006032000) {
        table_column('post', '', 'module', 'varchar', '20', '', '', 'not null', 'id');
        modify_database('', "ALTER TABLE prefix_post ADD INDEX post_module_idx (module);");
        modify_database('', "UPDATE prefix_post SET module = 'blog';");
    }
    if ($oldversion < 2006032001) {
        table_column('blog_tag_instance', '', 'timemodified', 'integer', '10', 'unsigned', '0', 'not null', 'userid');
        modify_database('', "ALTER TABLE prefix_blog_tag_instance ADD INDEX bti_entryid_idx (entryid);");
        modify_database('', "ALTER TABLE prefix_blog_tag_instance ADD INDEX bti_tagid_idx (tagid);");
        modify_database('', "UPDATE prefix_blog_tag_instance SET timemodified = '" . time() . "';");
开发者ID:veritech,项目名称:pare-project,代码行数:67,代码来源:mysql.php

示例5: main_upgrade


//.........这里部分代码省略.........
    }
    if ($oldversion < 2005100300) {
        table_column('course', '', 'expirynotify', 'integer', '1');
        table_column('course', '', 'expirythreshold', 'integer');
        table_column('course', '', 'notifystudents', 'integer', '1');
        $new = new stdClass();
        $new->name = 'lastexpirynotify';
        $new->value = 0;
        insert_record('config', $new);
    }
    if ($oldversion < 2005100400) {
        table_column('course', '', 'enrollable', 'integer', '1', 'unsigned', '1');
        table_column('course', '', 'enrolstartdate', 'integer');
        table_column('course', '', 'enrolenddate', 'integer');
    }
    if ($oldversion < 2005101200) {
        // add enrolment key to course_request.
        table_column('course_request', '', 'password', 'text');
    }
    if ($oldversion < 2006030800) {
        # add extra indexes to log (see bug #4112)
        modify_database('', "CREATE INDEX prefix_log_userid_idx ON prefix_log (userid);");
        modify_database('', "CREATE INDEX prefix_log_info_idx ON prefix_log (info);");
    }
    if ($oldversion < 2006030900) {
        table_column('course', '', 'enrol', 'varchar', '20', '', '');
        if ($CFG->enrol == 'internal' || $CFG->enrol == 'manual') {
            set_config('enrol_plugins_enabled', 'manual');
            set_config('enrol', 'manual');
        } else {
            set_config('enrol_plugins_enabled', 'manual,' . $CFG->enrol);
        }
        require_once "{$CFG->dirroot}/enrol/enrol.class.php";
        $defaultenrol = enrolment_factory::factory($CFG->enrol);
        if (!method_exists($defaultenrol, 'print_entry')) {
            // switch enrollable to off for all courses in this case
            modify_database('', 'UPDATE prefix_course SET enrollable = 0');
        }
        execute_sql("UPDATE {$CFG->prefix}user_students SET enrol='manual' WHERE enrol='' OR enrol='internal'");
        execute_sql("UPDATE {$CFG->prefix}user_teachers SET enrol='manual' WHERE enrol=''");
    }
    if ($oldversion < 2006031000) {
        modify_database("", "CREATE TABLE prefix_post (\n          id SERIAL PRIMARY KEY,\n          userid INTEGER NOT NULL default 0,\n          courseid INTEGER NOT NULL default 0,\n          groupid INTEGER NOT NULL default 0,\n          moduleid INTEGER NOT NULL default 0,\n          coursemoduleid INTEGER NOT NULL default 0,\n          subject varchar(128) NOT NULL default '',\n          summary text,\n          content text,\n          uniquehash varchar(128) NOT NULL default '',\n          rating INTEGER NOT NULL default 0,\n          format INTEGER NOT NULL default 0,\n          publishstate varchar(10) CHECK (publishstate IN ('draft','site','public')) NOT NULL default 'draft',\n          lastmodified INTEGER NOT NULL default '0',\n          created INTEGER NOT NULL default '0'\n        );");
        modify_database("", "CREATE INDEX id_user_idx ON prefix_post  (id, courseid);");
        modify_database("", "CREATE INDEX post_lastmodified_idx ON prefix_post (lastmodified);");
        modify_database("", "CREATE INDEX post_subject_idx ON prefix_post (subject);");
        modify_database("", "CREATE TABLE prefix_tags (\n          id SERIAL PRIMARY KEY,\n          type varchar(255) NOT NULL default 'official',\n          userid INTEGER NOT NULL default 0,\n          text varchar(255) NOT NULL default ''\n        );");
        modify_database("", "CREATE TABLE prefix_blog_tag_instance (\n          id SERIAL PRIMARY KEY,\n          entryid integer NOT NULL default 0,\n          tagid integer NOT NULL default 0,\n          groupid integer NOT NULL default 0,\n          courseid integer NOT NULL default 0,\n          userid integer NOT NULL default 0\n        );");
    }
    if ($oldversion < 2006031400) {
        require_once "{$CFG->dirroot}/enrol/enrol.class.php";
        $defaultenrol = enrolment_factory::factory($CFG->enrol);
        if (!method_exists($defaultenrol, 'print_entry')) {
            set_config('enrol', 'manual');
        }
    }
    if ($oldversion < 2006032000) {
        table_column('post', '', 'module', 'varchar', '20', '', '', 'not null', 'id');
        modify_database('', "CREATE INDEX post_module_idx ON prefix_post (module);");
        modify_database('', "UPDATE prefix_post SET module = 'blog';");
    }
    if ($oldversion < 2006032001) {
        table_column('blog_tag_instance', '', 'timemodified', 'integer', '10', 'unsigned', '0', 'not null', 'userid');
        modify_database('', "CREATE INDEX bti_entryid_idx ON prefix_blog_tag_instance (entryid);");
        modify_database('', "CREATE INDEX bti_tagid_idx ON prefix_blog_tag_instance (tagid);");
        modify_database('', "UPDATE prefix_blog_tag_instance SET timemodified = '" . time() . "';");
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:67,代码来源:postgres7.php

示例6: definition


//.........这里部分代码省略.........
     $mform->addElement('selectyesno', 'showgrades', get_string('showgrades'));
     $mform->setHelpButton('showgrades', array('coursegrades', get_string('grades')), true);
     $mform->setDefault('showgrades', 1);
     $mform->addElement('selectyesno', 'showreports', get_string('showreports'));
     $mform->setHelpButton('showreports', array('coursereports', get_string('activityreport')), true);
     $mform->setDefault('showreports', 0);
     $choices = get_max_upload_sizes($CFG->maxbytes);
     $mform->addElement('select', 'maxbytes', get_string('maximumupload'), $choices);
     $mform->setHelpButton('maxbytes', array('courseuploadsize', get_string('maximumupload')), true);
     if (!empty($CFG->allowcoursethemes)) {
         $themes = array();
         $themes[''] = get_string('forceno');
         $themes += get_list_of_themes();
         $mform->addElement('select', 'theme', get_string('forcetheme'), $themes);
     }
     $meta = array();
     $meta[0] = get_string('no');
     $meta[1] = get_string('yes');
     if ($disable_meta === false) {
         $mform->addElement('select', 'metacourse', get_string('managemeta'), $meta);
         $mform->setHelpButton('metacourse', array('metacourse', get_string('metacourse')), true);
         $mform->setDefault('metacourse', 0);
     } else {
         // no metacourse element - we do not want to change it anyway!
         $mform->addElement('static', 'nometacourse', get_string('managemeta'), (empty($course->metacourse) ? $meta[0] : $meta[1]) . " - {$disable_meta} ");
         $mform->setHelpButton('nometacourse', array('metacourse', get_string('metacourse')), true);
     }
     //--------------------------------------------------------------------------------
     $mform->addElement('header', 'enrolhdr', get_string('enrolments'));
     $choices = array();
     $modules = explode(',', $CFG->enrol_plugins_enabled);
     foreach ($modules as $module) {
         $name = get_string('enrolname', "enrol_{$module}");
         $plugin = enrolment_factory::factory($module);
         if (method_exists($plugin, 'print_entry')) {
             $choices[$name] = $module;
         }
     }
     asort($choices);
     $choices = array_flip($choices);
     $choices = array_merge(array('' => get_string('sitedefault') . ' (' . get_string('enrolname', "enrol_{$CFG->enrol}") . ')'), $choices);
     $mform->addElement('select', 'enrol', get_string('enrolmentplugins'), $choices);
     $mform->setHelpButton('enrol', array('courseenrolmentplugins', get_string('enrolmentplugins')), true);
     $roles = get_assignable_roles($context);
     if (!empty($course)) {
         // add current default role, so that it is selectable even when user can not assign it
         if ($current_role = get_record('role', 'id', $course->defaultrole)) {
             $roles[$current_role->id] = strip_tags(format_string($current_role->name, true));
         }
     }
     $choices = array();
     if ($sitedefaultrole = get_record('role', 'id', $CFG->defaultcourseroleid)) {
         $choices[0] = get_string('sitedefault') . ' (' . $sitedefaultrole->name . ')';
     } else {
         $choices[0] = get_string('sitedefault');
     }
     $choices = $choices + $roles;
     // fix for MDL-9197
     foreach ($choices as $choiceid => $choice) {
         $choices[$choiceid] = format_string($choice);
     }
     $mform->addElement('select', 'defaultrole', get_string('defaultrole', 'role'), $choices);
     $mform->setDefault('defaultrole', 0);
     $radio = array();
     $radio[] =& MoodleQuickForm::createElement('radio', 'enrollable', null, get_string('no'), 0);
     $radio[] =& MoodleQuickForm::createElement('radio', 'enrollable', null, get_string('yes'), 1);
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:67,代码来源:edit_form.php

示例7: is_enrollable

 /**
  * Determine whether a class is currently (manually) enrollable.
  * Checks if the class is associated with a Moodle course.
  * Checks whether the Moodle course is enrollable.
  * The logic is mostly copied/based on /course/enrol.php
  */
 public function is_enrollable()
 {
     global $CURMAN, $CFG;
     $courseid = $this->get_moodle_course_id();
     // no associated Moodle course, so we're always enrollable
     if ($courseid == 0) {
         return true;
     }
     $course = $CURMAN->db->get_record('course', 'id', $courseid);
     // check that this is a valid course to enrol into
     if (!$course || $course->metacourse || $course->id == SITEID) {
         return false;
     }
     // check that the course is enrollable, and that we are within the
     // enrolment dates
     if (!$course->enrollable || $course->enrollable == 2 && $course->enrolstartdate > 0 && $course->enrolstartdate > time() || $course->enrollable == 2 && $course->enrolenddate > 0 && $course->enrolenddate <= time()) {
         return false;
     }
     // check if the course is using the ELIS enrolment plugin
     $enrol = $course->enrol;
     if (!$enrol) {
         $enrol = $CFG->enrol;
     }
     if ($CURMAN->config->restrict_to_elis_enrolment_plugin && $enrol != 'elis') {
         return false;
     }
     // check that the enrolment plugin allows manual enrolment
     require_once "{$CFG->dirroot}/enrol/enrol.class.php";
     $enrol = enrolment_factory::factory($course->enrol);
     if (!method_exists($enrol, 'print_entry')) {
         return false;
     }
     // if all the checks pass, then we're good
     return true;
 }
开发者ID:remotelearner,项目名称:elis.cm,代码行数:41,代码来源:cmclass.class.php

示例8: get_list_of_plugins

    ++$cnt;
}
$coursefmtplugins = get_list_of_plugins('course/format');
foreach ($coursefmtplugins as $coursefmtplugin) {
    $plugins[$cnt] = new stdClass();
    $plugins[$cnt]->dir = "course/format/{$coursefmtplugin}";
    // TBD: no object for course/format?
    ++$cnt;
}
$enrolplugins = get_list_of_plugins('enrol');
// require class enrolment_factory for enrolplugin
require_once "{$CFG->dirroot}/enrol/enrol.class.php";
foreach ($enrolplugins as $enrolplugin) {
    $plugins[$cnt] = new stdClass();
    $plugins[$cnt]->dir = "enrol/{$enrolplugin}";
    $plugins[$cnt]->obj = enrolment_factory::factory($enrolplugin);
    ++$cnt;
}
$filterplugins = get_list_of_plugins('filter');
foreach ($filterplugins as $filterplugin) {
    $plugins[$cnt] = new stdClass();
    $plugins[$cnt]->dir = "filter/{$filterplugin}";
    // TBD: no object for filters?
    ++$cnt;
}
$modplugins = get_list_of_plugins('mod');
foreach ($modplugins as $modplugin) {
    $plugins[$cnt] = new stdClass();
    $plugins[$cnt]->dir = "mod/{$modplugin}";
    $plugins[$cnt]->obj = "mod_{$modplugin}";
    ++$cnt;
开发者ID:benavidesrobert,项目名称:elis.base,代码行数:31,代码来源:elis_info.php

示例9: print_course

function print_course($course)
{
    global $CFG, $USER;
    $context = get_context_instance(CONTEXT_COURSE, $course->id);
    $linkcss = $course->visible ? '' : ' class="dimmed" ';
    echo '<div class="coursebox">';
    echo '<div class="info">';
    echo '<div class="name"><a title="' . get_string('entercourse') . '"' . $linkcss . ' href="' . $CFG->wwwroot . '/course/view.php?id=' . $course->id . '">' . format_string($course->fullname) . '</a></div>';
    /// first find all roles that are supposed to be displayed
    if ($managerroles = get_config('', 'coursemanager')) {
        $coursemanagerroles = split(',', $managerroles);
        $roles = get_records_select('role', '', 'sortorder');
        foreach ($roles as $role) {
            if (in_array($role->id, $coursemanagerroles)) {
                if ($users = get_role_users($role->id, $context, true, '', 'u.lastname ASC', true)) {
                    foreach ($users as $teacher) {
                        $fullname = fullname($teacher, has_capability('moodle/site:viewfullnames', $context));
                        $namesarray[] = format_string($role->name) . ': <a href="' . $CFG->wwwroot . '/user/view.php?id=' . $teacher->id . '&amp;course=' . SITEID . '">' . $fullname . '</a>';
                    }
                }
            }
        }
        if (!empty($namesarray)) {
            echo "<ul class=\"teachers\">\n<li>";
            echo implode('</li><li>', $namesarray);
            echo "</li></ul>";
        }
    }
    require_once "{$CFG->dirroot}/enrol/enrol.class.php";
    $enrol = enrolment_factory::factory($course->enrol);
    echo $enrol->get_access_icons($course);
    echo '</div><div class="summary">';
    $options = NULL;
    $options->noclean = true;
    $options->para = false;
    echo format_text($course->summary, FORMAT_MOODLE, $options, $course->id);
    echo '</div>';
    echo '</div>';
    echo '<div class="clearer"></div>';
}
开发者ID:veritech,项目名称:pare-project,代码行数:40,代码来源:lib.php

示例10: fn_sg_course_uses_sgenrol

/**
 * Returns true if the specified course is using site group enrolment.
 *
 * @param object $course The course in question. Requires the 'enrol' field as a minimum.
 * @return boolean
 */
function fn_sg_course_uses_sgenrol($course)
{
    global $CFG;
    require_once $CFG->dirroot . '/enrol/enrol.class.php';
    /// We don't add course groups to courses using the site group enrolment plug-in.
    $enrol = enrolment_factory::factory($course->enrol);
    $enrolp = get_class($enrol);
    $enrolp = substr($enrolp, strlen('enrolment_plugin_'));
    return $enrolp == FNSITEGROUPENROL;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:16,代码来源:lib.php

示例11: admin_setting_configselect

 $temp->add(new admin_setting_configselect('moodlecourse/showreports', get_string('showreports'), '', 0, array(0 => get_string('no'), 1 => get_string('yes'))));
 if (isset($CFG->maxbytes)) {
     $choices = get_max_upload_sizes($CFG->maxbytes);
 } else {
     $choices = get_max_upload_sizes();
 }
 $temp->add(new admin_setting_configselect('moodlecourse/maxbytes', get_string('maximumupload'), get_string('coursehelpmaximumupload'), key($choices), $choices));
 $temp->add(new admin_setting_configselect('moodlecourse/metacourse', get_string('metacourse'), get_string('coursehelpmetacourse'), 0, array(0 => get_string('no'), 1 => get_string('yes'))));
 ///enrolement course settings
 $temp->add(new admin_setting_heading('enrolhdr', get_string('enrolments'), ''));
 require_once $CFG->dirroot . '/enrol/enrol.class.php';
 $choices = array();
 $modules = explode(',', $CFG->enrol_plugins_enabled);
 foreach ($modules as $module) {
     $name = get_string('enrolname', "enrol_{$module}");
     $plugin = enrolment_factory::factory($module);
     if (method_exists($plugin, 'print_entry')) {
         $choices[$name] = $module;
     }
 }
 asort($choices);
 $choices = array_flip($choices);
 $choices = array_merge(array('' => get_string('sitedefault') . ' (' . get_string('enrolname', "enrol_{$CFG->enrol}") . ')'), $choices);
 $temp->add(new admin_setting_configselect('moodlecourse/enrol', get_string('enrolmentplugins'), get_string('coursehelpenrolmentplugins'), key($choices), $choices));
 $choices = array(0 => get_string('no'), 1 => get_string('yes'), 2 => get_string('enroldate'));
 $temp->add(new admin_setting_configselect('moodlecourse/enrollable', get_string('enrollable'), get_string('coursehelpenrollable'), 1, $choices));
 $periodmenu = array();
 $periodmenu[0] = get_string('unlimited');
 for ($i = 1; $i <= 365; $i++) {
     $seconds = $i * 86400;
     $periodmenu[$seconds] = get_string('numdays', '', $i);
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:courses.php

示例12: print_course

/**
 * Print a description of a course, suitable for browsing in a list.
 *
 * @param object $course the course object.
 * @param string $highlightterms (optional) some search terms that should be highlighted in the display.
 */
function print_course($course, $highlightterms = '')
{
    global $CFG, $USER;
    if (isset($course->context)) {
        $context = $course->context;
    } else {
        $context = get_context_instance(CONTEXT_COURSE, $course->id);
    }
    $linkcss = $course->visible ? '' : ' class="dimmed" ';
    echo '<div class="coursebox clearfix">';
    echo '<div class="info">';
    echo '<div class="name"><a title="' . get_string('entercourse') . '"' . $linkcss . ' href="' . $CFG->wwwroot . '/course/view.php?id=' . $course->id . '">' . highlight($highlightterms, format_string($course->fullname)) . '</a></div>';
    /// first find all roles that are supposed to be displayed
    if (!empty($CFG->coursemanager)) {
        $managerroles = split(',', $CFG->coursemanager);
        $canseehidden = has_capability('moodle/role:viewhiddenassigns', $context);
        $namesarray = array();
        if (isset($course->managers)) {
            if (count($course->managers)) {
                $rusers = $course->managers;
                $canviewfullnames = has_capability('moodle/site:viewfullnames', $context);
                /// Rename some of the role names if needed
                if (isset($context)) {
                    $aliasnames = get_records('role_names', 'contextid', $context->id, '', 'roleid,contextid,name');
                }
                // keep a note of users displayed to eliminate duplicates
                $usersshown = array();
                foreach ($rusers as $ra) {
                    // if we've already displayed user don't again
                    if (in_array($ra->user->id, $usersshown)) {
                        continue;
                    }
                    $usersshown[] = $ra->user->id;
                    if ($ra->hidden == 0 || $canseehidden) {
                        $fullname = fullname($ra->user, $canviewfullnames);
                        if ($ra->hidden == 1) {
                            $status = " <img src=\"{$CFG->pixpath}/t/show.gif\" title=\"" . get_string('userhashiddenassignments', 'role') . "\" alt=\"" . get_string('hiddenassign') . "\" class=\"hide-show-image\"/>";
                        } else {
                            $status = '';
                        }
                        if (isset($aliasnames[$ra->roleid])) {
                            $ra->rolename = $aliasnames[$ra->roleid]->name;
                        }
                        $namesarray[] = format_string($ra->rolename) . ': <a href="' . $CFG->wwwroot . '/user/view.php?id=' . $ra->user->id . '&amp;course=' . SITEID . '">' . $fullname . '</a>' . $status;
                    }
                }
            }
        } else {
            $rusers = get_role_users($managerroles, $context, true, '', 'r.sortorder ASC, u.lastname ASC', $canseehidden);
            if (is_array($rusers) && count($rusers)) {
                $canviewfullnames = has_capability('moodle/site:viewfullnames', $context);
                /// Rename some of the role names if needed
                if (isset($context)) {
                    $aliasnames = get_records('role_names', 'contextid', $context->id, '', 'roleid,contextid,name');
                }
                foreach ($rusers as $teacher) {
                    $fullname = fullname($teacher, $canviewfullnames);
                    /// Apply role names
                    if (isset($aliasnames[$teacher->roleid])) {
                        $teacher->rolename = $aliasnames[$teacher->roleid]->name;
                    }
                    $namesarray[] = format_string($teacher->rolename) . ': <a href="' . $CFG->wwwroot . '/user/view.php?id=' . $teacher->id . '&amp;course=' . SITEID . '">' . $fullname . '</a>';
                }
            }
        }
        if (!empty($namesarray)) {
            echo "<ul class=\"teachers\">\n<li>";
            echo implode('</li><li>', $namesarray);
            echo "</li></ul>";
        }
    }
    require_once "{$CFG->dirroot}/enrol/enrol.class.php";
    $enrol = enrolment_factory::factory($course->enrol);
    echo $enrol->get_access_icons($course);
    echo '</div><div class="summary">';
    $options = NULL;
    $options->noclean = true;
    $options->para = false;
    echo highlight($highlightterms, format_text($course->summary, FORMAT_MOODLE, $options, $course->id));
    echo '</div>';
    echo '</div>';
}
开发者ID:arshanam,项目名称:Moodle-ITScholars-LMS,代码行数:88,代码来源:lib.php

示例13: check_entry

 /**
 * This function enables internal enrolment when PayPal is primary and course key is set at the same time.
 *
 * @param    form    the form data submitted, as an object
 * @param    course  the current course, as an object
 */
 function check_entry($form, $course)
 {
     $manual = enrolment_factory::factory('manual');
     $manual->check_entry($form, $course);
     if (isset($manual->errormsg)) {
         $this->errormsg = $manual->errormsg;
     }
 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:14,代码来源:enrol.php

示例14: definition


//.........这里部分代码省略.........
     $mform->setHelpButton('showgrades', array('coursegrades', get_string('grades')), true);
     $mform->setDefault('showgrades', $courseconfig->showgrades);
     $mform->addElement('selectyesno', 'showreports', get_string('showreports'));
     $mform->setHelpButton('showreports', array('coursereports', get_string('activityreport')), true);
     $mform->setDefault('showreports', $courseconfig->showreports);
     $choices = get_max_upload_sizes($CFG->maxbytes);
     $mform->addElement('select', 'maxbytes', get_string('maximumupload'), $choices);
     $mform->setHelpButton('maxbytes', array('courseuploadsize', get_string('maximumupload')), true);
     $mform->setDefault('maxbytes', $courseconfig->maxbytes);
     if (!empty($CFG->allowcoursethemes)) {
         $themes = array();
         $themes[''] = get_string('forceno');
         $themes += get_list_of_themes();
         $mform->addElement('select', 'theme', get_string('forcetheme'), $themes);
     }
     $meta = array();
     $meta[0] = get_string('no');
     $meta[1] = get_string('yes');
     if ($disable_meta === false) {
         $mform->addElement('select', 'metacourse', get_string('managemeta'), $meta);
         $mform->setHelpButton('metacourse', array('metacourse', get_string('metacourse')), true);
         $mform->setDefault('metacourse', $courseconfig->metacourse);
     } else {
         // no metacourse element - we do not want to change it anyway!
         $mform->addElement('static', 'nometacourse', get_string('managemeta'), (empty($course->metacourse) ? $meta[0] : $meta[1]) . " - {$disable_meta} ");
         $mform->setHelpButton('nometacourse', array('metacourse', get_string('metacourse')), true);
     }
     //--------------------------------------------------------------------------------
     $mform->addElement('header', 'enrolhdr', get_string('enrolments'));
     $choices = array();
     $modules = explode(',', $CFG->enrol_plugins_enabled);
     foreach ($modules as $module) {
         $name = get_string('enrolname', "enrol_{$module}");
         $plugin = enrolment_factory::factory($module);
         if (method_exists($plugin, 'print_entry')) {
             $choices[$name] = $module;
         }
     }
     asort($choices);
     $choices = array_flip($choices);
     $choices = array_merge(array('' => get_string('sitedefault') . ' (' . get_string('enrolname', "enrol_{$CFG->enrol}") . ')'), $choices);
     $mform->addElement('select', 'enrol', get_string('enrolmentplugins'), $choices);
     $mform->setHelpButton('enrol', array('courseenrolmentplugins', get_string('enrolmentplugins')), true);
     $mform->setDefault('enrol', $courseconfig->enrol);
     $roles = get_assignable_roles($context);
     if (!empty($course)) {
         // add current default role, so that it is selectable even when user can not assign it
         if ($current_role = $DB->get_record('role', array('id' => $course->defaultrole))) {
             $roles[$current_role->id] = strip_tags(format_string($current_role->name, true));
         }
     }
     $choices = array();
     if ($sitedefaultrole = $DB->get_record('role', array('id' => $CFG->defaultcourseroleid))) {
         $choices[0] = get_string('sitedefault') . ' (' . $sitedefaultrole->name . ')';
     } else {
         $choices[0] = get_string('sitedefault');
     }
     $choices = $choices + $roles;
     // fix for MDL-9197
     foreach ($choices as $choiceid => $choice) {
         $choices[$choiceid] = format_string($choice);
     }
     $mform->addElement('select', 'defaultrole', get_string('defaultrole', 'role'), $choices);
     $mform->setDefault('defaultrole', 0);
     $radio = array();
     $radio[] =& MoodleQuickForm::createElement('radio', 'enrollable', null, get_string('no'), 0);
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:67,代码来源:edit_form.php

示例15: check_enrolment_plugins

/**
 * Check all the login enrolment information for the given user object
 * by querying the enrolment plugins
 * @return void
 */
function check_enrolment_plugins(&$user)
{
    global $CFG;
    if (empty($user->id) or isguestuser($user)) {
        // shortcut - there is no enrolment work for guests and not-logged-in users
        return;
    }
    static $inprogress = array();
    // To prevent this function being called more than once in an invocation
    if (!empty($inprogress[$user->id])) {
        return;
    }
    $inprogress[$user->id] = true;
    // Set the flag
    require_once $CFG->dirroot . '/enrol/enrol.class.php';
    if (!($plugins = explode(',', $CFG->enrol_plugins_enabled))) {
        $plugins = array($CFG->enrol);
    }
    foreach ($plugins as $plugin) {
        $enrol = enrolment_factory::factory($plugin);
        if (method_exists($enrol, 'setup_enrolments')) {
            /// Plugin supports Roles (Moodle 1.7 and later)
            $enrol->setup_enrolments($user);
        } else {
            /// Run legacy enrolment methods
            if (method_exists($enrol, 'get_student_courses')) {
                $enrol->get_student_courses($user);
            }
            if (method_exists($enrol, 'get_teacher_courses')) {
                $enrol->get_teacher_courses($user);
            }
            /// deal with $user->students and $user->teachers stuff
            unset($user->student);
            unset($user->teacher);
        }
        unset($enrol);
    }
    unset($inprogress[$user->id]);
    // Unset the flag
}
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:45,代码来源:accesslib.php


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