本文整理汇总了PHP中get_site函数的典型用法代码示例。如果您正苦于以下问题:PHP get_site函数的具体用法?PHP get_site怎么用?PHP get_site使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_site函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* Sets up and retrieves the API objects
*
**/
public function __construct($company, $user, $course, $invoice, $classroom, $license, $sender, $approveuser)
{
$this->company =& $company;
$this->user =& $user;
$this->invoice =& $invoice;
$this->classroom =& $classroom;
$this->license =& $license;
$this->sender =& $sender;
$this->approveuser =& $approveuser;
if (!isset($this->company)) {
if (isset($user->id) && !isset($user->profile)) {
profile_load_custom_fields($this->user);
}
if (isset($user->profile["company"])) {
$this->company = company::by_shortname($this->user->profile["company"])->get('*');
}
}
$this->course =& $course;
if (!empty($course->id)) {
$this->course->url = new moodle_url('/course/view.php', array('id' => $this->course->id));
}
if (!empty($user->id)) {
$this->url = new moodle_url('/user/profile.php', array('id' => $this->user->id));
}
$this->site = get_site();
}
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:32,代码来源:vars.php
示例2: html_header
function html_header($course, $wdir, $formfield = "")
{
global $CFG, $ME, $choose;
if (!($site = get_site())) {
error("Invalid site!");
}
$strfiles = get_string("coursefiles", 'wiki');
if ($wdir == "/") {
$fullnav = "{$strfiles}";
} else {
$dirs = explode("/", $wdir);
$numdirs = count($dirs);
$link = "";
$navigation = "";
for ($i = 1; $i < $numdirs - 1; $i++) {
$navigation .= " -> ";
$link .= "/" . urlencode($dirs[$i]);
$navigation .= "<a href=\"" . $ME . "?id={$course->id}&wdir={$link}&choose={$choose}\">" . $dirs[$i] . "</a>";
}
$fullnav = "<a href=\"" . $ME . "?id={$course->id}&wdir=/&choose={$choose}\">{$strfiles}</a> {$navigation} -> " . $dirs[$numdirs - 1];
}
if ($choose) {
print_header();
$chooseparts = explode('.', $choose);
?>
<script language="javascript" type="text/javascript">
<!--
function set_value(txt) {
opener.document.forms['<?php
echo $chooseparts[0] . "']." . $chooseparts[1];
?>
.value = txt;
window.close();
}
-->
</script>
<?php
$fullnav = str_replace('->', '»', "{$course->shortname} -> {$fullnav}");
echo '<div id="nav-bar">' . $fullnav . '</div>';
if ($course->id == $site->id) {
print_heading(get_string("publicsitefileswarning"), "center", 2);
}
} else {
if ($course->id == $site->id) {
print_header("{$course->shortname}: {$strfiles}", "{$course->fullname}", "<a href=\"../index.php?id={$course->id}\">" . get_string("modulenameplural", 'wiki') . "</a> -> {$fullnav}", $formfield);
print_heading(get_string("publicsitefileswarning"), "center", 2);
} else {
print_header("{$course->shortname}: {$strfiles}", "{$course->fullname}", "<a href=\"../../../course/view.php?id={$course->id}\">{$course->shortname}" . "</a> -> <a href=\"../index.php?id={$course->id}\">" . get_string("modulenameplural", 'wiki') . "</a> -> {$fullnav}", $formfield);
}
}
$prop = null;
$prop->border = "0";
$prop->spacing = "3";
$prop->padding = "3";
$prop->width = "640";
$prop->class = "boxaligncenter";
$prop->colspantd = "2";
wiki_table_start($prop);
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:60,代码来源:index.php
示例3: xmldb_tool_bloglevelupgrade_install
function xmldb_tool_bloglevelupgrade_install()
{
global $CFG, $OUTPUT;
// this is a hack - admins were long ago instructed to upgrade blog levels,
// the problem is that blog is not supposed to be course level activity!!
if (!empty($CFG->bloglevel_upgrade_complete)) {
// somebody already upgrades, we do not need this any more
unset_config('bloglevel_upgrade_complete');
return;
}
if (!isset($CFG->bloglevel)) {
// fresh install?
return;
}
if ($CFG->bloglevel == BLOG_COURSE_LEVEL || $CFG->bloglevel == BLOG_GROUP_LEVEL) {
// inform admins that some settings require attention after upgrade
$site = get_site();
$a = new StdClass();
$a->sitename = $site->fullname;
$a->fixurl = "{$CFG->wwwroot}/{$CFG->admin}/tool/bloglevelupgrade/index.php";
$subject = get_string('bloglevelupgrade', 'tool_bloglevelupgrade');
$description = get_string('bloglevelupgradedescription', 'tool_bloglevelupgrade', $a);
// can not use messaging here because it is not configured yet!
upgrade_log(UPGRADE_LOG_NOTICE, null, $subject, $description);
set_config('tool_bloglevelupgrade_pending', 1);
echo $OUTPUT->notification($description);
}
}
开发者ID:nigeldaley,项目名称:moodle,代码行数:28,代码来源:install.php
示例4: test_get_site_in_switched_state_returns_switched_site
public function test_get_site_in_switched_state_returns_switched_site()
{
switch_to_blog(self::$site_ids['wordpress.org/foo/']);
$site = get_site();
restore_current_blog();
$this->assertEquals(self::$site_ids['wordpress.org/foo/'], $site->id);
}
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:7,代码来源:getSite.php
示例5: test_filter
/**
* Tests that the filter applies the required changes.
*
* @return void
*/
public function test_filter()
{
$this->resetAfterTest(true);
$this->setAdminUser();
filter_manager::reset_caches();
filter_set_global_state('data', TEXTFILTER_ON);
$course1 = $this->getDataGenerator()->create_course();
$coursecontext1 = context_course::instance($course1->id);
$course2 = $this->getDataGenerator()->create_course();
$coursecontext2 = context_course::instance($course2->id);
$sitecontext = context_course::instance(SITEID);
$site = get_site();
$this->add_simple_database_instance($site, array('SiteEntry'));
$this->add_simple_database_instance($course1, array('CourseEntry'));
$html = '<p>I like CourseEntry and SiteEntry</p>';
// Testing at course level (both site and course).
$filtered = format_text($html, FORMAT_HTML, array('context' => $coursecontext1));
$this->assertRegExp('/title=(\'|")CourseEntry(\'|")/', $filtered);
$this->assertRegExp('/title=(\'|")SiteEntry(\'|")/', $filtered);
// Testing at site level (only site).
$filtered = format_text($html, FORMAT_HTML, array('context' => $sitecontext));
$this->assertNotRegExp('/title=(\'|")CourseEntry(\'|")/', $filtered);
$this->assertRegExp('/title=(\'|")SiteEntry(\'|")/', $filtered);
// Changing to another course to test the caches invalidation (only site).
$filtered = format_text($html, FORMAT_HTML, array('context' => $coursecontext2));
$this->assertNotRegExp('/title=(\'|")CourseEntry(\'|")/', $filtered);
$this->assertRegExp('/title=(\'|")SiteEntry(\'|")/', $filtered);
}
开发者ID:evltuma,项目名称:moodle,代码行数:33,代码来源:filter_test.php
示例6: html_header
function html_header($course, $wdir, $formfield = "")
{
global $CFG, $ME, $choose;
if (!($site = get_site())) {
error("Invalid site!");
}
if ($course->id == $site->id) {
$strfiles = get_string("sitefiles");
} else {
$strfiles = get_string("files");
}
if ($wdir == "/") {
$fullnav = "{$strfiles}";
} else {
$dirs = explode("/", $wdir);
$numdirs = count($dirs);
$link = "";
$navigation = "";
for ($i = 1; $i < $numdirs - 1; $i++) {
$navigation .= " -> ";
$link .= "/" . urlencode($dirs[$i]);
$navigation .= "<a href=\"" . $ME . "?id={$course->id}&wdir={$link}&choose={$choose}\">" . $dirs[$i] . "</a>";
}
$fullnav = "<a href=\"" . $ME . "?id={$course->id}&wdir=/&choose={$choose}\">{$strfiles}</a> {$navigation} -> " . $dirs[$numdirs - 1];
}
if ($choose) {
print_header();
$chooseparts = explode('.', $choose);
?>
<script language="javascript" type="text/javascript">
<!--
function set_value(txt) {
opener.document.forms['<?php
echo $chooseparts[0] . "']." . $chooseparts[1];
?>
.value = txt;
window.close();
}
-->
</script>
<?php
$fullnav = str_replace('->', '»', "{$course->shortname} -> {$fullnav}");
echo '<div id="nav-bar">' . $fullnav . '</div>';
if ($course->id == $site->id) {
print_heading(get_string("publicsitefileswarning"), "center", 2);
}
} else {
if ($course->id == $site->id) {
print_header("{$course->shortname}: {$strfiles}", "{$course->fullname}", "<a href=\"../{$CFG->admin}/index.php\">" . get_string("administration") . "</a> -> {$fullnav}", $formfield);
print_heading(get_string("publicsitefileswarning"), "center", 2);
} else {
print_header("{$course->shortname}: {$strfiles}", "{$course->fullname}", "<a href=\"../course/view.php?id={$course->id}\">{$course->shortname}" . "</a> -> {$fullnav}", $formfield);
}
}
echo "<table border=\"0\" align=\"center\" cellspacing=\"3\" cellpadding=\"3\" width=\"640\">";
echo "<tr>";
echo "<td colspan=\"2\">";
}
开发者ID:ronniebrito,项目名称:moodle_hiperbook,代码行数:59,代码来源:coursefiles.php
示例7: config_read
function config_read($name)
{
$site = get_site();
if ($site->format == 'page') {
return 1;
} else {
return 0;
}
}
开发者ID:NextEinstein,项目名称:riverhills,代码行数:9,代码来源:frontpage.php
示例8: loginpage_hook
/**
* Authentication choice (CAS or other)
* Redirection to the CAS form or to login/index.php
* for other authentication
*/
function loginpage_hook()
{
global $frm;
global $CFG;
global $SESSION, $OUTPUT, $PAGE;
$site = get_site();
$CASform = get_string('CASform', 'auth_cas');
$username = optional_param('username', '', PARAM_RAW);
if (!empty($username)) {
if (isset($SESSION->wantsurl) && (strstr($SESSION->wantsurl, 'ticket') || strstr($SESSION->wantsurl, 'NOCAS'))) {
unset($SESSION->wantsurl);
}
return;
}
// Return if CAS enabled and settings not specified yet
if (empty($this->config->hostname)) {
return;
}
// Connection to CAS server
$this->connectCAS();
if (phpCAS::checkAuthentication()) {
$frm = new stdClass();
$frm->username = phpCAS::getUser();
$frm->password = 'passwdCas';
return;
}
if (isset($_GET['loginguest']) && $_GET['loginguest'] == true) {
$frm = new stdClass();
$frm->username = 'guest';
$frm->password = 'guest';
return;
}
if ($this->config->multiauth) {
$authCAS = optional_param('authCAS', '', PARAM_RAW);
if ($authCAS == 'NOCAS') {
return;
}
// Show authentication form for multi-authentication
// test pgtIou parameter for proxy mode (https connection
// in background from CAS server to the php server)
if ($authCAS != 'CAS' && !isset($_GET['pgtIou'])) {
$PAGE->set_url('/auth/cas/auth.php');
$PAGE->navbar->add($CASform);
$PAGE->set_title("{$site->fullname}: {$CASform}");
$PAGE->set_heading($site->fullname);
echo $OUTPUT->header();
include $CFG->dirroot . '/auth/cas/cas_form.html';
echo $OUTPUT->footer();
exit;
}
}
// Force CAS authentication (if needed).
if (!phpCAS::isAuthenticated()) {
phpCAS::setLang($this->config->language);
phpCAS::forceAuthentication();
}
}
开发者ID:Burick,项目名称:moodle,代码行数:62,代码来源:auth.php
示例9: set_parameters
/**
* Sets the parameters property of the extended class
*
* Sets the parameters property of the extended file resource class
*
* @param USER global object
* @param CFG global object
*/
function set_parameters()
{
global $USER, $CFG;
$site = get_site();
$this->parameters = array('label2' => array('langstr' => "", 'value' => '/optgroup'), 'label3' => array('langstr' => get_string('course'), 'value' => 'optgroup'), 'courseid' => array('langstr' => 'id', 'value' => $this->course->id), 'coursefullname' => array('langstr' => get_string('fullname'), 'value' => $this->course->fullname), 'courseshortname' => array('langstr' => get_string('shortname'), 'value' => $this->course->shortname), 'courseidnumber' => array('langstr' => get_string('idnumbercourse'), 'value' => $this->course->idnumber), 'coursesummary' => array('langstr' => get_string('summary'), 'value' => $this->course->summary), 'courseformat' => array('langstr' => get_string('format'), 'value' => $this->course->format), 'courseteacher' => array('langstr' => get_string('wordforteacher'), 'value' => $this->course->teacher), 'courseteachers' => array('langstr' => get_string('wordforteachers'), 'value' => $this->course->teachers), 'coursestudent' => array('langstr' => get_string('wordforstudent'), 'value' => $this->course->student), 'coursestudents' => array('langstr' => get_string('wordforstudents'), 'value' => $this->course->students), 'label4' => array('langstr' => "", 'value' => '/optgroup'), 'label5' => array('langstr' => get_string('miscellaneous'), 'value' => 'optgroup'), 'lang' => array('langstr' => get_string('preferredlanguage'), 'value' => current_language()), 'sitename' => array('langstr' => get_string('fullsitename'), 'value' => format_string($site->fullname)), 'serverurl' => array('langstr' => get_string('serverurl', 'resource', $CFG), 'value' => $CFG->wwwroot), 'currenttime' => array('langstr' => get_string('time'), 'value' => time()), 'encryptedcode' => array('langstr' => get_string('encryptedcode'), 'value' => $this->set_encrypted_parameter()), 'label6' => array('langstr' => "", 'value' => '/optgroup'));
if (!empty($USER->id)) {
$userparameters = array('label1' => array('langstr' => get_string('user'), 'value' => 'optgroup'), 'userid' => array('langstr' => 'id', 'value' => $USER->id), 'userusername' => array('langstr' => get_string('username'), 'value' => $USER->username), 'useridnumber' => array('langstr' => get_string('idnumber'), 'value' => $USER->idnumber), 'userfirstname' => array('langstr' => get_string('firstname'), 'value' => $USER->firstname), 'userlastname' => array('langstr' => get_string('lastname'), 'value' => $USER->lastname), 'userfullname' => array('langstr' => get_string('fullname'), 'value' => fullname($USER)), 'useremail' => array('langstr' => get_string('email'), 'value' => $USER->email), 'usericq' => array('langstr' => get_string('icqnumber'), 'value' => $USER->icq), 'userphone1' => array('langstr' => get_string('phone') . ' 1', 'value' => $USER->phone1), 'userphone2' => array('langstr' => get_string('phone') . ' 2', 'value' => $USER->phone2), 'userinstitution' => array('langstr' => get_string('institution'), 'value' => $USER->institution), 'userdepartment' => array('langstr' => get_string('department'), 'value' => $USER->department), 'useraddress' => array('langstr' => get_string('address'), 'value' => $USER->address), 'usercity' => array('langstr' => get_string('city'), 'value' => $USER->city), 'usertimezone' => array('langstr' => get_string('timezone'), 'value' => get_user_timezone_offset()), 'userurl' => array('langstr' => get_string('webpage'), 'value' => $USER->url));
$this->parameters = $userparameters + $this->parameters;
}
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:18,代码来源:resource.class.php
示例10: saml_error
function saml_error($err, $urltogo = false, $logfile = '')
{
global $CFG, $PAGE, $OUTPUT;
if (!isset($CFG->debugdisplay) || !$CFG->debugdisplay) {
$debug = false;
} else {
$debug = true;
}
if ($urltogo != false) {
$site = get_site();
if ($site === false || !isset($site->fullname)) {
$site_name = '';
} else {
$site_name = $site->fullname;
}
$PAGE->set_title($site_name . ':Error SAML Login');
echo $OUTPUT->header();
echo '<div style="margin:20px;font-weight: bold; color: red;">';
}
if (is_array($err)) {
foreach ($err as $key => $messages) {
if (!is_array($messages)) {
if ($urltogo != false && ($debug || $key == 'course_enrollment')) {
echo $messages;
}
$msg = 'Moodle SAML module: ' . $key . ': ' . $messages;
log_saml_error($msg, $logfile);
} else {
foreach ($messages as $message) {
if ($urltogo != false && ($debug || $key == 'course_enrollment')) {
echo $message . '<br>';
}
$msg = 'Moodle SAML module: ' . $key . ': ' . $message;
log_saml_error($msg, $logfile);
}
}
echo '<br>';
}
} else {
if ($urltogo != false) {
echo $err;
}
$msg = 'Moodle SAML module: login: ' . $err;
log_saml_error($msg, $logfile);
}
if ($urltogo != false) {
echo '</div>';
$OUTPUT->continue_button($urltogo);
if ($debug) {
print_string("auth_saml_disable_debugdisplay", "auth_saml");
}
$OUTPUT->footer();
exit;
}
}
开发者ID:blionut,项目名称:elearning,代码行数:55,代码来源:error.php
示例11: send_message
/**
* Processes the message and sends a notification via airnotifier
*
* @param stdClass $eventdata the event data submitted by the message sender plus $eventdata->savedmessageid
* @return true if ok, false if error
*/
public function send_message($eventdata)
{
global $CFG;
require_once $CFG->libdir . '/filelib.php';
if (!empty($CFG->noemailever)) {
// Hidden setting for development sites, set in config.php if needed.
debugging('$CFG->noemailever active, no airnotifier message sent.', DEBUG_MINIMAL);
return true;
}
// Skip any messaging suspended and deleted users.
if ($eventdata->userto->auth === 'nologin' or $eventdata->userto->suspended or $eventdata->userto->deleted) {
return true;
}
// Site id, to map with Moodle Mobile stored sites.
$siteid = md5($CFG->wwwroot . $eventdata->userto->username);
// Airnotifier can handle custom requests using processors (that are Airnotifier plugins).
// In the extra parameter we indicate which processor to use and also additional data to be handled by the processor.
// Here we clone the eventdata object because will be deleting/adding attributes.
$extra = clone $eventdata;
// Delete attributes that may content private information.
if (!empty($eventdata->userfrom)) {
$extra->userfromid = $eventdata->userfrom->id;
$extra->userfromfullname = fullname($eventdata->userfrom);
unset($extra->userfrom);
}
$extra->usertoid = $eventdata->userto->id;
unset($extra->userto);
$extra->processor = 'moodle';
$extra->site = $siteid;
$extra->date = !empty($eventdata->timecreated) ? $eventdata->timecreated : time();
$extra->notification = !empty($eventdata->notification) ? 1 : 0;
// Site name.
$site = get_site();
$extra->sitefullname = format_string($site->fullname);
$extra->siteshortname = format_string($site->shortname);
// We are sending to message to all devices.
$airnotifiermanager = new message_airnotifier_manager();
$devicetokens = $airnotifiermanager->get_user_devices($CFG->airnotifiermobileappname, $eventdata->userto->id);
foreach ($devicetokens as $devicetoken) {
if (!$devicetoken->enable) {
continue;
}
// Sending the message to the device.
$serverurl = $CFG->airnotifierurl . ':' . $CFG->airnotifierport . '/api/v2/push/';
$header = array('Accept: application/json', 'X-AN-APP-NAME: ' . $CFG->airnotifierappname, 'X-AN-APP-KEY: ' . $CFG->airnotifieraccesskey);
$curl = new curl();
$curl->setHeader($header);
$params = array('device' => $devicetoken->platform, 'token' => $devicetoken->pushid, 'extra' => $extra);
// JSON POST raw body request.
$resp = $curl->post($serverurl, json_encode($params));
}
return true;
}
开发者ID:alanaipe2015,项目名称:moodle,代码行数:59,代码来源:message_output_airnotifier.php
示例12: print_header
function print_header($title)
{
global $USER, $CFG;
$replacements = array('%fullname%' => get_string('mycollaboration', 'local'));
foreach ($replacements as $search => $replace) {
$title = str_replace($search, $replace, $title);
}
$site = get_site();
$nav = get_string('mycollaboration', 'local');
$header = $site->shortname . ': ' . $nav;
$navlinks = array(array('name' => $nav, 'link' => '', 'type' => 'misc'));
$navigation = build_navigation($navlinks);
print_header($title, $header, $navigation, '', '', true);
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:14,代码来源:collaborationpagelib.php
示例13: print_header
function print_header($title)
{
global $USER;
$replacements = array('%fullname%' => get_string('mymoodle', 'my'));
foreach ($replacements as $search => $replace) {
$title = str_replace($search, $replace, $title);
}
$site = get_site();
$button = update_mymoodle_icon($USER->id);
$nav = get_string('mymoodle', 'my');
$header = $site->shortname . ': ' . $nav;
$loggedinas = user_login_string($site);
print_header($title, $header, $nav, '', '', true, $button, $loggedinas);
}
开发者ID:veritech,项目名称:pare-project,代码行数:14,代码来源:pagelib.php
示例14: begin
public function begin()
{
global $CFG, $USER;
$txnId = time() . $this->_transaction->get_id();
$site = get_site();
// create the "Generate Request" XML message
$xmlrequest = sprintf("<GenerateRequest>\n \t<PxPayUserId>%s</PxPayUserId>\n \t<PxPayKey>%s</PxPayKey>\n \t<AmountInput>%.2f</AmountInput>\n \t<CurrencyInput>%s</CurrencyInput>\n \t<MerchantReference>%s</MerchantReference>\n \t<EmailAddress>%s</EmailAddress>\n \t<TxnData1>%d</TxnData1>\n \t<TxnData2>%s</TxnData2>\n \t<TxnData3>%s</TxnData3>\n \t<TxnType>Purchase</TxnType>\n \t<TxnId>%d</TxnId>\n \t<BillingId></BillingId>\n \t<EnableAddBillCard>0</EnableAddBillCard>\n \t<UrlSuccess>%s</UrlSuccess>\n \t<UrlFail>%s</UrlFail>\n \t<Opt></Opt>\n </GenerateRequest>", clean_param(get_config('local_moodec', 'payment_dps_userid'), PARAM_CLEAN), clean_param(get_config('local_moodec', 'payment_dps_key'), PARAM_CLEAN), clean_param($this->_transaction->get_cost(), PARAM_CLEAN), clean_param(get_config('local_moodec', 'currency'), PARAM_CLEAN), clean_param('Transaction #' . $this->_transaction->get_id(), PARAM_CLEAN), clean_param($USER->email, PARAM_CLEAN), clean_param($txnId, PARAM_CLEAN), clean_param(substr($site->shortname, 0, 50), PARAM_CLEAN), clean_param(substr("{$USER->lastname}, {$USER->firstname}", 0, 50), PARAM_CLEAN), clean_param(time() . $this->_transaction->get_id(), PARAM_CLEAN), new moodle_url($CFG->wwwroot . '/local/moodec/payment/dps/success.php'), new moodle_url($CFG->wwwroot . '/local/moodec/payment/dps/fail.php'));
// Query DPS with the xml request
$result = $this->query($xmlrequest);
// Set the transaction gateway and status
$this->_transaction->set_gateway(MOODEC_GATEWAY_DPS);
$this->_transaction->set_txn_id($txnId);
$this->_transaction->pending();
// Return the DOM formatted result of the request
return $this->get_dom($result);
}
开发者ID:Regaez,项目名称:moodle-local_moodec,代码行数:16,代码来源:gateway_dps.php
示例15: find_site
/**
* Find site by domain.
*
* @param string $domain The domain to look for.
*
* @return \WP_Site|null
*/
protected function find_site($domain)
{
if (empty($domain) || !is_string($domain)) {
return;
}
// Get site by domain.
if ($site = get_site_by_path($domain, '')) {
return $site instanceof WP_Site ? $site : new WP_Site($site);
}
// Redirect to main site if no site is found.
if ($site = get_site(1)) {
$scheme = is_ssl() ? 'https' : 'http';
$uri = sprintf('%s://%s', $scheme, $site->domain);
header('Location: ' . $uri);
die;
}
}
开发者ID:isotopsweden,项目名称:wp-hercules,代码行数:24,代码来源:class-hercules.php
示例16: execute
public function execute()
{
global $CFG, $DB;
require_once $CFG->dirroot . '/mod/ratingallocate/locallib.php';
$site = get_site();
// parse customdata passed
$customdata = $this->get_custom_data();
$userid = $customdata->userid;
$ratingallocateid = $customdata->ratingallocateid;
//get instance of ratingallocate
$ratingallocate = $DB->get_record(this_db\ratingallocate::TABLE, array(this_db\ratingallocate::ID => $ratingallocateid), '*', MUST_EXIST);
$courseid = $ratingallocate->course;
$course = get_course($courseid);
$cm = get_coursemodule_from_instance('ratingallocate', $ratingallocate->id, $courseid);
$context = \context_module::instance($cm->id);
$ratingallocateobj = new \ratingallocate($ratingallocate, $course, $cm, $context);
$ratingallocateobj->notify_users_distribution($userid);
}
开发者ID:andrewhancox,项目名称:moodle-mod_ratingallocate,代码行数:18,代码来源:send_distribution_notification.php
示例17: 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
示例18: definition
/**
* Form definition.
*/
protected function definition()
{
global $DB;
$mform = $this->_form;
// Add student select box.
$mform->addElement('select', 'users', 'Users', $DB->get_records_menu('user', array(), '', 'id,username'), array('class' => 'chosen', 'multiple' => 'multiple'));
$mform->addRule('users', null, 'required', null, 'client');
// Add student select box.
$courses = $DB->get_records_menu('course', array(), '', 'id,CONCAT(shortname, \': \', fullname)');
$mform->addElement('select', 'courses', 'Courses', $courses, array('class' => 'chosen', 'multiple' => 'multiple'));
$mform->addRule('courses', null, 'required', null, 'client');
unset($courses);
// Add role select box.
$course = get_site();
$roles = get_assignable_roles(\context_course::instance($course->id));
$mform->addElement('select', 'roleid', 'Role', $roles);
$mform->addRule('roleid', null, 'required', null, 'client');
$this->add_action_buttons(true, 'Enrol');
}
开发者ID:unikent,项目名称:moodle-tool_kent,代码行数:22,代码来源:mass_enrol.php
示例19: atom_standard_header
function atom_standard_header($uniqueid, $link, $updated, $title = NULL, $description = NULL)
{
global $CFG, $USER;
static $pixpath = '';
$status = true;
$result = "";
if (!($site = get_site())) {
$status = false;
}
if ($status) {
//Calculate title, link and description
if (empty($title)) {
$title = format_string($site->fullname);
}
//xml headers
$result .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
$result .= "<feed xmlns=\"http://www.w3.org/2005/Atom\">\n";
//open the channel
//write channel info
$result .= atom_full_tag('id', 1, false, htmlspecialchars($uniqueid));
$result .= atom_full_tag('updated', 1, false, date_format_rfc3339($updated));
$result .= atom_full_tag('title', 1, false, htmlspecialchars(html_to_text($title)));
$result .= atom_full_tag('link', 1, false, null, array('href' => $link, 'rel' => 'self'));
if (!empty($description)) {
$result .= atom_full_tag('subtitle', 1, false, $description);
}
$result .= atom_full_tag('generator', 1, false, 'Moodle');
if (!empty($USER->lang)) {
$result .= atom_full_tag('language', 1, false, substr($USER->lang, 0, 2));
}
$today = getdate();
$result .= atom_full_tag('rights', 1, false, '© ' . $today['year'] . ' ' . format_string($site->fullname));
//write image info
$atompix = $CFG->pixpath . "/i/rsssitelogo.gif";
//write the info
$result .= atom_full_tag('logo', 1, false, $atompix);
}
if (!$status) {
return false;
} else {
return $result;
}
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:43,代码来源:atomlib.php
示例20: ms_site_check
/**
* Checks status of current blog.
*
* Checks if the blog is deleted, inactive, archived, or spammed.
*
* Dies with a default message if the blog does not pass the check.
*
* To change the default message when a blog does not pass the check,
* use the wp-content/blog-deleted.php, blog-inactive.php and
* blog-suspended.php drop-ins.
*
* @since 3.0.0
*
* @return true|string Returns true on success, or drop-in file to include.
*/
function ms_site_check()
{
/**
* Filters checking the status of the current blog.
*
* @since 3.0.0
*
* @param bool null Whether to skip the blog status check. Default null.
*/
$check = apply_filters('ms_site_check', null);
if (null !== $check) {
return true;
}
// Allow super admins to see blocked sites
if (is_super_admin()) {
return true;
}
$blog = get_site();
if ('1' == $blog->deleted) {
if (file_exists(WP_CONTENT_DIR . '/blog-deleted.php')) {
return WP_CONTENT_DIR . '/blog-deleted.php';
} else {
wp_die(__('This site is no longer available.'), '', array('response' => 410));
}
}
if ('2' == $blog->deleted) {
if (file_exists(WP_CONTENT_DIR . '/blog-inactive.php')) {
return WP_CONTENT_DIR . '/blog-inactive.php';
} else {
$admin_email = str_replace('@', ' AT ', get_site_option('admin_email', 'support@' . get_network()->domain));
wp_die(sprintf(__('This site has not been activated yet. If you are having problems activating your site, please contact %s.'), sprintf('<a href="mailto:%s">%s</a>', $admin_email)));
}
}
if ($blog->archived == '1' || $blog->spam == '1') {
if (file_exists(WP_CONTENT_DIR . '/blog-suspended.php')) {
return WP_CONTENT_DIR . '/blog-suspended.php';
} else {
wp_die(__('This site has been archived or suspended.'), '', array('response' => 410));
}
}
return true;
}
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:57,代码来源:ms-load.php
注:本文中的get_site函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论