本文整理汇总了PHP中add_to_log函数的典型用法代码示例。如果您正苦于以下问题:PHP add_to_log函数的具体用法?PHP add_to_log怎么用?PHP add_to_log使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_to_log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onreject
/**
* Action called on reject of a face to face action
*
* @param array $eventdata
* @param object $msg
*/
function onreject($eventdata, $msg) {
global $DB;
// can manipulate the language by setting $SESSION->lang temporarily
// Load course
$userid = $eventdata['userid'];
$session = $eventdata['session'];
$facetoface = $eventdata['facetoface'];
if (!$course = $DB->get_record('course', array('id' => $facetoface->course))) {
print_error('error:coursemisconfigured', 'facetoface');
return false;
}
if (!$cm = get_coursemodule_from_instance('facetoface', $facetoface->id, $course->id)) {
print_error('error:incorrectcoursemodule', 'facetoface');
return false;
}
$form = new stdClass();
$form->s = $session->id;
$form->requests = array($userid => 1); // 2 = approve, 1 = decline
error_log(var_export($form, true));
// Decline requests
if (facetoface_approve_requests($form)) {
add_to_log($course->id, 'facetoface', 'approve requests', "view.php?id=$cm->id", $facetoface->id, $cm->id);
}
// issue notification that registration has been declined
return $this->acceptreject_notification($userid, $facetoface, $session, 'status_declined');
}
示例2: ilp_add_to_log
/**
* Adds a record of an action to the log
*
* @param int $course_id
* @param string $log_action the generic short name for the event
* @param string $log_url (optional, defaults to ASSMGR_LOG_URL_PREFIX)
* @param string $log_info Detailed explanation of what has happened
* @return void
*/
function ilp_add_to_log($course_id, $log_action, $log_url, $log_info)
{
// prepend the url prefix if the log_url is not empty
$log_url = empty($log_url) ? '' : ILP_LOG_URL_PREFIX . '/' . $log_url;
// add to the moodle log
add_to_log($course_id, ILP_LOG_MODULE, $log_action, $log_url, $log_info);
}
示例3: display
function display()
{
global $CFG;
$formatoptions = new object();
$formatoptions->noclean = true;
/// Are we displaying the course blocks?
if ($this->resource->options == 'showblocks') {
parent::display_course_blocks_start();
echo format_text($this->resource->alltext, FORMAT_HTML, $formatoptions, $this->course->id);
parent::display_course_blocks_end();
} else {
/// Set up generic stuff first, including checking for access
parent::display();
/// Set up some shorthand variables
$cm = $this->cm;
$course = $this->course;
$resource = $this->resource;
$pagetitle = strip_tags($course->shortname . ': ' . format_string($resource->name));
$inpopup = optional_param('inpopup', '', PARAM_BOOL);
// fix for MDL-9021, thanks Etienne Roz
add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
if ($resource->popup) {
if ($inpopup) {
/// Popup only
print_header();
print_simple_box(format_text($resource->alltext, FORMAT_HTML, $formatoptions, $course->id), "center clearfix", "", "", "20");
print_footer($course);
} else {
/// Make a page and a pop-up window
$this->navlinks[] = array('name' => format_string($resource->name), 'link' => '', 'type' => 'activityinstance');
$this->navigation = build_navigation($this->navlinks);
print_header($pagetitle, $course->fullname, $this->navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm));
echo "\n<script type=\"text/javascript\">";
echo "\n//<![CDATA[\n";
echo "openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}','resource{$resource->id}','{$resource->popup}');\n";
echo "\n//]]>\n";
echo '</script>';
if (trim(strip_tags($resource->summary))) {
print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center clearfix");
}
$link = "<a href=\"{$CFG->wwwroot}/mod/resource/view.php?inpopup=true&id={$cm->id}\" onclick=\"this.target='resource{$resource->id}'; return openpopup('/mod/resource/view.php?inpopup=true&id={$cm->id}', 'resource{$resource->id}','{$resource->popup}');\">" . format_string($resource->name, true) . "</a>";
echo '<div class="popupnotice">';
print_string('popupresource', 'resource');
echo '<br />';
print_string('popupresourcelink', 'resource', $link);
echo '</div>';
print_footer($course);
}
} else {
/// not a popup at all
$this->navlinks[] = array('name' => format_string($resource->name), 'link' => '', 'type' => 'activityinstance');
$this->navigation = build_navigation($this->navlinks);
print_header($pagetitle, $course->fullname, $this->navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm));
print_simple_box(format_text($resource->alltext, FORMAT_HTML, $formatoptions, $course->id), "center clearfix", "", "", "20");
$strlastmodified = get_string("lastmodified");
echo "<div class=\"modified\">{$strlastmodified}: " . userdate($resource->timemodified) . "</div>";
print_footer($course);
}
}
}
示例4: _unenrollUserFromCourse
function _unenrollUserFromCourse($user, $course)
{
$retVal = true;
echo "<br> {$username} is now going to be unenrolled from {$course->fullname}.";
if (unenrollQSUser($user, $course)) {
echo "<br> unenrollQSUser for {$user->username} and {$course->fullname} was successful.";
if (enrollUserInCourse($user->username, $user->username, $course->fullname, false)) {
echo "<br> enrollUserInCourse for {$user->username} and {$course->fullname} and false was successful.";
if (!($context = get_context_instance(CONTEXT_COURSE, $course->id))) {
echo "<br> Course context for {$course->fullname} is invalid";
admin_moodlefailed_email($user, 'unenrollUser', $course);
$retVal = false;
}
echo "<br> Course context id is {$context->id}";
if (!role_unassign(0, $user->id, 0, $context->id)) {
echo "An error occurred in role_unassign while trying to unenroll {$username} from vLab via auto-delete.";
admin_moodlefailed_email($user, 'unenrollUser', $course);
$retVal = false;
}
echo "<br> role_unassign for user id of {$user->id} and context id of {$context->id} was successful.";
send_unenrollment_notification($course, $user);
add_to_log($course->id, 'course', 'unenrol', "auto-delete", $course->id);
} else {
enrollQSUser($user, $course);
echo "An error occurred in enrollUserInCourse while trying to unenrll {$username} from vLab via auto-delete.";
admin_moodlefailed_email($user, 'unenrollUser', $course);
$retVal = false;
}
} else {
echo "An error occurred in unenrollQSUser while trying to unenroll {$username} from vLab via auto-delete.";
admin_moodlefailed_email($user, 'unenrollUser', $course);
$retVal = false;
}
return $retVal;
}
示例5: display
function display()
{
global $CFG;
$formatoptions = new object();
$formatoptions->noclean = true;
/// Are we displaying the course blocks?
if ($this->resource->options == 'showblocks') {
parent::display_course_blocks_start();
$entry = get_record('kaltura_entries', 'context', "R_" . "{$this->resource}->id");
if (trim(strip_tags($this->resource->alltext))) {
echo $entry->title;
$player_url = $CFG->wwwroot . '/mod/kaltura/kswfdoc.php?context=' . $this->course->id . '&entry_id=' . $resource->alltext;
$formatoptions = new object();
$formatoptions->noclean = true;
print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $this->course->id), "center");
if ($resource->alltext) {
echo '<input style="margin-top:20px;" type="button" value="View video presentation" onclick="kalturaInitModalBox(\'' . $player_url . '\', {width:780, height:400});">';
}
// echo embed_kaltura($resource->alltext,get_width($entry),get_height($entry),$entry->entry_type);
}
parent::display_course_blocks_end();
} else {
/// Set up generic stuff first, including checking for access
parent::display();
/// Set up some shorthand variables
$cm = $this->cm;
$course = $this->course;
$resource = $this->resource;
$entry = get_record('kaltura_entries', 'context', "R_" . "{$resource->id}");
$pagetitle = strip_tags($course->shortname . ': ' . format_string($resource->name));
$inpopup = optional_param('inpopup', '', PARAM_BOOL);
add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
$navigation = build_navigation($this->navlinks, $cm);
print_header($pagetitle, $course->fullname, $navigation, "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm));
if (trim(strip_tags($this->resource->alltext))) {
echo $entry->title;
}
$formatoptions = new object();
$formatoptions->noclean = true;
print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $this->course->id), "center");
if (trim(strip_tags($this->resource->alltext))) {
$player_url = $CFG->wwwroot . '/mod/kaltura/kswfdoc.php?context=' . $this->course->id . '&entry_id=' . $resource->alltext;
if ($resource->alltext) {
echo '<input type="button" style="margin-top:20px;" value="View video presentation" onclick="kalturaInitModalBox(\'' . $player_url . '\', {width:780, height:400});">';
}
// echo embed_kaltura($resource->alltext,get_width($entry),get_height($entry),$entry->entry_type);
}
/* print_simple_box(format_text($resource->alltext, $resource->reference, $formatoptions, $course->id),
"center", "", "", "20");
*/
$strlastmodified = get_string("lastmodified");
echo "<div class=\"modified\">{$strlastmodified}: " . userdate($resource->timemodified) . "</div>";
print_footer($course);
}
}
示例6: oauth_add_to_log
/**
* oauth_add_to_log is a quick hack to avoid add_to_log debugging
*/
function oauth_add_to_log($courseid, $module, $action, $url = '', $info = '', $cm = 0, $user = 0)
{
if (function_exists('get_log_manager')) {
$manager = get_log_manager();
$manager->legacy_add_to_log($courseid, $module, $action, $url, $info, $cm, $user);
} else {
if (function_exists('add_to_log')) {
add_to_log($courseid, $module, $action, $url, $info, $cm, $user);
}
}
}
示例7: Debug
/**
* override smbwebclient debugging function with function that logs to Moodle logs
* (non-PHPdoc)
* @see blocks/smb_web_client/smbwebclient#Debug($message, $level)
*/
function Debug($message, $level = 0)
{
if ($level <= $this->debug) {
foreach (preg_split('/\\n/', $message) as $line) {
// Fixed deprecated split function by Jon Witts 2010090600
if (trim($line) != '') {
add_to_log(1, 'smb_webclient', 'view', '', substr($line, 0, 252) . '...');
}
}
}
}
示例8: check_permission
/**
* Check that the user is logged-in and has permission to alter course settings.
*/
function check_permission()
{
// Ensure the user logs in
require_login($this->course->id);
if (isguestuser()) {
error(get_string('noguestaccess', 'sloodle'));
}
add_to_log($this->course->id, 'course', 'view sloodle data', '', "{$this->course->id}");
// Ensure the user is allowed to update information on this course
$this->course_context = get_context_instance(CONTEXT_COURSE, $this->course->id);
require_capability('moodle/course:update', $this->course_context);
}
示例9: doListKeywords
function doListKeywords()
{
global $USER;
$user = get_record('user', 'username', $this->currentUserId);
if ($user) {
$keywords = annotation_keywords_db::list_keywords($user->id);
$logurl = 'keywords.php';
add_to_log(null, 'annotation', 'list', $logurl);
return $keywords;
} else {
return array();
}
}
示例10: wiki_tags_save_tags
/**
* Save the wikitags list
*
* @param Object $WS WikiStorage
* @param String $taglist Comma-separated tags
*/
function wiki_tags_save_tags($WS, $taglist)
{
global $COURSE;
add_to_log($COURSE->id, 'wiki', 'save tags', addslashes("view.php?id={$WS->cm->id}&page={$WS->page}"), $WS->dfwiki->id, $WS->cm->id);
$page = wiki_page_last_version($WS->page, $WS);
// delete the tags of the current wiki page version
/*
*$tagids = tag_get_tags_ids('wiki', $taglist);
*foreach ($tagids as $tagid)
* tag_delete_instance('wiki', $page->created, $tagid);
*/
// add the tags to the next wiki page
tag_set('wiki', $page->created, explode(',', $taglist));
}
示例11: turnitintooltwo_add_to_log
/**
* Function for either adding to log or triggering an event
* depending on Moodle version
* @param int $courseid Moodle course ID
* @param string $event_name The event we are logging
* @param string $link A link to the Turnitin activity
* @param string $desc Description of the logged event
* @param int $cmid Course module id
*/
function turnitintooltwo_add_to_log($courseid, $event_name, $link, $desc, $cmid, $userid = 0)
{
global $CFG, $USER;
if ((property_exists($CFG, 'branch') and $CFG->branch < 27) || !property_exists($CFG, 'branch')) {
add_to_log($courseid, "turnitintooltwo", $event_name, $link, $desc, $cmid);
} else {
$event_name = str_replace(' ', '_', $event_name);
$event_path = '\\mod_turnitintooltwo\\event\\' . $event_name;
$data = array('objectid' => $cmid, 'context' => $cmid == 0 ? context_course::instance($courseid) : context_module::instance($cmid), 'other' => array('desc' => $desc));
if (!empty($userid) && $userid != $USER->id) {
$data['relateduserid'] = $userid;
}
$event = $event_path::create($data);
$event->trigger();
}
}
示例12: __sendPassword
public function __sendPassword($email)
{
global $CFG, $DB;
$systemcontext = context_system::instance();
$response = new CliniqueServiceResponce();
if (!empty($email) || !$email) {
$select = $DB->sql_like('email', ':email', false, true, false, '|') . " AND mnethostid = :mnethostid AND deleted=0 AND suspended=0";
$params = array('email' => $DB->sql_like_escape($email, '|'), 'mnethostid' => $CFG->mnet_localhost_id);
$user = $DB->get_record_select('user', $select, $params, '*', IGNORE_MULTIPLE);
if ($user and ($user->auth === 'nologin' or !is_enabled_auth($user->auth))) {
// bad luck - user is not able to login, do not let them reset password
$user = false;
$response->response(true, 'fp_nologin');
die;
}
if (!empty($user)) {
if (is_mnet_remote_user($user)) {
add_to_log(-1, 'custom_webservice', 'mnet_user', null, 'Forgot password - mnet user trying to access.', 0, $user->id);
$response->response(true, 'cp_mnet_user');
die;
}
if (isguestuser($user)) {
add_to_log(-1, 'custom_webservice', 'guest_user', null, 'Forgot password - guest user credential supplied.', 0, $user->id);
$response->response(true, 'fp_guest');
die;
}
// make sure user is allowed to change password
require_capability('moodle/user:changeownpassword', $systemcontext, $user->id);
if (!ForgotPassword::__app_reset_password_and_mail($user)) {
add_to_log(-1, 'custom_webservice', 'trigger_mail', null, 'Forgot password - email triggering failure.', 0, $user->id);
$response->response(true, 'fp_email_failure');
} else {
set_user_preference('auth_forcepasswordchange', true, $user->id);
$response->response(true, 'fp_email_success');
}
} else {
$response->response(false, 'fp_no_record');
}
} else {
add_to_log(-1, 'custom_webservice', 'input_parameters', null, 'Forgot password - input parameters missing.', 0, $user->id);
}
}
示例13: __getPassword
public function __getPassword($username, $email, $old_password, $new_password)
{
global $CFG, $DB;
$systemcontext = context_system::instance();
$response = new CliniqueServiceResponce();
if (!empty($username) && !empty($old_password) && !empty($new_password)) {
$user = $DB->get_record('user', array('username' => $username, 'mnethostid' => $CFG->mnet_localhost_id, 'deleted' => 0, 'suspended' => 0));
if (!empty($user)) {
if (is_mnet_remote_user($user)) {
add_to_log(-1, 'custom_webservice', 'mnet_user', null, 'Change password - mnet user trying to access.', 0, $user->id);
$response->response(true, 'cp_mnet_user');
die;
}
if (isguestuser($user)) {
add_to_log(-1, 'custom_webservice', 'mnet_user', null, 'Change password - guest user credential supplied.', 0, $user->id);
$response->response(true, 'cp_guest');
die;
}
// make sure user is allowed to change password
require_capability('moodle/user:changeownpassword', $systemcontext, $user->id);
// $generatePasswordResult = generatePassword::app_validate_internal_user_password($user, $old_password);
if (!ChangePassword::__app_validate_internal_user_password($user, $old_password)) {
$response->response(true, 'cp_wrong_oldpwd');
} else {
$userauth = get_auth_plugin($user->auth);
if ($userauth->user_update_password($user, $new_password)) {
unset_user_preference('auth_forcepasswordchange', $user);
unset_user_preference('create_password', $user);
$response->response(false, 'cp_success');
} else {
add_to_log(-1, 'custom_webservice', 'trigger_mail', null, 'Change password - password change updation failure.', 0, $user->id);
$response->response(true, 'cp_failure');
}
}
} else {
$response->response(false, 'cp_no_mail_record');
}
} else {
add_to_log(-1, 'custom_webservice', 'input_parameters', null, 'Change password - input parameters missing.', 0, $user->id);
}
}
示例14: process_feedback
function process_feedback()
{
global $USER;
if (!($feedback = data_submitted())) {
// No incoming data?
return false;
}
///For save and next, we need to know the userid to save, and the userid to go
///We use a new hidden field in the form, and set it to -1. If it's set, we use this
///as the userid to store
if ((int) $feedback->saveuserid !== -1) {
$feedback->userid = $feedback->saveuserid;
}
if (!empty($feedback->cancel)) {
// User hit cancel button
return false;
}
$submission = $this->get_submission($feedback->userid, true);
// Get or make one
$submission->grade = $feedback->grade;
$submission->submissioncomment = $feedback->submissioncomment;
$submission->format = $feedback->format;
$submission->teacher = $USER->id;
$submission->mailed = 0;
// Make sure mail goes out (again, even)
$submission->timemarked = time();
unset($submission->data1);
// Don't need to update this.
unset($submission->data2);
// Don't need to update this.
if (empty($submission->timemodified)) {
// eg for offline assignments
$submission->timemodified = time();
}
if (!update_record('assignment_submissions', $submission)) {
return false;
}
add_to_log($this->course->id, 'assignment', 'update grades', 'submissions.php?id=' . $this->assignment->id . '&user=' . $feedback->userid, $feedback->userid, $this->cm->id);
return $submission;
}
示例15: newfolder
/**
* This functions created news folders
*
* @param object $folder Fields of new folder
* @param int $parentfolder Parent folder
* @return boolean Success/Fail
* @todo Finish documenting this function
**/
function newfolder($folder, $parentfolder)
{
// Add actual time
$folder->timecreated = time();
// Make sure course field is not null Thanks Ann.
if (!isset($folder->course)) {
$folder->course = 0;
}
// Insert record
if (!($folder->id = insert_record('email_folder', $folder))) {
return false;
}
// Prepare subfolder
$subfolder = new stdClass();
$subfolder->folderparentid = $parentfolder;
$subfolder->folderchildid = $folder->id;
// Insert record reference
if (!insert_record('email_subfolder', $subfolder)) {
return false;
}
add_to_log($folder->userid, "email", "add subfolder", "{$folder->name}");
return true;
}