Merge branch 'MDL-56803-master' of git://github.com/damyon/moodle

This commit is contained in:
David Monllao 2016-11-14 16:25:43 +08:00
commit 337b723b07
6 changed files with 26 additions and 46 deletions

View File

@ -58,12 +58,7 @@ $exporturl = moodle_url::make_pluginfile_url($context->id, 'mod_glossary', 'expo
?>
<form action="<?php echo $exporturl->out(); ?>" method="post">
<table border="0" cellpadding="6" cellspacing="6" width="100%">
<tr><td align="center">
<input type="submit" value="<?php p($strexportfile)?>" />
</td></tr></table>
<div>
</div>
<input class="btn btn-primary" type="submit" value="<?php p($strexportfile)?>" />
</form>
<?php
// don't need cap check here, we share with the general export.

View File

@ -1181,7 +1181,7 @@ function glossary_print_entry_aliases($course, $cm, $glossary, $entry,$mode='',
foreach ($aliases as $alias) {
if (trim($alias->alias)) {
if ($return == '') {
$return = '<select id="keyword" style="font-size:8pt">';
$return = '<select id="keyword" class="custom-select">';
}
$return .= "<option>$alias->alias</option>";
}
@ -1233,7 +1233,7 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode='',$h
if (has_capability('mod/glossary:approve', $context) && !$glossary->defaultapproval && $entry->approved) {
$output = true;
$return .= '<a class="action-icon" title="' . get_string('disapprove', 'glossary').
$return .= '<a class="icon" title="' . get_string('disapprove', 'glossary').
'" href="approve.php?newstate=0&amp;eid='.$entry->id.'&amp;mode='.$mode.
'&amp;hook='.urlencode($hook).'&amp;sesskey='.sesskey().
'"><img src="'.$OUTPUT->pix_url('t/block').'" class="smallicon" alt="'.
@ -1248,7 +1248,10 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode='',$h
$mainglossary = $DB->get_record('glossary', array('mainglossary'=>1,'course'=>$course->id));
if ( $mainglossary ) { // if there is a main glossary defined, allow to export the current entry
$output = true;
$return .= '<a class="action-icon" title="'.get_string('exporttomainglossary','glossary') . '" href="exportentry.php?id='.$entry->id.'&amp;prevmode='.$mode.'&amp;hook='.urlencode($hook).'"><img src="'.$OUTPUT->pix_url('export', 'glossary').'" class="smallicon" alt="'.get_string('exporttomainglossary','glossary').$altsuffix.'" /></a>';
$return .= '<a class="icon" title="'.get_string('exporttomainglossary','glossary') . '" ' .
'href="exportentry.php?id='.$entry->id.'&amp;prevmode='.$mode.'&amp;hook='.urlencode($hook).'">' .
'<img src="'.$OUTPUT->pix_url('export', 'glossary').'" class="smallicon" ' .
'alt="'.get_string('exporttomainglossary','glossary').$altsuffix.'" /></a>';
}
}
@ -1264,11 +1267,16 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode='',$h
$ineditperiod = ((time() - $entry->timecreated < $CFG->maxeditingtime) || $glossary->editalways);
if ( !$importedentry and (has_capability('mod/glossary:manageentries', $context) or ($entry->userid == $USER->id and ($ineditperiod and has_capability('mod/glossary:write', $context))))) {
$output = true;
$return .= "<a class='action-icon' title=\"" . get_string("delete") . "\" href=\"deleteentry.php?id=$cm->id&amp;mode=delete&amp;entry=$entry->id&amp;prevmode=$mode&amp;hook=".urlencode($hook)."\"><img src=\"";
$url = "deleteentry.php?id=$cm->id&amp;mode=delete&amp;entry=$entry->id&amp;prevmode=$mode&amp;hook=".urlencode($hook);
$return .= "<a class='icon' title=\"" . get_string("delete") . "\" " .
"href=\"$url\"><img src=\"";
$return .= $icon;
$return .= "\" class=\"smallicon\" alt=\"" . get_string("delete") .$altsuffix."\" /></a>";
$return .= "<a class='action-icon' title=\"" . get_string("edit") . "\" href=\"edit.php?cmid=$cm->id&amp;id=$entry->id&amp;mode=$mode&amp;hook=".urlencode($hook)."\"><img src=\"" . $OUTPUT->pix_url('t/edit') . "\" class=\"smallicon\" alt=\"" . get_string("edit") .$altsuffix. "\" /></a>";
$url = "edit.php?cmid=$cm->id&amp;id=$entry->id&amp;mode=$mode&amp;hook=".urlencode($hook);
$return .= "<a class='icon' title=\"" . get_string("edit") . "\" href=\"$url\">" .
"<img src=\"" . $OUTPUT->pix_url('t/edit') . "\" class=\"smallicon\" " .
"alt=\"" . get_string("edit") .$altsuffix. "\" /></a>";
} elseif ( $importedentry ) {
$return .= "<font size=\"-1\">" . get_string("exportedentry","glossary") . "</font>";
}
@ -1311,6 +1319,7 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode='',$h
$return .= '<div>'.$comment->output(true).'</div>';
$output = true;
}
$return .= '<hr>';
//If we haven't calculated any REAL thing, delete result ($return)
if (!$output) {

View File

@ -23,10 +23,6 @@
width: 35px;
}
.path-mod-glossary .glossarypost .entrylowersection .aliases {
text-align: center;
}
.path-mod-glossary .glossarypost .entrylowersection .icons {
text-align: right;
padding-right: 5px;

View File

@ -360,46 +360,41 @@ if ($glossary->intro && $showcommonelements) {
/// Search box
if ($showcommonelements ) {
echo '<form method="post" action="view.php">';
echo '<form method="post" class="form form-inline m-b-1" action="view.php">';
echo '<table class="boxaligncenter" width="70%" border="0">';
echo '<tr><td align="center" class="glossarysearchbox">';
echo '<input type="submit" value="'.$strsearch.'" name="searchbutton" /> ';
if ($mode == 'search') {
echo '<input type="text" name="hook" size="20" value="'.s($hook).'" alt="'.$strsearch.'" /> ';
echo '<input type="text" name="hook" size="20" value="'.s($hook).'" alt="'.$strsearch.'" class="form-control"/> ';
} else {
echo '<input type="text" name="hook" size="20" value="" alt="'.$strsearch.'" /> ';
echo '<input type="text" name="hook" size="20" value="" alt="'.$strsearch.'" class="form-control"/> ';
}
echo '<input type="submit" value="'.$strsearch.'" name="searchbutton" class="btn btn-secondary m-r-1"/> ';
if ($fullsearch || $mode != 'search') {
$fullsearchchecked = 'checked="checked"';
} else {
$fullsearchchecked = '';
}
echo '<input type="checkbox" name="fullsearch" id="fullsearch" value="1" '.$fullsearchchecked.' />';
echo '<span class="checkbox"><label for="fullsearch">';
echo ' <input type="checkbox" name="fullsearch" id="fullsearch" value="1" '.$fullsearchchecked.'/> ';
echo '<input type="hidden" name="mode" value="search" />';
echo '<input type="hidden" name="id" value="'.$cm->id.'" />';
echo '<label for="fullsearch">'.$strsearchindefinition.'</label>';
echo '</td></tr></table>';
echo $strsearchindefinition.'</label></span>';
echo '</form>';
echo '<br />';
}
/// Show the add entry button if allowed
if (has_capability('mod/glossary:write', $context) && $showcommonelements ) {
echo '<div class="singlebutton glossaryaddentry">';
echo "<form id=\"newentryform\" method=\"get\" action=\"$CFG->wwwroot/mod/glossary/edit.php\">";
echo "<form class=\"form form-inline m-b-1\" id=\"newentryform\" method=\"get\" action=\"$CFG->wwwroot/mod/glossary/edit.php\">";
echo '<div>';
echo "<input type=\"hidden\" name=\"cmid\" value=\"$cm->id\" />";
echo '<input type="submit" value="'.get_string('addentry', 'glossary').'" />';
echo '<input type="submit" value="'.get_string('addentry', 'glossary').'" class="btn btn-secondary" />';
echo '</div>';
echo '</form>';
echo "</div>\n";
}
echo '<br />';
require("tabs.php");

View File

@ -25,14 +25,11 @@
defined('MOODLE_INTERNAL') || die();
$bodyattributes = $OUTPUT->body_attributes([]);
$regionmainsettingsmenu = $OUTPUT->region_main_settings_menu();
$templatecontext = [
'sitename' => format_string($SITE->shortname, true, array('context' => context_course::instance(SITEID))),
'output' => $OUTPUT,
'bodyattributes' => $bodyattributes,
'regionmainsettingsmenu' => $regionmainsettingsmenu,
'hasregionmainsettingsmenu' => !empty($regionmainsettingsmenu)
'bodyattributes' => $bodyattributes
];
echo $OUTPUT->render_from_template('theme_boost/columns1', $templatecontext);

View File

@ -23,16 +23,12 @@
* sitename - The name of the site
* output - The core renderer for the page
* bodyattributes - attributes for the body tag as a string of html attributes
* regionmainsettingsmenu - HTML for the region main settings menu
* hasregionmainsettingsmenu - There is a region main settings menu on this page.
Example context (json):
{
"sitename": "Moodle",
"output": {"doctype": "<!DOCTYPE html>", "page_title": "Test page", "favicon": "favicon.ico"},
"bodyattributes":"",
"regionmainsettingsmenu": "",
"hasregionmainsettingsmenu": false
"bodyattributes":""
}
}}
{{{ output.doctype }}}
@ -53,16 +49,8 @@
<div id="page" class="container-fluid">
<div id="page-content" class="row">
<div id="region-main-box" class="col-xs-12">
{{#hasregionmainsettingsmenu}}
<div id="region-main-settings-menu" class="has-blocks">
<div> {{{ regionmainsettingsmenu }}} </div>
</div>
{{/hasregionmainsettingsmenu}}
<section id="region-main">
<div class="card card-block">
{{#hasregionmainsettingsmenu}}
<div class="region_main_settings_menu_proxy"></div>
{{/hasregionmainsettingsmenu}}
{{{ output.course_content_header }}}
{{{ output.main_content }}}
{{{ output.course_content_footer }}}