本文整理汇总了PHP中get_admins函数的典型用法代码示例。如果您正苦于以下问题:PHP get_admins函数的具体用法?PHP get_admins怎么用?PHP get_admins使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_admins函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: portfolio_picasa_admin_upgrade_notification
function portfolio_picasa_admin_upgrade_notification() {
$admins = get_admins();
if (empty($admins)) {
return;
}
$mainadmin = reset($admins);
$a = new stdClass;
$a->docsurl = get_docs_url('Google_OAuth_2.0_setup');
foreach ($admins as $admin) {
$message = new stdClass();
$message->component = 'moodle';
$message->name = 'notices';
$message->userfrom = $mainadmin;
$message->userto = $admin;
$message->smallmessage = get_string('oauth2upgrade_message_small', 'portfolio_picasa');
$message->subject = get_string('oauth2upgrade_message_subject', 'portfolio_picasa');
$message->fullmessage = get_string('oauth2upgrade_message_content', 'portfolio_picasa', $a);
$message->fullmessagehtml = get_string('oauth2upgrade_message_content', 'portfolio_picasa', $a);
$message->fullmessageformat = FORMAT_PLAIN;
$message->notification = 1;
message_send($message);
}
}
示例2: notify_admins_unknown
function notify_admins_unknown($file, $a)
{
global $site;
$admins = get_admins();
$subject = get_string('virusfoundsubject', 'moodle', format_string($site->fullname));
$body = get_string('virusfoundlateradminnolog', 'moodle', $a);
foreach ($admins as $admin) {
email_to_user($admin, $admin, $subject, $body);
}
}
示例3: jbxl_is_admin
function jbxl_is_admin($uid)
{
$admins = get_admins();
foreach ($admins as $admin) {
if ($uid == $admin->id) {
return true;
}
}
return false;
}
示例4: notify
function notify($changelist, $user, $course)
{
$admin = current(get_admins());
$html_message = $this->html_mail($changelist, $course);
$text_message = $this->text_mail($changelist, $course);
$subject = get_string('mailsubject', 'block_notifications');
$subject .= ": " . format_string($course->fullname, true);
//$this->test_email_to_user( $user, $admin, $subject, $text_message, $html_message );
email_to_user($user, $admin, $subject, $text_message, $html_message);
}
示例5: get_admin
/**
* Returns $user object of the main admin user
* primary admin = admin with lowest role_assignment id among admins
* @uses $CFG
* @return object(admin) An associative array representing the admin user.
*/
function get_admin()
{
static $myadmin;
if (!isset($admin)) {
if (!($admins = get_admins())) {
return false;
}
$admin = reset($admins);
//reset returns first element
}
return $admin;
}
示例6: definition
/**
* Sets up form for display to user
* @global object $CFG Moodle global config
* @version 2015062901
* @since 2011042601
*/
public function definition()
{
global $CFG;
global $PAGE;
$accountDAO = new TxttoolsAccountDAO();
$accountCount = $accountDAO->countTxttoolsRecords();
$PAGE->requires->jquery();
$PAGE->requires->yui_module('moodle-block_moodletxt-admin', 'M.block_moodletxt.admin.init');
$installForm =& $this->_form;
// We need a list of users that can be default inboxes,
// for the user to choose from for this initial account
$defaultInboxUsers = get_users_by_capability(context_system::instance(), 'block/moodletxt:defaultinbox');
$admins = get_admins();
foreach ($admins as $admin) {
$defaultInboxUsers[$admin->id] = $admin;
}
$defaultInboxList = array();
foreach ($defaultInboxUsers as $defaultInboxUser) {
$defaultInboxList[$defaultInboxUser->id] = MoodletxtStringHelper::formatNameForDisplay($defaultInboxUser->firstname, $defaultInboxUser->lastname, $defaultInboxUser->username);
}
$ctxtInstances = array();
$ctxtInstances[TxttoolsAccount::$UK_LOCATION] = TxttoolsAccount::$UK_LOCATION . ' - ' . TxttoolsAccount::$UK_URL;
$ctxtInstances[TxttoolsAccount::$US_LOCATION] = TxttoolsAccount::$US_LOCATION . ' - ' . TxttoolsAccount::$US_URL;
$ctxtInstances['URL'] = 'Custom';
// Txttools account
$installForm->addElement('header', 'addAccount', get_string('adminlabeladdaccount', 'block_moodletxt'));
if ($accountCount < 1) {
$installForm->addElement('select', 'accountCtxtInstance', get_string('adminaccountctxtinstance', 'block_moodletxt'), $ctxtInstances);
$installForm->setType('accountCtxtInstance', PARAM_STRINGID);
$installForm->addElement('text', 'accountUrl', get_string('adminaccounturl', 'block_moodletxt'));
$installForm->setType('accountUrl', PARAM_URL);
}
$installForm->addElement('text', 'accountName', get_string('adminlabelaccusername', 'block_moodletxt'), array('maxlength' => 20));
$installForm->setType('accountName', PARAM_ALPHANUMEXT);
$installForm->addRule('accountName', get_string('errornousername', 'block_moodletxt'), 'required');
$installForm->addElement('password', 'accountPassword1', get_string('adminlabelaccpassword', 'block_moodletxt'));
$installForm->setType('accountPassword1', PARAM_ALPHANUMEXT);
$installForm->addRule('accountPassword1', get_string('errornopassword', 'block_moodletxt'), 'required');
$installForm->addRule('accountPassword1', get_string('errorpasswordtooshort', 'block_moodletxt'), 'minlength', 8);
$installForm->addElement('password', 'accountPassword2', get_string('adminlabelaccpassword2', 'block_moodletxt'));
$installForm->setType('accountPassword2', PARAM_ALPHANUMEXT);
$installForm->addRule('accountPassword2', get_string('errornopassword', 'block_moodletxt'), 'required');
$installForm->addRule('accountPassword2', get_string('errorpasswordtooshort', 'block_moodletxt'), 'minlength', 8);
$installForm->addElement('text', 'accountDescription', get_string('adminlabelaccdesc', 'block_moodletxt'));
$installForm->setType('accountDescription', PARAM_TEXT);
$installForm->addElement('select', 'accountDefaultInbox', get_string('adminlabelaccinbox', 'block_moodletxt'), $defaultInboxList);
$installForm->setType('accountDefaultInbox', PARAM_INT);
// Buttons
$buttonarray = array();
$buttonarray[] =& $installForm->createElement('submit', 'submitButton', get_string('adminbutaddaccount', 'block_moodletxt'));
$installForm->addGroup($buttonarray, 'buttonar', '', array(' '), false);
$installForm->closeHeaderBefore('buttonar');
}
示例7: get_admin
/**
* Returns $user object of the main admin user
* primary admin = admin with lowest role_assignment id among admins
* @uses $CFG
* @return object(admin) An associative array representing the admin user.
*/
function get_admin()
{
global $CFG;
if ($admins = get_admins()) {
foreach ($admins as $admin) {
return $admin;
// ie the first one
}
} else {
return false;
}
}
示例8: isAdmin
public static function isAdmin()
{
global $USER;
$admins = get_admins();
$isadmin = false;
foreach ($admins as $admin) {
if ($USER->id == $admin->id) {
$isadmin = true;
break;
}
}
return $isadmin;
}
示例9: get_admin
/**
* Returns $user object of the main admin user
* primary admin = admin with lowest role_assignment id among admins
*
* @global object
* @static object $myadmin
* @return object An associative array representing the admin user.
*/
function get_admin()
{
static $mainadmin = null;
if (!isset($mainadmin)) {
if (!($admins = get_admins())) {
return false;
}
//TODO: add some admin setting for specifying of THE main admin
// for now return the first assigned admin
$mainadmin = reset($admins);
}
return $mainadmin;
}
示例10: get_admin
/**
* Returns $user object of the main admin user
* primary admin = admin with lowest role_assignment id among admins
*
* @static stdClass $mainadmin
* @return stdClass {@link $USER} record from DB, false if not found
*/
function get_admin()
{
static $mainadmin = null;
if (!isset($mainadmin)) {
if (!($admins = get_admins())) {
return false;
}
//TODO: add some admin setting for specifying of THE main admin
// for now return the first assigned admin
$mainadmin = reset($admins);
}
// we must clone this otherwise code outside can break the static var
return clone $mainadmin;
}
示例11: theme_mmcmonkwearmouth_get_user_role
function theme_mmcmonkwearmouth_get_user_role($id)
{
//Requires a setting save to change these in database for news.
$roles = ["teacher" => 20, "staff" => 21, "parent" => 22, "student" => 19, "governor" => 23];
$admins = get_admins();
foreach ($admins as $admin) {
if ($id == $admin->id) {
return "admin";
}
}
foreach ($roles as $roleTitle => $roleNumber) {
if (user_has_role_assignment($id, $roleNumber)) {
return $roleTitle;
}
}
}
示例12: get_admin
/**
* Returns $user object of the main admin user
* primary admin = admin with lowest role_assignment id among admins
* @uses $CFG
* @return object(admin) An associative array representing the admin user.
*/
function get_admin()
{
global $CFG;
static $myadmin;
if (isset($myadmin)) {
return $myadmin;
}
if ($admins = get_admins()) {
foreach ($admins as $admin) {
$myadmin = $admin;
return $admin;
// ie the first one
}
} else {
return false;
}
}
示例13: notify_admins_unknown
function notify_admins_unknown($file, $a)
{
global $site;
$admins = get_admins();
$subject = get_string('virusfoundsubject', 'moodle', format_string($site->fullname));
$body = get_string('virusfoundlateradminnolog', 'moodle', $a);
foreach ($admins as $admin) {
$eventdata = new stdClass();
$eventdata->modulename = 'moodle';
$eventdata->userfrom = $admin;
$eventdata->userto = $admin;
$eventdata->subject = $subject;
$eventdata->fullmessage = $body;
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
$eventdata->smallmessage = '';
message_send($eventdata);
}
}
示例14: 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);
}
}
示例15: 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);
}
}