本文整理汇总了PHP中events_trigger函数的典型用法代码示例。如果您正苦于以下问题:PHP events_trigger函数的具体用法?PHP events_trigger怎么用?PHP events_trigger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了events_trigger函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: user_signup
/**
* Sign up a new user ready for confirmation.
* Password is passed in plaintext.
*
* @param object $user new user object
* @param boolean $notify print notice with link and terminate
*/
function user_signup($user, $notify = true)
{
global $CFG, $DB;
require_once $CFG->dirroot . '/user/profile/lib.php';
$user->password = hash_internal_user_password($user->password);
$user->id = $DB->insert_record('user', $user);
/// Save any custom profile field information
profile_save_data($user);
$user = $DB->get_record('user', array('id' => $user->id));
events_trigger('user_created', $user);
if (!send_confirmation_email($user)) {
print_error('auth_emailnoemail', 'auth_email');
}
if ($notify) {
global $CFG, $PAGE, $OUTPUT;
$emailconfirm = get_string('emailconfirm');
$PAGE->navbar->add($emailconfirm);
$PAGE->set_title($emailconfirm);
$PAGE->set_heading($PAGE->course->fullname);
echo $OUTPUT->header();
notice(get_string('emailconfirmsent', '', $user->email), "{$CFG->wwwroot}/index.php");
} else {
return true;
}
}
开发者ID:JP-Git,项目名称:moodle,代码行数:32,代码来源:auth.php
示例2: user_signup
/**
* Sign up a new user ready for confirmation.
* Password is passed in plaintext.
*
* @param object $user new user object (with system magic quotes)
* @param boolean $notify print notice with link and terminate
*/
function user_signup($user, $notify = true)
{
global $CFG;
require_once $CFG->dirroot . '/user/profile/lib.php';
$user->password = hash_internal_user_password($user->password);
if (!($user->id = insert_record('user', $user))) {
print_error('auth_emailnoinsert', 'auth');
}
/// Save any custom profile field information
profile_save_data($user);
$user = get_record('user', 'id', $user->id);
events_trigger('user_created', $user);
if (!send_confirmation_email($user)) {
print_error('auth_emailnoemail', 'auth');
}
if ($notify) {
global $CFG;
$emailconfirm = get_string('emailconfirm');
$navlinks = array();
$navlinks[] = array('name' => $emailconfirm, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header($emailconfirm, $emailconfirm, $navigation);
notice(get_string('emailconfirmsent', '', $user->email), "{$CFG->wwwroot}/index.php");
} else {
return true;
}
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:34,代码来源:auth.php
示例3: cluster_groups_changed
function cluster_groups_changed($name)
{
global $DB;
$shortname = substr($name, strpos($name, 'local_elisprogram_') + strlen('local_elisprogram_'));
// TBD: following didn't work?
//$value = elis::$config->local_elisprogram->$shortname;
$value = $DB->get_field('config_plugins', 'value', array('plugin' => 'local_elisprogram', 'name' => $shortname));
//error_log("/local/elisprogram/lib/lib.php::cluster_groups_changed({$name}) {$shortname} = '{$value}'");
if (!empty($value)) {
$event = 'crlm_' . $shortname . '_enabled';
error_log("Triggering event: {$event}");
events_trigger($event, 0);
}
}
开发者ID:jamesmcq,项目名称:elis,代码行数:14,代码来源:lib.php
示例4: user_update_user
/**
* Update a user with a user object (will compare against the ID)
*
* @param object $user the user to update
*/
function user_update_user($user)
{
global $DB;
// set the timecreate field to the current time
if (!is_object($user)) {
$user = (object) $user;
}
// unset password here, for updating later
if (isset($user->password)) {
$passwd = $user->password;
unset($user->password);
}
$user->timemodified = time();
$DB->update_record('user', $user);
// trigger user_updated event on the full database user row
$updateduser = $DB->get_record('user', array('id' => $user->id));
events_trigger('user_updated', $updateduser);
// if password was set, then update its hash
if (isset($passwd)) {
update_internal_user_password($updateduser, $passwd);
}
}
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:27,代码来源:lib.php
示例5: user_signup
function user_signup($user, $notify = true)
{
global $CFG, $DB;
require_once $CFG->dirroot . '/user/profile/lib.php';
$password_clear = $user->password;
$user->password = hash_internal_user_password($user->password);
if (!($user->id = $DB->insert_record('user', $user))) {
print_error('auth_emailnoinsert', 'auth');
}
/// Save any custom profile field information
profile_save_data($user);
$conditions = array('id' => $user->id);
$user = $DB->get_record('user', $conditions);
/* Create user in Joomla */
$userinfo['username'] = $user->username;
$userinfo['password'] = $password_clear;
$userinfo['password2'] = $password_clear;
$userinfo['name'] = $user->firstname . " " . $user->lastname;
$userinfo['email'] = $user->email;
$userinfo['block'] = 1;
$this->call_method("createUser", $userinfo);
events_trigger('user_created', $user);
if (!send_confirmation_email($user)) {
print_error('auth_emailnoemail', 'auth');
}
if ($notify) {
global $CFG;
$emailconfirm = get_string('emailconfirm');
$navlinks = array();
$navlinks[] = array('name' => $emailconfirm, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header($emailconfirm, $emailconfirm, $navigation);
notice(get_string('emailconfirmsent', '', $user->email), "{$CFG->wwwroot}/index.php");
} else {
return true;
}
}
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:37,代码来源:auth.php
示例6: groups_add_member
/**
* Adds a specified user to a group
* @param int $userid The user id
* @param int $groupid The group id
* @return boolean True if user added successfully or the user is already a
* member of the group, false otherwise.
*/
function groups_add_member($groupid, $userid)
{
if (!groups_group_exists($groupid)) {
return false;
}
if (groups_is_member($groupid, $userid)) {
return true;
}
$member = new object();
$member->groupid = $groupid;
$member->userid = $userid;
$member->timeadded = time();
if (!insert_record('groups_members', $member)) {
return false;
}
//update group info
set_field('groups', 'timemodified', $member->timeadded, 'id', $groupid);
// MDL-9983
$eventdata = new object();
$eventdata->groupid = $groupid;
$eventdata->userid = $userid;
events_trigger('group_user_added', $eventdata);
return true;
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:31,代码来源:lib.php
示例7: implode
} else {
$newlayout[] = 0;
}
}
$attempt->layout = implode(',', $newlayout);
}
// Save the attempt in the database.
$transaction = $DB->start_delegated_transaction();
question_engine::save_questions_usage_by_activity($quba);
$attempt->uniqueid = $quba->get_id();
$attempt->id = $DB->insert_record('quiz_attempts', $attempt);
// Log the new attempt.
if ($attempt->preview) {
add_to_log($course->id, 'quiz', 'preview', 'view.php?id=' . $quizobj->get_cmid(), $quizobj->get_quizid(), $quizobj->get_cmid());
} else {
add_to_log($course->id, 'quiz', 'attempt', 'review.php?attempt=' . $attempt->id, $quizobj->get_quizid(), $quizobj->get_cmid());
}
// Trigger event.
$eventdata = new stdClass();
$eventdata->component = 'mod_quiz';
$eventdata->attemptid = $attempt->id;
$eventdata->timestart = $attempt->timestart;
$eventdata->timestamp = $attempt->timestart;
$eventdata->userid = $attempt->userid;
$eventdata->quizid = $quizobj->get_quizid();
$eventdata->cmid = $quizobj->get_cmid();
$eventdata->courseid = $quizobj->get_courseid();
events_trigger('quiz_attempt_started', $eventdata);
$transaction->allow_commit();
// Redirect to the attempt page.
redirect($quizobj->attempt_url($attempt->id, $page));
开发者ID:vinoth4891,项目名称:clinique,代码行数:31,代码来源:startattempt.php
示例8: update_course
/**
* Update a course.
*
* Please note this functions does not verify any access control,
* the calling code is responsible for all validation (usually it is the form definition).
*
* @param object $data - all the data needed for an entry in the 'course' table
* @param array $editoroptions course description editor options
* @return void
*/
function update_course($data, $editoroptions = NULL)
{
global $CFG, $DB;
$data->timemodified = time();
$oldcourse = $DB->get_record('course', array('id' => $data->id), '*', MUST_EXIST);
$context = get_context_instance(CONTEXT_COURSE, $oldcourse->id);
if ($editoroptions) {
$data = file_postupdate_standard_editor($data, 'summary', $editoroptions, $context, 'course', 'summary', 0);
}
if (!isset($data->category) or empty($data->category)) {
// prevent nulls and 0 in category field
unset($data->category);
}
$movecat = (isset($data->category) and $oldcourse->category != $data->category);
if (!isset($data->visible)) {
// data not from form, add missing visibility info
$data->visible = $oldcourse->visible;
}
if ($data->visible != $oldcourse->visible) {
// reset the visibleold flag when manually hiding/unhiding course
$data->visibleold = $data->visible;
} else {
if ($movecat) {
$newcategory = $DB->get_record('course_categories', array('id' => $data->category));
if (empty($newcategory->visible)) {
// make sure when moving into hidden category the course is hidden automatically
$data->visible = 0;
}
}
}
// Update with the new data
$DB->update_record('course', $data);
$course = $DB->get_record('course', array('id' => $data->id));
if ($movecat) {
$newparent = get_context_instance(CONTEXT_COURSECAT, $course->category);
context_moved($context, $newparent);
}
fix_course_sortorder();
// Test for and remove blocks which aren't appropriate anymore
blocks_remove_inappropriate($course);
// Save any custom role names.
save_local_role_names($course->id, $data);
// update enrol settings
enrol_course_updated(false, $course, $data);
add_to_log($course->id, "course", "update", "edit.php?id={$course->id}", $course->id);
// Trigger events
events_trigger('course_updated', $course);
}
开发者ID:numbas,项目名称:moodle,代码行数:58,代码来源:lib.php
示例9: associate
/**
* Associates a cluster with a track.
*/
static function associate($cluster, $track, $autounenrol = true, $autoenrol = true)
{
global $CURMAN;
$db = $CURMAN->db;
// make sure we don't double-associate
if ($db->record_exists(CLSTTRKTABLE, 'clusterid', $cluster, 'trackid', $track)) {
return;
}
$record = new clustertrack();
$record->clusterid = $cluster;
$record->trackid = $track;
$record->autoenrol = $autoenrol;
$record->autounenrol = $autounenrol;
$record->data_insert_record();
// Enrol all users in the cluster into track.
$sql = 'SELECT uc.*
FROM ' . $CURMAN->db->prefix_table(CLSTASSTABLE) . ' as uc
JOIN ' . $CURMAN->db->prefix_table(USRTABLE) . ' as u
ON uc.userid = u.id
WHERE uc.clusterid = ' . $cluster . ' AND uc.autoenrol = 1
ORDER BY u.lastname';
$users = $db->get_records_sql($sql);
// $users = $db->get_records(CLSTUSERTABLE, 'clusterid', $cluster);
if ($users && !empty($autoenrol)) {
foreach ($users as $user) {
usertrack::enrol($user->userid, $track);
}
}
events_trigger('crlm_cluster_track_associated', $record);
}
开发者ID:remotelearner,项目名称:elis.cm,代码行数:33,代码来源:clustercurriculum.class.php
示例10: finish_setup_course_module
/**
* Called after the mod has set itself up, to finish off any course module settings
* (set instance id, add to correct section, set visibility, etc.) and send the response
*
* @param int $instanceid id returned by the mod when it was created
*/
protected function finish_setup_course_module($instanceid)
{
global $DB, $USER;
if (!$instanceid) {
// Something has gone wrong - undo everything we can.
delete_course_module($this->cm->id);
throw new moodle_exception('errorcreatingactivity', 'moodle', '', $this->module->name);
}
$DB->set_field('course_modules', 'instance', $instanceid, array('id' => $this->cm->id));
// Rebuild the course cache after update action
rebuild_course_cache($this->course->id, true);
$this->course->modinfo = null;
// Otherwise we will just get the old version back again.
$sectionid = course_add_cm_to_section($this->course, $this->cm->id, $this->section);
set_coursemodule_visible($this->cm->id, true);
// retrieve the final info about this module.
$info = get_fast_modinfo($this->course);
if (!isset($info->cms[$this->cm->id])) {
// The course module has not been properly created in the course - undo everything.
delete_course_module($this->cm->id);
throw new moodle_exception('errorcreatingactivity', 'moodle', '', $this->module->name);
}
$mod = $info->cms[$this->cm->id];
$mod->groupmodelink = $this->cm->groupmodelink;
$mod->groupmode = $this->cm->groupmode;
// Trigger mod_created event with information about this module.
$eventdata = new stdClass();
$eventdata->modulename = $mod->modname;
$eventdata->name = $mod->name;
$eventdata->cmid = $mod->id;
$eventdata->courseid = $this->course->id;
$eventdata->userid = $USER->id;
events_trigger('mod_created', $eventdata);
add_to_log($this->course->id, "course", "add mod", "../mod/{$mod->modname}/view.php?id={$mod->id}", "{$mod->modname} {$instanceid}");
add_to_log($this->course->id, $mod->modname, "add", "view.php?id={$mod->id}", "{$instanceid}", $mod->id);
$this->send_response($mod);
}
开发者ID:vinoth4891,项目名称:clinique,代码行数:43,代码来源:dnduploadlib.php
示例11: forum_trigger_content_uploaded_event
/**
* Sends post content to plagiarism plugin
* @param object $post Forum post object
* @param object $cm Course-module
* @param string $name
* @return bool
*/
function forum_trigger_content_uploaded_event($post, $cm, $name) {
$context = context_module::instance($cm->id);
$fs = get_file_storage();
$files = $fs->get_area_files($context->id, 'mod_forum', 'attachment', $post->id, "timemodified", false);
$eventdata = new stdClass();
$eventdata->modulename = 'forum';
$eventdata->name = $name;
$eventdata->cmid = $cm->id;
$eventdata->itemid = $post->id;
$eventdata->courseid = $post->course;
$eventdata->userid = $post->userid;
$eventdata->content = $post->message;
if ($files) {
$eventdata->pathnamehashes = array_keys($files);
}
events_trigger('assessable_content_uploaded', $eventdata);
return true;
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:26,代码来源:lib.php
示例12: delete_course
/**
* Delete a course, including all related data from the database,
* and any associated files from the moodledata folder.
*
* @param mixed $courseorid The id of the course or course object to delete.
* @param bool $showfeedback Whether to display notifications of each action the function performs.
* @return bool true if all the removals succeeded. false if there were any failures. If this
* method returns false, some of the removals will probably have succeeded, and others
* failed, but you have no way of knowing which.
*/
function delete_course($courseorid, $showfeedback = true)
{
global $CFG;
$result = true;
if (is_object($courseorid)) {
$courseid = $courseorid->id;
$course = $courseorid;
} else {
$courseid = $courseorid;
if (!($course = get_record('course', 'id', $courseid))) {
return false;
}
}
// frontpage course can not be deleted!!
if ($courseid == SITEID) {
return false;
}
if (!remove_course_contents($courseid, $showfeedback)) {
if ($showfeedback) {
notify("An error occurred while deleting some of the course contents.");
}
$result = false;
}
if (!delete_records("course", "id", $courseid)) {
if ($showfeedback) {
notify("An error occurred while deleting the main course record.");
}
$result = false;
}
/// Delete all roles and overiddes in the course context
if (!delete_context(CONTEXT_COURSE, $courseid)) {
if ($showfeedback) {
notify("An error occurred while deleting the main course context.");
}
$result = false;
}
if (!fulldelete($CFG->dataroot . '/' . $courseid)) {
if ($showfeedback) {
notify("An error occurred while deleting the course files.");
}
$result = false;
}
if ($result) {
//trigger events
events_trigger('course_deleted', $course);
}
return $result;
}
开发者ID:nadavkav,项目名称:rtlMoodle,代码行数:58,代码来源:moodlelib.php
示例13: test__events_trigger__failed_instant
/**
* tests events_trigger funtion() when instant handler fails
*/
function test__events_trigger__failed_instant()
{
$this->assertEqual(1, events_trigger('test_instant', 'fail'), 'fail first event: %s');
$this->assertEqual(1, events_trigger('test_instant', 'ok'), 'this one should fail too: %s');
$this->assertEqual(0, events_cron('test_instant'), 'all events should stay in queue: %s');
$this->assertEqual(2, events_pending_count('test_instant'), 'two events should in queue: %s');
$this->assertEqual(0, sample_function_handler('status'), 'verify no event dispatched yet: %s');
sample_function_handler('ignorefail');
//ignore "fail" eventdata from now on
$this->assertEqual(1, events_trigger('test_instant', 'ok'), 'this one should go to queue directly: %s');
$this->assertEqual(3, events_pending_count('test_instant'), 'three events should in queue: %s');
$this->assertEqual(0, sample_function_handler('status'), 'verify previous event was not dispatched: %s');
$this->assertEqual(3, events_cron('test_instant'), 'all events should be dispatched: %s');
$this->assertEqual(3, sample_function_handler('status'), 'verify three events were dispatched: %s');
$this->assertEqual(0, events_pending_count('test_instant'), 'no events should in queue: %s');
$this->assertEqual(0, events_trigger('test_instant', 'ok'), 'this event should be dispatched immediately: %s');
$this->assertEqual(4, sample_function_handler('status'), 'verify event was dispatched: %s');
$this->assertEqual(0, events_pending_count('test_instant'), 'no events should in queue: %s');
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:22,代码来源:testeventslib.php
示例14: test_pmuser_moodle_fullname
/**
* Test PM user method moodle_fullname
*/
public function test_pmuser_moodle_fullname()
{
global $DB;
// Create a Moodle user
$src = new stdClass();
$src->username = '_____phpunit_test_';
$src->password = 'pass';
$src->idnumber = '_____phpunit_test_';
$src->firstname = 'John';
$src->lastname = 'Doe';
$src->email = '[email protected]';
$src->country = 'CA';
$src->confirmed = 1;
$src->id = $DB->insert_record('user', $src);
events_trigger('user_created', $src);
// Get the PM user
$retr = user::find(new field_filter('idnumber', $src->idnumber), array(), 0, 0);
$this->assertTrue($retr->valid());
$retr = $retr->current();
$mdluser = $DB->get_record('user', array('id' => $src->id));
$this->assertEquals(fullname($mdluser), $retr->moodle_fullname());
}
开发者ID:jamesmcq,项目名称:elis,代码行数:25,代码来源:user_test.php
示例15: user_update_user
/**
* Update a user with a user object (will compare against the ID)
*
* @param object $user the user to update
*/
function user_update_user($user)
{
global $DB;
// set the timecreate field to the current time
if (!is_object($user)) {
$user = (object) $user;
}
//check username
if (isset($user->username)) {
if ($user->username !== textlib::strtolower($user->username)) {
throw new moodle_exception('usernamelowercase');
} else {
if ($user->username !== clean_param($user->username, PARAM_USERNAME)) {
throw new moodle_exception('invalidusername');
}
}
}
// unset password here, for updating later
if (isset($user->password)) {
//check password toward the password policy
if (!check_password_policy($user->password, $errmsg)) {
throw new moodle_exception($errmsg);
}
$passwd = $user->password;
unset($user->password);
}
$user->timemodified = time();
$DB->update_record('user', $user);
// trigger user_updated event on the full database user row
$updateduser = $DB->get_record('user', array('id' => $user->id));
// if password was set, then update its hash
if (isset($passwd)) {
$authplugin = get_auth_plugin($updateduser->auth);
if ($authplugin->can_change_password()) {
$authplugin->user_update_password($updateduser, $passwd);
}
}
events_trigger('user_updated', $updateduser);
add_to_log(SITEID, 'user', get_string('update'), '/view.php?id=' . $updateduser->id, fullname($updateduser));
}
开发者ID:nmicha,项目名称:moodle,代码行数:45,代码来源:lib.php
示例16: update_users
/**
* Update users
*
* @param array $users
* @return null
* @since Moodle 2.2
*/
public static function update_users($users)
{
global $CFG, $DB;
require_once $CFG->dirroot . "/user/lib.php";
require_once $CFG->dirroot . "/user/profile/lib.php";
//required for customfields related function
// Ensure the current user is allowed to run this function
$context = context_system::instance();
require_capability('moodle/user:update', $context);
self::validate_context($context);
$params = self::validate_parameters(self::update_users_parameters(), array('users' => $users));
$transaction = $DB->start_delegated_transaction();
foreach ($params['users'] as $user) {
if (empty($user['country'])) {
//Allowing empty country leads to login issues. Let's not allow such updates
continue;
}
user_update_user($user);
//update user custom fields
if (!empty($user['customfields'])) {
foreach ($user['customfields'] as $customfield) {
$user["profile_field_" . $customfield['type']] = $customfield['value'];
//profile_save_data() saves profile file
//it's expecting a user with the correct id,
//and custom field to be named profile_field_"shortname"
}
profile_save_data((object) $user);
events_trigger('user_updated', (object) $user);
}
//preferences
if (!empty($user['preferences'])) {
foreach ($user['preferences'] as $preference) {
set_user_preference($preference['type'], $preference['value'], $user['id']);
}
}
}
$transaction->allow_commit();
return null;
}
开发者ID:vinoth4891,项目名称:clinique,代码行数:46,代码来源:externallib.php
示例17: add
/**
* Perform all necessary tasks to add an instructor assignment to the system.
*
* @return boolean true on success, otherwise false
*/
public function add()
{
if ($this->duplicate_check() === false && $this->has_required_fields()) {
$result = $this->data_insert_record();
if ($result) {
//trigger appropriate notification only on success
events_trigger('crlm_instructor_assigned', $this);
}
return $result;
} else {
//invalid data
return false;
}
}
开发者ID:remotelearner,项目名称:elis.cm,代码行数:19,代码来源:instructor.class.php
示例18: delete_move
/**
* Deletes a category and moves all content (children, courses and questions) to the new parent
*
* Note that this function does not check capabilities, {@link coursecat::can_move_content_to()}
* must be called prior
*
* @param int $newparentid
* @param bool $showfeedback
* @return bool
*/
public function delete_move($newparentid, $showfeedback = false)
{
global $CFG, $DB, $OUTPUT;
require_once $CFG->libdir . '/gradelib.php';
require_once $CFG->libdir . '/questionlib.php';
require_once $CFG->dirroot . '/cohort/lib.php';
// get all objects and lists because later the caches will be reset so
// we don't need to make extra queries
$newparentcat = self::get($newparentid, MUST_EXIST, true);
$catname = $this->get_formatted_name();
$children = $this->get_children();
$coursesids = $DB->get_fieldset_select('course', 'id', 'category = :category ORDER BY sortorder ASC', array('category' => $this->id));
$context = context_coursecat::instance($this->id);
if ($children) {
foreach ($children as $childcat) {
$childcat->change_parent_raw($newparentcat);
// Log action.
add_to_log(SITEID, "category", "move", "editcategory.php?id={$childcat->id}", $childcat->id);
}
fix_course_sortorder();
}
if ($coursesids) {
if (!move_courses($coursesids, $newparentid)) {
if ($showfeedback) {
echo $OUTPUT->notification("Error moving courses");
}
return false;
}
if ($showfeedback) {
echo $OUTPUT->notification(get_string('coursesmovedout', '', $catname), 'notifysuccess');
}
}
// move or delete cohorts in this context
cohort_delete_category($this);
// now delete anything that may depend on course category context
grade_course_category_delete($this->id, $newparentid, $showfeedback);
if (!question_delete_course_category($this, $newparentcat, $showfeedback)) {
if ($showfeedback) {
echo $OUTPUT->notification(get_string('errordeletingquestionsfromcategory', 'question', $catname), 'notifysuccess');
}
return false;
}
// finally delete the category and it's context
$DB->delete_records('course_categories', array('id' => $this->id));
$context->delete();
add_to_log(SITEID, "category", "delete", "index.php", "{$this->name} (ID {$this->id})");
events_trigger('course_category_deleted', $this);
cache_helper::purge_by_event('changesincoursecat');
if ($showfeedback) {
echo $OUTPUT->notification(get_string('coursecategorydeleted', '', $catname), 'notifysuccess');
}
// If we deleted $CFG->defaultrequestcategory, make it point somewhere else.
if ($this->id == $CFG->defaultrequestcategory) {
set_config('defaultrequestcategory', $DB->get_field('course_categories', 'MIN(id)', array('parent' => 0)));
}
return true;
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:67,代码来源:coursecatlib.php
示例19: object
$supportuser = new object();
$supportuser->email = $CFG->supportemail ? $CFG->supportemail : $admin->email;
$supportuser->firstname = $CFG->supportname ? $CFG->supportname : $admin->firstname;
$supportuser->lastname = $CFG->supportname ? '' : $admin->lastname;
$supportuser->maildisplay = true;
/// Send the message and redirect
$eventdata = new object();
$eventdata->modulename = 'moodle';
$eventdata->userfrom = $USER;
$eventdata->userto = $supportuser;
$eventdata->subject = 'Error: ' . $form->referer . ' -> ' . $form->requested;
$eventdata->fullmessage = $form->text;
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
$eventdata->smallmessage = '';
events_trigger('message_send', $eventdata);
redirect($CFG->wwwroot . '/course/', 'Message sent, thanks', 3);
exit;
}
$site = get_site();
$redirecturl = empty($_SERVER['REDIRECT_URL']) ? '' : $_SERVER['REDIRECT_URL'];
$httpreferer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
$requesturi = empty($_SERVER['REQUEST_URI']) ? '' : $_SERVER['REQUEST_URI'];
header("HTTP/1.0 404 Not Found");
header("Status: 404 Not Found");
print_header($site->fullname . ':Error', $site->fullname . ': Error 404', 'Error 404 - File not Found', '');
print_simple_box('<p align="center">' . get_string('pagenotexist', 'error') . '<br />' . s($requesturi) . '</p>', 'center');
if (isloggedin()) {
?>
<center>
<p><?php
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:31,代码来源:index.php
示例20: moodle_url
$user->id = $DB->insert_record('user', $user);
$upt->track('username', html_writer::link(new moodle_url('/user/profile.php', array('id' => $user->id)), s($user->username)), 'normal', false);
// save custom profile fields data
profile_save_data($user);
if ($forcechangepassword) {
set_user_preference('auth_forcepasswordchange', 1, $user);
}
if ($user->password === 'to be generated') {
set_user_preference('create_password', 1, $user);
}
$upt->track('status', $struseradded);
$upt->track('id', $user->id, 'normal', false);
$usersnew++;
// make sure user context exists
get_context_instance(CONTEXT_USER, $user->id);
events_trigger('user_created', $user);
if ($bulk == UU_BULK_NEW or $bulk == UU_BULK_ALL) {
if (!in_array($user->id, $SESSION->bulk_users)) {
$SESSION->bulk_users[] = $user->id;
}
}
}
// add to cohort first, it might trigger enrolments indirectly - do NOT create cohorts here!
foreach ($filecolumns as $column) {
if (!preg_match('/^cohort\\d+$/', $column)) {
continue;
}
if (!empty($user->{$column})) {
$addcohort = $user->{$column};
if (!isset($cohorts[$addcohort])) {
if (is_number($addcohort)) {
开发者ID:richheath,项目名称:moodle,代码行数:31,代码来源:uploaduser.php
注:本文中的events_trigger函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论