本文整理汇总了PHP中get_strings函数的典型用法代码示例。如果您正苦于以下问题:PHP get_strings函数的具体用法?PHP get_strings怎么用?PHP get_strings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_strings函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: course_get_cm_edit_actions_reduced
/**
* Returns the list of all editing actions that current user can perform on the module
*
* @param cm_info $mod The module to produce editing buttons for
* @param int $indent The current indenting (default -1 means no move left-right actions)
* @param int $sr The section to link back to (used for creating the links)
* @return array array of action_link or pix_icon objects
*/
function course_get_cm_edit_actions_reduced(cm_info $mod, $indent = -1, $sr = null)
{
global $COURSE, $SITE;
static $str;
$coursecontext = context_course::instance($mod->course);
$modcontext = context_module::instance($mod->id);
$editcaps = array('moodle/course:manageactivities', 'moodle/course:activityvisibility', 'moodle/role:assign');
$dupecaps = array('moodle/backup:backuptargetimport', 'moodle/restore:restoretargetimport');
//No permission to edit anything.
if (!has_any_capability($editcaps, $modcontext) and !has_all_capabilities($dupecaps, $coursecontext)) {
return array();
}
$hasmanageactivities = has_capability('moodle/course:manageactivities', $modcontext);
if (!isset($str)) {
$str = get_strings(array('delete', 'move', 'moveright', 'moveleft', 'editsettings', 'duplicate', 'hide', 'show'), 'moodle');
$str->assign = get_string('assignroles', 'role');
$str->groupsnone = get_string('clicktochangeinbrackets', 'moodle', get_string("groupsnone"));
$str->groupsseparate = get_string('clicktochangeinbrackets', 'moodle', get_string("groupsseparate"));
$str->groupsvisible = get_string('clicktochangeinbrackets', 'moodle', get_string("groupsvisible"));
}
$baseurl = new moodle_url('/course/mod.php', array('sesskey' => sesskey()));
if ($sr !== null) {
$baseurl->param('sr', $sr);
}
$actions = array();
// Duplicate (require both target import caps to be able to duplicate and backup2 support, see modduplicate.php)
// Note that restoring on front page is never allowed.
if ($mod->course != SITEID && has_all_capabilities($dupecaps, $coursecontext) && plugin_supports('mod', $mod->modname, FEATURE_BACKUP_MOODLE2)) {
$actions['duplicate'] = new action_menu_link_secondary(new moodle_url($baseurl, array('duplicate' => $mod->id)), new pix_icon('t/copy', $str->duplicate, 'moodle', array('class' => 'iconsmall', 'title' => '')), $str->duplicate, array('class' => 'editing_duplicate', 'data-action' => 'duplicate', 'data-sr' => $sr));
}
// Delete.
if ($hasmanageactivities) {
$actions['delete'] = new action_menu_link_secondary(new moodle_url($baseurl, array('delete' => $mod->id)), new pix_icon('t/delete', $str->delete, 'moodle', array('class' => 'iconsmall', 'title' => '')), $str->delete, array('class' => 'editing_delete', 'data-action' => 'delete'));
}
return $actions;
}
示例2: course_get_cm_edit_actions
/**
* Returns the list of all editing actions that current user can perform on the module
*
* @param cm_info $mod The module to produce editing buttons for
* @param int $indent The current indenting (default -1 means no move left-right actions)
* @param int $sr The section to link back to (used for creating the links)
* @return array array of action_link or pix_icon objects
*/
function course_get_cm_edit_actions(cm_info $mod, $indent = -1, $sr = null)
{
global $COURSE, $SITE;
static $str;
$coursecontext = context_course::instance($mod->course);
$modcontext = context_module::instance($mod->id);
$editcaps = array('moodle/course:manageactivities', 'moodle/course:activityvisibility', 'moodle/role:assign');
$dupecaps = array('moodle/backup:backuptargetimport', 'moodle/restore:restoretargetimport');
// no permission to edit anything
if (!has_any_capability($editcaps, $modcontext) and !has_all_capabilities($dupecaps, $coursecontext)) {
return array();
}
$hasmanageactivities = has_capability('moodle/course:manageactivities', $modcontext);
if (!isset($str)) {
$str = get_strings(array('delete', 'move', 'moveright', 'moveleft', 'update', 'duplicate', 'hide', 'show', 'edittitle'), 'moodle');
$str->assign = get_string('assignroles', 'role');
$str->groupsnone = get_string('clicktochangeinbrackets', 'moodle', get_string("groupsnone"));
$str->groupsseparate = get_string('clicktochangeinbrackets', 'moodle', get_string("groupsseparate"));
$str->groupsvisible = get_string('clicktochangeinbrackets', 'moodle', get_string("groupsvisible"));
$str->forcedgroupsnone = get_string('forcedmodeinbrackets', 'moodle', get_string("groupsnone"));
$str->forcedgroupsseparate = get_string('forcedmodeinbrackets', 'moodle', get_string("groupsseparate"));
$str->forcedgroupsvisible = get_string('forcedmodeinbrackets', 'moodle', get_string("groupsvisible"));
}
$baseurl = new moodle_url('/course/mod.php', array('sesskey' => sesskey()));
if ($sr !== null) {
$baseurl->param('sr', $sr);
}
$actions = array();
// AJAX edit title
if ($mod->has_view() && $hasmanageactivities && ($mod->course == $COURSE->id && course_ajax_enabled($COURSE) || $mod->course == SITEID && course_ajax_enabled($SITE))) {
// we will not display link if we are on some other-course page (where we should not see this module anyway)
$actions['title'] = new action_link(new moodle_url($baseurl, array('update' => $mod->id)), new pix_icon('t/editstring', $str->edittitle, 'moodle', array('class' => 'iconsmall visibleifjs', 'title' => '')), null, array('class' => 'editing_title', 'title' => $str->edittitle));
}
// leftright
if ($hasmanageactivities) {
if (right_to_left()) {
// Exchange arrows on RTL
$rightarrow = 't/left';
$leftarrow = 't/right';
} else {
$rightarrow = 't/right';
$leftarrow = 't/left';
}
if ($indent > 0) {
$actions['moveleft'] = new action_link(new moodle_url($baseurl, array('id' => $mod->id, 'indent' => '-1')), new pix_icon($leftarrow, $str->moveleft, 'moodle', array('class' => 'iconsmall', 'title' => '')), null, array('class' => 'editing_moveleft', 'title' => $str->moveleft));
}
if ($indent >= 0) {
$actions['moveright'] = new action_link(new moodle_url($baseurl, array('id' => $mod->id, 'indent' => '1')), new pix_icon($rightarrow, $str->moveright, 'moodle', array('class' => 'iconsmall', 'title' => '')), null, array('class' => 'editing_moveright', 'title' => $str->moveright));
}
}
// move
if ($hasmanageactivities) {
$actions['move'] = new action_link(new moodle_url($baseurl, array('copy' => $mod->id)), new pix_icon('t/move', $str->move, 'moodle', array('class' => 'iconsmall', 'title' => '')), null, array('class' => 'editing_move', 'title' => $str->move));
}
// Update
if ($hasmanageactivities) {
$actions['update'] = new action_link(new moodle_url($baseurl, array('update' => $mod->id)), new pix_icon('t/edit', $str->update, 'moodle', array('class' => 'iconsmall', 'title' => '')), null, array('class' => 'editing_update', 'title' => $str->update));
}
// Duplicate (require both target import caps to be able to duplicate and backup2 support, see modduplicate.php)
// note that restoring on front page is never allowed
if ($mod->course != SITEID && has_all_capabilities($dupecaps, $coursecontext) && plugin_supports('mod', $mod->modname, FEATURE_BACKUP_MOODLE2)) {
$actions['duplicate'] = new action_link(new moodle_url($baseurl, array('duplicate' => $mod->id)), new pix_icon('t/copy', $str->duplicate, 'moodle', array('class' => 'iconsmall', 'title' => '')), null, array('class' => 'editing_duplicate', 'title' => $str->duplicate));
}
// Delete
if ($hasmanageactivities) {
$actions['delete'] = new action_link(new moodle_url($baseurl, array('delete' => $mod->id)), new pix_icon('t/delete', $str->delete, 'moodle', array('class' => 'iconsmall', 'title' => '')), null, array('class' => 'editing_delete', 'title' => $str->delete));
}
// hideshow
if (has_capability('moodle/course:activityvisibility', $modcontext)) {
if ($mod->visible) {
$actions['hide'] = new action_link(new moodle_url($baseurl, array('hide' => $mod->id)), new pix_icon('t/hide', $str->hide, 'moodle', array('class' => 'iconsmall', 'title' => '')), null, array('class' => 'editing_hide', 'title' => $str->hide));
} else {
$actions['show'] = new action_link(new moodle_url($baseurl, array('show' => $mod->id)), new pix_icon('t/show', $str->show, 'moodle', array('class' => 'iconsmall', 'title' => '')), null, array('class' => 'editing_show', 'title' => $str->show));
}
}
// groupmode
if ($hasmanageactivities and plugin_supports('mod', $mod->modname, FEATURE_GROUPS, 0)) {
if ($mod->coursegroupmodeforce) {
$modgroupmode = $mod->coursegroupmode;
} else {
$modgroupmode = $mod->groupmode;
}
if ($modgroupmode == SEPARATEGROUPS) {
$groupmode = NOGROUPS;
$grouptitle = $str->groupsseparate;
$forcedgrouptitle = $str->forcedgroupsseparate;
$actionname = 'groupsseparate';
$groupimage = 't/groups';
} else {
if ($modgroupmode == VISIBLEGROUPS) {
$groupmode = SEPARATEGROUPS;
$grouptitle = $str->groupsvisible;
//.........这里部分代码省略.........
示例3: upload_strings
function upload_strings($api_key, $secret, $input)
{
$strings = get_strings($input);
print_strings($strings);
$cnt = count($strings);
if ($cnt < 1) {
echo "No strings found. Exiting.\n";
exit;
}
echo "\nThe {$cnt} string(s) above will be uploaded.\n";
echo "To exit now, use Ctrl-C.\n";
$facebook = new FacebookDesktop($api_key, $secret);
$auth_token = $facebook->api_client->auth_createToken();
$login_url = build_url($api_key, $auth_token);
`open "{$login_url}"`;
do {
echo "Otherwise, type 'y' to continue after logging into Facebook.\n";
} while (!(strtolower(fgets(STDIN)) === "y\n"));
if (null == $facebook->do_get_session($auth_token)) {
echo "Could not obtain Facebook session. Exiting.\n";
exit;
}
$unescaped_strings = unescape_c_strings($strings);
$num_strings = $facebook->api_client->intl_uploadNativeStrings($unescaped_strings);
if (!$num_strings) {
echo "Oops. Sorry, failed to upload.\n";
} else {
echo "{$num_strings} string(s) uploaded successfully.\n";
}
}
示例4: asort
asort($frm->enable);
$frm->enable = array_merge(array('manual'), $frm->enable);
// make sure manual plugin is called first
set_config('enrol_plugins_enabled', implode(',', $frm->enable));
set_config('enrol', $frm->default);
redirect("enrol.php", get_string("changessaved"), 1);
} else {
if ($frm = data_submitted() and $savesettings) {
if (!confirm_sesskey()) {
print_error('confirmsesskeybad', 'error');
}
set_config('sendcoursewelcomemessage', required_param('sendcoursewelcomemessage', PARAM_BOOL));
}
}
/// Print the form
$str = get_strings(array('enrolmentplugins', 'users', 'administration', 'settings', 'edit'));
admin_externalpage_print_header();
$modules = get_list_of_plugins("enrol");
$options = array();
foreach ($modules as $module) {
$options[$module] = get_string("enrolname", "enrol_{$module}");
}
asort($options);
print_simple_box(get_string('configenrolmentplugins', 'admin'), 'center', '700');
echo "<form {$CFG->frametarget} id=\"enrolmenu\" method=\"post\" action=\"enrol.php\">";
echo "<div>";
echo "<input type=\"hidden\" name=\"sesskey\" value=\"" . sesskey() . "\" />";
$table = new stdClass();
$table->head = array(get_string('name'), get_string('enable'), get_string('default'), $str->settings);
$table->align = array('left', 'center', 'center', 'center');
$table->size = array('60%', '', '', '15%');
示例5: unset
unset($exclude);
$searchtext = trim($searchtext);
if ($searchtext !== '') {
// Search for a subset of remaining users
$LIKE = sql_ilike();
$FULLNAME = sql_fullname();
$select .= " AND ({$FULLNAME} {$LIKE} '%{$searchtext}%' OR email {$LIKE} '%{$searchtext}%') ";
}
$sql = 'SELECT id, firstname, lastname, email
FROM ' . $CFG->prefix . 'user u
WHERE deleted = 0 AND confirmed = 1
AND mnethostid = ' . $CFG->mnet_localhost_id . ' ' . $select . 'ORDER BY lastname ASC, firstname ASC';
$availableusers = get_recordset_sql($sql, 0, MAX_USERS_PER_PAGE);
/// Print the page
/// get language strings
$str = get_strings(array('enrolmentplugins', 'configuration', 'users', 'administration'));
/// Get some language strings
$strpotentialusers = get_string('potentialusers', 'role');
$strexistingusers = get_string('existingusers', 'role');
$straction = get_string('assignroles', 'role');
$strroletoassign = get_string('roletoassign', 'role');
$strcurrentcontext = get_string('currentcontext', 'role');
$strsearch = get_string('search');
$strshowall = get_string('showall');
$strparticipants = get_string('participants');
$strsearchresults = get_string('searchresults');
admin_externalpage_print_header();
print_box('<strong>' . s($mnet_peer->name) . ' : ' . format_string($course->shortname) . ' ' . format_string($course->fullname) . '</strong><br />' . get_string("enrolcourseenrol_desc", "mnet"));
echo "<hr />";
include dirname(__FILE__) . '/enr_course_enrol.html';
if (!empty($errors)) {
示例6: course_get_cm_rename_action
/**
* Returns the rename action.
*
* @deprecated since 3.1
* @param cm_info $mod The module to produce editing buttons for
* @param int $sr The section to link back to (used for creating the links)
* @return The markup for the rename action, or an empty string if not available.
*/
function course_get_cm_rename_action(cm_info $mod, $sr = null)
{
global $COURSE, $OUTPUT;
static $str;
static $baseurl;
debugging('Function course_get_cm_rename_action() is deprecated. Please use inplace_editable ' . 'https://docs.moodle.org/dev/Inplace_editable', DEBUG_DEVELOPER);
$modcontext = context_module::instance($mod->id);
$hasmanageactivities = has_capability('moodle/course:manageactivities', $modcontext);
if (!isset($str)) {
$str = get_strings(array('edittitle'));
}
if (!isset($baseurl)) {
$baseurl = new moodle_url('/course/mod.php', array('sesskey' => sesskey()));
}
if ($sr !== null) {
$baseurl->param('sr', $sr);
}
// AJAX edit title.
if ($mod->has_view() && $hasmanageactivities && course_ajax_enabled($COURSE) && ($mod->course == $COURSE->id || $mod->course == SITEID)) {
// we will not display link if we are on some other-course page (where we should not see this module anyway)
return html_writer::span(html_writer::link(new moodle_url($baseurl, array('update' => $mod->id)), $OUTPUT->pix_icon('t/editstring', '', 'moodle', array('class' => 'iconsmall visibleifjs', 'title' => '')), array('class' => 'editing_title', 'data-action' => 'edittitle', 'title' => $str->edittitle)));
}
return '';
}
示例7: optional_param
// $Id: index.php,v 2.9 2008/06/20 10:48:32 ethem Exp $
/// Load libraries
require_once '../../config.php';
require_once 'const.php';
require_once 'locallib.php';
require_once 'localfuncs.php';
require_once 'authorizenet.class.php';
/// Parameters
$orderid = optional_param('order', 0, PARAM_INT);
$courseid = optional_param('course', SITEID, PARAM_INT);
$userid = optional_param('user', 0, PARAM_INT);
/// Get course
if (!($course = $DB->get_record('course', array('id' => $courseid)))) {
print_error('invalidcourseid', '', '', $courseid);
}
/// Only SITE users can access to this page
require_login();
// Don't use $courseid! User may want to see old orders.
if (has_capability('moodle/legacy:guest', get_context_instance(CONTEXT_SYSTEM), $USER->id, false)) {
print_error('noguest');
}
/// Load strings. All strings should be defined here. locallib.php uses these strings.
$strs = get_strings(array('search', 'status', 'action', 'time', 'course', 'confirm', 'yes', 'no', 'cancel', 'all', 'none', 'error'));
$authstrs = get_strings(array('orderid', 'nameoncard', 'echeckfirslasttname', 'void', 'capture', 'refund', 'delete', 'allpendingorders', 'authcaptured', 'authorizedpendingcapture', 'capturedpendingsettle', 'settled', 'refunded', 'cancelled', 'expired', 'underreview', 'approvedreview', 'reviewfailed', 'tested', 'new', 'paymentmethod', 'methodcc', 'methodecheck', 'paymentmanagement', 'orderdetails', 'cclastfour', 'isbusinesschecking', 'shopper', 'transid', 'settlementdate', 'notsettled', 'amount', 'unenrolstudent'), 'enrol_authorize');
/// User wants to see all orders
if (empty($orderid)) {
authorize_print_orders($courseid, $userid);
} else {
authorize_print_order($orderid);
}
示例8: dirname
*
* Displays the list of found plagiarism plugins, their version (if found) and
* a link to uninstall the plagiarism plugin.
*
* @see http://docs.moodle.org/dev/Plagiarism_API
* @package admin
* @copyright 2012 Dan Marsden <dan@danmarsden.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once dirname(dirname(__FILE__)) . '/config.php';
require_once $CFG->libdir . '/adminlib.php';
require_once $CFG->libdir . '/tablelib.php';
admin_externalpage_setup('manageplagiarismplugins');
echo $OUTPUT->header();
// Print the table of all installed plagiarism plugins.
$txt = get_strings(array('settings', 'name', 'version'));
$txt->uninstall = get_string('uninstallplugin', 'core_admin');
$plagiarismplugins = core_component::get_plugin_list('plagiarism');
if (empty($plagiarismplugins)) {
echo $OUTPUT->notification(get_string('nopluginsinstalled', 'plagiarism'));
echo $OUTPUT->footer();
exit;
}
echo $OUTPUT->heading(get_string('availableplugins', 'plagiarism'), 3, 'main');
echo $OUTPUT->box_start('generalbox authsui');
$table = new html_table();
$table->head = array($txt->name, $txt->version, $txt->uninstall, $txt->settings);
$table->colclasses = array('mdl-left', 'mdl-align', 'mdl-align', 'mdl-align');
$table->data = array();
$table->attributes['class'] = 'manageplagiarismtable generaltable';
// Iterate through auth plugins and add to the display table.
示例9: theme_snap_myprofile_navigation
function theme_snap_myprofile_navigation(core_user\output\myprofile\tree $tree, $user, $iscurrentuser, $course)
{
global $PAGE;
if ($PAGE->theme->name === 'snap') {
if ($iscurrentuser) {
$str = get_strings(['preferences']);
if (isset($tree->nodes['editprofile'])) {
$after = 'editprofile';
} else {
$after = null;
}
$url = new moodle_url('/user/preferences.php');
$prefnode = new core_user\output\myprofile\node('contact', 'userpreferences', $str->preferences, $after, $url);
$tree->add_node($prefnode);
}
}
}
示例10: format_string
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<title><?php
echo format_string($title);
?>
</title>
<link rel="shortcut icon" href="pix/icon.ico"/>
<script>
var Elang = Elang || {};
Elang.strings =
<?php
include dirname(__FILE__) . '/lang/en/elang.php';
echo json_encode(get_strings(array_keys($string), 'elang'));
?>
;
</script>
<?php
if (file_exists(dirname(__FILE__) . '/build')) {
?>
<link href="build/enyo.css" rel="stylesheet" />
<link href="build/app.css" rel="stylesheet" />
<script src="build/enyo.js"></script>
<script src="build/app.js"></script>
<?php
} else {
?>
<script src="enyo/enyo.js" type="text/javascript"></script>
<script src="source/package.js" type="text/javascript"></script>
示例11: course_section_cm
//.........这里部分代码省略.........
}
$assetrestrictions .= "<div class='text'>{$groupinfo}</div>";
}
// TODO - ask what this is...
if (!empty($mod->groupingid) && $canmanagegroups) {
// Grouping label.
$groupings = groups_get_all_groupings($mod->course);
$assetrestrictions .= "<div class='text text-danger'>" . format_string($groupings[$mod->groupingid]->name) . "</div>";
// TBD - add a title to show this is the Grouping...
}
$canviewhidden = has_capability('moodle/course:viewhiddenactivities', $mod->context);
// If the module isn't available, or we are a teacher (can view hidden activities) then get availability
// info.
$availabilityinfo = '';
if (!$mod->available || $canviewhidden) {
$availabilityinfo = $this->course_section_cm_availability($mod, $displayoptions);
}
if ($availabilityinfo !== '') {
$conditionalinfo = get_string('conditional', 'theme_snap');
$assetrestrictions .= "<div class='text text-danger'>{$conditionalinfo}.{$availabilityinfo}</div>";
}
$assetrestrictions = "<div class='snap-restrictions-meta'>{$assetrestrictions}</div>";
$assetmeta .= $assetcompletionmeta . $assetrestrictions;
// Build output.
$postcontent = '<div class="snap-asset-meta" data-cmid="' . $mod->id . '">' . $mod->afterlink . $assetmeta . '</div>';
$output .= $assetlink . $contentpart . $postcontent;
// Bail at this point if we aren't using a supported format. (Folder view is only partially supported).
$supported = ['folderview', 'topics', 'weeks', 'site'];
if (!in_array($COURSE->format, $supported)) {
return parent::course_section_cm($course, $completioninfo, $mod, $sectionreturn, $displayoptions) . $assetmeta;
}
// Build up edit actions.
$actions = '';
$actionsadvanced = array();
$coursecontext = context_course::instance($mod->course);
$modcontext = context_module::instance($mod->id);
$baseurl = new moodle_url('/course/mod.php', array('sesskey' => sesskey()));
if (has_capability('moodle/course:update', $modcontext)) {
$str = get_strings(array('delete', 'move', 'duplicate', 'hide', 'show', 'roles'), 'moodle');
// TODO - add snap strings here.
// Move, Edit, Delete.
if (has_capability('moodle/course:manageactivities', $modcontext)) {
$movealt = get_string('move', 'theme_snap', $mod->get_formatted_name());
$moveicon = "<img title='{$movealt}' aria-hidden='true' class='svg-icon' src='" . $this->output->pix_url('move', 'theme') . "' />";
$editalt = get_string('edit', 'theme_snap', $mod->get_formatted_name());
$editicon = "<img title='{$editalt}' alt='{$editalt}' class='svg-icon' src='" . $this->output->pix_url('edit', 'theme') . "'/>";
$actions .= "<input id='snap-move-mod-{$mod->id}' class='js-snap-asset-move sr-only' type='checkbox'><label class='snap-asset-move' for='snap-move-mod-{$mod->id}'><span class='sr-only'>{$movealt}</span>{$moveicon}</label>";
$actions .= "<a class='snap-edit-asset' href='" . new moodle_url($baseurl, array('update' => $mod->id)) . "'>{$editicon}</a>";
$actionsadvanced[] = "<a href='" . new moodle_url($baseurl, array('delete' => $mod->id)) . "'>{$str->delete}</a>";
}
// Hide/Show.
if (has_capability('moodle/course:activityvisibility', $modcontext)) {
$actionsadvanced[] = "<a href='" . new moodle_url($baseurl, array('hide' => $mod->id)) . "' class='editing_hide js_snap_hide'>{$str->hide}</a>";
$actionsadvanced[] = "<a href='" . new moodle_url($baseurl, array('show' => $mod->id)) . "' class='editing_show js_snap_show'>{$str->show}</a>";
// AX click to change.
}
// Duplicate.
$dupecaps = array('moodle/backup:backuptargetimport', 'moodle/restore:restoretargetimport');
if (has_all_capabilities($dupecaps, $coursecontext) && plugin_supports('mod', $mod->modname, FEATURE_BACKUP_MOODLE2) && plugin_supports('mod', $mod->modname, 'duplicate', true)) {
$actionsadvanced[] = "<a href='" . new moodle_url($baseurl, array('duplicate' => $mod->id)) . "' class='js_snap_duplicate'>{$str->duplicate}</a>";
}
// Asign roles.
if (has_capability('moodle/role:assign', $modcontext)) {
$actionsadvanced[] = "<a href='" . new moodle_url('/admin/roles/assign.php', array('contextid' => $modcontext->id)) . "'>{$str->roles}</a>";
}
// Give local plugins a chance to add icons.
$localplugins = array();
foreach (get_plugin_list_with_function('local', 'extend_module_editing_buttons') as $function) {
$localplugins = array_merge($localplugins, $function($mod));
}
// TODO - pld string is far too long....
$locallinks = '';
foreach ($localplugins as $localplugin) {
$url = $localplugin->url;
$text = $localplugin->text;
$class = $localplugin->attributes['class'];
$actionsadvanced[] = "<a href='{$url}' class='{$class}'>{$text}</a>";
}
}
$advancedactions = '';
if (!empty($actionsadvanced)) {
$moreicon = "<img title='" . get_string('more', 'theme_snap') . "' alt='" . get_string('more', 'theme_snap') . "' class='svg-icon' src='" . $this->output->pix_url('more', 'theme') . "'/>";
$advancedactions = "<div class='dropdown snap-edit-more-dropdown'>\n <a href='#' class='dropdown-toggle snap-edit-asset-more' data-toggle='dropdown' aria-expanded='false' aria-haspopup='true'>{$moreicon}</a>\n <ul class='dropdown-menu'>";
foreach ($actionsadvanced as $action) {
$advancedactions .= "<li>{$action}</li>";
}
$advancedactions .= "</ul></div>";
}
// Add actions menu.
if ($actions) {
$output .= "<div class='snap-asset-actions' role='region' aria-label='actions'>";
$output .= $actions . $advancedactions;
$output .= "</div>";
}
$output .= "</div>";
// Close .activityinstance.
$output .= "</div>";
// Close .asset-wrapper.
return $output;
}
示例12: get_all_my_notes
public function get_all_my_notes()
{
echo \html_writer::tag('p', get_string('mynotes', 'local_note'), ['class' => 'lead']);
$record = $this->db->get_records("cli_note", array('publisherid' => $this->userid), 'id desc');
if ($record != null) {
$table = new \html_table();
$table->head = (array) get_strings(['serial', 'date', 'course', 'title', 'content', 'attachment', 'label', 'status', 'action'], 'local_note');
$count = 1;
foreach ($record as $row) {
$status = $row->status == true ? '<span class="label label-success">' . get_string('active', 'local_note') . '</span>' : '<span class="label label-warning">' . get_string('inactive', 'local_note') . '</span>';
$action = '<i class="fa fa-lock" title="Access denied"></i>';
if ($this->userid == $row->publisherid) {
$action = \html_writer::link(new \moodle_url($this->cfg->wwwroot . '/local/note/edit_note.php?id=' . $row->id), '<i class="fa fa-edit"></i> ', ['title' => 'Edit note']);
$action .= \html_writer::link(new \moodle_url($this->cfg->wwwroot . '/local/note/delete_note.php?id=' . $row->id), ' <i class="fa fa-trash"></i>', ['title' => 'Delete note']);
}
$course = $this->db->get_record('course', array('id' => $row->courseid), 'fullname');
$table->data[] = array($count++, date('j M Y', $row->createdtime), \html_writer::link(new \moodle_url($this->cfg->wwwroot . '/course/view.php', ['id' => $row->courseid]), $course->fullname), '<a href="view_note.php?id=' . $row->id . '">' . $row->title . '</a>', strip_tags(substr($row->content, 0, 20)) . ' <a href="view_note.php?id=' . $row->id . '">' . get_string('more', 'local_note') . '</a>', \html_writer::link(new \moodle_url($this->get_attachment($row->attachment)['url']), $this->get_attachment($row->attachment)['filename'], ['download' => 'download']), $row->label, $status, $action);
}
echo \html_writer::start_div('div');
echo \html_writer::table($table);
echo \html_writer::end_div('div');
} else {
echo \html_writer::div(get_string("nonotesavailable", "local_note"), 'alert alert-warning');
}
}
示例13: error
if ($key === false) {
error(get_string('pluginnotenabled', 'auth', $auth), $url);
}
// move up the list
if ($key >= 1) {
$fsave = $authsenabled[$key];
$authsenabled[$key] = $authsenabled[$key - 1];
$authsenabled[$key - 1] = $fsave;
set_config('auth', implode(',', $authsenabled));
}
break;
default:
break;
}
// display strings
$txt = get_strings(array('authenticationplugins', 'users', 'administration', 'settings', 'edit', 'name', 'enable', 'disable', 'up', 'down', 'none'));
$txt->updown = "{$txt->up}/{$txt->down}";
// construct the display array, with enabled auth plugins at the top, in order
$displayauths = array();
$registrationauths = array();
$registrationauths[''] = $txt->disable;
foreach ($authsenabled as $auth) {
$authplugin = get_auth_plugin($auth);
/// Get the auth title (from core or own auth lang files)
$authtitle = get_string("auth_{$auth}title", "auth");
if ($authtitle == "[[auth_{$auth}title]]") {
$authtitle = get_string("auth_{$auth}title", "auth_{$auth}");
}
/// Apply titles
$displayauths[$auth] = $authtitle;
if ($authplugin->can_signup()) {
示例14: module_get_rename_action
/**
* Returns the rename action.
*
* @param cm_info $mod The module to produce editing buttons for
* @param int $sr The section to link back to (used for creating the links)
* @return The markup for the rename action, or an empty string if not available.
*/
function module_get_rename_action($cm, $instance, $sr = null) {
global $COURSE, $OUTPUT;
static $str;
static $baseurl;
$modcontext = context_module::instance($cm->id);
$hasmanageactivities = has_capability('mod/virtualclass:recordingupload', $modcontext);
if (!isset($str)) {
$str = get_strings(array('edittitle'));
}
if (!isset($baseurl)) {
$baseurl = new moodle_url('edit.php', array('id' => $cm->id, 'sesskey' => sesskey()));
}
if ($sr !== null) {
$baseurl->param('sr', $sr);
}
// AJAX edit title.
/*
if ($mod->has_view() && $hasmanageactivities && course_ajax_enabled($COURSE) &&
(($mod->course == $COURSE->id) || ($mod->course == SITEID))) {
*/
if($hasmanageactivities){
// we will not display link if we are on some other-course page (where we should not see this module anyway)
return html_writer::span(
html_writer::link(
new moodle_url($baseurl, array('update' => $instance->id)),
$OUTPUT->pix_icon('t/editstring', '', 'moodle', array('class' => 'iconsmall visibleifjs', 'title' => '')),
array(
'class' => 'editing_title',
'data-action' => 'edittitle',
'title' => $str->edittitle,
)
)
);
}
return '';
}
示例15: treasurehunt_get_strings_edit
/**
* Get all the strings used in the JavaScript of the edit screen
*
* @return array The strings
*/
function treasurehunt_get_strings_edit()
{
return get_strings(array('stage', 'road', 'add', 'modify', 'save', 'remove', 'searchlocation', 'savewarning', 'removewarning', 'areyousure', 'removeroadwarning', 'confirm', 'cancel'), 'mod_treasurehunt');
}