• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_admins函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_admins函数的典型用法代码示例。如果您正苦于以下问题:PHP get_admins函数的具体用法?PHP get_admins怎么用?PHP get_admins使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_admins函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: NotifyAdmins

 public static function NotifyAdmins(\Models\Sickleave $sickleave)
 {
     $mail = self::Instance();
     // Get admins
     require_once ROOT_PATH . 'includes/load_admin_usernames.php';
     $admins = get_admins();
     // Initialize user data of people behind the sickleave entry
     $userAuthor = $sickleave->getAuthor();
     $userFor = $sickleave->getFor();
     foreach ($admins as $admin) {
         $adminUser = \Models\User::FindUsername($admin);
         if ($adminUser instanceof \Models\User) {
             $emailAddress = $adminUser->getEmail();
             $mail->clearAllRecipients();
             // Send email to this person
             $mail->addAddress($emailAddress, $adminUser->getName());
             $mail->Subject = sprintf('New Sick-leave for %s', $userFor->getName());
             $mail->Body = String::Format('<font face="arial" size="8px">' . 'Hello {{admin_name}},<br>' . '<br>' . '<br>' . '<h2>A sick-leave has been filed for {{for_name}}</h2>' . '<br>' . '<b>For: </b>{{for_name}}<br>' . '<b>Author: </b>{{author_name}}<br>' . '<b>Target date: </b>{{date}}<br>' . '<b>Span: </b>{{span}} day/s<br>' . '<br>' . '<h2>Reason</h2>' . '<h3><i>"{{reason}}"</i></h3><br>' . 'To view this sick-leave, click the URL below: <br>' . '<a href="{{url}}">{{url}}</a><br>' . '<br>' . 'Thank you!<br>' . '<i>OpeniT YouSick system</i>' . '</font>', ['admin_name' => $adminUser->getName(), 'for_name' => $userFor->getName(), 'author_name' => $userAuthor->getName(), 'date' => $sickleave->getDate(), 'span' => $sickleave->getSpan(), 'reason' => $sickleave->getReason(), 'url' => BASE_URL . 'admin/view-sickleave?id=' . $sickleave->GetRecordID()]);
             // Send mail
             $mail->send();
         }
     }
 }
开发者ID:allenlinatoc,项目名称:yousick,代码行数:23,代码来源:Email.php


示例17: repository_boxnet_admin_upgrade_notification

/**
 * Send a message to the admin in regard with the APIv1 migration.
 *
 * @return void
 */
function repository_boxnet_admin_upgrade_notification()
{
    $admins = get_admins();
    if (empty($admins)) {
        return;
    }
    $a = new stdClass();
    $a->docsurl = get_docs_url('Box.net_APIv1_migration');
    foreach ($admins as $admin) {
        $message = new stdClass();
        $message->component = 'moodle';
        $message->name = 'notices';
        $message->userfrom = get_admin();
        $message->userto = $admin;
        $message->smallmessage = get_string('apiv1migration_message_small', 'repository_boxnet');
        $message->subject = get_string('apiv1migration_message_subject', 'repository_boxnet');
        $message->fullmessage = get_string('apiv1migration_message_content', 'repository_boxnet', $a);
        $message->fullmessagehtml = get_string('apiv1migration_message_content', 'repository_boxnet', $a);
        $message->fullmessageformat = FORMAT_PLAIN;
        $message->notification = 1;
        message_send($message);
    }
}
开发者ID:alanaipe2015,项目名称:moodle,代码行数:28,代码来源:upgradelib.php


示例18: repository_googledocs_admin_upgrade_notification

function repository_googledocs_admin_upgrade_notification() {
    $admins = get_admins();

    if (empty($admins)) {
        return;
    }
    $mainadmin = reset($admins);

    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', 'repository_googledocs');
        $message->subject           = get_string('oauth2upgrade_message_subject', 'repository_googledocs');
        $message->fullmessage       = get_string('oauth2upgrade_message_content', 'repository_googledocs');
        $message->fullmessagehtml   = get_string('oauth2upgrade_message_content', 'repository_googledocs');
        $message->fullmessageformat = FORMAT_PLAIN;
        $message->notification      = 1;
        message_send($message);
    }
}
开发者ID:nicusX,项目名称:moodle,代码行数:23,代码来源:upgrade.php


示例19: mod_assignment_pending_upgrades_notification

/**
 * Inform admins about assignments that still need upgrading.
 */
function mod_assignment_pending_upgrades_notification($count)
{
    $admins = get_admins();
    if (empty($admins)) {
        return;
    }
    $a = new stdClass();
    $a->count = $count;
    $a->docsurl = get_docs_url('Assignment_upgrade_tool');
    foreach ($admins as $admin) {
        $message = new stdClass();
        $message->component = 'moodle';
        $message->name = 'notices';
        $message->userfrom = \core_user::get_noreply_user();
        $message->userto = $admin;
        $message->smallmessage = get_string('pendingupgrades_message_small', 'mod_assignment');
        $message->subject = get_string('pendingupgrades_message_subject', 'mod_assignment');
        $message->fullmessage = get_string('pendingupgrades_message_content', 'mod_assignment', $a);
        $message->fullmessagehtml = get_string('pendingupgrades_message_content', 'mod_assignment', $a);
        $message->fullmessageformat = FORMAT_PLAIN;
        $message->notification = 1;
        message_send($message);
    }
}
开发者ID:alanaipe2015,项目名称:moodle,代码行数:27,代码来源:upgradelib.php


示例20: load_choices

 /**
  * Load all of the uses who have the capability into choice array
  *
  * @return bool Always returns true
  */
 function load_choices()
 {
     if (is_array($this->choices)) {
         return true;
     }
     list($sort, $sortparams) = users_order_by_sql('u');
     if (!empty($sortparams)) {
         throw new coding_exception('users_order_by_sql returned some query parameters. ' . 'This is unexpected, and a problem because there is no way to pass these ' . 'parameters to get_users_by_capability. See MDL-34657.');
     }
     $userfields = 'u.id, u.username, ' . get_all_user_name_fields(true, 'u');
     $users = get_users_by_capability(context_system::instance(), $this->capability, $userfields, $sort);
     $this->choices = array('$@NONE@$' => get_string('nobody'), '$@ALL@$' => get_string('everyonewhocan', 'admin', get_capability_string($this->capability)));
     if ($this->includeadmins) {
         $admins = get_admins();
         foreach ($admins as $user) {
             $this->choices[$user->id] = fullname($user);
         }
     }
     if (is_array($users)) {
         foreach ($users as $user) {
             $this->choices[$user->id] = fullname($user);
         }
     }
     return true;
 }
开发者ID:Alexbado,项目名称:moodle2,代码行数:30,代码来源:adminlib.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_affiliate函数代码示例发布时间:2022-05-15
下一篇:
PHP get_adminpage_name函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap