本文整理汇总了PHP中user::moodle_fullname方法的典型用法代码示例。如果您正苦于以下问题:PHP user::moodle_fullname方法的具体用法?PHP user::moodle_fullname怎么用?PHP user::moodle_fullname使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类user
的用法示例。
在下文中一共展示了user::moodle_fullname方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_context_name
/**
* Returns human readable context identifier.
*
* @param boolean $withprefix whether to prefix the name of the context with User
* @param boolean $short does not apply to user context
* @return string the human readable context name.
*/
public function get_context_name($withprefix = true, $short = false)
{
global $DB;
$name = '';
if ($user = new \user($this->_instanceid)) {
$user->load();
if ($withprefix) {
$name = get_string('user', 'local_elisprogram') . ': ';
}
$name .= $user->moodle_fullname();
}
return $name;
}
示例2: class_notcompleted_handler
/**
* Function to handle class not completed events.
*
* @param student $student The class enrolment / student object who is "not completed"
* @uses $CFG
* @uses $DB
* @return boolean TRUE is successful, otherwise FALSE
*/
public static function class_notcompleted_handler($student)
{
global $CFG, $DB;
require_once elispm::lib('notifications.php');
/// Does the user receive a notification?
$sendtouser = elis::$config->local_elisprogram->notify_classnotcompleted_user;
$sendtorole = elis::$config->local_elisprogram->notify_classnotcompleted_role;
$sendtosupervisor = elis::$config->local_elisprogram->notify_classnotcompleted_supervisor;
/// If nobody receives a notification, we're done.
if (!$sendtouser && !$sendtorole && !$sendtosupervisor) {
return true;
}
if (!empty($student->moodlecourseid)) {
if (!($context = context_course::instance($student->moodlecourseid))) {
if (in_cron()) {
mtrace(get_string('invalidcontext'));
} else {
debugging(get_string('invalidcontext'));
}
return true;
}
} else {
$context = context_system::instance();
}
$message = new notification();
/// Set up the text of the message
$text = empty(elis::$config->local_elisprogram->notify_classnotcompleted_message) ? get_string('notifyclassnotcompletedmessagedef', self::LANG_FILE) : elis::$config->local_elisprogram->notify_classnotcompleted_message;
$search = array('%%userenrolname%%', '%%classname%%', '%%coursename%%');
$user = new user($student->userid);
if (!$user) {
if (in_cron()) {
mtrace(get_string('nouser', 'local_elisprogram'));
} else {
debugging(get_string('nouser', 'local_elisprogram'));
}
return true;
}
$user->load();
// Get course info
$pmcourse = $DB->get_record(course::TABLE, array('id' => $student->courseid));
$pmclass = $DB->get_record(pmclass::TABLE, array('id' => $student->classid));
$replace = array($user->moodle_fullname(), $pmclass->idnumber, $pmcourse->name);
$text = str_replace($search, $replace, $text);
$eventlog = new Object();
$eventlog->event = 'class_notcompleted';
$eventlog->instance = $student->classid;
$eventlog->fromuserid = $user->id;
if ($sendtouser) {
$message->send_notification($text, $user, null, $eventlog);
}
$users = array();
if ($sendtorole) {
/// Get all users with the notify_classnotcomplete capability.
if ($roleusers = get_users_by_capability($context, 'local/elisprogram:notify_classnotcomplete')) {
$users = $users + $roleusers;
}
}
if ($sendtosupervisor) {
/// Get parent-context users.
if ($supervisors = pm_get_users_by_capability('user', $user->id, 'local/elisprogram:notify_classnotcomplete')) {
$users = $users + $supervisors;
}
}
// Send notifications to any users who need to receive them.
foreach ($users as $touser) {
$message->send_notification($text, $touser, $user, $eventlog);
}
return true;
}
示例3: edit_form_html
/**
* Return the HTML to edit a specific instructor.
* This could be extended to allow for application specific editing, for example
* a Moodle interface to its formslib.
*
* @param int $classid The class ID.
* @param string $sort Field to sort on.
* @param string $dir Direction of sort.
* @param int $page The page to start at.
* @param int $perpage Number of records per page.
* @param string $namesearch Search string for item name.
* @param string $alpha Start initial of item name filter.
* @return string The form HTML, without the form.
*/
public function edit_form_html($classid, $sort = 'name', $dir = 'ASC', $page = 0, $perpage = 30, $namesearch = '', $alpha = '')
{
global $CFG, $OUTPUT, $SESSION, $PAGE;
$action = optional_param('action', '', PARAM_ALPHA);
$this->classid = $classid;
$output = '';
ob_start();
if (empty($this->id)) {
$columns = array('assign' => array('header' => get_string('assign', self::LANG_FILE), 'display_function' => 'htmltab_display_function', 'sortable' => false), 'idnumber' => array('header' => get_string('class_idnumber', self::LANG_FILE), 'display_function' => 'htmltab_display_function'), 'name' => array('header' => get_string('tag_name', self::LANG_FILE), 'display_function' => 'htmltab_display_function'), 'assigntime' => array('header' => get_string('assigntime', self::LANG_FILE), 'display_function' => 'htmltab_display_function', 'sortable' => false), 'completetime' => array('header' => get_string('completion_time', self::LANG_FILE), 'display_function' => 'htmltab_display_function', 'sortable' => false));
} else {
$columns = array('idnumber' => array('header' => get_string('class_idnumber', self::LANG_FILE), 'display_function' => 'htmltab_display_function'), 'name' => array('header' => get_string('tag_name', self::LANG_FILE), 'display_function' => 'htmltab_display_function'), 'assigntime' => array('header' => get_string('assigntime', self::LANG_FILE), 'display_function' => 'htmltab_display_function', 'sortable' => false), 'completetime' => array('header' => get_string('completion_time', self::LANG_FILE), 'display_function' => 'htmltab_display_function', 'sortable' => false));
}
if ($dir !== 'DESC') {
$dir = 'ASC';
}
if (isset($columns[$sort])) {
$columns[$sort]['sortable'] = $dir;
} else {
$sort = 'name';
$columns[$sort]['sortable'] = $dir;
}
$newarr = array();
$users = array();
if (empty($this->id)) {
$users = $this->get_users_avail($sort, $dir, $page * $perpage, $perpage, $namesearch, $alpha);
$usercount = $this->count_users_avail($namesearch, $alpha);
pmalphabox(new moodle_url('/local/elisprogram/index.php', array('s' => 'ins', 'section' => 'curr', 'action' => 'add', 'id' => $classid, 'sort' => $sort, 'dir' => $dir, 'perpage' => $perpage)), 'alpha', get_string('tag_name', self::LANG_FILE) . ':');
$pagingbar = new paging_bar($usercount, $page, $perpage, "index.php?s=ins&section=curr&id={$classid}&action=add&" . "sort={$sort}&dir={$dir}&perpage={$perpage}&alpha={$alpha}&" . "search=" . urlencode($namesearch));
// TBD: .'&'
echo $OUTPUT->render($pagingbar);
flush();
} else {
//error_log("instructor.class.php::edit_form_html(); userid = {$this->userid}");
$user = new stdClass();
$user->name = '?';
if ($tmpuser = new user($this->userid)) {
$tmpuser->load();
$user = $tmpuser->to_object();
$user->name = $tmpuser->moodle_fullname();
}
$users[] = $user;
$usercount = 0;
// TBD: 1 ???
}
$has_users = is_array($users) && !empty($users) || $users instanceof Iterator && $users->valid() === true ? true : false;
if (empty($this->id) && $has_users === false) {
$table = NULL;
} else {
$insobj = new instructor();
//$table->width = "100%";
foreach ($users as $user) {
$tabobj = new stdClass();
$assigntime = $this->assigntime;
$completetime = $this->completetime;
$selection = json_decode(retrieve_session_selection($user->id, 'add'));
if ($selection) {
$assigntime = pm_timestamp(0, 0, 0, $selection->enrolment_date->month, $selection->enrolment_date->day, $selection->enrolment_date->year);
$completetime = pm_timestamp(0, 0, 0, $selection->completion_date->month, $selection->completion_date->day, $selection->completion_date->year);
}
/* **** debug code
ob_start();
var_dump($user);
$tmp = ob_get_contents();
ob_end_clean();
error_log("instructor.class.php::edit_form_html() user = $tmp");
**** */
foreach ($columns as $column => $cdesc) {
switch ($column) {
case 'assign':
$tabobj->{$column} = '<input type="checkbox" id="checkbox' . $user->id . '" onClick="select_item(' . $user->id . ')" name="users[' . $user->id . '][assign]" value="1" ' . ($selection ? 'checked="checked"' : '') . '/>' . '<input type="hidden" name="users[' . $user->id . '][idnumber]" ' . 'value="' . $user->idnumber . '" />';
break;
case 'name':
case 'idnumber':
case 'description':
$tabobj->{$column} = $user->{$column};
break;
case 'assigntime':
$tabobj->{$column} = cm_print_date_selector('users[' . $user->id . '][startday]', 'users[' . $user->id . '][startmonth]', 'users[' . $user->id . '][startyear]', $assigntime, true);
break;
case 'completetime':
$tabobj->{$column} = cm_print_date_selector('users[' . $user->id . '][endday]', 'users[' . $user->id . '][endmonth]', 'users[' . $user->id . '][endyear]', $completetime, true);
break;
default:
$tabobj->{$column} = '';
break;
}
//.........这里部分代码省略.........
示例4: curriculum_notcompleted_handler
/**
* Function to handle curriculum not completed events.
*
*/
public static function curriculum_notcompleted_handler($curstudent)
{
global $CFG, $DB;
require_once elispm::lib('notifications.php');
/// Does the user receive a notification?
$sendtouser = elis::$config->local_elisprogram->notify_curriculumnotcompleted_user;
$sendtorole = elis::$config->local_elisprogram->notify_curriculumnotcompleted_role;
$sendtosupervisor = elis::$config->local_elisprogram->notify_curriculumnotcompleted_supervisor;
/// If nobody receives a notification, we're done.
if (!$sendtouser && !$sendtorole && !$sendtosupervisor) {
return true;
}
$context = context_system::instance();
// Send notifications
$message = new notification();
/// Set up the text of the message
$text = empty(elis::$config->local_elisprogram->notify_curriculumnotcompleted_message) ? get_string('notifycurriculumnotcompletedmessagedef', 'local_elisprogram') : elis::$config->local_elisprogram->notify_curriculumnotcompleted_message;
$user = new user($curstudent->userid);
if (!$user) {
return true;
}
$user->load();
// Get course info
$program = $DB->get_record(curriculum::TABLE, array('id' => $curstudent->curriculumid));
$search = array('%%userenrolname%%', '%%programname%%');
$replace = array($user->moodle_fullname(), $program->name);
$text = str_replace($search, $replace, $text);
$eventlog = new Object();
$eventlog->event = 'curriculum_notcompleted';
$eventlog->instance = $curstudent->id;
/// Store the assignment id.
$eventlog->fromuserid = $user->id;
if ($sendtouser) {
$message->send_notification($text, $user, null, $eventlog);
}
$users = array();
if ($sendtorole) {
/// Get all users with the notify_curriculumnotcomplete capability.
if ($roleusers = get_users_by_capability($context, 'local/elisprogram:notify_programnotcomplete')) {
$users = $users + $roleusers;
}
}
if ($sendtosupervisor) {
/// Get parent-context users.
if ($supervisors = pm_get_users_by_capability('user', $user->id, 'local/elisprogram:notify_programnotcomplete')) {
$users = $users + $supervisors;
}
}
foreach ($users as $u) {
$message->send_notification($text, $u, $user, $eventlog);
}
return true;
}
示例5: pm_notify_track_assign_handler
/**
* Triggered when a track assignment takes place.
* This function should use the CM configured values to send messages to appropriate users when a track assignment
* takes place. Users will be ones configured for the context, which can include the user that is assigned and users
* assigned to configured roles for that context. The message template used should be the one configured as well.
*
* @param object $eventdata the track assignment record
* @return boolean success
*
*/
function pm_notify_track_assign_handler($eventdata)
{
global $CFG, $DB, $USER;
/// Does the user receive a notification?
$sendtouser = isset(elis::$config->local_elisprogram->notify_trackenrol_user) ? elis::$config->local_elisprogram->notify_trackenrol_user : '';
$sendtorole = isset(elis::$config->local_elisprogram->notify_trackenrol_role) ? elis::$config->local_elisprogram->notify_trackenrol_role : '';
$sendtosupervisor = isset(elis::$config->local_elisprogram->notify_trackenrol_supervisor) ? elis::$config->local_elisprogram->notify_trackenrol_supervisor : '';
/// If nobody receives a notification, we're done.
if (!$sendtouser && !$sendtorole && !$sendtosupervisor) {
return true;
}
/// We get all context assigns, so check that this is a class. If not, we're done.
$context = context_system::instance();
/// Make sure this is a valid user.
$enroluser = new user($eventdata->userid);
if (!$enroluser) {
if (in_cron()) {
mtrace(getstring('nouser', 'local_elisprogram'));
} else {
print_error('nouser', 'local_elisprogram');
}
return true;
}
// Due to lazy loading, we need to pre-load this object
$enroluser->load();
if (empty($enroluser->id)) {
if (in_cron()) {
mtrace(getstring('nouser', 'local_elisprogram'));
} else {
print_error('nouser', 'local_elisprogram');
}
return true;
}
/// Get the track record from the track id.
if (!($track = $DB->get_record('local_elisprogram_trk', array('id' => $eventdata->trackid)))) {
if (in_cron()) {
mtrace(get_string('notrack', 'local_elisprogram'));
} else {
print_error('notrack', 'local_elisprogram');
}
return true;
}
$message = new notification();
/// Set up the text of the message
$text = empty(elis::$config->local_elisprogram->notify_trackenrol_message) ? get_string('notifytrackenrolmessagedef', 'local_elisprogram') : elis::$config->local_elisprogram->notify_trackenrol_message;
$search = array('%%userenrolname%%', '%%trackname%%');
$replace = array($enroluser->moodle_fullname(), $track->name);
$text = str_replace($search, $replace, $text);
if ($sendtouser) {
$message->send_notification($text, $enroluser);
}
$users = array();
if ($sendtorole) {
/// Get all users with the notify_trackenrol capability.
if ($roleusers = get_users_by_capability($context, 'local/elisprogram:notify_trackenrol')) {
$users = $users + $roleusers;
}
}
if ($sendtosupervisor) {
/// Get parent-context users.
if ($supervisors = pm_get_users_by_capability('user', $eventdata->userid, 'local/elisprogram:notify_trackenrol')) {
$users = $users + $supervisors;
}
}
foreach ($users as $user) {
$message->send_notification($text, $user, $enroluser);
}
/// If you don't return true, the message queue will clog and no more will be sent.
return true;
}
示例6: array
/**
* Specifies available report filters
* (empty by default but can be implemented by child class)
*
* @param boolean $init_data If true, signal the report to load the
* actual content of the filter objects
*
* @return array The list of available filters
*/
function get_filters($init_data = true)
{
global $CFG, $USER;
require_once $CFG->dirroot . '/local/elisprogram/accesslib.php';
$filters = array();
$autocomplete_opts = array('report' => $this->get_report_shortname(), 'ui' => 'inline', 'contextlevel' => CONTEXT_ELIS_USER, 'instance_fields' => array('idnumber' => get_string('filter_autocomplete_idnumber', $this->lang_file), 'firstname' => get_string('filter_autocomplete_firstname', $this->lang_file), 'lastname' => get_string('filter_autocomplete_lastname', $this->lang_file), 'username' => get_string('filter_autocomplete_username', $this->lang_file)), 'custom_fields' => '*', 'label_template' => '[[firstname]] [[lastname]]', 'configurable' => true, 'required' => true);
$permissions_filter = $this->get_user_permissions_filter('id', false);
$autocomplete_opts['selection_enabled'] = !isset($permissions_filter->select) || $permissions_filter->select != 'FALSE' ? true : false;
$autocomplete_opts['restriction_sql'] = $permissions_filter;
$last_user = $this->get_chosen_userid();
$cm_user_id = empty($last_user) ? cm_get_crlmuserid($USER->id) : $last_user;
if ($cm_user_id && ($cmuser = new user($cm_user_id))) {
$cmuser->load();
$autocomplete_opts['defaults'] = array('label' => $cmuser->moodle_fullname(), 'id' => $cm_user_id);
}
$filters[] = new generalized_filter_entry('filterautoc', 'crlmuser', 'id', get_string('fld_fullname', 'local_eliscore'), false, 'autocomplete_eliswithcustomfields', $autocomplete_opts);
$field_list = array('block_instance' => $this->id, 'reportname' => $this->get_report_shortname(), 'field_exceptions' => array('_elis_course_pretest', '_elis_course_posttest'), 'help' => array('individual_course_progress_field', get_string('displayname', $this->lang_file), $this->lang_file));
$filters[] = new generalized_filter_entry('field' . $this->id, 'field' . $this->id, 'id', get_string('selectcustomfields', $this->lang_file), false, 'custom_field_multiselect_values', $field_list);
// column selection checkboxes
$filters[] = new generalized_filter_entry('optional_columns', '', '', get_string('columns_options_heading', $this->lang_file), false, 'checkboxes', array('choices' => array('los' => get_string('los_label', $this->lang_file), 'totalscore' => get_string('totalscore_label', $this->lang_file), 'preposttest' => get_string('preposttest_label', $this->lang_file)), 'checked' => array('preposttest'), 'allowempty' => true, 'heading' => get_string('columns_options_heading', $this->lang_file), 'nofilter' => true, 'help' => array('optional_columns', get_string('displayname', $this->lang_file), $this->lang_file)));
return $filters;
}
示例7: array
/**
* Specifies available report filters
* (empty by default but can be implemented by child class)
*
* @param boolean $init_data If true, signal the report to load the
* actual content of the filter objects
* @uses $CFG
* @uses $USER
* @return array The list of available filters
*/
function get_filters($init_data = true)
{
global $CFG, $USER;
require_once $CFG->dirroot . '/local/elisprogram/accesslib.php';
$filters = array();
$autocomplete_opts = array('report' => $this->get_report_shortname(), 'ui' => 'inline', 'contextlevel' => CONTEXT_ELIS_USER, 'instance_fields' => array('idnumber' => get_string('filter_autocomplete_idnumber', $this->lang_file), 'firstname' => get_string('filter_autocomplete_firstname', $this->lang_file), 'lastname' => get_string('filter_autocomplete_lastname', $this->lang_file), 'username' => get_string('filter_autocomplete_username', $this->lang_file)), 'custom_fields' => '*', 'label_template' => '[[firstname]] [[lastname]]', 'configurable' => true, 'required' => true, 'help' => array('individual_user_report', get_string('displayname', $this->lang_file), 'rlreport_individual_user'));
$permissions_filter = $this->get_user_permissions_filter('id', false);
$autocomplete_opts['selection_enabled'] = !isset($permissions_filter->select) || $permissions_filter->select != 'FALSE' ? true : false;
$autocomplete_opts['restriction_sql'] = $permissions_filter;
$last_user = $this->get_chosen_userid();
$cm_user_id = empty($last_user) ? cm_get_crlmuserid($USER->id) : $last_user;
if ($cm_user_id && ($cmuser = new user($cm_user_id))) {
$cmuser->load();
$autocomplete_opts['defaults'] = array('label' => $cmuser->moodle_fullname(), 'id' => $cm_user_id);
}
$filters[] = new generalized_filter_entry('userid', 'usr', 'id', get_string('fld_fullname', 'local_eliscore'), false, 'autocomplete_eliswithcustomfields', $autocomplete_opts);
return $filters;
}
示例8: course_recurrence_handler
/**
* Function to handle course recurrence events.
*
* @param user $user CM user object representing the user in the course
*
* @return boolean TRUE is successful, otherwise FALSE
*/
public static function course_recurrence_handler($user)
{
global $DB;
require_once elispm::lib('notifications.php');
/// Does the user receive a notification?
$sendtouser = elis::$config->local_elisprogram->notify_courserecurrence_user;
$sendtorole = elis::$config->local_elisprogram->notify_courserecurrence_role;
$sendtosupervisor = elis::$config->local_elisprogram->notify_courserecurrence_supervisor;
/// If nobody receives a notification, we're done.
if (!$sendtouser && !$sendtorole && !$sendtosupervisor) {
return true;
}
$context = context_system::instance();
/// Make sure this is a valid user.
$enroluser = new user($user->userid);
if (!$enroluser) {
if (in_cron()) {
mtrace(get_string('nouser', 'local_elisprogram'));
} else {
print_error('nouser', 'local_elisprogram');
}
return true;
}
// Due to lazy loading, we need to pre-load this object
$enroluser->load();
if (empty($enroluser->id)) {
if (in_cron()) {
mtrace(get_string('nouser', 'local_elisprogram'));
} else {
print_error('nouser', 'local_elisprogram');
}
return true;
}
/// Set up the text of the message
$message = new notification();
$text = empty(elis::$config->local_elisprogram->notify_courserecurrence_message) ? get_string('notifycourserecurrencemessagedef', 'local_elisprogram') : elis::$config->local_elisprogram->notify_courserecurrence_message;
$search = array('%%userenrolname%%', '%%coursename%%');
$replace = array($enroluser->moodle_fullname(), $user->coursename);
$text = str_replace($search, $replace, $text);
$eventlog = new Object();
$eventlog->event = 'course_recurrence';
$eventlog->instance = $user->enrolmentid;
$eventlog->fromuserid = $enroluser->id;
if ($sendtouser) {
$message->send_notification($text, $enroluser, null, $eventlog);
}
$users = array();
if ($sendtorole) {
/// Get all users with the notify_courserecurrence capability.
if ($roleusers = get_users_by_capability($context, 'local/elisprogram:notify_courserecurrence')) {
$users = $users + $roleusers;
}
}
if ($sendtosupervisor) {
/// Get parent-context users.
if ($supervisors = pm_get_users_by_capability('user', $enroluser->id, 'local/elisprogram:notify_courserecurrence')) {
$users = $users + $supervisors;
}
}
foreach ($users as $u) {
$message->send_notification($text, $u, $enroluser, $eventlog);
}
return true;
}
示例9: definition
public function definition()
{
global $DB;
parent::definition();
$mform =& $this->_form;
if (!empty($this->_customdata['students'])) {
$student_list = $this->_customdata['students'];
$mform->addElement('header', 'waitlistaddform', get_string('waitinglistform_title', 'local_elisprogram'));
foreach ($student_list as $student) {
$mform->addElement('hidden', 'userid[' . $student->userid . ']', $student->userid);
$mform->setType('userid[' . $student->userid . ']', PARAM_INT);
$mform->addElement('hidden', 'classid[' . $student->userid . ']', $student->classid);
$mform->setType('classid[' . $student->userid . ']', PARAM_INT);
$mform->addElement('hidden', 'enrolmenttime[' . $student->userid . ']', $student->enrolmenttime);
$mform->setType('enrolmenttime[' . $student->userid . ']', PARAM_INT);
$enrol_options = array();
$enrol_options[] = $mform->createElement('radio', 'enrol[' . $student->userid . ']', '', get_string('yes'), 1);
$enrol_options[] = $mform->createElement('radio', 'enrol[' . $student->userid . ']', '', get_string('no'), 0);
$context = context_system::instance();
if (has_capability('local/elisprogram:overrideclasslimit', $context)) {
$mform->addElement('hidden', 'grade[' . $student->userid . ']', $student->grade);
$mform->setType('grade[' . $student->userid . ']', PARAM_INT);
$mform->addElement('hidden', 'credits[' . $student->credits . ']', $student->credits);
$mform->setType('credits[' . $student->credits . ']', PARAM_INT);
$mform->addElement('hidden', 'locked[' . $student->locked . ']', $student->locked);
$mform->setType('locked[' . $student->locked . ']', PARAM_INT);
$enrol_options[] = $mform->createElement('radio', 'enrol[' . $student->userid . ']', '', get_string('over_enrol', 'local_elisprogram'), 2);
}
$user = new stdClass();
$user->name = '?';
if ($tmpuser = new user($student->userid)) {
$tmpuser->load();
$user = $tmpuser->to_object();
$user->name = $tmpuser->moodle_fullname();
}
$mform->addGroup($enrol_options, 'options[' . $student->userid . ']', get_string('add_to_waitinglist', 'local_elisprogram', $user), array(' '), false);
}
} else {
if (!empty($this->_customdata['student_ids'])) {
$student_id = $this->_customdata['student_ids'];
foreach ($student_id as $id => $student) {
$mform->addElement('hidden', 'userid[' . $id . ']');
$mform->setType('userid[' . $id . ']', PARAM_INT);
$mform->addElement('hidden', 'classid[' . $id . ']');
$mform->setType('classid[' . $id . ']', PARAM_INT);
$mform->addElement('hidden', 'enrolmenttime[' . $id . ']');
$mform->setType('enrolmenttime[' . $id . ']', PARAM_INT);
$enrol_options = array();
$enrol_options[] = $mform->createElement('radio', 'enrol[' . $id . ']', '', get_string('yes'), 1);
$enrol_options[] = $mform->createElement('radio', 'enrol[' . $id . ']', '', get_string('no'), 0);
$context = context_system::instance();
if (has_capability('local/elisprogram:overrideclasslimit', $context)) {
$enrol_options[] = $mform->createElement('radio', 'enrol[' . $id . ']', '', get_string('over_enrol', 'local_elisprogram'), 2);
}
$name = 'no name';
$mform->addGroup($enrol_options, 'options[' . $id . ']', $name, '', false);
}
}
}
$mform->addElement('hidden', 'id');
$mform->setType('id', PARAM_INT);
$mform->addElement('submit', 'submitbutton', 'Save');
}