Server IP : 103.11.96.170 / Your IP : 3.142.135.246 Web Server : Microsoft-IIS/10.0 System : Windows NT WIN-F6SLGVICLOP 10.0 build 17763 (Windows Server 2016) AMD64 User : elibrary.unsap.ac.id ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF Directory (0777) : D:/localhost/lms/blocks/cocoon_users_slider/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php class block_cocoon_users_slider_edit_form extends block_edit_form { private function get_users() { global $DB, $OUTPUT, $PAGE; $usernames = []; if(empty($this->block->config->users)) return []; $ids = $this->block->config->users; list($uids, $params) = $DB->get_in_or_equal($ids); $rs = $DB->get_recordset_select('user', 'id ' . $uids, $params, '', 'id,firstname,lastname,email'); foreach ($rs as $record) { $usernames[$record->id] = fullname($record) . ' ' . $record->email; } $rs->close(); return $usernames; } /** * Extends the configuration form for block_cocoon_users_slider. */ protected function specific_definition($mform) { global $CFG; // Section header title. $mform->addElement('header', 'configheader', get_string('blocksettings', 'block')); // Please keep in mind that all elements defined here must start with 'config_'. $mform->addElement('text', 'config_title', get_string('config_title', 'theme_edumy')); $mform->setType('config_title', PARAM_TEXT); $usernames = $this->get_users(); $mform->addElement('autocomplete', 'config_users', get_string('config_users', 'theme_edumy'), $usernames, [ 'multiple' => true, 'ajax' => 'tool_lp/form-user-selector', ]); $mform->addRule('config_users', null, 'required'); include($CFG->dirroot . '/theme/edumy/ccn/block_handler/edit.php'); } }