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


PHP is_siteadmin函数代码示例

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


在下文中一共展示了is_siteadmin函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_content

    function get_content() {
        global $USER,$DB;
        if ($this->content !== NULL) {
            return $this->content;
        }
	$this->content = new stdClass();
	$this->content->items = array();
	$is_manager = $DB->record_exists_sql("select cp.* from {local_costcenter_permissions} as cp 
                             JOIN {role_assignments} as ra ON ra.userid=cp.userid and cp.userid=$USER->id
                             JOIN {role} as r ON r.id=ra.roleid
                             where r.archetype='manager'");
	$is_teammanager = $DB->record_exists('local_teammanager_employee', array('teammanagerid'=>$USER->id));
	if($is_manager || is_siteadmin())
	$link = array(html_writer::link(new moodle_url('/local/users/index.php'),get_string('pluginname','local_users')));
	if(is_siteadmin())
	$link[] =  html_writer::link(new moodle_url('/local/costcenter/index.php'),get_string('pluginname','local_costcenter'));
        
	if($is_manager || is_siteadmin())
	$link[] =  html_writer::link(new moodle_url('/local/teammanager/index.php'),get_string('pluginname', 'local_teammanager'));
	if($is_teammanager && !is_siteadmin())
	$link[] =  html_writer::link(new moodle_url('/local/teammanager/myteam.php'),get_string('viewmyteam', 'local_teammanager'));
	if($is_manager || is_siteadmin())
	$link[] = html_writer::link(new moodle_url('/local/costcenter/courses.php'),get_string('course'));
	$this->content->items =  $link;
	$this->content->icons = '';
        $this->content->footer = '';
        return $this->content;
    }
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:28,代码来源:block_quicklinks.php

示例2: local_loginas_extends_settings_navigation

/**
 * Adds module specific settings to the settings block.
 *
 * @param settings_navigation $settings The settings navigation object
 * @param stdClass $context The node context
 */
function local_loginas_extends_settings_navigation(settings_navigation $settings, $context)
{
    global $DB, $CFG, $PAGE, $USER;
    // Course id and context.
    $courseid = !empty($PAGE->course->id) ? $PAGE->course->id : SITEID;
    $coursecontext = context_course::instance($courseid);
    // Must have the loginas capability.
    if (!has_capability('moodle/user:loginas', $coursecontext)) {
        return;
    }
    // Set the settings category.
    $loginas = $settings->add(get_string('loginas'));
    // Login as list by admin setting.
    if (is_siteadmin($USER)) {
        // Admin settings page.
        $url = new moodle_url('/admin/settings.php', array('section' => 'localsettingloginas'));
        $loginas->add(get_string('settings'), $url, $settings::TYPE_SETTING);
        // Users list.
        $loginasusers = array();
        // Since 2.6, use all the required fields.
        $ufields = 'id, ' . get_all_user_name_fields(true);
        // Get users by id.
        if ($configuserids = get_config('local_loginas', 'loginasusers')) {
            $userids = explode(',', $configuserids);
            if ($users = $DB->get_records_list('user', 'id', $userids, '', $ufields)) {
                $loginasusers = $users;
            }
        }
        // Get users by username.
        if ($configusernames = get_config('local_loginas', 'loginasusernames')) {
            $usernames = explode(',', $configusernames);
            if ($users = $DB->get_records_list('user', 'username', $usernames, '', $ufields)) {
                $loginasusers = $loginasusers + $users;
            }
        }
        // Add action links for specified users.
        if ($loginasusers) {
            $params = array('id' => $courseid, 'sesskey' => sesskey());
            foreach ($loginasusers as $userid => $lauser) {
                $url = new moodle_url('/course/loginas.php', $params);
                $url->param('user', $userid);
                $loginas->add(fullname($lauser, true), $url, $settings::TYPE_SETTING);
            }
        }
    }
    // Course users login as.
    if (!($configcourseusers = get_config('local_loginas', 'courseusers'))) {
        return;
    }
    $loggedinas = \core\session\manager::is_loggedinas();
    if (!$loggedinas) {
        // Ajax link.
        $node = $loginas->add(get_string('courseusers', 'local_loginas'), 'javascript:void();', $settings::TYPE_SETTING);
        $node->add_class('local_loginas_setting_link');
        local_loginas_require_js($PAGE);
    }
}
开发者ID:keliix06,项目名称:moodle-local_loginas,代码行数:63,代码来源:lib.php

示例3: get_content

    public function get_content() {
    global $CFG,$USER;    
    
    if ($this->content !== null) {
      return $this->content;
    }   
    if(!isloggedin()){
        return $this->content;
    }
    
    $this->content =  new stdClass;
    $systemcontext = context_system::instance();

    $usercontext = context_user::instance($USER->id);
      

    if(has_capability('local/gradeletter:manage', $usercontext) || is_siteadmin() ){		 
    $this->content->text=array();
    $icon = html_writer::empty_tag('img',array('src'=>$CFG->wwwroot.'/pix/i/navigationitem.png'));
    $this->content->text[]=html_writer::tag('a',$icon.get_string('addbatch','block_managebatches'),array('href' =>$CFG->wwwroot.'/local/batches/index.php'));
    //$this->content->text[]=html_writer::empty_tag('br');
    $this->content->text[]=html_writer::tag('a',$icon.get_string('assignbatch','block_managebatches'), array('href' =>$CFG->wwwroot.'/local/batches/bulk_enroll.php?mode=new'));
    //$this->content->text[]=html_writer::empty_tag('br');
    $this->content->text[]=html_writer::tag('a',$icon.get_string('enrolbatch','block_managebatches'), array('href' => $CFG->wwwroot.'/local/batches/bulk_enroll.php?mode=exists')); 
    //$this->content->text[]=html_writer::empty_tag('br');
 //   $this->content->text[]=html_writer::tag('a',$icon.get_string('reports','block_managebatches') , array('href' => $CFG->wwwroot.'/admin/index.php?cache=1')); 
    
    $this->content->text=implode('',$this->content->text);
     return $this->content;
    }    
    
    else
     return $this->content;    
   
  }
开发者ID:anilch,项目名称:Personel,代码行数:35,代码来源:block_managebatches.php

示例4: get_content

 function get_content()
 {
     if ($this->content !== NULL) {
         return $this->content;
     }
     global $CFG, $COURSE, $USER;
     $this->content = new stdClass();
     $this->content->icons = array();
     $this->content->items = array();
     $this->content->footer = '';
     list($source, $cap) = $this->permissions($COURSE);
     if (!$cap) {
         return $this->content;
     }
     //We're in a global section, so we change our links
     $global = $source == 'system';
     $cps_user = CoursePrefsUser::findByUnique($USER->username);
     // If the cps user is valid, and they are in the teaching role in their course
     $can_report = ($cps_user and $cps_user->getSectionsForMoodleCourse($COURSE) or is_siteadmin($USER->id));
     if (!$global and $can_report) {
         $this->content->icons[] = '<img src="' . $CFG->pixpath . '/i/email.gif"/>';
         $this->content->items[] = '<a href="' . $CFG->wwwroot . '/blocks/student_reporting/select.php?id=' . $COURSE->id . '">' . get_string('select', 'block_student_reporting') . '</a>';
     }
     $this->content->icons[] = '';
     $this->content->items[] = '<a href="' . $CFG->wwwroot . '/blocks/student_gradeviewer/analysis.php' . ($global ? '' : '?id=' . $COURSE->id) . '">' . get_string('analysis', 'block_student_gradeviewer') . '</a>';
     if (!empty($CFG->cas_email) and $cps_user and $cps_user->getSectionsInfoAsTeacher()) {
         $this->content->items[] = '<a href="' . $CFG->wwwroot . '/blocks/student_gradeviewer/options.php?id=' . $COURSE->id . '">' . get_string('options', 'block_student_gradeviewer') . '</a>';
     }
     return $this->content;
 }
开发者ID:rrusso,项目名称:EARS,代码行数:30,代码来源:block_student_reporting.php

示例5: definition

    public function definition() {
        global $USER, $CFG, $DB;
        $mform = $this->_form;
        $enrol = $this->_customdata['enrolid'];
        if(is_siteadmin())
        $costcenterid = $DB->get_field_sql('select costcenter from {course} as  c join  {enrol} as e ON c.id=e.courseid  where e.id='.$enrol.'');
        
        if(!is_siteadmin())
        $costcenterid = $DB->get_field('local_userdata','costcenterid',array('userid'=>$USER->id));
        
        $sql = 'select distinct(lp.id) as position_key,lp.fullname as position_value from {local_positions} as lp JOIN {local_userdata} as ud ON lp.id=ud.position where ud.position!="" AND ud.costcenterid='.$costcenterid.'';
        $position_list = $DB->get_records_sql_menu($sql);
        $mform->addElement('select', 'position', get_string('positions', 'local_costcenter'),  $position_list, array('multiple' => 'multiple','class'=>'filter_drop'));
        $mform->setType('position', PARAM_RAW);

        $batch_list = $DB->get_records_sql_menu('select id as name_key,name as name_value from {cohort} where id in(select batchid from {local_costcenter_batch} where costcenterid='.$costcenterid.')');
        $mform->addElement('select', 'batch', get_string('batch', 'local_costcenter'),  $batch_list, array('multiple' => 'multiple','class'=>'filter_drop'));
        $mform->setType('batch', PARAM_INT);
        
         $skillset_list = $DB->get_records_sql_menu('select distinct(skillset) as skillset_key,skillset as skillset_value from {local_userdata} where skillset!="" and costcenterid='.$costcenterid.'');
         $mform->addElement('select', 'skillset', get_string('skillset', 'local_costcenter'),  $skillset_list, array('multiple' => 'multiple','class'=>'filter_drop'));
        $mform->setType('skillset', PARAM_RAW);

        $sub_skillset_list = $DB->get_records_sql_menu('select distinct(subskillset) as sub_skillset_key,subskillset as sub_skillset_value from {local_userdata} where subskillset!="" and costcenterid='.$costcenterid.'');
        $mform->addElement('select', 'sub_skillset', get_string('subskillset', 'local_costcenter'), $sub_skillset_list, array('multiple' => 'multiple','class'=>'filter_drop'));
        $mform->setType('sub_skillset', PARAM_RAW);

        $mform->addElement('hidden','enrolid');
        $mform->setType('enrolid',PARAM_INT);
        $mform->setDefault('enrolid',$enrol);
        $this->add_action_buttons('true', 'Filter');
    }
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:32,代码来源:filter_form.php

示例6: insert_analytics_tracking

function insert_analytics_tracking()
{
    global $PAGE, $OUTPUT;
    $trackadmin = false;
    $cleanurl = false;
    if (isset($PAGE->theme->settings->analyticstrackingid)) {
        $trackingid = $PAGE->theme->settings->analyticstrackingid;
    }
    if (isset($PAGE->theme->settings->analyticstrackadmin)) {
        $trackadmin = $PAGE->theme->settings->analyticstrackadmin;
    }
    if (isset($PAGE->theme->settings->analyticscleanurl)) {
        $cleanurl = $PAGE->theme->settings->analyticscleanurl;
    }
    $tracking = '';
    if ($cleanurl) {
        $addition = "{'hitType' : 'pageview',\n            'page' : " . analytics_trackurl() . ",\n            'title' : '" . addslashes($PAGE->heading) . "'\n            }";
    } else {
        $addition = "'pageview'";
    }
    if (!is_siteadmin() || $trackadmin) {
        $tracking = "\n            <script>\n            (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n            m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n            })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n            ga('create', '" . $trackingid . "', {'siteSpeedSampleRate': 50});\n            ga('send', " . $addition . ");\n\n            </script>";
    }
    return $tracking;
}
开发者ID:kennibc,项目名称:moodle-theme_pioneer,代码行数:25,代码来源:guniversal.php

示例7: filter_matches

 /**
  * Check whether the filter matches the specified tour and/or context.
  *
  * @param   tour        $tour       The tour to check
  * @param   context     $context    The context to check
  * @return  boolean
  */
 public static function filter_matches(tour $tour, context $context)
 {
     global $USER;
     $values = $tour->get_filter_values(self::get_filter_name());
     if (empty($values)) {
         // There are no values configured.
         // No values means all.
         return true;
     }
     if (is_siteadmin()) {
         return true;
     }
     // Presence within the array is sufficient. Ignore any value.
     $values = array_flip($values);
     $cache = \cache::make_from_params(\cache_store::MODE_REQUEST, 'tool_usertours', 'filter_role');
     $cachekey = "{$USER->id}_{$context->id}";
     $userroles = $cache->get($cachekey);
     if ($userroles === false) {
         $userroles = get_user_roles_with_special($context);
         $cache->set($cachekey, $userroles);
     }
     foreach ($userroles as $role) {
         if (isset($values[$role->roleid])) {
             return true;
         }
     }
     return false;
 }
开发者ID:dg711,项目名称:moodle,代码行数:35,代码来源:role.php

示例8: definition

 /**
  * Form definition.
  *
  * @return void
  */
 function definition()
 {
     global $CFG;
     $mform =& $this->_form;
     $mform->disable_form_change_checker();
     $mform->addElement('header', 'search', get_string('search', 'search'));
     // Help info depends on the selected search engine.
     $mform->addElement('text', 'q', get_string('enteryoursearchquery', 'search'));
     $mform->addHelpButton('q', 'searchinfo', $this->_customdata['searchengine']);
     $mform->setType('q', PARAM_TEXT);
     $mform->addRule('q', get_string('required'), 'required', null, 'client');
     $mform->addElement('header', 'filtersection', get_string('filterheader', 'search'));
     $mform->setExpanded('filtersection', false);
     $mform->addElement('text', 'title', get_string('title', 'search'));
     $mform->setType('title', PARAM_TEXT);
     $search = \core_search\manager::instance();
     $searchareas = \core_search\manager::get_search_areas_list(true);
     $areanames = array();
     foreach ($searchareas as $areaid => $searcharea) {
         $areanames[$areaid] = $searcharea->get_visible_name();
     }
     // Sort the array by the text.
     \core_collator::asort($areanames);
     $options = array('multiple' => true, 'noselectionstring' => get_string('allareas', 'search'));
     $mform->addElement('autocomplete', 'areaids', get_string('searcharea', 'search'), $areanames, $options);
     $options = array('multiple' => true, 'limittoenrolled' => !is_siteadmin(), 'noselectionstring' => get_string('allcourses', 'search'));
     $mform->addElement('course', 'courseids', get_string('courses', 'core'), $options);
     $mform->setType('courseids', PARAM_INT);
     $mform->addElement('date_time_selector', 'timestart', get_string('fromtime', 'search'), array('optional' => true));
     $mform->setDefault('timestart', 0);
     $mform->addElement('date_time_selector', 'timeend', get_string('totime', 'search'), array('optional' => true));
     $mform->setDefault('timeend', 0);
     $this->add_action_buttons(false, get_string('search', 'search'));
 }
开发者ID:evltuma,项目名称:moodle,代码行数:39,代码来源:search.php

示例9: insert_analytics_tracking

function insert_analytics_tracking() {
    global $CFG;
    $enabled = get_config('local_analytics', 'enabled');
    $siteid = get_config('local_analytics', 'siteid');
    $trackadmin = get_config('local_analytics', 'trackadmin');
    $cleanurl = get_config('local_analytics', 'cleanurl');
    $location = "additionalhtml" . get_config('local_analytics', 'location');

    if ($enabled && (!is_siteadmin() || $trackadmin)) {
        $CFG->$location .= "
            <script type='text/javascript' name='localga'>
              var _gaq = _gaq || [];
              _gaq.push(['_setAccount', '" . $siteid . "']);
              _gaq.push(['_trackPageview'," . ($cleanurl ? analytics_trackurl() : '') . "]);
              _gaq.push(['_setSiteSpeedSampleRate', 50]);

              (function() {
                var ga = document.createElement('script'); ga.type = 'text/javascript'; 
                ga.async = true;
                ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
                var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
              })();
            </script>
			";
    }
}
开发者ID:anilch,项目名称:Personel,代码行数:26,代码来源:ganalytics.php

示例10: search

 public function search($q, $courseID = 0, $removeHiddenResults = false)
 {
     if (strlen($q) < 2) {
         return array('error' => get_string('error_query_too_short', 'block_search', 2));
     }
     raise_memory_limit(MEMORY_UNLIMITED);
     //Check if user cached results exist
     $userCacheValidFor = (int) get_config('block_search', 'cache_results_per_user');
     $useUserCache = $userCacheValidFor > 0;
     if (is_siteadmin()) {
         $useUserCache = false;
     }
     if ($useUserCache) {
         $cacheKey = md5(json_encode(array($q, $courseID, $removeHiddenResults)));
         $userCache = cache::make('block_search', 'user_searches');
         if ($results = $userCache->get($cacheKey)) {
             if ($results['filtered'] > time() - (int) $userCacheValidFor) {
                 $results['userCached'] = true;
                 return $results;
             }
         }
     }
     $search = new Search($q, $courseID);
     $search->filterResults($removeHiddenResults);
     $results = $search->getResults();
     if ($useUserCache) {
         $userCache->set($cacheKey, $results);
     }
     return $results;
 }
开发者ID:papillon326,项目名称:moodle-block_search,代码行数:30,代码来源:Block.php

示例11: insert_analytics_tracking

function insert_analytics_tracking() {
    global $CFG, $PAGE;
    $enabled = get_config('local_analytics', 'enabled');
    $siteid = get_config('local_analytics', 'siteid');
    $trackadmin = get_config('local_analytics', 'trackadmin');
    $cleanurl = get_config('local_analytics', 'cleanurl');
    $location = "additionalhtml" . get_config('local_analytics', 'location');

    if ($cleanurl) {
        $addition = "{'hitType' : 'pageview',
            'page' : " . analytics_trackurl() . ",
            'title' : '" . addslashes($PAGE->heading) . "'
            }";
    } else {
        $addition = "'pageview'";
    }


    if ($enabled && (!is_siteadmin() || $trackadmin)) {
        $CFG->$location .= "   
            <script>
            (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
            m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
            })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
            ga('create', '" . $siteid . "', {'siteSpeedSampleRate': 50});
            ga('send', " . $addition . ");
			
            </script>
			";
    }
}
开发者ID:anilch,项目名称:Personel,代码行数:32,代码来源:guniversal.php

示例12: observer

 /**
  * Observe the events, and dispatch them if necessary.
  *
  * @param \core\event\base $event The event.
  * @return void
  */
 public static function observer(\core\event\base $event)
 {
     if ($event->component === 'block_xp') {
         // Skip own events.
     } else {
         if (!$event->userid || isguestuser($event->userid) || is_siteadmin($event->userid)) {
             // Skip non-logged in users and guests.
         } else {
             if ($event->contextlevel !== CONTEXT_COURSE && $event->contextlevel !== CONTEXT_MODULE) {
                 // Ignore events outside a course.
             } else {
                 if ($event->edulevel !== \core\event\base::LEVEL_PARTICIPATING) {
                     // Ignore events that are not participating.
                 } else {
                     if (!has_capability('block/xp:earnxp', $event->get_context(), $event->userid)) {
                         // Skip the events if the user does not have the capability to earn XP, or if it is the admin.
                     } else {
                         // Keep the event, and proceed.
                         $manager = block_xp_manager::get($event->courseid);
                         $manager->capture_event($event);
                     }
                 }
             }
         }
     }
 }
开发者ID:scarletjester,项目名称:moodle-block_xp,代码行数:32,代码来源:helper.php

示例13: get_content

 function get_content()
 {
     global $CFG, $USER;
     if ($this->content !== NULL) {
         return $this->content;
     }
     if (!isloggedin()) {
         return $this->content;
     }
     if (is_siteadmin()) {
         return $this->content;
     }
     //this block is for students
     $usercontext = context_user::instance($USER->id);
     if (!has_capability('local/clclasses:enrollclass', $usercontext)) {
         return $this->content;
     }
     // Prep the content
     $this->content = new stdClass();
     require_once 'academic_status.php';
     //$id=optional_param('id',5,PARAM_INT);
     $events = get_semslist();
     $this->content->text = $events;
     return $this->content;
     // Prepare the footer for this block
     // No footer to display
     $this->content->footer = '';
     // Return the content object
     return $this->content;
 }
开发者ID:anilch,项目名称:Personel,代码行数:30,代码来源:block_academic_status.php

示例14: theme_essential_insert_analytics_tracking

function theme_essential_insert_analytics_tracking()
{
    $siteurl = \theme_essential\toolbox::get_setting('analyticssiteurl');
    $tracking = '';
    if (!empty($siteurl)) {
        $imagetrack = \theme_essential\toolbox::get_setting('analyticsimagetrack');
        $siteid = \theme_essential\toolbox::get_setting('analyticssiteid');
        $trackadmin = \theme_essential\toolbox::get_setting('analyticstrackadmin');
        $cleanurl = \theme_essential\toolbox::get_setting('analyticscleanurl');
        if ($imagetrack) {
            $addition = '<noscript><p><img src="//' . $siteurl . '/piwik.php?idsite=' . $siteid . '" style="border:0" alt="" /></p></noscript>';
        } else {
            $addition = '';
        }
        if ($cleanurl) {
            $doctitle = "_paq.push(['setDocumentTitle', " . theme_essential_analytics_trackurl() . "]);";
        } else {
            $doctitle = "";
        }
        if (!is_siteadmin() || $trackadmin) {
            $tracking = "<script type='text/javascript'>\n                    var _paq = _paq || [];\n                    " . $doctitle . "\n                    _paq.push(['enableLinkTracking']);\n                    _paq.push(['trackPageView']);\n                    (function(){\n                        var u=(('https:' == document.location.protocol) ? 'https' : 'http') + '://" . $siteurl . "/';\n                        _paq.push(['setSiteId', " . $siteid . "]);\n                        _paq.push(['setTrackerUrl', u+'piwik.php']);\n                        var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.defer=true; g.async=true; g.src=u+'piwik.js';\n                        s.parentNode.insertBefore(g,s);\n                    })();\n                </script>\n                " . $addition;
        }
    }
    return $tracking;
}
开发者ID:RobsonTK,项目名称:Moodle,代码行数:25,代码来源:piwik.php

示例15: user_loggedin

 /**
  * Triggered via the user_loggedin event, when a user logs in.
  *
  * @param stdClass $event
  */
 public static function user_loggedin($event)
 {
     global $DB;
     $eventdata = $event->get_data();
     if (!enrol_is_enabled('auto')) {
         return;
     }
     if (is_siteadmin($eventdata['userid'])) {
         // Don't enrol site admins
         return;
     }
     // Get all courses that have an auto enrol plugin, set to auto enrol on login, where the user isn't enrolled yet
     $sql = "SELECT e.courseid\n            FROM {enrol} e\n            LEFT JOIN {user_enrolments} ue ON e.id = ue.enrolid AND ue.userid = ?\n            WHERE e.enrol = 'auto'\n            AND e.status = ?\n            AND e.customint3 = ?\n            AND ue.id IS NULL";
     if (!($courses = $DB->get_records_sql($sql, array($eventdata['userid'], ENROL_INSTANCE_ENABLED, ENROL_AUTO_LOGIN)))) {
         return;
     }
     $autoplugin = enrol_get_plugin('auto');
     foreach ($courses as $course) {
         if (!($instance = $autoplugin->get_instance_for_course($course->courseid))) {
             continue;
         }
         $autoplugin->enrol_user($instance, $eventdata['userid'], $instance->roleid);
         // Send welcome message.
         if ($instance->customint2) {
             $autoplugin = enrol_get_plugin('auto');
             $autoplugin->email_welcome_message($instance, $DB->get_record('user', array('id' => $eventdata['userid'])));
         }
     }
 }
开发者ID:ninelanterns,项目名称:scaffold-enrol_auto,代码行数:34,代码来源:observer.php


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