* @return string If $return is true then the entire form is returned as a string.
* @todo Finish documenting this function<br>
*/
-function popup_form($common, $options, $formid, $selected='', $nothing='choose', $help='', $helptext='', $return=false, $targetwindow='self', $selectlabel='') {
+function popup_form($common, $options, $formid, $selected='', $nothing='choose', $help='', $helptext='', $return=false,
+$targetwindow='self', $selectlabel='', $optionsextra=NULL) {
global $CFG;
static $go, $choose; /// Locally cached, in case there's lots on a page
$optstr .= ' selected="selected"';
}
+ if (!empty($optionsextra[$value])) {
+ $optstr .= ' '.$optionsextra[$value];
+ }
+
if ($label) {
$optstr .= '>'. $label .'</option>' . "\n";
} else {
function print_group_menu($groups, $groupmode, $currentgroup, $urlroot, $showall=1, $return=false) {
$output = '';
+ $groupsmenu = array();
/// Add an "All groups" to the start of the menu
if ($showall){
$groupsmenu[0] = get_string('allparticipants');
}
- foreach ($groups as $key => $groupname) {
- $groupsmenu[$key] = $groupname;
+ foreach ($groups as $key => $group) {
+ $groupsmenu[$key] = format_string($group->name);
}
if ($groupmode == VISIBLEGROUPS) {
- $grouplabel = get_string('groupsvisible').':';
+ $grouplabel = get_string('groupsvisible');
} else {
- $grouplabel = get_string('groupsseparate').':';
+ $grouplabel = get_string('groupsseparate');
+ }
+
+ if (count($groupsmenu) == 1) {
+ $groupname = reset($groupsmenu);
+ $output .= $grouplabel.': '.$groupname;
+ } else {
+ $output .= popup_form($urlroot.'&group=', $groupsmenu, 'selectgroup', $currentgroup, '', '', '', true, 'self', $grouplabel);
}
- $output .= popup_form($urlroot.'&group=', $groupsmenu, 'selectgroup', $currentgroup, '', '', '', true, 'self', $grouplabel);
if ($return) {
return $output;
$logslink = NULL;
$flag = false;
$menu = array();
+ $menustyle = array();
$sections = get_records('course_sections','course',$course->id,'section','section,visible,summary');
}
}
$menu[$url] = $mod->name;
+ if (empty($THEME->navmenuiconshide)) {
+ $menustyle[$url] = 'style="background-image: url('.$CFG->modpixpath.'/'.$mod->mod.'/icon.gif);"'; // Unfortunately necessary to do this here
+ }
$previousmod = $mod;
}
}
return '<div class="navigation">'."\n".'<ul>'.$logslink . $backmod .
'<li>'.popup_form($CFG->wwwroot .'/mod/', $menu, 'navmenupopup', $selected, $strjumpto,
- '', '', true, $targetwindow).'</li>'.
+ '', '', true, $targetwindow, '', $menustyle).'</li>'.
$nextmod . '</ul>'."\n".'</div>';
}
$delay += 3; // double redirect prevention, it was sometimes breaking upgrades before 1.7
}
echo '<div style="text-align:center">';
- echo '<p>'. $message .'</p>';
- echo '<p>( <a href="'. $encodedurl .'">'. get_string('continue') .'</a> )</p>';
+ echo '<div>'. $message .'</div>';
+ echo '<div>( <a href="'. $encodedurl .'">'. get_string('continue') .'</a> )</div>';
echo '</div>';
if (!$errorprinted) {