fixed define detection

This commit is contained in:
Petr Skoda 2010-09-17 12:34:03 +00:00
parent 1493741406
commit 894843b465

View file

@ -529,7 +529,7 @@ class course_enrolment_manager {
try { try {
role_unassign($roleid, $user->id, $this->context->id, '', NULL); role_unassign($roleid, $user->id, $this->context->id, '', NULL);
} catch (Exception $e) { } catch (Exception $e) {
if (is_defined('AJAX_SCRIPT')) { if (defined('AJAX_SCRIPT')) {
throw $e; throw $e;
} }
return false; return false;
@ -547,7 +547,7 @@ class course_enrolment_manager {
public function assign_role_to_user($roleid, $userid) { public function assign_role_to_user($roleid, $userid) {
require_capability('moodle/role:assign', $this->context); require_capability('moodle/role:assign', $this->context);
if (!array_key_exists($roleid, $this->get_assignable_roles())) { if (!array_key_exists($roleid, $this->get_assignable_roles())) {
if (is_defined('AJAX_SCRIPT')) { if (defined('AJAX_SCRIPT')) {
throw new moodle_exception('invalidrole'); throw new moodle_exception('invalidrole');
} }
return false; return false;