diff --git a/classes/helper.php b/classes/helper.php index f384e8d..7664852 100644 --- a/classes/helper.php +++ b/classes/helper.php @@ -100,10 +100,12 @@ public function get_course_staff_users($course) { $user = \core_user::get_user($userid); profile_load_data($user); - $extrafields = profile_get_user_fields_with_data($userid); - foreach ($extrafields as $formfield) { - if ($course->{$formfield->inputname}) { - $customfield[]['value'] = $formfield->data; + if (format_designer_has_pro() != 1) { + $extrafields = profile_get_user_fields_with_data($userid); + foreach ($extrafields as $formfield) { + if ($course->{$formfield->inputname}) { + $customfield[]['value'] = $formfield->data; + } } } $roles = get_user_roles($coursecontext, $userid, false); diff --git a/classes/output/renderer.php b/classes/output/renderer.php index 6908719..0cf2538 100644 --- a/classes/output/renderer.php +++ b/classes/output/renderer.php @@ -102,6 +102,7 @@ public function render_content($widget) { } $data->startclass = implode(' ', $startclass); $data->startid = $startid; + $data->issectionpageclass = (optional_param('section', null, PARAM_INT)) ? 'section-page-layout' : ''; if (!format_designer_has_pro()) { $data->timemanagement = $this->timemanagement_details($course); @@ -843,17 +844,26 @@ public function render_section_data(section_info $section, stdClass $course, $on if ($thismod->uservisible) { if (isset($mods[$thismod->modname])) { $mods[$thismod->modname]['name'] = $thismod->modplural; - $mods[$thismod->modname]['img'] = $CFG->wwwroot.'/mod/'.$thismod->modname.'/pix/monologo.png'; + if (file_exists($CFG->dirroot.'/mod/'.$thismod->modname.'/pix/monologo.png')) { + $mods[$thismod->modname]['img'] = $CFG->wwwroot.'/mod/'.$thismod->modname.'/pix/monologo.png'; + } else if (file_exists($CFG->dirroot.'/mod/'.$thismod->modname.'/pix/icon.png')) { + $mods[$thismod->modname]['img'] = $CFG->wwwroot.'/mod/'.$thismod->modname.'/pix/icon.png'; + } $mods[$thismod->modname]['count']++; } else { $mods[$thismod->modname]['name'] = $thismod->modfullname; - $mods[$thismod->modname]['img'] = $CFG->wwwroot.'/mod/'.$thismod->modname.'/pix/monologo.png'; + if (file_exists($CFG->dirroot.'/mod/'.$thismod->modname.'/pix/monologo.png')) { + $mods[$thismod->modname]['img'] = $CFG->wwwroot.'/mod/'.$thismod->modname.'/pix/monologo.png'; + } else if (file_exists($CFG->dirroot.'/mod/'.$thismod->modname.'/pix/icon.png')) { + $mods[$thismod->modname]['img'] = $CFG->wwwroot.'/mod/'.$thismod->modname.'/pix/icon.png'; + } $mods[$thismod->modname]['count'] = 1; } } } $templatecontext['sectioncountstatus'] = true; $templatecontext['sectionmodcount'] = array_values($mods); + $templatecontext['sectionsingle'] = true; } if (format_designer_has_pro() && $section->section == 0) { require_once($CFG->dirroot. "/local/designer/lib.php"); diff --git a/lang/en/format_designer.php b/lang/en/format_designer.php index 845049f..9277d7b 100644 --- a/lang/en/format_designer.php +++ b/lang/en/format_designer.php @@ -316,7 +316,7 @@ $string['strprerequisiteinfo'] = "Prerequisite info"; $string['strprerequisiteinfo_help'] = "Display the text above the prerequisites."; $string['displayheaderroleusers'] = "Choose the staff role"; -$string['displayheaderroleusers_help'] = ""; +$string['displayheaderroleusers_help'] = "Users with these selected roles will be displayed in the course header."; $string['addtocontacts'] = "Add to contacts"; $string['message'] = "Message"; $string['mail'] = "Mail"; @@ -371,45 +371,53 @@ // Course background. $string['coursebackground'] = 'Course Background'; $string['coursebackgroundcolor'] = 'Course Background Color'; -$string['coursebackgroundcolor_help'] = ''; +$string['coursebackgroundcolor_help'] = 'Use this option to choose a background color for the entire course. If a color is selected here, it will be applied as the background color for the course. This setting is optional, and you can leave it blank if you don\'t want to set a specific background color.'; $string['coursebackgroundimage'] = 'Course Background Image'; -$string['coursebackgroundimage_help'] = ''; +$string['coursebackgroundimage_help'] = 'If you wish to have an image as the background for the entire course, you can upload it here. Once uploaded, this image will be displayed as the background for the entire course. This setting is optional, and you can leave it blank if you prefer not to have a background image.'; $string['coursebackgroundtransparent'] = 'Transparent Course'; -$string['coursebackgroundtransparent_help'] = ''; +$string['coursebackgroundtransparent_help'] = 'If you select this option, the background color of container elements within the course that currently have a background color will be set to transparent. This can create a visually appealing effect where elements appear to float on top of the background'; // Course header. $string['courseheadertype'] = 'Type'; -$string['courseheadertype_help'] = ''; +$string['courseheadertype_help'] = 'None: This option will not add any header to the course page.
+Hero: Selecting this option will make the header span the full width of the page, providing a visually impactful course introduction.
+Content: Choosing this option will set the header width to match the course contents, maintaining a more compact design.'; $string['hero'] = 'Hero'; $string['content'] = 'Content'; $string['courseheadertimemanagement'] = 'Time Management'; -$string['courseheadertimemanagement_help'] = ''; +$string['courseheadertimemanagement_help'] = 'Select the time-related elements you want to display in the course header. You can choose multiple options from enrolment start date, enrolment end date, due date, and completed date.'; $string['courseprogresstype'] = 'Course Progress'; -$string['courseprogresstype_help'] = ''; +$string['courseprogresstype_help'] = 'Disabled: This option will not display any course progress information in the header.
+Progress Bar: Selecting this option will display the course progress as a bar, visually indicating how much of the course is completed.
+Donut: Choosing this option will display the course progress as a donut chart, providing a different visual representation of progress.
'; $string['progressbar'] = 'Progress bar'; $string['donut'] = 'Donut'; $string['sectionprogresstype'] = 'Section Progress'; -$string['sectionprogresstype_help'] = ''; +$string['sectionprogresstype_help'] = 'Disabled: This option will not display any section progress information in the header.
+Progress Bar: Selecting this option will display the section progress as a bar, showing the completion status of individual course sections.
+Donut: Choosing this option will display the section progress as a donut chart, offering an alternative visual representation.
'; $string['courseheadersummary'] = 'Summary'; -$string['courseheadersummary_help'] = ''; +$string['courseheadersummary_help'] = 'Disabled: This option will not show any summary in the header.
+Trimmed: Selecting this option will trim the course summary based on the global setting "trim length."
+Full: Choosing this option will display the complete course summary.
'; $string['trimmed'] = 'Trimmed'; $string['full'] = 'Full'; $string['additionalcontent'] = 'Additional Content'; -$string['additionalcontent_help'] = ''; +$string['additionalcontent_help'] = 'Add any additional content that you want to appear at the bottom of the course header.'; $string['courseheaderbgcolor'] = 'Background color'; -$string['courseheaderbgcolor_help'] = ''; +$string['courseheaderbgcolor_help'] = 'Choose a background color to overlay on top of the background image. This color setting should support transparency if desired.'; $string['courseheadertextcolor'] = 'Text color'; -$string['courseheadertextcolor_help'] = ''; +$string['courseheadertextcolor_help'] = 'Select the color for text elements within the course header.'; $string['courseheaderbgimage'] = 'Background image'; -$string['courseheaderbgimage_help'] = ''; +$string['courseheaderbgimage_help'] = 'Upload a background image that you want to use for the course header.'; $string['courseheaderheight'] = 'Minimum Height'; -$string['courseheaderheight_help'] = ''; +$string['courseheaderheight_help'] = 'Specify the minimum height, in number, for the course header.'; $string['courseheadersize'] = 'Full Screen'; -$string['courseheadersize_help'] = ''; +$string['courseheadersize_help'] = 'If enabled, the course header will take up the full height of the screen.'; $string['userfields'] = 'User profile fields'; -$string['userfields_help'] = 'Select fields to display under the staff users'; +$string['userfields_help'] = 'Select profile fields to display below the user in the course header.'; $string['coursecustomfields'] = 'Course fields'; -$string['coursecustomfields_help'] = ''; +$string['coursecustomfields_help'] = 'Select the course fields from those available on the site that you want to display in the course header.'; $string['coursecompleted'] = 'Course completed'; $string['coursecustomfields_help'] = ''; // ...Coursefields icon. diff --git a/lib.php b/lib.php index 9b4c0a8..c849dd5 100644 --- a/lib.php +++ b/lib.php @@ -284,6 +284,7 @@ public function extend_course_navigation($navigation, navigation_node $node) { if (format_designer_has_pro()) { // Include the designer pro styles. + $PAGE->requires->css('/local/designer/style/slick.css'); $styleurl = \local_designer\courseoptions::create($this->get_course())->designer_include_style(); $PAGE->requires->css($styleurl); } @@ -499,13 +500,15 @@ public static function course_format_options_list($foreditform = false) { $courseformatoptions += (new local_designer\courseoptions($PAGE->course))->course_header_options_format_list(); } - $userprofilefields = profile_get_user_fields_with_data(0); - if (!empty($userprofilefields)) { - foreach ($userprofilefields as $field) { - $courseformatoptions[$field->inputname] = [ - 'default' => 0, - 'type' => PARAM_INT, - ]; + if (format_designer_has_pro() != 1 ) { + $userprofilefields = profile_get_user_fields_with_data(0); + if (!empty($userprofilefields)) { + foreach ($userprofilefields as $field) { + $courseformatoptions[$field->inputname] = [ + 'default' => 0, + 'type' => PARAM_INT, + ]; + } } } @@ -739,15 +742,17 @@ public static function course_format_options_list($foreditform = false) { 'help_component' => 'format_designer', ]; - $userprofilefields = profile_get_user_fields_with_data(0); - if (!empty($userprofilefields)) { - foreach ($userprofilefields as $field) { - $courseformatoptionsedit[$field->inputname] = [ - 'label' => $field->field->name, - 'element_type' => 'advcheckbox', - 'help' => 'profilefieditem', - 'help_component' => 'format_designer', - ]; + if (format_designer_has_pro() != 1 ) { + $userprofilefields = profile_get_user_fields_with_data(0); + if (!empty($userprofilefields)) { + foreach ($userprofilefields as $field) { + $courseformatoptionsedit[$field->inputname] = [ + 'label' => $field->field->name, + 'element_type' => 'advcheckbox', + 'help' => 'profilefieditem', + 'help_component' => 'format_designer', + ]; + } } } diff --git a/styles.css b/styles.css index 21bd56a..f2eb505 100644 --- a/styles.css +++ b/styles.css @@ -22,20 +22,27 @@ } @media (min-width: 768px) { - .format-designer .header-maxwidth, - .format-designer .secondary-navigation, .pagelayout-standard.format-designer #page.drawers .main-inner, body.limitedwidth.format-designer #page.drawers .main-inner, .pagelayout-standard.format-designer #page.drawers .footer-popover, body.limitedwidth.format-designer #page.drawers .footer-popover { max-width: none; } + .format-designer.path-admin.path-admin-roles:not(.format-site) .header-maxwidth, + .format-designer.path-admin.path-admin-roles:not(.format-site) .secondary-navigation .navigation .nav-tabs, + .format-designer.path-admin.path-admin-tool-lp .header-maxwidth, + .format-designer.path-admin.path-admin-tool-lp .secondary-navigation .navigation .nav-tabs { + max-width: none; + } #page.drawers.format-designer { padding-left: 0; padding-right: 0; } } - +.format-designer.path-mod .header-maxwidth { + padding: 0 3rem; + background-color: #fff; +} .format-designer #goto-top-link { z-index: 1; } @@ -216,12 +223,11 @@ border: 1px solid #eee; border-radius: 0; padding: 5px 15px 20px; - margin-right: 1.5rem; } .format-designer .course-content ul.designer.course-type-normal li.section.main:before { border: 0; } -.format-designer .course-content ul.designer li.section .section-header-content .goto-section { +.format-designer .course-content ul.designer:not(.course-type-flow) li.section .section-header-content .goto-section { float: right; clear: both; } @@ -267,37 +273,7 @@ .format-designer:not(.editing) .course-content ul.designer.course-type-normal li.section.main.container { width: 30%; } - -/* Section goto link */ -.format-designer .course-content ul.designer.course-type-normal li.section .section-header-content .goto-section { - text-indent: -999em; - border: 0; - background: none; - padding: 0; - clear: none; -} -.format-designer .course-content ul.designer.course-type-normal li.section .section-header-content .goto-section:focus { - box-shadow: none; -} -.format-designer .course-content ul.designer.course-type-normal li.section .section-header-content a.goto-section:after { - content: '\f178'; - font-size: 30px; - color: #000; - text-indent: 0; - margin: 0; - float: left; -} -/* End of Section goto link */ - -@media (min-width: 576px) { - .format-designer .course-content ul.designer.course-type-normal li.section.main { - max-width: none; - width: 30%; - flex: auto; - } -} /* End of Course type - Normal*/ - .format-designer ul.designer .card.card-list.notstarted { border-left-color: var(--primary); } @@ -462,8 +438,8 @@ body.format-designer.editing ul.designer .section .circles-layout .activity .edi /* format_topics CSS copied from boost to replicate basic styling for designer (based on topic) */ .format-designer .course-content ul.designer { list-style: none; - padding: 0; - margin: 0; + padding: 0 0 20px 0; + margin: 0 0 20px 0; clear: both; } .format-designer .course-content ul.designer li.section.main { @@ -656,6 +632,14 @@ span.section-collapse-icon:before { display: inline-block; vertical-align: middle; } +.format-designer.path-course-view.pagelayout-course #page { + background-color: transparent; +} +.format-designer #page #page-content section#region-main { + padding: 10px; + border-radius: 5px; + overflow: auto; +} .format-designer.path-course-view.pagelayout-course #page #page-content section#region-main { padding: 0; overflow: visible; @@ -664,9 +648,6 @@ span.section-collapse-icon:before { max-width: none; width: auto; } -.format-designer .course-content ul.designer.single-section-layout li.section.main { - padding-right: 10px; -} .format-designer .course-content ul.designer li.section.main.container .section-content-wrapper .right .section-collapsemenu { margin-bottom: 10px; } @@ -1678,6 +1659,9 @@ ul li { margin-left: 35px; margin-bottom: 5px; } +.format-designer .designer .section .content .section.card-layout li.activity .card.card-list.success { + min-height: 250px; +} .format-designer .designer .section .content .section.card-layout li.activity .card.card-list .mod-indent-outer { height: 100%; } @@ -2902,7 +2886,8 @@ body.format-designer.editing .designer .section .content .section.card-layout li height: auto; } .format-designer .course-content ul.designer.course-type-flow { - display: contents; + /* display: contents; */ + margin-top: 30px; } .format-designer .course-content ul.course-type-flow.designer .section.main .section-content-wrapper { display: contents; @@ -2941,7 +2926,7 @@ body.format-designer.editing .designer .section .content .section.card-layout li bottom: 20px; left: 20px; } -.format-designer .course-content ul.designer.course-type-flow li.section .section-header-content .section-progress-info .progress { +.format-designer .course-content ul.designer.course-type-flow li.section .section-header-content .section-progress-info > div:not(.progress-donut) .progress { height: 12px; background: #fff; } diff --git a/templates/courseformat/content.mustache b/templates/courseformat/content.mustache index 1209cc5..ff9126d 100644 --- a/templates/courseformat/content.mustache +++ b/templates/courseformat/content.mustache @@ -159,7 +159,7 @@ } } }} -
+
{{{timemanagement}}}

{{{title}}}

{{{completionhelp}}} diff --git a/templates/section_layout.mustache b/templates/section_layout.mustache index 5f5babc..cf5059e 100644 --- a/templates/section_layout.mustache +++ b/templates/section_layout.mustache @@ -26,7 +26,7 @@ } }} -
+
{{#sectiondesignwhole}}
{{#maskinner}} @@ -203,7 +203,7 @@
{{/sectioncountstatus}} {{#gotosection}} - {{#str}}gotosection, format_designer{{/str}} + {{#str}}gotosection, format_designer{{/str}} {{/gotosection}}
diff --git a/version.php b/version.php index fd3878a..d5f310e 100644 --- a/version.php +++ b/version.php @@ -24,7 +24,7 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2023101100; // The current plugin version (Date: YYYYMMDDXX). +$plugin->version = 2023101101; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2020061500; // Requires this Moodle version. $plugin->component = 'format_designer'; // Full name of the plugin (used for diagnostics). $plugin->release = 'Version 1.4';