本文整理汇总了PHP中get_admin函数的典型用法代码示例。如果您正苦于以下问题:PHP get_admin函数的具体用法?PHP get_admin怎么用?PHP get_admin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_admin函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
global $USER;
// Check to make sure external communications hasn't been disabled
$extcom = !!get_config('mod_hvp', 'external_communication');
$extcomnotify = !!get_config('mod_hvp', 'external_communication_notify');
if ($extcom || !$extcomnotify) {
$core = \mod_hvp\framework::instance();
$core->fetchLibrariesMetadata(!$extcom);
set_config('external_communication_notify', $extcom ? false : time(), 'mod_hvp');
// Notify admin if there are updates available!
$update_available = \get_config('mod_hvp', 'update_available');
$current_update = \get_config('mod_hvp', 'current_update');
$admin_notified = \get_config('mod_hvp', 'admin_notified');
if ($admin_notified !== $update_available && $update_available !== false && $current_update !== false && $current_update < $update_available) {
// New update is available
// Send message
$updatesurl = new \moodle_url('/mod/hvp/library_list.php');
$message = new \stdClass();
$message->component = 'mod_hvp';
$message->name = 'updates';
$message->userfrom = $USER;
$message->userto = get_admin();
$message->subject = get_string('updatesavailabletitle', 'mod_hvp');
$message->fullmessage = get_string('updatesavailablemsgpt1', 'mod_hvp') . ' ' . get_string('updatesavailablemsgpt2', 'mod_hvp') . "\n\n" . get_string('updatesavailablemsgpt3', 'mod_hvp', date('Y-m-d', $update_available)) . "\n" . get_string('updatesavailablemsgpt4', 'mod_hvp', date('Y-m-d', $current_update)) . "\n\n" . $updatesurl;
$message->fullmessageformat = FORMAT_PLAIN;
$message->fullmessagehtml = '<p>' . get_string('updatesavailablemsgpt1', 'mod_hvp') . '<br/>' . get_string('updatesavailablemsgpt2', 'mod_hvp') . '</p>' . '<p>' . get_string('updatesavailablemsgpt3', 'mod_hvp', '<b>' . date('Y-m-d', $update_available) . '</b>') . '<br/>' . get_string('updatesavailablemsgpt4', 'mod_hvp', '<b>' . date('Y-m-d', $current_update) . '</b>') . '</p>' . '<a href="' . $updatesurl . '" target="_blank">' . $updatesurl . '</a>';
$message->smallmessage = '';
$message->notification = 1;
message_send($message);
// Keep track of which version we've notfied about
\set_config('admin_notified', $update_available, 'mod_hvp');
}
}
}
开发者ID:nadavkav,项目名称:h5p-moodle-plugin,代码行数:35,代码来源:look_for_updates.php
示例2: facetoface_send_admin_upgrade_msg
/**
*
* Sends message to administrator listing all updated
* duplicate custom fields
* @param array $data
*/
function facetoface_send_admin_upgrade_msg($data)
{
global $SITE;
// No data - no need to send email.
if (empty($data)) {
return;
}
$table = new html_table();
$table->head = array('Custom field ID', 'Custom field original shortname', 'Custom field new shortname');
$table->data = $data;
$table->align = array('center', 'center', 'center');
$title = "{$SITE->fullname}: Face to Face upgrade info";
$note = 'During the last site upgrade the face-to-face module has been modified. It now
requires session custom fields to have unique shortnames. Since some of your
custom fields had duplicate shortnames, they have been renamed to remove
duplicates (see table below). This could impact on your email messages if you
reference those custom fields in the message templates.';
$message = html_writer::start_tag('html');
$message .= html_writer::start_tag('head') . html_writer::tag('title', $title) . html_writer::end_tag('head');
$message .= html_writer::start_tag('body');
$message .= html_writer::tag('p', $note) . html_writer::table($table, true);
$message .= html_writer::end_tag('body');
$message .= html_writer::end_tag('html');
$admin = get_admin();
email_to_user($admin, $admin, $title, '', $message);
}
开发者ID:CWRTP,项目名称:facetoface-2.0,代码行数:32,代码来源:upgrade.php
示例3: xmldb_assignfeedback_editpdf_upgrade
/**
* EditPDF upgrade code
* @param int $oldversion
* @return bool
*/
function xmldb_assignfeedback_editpdf_upgrade($oldversion)
{
global $CFG;
if ($oldversion < 2013110800) {
// Check that no stamps where uploaded.
$fs = get_file_storage();
$stamps = $fs->get_area_files(context_system::instance()->id, 'assignfeedback_editpdf', 'stamps', 0, "filename", false);
// Add default stamps.
if (empty($stamps)) {
// List of default stamps.
$defaultstamps = array('smile.png', 'sad.png', 'tick.png', 'cross.png');
// Stamp file object.
$filerecord = new stdClass();
$filerecord->component = 'assignfeedback_editpdf';
$filerecord->contextid = context_system::instance()->id;
$filerecord->userid = get_admin()->id;
$filerecord->filearea = 'stamps';
$filerecord->filepath = '/';
$filerecord->itemid = 0;
// Add all default stamps.
foreach ($defaultstamps as $stamp) {
$filerecord->filename = $stamp;
$fs->create_file_from_pathname($filerecord, $CFG->dirroot . '/mod/assign/feedback/editpdf/pix/' . $filerecord->filename);
}
}
upgrade_plugin_savepoint(true, 2013110800, 'assignfeedback', 'editpdf');
}
// Moodle v2.6.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.7.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:40,代码来源:upgrade.php
示例4: notify_user
function notify_user($user, $subject, $a)
{
if (!$user) {
return false;
}
$body = get_string('virusfoundlater', 'moodle', $a);
email_to_user($user, get_admin(), $subject, $body);
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:8,代码来源:handlevirus.php
示例5: is_valid_admin_login
function is_valid_admin_login($username, $password)
{
$token = get_admin($username);
if ($token['password'] == $password) {
return TRUE;
} else {
return FALSE;
}
}
开发者ID:ReneeHuh,项目名称:PHPSchoolProject,代码行数:9,代码来源:admin_db.php
示例6: execute
public function execute()
{
global $CFG, $DB;
require_once $CFG->dirroot . "/mod/turnitintooltwo/lib.php";
require_once $CFG->dirroot . "/mod/turnitintooltwo/turnitintooltwo_view.class.php";
$data = (array) $this->get_custom_data();
// Make sure we are still wanted.
$submission = $DB->get_record('turnitintooltwo_submissions', array('id' => $data['submissionid']));
if (!$submission) {
return true;
}
cli_writeln("Processing Turnitintooltwo submission: " . $data['submissionid']);
$user = $DB->get_record('user', array('id' => $data['userid']));
\core\session\manager::set_user($user);
$turnitintooltwo = $DB->get_record('turnitintooltwo', array('id' => $data['tiiid']));
list($course, $cm) = get_course_and_cm_from_instance($turnitintooltwo, 'turnitintooltwo');
try {
$turnitintooltwoassignment = new \turnitintooltwo_assignment($turnitintooltwo->id, $turnitintooltwo);
$turnitintooltwosubmission = new \turnitintooltwo_submission($data['submissionid'], "moodle", $turnitintooltwoassignment);
$parts = $turnitintooltwoassignment->get_parts();
$tiisubmission = $turnitintooltwosubmission->do_tii_submission($cm, $turnitintooltwoassignment);
// Update submission.
$DB->update_record('turnitintooltwo_submissions', array('id' => $data['submissionid'], 'submission_modified' => $data['subtime']));
} catch (\Exception $e) {
$tiisubmission = array('success' => false, 'message' => $e->getMessage());
cli_writeln($e->getMessage());
}
$digitalreceipt = $tiisubmission;
$digitalreceipt['is_manual'] = 0;
$digitalreceipt = json_encode($digitalreceipt);
$this->update_sub_status($data['submissionid'], $tiisubmission['success'], $digitalreceipt);
if ($tiisubmission['success'] === true) {
$lockedassignment = new \stdClass();
$lockedassignment->id = $turnitintooltwoassignment->turnitintooltwo->id;
$lockedassignment->submitted = 1;
$DB->update_record('turnitintooltwo', $lockedassignment);
$lockedpart = new \stdClass();
$lockedpart->id = $data['submissionpart'];
$lockedpart->submitted = 1;
// Disable anonymous marking if post date has passed.
if ($parts[$data['submissionpart']]->dtpost <= time()) {
$lockedpart->unanon = 1;
}
$DB->update_record('turnitintooltwo_parts', $lockedpart);
cli_writeln("Finished processing successful submission: " . $data['submissionid']);
} else {
turnitintooltwo_add_to_log($course->id, "errored submission", 'view.php?id=' . $cm->id, "Failed to submit '" . $turnitintooltwosubmission->submission_title . "'", $cm->id, $user->id, array('submissionid' => $data['submissionid']));
cli_writeln("Finished processing unsuccessful submission: " . $data['submissionid']);
}
\core\session\manager::set_user(get_admin());
return $tiisubmission['success'];
}
开发者ID:SkylarKelty,项目名称:moodle-mod_turnitintooltwo,代码行数:52,代码来源:submit_assignment.php
示例7: rss_get_link
/**
* This function returns the icon (from theme) with the link to rss/file.php
*
* @global object
* @global object
*/
function rss_get_link($courseid, $userid, $modulename, $id, $tooltiptext = '')
{
global $OUTPUT;
static $rsspath = '';
//In site course, if no logged (userid), use admin->id. Bug 2048.
if ($courseid == SITEID and empty($userid)) {
$admin = get_admin();
$userid = $admin->id;
}
$rsspath = rss_get_url($courseid, $userid, $modulename, $id);
$rsspix = $OUTPUT->old_icon_url('i/rss');
return '<a href="' . $rsspath . '"><img src="' . $rsspix . '" title="' . strip_tags($tooltiptext) . '" alt="' . get_string('rss') . '" /></a>';
}
开发者ID:ajv,项目名称:Offline-Caching,代码行数:19,代码来源:rsslib.php
示例8: notification_definition
/**
*
*/
public static function notification_definition($mform, $dataformid, $prefix = null)
{
global $DB;
$paramtext = !empty($CFG->formatstringstriptags) ? PARAM_TEXT : PARAM_CLEAN;
$mform->addElement('header', 'messagehdr', get_string('message', 'message'));
$mform->setExpanded('messagehdr');
// Message type.
$options = array(0 => get_string('notification', 'dataform'), 1 => get_string('conversation', 'dataform'));
$mform->addElement('select', $prefix . 'messagetype', get_string('type', 'dataform'), $options);
// Subject.
$mform->addElement('text', $prefix . 'subject', get_string('subject', 'dataform'));
$mform->setType($prefix . 'subject', $paramtext);
// Content.
$mform->addElement('textarea', $prefix . 'contenttext', get_string('content'));
$mform->setType($prefix . 'contenttext', $paramtext);
// Content from view.
$options = array('' => get_string('choosedots'));
if ($items = \mod_dataform_view_manager::instance($dataformid)->views_menu) {
$items = array_combine($items, $items);
$options = array_merge($options, $items);
}
$label = get_string('contentview', 'mod_dataform');
$mform->addElement('select', $prefix . 'contentview', $label, $options);
// Format.
$options = array(FORMAT_PLAIN => get_string('formatplain'), FORMAT_HTML => get_string('formathtml'));
$mform->addElement('select', $prefix . 'messageformat', get_string('format'), $options);
// Sender: Entry author, manager.
$mform->addElement('header', 'senderhdr', get_string('sender', 'mod_dataform'));
$mform->setExpanded('senderhdr');
$admin = get_admin();
$options = array(\core_user::NOREPLY_USER => get_string('noreply', 'dataform'), \core_user::SUPPORT_USER => get_string('supportcontact', 'admin'), $admin->id => get_string('admin'), 'author' => get_string('author', 'dataform'), 'event' => get_string('event', 'dataform'));
$mform->addElement('select', $prefix . 'sender', get_string('from'), $options);
// Recipient.
$mform->addElement('header', 'recipientshdr', get_string('recipient', 'mod_dataform'));
$mform->setExpanded('recipientshdr');
// Admin.
$mform->addElement('advcheckbox', $prefix . 'recipient[admin]', get_string('admin'));
// Support.
$mform->addElement('advcheckbox', $prefix . 'recipient[support]', get_string('supportcontact', 'admin'));
// Entry author.
$mform->addElement('advcheckbox', $prefix . 'recipient[author]', get_string('author', 'dataform'));
// Role (mod/dataform:notification permission in context).
$mform->addElement('advcheckbox', $prefix . 'recipient[role]', get_string('role'));
// Username (comma delimited).
$mform->addElement('text', $prefix . 'recipient[username]', get_string('username'));
$mform->setType($prefix . 'recipient[username]', $paramtext);
// Email (comma delimited).
$mform->addElement('text', $prefix . 'recipient[email]', get_string('email'));
$mform->setType($prefix . 'recipient[email]', $paramtext);
}
开发者ID:parksandwildlife,项目名称:learning,代码行数:53,代码来源:notificationform.php
示例9: xmldb_theme_evolved_install
/**
* Theme_mimoodle install function.
*
* @return void
*/
function xmldb_theme_evolved_install()
{
global $CFG;
// Set the default background.
$fs = get_file_storage();
$filerecord = new stdClass();
$filerecord->component = 'theme_evolved';
$filerecord->contextid = context_system::instance()->id;
$filerecord->userid = get_admin()->id;
$filerecord->filearea = 'backgroundimage';
$filerecord->filepath = '/';
$filerecord->itemid = 0;
$filerecord->filename = 'background.png';
$fs->create_file_from_pathname($filerecord, $CFG->dirroot . '/theme/evolved/pix/background.png');
}
开发者ID:amsibsam,项目名称:moodle3,代码行数:20,代码来源:install.php
示例10: local_enrolmentreminder_send_messages
function local_enrolmentreminder_send_messages($events)
{
global $DB;
global $CFG;
require_once $CFG->libdir . '/completionlib.php';
$eventdata = new stdClass();
$eventdata->component = 'local_enrolmentreminder';
// plugin name
$eventdata->name = 'enrolmentending';
// message interface name
$eventdata->userfrom = get_admin();
$dateformat = '%b %e';
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
$dateformat = '%b %#d';
}
foreach ($events as $event) {
$course = $DB->get_record('course', array('id' => $event->courseid));
$user = $DB->get_record('user', array('id' => $event->userid));
if (empty($completioninfo[$event->courseid])) {
$completioninfo[$event->courseid] = new completion_info($course);
}
if ($completioninfo[$event->courseid]->is_course_complete($event->userid)) {
mtrace("user {$event->userid} has completed course {$event->courseid}");
continue;
}
// use timeend for enrolments, timestart for events.
$ending = userdate($event->timeend, $dateformat);
$eventdata->fullmessage = local_enrolmentreminder_get_message_plaintext($course, $user, $ending, $event->reminderid);
if (empty($eventdata->fullmessage)) {
mtrace("eventdata->fullmessage is empty");
}
if (!empty($eventdata->fullmessage)) {
$eventdata->subject = $course->shortname . ' ending ' . $ending;
$eventdata->smallmessage = $course->fullname . ' ending ' . $ending;
$eventdata->fullmessagehtml = '';
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->notification = 1;
$eventdata->userto = $user;
// $eventdata->userto = get_admin();
$mailresult = message_send($eventdata);
mtrace("sent message with result {$mailresult}: " . print_r($eventdata, true));
$params = array('context' => context_course::instance($event->courseid), 'objectid' => $course->id, 'relateduserid' => $event->userid);
$msg_event = \local_enrolmentreminder\event\message_sent::create($params);
$msg_event->trigger();
}
}
}
开发者ID:advancingdesign,项目名称:moodle-local_enrolmentreminder,代码行数:47,代码来源:lib.php
示例11: notify_user
function notify_user($user, $subject, $a)
{
if (!$user) {
return false;
}
$body = get_string('virusfoundlater', 'moodle', $a);
$eventdata = new stdClass();
$eventdata->modulename = 'moodle';
$eventdata->userfrom = get_admin();
$eventdata->userto = $user;
$eventdata->subject = $subject;
$eventdata->fullmessage = $body;
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
$eventdata->smallmessage = '';
message_send($eventdata);
}
开发者ID:JP-Git,项目名称:moodle,代码行数:17,代码来源:handlevirus.php
示例12: send_welcome
/**
* This plugin sends users a welcome message after logging in
* and notify a moderator a new user has been added
* it has a settings page that allow you to configure the messages
* send.
*
* @package local
* @subpackage welcome
* @copyright 2014 Bas Brands, basbrands.nl, [email protected]
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
function send_welcome($user)
{
global $CFG, $SITE;
$moderator = get_admin();
$sender = get_admin();
if (!empty($user->email)) {
$config = get_config('local_welcome');
if (!empty($config->auth_plugins)) {
$auths = explode(',', $config->auth_plugins);
if (!in_array($user->auth, $auths)) {
return '';
}
} else {
return '';
}
$moderator->email = $config->moderator_email;
$sender->email = $config->sender_email;
$sender->firstname = $config->sender_firstname;
$sender->lastname = $config->sender_lastname;
$message_user_enabled = $config->message_user_enabled;
$message_user = $config->message_user;
$message_user_subject = $config->message_user_subject;
$message_moderator_enabled = $config->message_moderator_enabled;
$message_moderator = $config->message_moderator;
$message_moderator_subject = $config->message_moderator_subject;
if (!empty($user->country)) {
$user->country = get_string($user->country, 'countries');
} else {
$user->country = '';
}
$sitelink = html_writer::link(new moodle_url('/'), $SITE->fullname);
$resetpasswordlink = html_writer::link(new moodle_url('/login/forgot_password.php'), get_string('resetpass', 'local_welcome'));
$fields = array('[[fullname]]', '[[username]]', '[[firstname]]', '[[lastname]]', '[[email]]', '[[city]]', '[[country]]', '[[sitelink]]', '[[sitename]]', '[[resetpasswordlink]]');
$values = array(fullname($user), $user->username, $user->firstname, $user->lastname, $user->email, $user->city, $user->country, $sitelink, $SITE->fullname, $resetpasswordlink);
$message_user = str_replace($fields, $values, $message_user);
$message_user_subject = str_replace($fields, $values, $message_user_subject);
$message_moderator = str_replace($fields, $values, $message_moderator);
$message_moderator_subject = str_replace($fields, $values, $message_moderator_subject);
if (!empty($message_user) && !empty($sender->email) && $message_user_enabled) {
email_to_user($user, $sender, $message_user_subject, html_to_text($message_user), $message_user);
}
if (!empty($message_moderator) && !empty($sender->email) && $message_moderator_enabled) {
email_to_user($moderator, $sender, $message_moderator_subject, html_to_text($message_moderator), $message_moderator);
}
}
}
开发者ID:RicardoMaurici,项目名称:moodle-local_welcome,代码行数:57,代码来源:event_handlers.php
示例13: execute
public function execute()
{
global $CFG;
require_once "{$CFG->libdir}/datalib.php";
$user = get_admin();
if (!$user) {
cli_error("Unable to find admin user in DB.");
}
$auth = empty($user->auth) ? 'manual' : $user->auth;
if ($auth == 'nologin' or !is_enabled_auth($auth)) {
cli_error(sprintf("User authentication is either 'nologin' or disabled. Check Moodle authentication method for '%s'", $user->username));
}
$authplugin = get_auth_plugin($auth);
$authplugin->sync_roles($user);
login_attempt_valid($user);
complete_user_login($user);
printf("%s:%s\n", session_name(), session_id());
}
开发者ID:dariogs,项目名称:moosh,代码行数:18,代码来源:AdminLogin.php
示例14: send_message
/**
* Send non-submitters message to students.
*
* @param string $message
* @return void
*/
public function send_message($userid, $subject, $message)
{
$eventdata = new stdClass();
$eventdata->component = 'mod_turnitintooltwo';
//your component name
$eventdata->name = 'nonsubmitters';
//this is the message name from messages.php
$eventdata->userfrom = get_admin();
$eventdata->userto = $userid;
$eventdata->subject = $subject;
$eventdata->fullmessage = $message;
$eventdata->fullmessageformat = FORMAT_HTML;
$eventdata->fullmessagehtml = $message;
$eventdata->smallmessage = '';
$eventdata->notification = 1;
//this is only set to 0 for personal messages between users
message_send($eventdata);
}
开发者ID:Dextirpe,项目名称:moodle-mod_turnitintooltwo,代码行数:24,代码来源:nonsubmitters_message.php
示例15: clam_message_admins
/**
* Emails admins about a clam outcome
*
* @param string $notice The body of the email to be sent.
*/
function clam_message_admins($notice)
{
$site = get_site();
$subject = get_string('clamemailsubject', 'moodle', format_string($site->fullname));
$admins = get_admins();
foreach ($admins as $admin) {
$eventdata = new stdClass();
$eventdata->component = 'moodle';
$eventdata->name = 'errors';
$eventdata->userfrom = get_admin();
$eventdata->userto = $admin;
$eventdata->subject = $subject;
$eventdata->fullmessage = $notice;
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
$eventdata->smallmessage = '';
message_send($eventdata);
}
}
开发者ID:pzhu2004,项目名称:moodle,代码行数:24,代码来源:uploadlib.php
示例16: xmldb_theme_more_upgrade
/**
* Theme_more upgrade function.
*
* @param int $oldversion The version we upgrade from.
* @return bool
*/
function xmldb_theme_more_upgrade($oldversion)
{
global $CFG;
if ($oldversion < 2014032400) {
// Set the default background. If an image is already there then ignore.
$fs = get_file_storage();
$bg = $fs->get_area_files(context_system::instance()->id, 'theme_more', 'backgroundimage', 0);
// Add default background image.
if (empty($bg)) {
$filerecord = new stdClass();
$filerecord->component = 'theme_more';
$filerecord->contextid = context_system::instance()->id;
$filerecord->userid = get_admin()->id;
$filerecord->filearea = 'backgroundimage';
$filerecord->filepath = '/';
$filerecord->itemid = 0;
$filerecord->filename = 'background.jpg';
$fs->create_file_from_pathname($filerecord, $CFG->dirroot . '/theme/more/pix/background.jpg');
}
upgrade_plugin_savepoint(true, 2014032400, 'theme', 'more');
}
if ($oldversion < 2014032401) {
// Set the default settings as they might already be set.
set_config('textcolor', '#333366', 'theme_more');
set_config('linkcolor', '#FF6500', 'theme_more');
set_config('backgroundrepeat', 'repeat', 'theme_more');
set_config('contentbackground', '#FFFFFF', 'theme_more');
set_config('secondarybackground', '#FFFFFF', 'theme_more');
set_config('invert', 1, 'theme_more');
set_config('backgroundimage', '/background.jpg', 'theme_more');
upgrade_plugin_savepoint(true, 2014032401, 'theme', 'more');
}
// Moodle v2.7.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
开发者ID:alanaipe2015,项目名称:moodle,代码行数:48,代码来源:upgrade.php
示例17: xmldb_setaskfeedback_editpdf_install
/**
* EditPDF install code
*/
function xmldb_setaskfeedback_editpdf_install()
{
global $CFG;
// List of default stamps.
$defaultstamps = array('smile.png', 'sad.png', 'tick.png', 'cross.png');
// Stamp file object.
$filerecord = new stdClass();
$filerecord->component = 'setaskfeedback_editpdf';
$filerecord->contextid = context_system::instance()->id;
$filerecord->userid = get_admin()->id;
$filerecord->filearea = 'stamps';
$filerecord->filepath = '/';
$filerecord->itemid = 0;
$fs = get_file_storage();
// Load all default stamps.
foreach ($defaultstamps as $stamp) {
$filerecord->filename = $stamp;
$fs->create_file_from_pathname($filerecord, $CFG->dirroot . '/mod/setask/feedback/editpdf/pix/' . $filerecord->filename);
}
}
开发者ID:krzpassrl,项目名称:SRL_Moodle_db,代码行数:23,代码来源:install.php
示例18: process_facetoface_session
protected function process_facetoface_session($data) {
global $DB, $USER;
$data = (object)$data;
$oldid = $data->id;
$data->facetoface = $this->get_new_parentid('facetoface');
$data->timecreated = $this->apply_date_offset($data->timecreated);
$data->timemodified = $this->apply_date_offset($data->timemodified);
$data->usermodified = isset($USER->id) ? $USER->id : get_admin()->id;
$rooms = $DB->get_records('facetoface_room', array('name' => $data->room_name,
'building' => $data->room_building, 'address' => $data->room_address, 'custom' => 0), '', 'id');
$rooms_found = count($rooms);
if (!$rooms_found || $data->room_custom) {
if (!$data->room_custom) {
debugging("Room [{$data->room_name}, {$data->room_building}, {$data->room_address}] ".
"in face to face session does not exist - creating as custom room");
}
$customroom = new stdClass();
$customroom->name = $data->room_name;
$customroom->building = $data->room_building;
$customroom->address = $data->room_address;
$customroom->capacity = $data->capacity;
$customroom->custom = 1;
$customroom->timecreated = $data->timecreated;
$customroom->timemodified = $data->timemodified;
$data->roomid = $DB->insert_record('facetoface_room', $customroom);
} else {
if ($rooms_found > 1) {
debugging("Room [{$data->room_name}, {$data->room_building}, {$data->room_address}] matches more ".
"than one predefined room and we can't identify which - arbitrarily selecting one of them");
}
$data->roomid = reset($rooms)->id;
}
// insert the entry record
$newitemid = $DB->insert_record('facetoface_sessions', $data);
$this->set_mapping('facetoface_session', $oldid, $newitemid, true); // childs and files by itemname
}
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:41,代码来源:restore_facetoface_stepslib.php
示例19: test_get_user
public function test_get_user()
{
global $CFG;
$this->resetAfterTest(true);
// Create user and try fetach it with api.
$user = $this->getDataGenerator()->create_user();
$this->assertEquals($user, core_user::get_user($user->id, '*', MUST_EXIST));
// Test noreply user.
$CFG->noreplyuserid = null;
$noreplyuser = core_user::get_noreply_user();
$this->assertEquals(1, $noreplyuser->emailstop);
$this->assertFalse(core_user::is_real_user($noreplyuser->id));
$this->assertEquals($CFG->noreplyaddress, $noreplyuser->email);
$this->assertEquals(get_string('noreplyname'), $noreplyuser->firstname);
// Set user as noreply user and make sure noreply propery is set.
core_user::reset_internal_users();
$CFG->noreplyuserid = $user->id;
$noreplyuser = core_user::get_noreply_user();
$this->assertEquals(1, $noreplyuser->emailstop);
$this->assertTrue(core_user::is_real_user($noreplyuser->id));
// Test support user.
core_user::reset_internal_users();
$CFG->supportemail = null;
$CFG->noreplyuserid = null;
$supportuser = core_user::get_support_user();
$adminuser = get_admin();
$this->assertEquals($adminuser, $supportuser);
$this->assertTrue(core_user::is_real_user($supportuser->id));
// When supportemail is set.
core_user::reset_internal_users();
$CFG->supportemail = '[email protected]';
$supportuser = core_user::get_support_user();
$this->assertEquals(core_user::SUPPORT_USER, $supportuser->id);
$this->assertFalse(core_user::is_real_user($supportuser->id));
// Set user as support user and make sure noreply propery is set.
core_user::reset_internal_users();
$CFG->supportuserid = $user->id;
$supportuser = core_user::get_support_user();
$this->assertEquals($user, $supportuser);
$this->assertTrue(core_user::is_real_user($supportuser->id));
}
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:41,代码来源:user_test.php
示例20: repository_alfresco_admin_security_key_notice
/**
* Send a message to the admin in regard with the APIv1 migration.
*
* @return void
*/
function repository_alfresco_admin_security_key_notice()
{
$admins = get_admins();
if (empty($admins)) {
return;
}
foreach ($admins as $admin) {
$message = new stdClass();
$message->component = 'moodle';
$message->name = 'notices';
$message->userfrom = get_admin();
$message->userto = $admin;
$message->smallmessage = get_string('security_key_notice_message_small', 'repository_alfresco');
$message->subject = get_string('security_key_notice_message_subject', 'repository_alfresco');
$message->fullmessage = get_string('security_key_notice_message_content', 'repository_alfresco');
$message->fullmessagehtml = get_string('security_key_notice_message_content', 'repository_alfresco');
$message->fullmessageformat = FORMAT_PLAIN;
$message->notification = 1;
message_send($message);
}
}
开发者ID:krysnuvadga,项目名称:moodle,代码行数:26,代码来源:upgradelib.php
注:本文中的get_admin函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论