. /** * * @package enrol_apply * @copyright 2015 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) { echo $this->header(); echo $this->heading(get_string('confirmusers', 'enrol_apply')); echo get_string('confirmusers_desc', 'enrol_apply'); $this->manage_form($table, $manageurl); echo $this->footer(); } public function manage_form($table, $manageurl) { echo html_writer::start_tag('form', array('id' => 'enrol_apply_manage_form', 'method' => 'post', 'action' => $manageurl->out())); $this->manage_table($table); echo html_writer::start_tag('p', array('align' => 'center')); echo html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'confirm', 'value' => get_string('btnconfirm', 'enrol_apply'))); echo html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'wait', 'value' => get_string('btnwait', 'enrol_apply'))); echo html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'cancel', 'value' => get_string('btncancel', 'enrol_apply'))); echo html_writer::end_tag('p'); echo html_writer::end_tag('form'); } public function manage_table($table) { $columns = array( 'checkboxcolumn', 'course', 'fullname', // Magic happens here: The column heading will automatically be set. 'email', 'applydate', 'applycomment'); $headers = array( '', 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'), get_string('comment', 'enrol_apply')); $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, $info = null, $extra = 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($info){ $body .= '

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

'; $body .= '

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

'; $body .= '

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

'; $body .= '

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

'; $body .= '

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

'; $body .= '

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

'; $body .= '

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

'; $body .= '

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

'; $body .= '

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

'; $body .= '

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

'; $body .= '

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

'; $body .= '

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

'; $body .= '

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

'; $body .= '

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

'; $body .= '

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

'; $body .= '

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

'; $body .= '

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

'; $body .= '

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

'; $body .= '

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

'; $body .= '

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

'; $body .= '

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

'; $body .= '

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

'; $body .= '

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

'; $body .= '

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

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

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

'; } } $body .= '

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

'; return $body; } }