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

PHP is_siteadmin函数代码示例

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

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



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


示例16: definition

 function definition()
 {
     global $DB, $CFG, $USER;
     $mform = $this->_form;
     $instance = $this->_customdata;
     $examid = $instance['examid'];
     $debug = $instance['debug'];
     // Exam totalpages goes hidden as well
     $mform->addElement('hidden', 'exam', $examid);
     $mform->setType('exam', PARAM_INT);
     // Exam totalpages goes hidden as well
     $mform->addElement('hidden', 'debug', $debug);
     $mform->setType('debug', PARAM_BOOL);
     $mform->addElement('header', 'selectprinter', get_string('selectprinter', 'mod_emarking'));
     if (is_siteadmin($USER)) {
         $sqlprinters = "SELECT p.id, p.name\n\t\t\t\t\tFROM {emarking_printers} as p";
         $printersarray = $DB->get_records_sql($sqlprinters);
     } else {
         $sqlprinters = "SELECT p.id, p.name\n\t\t\t\t\tFROM {emarking_printers} as p \n\t\t\t\t\tINNER JOIN {emarking_users_printers} as up ON (p.id = up.id_printer)\n\t\t\t\t\tWHERE up.id_user = ?";
         $printersarray = $DB->get_records_sql($sqlprinters, array($USER->id));
     }
     $selectprinters = array();
     foreach ($printersarray as $printer) {
         $selectprinters[$printer->id] = $printer->name;
     }
     // Extra sheets per student
     $mform->addElement('select', 'printername', get_string('printername', 'mod_emarking'), $selectprinters, null);
     $mform->addHelpButton('printername', 'printername', 'mod_emarking');
     // buttons
     $this->add_action_buttons(true, get_string('submit'));
 }
开发者ID:eduagdo,项目名称:emarking,代码行数:31,代码来源:printexam_form.php


示例17: block_queries_display_view

function block_queries_display_view($USER,$instructorlogin,$registrarlogin,$studentlogin){
     global $CFG, $USER, $PAGE, $DB;
     $blockqueries_returncontent = array();
           $sql ="SELECT * FROM {block_queries} WHERE userid = $USER->id";
     if(is_siteadmin($USER->id)){
          $sql .=" AND userrole = 'admin' ORDER BY id DESC LIMIT 3";
          $blockqueries_returncontent[]=blockqueries_tablecontent($sql);
          $blockqueries_returncontent = implode('',$blockqueries_returncontent);
     }
     elseif(!empty($instructorlogin) ){
        $sql .=" AND userrole = 'instructor' ORDER BY id DESC LIMIT 3";
        $blockqueries_returncontent[]=blockqueries_tablecontent($sql);
        $blockqueries_returncontent = implode('',$blockqueries_returncontent);
     }
     elseif(!empty($registrarlogin)){
        $sql .=" AND userrole = 'registrar' ORDER BY id DESC LIMIT 3";
        $blockqueries_returncontent[]=blockqueries_tablecontent($sql);
        $blockqueries_returncontent = implode('',$blockqueries_returncontent);
     }
     elseif(!empty($studentlogin)){
        $formdata = new stdClass();
        $actionpage = $CFG->wwwroot.'/blocks/queries/sendingemail.php';
        $mform= new block_queries_form($actionpage);
        $blockqueries_returncontent[] = $mform->render();  //to display form in block
        $blockqueries_returncontent = implode('',$blockqueries_returncontent);
   }
     else {
          $blockqueries_returncontent[] = html_writer:: tag('p',get_string('noprevioussubjects','block_queries'),array());  
     }
     return $blockqueries_returncontent;
} // end of function 
开发者ID:anilch,项目名称:Personel,代码行数:31,代码来源:lib.php


示例18: call_success

 public function call_success()
 {
     global $USER, $COURSE, $CFG;
     if (empty($this->_xmlresponse)) {
         if (is_siteadmin($USER->id)) {
             notice(get_string('adminemptyxml', 'adobeconnect'), $CFG->wwwroot . '/admin/settings.php?section=modsettingadobeconnect');
         } else {
             notice(get_string('emptyxml', 'adobeconnect'), '', $COURSE);
         }
     }
     $dom = new DomDocument();
     $dom->loadXML($this->_xmlresponse);
     $domnodelist = $dom->getElementsByTagName('status');
     if ($domnodelist->item(0)->hasAttributes()) {
         $domnode = $domnodelist->item(0)->attributes->getNamedItem('code');
         if (!is_null($domnode)) {
             if (0 == strcmp('ok', $domnode->nodeValue)) {
                 return true;
             } else {
                 return false;
             }
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:28,代码来源:connect_class_dom.php


示例19: definition

 public function definition() {
     global $USER,$DB;
     $mform = & $this->_form;
      $id = $this->_customdata['id'];
     if (!isset($errors))
         $errors = array();
      /*
      * EA_NK23-02-2015
      * Added cost center field
      */
     $costcenters = array();
     $is_manager = $DB->record_exists_sql("SELECT ra.userid
                                             FROM {role_assignments} as ra
                                             JOIN {role} as r ON ra.roleid=r.id
                                            WHERE r.archetype='manager' AND ra.userid={$USER->id}");
         if($id>0){
          $batchname = $DB->get_field_sql("SELECT c.fullname FROM {local_costcenter} as c JOIN {learning_learningplan} as lp ON c.id=lp.costcenter AND lp.id=$id");
          $mform->addElement('static', 'costcenterid', get_string('pluginname', 'local_costcenter'), $batchname);
     }if(is_siteadmin()){
     $costcenters = $DB->get_records_select_menu('local_costcenter','',null,'id','id,fullname');
     $mform->addElement('select', 'costcenter', get_string('pluginname', 'local_costcenter'), $costcenters);        
     }elseif ($is_manager) {
        /* code for training manager capable of handling one or more departments - code added by sreenivas*/
         $costcenterslists = $DB->get_records_sql("SELECT cc.* FROM {local_costcenter_permissions} ccp JOIN {local_costcenter} cc ON ccp.costcenterid=cc.id WHERE ccp.userid={$USER->id}");
         if (!$costcenterslists)
         print_error('notassignedcostcenter', 'local_costcenter'); // code by sreenivas 27/10/2015
         $costarray = array();
         foreach ($costcenterslists as $costcenterslist) {
             $costarray[$costcenterslist->id] = $costcenterslist->fullname;
         }
          $mform->addElement('select', 'costcenter', get_string('pluginname', 'local_costcenter'), $costarray);
          /*end of code - sreenivas*/
     //$costcenter = $DB->get_record_sql("SELECT cc.* FROM {local_costcenter_permissions} ccp JOIN {local_costcenter} cc ON ccp.costcenterid=cc.id WHERE ccp.userid={$USER->id}");
     //$mform->addElement('hidden','costcenter');
     //$mform->setDefault('costcenter',$costcenter->id);
     //$mform->addElement('static', 'costcenterid', get_string('pluginname', 'local_costcenter'), $costcenter->fullname);
     }else{
     $costcenters = $DB->get_records_sql_menu("SELECT cc.id,cc.fullname FROM {local_userdata} ud JOIN {local_costcenter} cc ON ud.costcenterid=cc.id WHERE ud.userid={$USER->id}");
     $mform->addElement('hidden','costcenter');
     $mform->setDefault('costcenter',$costcenter->id);
     $mform->addElement('static', 'costcenterid', get_string('pluginname', 'local_costcenter'), $costcenter->fullname);
     }
     $mform->setType('costcenter', PARAM_RAW);
     $mform->addElement('text', 'learning_plan', get_string('fullnamelp', 'block_learning_plan'));
     $mform->addRule('learning_plan', null, 'required', null, 'server');
     $mform->setType('learning_plan', PARAM_TEXT);
     $mform->addElement('text', 'shortname', get_string('shortnamelp','block_learning_plan'), 'maxlength="100" size="20"');
     //$mform->addHelpButton('shortname', 'shortnamelp');
     $mform->addRule('shortname', get_string('missingshortname'), 'required', null, 'client');
     $mform->setType('shortname', PARAM_TEXT);
     $attributes = array('rows' => '8', 'cols' => '40');
     $mform->addElement('textarea', 'description', get_string('desc', 'block_learning_plan'), $attributes);
     $mform->setType('description', PARAM_TEXT);
      $mform->addElement('date_selector', 'startdate', get_string('startdate','block_learning_plan'),array('optional'=>true));
     $mform->addElement('date_selector', 'enddate', get_string('enddate','block_learning_plan'),array('optional'=>true));
     $mform->addElement('hidden', 'id');
     $mform->setType('id', PARAM_INT);
     $this->add_action_buttons();
 }
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:59,代码来源:learning_plan_form.php


示例20: test_set_admin_user

 public function test_set_admin_user()
 {
     global $USER;
     $this->resetAfterTest(true);
     $this->setAdminUser();
     $this->assertEquals($USER->id, 2);
     $this->assertTrue(is_siteadmin());
 }
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:8,代码来源:advanced_test.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP is_soap_fault函数代码示例发布时间:2022-05-15
下一篇:
PHP is_site_admin函数代码示例发布时间: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