. /** * * @package enrol_apply * @copyright 2016 sudile GbR (http://www.sudile.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @author Johannes Burk */ defined('MOODLE_INTERNAL') || die(); class enrol_apply_renderer extends plugin_renderer_base { public function manage_page($table, $manageurl, $instance) { echo $this->header(); echo $this->heading(get_string('confirmusers', 'enrol_apply')); echo get_string('confirmusers_desc', 'enrol_apply'); $this->manage_form($table, $manageurl, $instance); echo $this->footer(); } public function edit_page($mform) { echo $this->header(); echo $this->heading(get_string('pluginname', 'enrol_apply')); $mform->display(); echo $this->footer(); } public function manage_form($table, $manageurl, $instance) { echo html_writer::start_tag('form', array( 'id' => 'enrol_apply_manage_form', 'method' => 'post', 'action' => $manageurl->out())); $this->manage_table($table, $instance); if ($table->totalrows > 0) { echo html_writer::empty_tag('br'); echo html_writer::start_tag('div', array('class' => 'formaction')); $formactions = array( 'confirm' => get_string('btnconfirm', 'enrol_apply'), 'wait' => get_string('btnwait', 'enrol_apply'), 'cancel' => get_string('btncancel', 'enrol_apply')); echo html_writer::tag('label', get_string('withselectedusers'), array('for' => 'formaction')); echo html_writer::select($formactions, 'formaction', '', array('' => 'choosedots'), array('id' => 'formaction')); echo html_writer::tag('noscript', html_writer::empty_tag('input', array('type' => 'submit', get_string('submit'))), array('style' => 'display: inline;')); echo html_writer::end_tag('div'); $this->page->requires->js_call_amd('enrol_apply/manage', 'init'); } echo html_writer::end_tag('form'); } public function info_page($table, $manageurl,$instance) { echo $this->header(); echo $this->heading(get_string('submitted_info', 'enrol_apply')); echo get_string('submitted_info', 'enrol_apply'); $this->info_form($table, $manageurl,$instance); echo $this->footer(); } public function manage_table($table, $instance) { $columns = array( 'checkboxcolumn', 'course', 'fullname', // Magic happens here: The column heading will automatically be set. 'email', 'applydate', 'applycomment'); $headers = array( html_writer::checkbox('toggleall', 'toggleall', false, '', array('id' => 'toggleall')), get_string('course'), 'fullname', // Magic happens here: The column heading will automatically be set due to column name 'fullname'. get_string('email'), get_string('applydate', 'enrol_apply'), $instance->customtext2); $table->define_columns($columns); $table->define_headers($headers); $table->sortable(true, 'id'); $table->out(50, true); } public function info_form($table, $manageurl,$instance) { echo html_writer::start_tag('form', array( 'id' => 'enrol_apply_info_form', 'method' => 'post', 'action' => $manageurl->out())); $this->info_table($table,$instance); if ($table->totalrows > 0) { echo html_writer::empty_tag('br'); echo html_writer::start_tag('div', array('class' => 'formaction')); echo html_writer::end_tag('div'); $this->page->requires->js_call_amd('enrol_apply/info', 'init'); } echo html_writer::end_tag('form'); } public function info_table($table,$instance) { $columns = array( 'fullname', 'applycomment'); $headers = array( 'User', // Magic happens here: The column heading will automatically be set due to column name 'fullname'. $instance->customtext2); $table->define_columns($columns); $table->define_headers($headers); $table->sortable(true, 'id'); $table->out(50, true); } public function application_notification_mail_body( $course, $user, $manageurl, $applydescription, $standarduserfields = null, $extrauserfields = null) { $body = '

'. get_string('coursename', 'enrol_apply') .': '.format_string($course->fullname).'

'; $body .= '

'. get_string('applyuser', 'enrol_apply') .': '.$user->firstname.' '.$user->lastname.'

'; $body .= '

'. get_string('comment', 'enrol_apply') .': '.$applydescription.'

'; if ($standarduserfields) { $body .= '

'. get_string('user_profile', 'enrol_apply').'

'; $body .= '

'. get_string('firstname') .': '.$standarduserfields->firstname.'

'; $body .= '

'. get_string('lastname') .': '.$standarduserfields->lastname.'

'; $body .= '

'. get_string('email') .': '.$standarduserfields->email.'

'; $body .= '

'. get_string('city') .': '.$standarduserfields->city.'

'; $body .= '

'. get_string('country') .': '.$standarduserfields->country.'

'; if(isset($standarduserfields->lang)){ $body .= '

'. get_string('preferredlanguage') .': '.$standarduserfields->lang.'

'; } $body .= '

'. get_string('description') .': '.$standarduserfields->description_editor['text'].'

'; $body .= '

'. get_string('firstnamephonetic') .': '.$standarduserfields->firstnamephonetic.'

'; $body .= '

'. get_string('lastnamephonetic') .': '.$standarduserfields->lastnamephonetic.'

'; $body .= '

'. get_string('middlename') .': '.$standarduserfields->middlename.'

'; $body .= '

'. get_string('alternatename') .': '.$standarduserfields->alternatename.'

'; $body .= '

'. get_string('url') .': '.$standarduserfields->url.'

'; $body .= '

'. get_string('icqnumber') .': '.$standarduserfields->icq.'

'; $body .= '

'. get_string('skypeid') .': '.$standarduserfields->skype.'

'; $body .= '

'. get_string('aimid') .': '.$standarduserfields->aim.'

'; $body .= '

'. get_string('yahooid') .': '.$standarduserfields->yahoo.'

'; $body .= '

'. get_string('msnid') .': '.$standarduserfields->msn.'

'; $body .= '

'. get_string('idnumber') .': '.$standarduserfields->idnumber.'

'; $body .= '

'. get_string('institution') .': '.$standarduserfields->institution.'

'; $body .= '

'. get_string('department') .': '.$standarduserfields->department.'

'; $body .= '

'. get_string('phone') .': '.$standarduserfields->phone1.'

'; $body .= '

'. get_string('phone2') .': '.$standarduserfields->phone2.'

'; $body .= '

'. get_string('address') .': '.$standarduserfields->address.'

'; } if ($extrauserfields) { foreach ($extrauserfields as $key => $value) { $body .= '

'. $key .': '.$value.'

'; } } $body .= '

'. html_writer::link($manageurl, get_string('applymanage', 'enrol_apply')).'

'; return $body; } }