Skip to content

Commit

Permalink
Merge pull request #26 from WisdmLabs/dev
Browse files Browse the repository at this point in the history
Dev to Master
  • Loading branch information
ranjitlawale11 authored Dec 5, 2019
2 parents e773956 + 434c5ef commit 0a2218d
Show file tree
Hide file tree
Showing 19 changed files with 189 additions and 96 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ The file remuiformat/styles.css contains the CSS styles for the format.

# Roadmap

1. Will give option to set image as background to the card in card layout.
2. Will give option to adjust image brightness of the card in card layout.
1. Global Course Announcement Feature.

[(Back to top)](#table-of-contents)

Expand Down
2 changes: 1 addition & 1 deletion amd/build/format_card.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions amd/src/format_card.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,12 @@ define(['jquery', 'core/ajax', 'format_remuiformat/jquery.dragsort'], function($
}
});
});

// + Show full summary label show conditionally.
var summaryheight = $('.read-more-target .no-overflow').height();
if (summaryheight > 52) {
$('.read-more-trigger').show();
}
}
// Must return the init function.

Expand Down
21 changes: 16 additions & 5 deletions changes.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
Version 1.0.4
Fixes
* Fixed issue when course layout resets on course restore.
* Fixed multi-language support for section/topic summary in card format.
* Fixed language support issue in activity count showed in the general section in card format.
* General section image changes when changed in the other duplicated course in List format.

Tweaks
* Added fixed SVG pattern to topic card if image is not added in topic summary.
* Hide label 'Activities' if no activity exists in general section of card format.

Version 1.0.3
Fixes
* Fixed Drag&Drop Upload Problem in List format.

Features
* Add background image to section in Card format.
* Move activity to specific section in Card format.
* Course progress and total number of different activity count details in the course added in Card format general section.
* Showed limited activity depending on screen size in general section in Card foramt.
* Resume to last viewed activity functionality in Card format general section.
* Add a background image to the section in Card format.
* Move activity to the specific section in Card format.
* Course progress and the total number of different activity count details in the course added in Card format general section.
* Showed limited activity depending on screen size in the general section in Card format.
* Resume to the last viewed activity functionality in the Card format general section.
* Add new section after specific section in list format.

Version 1.0.2
Expand Down
85 changes: 51 additions & 34 deletions classes/course_format_data_common_trait.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,37 +224,46 @@ public function get_all_section_data($renderer, $editing, $rformat, $settings, $
$extradetails = $this->get_section_module_info($currentsection, $course, null, $singlepageurl);

if ($rformat == REMUI_CARD_FORMAT) {
if (!empty($currentsection->summary)) {
// Get the section summary.
$sectiondetails->summary = $renderer->abstract_html_contents(
$currentsection->summary, $sectiontitlesummarymaxlength
);
// Check if background image to section card setting is enable and image exists in summary,
// if yes then add background image to context.
if ($remuienablecardbackgroundimg == 1 && $this->get_section_first_image(
$currentsection, $currentsection->summary
)) {
// Get the section summary.
$sectiondetails->summary = $renderer->abstract_html_contents(
$renderer->format_summary_text($currentsection), $sectiontitlesummarymaxlength
);

// Check if background image to section card setting is enable and image exists in summary,
// if yes then add background image to context.
if ($remuienablecardbackgroundimg == 1
&& $this->get_section_first_image( $currentsection, $currentsection->summary ))
{
if ( $remuidefaultsectiontheme == 1 ) {
// Dark theme.
$remuidefaultsectionoverlay = 'rgba(0,0,0,0.45)';
$remuinewfontcolor = '#eaeaea';
$remuinewthemecolor = 'dark';
} else {
// Light theme.
$remuidefaultsectionoverlay = 'rgba(255,255,255,0.8)';
if ( $remuidefaultsectiontheme == 1 ) {
// Dark theme.
$remuidefaultsectionoverlay = 'rgba(0,0,0,0.45)';
$remuinewfontcolor = '#eaeaea';
$remuinewthemecolor = 'dark';
} else {
// Light theme.
$remuidefaultsectionoverlay = 'rgba(255,255,255,0.8)';
$remuinewfontcolor = '#101010';
$remuinewthemecolor = 'light';
}
// Get first image from section to set card card background image.
$sectiondetails->sectionfirstimage = $this->get_section_first_image(
$currentsection, $currentsection->summary
);
$sectiondetails->remuidefaultsectionoverlay = $remuidefaultsectionoverlay;
$sectiondetails->remuinewfontcolor = $remuinewfontcolor;
$sectiondetails->remuinewthemecolor = $remuinewthemecolor;
$remuinewfontcolor = '#101010';
$remuinewthemecolor = 'light';
}

// Get first image from section to set card card background image.
$imgarray = $this->get_section_first_image( $currentsection, $currentsection->summary );
$sectiondetails->sectionfirstimage = $imgarray['img'];

// Change the overlay opacity if pattern image.
if ( $remuidefaultsectiontheme == 0 && $imgarray['pattern'] == 1) {
// Light theme.
$remuidefaultsectionoverlay = 'rgba(255,255,255,0.0)';
} elseif ( $remuidefaultsectiontheme == 1 && $imgarray['pattern'] == 1 ) {
// Dark theme.
$remuidefaultsectionoverlay = 'rgba(0, 0, 0, 0.55)';
}

$sectiondetails->remuidefaultsectionoverlay = $remuidefaultsectionoverlay;
$sectiondetails->remuinewfontcolor = $remuinewfontcolor;
$sectiondetails->remuinewthemecolor = $remuinewthemecolor;
}

$sectiondetails->activityinfo = $extradetails['activityinfo'];
$sectiondetails->progressinfo = $extradetails['progressinfo'];

Expand Down Expand Up @@ -448,16 +457,24 @@ public function get_activity_to_resume($course) {
* Get the image from section.
*/
public function get_section_first_image($currentsection, $summaryhtml) {
$newcontent = '';
$imgarray = array();
$context = context_course::instance($currentsection->course);
$summarytext = file_rewrite_pluginfile_urls($summaryhtml, 'pluginfile.php',
$context->id, 'course', 'section', $currentsection->id);
$image = $this->extract_first_image($summarytext);
$image = '';
if( !empty($summarytext) ) {
$image = $this->extract_first_image($summarytext);
}
if ($image) {
$imagesrc = $image['src'];
$newcontent .= $imagesrc;
return $newcontent;
$imagesrc = 'url(' . $image['src'] . ')';
$imgarray['img'] = $imagesrc;
$imgarray['pattern'] = 0;
} else {
$imgarray['img'] = "linear-gradient(324deg, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 85%),
url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='200' viewBox='0 0 160 80'%3E%3Cg fill='%23ededed' %3E%3Cpolygon points='0 10 0 0 10 0'/%3E%3Cpolygon points='0 40 0 30 10 30'/%3E%3Cpolygon points='0 30 0 20 10 20'/%3E%3Cpolygon points='0 70 0 60 10 60'/%3E%3Cpolygon points='0 80 0 70 10 70'/%3E%3Cpolygon points='50 80 50 70 60 70'/%3E%3Cpolygon points='10 20 10 10 20 10'/%3E%3Cpolygon points='10 40 10 30 20 30'/%3E%3Cpolygon points='20 10 20 0 30 0'/%3E%3Cpolygon points='10 10 10 0 20 0'/%3E%3Cpolygon points='30 20 30 10 40 10'/%3E%3Cpolygon points='20 20 20 40 40 20'/%3E%3Cpolygon points='40 10 40 0 50 0'/%3E%3Cpolygon points='40 20 40 10 50 10'/%3E%3Cpolygon points='40 40 40 30 50 30'/%3E%3Cpolygon points='30 40 30 30 40 30'/%3E%3Cpolygon points='40 60 40 50 50 50'/%3E%3Cpolygon points='50 30 50 20 60 20'/%3E%3Cpolygon points='40 60 40 80 60 60'/%3E%3Cpolygon points='50 40 50 60 70 40'/%3E%3Cpolygon points='60 0 60 20 80 0'/%3E%3Cpolygon points='70 30 70 20 80 20'/%3E%3Cpolygon points='70 40 70 30 80 30'/%3E%3Cpolygon points='60 60 60 80 80 60'/%3E%3Cpolygon points='80 10 80 0 90 0'/%3E%3Cpolygon points='70 40 70 60 90 40'/%3E%3Cpolygon points='80 60 80 50 90 50'/%3E%3Cpolygon points='60 30 60 20 70 20'/%3E%3Cpolygon points='80 70 80 80 90 80 100 70'/%3E%3Cpolygon points='80 10 80 40 110 10'/%3E%3Cpolygon points='110 40 110 30 120 30'/%3E%3Cpolygon points='90 40 90 70 120 40'/%3E%3Cpolygon points='10 50 10 80 40 50'/%3E%3Cpolygon points='110 60 110 50 120 50'/%3E%3Cpolygon points='100 60 100 80 120 60'/%3E%3Cpolygon points='110 0 110 20 130 0'/%3E%3Cpolygon points='120 30 120 20 130 20'/%3E%3Cpolygon points='130 10 130 0 140 0'/%3E%3Cpolygon points='130 30 130 20 140 20'/%3E%3Cpolygon points='120 40 120 30 130 30'/%3E%3Cpolygon points='130 50 130 40 140 40'/%3E%3Cpolygon points='120 50 120 70 140 50'/%3E%3Cpolygon points='110 70 110 80 130 80 140 70'/%3E%3Cpolygon points='140 10 140 0 150 0'/%3E%3Cpolygon points='140 20 140 10 150 10'/%3E%3Cpolygon points='140 40 140 30 150 30'/%3E%3Cpolygon points='140 50 140 40 150 40'/%3E%3Cpolygon points='140 70 140 60 150 60'/%3E%3Cpolygon points='150 20 150 40 160 30 160 20'/%3E%3Cpolygon points='150 60 150 50 160 50'/%3E%3Cpolygon points='140 70 140 80 150 80 160 70'/%3E%3C/g%3E%3C/svg%3E\")";
$imgarray['pattern'] = 1;
}
return $imgarray;
}

/**
Expand Down Expand Up @@ -551,4 +568,4 @@ public function abstract_html_contents($html, $maxlength = 100) {

return $newcontent;
}
}
}
Loading

0 comments on commit 0a2218d

Please sign in to comment.