Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 12... Línea 12...
12
// GNU General Public License for more details.
12
// GNU General Public License for more details.
13
//
13
//
14
// You should have received a copy of the GNU General Public License
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
Línea 16... Línea -...
16
 
-
 
17
/**
-
 
18
 * Form to allow user to set their default home page
-
 
19
 *
-
 
20
 * @package     core_user
-
 
21
 * @copyright   2019 Paul Holden <paulh@moodle.com>
-
 
22
 * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-
 
23
 */
-
 
24
 
16
 
Línea -... Línea 17...
-
 
17
namespace core_user\form;
-
 
18
 
25
namespace core_user\form;
19
use core\di;
-
 
20
use core\hook\manager;
Línea 26... Línea 21...
26
 
21
use core\lang_string;
Línea 27... Línea 22...
27
use lang_string;
22
use core_user\hook\extend_default_homepage;
Línea 28... Línea 23...
28
 
23
 
29
defined('MOODLE_INTERNAL') || die;
24
defined('MOODLE_INTERNAL') || die;
30
 
25
 
-
 
26
require_once($CFG->dirroot . '/lib/formslib.php');
31
require_once($CFG->dirroot . '/lib/formslib.php');
27
 
32
 
28
/**
33
/**
29
 * Form to allow user to set their default home page
34
 * Form class
30
 *
Línea 53... Línea 49...
53
        if (!empty($CFG->enabledashboard)) {
49
        if (!empty($CFG->enabledashboard)) {
54
            $options[HOMEPAGE_MY] = new lang_string('mymoodle', 'admin');
50
            $options[HOMEPAGE_MY] = new lang_string('mymoodle', 'admin');
55
        }
51
        }
56
        $options[HOMEPAGE_MYCOURSES] = new lang_string('mycourses', 'admin');
52
        $options[HOMEPAGE_MYCOURSES] = new lang_string('mycourses', 'admin');
Línea -... Línea 53...
-
 
53
 
-
 
54
        // Allow hook callbacks to extend options.
-
 
55
        $hook = new extend_default_homepage(true);
-
 
56
        di::get(manager::class)->dispatch($hook);
-
 
57
        $options += $hook->get_options();
57
 
58
 
58
        $mform->addElement('select', 'defaulthomepage', get_string('defaulthomepageuser'), $options);
59
        $mform->addElement('select', 'defaulthomepage', get_string('defaulthomepageuser'), $options);
59
        $mform->addHelpButton('defaulthomepage', 'defaulthomepageuser');
60
        $mform->addHelpButton('defaulthomepage', 'defaulthomepageuser');
Línea 60... Línea 61...
60
        $mform->setDefault('defaulthomepage', get_default_home_page());
61
        $mform->setDefault('defaulthomepage', get_default_home_page());