本文整理汇总了PHP中html_select::make_popup_form方法的典型用法代码示例。如果您正苦于以下问题:PHP html_select::make_popup_form方法的具体用法?PHP html_select::make_popup_form怎么用?PHP html_select::make_popup_form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类html_select
的用法示例。
在下文中一共展示了html_select::make_popup_form方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: report_stats_mode_menu
function report_stats_mode_menu($course, $mode, $time, $url)
{
global $CFG, $OUTPUT;
/*
$reportoptions = stats_get_report_options($course->id, $mode);
$timeoptions = report_stats_timeoptions($mode);
if (empty($timeoptions)) {
print_error('nostatstodisplay', '', $CFG->wwwroot.'/course/view.php?id='.$course->id);
}
*/
$options = array();
$options[STATS_MODE_GENERAL] = get_string('statsmodegeneral');
$options[STATS_MODE_DETAILED] = get_string('statsmodedetailed');
if (has_capability('coursereport/stats:view', get_context_instance(CONTEXT_SYSTEM))) {
$options[STATS_MODE_RANKED] = get_string('reports');
}
$popupurl = $url . "?course={$course->id}&time={$time}";
$select = html_select::make_popup_form($popupurl, 'mode', $options, 'switchmode', $mode);
$select->nothinglabel = false;
return $OUTPUT->select($select);
}
示例2: glossary_print_categories_menu
/**
* @global object
* @global object
* @param object $cm
* @param object $glossary
* @param string $hook
* @param object $category
*/
function glossary_print_categories_menu($cm, $glossary, $hook, $category)
{
global $CFG, $DB, $OUTPUT;
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
echo '<table border="0" width="100%">';
echo '<tr>';
echo '<td align="center" style="width:20%">';
if (has_capability('mod/glossary:managecategories', $context)) {
$options['id'] = $cm->id;
$options['mode'] = 'cat';
$options['hook'] = $hook;
echo $OUTPUT->button(html_form::make_button("editcategories.php", $options, get_string("editcategories", "glossary"), "get"));
}
echo '</td>';
echo '<td align="center" style="width:60%">';
echo '<b>';
$menu[GLOSSARY_SHOW_ALL_CATEGORIES] = get_string("allcategories", "glossary");
$menu[GLOSSARY_SHOW_NOT_CATEGORISED] = get_string("notcategorised", "glossary");
$categories = $DB->get_records("glossary_categories", array("glossaryid" => $glossary->id), "name ASC");
$selected = '';
if ($categories) {
foreach ($categories as $currentcategory) {
$url = $currentcategory->id;
if ($category) {
if ($currentcategory->id == $category->id) {
$selected = $url;
}
}
$menu[$url] = clean_text($currentcategory->name);
//Only clean, not filters
}
}
if (!$selected) {
$selected = GLOSSARY_SHOW_NOT_CATEGORISED;
}
if ($category) {
echo format_text($category->name, FORMAT_PLAIN);
} else {
if ($hook == GLOSSARY_SHOW_NOT_CATEGORISED) {
echo get_string("entrieswithoutcategory", "glossary");
$selected = GLOSSARY_SHOW_NOT_CATEGORISED;
} elseif ($hook == GLOSSARY_SHOW_ALL_CATEGORIES) {
echo get_string("allcategories", "glossary");
$selected = GLOSSARY_SHOW_ALL_CATEGORIES;
}
}
echo '</b></td>';
echo '<td align="center" style="width:20%">';
$select = html_select::make_popup_form("{$CFG->wwwroot}/mod/glossary/view.php?id={$cm->id}&mode=cat", 'hook', $menu, "catmenu", $selected);
$select->nothinglabel = false;
echo $OUTPUT->select($select);
echo '</td>';
echo '</tr>';
echo '</table>';
}
示例3: get_table_row
function get_table_row($filterinfo, $isfirstrow, $islastactive, $applytostrings)
{
global $CFG, $OUTPUT, $activechoices, $applytochoices, $filternames;
$row = array();
$filter = $filterinfo->filter;
// Filter name
if (!empty($filternames[$filter])) {
$row[] = $filternames[$filter];
} else {
$row[] = '<span class="error">' . get_string('filemissing', '', $filter) . '</span>';
}
// Disable/off/on
$select = html_select::make_popup_form(action_url($filter, 'setstate'), 'newstate', $activechoices, 'active' . basename($filter), $filterinfo->active);
$select->nothinglabel = false;
$select->form->button->text = get_string('save', 'admin');
$row[] = $OUTPUT->select($select);
// Re-order
$updown = '';
$spacer = '<img src="' . $OUTPUT->old_icon_url('spacer') . '" class="iconsmall" alt="" /> ';
if ($filterinfo->active != TEXTFILTER_DISABLED) {
if (!$isfirstrow) {
$updown .= action_icon(action_url($filter, 'up'), 'up', get_string('up'));
} else {
$updown .= $spacer;
}
if (!$islastactive) {
$updown .= action_icon(action_url($filter, 'down'), 'down', get_string('down'));
} else {
$updown .= $spacer;
}
}
$row[] = $updown;
// Apply to strings.
$select = html_select::make_popup_form(action_url($filter, 'setapplyto'), 'stringstoo', $applytochoices, 'applyto' . basename($filter), $applytostrings);
$select->nothinglabel = false;
$select->disabled = $filterinfo->active == TEXTFILTER_DISABLED;
$select->form->button->text = get_string('save', 'admin');
$row[] = $OUTPUT->select($select);
// Settings link, if required
if (filter_has_global_settings($filter)) {
$row[] = '<a href="' . $CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=filtersetting' . str_replace('/', '', $filter) . '">' . get_string('settings') . '</a>';
} else {
$row[] = '';
}
// Delete
if (substr($filter, 0, 4) != 'mod/') {
$row[] = '<a href="' . action_url($filter, 'delete') . '">' . get_string('delete') . '</a>';
} else {
$row[] = '';
}
return $row;
}
示例4: print_grade_plugin_selector
/**
* Print grading plugin selection popup form.
*
* @param array $plugin_info An array of plugins containing information for the selector
* @param boolean $return return as string
*
* @return nothing or string if $return true
*/
function print_grade_plugin_selector($plugin_info, $return = false)
{
global $CFG, $OUTPUT, $PAGE;
$menu = array();
$count = 0;
$active = '';
foreach ($plugin_info as $plugin_type => $plugins) {
if ($plugin_type == 'strings') {
continue;
}
$first_plugin = reset($plugins);
$menu[$first_plugin->link . '&'] = '--' . $plugin_info['strings'][$plugin_type];
if (empty($plugins->id)) {
foreach ($plugins as $plugin) {
$menu[$plugin->link] = $plugin->string;
$count++;
}
}
}
// finally print/return the popup form
if ($count > 1) {
$select = html_select::make_popup_form('', '', $menu, 'choosepluginreport', '');
$select->override_option_values($menu);
if ($return) {
return $OUTPUT->select($select);
} else {
echo $OUTPUT->select($select);
}
} else {
// only one option - no plugin selector needed
return '';
}
}
示例5: print_string
print_string('savechanges');
?>
" />
<input type="submit" name="cancel" value="<?php
print_string('cancel');
?>
" />
</div>
</div></form>
<?php
echo $OUTPUT->box_end();
}
/// Print a form to swap roles, and a link back to the all roles list.
echo '<div class="backlink">';
$select = html_select::make_popup_form($baseurl, 'roleid', $nameswithcounts, 'switchrole', $roleid);
$select->set_label(get_string('overrideanotherrole', 'role'));
$select->nothinglabel = false;
echo $OUTPUT->select($select);
echo '<p><a href="' . $baseurl . '">' . get_string('backtoallroles', 'role') . '</a></p>';
echo '</div>';
} else {
if (empty($overridableroles)) {
/// Print a message that there are no roles that can me assigned here.
echo $OUTPUT->heading(get_string('notabletooverrideroleshere', 'role'), 3, 'mdl-align');
} else {
/// Show UI for choosing a role to assign.
$table = new html_table();
$table->tablealign = 'center';
$table->width = '60%';
$table->head = array(get_string('role'), get_string('description'), get_string('overrides', 'role'));
示例6: get_string
$string = get_string('updatemymoodleon');
$edit = '1';
}
$form = new html_form();
$form->url = new moodle_url("{$CFG->wwwroot}/my/index.php", array('edit' => $edit));
$form->button->text = $string;
$button = $OUTPUT->button($form);
$header = $SITE->shortname . ': ' . $strmymoodle;
$navigation = build_navigation($strmymoodle);
$loggedinas = user_login_string();
if (empty($CFG->langmenu)) {
$langmenu = '';
} else {
$currlang = current_language();
$langs = get_list_of_languages();
$select = html_select::make_popup_form($CFG->wwwroot . '/my/index.php', 'lang', $langs, 'chooselang', $currlang);
$select->nothinglabel = false;
$select->set_label(get_accesshide(get_string('language')));
$langmenu = $OUTPUT->select($select);
}
print_header($strmymoodle, $header, $navigation, '', '', true, $button, $loggedinas . $langmenu);
/// The main overview in the middle of the page
// limits the number of courses showing up
$courses_limit = 21;
if (!empty($CFG->mycoursesperpage)) {
$courses_limit = $CFG->mycoursesperpage;
}
$courses = get_my_courses($USER->id, 'visible DESC,sortorder ASC', '*', false, $courses_limit);
$site = get_site();
$course = $site;
//just in case we need the old global $course hack
示例7: authorize_print_orders
/**
* authorize_print_orders
*
*/
function authorize_print_orders($courseid, $userid)
{
global $course;
global $CFG, $USER, $SITE, $DB, $OUTPUT, $PAGE;
global $strs, $authstrs;
require_once $CFG->libdir . '/tablelib.php';
$perpage = optional_param('perpage', 10, PARAM_INT);
$showonlymy = optional_param('showonlymy', 0, PARAM_BOOL);
$searchquery = optional_param('searchquery', '0', PARAM_INT);
$searchtype = optional_param('searchtype', 'orderid', PARAM_ALPHA);
$status = optional_param('status', AN_STATUS_NONE, PARAM_INT);
$searchmenu = array('orderid' => $authstrs->orderid, 'transid' => $authstrs->transid, 'cclastfour' => $authstrs->cclastfour);
$buttons = "<form method='post' action='index.php' autocomplete='off'><div>";
$select = html_select::make($searchmenu, 'searchtype', $searchtype, false);
$select->nothingvalue = '';
$buttons .= $OUTPUT->select($select);
$buttons .= "<input type='text' size='16' name='searchquery' value='' />";
$buttons .= "<input type='submit' value='{$strs->search}' />";
$buttons .= "</div></form>";
if (has_capability('enrol/authorize:uploadcsv', get_context_instance(CONTEXT_USER, $USER->id))) {
$buttons .= "<form method='get' action='uploadcsv.php'><div><input type='submit' value='" . get_string('uploadcsv', 'enrol_authorize') . "' /></div></form>";
}
$canmanagepayments = has_capability('enrol/authorize:managepayments', get_context_instance(CONTEXT_COURSE, $courseid));
if ($showonlymy || !$canmanagepayments) {
$userid = $USER->id;
}
$baseurl = $CFG->wwwroot . '/enrol/authorize/index.php?user=' . $userid;
$params = array('userid' => $userid);
$sql = "SELECT c.id, c.fullname FROM {course} c JOIN {enrol_authorize} e ON c.id = e.courseid ";
$sql .= $userid > 0 ? "WHERE (e.userid=:userid) " : '';
$sql .= "ORDER BY c.sortorder, c.fullname";
if ($popupcrs = $DB->get_records_sql_menu($sql, $params)) {
$popupcrs = array($SITE->id => $SITE->fullname) + $popupcrs;
}
$popupmenu = empty($popupcrs) ? '' : $OUTPUT->select(html_select::make_popup_form($baseurl . '&status=' . $status, 'course', $popupcrs, 'coursesmenu', $courseid));
$popupmenu .= '<br />';
$statusmenu = array(AN_STATUS_NONE => $strs->all, AN_STATUS_AUTH | AN_STATUS_UNDERREVIEW | AN_STATUS_APPROVEDREVIEW => $authstrs->allpendingorders, AN_STATUS_AUTH => $authstrs->authorizedpendingcapture, AN_STATUS_AUTHCAPTURE => $authstrs->authcaptured, AN_STATUS_CREDIT => $authstrs->refunded, AN_STATUS_VOID => $authstrs->cancelled, AN_STATUS_EXPIRE => $authstrs->expired, AN_STATUS_UNDERREVIEW => $authstrs->underreview, AN_STATUS_APPROVEDREVIEW => $authstrs->approvedreview, AN_STATUS_REVIEWFAILED => $authstrs->reviewfailed, AN_STATUS_TEST => $authstrs->tested);
$popupmenu .= $OUTPUT->select(html_select::make_popup_form($baseurl . '&course=' . $courseid, 'status', $statusmenu, 'statusmenu', $status));
if ($canmanagepayments) {
$popupmenu .= '<br />';
$checkbox = html_select_option::make_checkbox(1, $userid == $USER->id, get_string('mypaymentsonly', 'enrol_authorize'));
$PAGE->requires->js('enrol/authorize/authorize.js');
$checkbox->add_action('click', 'authorize_jump_to_mypayments', array('userid' => $USER->id, 'status' => $status));
$popupmenu .= $OUTPUT->checkbox($checkbox, 'showonlymy');
}
$navlinks = array();
if (SITEID != $courseid) {
$navlinks[] = array('name' => $course->shortname, 'link' => "{$CFG->wwwroot}/course/view.php?id=" . $course->id, 'type' => 'misc');
}
$navlinks[] = array('name' => $authstrs->paymentmanagement, 'link' => 'index.php', 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("{$course->shortname}: {$authstrs->paymentmanagement}", $authstrs->paymentmanagement, $navigation, '', '', false, $buttons, $popupmenu);
$table = new flexible_table('enrol-authorize');
$table->set_attribute('width', '100%');
$table->set_attribute('cellspacing', '0');
$table->set_attribute('cellpadding', '3');
$table->set_attribute('id', 'orders');
$table->set_attribute('class', 'generaltable generalbox');
if ($perpage > 100) {
$perpage = 100;
}
$perpagemenus = array(5 => 5, 10 => 10, 20 => 20, 50 => 50, 100 => 100);
$perpagemenu = $OUTPUT->select(html_select::make_popup_form($baseurl . '&status=' . $status . '&course=' . $courseid, 'perpage', $perpagemenus, 'perpagemenu', $perpage));
$table->define_columns(array('id', 'userid', 'timecreated', 'status', 'action'));
$table->define_headers(array($authstrs->orderid, $authstrs->shopper, $strs->time, $strs->status, $perpagemenu));
$table->define_baseurl($baseurl . "&status={$status}&course={$courseid}&perpage={$perpage}");
$table->no_sorting('action');
$table->sortable(true, 'id', SORT_DESC);
$table->pageable(true);
$table->setup();
$select = "SELECT e.id, e.paymentmethod, e.refundinfo, e.transid, e.courseid, e.userid, e.status, e.ccname, e.timecreated, e.settletime ";
$from = "FROM {enrol_authorize} e ";
$where = "WHERE (1=1) ";
$params = array();
if (!empty($searchquery)) {
switch ($searchtype) {
case 'orderid':
$where = "WHERE (e.id = :searchquery) ";
$params['searchquery'] = $searchquery;
break;
case 'transid':
$where = "WHERE (e.transid = :searchquery) ";
$params['searchquery'] = $searchquery;
break;
case 'cclastfour':
$searchquery = sprintf("%04d", $searchquery);
$where = "WHERE (e.refundinfo = :searchquery) AND (e.paymentmethod=:method) ";
$params['searchquery'] = $searchquery;
$params['method'] = AN_METHOD_CC;
break;
}
} else {
switch ($status) {
case AN_STATUS_NONE:
if (empty($CFG->an_test)) {
$where .= "AND (e.status != :status) ";
//.........这里部分代码省略.........
示例8: switchroles_form
/**
* Returns a little popup menu for switching roles
*
* @global object
* @global object
* @uses CONTEXT_COURSE
* @param int $courseid The course to update by id as found in 'course' table
* @return string
*/
function switchroles_form($courseid)
{
global $CFG, $USER, $OUTPUT;
if (!($context = get_context_instance(CONTEXT_COURSE, $courseid))) {
return '';
}
if (!empty($USER->access['rsw'][$context->path])) {
// Just a button to return to normal
$options = array();
$options['id'] = $courseid;
$options['sesskey'] = sesskey();
$options['switchrole'] = 0;
return $OUTPUT->button(html_form::make_button($CFG->wwwroot . '/course/view.php', $options, get_string('switchrolereturn')));
}
if (has_capability('moodle/role:switchroles', $context)) {
if (!($roles = get_switchable_roles($context))) {
return '';
// Nothing to show!
}
// unset default user role - it would not work
unset($roles[$CFG->guestroleid]);
$popupurl = $CFG->wwwroot . '/course/view.php?id=' . $courseid . '&sesskey=' . sesskey();
$select = html_select::make_popup_form($popupurl, 'switchrole', $roles, 'switchrole', '');
$select->nothinglabel = get_string('switchroleto');
$select->set_help_icon('switchrole', get_string('switchroleto'));
return $OUTPUT->select($select);
}
return '';
}
示例9: calendar_course_filter_selector
function calendar_course_filter_selector($getvars = '')
{
global $USER, $SESSION, $OUTPUT;
if (empty($USER->id) or isguest()) {
return '';
}
if (has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_SYSTEM)) && !empty($CFG->calendar_adminseesall)) {
$courses = get_courses('all', 'c.shortname', 'c.id,c.shortname');
} else {
$courses = get_my_courses($USER->id, 'shortname');
}
unset($courses[SITEID]);
$courseoptions[SITEID] = get_string('fulllistofcourses');
foreach ($courses as $course) {
$courseoptions[$course->id] = format_string($course->shortname);
}
if (is_numeric($SESSION->cal_courses_shown)) {
$selected = $SESSION->cal_courses_shown;
} else {
$selected = '';
}
$select = html_select::make_popup_form(CALENDAR_URL . 'set.php?var=setcourse&' . $getvars, 'id', $courseoptions, 'cal_courses_flt', $selected);
$select->nothinglabel = false;
return $OUTPUT->select($select);
}
示例10: print_section_add_menus
/**
* Prints the menus to add activities and resources.
*/
function print_section_add_menus($course, $section, $modnames, $vertical = false, $return = false)
{
global $CFG, $OUTPUT;
// check to see if user can add menus
if (!has_capability('moodle/course:manageactivities', get_context_instance(CONTEXT_COURSE, $course->id))) {
return false;
}
static $resources = false;
static $activities = false;
if ($resources === false) {
$resources = array();
$activities = array();
foreach ($modnames as $modname => $modnamestr) {
if (!course_allowed_module($course, $modname)) {
continue;
}
$libfile = "{$CFG->dirroot}/mod/{$modname}/lib.php";
if (!file_exists($libfile)) {
continue;
}
include_once $libfile;
$gettypesfunc = $modname . '_get_types';
if (function_exists($gettypesfunc)) {
$types = $gettypesfunc();
foreach ($types as $type) {
$type->type = str_replace('&', '&', $type->type);
if (!isset($type->modclass) or !isset($type->typestr)) {
debugging('Incorrect activity type in ' . $modname);
continue;
}
if ($type->modclass == MOD_CLASS_RESOURCE) {
$resources[$type->type] = $type->typestr;
} else {
$activities[$type->type] = $type->typestr;
}
}
} else {
$archetype = plugin_supports('mod', $modname, FEATURE_MOD_ARCHETYPE, MOD_ARCHETYPE_OTHER);
if ($archetype == MOD_ARCHETYPE_RESOURCE) {
$resources[$modname] = $modnamestr;
} else {
// all other archetypes are considered activity
$activities[$modname] = $modnamestr;
}
}
}
}
$straddactivity = get_string('addactivity');
$straddresource = get_string('addresource');
$output = '<div class="section_add_menus">';
if (!$vertical) {
$output .= '<div class="horizontal">';
}
$popupurl = "{$CFG->wwwroot}/course/mod.php?id={$course->id}§ion={$section}&sesskey=" . sesskey();
if (!empty($resources)) {
$select = html_select::make_popup_form($popupurl, 'add', $resources, "ressection{$section}", null);
$select->nothinglabel = $straddresource;
$select->set_help_icon('resource/types', $straddresource);
$output .= $OUTPUT->select($select);
}
if (!empty($activities)) {
$select = html_select::make_popup_form($popupurl, 'add', $activities, "section{$section}", null);
$select->nothinglabel = $straddactivity;
$select->set_help_icon('mods', $straddactivity);
$output .= $OUTPUT->select($select);
}
if (!$vertical) {
$output .= '</div>';
}
$output .= '</div>';
if ($return) {
return $output;
} else {
echo $output;
}
}
示例11: strip_tags
if (function_exists('role_get_name')) {
$rolenames[$role->id] = strip_tags(role_get_name($role, $context));
// Used in menus etc later on
} else {
$rolenames[$role->id] = strip_tags(format_string($role->name));
// Used in menus etc later on
}
}
}
/// If there are multiple Roles in the course, then show a drop down menu for switching
if (count($rolenames) > 1) {
echo '<div class="rolesform">';
echo get_string('currentrole', 'role') . ': ';
$rolenames = array(0 => get_string('all')) + $rolenames;
$baseurl = "{$wwwroot}/blocks/email_list/email/participants.php?id={$courseid}&group={$selgroup}&page={$page}&perpage={$perpage}&search={$search}&fname={$firstinitial}&lname={$lastinitial}&contextid={$context->id}";
$select = html_select::make_popup_form($baseurl, 'roleid', $rolenames, 'rolesform', $roleid);
echo $OUTPUT->select($select);
echo '</div>';
}
// Prints group selector for users with a viewallgroups capability if course groupmode is separate
echo '<br />';
groups_print_course_menu($course, $wwwroot . '/blocks/email_list/email/participants.php?id=' . $course->id);
echo '<br /><br />';
echo '<div id="participants"></div>' . '<iframe id="idsearch" name="bssearch" src="get_users.php?id=' . $courseid . '&roleid=' . $roleid . '&group=' . $selgroup . '&page=' . $page . '&perpage=' . $perpage . '&search=' . $search . '&fname=' . $firstinitial . '&lname=' . $lastinitial . '" style="display:none;"></iframe>' . "\n\n";
echo $OUTPUT->spacer($spacer);
if ($perpage == '7') {
echo '<div id="to_all_users" class="all_users"><img src="' . $CFG->wwwroot . '/blocks/email_list/email/images/add.png" height="16" width="16" alt="' . get_string("course") . '" /> <a href="' . $wwwroot . '/blocks/email_list/email/participants.php?id=' . $courseid . '&group=' . $selgroup . '&perpage=99999&search=' . $search . '&roleid=' . $roleid . '&fname=' . $firstinitial . '&lname=' . $lastinitial . '">' . get_string('showallusers') . '</a></div>';
} else {
echo '<div id="to_all_users" class="all_users"><img src="' . $CFG->wwwroot . '/blocks/email_list/email/images/delete.png" height="16" width="16" alt="' . get_string("course") . '" /> <a href="' . $wwwroot . '/blocks/email_list/email/participants.php?id=' . $courseid . '&group=' . $selgroup . '&perpage=7&search=' . $search . '&roleid=' . $roleid . '&fname=' . $firstinitial . '&lname=' . $lastinitial . '">' . get_string('showperpage', '', 7) . '</a></div>';
}
// Print close button
示例12: groups_print_activity_menu
/**
* Print group menu selector for activity.
*
* @global object
* @global object
* @global object
* @param object $cm course module object
* @param string $urlroot return address that users get to if they choose an option;
* should include any parameters needed, e.g. 'view.php?id=34'
* @param boolean $return return as string instead of printing
* @param boolean $hideallparticipants If true, this prevents the 'All participants'
* option from appearing in cases where it normally would. This is intended for
* use only by activities that cannot display all groups together. (Note that
* selecting this option does not prevent groups_get_activity_group from
* returning 0; it will still do that if the user has chosen 'all participants'
* in another activity, or not chosen anything.)
* @return mixed void or string depending on $return param
*/
function groups_print_activity_menu($cm, $urlroot, $return = false, $hideallparticipants = false)
{
global $CFG, $USER, $SESSION, $OUTPUT;
// groupings are ignored when not enabled
if (empty($CFG->enablegroupings)) {
$cm->groupingid = 0;
}
if (!($groupmode = groups_get_activity_groupmode($cm))) {
if ($return) {
return '';
} else {
return;
}
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
if ($groupmode == VISIBLEGROUPS or has_capability('moodle/site:accessallgroups', $context)) {
$allowedgroups = groups_get_all_groups($cm->course, 0, $cm->groupingid);
// any group in grouping (all if groupings not used)
// detect changes related to groups and fix active group
if (!empty($SESSION->activegroup[$cm->course][VISIBLEGROUPS][$cm->groupingid])) {
if (!array_key_exists($SESSION->activegroup[$cm->course][VISIBLEGROUPS][$cm->groupingid], $allowedgroups)) {
// active group does not exist anymore
unset($SESSION->activegroup[$cm->course][VISIBLEGROUPS][$cm->groupingid]);
}
}
if (!empty($SESSION->activegroup[$cm->course]['aag'][$cm->groupingid])) {
if (!array_key_exists($SESSION->activegroup[$cm->course]['aag'][$cm->groupingid], $allowedgroups)) {
// active group does not exist anymore
unset($SESSION->activegroup[$cm->course]['aag'][$cm->groupingid]);
}
}
} else {
$allowedgroups = groups_get_all_groups($cm->course, $USER->id, $cm->groupingid);
// only assigned groups
// detect changes related to groups and fix active group
if (isset($SESSION->activegroup[$cm->course][SEPARATEGROUPS][$cm->groupingid])) {
if ($SESSION->activegroup[$cm->course][SEPARATEGROUPS][$cm->groupingid] == 0) {
if ($allowedgroups) {
// somebody must have assigned at least one group, we can select it now - yay!
unset($SESSION->activegroup[$cm->course][SEPARATEGROUPS][$cm->groupingid]);
}
} else {
if (!array_key_exists($SESSION->activegroup[$cm->course][SEPARATEGROUPS][$cm->groupingid], $allowedgroups)) {
// active group not allowed or does not exist anymore
unset($SESSION->activegroup[$cm->course][SEPARATEGROUPS][$cm->groupingid]);
}
}
}
}
$activegroup = groups_get_activity_group($cm, true);
$groupsmenu = array();
if ((!$allowedgroups or $groupmode == VISIBLEGROUPS or has_capability('moodle/site:accessallgroups', $context)) and !$hideallparticipants) {
$groupsmenu[0] = get_string('allparticipants');
}
if ($allowedgroups) {
foreach ($allowedgroups as $group) {
$groupsmenu[$group->id] = format_string($group->name);
}
}
if ($groupmode == VISIBLEGROUPS) {
$grouplabel = get_string('groupsvisible');
} else {
$grouplabel = get_string('groupsseparate');
}
if (count($groupsmenu) == 1) {
$groupname = reset($groupsmenu);
$output = $grouplabel . ': ' . $groupname;
} else {
$select = html_select::make_popup_form($urlroot, 'group', $groupsmenu, 'selectgroup', $activegroup);
$select->nothinglabel = false;
$select->set_label($grouplabel);
$output = $OUTPUT->select($select);
}
$output = '<div class="groupselector">' . $output . '</div>';
if ($return) {
return $output;
} else {
echo $output;
}
}
示例13: html_table
$table = new html_table();
$table->head = array(get_string('fieldname', 'data'), get_string('type', 'data'), get_string('fielddescription', 'data'), get_string('action', 'data'));
$table->align = array('left', 'left', 'left', 'center');
$table->wrap = array(false, false, false, false);
if ($fff = $DB->get_records('data_fields', array('dataid' => $data->id), 'id')) {
foreach ($fff as $ff) {
$field = data_get_field($ff, $data);
$table->data[] = array('<a href="field.php?mode=display&d=' . $data->id . '&fid=' . $field->field->id . '&sesskey=' . sesskey() . '">' . $field->field->name . '</a>', $field->image() . ' ' . get_string($field->type, 'data'), shorten_text($field->field->description, 30), '<a href="field.php?d=' . $data->id . '&mode=display&fid=' . $field->field->id . '&sesskey=' . sesskey() . '">' . '<img src="' . $OUTPUT->old_icon_url('t/edit') . '" class="iconsmall" alt="' . get_string('edit') . '" title="' . get_string('edit') . '" /></a>' . ' ' . '<a href="field.php?d=' . $data->id . '&mode=delete&fid=' . $field->field->id . '&sesskey=' . sesskey() . '">' . '<img src="' . $OUTPUT->old_icon_url('t/delete') . '" class="iconsmall" alt="' . get_string('delete') . '" title="' . get_string('delete') . '" /></a>');
}
}
echo $OUTPUT->table($table);
}
echo '<div class="fieldadd">';
echo '<label for="fieldform_jump">' . get_string('newfield', 'data') . '</label>';
$popupurl = $CFG->wwwroot . '/mod/data/field.php?d=' . $data->id . '&mode=new&sesskey=' . sesskey();
echo $OUTPUT->select(html_select::make_popup_form($popupurl, 'newtype', $menufield, "fieldform"));
echo $OUTPUT->help_icon(moodle_help_icon::make('fields', get_string('addafield', 'data'), 'data'));
echo '</div>';
echo '<div class="sortdefault">';
echo '<form id="sortdefault" action="' . $CFG->wwwroot . '/mod/data/field.php" method="get">';
echo '<div>';
echo '<input type="hidden" name="d" value="' . $data->id . '" />';
echo '<input type="hidden" name="mode" value="sort" />';
echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
echo '<label for="defaultsort">' . get_string('defaultsortfield', 'data') . '</label>';
echo '<select id="defaultsort" name="defaultsort">';
if ($fields = $DB->get_records('data_fields', array('dataid' => $data->id))) {
echo '<optgroup label="' . get_string('fields', 'data') . '">';
foreach ($fields as $field) {
if ($data->defaultsort == $field->id) {
echo '<option value="' . $field->id . '" selected="selected">' . $field->name . '</option>';
示例14: get_string
$options[0] = get_string('all');
foreach ($groupings as $grouping) {
$options[$grouping->id] = strip_tags(format_string($grouping->name));
}
$popupurl = $rooturl . '&group=' . $groupid;
$select = html_select::make_popup_form($popupurl, 'grouping', $options, 'selectgrouping', $groupingid);
$select->set_label($strgrouping);
echo $OUTPUT->select($select);
}
$options = array();
$options[0] = get_string('all');
foreach ($groups as $group) {
$options[$group->id] = strip_tags(format_string($group->name));
}
$popupurl = $rooturl . '&grouping=' . $groupingid;
$select = html_select::make_popup_form($popupurl, 'group', $options, 'selectgroup', $groupid);
$select->set_label($strgroup);
echo $OUTPUT->select($select);
/// Print table
$printed = false;
foreach ($members as $gpgid => $groupdata) {
if ($groupingid and $groupingid != $gpgid) {
continue;
// do not show
}
$table = new html_table();
$table->head = array(get_string('groupscount', 'group', count($groupdata)), get_string('groupmembers', 'group'), get_string('usercount', 'group'));
$table->size = array('20%', '70%', '10%');
$table->align = array('left', 'left', 'center');
$table->width = '90%';
$table->data = array();
示例15: lesson_print_page_actions
/**
* Prints the page action buttons
*
* Move/Edit/Preview/Delete
*
* @uses $CFG
* @param int $cmid Course Module ID
* @param object $page Page record
* @param boolean $printmove Flag to print the move button or not
* @param boolean $printaddpage Flag to print the add page drop-down or not
* @param boolean $return Return flag
* @return mixed boolean/string
**/
function lesson_print_page_actions($cmid, $page, $printmove, $printaddpage = false, $return = false)
{
global $CFG, $OUTPUT;
$context = get_context_instance(CONTEXT_MODULE, $cmid);
$actions = array();
if (has_capability('mod/lesson:edit', $context)) {
if ($printmove) {
$actions[] = "<a title=\"" . get_string('move') . "\" href=\"{$CFG->wwwroot}/mod/lesson/lesson.php?id={$cmid}&action=move&pageid={$page->id}\">\n <img src=\"" . $OUTPUT->old_icon_url('t/move') . "\" class=\"iconsmall\" alt=\"" . get_string('move') . "\" /></a>\n";
}
$actions[] = "<a title=\"" . get_string('update') . "\" href=\"{$CFG->wwwroot}/mod/lesson/lesson.php?id={$cmid}&action=editpage&pageid={$page->id}\">\n <img src=\"" . $OUTPUT->old_icon_url('t/edit') . "\" class=\"iconsmall\" alt=\"" . get_string('update') . "\" /></a>\n";
$actions[] = "<a title=\"" . get_string('preview') . "\" href=\"{$CFG->wwwroot}/mod/lesson/view.php?id={$cmid}&pageid={$page->id}\">\n <img src=\"" . $OUTPUT->old_icon_url('t/preview') . "\" class=\"iconsmall\" alt=\"" . get_string('preview') . "\" /></a>\n";
$actions[] = "<a title=\"" . get_string('delete') . "\" href=\"{$CFG->wwwroot}/mod/lesson/lesson.php?id={$cmid}&sesskey=" . sesskey() . "&action=confirmdelete&pageid={$page->id}\">\n <img src=\"" . $OUTPUT->old_icon_url('t/delete') . "\" class=\"iconsmall\" alt=\"" . get_string('delete') . "\" /></a>\n";
if ($printaddpage) {
// Add page drop-down
$options = array();
$options['addcluster&sesskey=' . sesskey()] = get_string('clustertitle', 'lesson');
$options['addendofcluster&sesskey=' . sesskey()] = get_string('endofclustertitle', 'lesson');
$options['addbranchtable'] = get_string('branchtable', 'lesson');
$options['addendofbranch&sesskey=' . sesskey()] = get_string('endofbranch', 'lesson');
$options['addpage'] = get_string('question', 'lesson');
// Base url
$common = "{$CFG->wwwroot}/mod/lesson/lesson.php?id={$cmid}&pageid={$page->id}";
$select = html_select::make_popup_form($common, 'action', $options, "addpage_{$page->id}");
$select->nothinglabel = get_string('addpage', 'lesson') . '...';
$actions[] = $OUTPUT->select($select);
}
}
$actions = implode(' ', $actions);
if ($return) {
return $actions;
} else {
echo $actions;
return false;
}
}