本文整理汇总了PHP中textlib::strtolower方法的典型用法代码示例。如果您正苦于以下问题:PHP textlib::strtolower方法的具体用法?PHP textlib::strtolower怎么用?PHP textlib::strtolower使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类textlib
的用法示例。
在下文中一共展示了textlib::strtolower方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validation
/**
* Form validation
*
* @param array $data
* @param array $files
* @return array $errors An array of validataion errors for the form.
*/
function validation($data, $files)
{
global $COURSE, $DB;
$errors = parent::validation($data, $files);
$name = trim($data['name']);
if (isset($data['idnumber'])) {
$idnumber = trim($data['idnumber']);
} else {
$idnumber = '';
}
if ($data['id'] and $grouping = $DB->get_record('groupings', array('id' => $data['id']))) {
if (textlib::strtolower($grouping->name) != textlib::strtolower($name)) {
if (groups_get_grouping_by_name($COURSE->id, $name)) {
$errors['name'] = get_string('groupingnameexists', 'group', $name);
}
}
if (!empty($idnumber) && $grouping->idnumber != $idnumber) {
if (groups_get_grouping_by_idnumber($COURSE->id, $idnumber)) {
$errors['idnumber'] = get_string('idnumbertaken');
}
}
} else {
if (groups_get_grouping_by_name($COURSE->id, $name)) {
$errors['name'] = get_string('groupingnameexists', 'group', $name);
} else {
if (!empty($idnumber) && groups_get_grouping_by_idnumber($COURSE->id, $idnumber)) {
$errors['idnumber'] = get_string('idnumbertaken');
}
}
}
return $errors;
}
示例2: validation
/**
* Form validation
*
* @param array $data
* @param array $files
* @return array $errors An array of errors
*/
function validation($data, $files)
{
global $COURSE, $DB, $CFG;
$errors = parent::validation($data, $files);
$name = trim($data['name']);
if ($data['id'] and $group = $DB->get_record('groups', array('id' => $data['id']))) {
if (textlib::strtolower($group->name) != textlib::strtolower($name)) {
if (groups_get_group_by_name($COURSE->id, $name)) {
$errors['name'] = get_string('groupnameexists', 'group', $name);
}
}
if (!empty($CFG->groupenrolmentkeypolicy) and $data['enrolmentkey'] != '' and $group->enrolmentkey !== $data['enrolmentkey']) {
// enforce password policy only if changing password
$errmsg = '';
if (!check_password_policy($data['enrolmentkey'], $errmsg)) {
$errors['enrolmentkey'] = $errmsg;
}
}
} else {
if (groups_get_group_by_name($COURSE->id, $name)) {
$errors['name'] = get_string('groupnameexists', 'group', $name);
}
}
return $errors;
}
示例3: user_update_user
/**
* Update a user with a user object (will compare against the ID)
*
* @param object $user the user to update
*/
function user_update_user($user)
{
global $DB;
// set the timecreate field to the current time
if (!is_object($user)) {
$user = (object) $user;
}
//check username
if (isset($user->username)) {
if ($user->username !== textlib::strtolower($user->username)) {
throw new moodle_exception('usernamelowercase');
} else {
if ($user->username !== clean_param($user->username, PARAM_USERNAME)) {
throw new moodle_exception('invalidusername');
}
}
}
// unset password here, for updating later
if (isset($user->password)) {
//check password toward the password policy
if (!check_password_policy($user->password, $errmsg)) {
throw new moodle_exception($errmsg);
}
$passwd = $user->password;
unset($user->password);
}
$user->timemodified = time();
$DB->update_record('user', $user);
// trigger user_updated event on the full database user row
$updateduser = $DB->get_record('user', array('id' => $user->id));
// if password was set, then update its hash
if (isset($passwd)) {
$authplugin = get_auth_plugin($updateduser->auth);
if ($authplugin->can_change_password()) {
$authplugin->user_update_password($updateduser, $passwd);
}
}
events_trigger('user_updated', $updateduser);
add_to_log(SITEID, 'user', get_string('update'), '/view.php?id=' . $updateduser->id, fullname($updateduser));
}
示例4: filter_remove_duplicates
/**
* @todo Document this function
* @param array $linkarray
* @return array
*/
function filter_remove_duplicates($linkarray)
{
$concepts = array();
// keep a record of concepts as we cycle through
$lconcepts = array();
// a lower case version for case insensitive
$cleanlinks = array();
foreach ($linkarray as $key => $filterobject) {
if ($filterobject->casesensitive) {
$exists = in_array($filterobject->phrase, $concepts);
} else {
$exists = in_array(textlib::strtolower($filterobject->phrase), $lconcepts);
}
if (!$exists) {
$cleanlinks[] = $filterobject;
$concepts[] = $filterobject->phrase;
$lconcepts[] = textlib::strtolower($filterobject->phrase);
}
}
return $cleanlinks;
}
示例5: test_strtolower
/**
* Tests the static strtolower method
* @return void
*/
public function test_strtolower()
{
$str = "Žluťoučký koníček";
$low = 'žluťoučký koníček';
$this->assertSame(textlib::strtolower($str), $low);
$iso2 = pack("H*", "ae6c75bb6f75e86bfd206b6f6eede8656b");
$this->assertSame(textlib::strtolower($iso2, 'iso-8859-2'), textlib::convert($low, 'utf-8', 'iso-8859-2'));
$win = pack("H*", "8e6c759d6f75e86bfd206b6f6eede8656b");
$this->assertSame(textlib::strtolower($win, 'cp1250'), textlib::convert($low, 'utf-8', 'cp1250'));
$str = '言語設定';
$this->assertSame(textlib::strtolower($str), $str);
$str = '简体中文';
$this->assertSame(textlib::strtolower($str), $str);
$str = pack("H*", "1b24423840386c405f446a1b2842");
//ISO-2022-JP
$this->assertSame(textlib::strtolower($str, 'ISO-2022-JP'), $str);
$str = pack("H*", "8cbe8cea90dd92e8");
//SHIFT-JIS
$this->assertSame(textlib::strtolower($str, 'SHIFT-JIS'), $str);
$str = pack("H*", "bcf2cce5d6d0cec4");
//GB2312
$this->assertSame(textlib::strtolower($str, 'GB2312'), $str);
$str = pack("H*", "bcf2cce5d6d0cec4");
//GB18030
$this->assertSame(textlib::strtolower($str, 'GB18030'), $str);
// typo3 has problems with integers
$str = 1309528800;
$this->assertSame((string) $str, textlib::strtolower($str));
}
示例6: print_course_search
print_course_search('', false, 'short');
}
break;
case FRONTPAGECATEGORYNAMES:
echo html_writer::tag('a', get_string('skipa', 'access', textlib::strtolower(get_string('categories'))), array('href'=>'#skipcategories', 'class'=>'skip-block'));
echo $OUTPUT->heading(get_string('categories'), 2, 'headingblock header');
echo $OUTPUT->box_start('generalbox categorybox');
print_whole_category_list(NULL, NULL, NULL, -1, false);
echo $OUTPUT->box_end();
print_course_search('', false, 'short');
echo html_writer::tag('span', '', array('class'=>'skip-block-to', 'id'=>'skipcategories'));
break;
case FRONTPAGECATEGORYCOMBO:
echo html_writer::tag('a', get_string('skipa', 'access', textlib::strtolower(get_string('courses'))), array('href'=>'#skipcourses', 'class'=>'skip-block'));
echo $OUTPUT->heading(get_string('courses'), 2, 'headingblock header');
$renderer = $PAGE->get_renderer('core','course');
// if there are too many courses, budiling course category tree could be slow,
// users should go to course index page to see the whole list.
$coursecount = $DB->count_records('course');
if (empty($CFG->numcoursesincombo)) {
// if $CFG->numcoursesincombo hasn't been set, use default value 500
$CFG->numcoursesincombo = 500;
}
if ($coursecount > $CFG->numcoursesincombo) {
$link = new moodle_url('/course/');
echo $OUTPUT->notification(get_string('maxnumcoursesincombo', 'moodle', array('link'=>$link->out(), 'maxnumofcourses'=>$CFG->numcoursesincombo, 'numberofcourses'=>$coursecount)));
} else {
echo $renderer->course_category_tree(get_course_category_tree());
}
示例7: count_non_empty_children
/**
* Returns the number of children which are either files matching the specified extensions
* or folders containing at least one such file.
*
* We usually don't need the exact number of non empty children if it is >=2 (see param $limit)
* This function is used by repository_local to evaluate if the folder is empty. But
* it also can be used to check if folder has only one subfolder because in some cases
* this subfolder can be skipped.
*
* It is strongly recommended to overwrite this function so it uses a proper SQL
* query and does not create file_info objects (later might require a lot of time
* and memory usage on big sites).
*
* @param string|array $extensions, for example '*' or array('.gif','.jpg')
* @param int $limit stop counting after at least $limit non-empty children are found
* @return int
*/
public function count_non_empty_children($extensions = '*', $limit = 1)
{
$list = $this->get_children();
$cnt = 0;
// first loop through files
foreach ($list as $fileinfo) {
if (!$fileinfo->is_directory()) {
if ($extensions !== '*') {
$filename = $fileinfo->get_visible_name();
$extension = textlib::strtolower(pathinfo($filename, PATHINFO_EXTENSION));
if (empty($extension) || !in_array('.' . $extension, $extensions)) {
continue;
}
}
if (++$cnt >= $limit) {
return $cnt;
}
}
}
// now loop through directories
foreach ($list as $fileinfo) {
if ($fileinfo->is_directory() && $fileinfo->count_non_empty_children($extensions)) {
if (++$cnt >= $limit) {
return $cnt;
}
}
}
return $cnt;
}
示例8: implode
$progress = $completion->get_progress_all(
implode(' AND ', $where),
$where_params,
$group,
$firstnamesort ? 'u.firstname ASC' : 'u.lastname ASC',
$csv ? 0 : COMPLETION_REPORT_PAGE,
$csv ? 0 : $start,
$context
);
}
if ($csv && $grandtotal && count($activities)>0) { // Only show CSV if there are some users/actvs
$shortname = format_string($course->shortname, true, array('context' => $context));
header('Content-Disposition: attachment; filename=progress.'.
preg_replace('/[^a-z0-9-]/','_',textlib::strtolower(strip_tags($shortname))).'.csv');
// Unicode byte-order mark for Excel
if ($excel) {
header('Content-Type: text/csv; charset=UTF-16LE');
print chr(0xFF).chr(0xFE);
$sep="\t".chr(0);
$line="\n".chr(0);
} else {
header('Content-Type: text/csv; charset=UTF-8');
$sep=",";
$line="\n";
}
} else {
// Use SVG to draw sideways text if supported
$svgcleverness = can_use_rotated_text();
示例9: array
}
$permissiongranted = 1;
if ( $newentry->concept and $newentry->definition ) {
if ( !$glossary->allowduplicatedentries ) {
// checking if the entry is valid (checking if it is duplicated when should not be)
if ( $newentry->casesensitive ) {
$dupentry = $DB->record_exists_select('glossary_entries',
'glossaryid = :glossaryid AND concept = :concept', array(
'glossaryid' => $glossary->id,
'concept' => $newentry->concept));
} else {
$dupentry = $DB->record_exists_select('glossary_entries',
'glossaryid = :glossaryid AND LOWER(concept) = :concept', array(
'glossaryid' => $glossary->id,
'concept' => textlib::strtolower($newentry->concept)));
}
if ($dupentry) {
$permissiongranted = 0;
}
}
} else {
$permissiongranted = 0;
}
if ($permissiongranted) {
$newentry->glossaryid = $glossary->id;
$newentry->sourceglossaryid = 0;
$newentry->approved = 1;
$newentry->userid = $USER->id;
$newentry->teacherentry = 1;
$newentry->definitionformat = $xmlentry['#']['FORMAT'][0]['#'];
示例10: is_related
/**
* Checks if $query is one of the available webservices
*
* @param string $query The string to search for
* @return bool Returns true if found, false if not
*/
public function is_related($query)
{
if (parent::is_related($query)) {
return true;
}
$protocols = get_plugin_list('webservice');
foreach ($protocols as $protocol => $location) {
if (strpos($protocol, $query) !== false) {
return true;
}
$protocolstr = get_string('pluginname', 'webservice_' . $protocol);
if (strpos(textlib::strtolower($protocolstr), $query) !== false) {
return true;
}
}
return false;
}
示例11: uu_process_template_callback
/**
* Internal callback function.
*/
function uu_process_template_callback($username, $firstname, $lastname, $block)
{
switch ($block[3]) {
case 'u':
$repl = $username;
break;
case 'f':
$repl = $firstname;
break;
case 'l':
$repl = $lastname;
break;
default:
return $block[0];
}
switch ($block[1]) {
case '+':
$repl = textlib::strtoupper($repl);
break;
case '-':
$repl = textlib::strtolower($repl);
break;
case '~':
$repl = textlib::strtotitle($repl);
break;
}
if (!empty($block[2])) {
$repl = textlib::substr($repl, 0, $block[2]);
}
return $repl;
}
示例12: process_config
//.........这里部分代码省略.........
$config->ldap_version = '3';
}
if (!isset($config->objectclass)) {
$config->objectclass = '';
}
if (!isset($config->memberattribute)) {
$config->memberattribute = '';
}
if (!isset($config->memberattribute_isdn)) {
$config->memberattribute_isdn = '';
}
if (!isset($config->creators)) {
$config->creators = '';
}
if (!isset($config->create_context)) {
$config->create_context = '';
}
if (!isset($config->expiration)) {
$config->expiration = '';
}
if (!isset($config->expiration_warning)) {
$config->expiration_warning = '10';
}
if (!isset($config->expireattr)) {
$config->expireattr = '';
}
if (!isset($config->gracelogins)) {
$config->gracelogins = '';
}
if (!isset($config->graceattr)) {
$config->graceattr = '';
}
if (!isset($config->auth_user_create)) {
$config->auth_user_create = '';
}
if (!isset($config->forcechangepassword)) {
$config->forcechangepassword = 0;
}
if (!isset($config->stdchangepassword)) {
$config->stdchangepassword = 0;
}
if (!isset($config->passtype)) {
$config->passtype = 'plaintext';
}
if (!isset($config->changepasswordurl)) {
$config->changepasswordurl = '';
}
if (!isset($config->removeuser)) {
$config->removeuser = AUTH_REMOVEUSER_KEEP;
}
if (!isset($config->ntlmsso_enabled)) {
$config->ntlmsso_enabled = 0;
}
if (!isset($config->ntlmsso_subnet)) {
$config->ntlmsso_subnet = '';
}
if (!isset($config->ntlmsso_ie_fastpath)) {
$config->ntlmsso_ie_fastpath = 0;
}
if (!isset($config->ntlmsso_type)) {
$config->ntlmsso_type = 'ntlm';
}
// Try to remove duplicates before storing the contexts (to avoid problems in sync_users()).
$config->contexts = explode(';', $config->contexts);
$config->contexts = array_map(create_function('$x', 'return textlib::strtolower(trim($x));'), $config->contexts);
$config->contexts = implode(';', array_unique($config->contexts));
// Save settings
set_config('host_url', trim($config->host_url), $this->pluginconfig);
set_config('ldapencoding', trim($config->ldapencoding), $this->pluginconfig);
set_config('contexts', $config->contexts, $this->pluginconfig);
set_config('user_type', textlib::strtolower(trim($config->user_type)), $this->pluginconfig);
set_config('user_attribute', textlib::strtolower(trim($config->user_attribute)), $this->pluginconfig);
set_config('search_sub', $config->search_sub, $this->pluginconfig);
set_config('opt_deref', $config->opt_deref, $this->pluginconfig);
set_config('preventpassindb', $config->preventpassindb, $this->pluginconfig);
set_config('bind_dn', trim($config->bind_dn), $this->pluginconfig);
set_config('bind_pw', $config->bind_pw, $this->pluginconfig);
set_config('ldap_version', $config->ldap_version, $this->pluginconfig);
set_config('objectclass', trim($config->objectclass), $this->pluginconfig);
set_config('memberattribute', textlib::strtolower(trim($config->memberattribute)), $this->pluginconfig);
set_config('memberattribute_isdn', $config->memberattribute_isdn, $this->pluginconfig);
set_config('creators', trim($config->creators), $this->pluginconfig);
set_config('create_context', trim($config->create_context), $this->pluginconfig);
set_config('expiration', $config->expiration, $this->pluginconfig);
set_config('expiration_warning', trim($config->expiration_warning), $this->pluginconfig);
set_config('expireattr', textlib::strtolower(trim($config->expireattr)), $this->pluginconfig);
set_config('gracelogins', $config->gracelogins, $this->pluginconfig);
set_config('graceattr', textlib::strtolower(trim($config->graceattr)), $this->pluginconfig);
set_config('auth_user_create', $config->auth_user_create, $this->pluginconfig);
set_config('forcechangepassword', $config->forcechangepassword, $this->pluginconfig);
set_config('stdchangepassword', $config->stdchangepassword, $this->pluginconfig);
set_config('passtype', $config->passtype, $this->pluginconfig);
set_config('changepasswordurl', trim($config->changepasswordurl), $this->pluginconfig);
set_config('removeuser', $config->removeuser, $this->pluginconfig);
set_config('ntlmsso_enabled', (int) $config->ntlmsso_enabled, $this->pluginconfig);
set_config('ntlmsso_subnet', trim($config->ntlmsso_subnet), $this->pluginconfig);
set_config('ntlmsso_ie_fastpath', (int) $config->ntlmsso_ie_fastpath, $this->pluginconfig);
set_config('ntlmsso_type', $config->ntlmsso_type, 'auth/ldap');
return true;
}
示例13: __authenticate
public function __authenticate($username, $password, $serviceshortname)
{
global $CFG, $DB;
//echo $OUTPUT->header();
if (!$CFG->enablewebservices) {
throw new moodle_exception('enablewsdescription', 'webservice');
}
$username = trim(textlib::strtolower($username));
if (is_restored_user($username)) {
throw new moodle_exception('restoredaccountresetpassword', 'webservice');
}
$user = authenticate_user_login($username, $password);
if (!empty($user)) {
//Non admin can not authenticate if maintenance mode
$hassiteconfig = has_capability('moodle/site:config', context_system::instance(), $user);
if (!empty($CFG->maintenance_enabled) and !$hassiteconfig) {
throw new moodle_exception('sitemaintenance', 'admin');
}
if (isguestuser($user)) {
throw new moodle_exception('noguest');
}
if (empty($user->confirmed)) {
throw new moodle_exception('usernotconfirmed', 'moodle', '', $user->username);
}
// check credential expiry
$userauth = get_auth_plugin($user->auth);
if (!empty($userauth->config->expiration) and $userauth->config->expiration == 1) {
$days2expire = $userauth->password_expire($user->username);
if (intval($days2expire) < 0) {
throw new moodle_exception('passwordisexpired', 'webservice');
}
}
// let enrol plugins deal with new enrolments if necessary
enrol_check_plugins($user);
// setup user session to check capability
session_set_user($user);
//check if the service exists and is enabled
$service = $DB->get_record('external_services', array('shortname' => $serviceshortname, 'enabled' => 1));
if (empty($service)) {
// will throw exception if no token found
throw new moodle_exception('servicenotavailable', 'webservice');
}
//check if there is any required system capability
if ($service->requiredcapability and !has_capability($service->requiredcapability, context_system::instance(), $user)) {
throw new moodle_exception('missingrequiredcapability', 'webservice', '', $service->requiredcapability);
}
//specific checks related to user restricted service
if ($service->restrictedusers) {
$authoriseduser = $DB->get_record('external_services_users', array('externalserviceid' => $service->id, 'userid' => $user->id));
if (empty($authoriseduser)) {
throw new moodle_exception('usernotallowed', 'webservice', '', $serviceshortname);
}
if (!empty($authoriseduser->validuntil) and $authoriseduser->validuntil < time()) {
throw new moodle_exception('invalidtimedtoken', 'webservice');
}
if (!empty($authoriseduser->iprestriction) and !address_in_subnet(getremoteaddr(), $authoriseduser->iprestriction)) {
throw new moodle_exception('invalidiptoken', 'webservice');
}
}
//Check if a token has already been created for this user and this service
//Note: this could be an admin created or an user created token.
// It does not really matter we take the first one that is valid.
$tokenssql = "SELECT t.id, t.sid, t.token, t.validuntil, t.iprestriction\n FROM {external_tokens} t\n WHERE t.userid = ? AND t.externalserviceid = ? AND t.tokentype = ?\n ORDER BY t.timecreated ASC";
$tokens = $DB->get_records_sql($tokenssql, array($user->id, $service->id, EXTERNAL_TOKEN_PERMANENT));
//A bit of sanity checks
foreach ($tokens as $key => $token) {
/// Checks related to a specific token. (script execution continue)
$unsettoken = false;
//if sid is set then there must be a valid associated session no matter the token type
if (!empty($token->sid)) {
$session = session_get_instance();
if (!$session->session_exists($token->sid)) {
//this token will never be valid anymore, delete it
$DB->delete_records('external_tokens', array('sid' => $token->sid));
$unsettoken = true;
}
}
//remove token if no valid anymore
//Also delete this wrong token (similar logic to the web service servers
// /webservice/lib.php/webservice_server::authenticate_by_token())
if (!empty($token->validuntil) and $token->validuntil < time()) {
$DB->delete_records('external_tokens', array('token' => $token->token, 'tokentype' => EXTERNAL_TOKEN_PERMANENT));
$unsettoken = true;
}
// remove token if its ip not in whitelist
if (isset($token->iprestriction) and !address_in_subnet(getremoteaddr(), $token->iprestriction)) {
$unsettoken = true;
}
if ($unsettoken) {
unset($tokens[$key]);
}
}
// if some valid tokens exist then use the most recent
if (count($tokens) > 0) {
$token = array_pop($tokens);
} else {
if ($serviceshortname == MOODLE_OFFICIAL_MOBILE_SERVICE and has_capability('moodle/webservice:createmobiletoken', get_system_context()) or !is_siteadmin($user) && has_capability('moodle/webservice:createtoken', get_system_context())) {
// if service doesn't exist, dml will throw exception
$service_record = $DB->get_record('external_services', array('shortname' => $serviceshortname, 'enabled' => 1), '*', MUST_EXIST);
// create a new token
//.........这里部分代码省略.........
示例14: test_deprecated_textlib
public function test_deprecated_textlib()
{
$this->assertSame(textlib::strtolower('HUH'), core_text::strtolower('HUH'));
$this->assertDebuggingCalled(null, null, 'This fails if any other test uses the deprecated textlib class.');
}
示例15: course_section_cm_name
/**
* Renders html to display a name with the link to the course module on a course page
*
* If module is unavailable for user but still needs to be displayed
* in the list, just the name is returned without a link
*
* Note, that for course modules that never have separate pages (i.e. labels)
* this function return an empty string
*
* @param cm_info $mod
* @param array $displayoptions
* @return string
*/
public function course_section_cm_name(cm_info $mod, $displayoptions = array())
{
global $CFG;
$output = '';
if (!$mod->uservisible && (empty($mod->showavailability) || empty($mod->availableinfo))) {
// nothing to be displayed to the user
return $output;
}
$url = $mod->get_url();
if (!$url) {
return $output;
}
//Accessibility: for files get description via icon, this is very ugly hack!
$instancename = $mod->get_formatted_name();
$altname = '';
$altname = $mod->modfullname;
// Avoid unnecessary duplication: if e.g. a forum name already
// includes the word forum (or Forum, etc) then it is unhelpful
// to include that in the accessible description that is added.
if (false !== strpos(textlib::strtolower($instancename), textlib::strtolower($altname))) {
$altname = '';
}
// File type after name, for alphabetic lists (screen reader).
if ($altname) {
$altname = get_accesshide(' ' . $altname);
}
// For items which are hidden but available to current user
// ($mod->uservisible), we show those as dimmed only if the user has
// viewhiddenactivities, so that teachers see 'items which might not
// be available to some students' dimmed but students do not see 'item
// which is actually available to current student' dimmed.
$conditionalhidden = $this->is_cm_conditionally_hidden($mod);
$accessiblebutdim = (!$mod->visible || $conditionalhidden) && (!$mod->uservisible || has_capability('moodle/course:viewhiddenactivities', context_course::instance($mod->course)));
$linkclasses = '';
$accesstext = '';
$textclasses = '';
if ($accessiblebutdim) {
$linkclasses .= ' dimmed';
$textclasses .= ' dimmed_text';
if ($conditionalhidden) {
$linkclasses .= ' conditionalhidden';
$textclasses .= ' conditionalhidden';
}
if ($mod->uservisible) {
// show accessibility note only if user can access the module himself
$accesstext = get_accesshide(get_string('hiddenfromstudents') . ': ');
}
}
// Get on-click attribute value if specified and decode the onclick - it
// has already been encoded for display (puke).
$onclick = htmlspecialchars_decode($mod->get_on_click(), ENT_QUOTES);
$groupinglabel = '';
if (!empty($mod->groupingid) && has_capability('moodle/course:managegroups', context_course::instance($mod->course))) {
$groupings = groups_get_all_groupings($mod->course);
$groupinglabel = html_writer::tag('span', '(' . format_string($groupings[$mod->groupingid]->name) . ')', array('class' => 'groupinglabel ' . $textclasses));
}
// Display link itself.
$activitylink = html_writer::empty_tag('img', array('src' => $mod->get_icon_url(), 'class' => 'iconlarge activityicon', 'alt' => $mod->modfullname)) . $accesstext . html_writer::tag('span', $instancename . $altname, array('class' => 'instancename'));
if ($mod->uservisible) {
$output .= html_writer::link($url, $activitylink, array('class' => $linkclasses, 'onclick' => $onclick)) . $groupinglabel;
} else {
// We may be displaying this just in order to show information
// about visibility, without the actual link ($mod->uservisible)
$output .= html_writer::tag('div', $activitylink, array('class' => $textclasses)) . $groupinglabel;
}
return $output;
}