mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-37455 mod_folder can display content inline. Coding style corrections
This commit is contained in:
parent
ec62d8b4e5
commit
c553530a8e
@ -52,7 +52,7 @@ $options = array('subdirs'=>1, 'maxbytes'=>$CFG->maxbytes, 'maxfiles'=>-1, 'acce
|
||||
file_prepare_standard_filemanager($data, 'files', $options, $context, 'mod_folder', 'content', 0);
|
||||
|
||||
$mform = new mod_folder_edit_form(null, array('data'=>$data, 'options'=>$options));
|
||||
if (!empty($folder->display) && $folder->display == FOLDER_DISPLAY_INLINE) {
|
||||
if ($folder->display == FOLDER_DISPLAY_INLINE) {
|
||||
$redirecturl = course_get_url($cm->course, $cm->sectionnum);
|
||||
} else {
|
||||
$redirecturl = new moodle_url('/mod/folder/view.php', array('id' => $cm->id));
|
||||
|
@ -45,11 +45,9 @@ $string['page-mod-folder-view'] = 'Folder module main page';
|
||||
$string['pluginadministration'] = 'Folder administration';
|
||||
$string['pluginname'] = 'Folder';
|
||||
$string['display'] = 'Display folder contents';
|
||||
$string['display_help'] = 'If you choose to display the folder contents on a course page, there '.
|
||||
'will be no link to a separate page and the title will not be displayed. The '.
|
||||
'description will be displayed only if "Display description on course page" '.
|
||||
'is checked.<br />'.
|
||||
'Also note that participants view actions can not be logged in this case.';
|
||||
$string['display_help'] = 'If you choose to display the folder contents on a course page, there will be no link to a separate page and the title will not be displayed.
|
||||
The description will be displayed only if "Display description on course page" is checked.<br />
|
||||
Also note that participants view actions can not be logged in this case.';
|
||||
$string['displaypage'] = 'On a separate page';
|
||||
$string['displayinline'] = 'Inline on a course page';
|
||||
$string['noautocompletioninline'] = 'Automatic completion on viewing of activity can not be selected together with "Display inline" option';
|
||||
|
@ -433,14 +433,14 @@ function folder_get_coursemodule_info($cm) {
|
||||
$cminfo->name = $folder->name;
|
||||
if ($folder->display == FOLDER_DISPLAY_INLINE) {
|
||||
// prepare folder object to store in customdata
|
||||
$fdata = new stdClass;
|
||||
$fdata = new stdClass();
|
||||
if ($cm->showdescription && strlen(trim($folder->intro))) {
|
||||
$fdata->intro = $folder->intro;
|
||||
if ($folder->introformat != FORMAT_MOODLE) {
|
||||
$fdata->introformat = $folder->introformat;
|
||||
}
|
||||
}
|
||||
$cminfo->customdata = json_encode($fdata);
|
||||
$cminfo->customdata = $fdata;
|
||||
} else {
|
||||
if ($cm->showdescription) {
|
||||
// Convert intro to html. Do not filter cached version, filters run at display time.
|
||||
@ -459,7 +459,8 @@ function folder_get_coursemodule_info($cm) {
|
||||
* @param cm_info $cm
|
||||
*/
|
||||
function folder_cm_info_dynamic(cm_info $cm) {
|
||||
if (strlen($cm->get_custom_data())) {
|
||||
if ($cm->get_custom_data()) {
|
||||
// the field 'customdata' is not empty IF AND ONLY IF we display contens inline
|
||||
$cm->set_no_view_link();
|
||||
}
|
||||
}
|
||||
@ -472,10 +473,12 @@ function folder_cm_info_dynamic(cm_info $cm) {
|
||||
*/
|
||||
function folder_cm_info_view(cm_info $cm) {
|
||||
global $PAGE;
|
||||
if ($cm->uservisible && strlen($cm->get_custom_data()) &&
|
||||
if ($cm->uservisible && $cm->get_custom_data() &&
|
||||
has_capability('mod/folder:view', $cm->context)) {
|
||||
// restore folder object from customdata
|
||||
$folder = json_decode($cm->get_custom_data());
|
||||
// Restore folder object from customdata.
|
||||
// Note the field 'customdata' is not empty IF AND ONLY IF we display contens inline.
|
||||
// Otherwise the content is default.
|
||||
$folder = $cm->get_custom_data();
|
||||
$folder->id = (int)$cm->instance;
|
||||
$folder->course = (int)$cm->course;
|
||||
$folder->display = FOLDER_DISPLAY_INLINE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user