MDL-71913 mod_data: Add tertiary navigation
This commit is contained in:
+52
-50
@@ -33,8 +33,10 @@ $exportuser = optional_param('exportuser', false, PARAM_BOOL); // Flag for expor
|
||||
$exporttime = optional_param('exporttime', false, PARAM_BOOL); // Flag for exporting date/time information
|
||||
$exportapproval = optional_param('exportapproval', false, PARAM_BOOL); // Flag for exporting user details
|
||||
$tags = optional_param('exporttags', false, PARAM_BOOL); // Flag for exporting user details.
|
||||
$redirectbackto = optional_param('backto', '', PARAM_LOCALURL); // The location to redirect back to.
|
||||
|
||||
$PAGE->set_url('/mod/data/export.php', array('d'=>$d));
|
||||
$url = new moodle_url('/mod/data/export.php', array('d' => $d));
|
||||
$PAGE->set_url($url);
|
||||
|
||||
if (! $data = $DB->get_record('data', array('id'=>$d))) {
|
||||
print_error('wrongdataid', 'data');
|
||||
@@ -76,62 +78,62 @@ foreach ($fieldrecords as $fieldrecord) {
|
||||
}
|
||||
|
||||
|
||||
$mform = new mod_data_export_form('export.php?d='.$data->id, $fields, $cm, $data);
|
||||
$mform = new mod_data_export_form(new moodle_url('/mod/data/export.php', ['d' => $data->id,
|
||||
'backto' => $redirectbackto]), $fields, $cm, $data);
|
||||
|
||||
if($mform->is_cancelled()) {
|
||||
redirect('view.php?d='.$data->id);
|
||||
} elseif (!$formdata = (array) $mform->get_data()) {
|
||||
// build header to match the rest of the UI
|
||||
$PAGE->set_title($data->name);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->force_settings_menu(true);
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(format_string($data->name), 2);
|
||||
if ($mform->is_cancelled()) {
|
||||
$redirectbackto = !empty($redirectbackto) ? $redirectbackto :
|
||||
new \moodle_url('/mod/data/view.php', ['d' => $data->id]);
|
||||
redirect($redirectbackto);
|
||||
} else if ($formdata = (array) $mform->get_data()) {
|
||||
$selectedfields = array();
|
||||
foreach ($formdata as $key => $value) {
|
||||
//field form elements are field_1 field_2 etc. 0 if not selected. 1 if selected.
|
||||
if (strpos($key, 'field_')===0 && !empty($value)) {
|
||||
$selectedfields[] = substr($key, 6);
|
||||
}
|
||||
}
|
||||
|
||||
// Render the activity information.
|
||||
$cminfo = cm_info::create($cm);
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cminfo, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cminfo, $USER->id);
|
||||
echo $OUTPUT->activity_information($cminfo, $completiondetails, $activitydates);
|
||||
|
||||
echo $OUTPUT->box(format_module_intro('data', $data, $cm->id), 'generalbox', 'intro');
|
||||
|
||||
$url = new moodle_url('/mod/data/export.php', array('d' => $d));
|
||||
groups_print_activity_menu($cm, $url);
|
||||
|
||||
// these are for the tab display
|
||||
$currentgroup = groups_get_activity_group($cm);
|
||||
$groupmode = groups_get_activity_groupmode($cm);
|
||||
$currenttab = 'export';
|
||||
include('tabs.php');
|
||||
$mform->display();
|
||||
echo $OUTPUT->footer();
|
||||
die;
|
||||
}
|
||||
|
||||
$selectedfields = array();
|
||||
foreach ($formdata as $key => $value) {
|
||||
//field form elements are field_1 field_2 etc. 0 if not selected. 1 if selected.
|
||||
if (strpos($key, 'field_')===0 && !empty($value)) {
|
||||
$selectedfields[] = substr($key, 6);
|
||||
$exportdata = data_get_exportdata($data->id, $fields, $selectedfields, $currentgroup, $context,
|
||||
$exportuser, $exporttime, $exportapproval, $tags);
|
||||
$count = count($exportdata);
|
||||
switch ($formdata['exporttype']) {
|
||||
case 'csv':
|
||||
data_export_csv($exportdata, $formdata['delimiter_name'], $data->name, $count);
|
||||
break;
|
||||
case 'xls':
|
||||
data_export_xls($exportdata, $data->name, $count);
|
||||
break;
|
||||
case 'ods':
|
||||
data_export_ods($exportdata, $data->name, $count);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$currentgroup = groups_get_activity_group($cm);
|
||||
|
||||
$exportdata = data_get_exportdata($data->id, $fields, $selectedfields, $currentgroup, $context,
|
||||
$exportuser, $exporttime, $exportapproval, $tags);
|
||||
$count = count($exportdata);
|
||||
switch ($formdata['exporttype']) {
|
||||
case 'csv':
|
||||
data_export_csv($exportdata, $formdata['delimiter_name'], $data->name, $count);
|
||||
break;
|
||||
case 'xls':
|
||||
data_export_xls($exportdata, $data->name, $count);
|
||||
break;
|
||||
case 'ods':
|
||||
data_export_ods($exportdata, $data->name, $count);
|
||||
break;
|
||||
// Build header to match the rest of the UI.
|
||||
$PAGE->set_title($data->name);
|
||||
$PAGE->set_heading($course->fullname);
|
||||
$PAGE->force_settings_menu(true);
|
||||
$PAGE->set_secondary_active_tab('modulepage');
|
||||
echo $OUTPUT->header();
|
||||
if (!$PAGE->has_secondary_navigation()) {
|
||||
echo $OUTPUT->heading(format_string($data->name), 2);
|
||||
}
|
||||
|
||||
// Render the activity information.
|
||||
$cminfo = cm_info::create($cm);
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cminfo, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cminfo, $USER->id);
|
||||
echo $OUTPUT->activity_information($cminfo, $completiondetails, $activitydates);
|
||||
|
||||
echo $OUTPUT->box(format_module_intro('data', $data, $cm->id), 'generalbox', 'intro');
|
||||
|
||||
groups_print_activity_menu($cm, $url);
|
||||
|
||||
$mform->display();
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
|
||||
die();
|
||||
|
||||
Reference in New Issue
Block a user