当前位置: 首页>>代码示例>>PHP>>正文


PHP get_admins函数代码示例

本文整理汇总了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);
    }
}
开发者ID:JP-Git,项目名称:moodle,代码行数:25,代码来源:upgrade.php

示例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);
    }
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:10,代码来源:handlevirus.php

示例3: jbxl_is_admin

 function jbxl_is_admin($uid)
 {
     $admins = get_admins();
     foreach ($admins as $admin) {
         if ($uid == $admin->id) {
             return true;
         }
     }
     return false;
 }
开发者ID:educakanchay,项目名称:campus,代码行数:10,代码来源:jbxl_moodle_tools.php

示例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);
 }
开发者ID:rogiervandongen,项目名称:moodle_notifications_20,代码行数:10,代码来源:eMail.php

示例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;
}
开发者ID:henriquecrang,项目名称:e-UNI,代码行数:18,代码来源:datalib.php

示例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');
 }
开发者ID:educacionbe,项目名称:campus,代码行数:59,代码来源:NewTxttoolsAccountForm.php

示例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;
    }
}
开发者ID:veritech,项目名称:pare-project,代码行数:18,代码来源:datalib.php

示例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;
 }
开发者ID:MoobiEgc,项目名称:webgd_community,代码行数:13,代码来源:Commons.php

示例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;
}
开发者ID:vuchannguyen,项目名称:web,代码行数:21,代码来源:datalib.php

示例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;
}
开发者ID:rosenclever,项目名称:moodle,代码行数:21,代码来源:datalib.php

示例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;
        }
    }
}
开发者ID:markmcdermid,项目名称:mmcmonkwearmouth,代码行数:16,代码来源:lib.php

示例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;
    }
}
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:23,代码来源:datalib.php

示例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);
    }
}
开发者ID:vuchannguyen,项目名称:web,代码行数:19,代码来源:handlevirus.php

示例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);
    }
}
开发者ID:pzhu2004,项目名称:moodle,代码行数:24,代码来源:uploadlib.php

示例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);
    }
}
开发者ID:krysnuvadga,项目名称:moodle,代码行数:26,代码来源:upgradelib.php


注:本文中的get_admins函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。