diff --git a/blocks/community/renderer.php b/blocks/community/renderer.php index b9a8eb84d8d..53ee619930e 100644 --- a/blocks/community/renderer.php +++ b/blocks/community/renderer.php @@ -171,7 +171,9 @@ class block_community_renderer extends plugin_renderer_base { 'alt' => $course->fullname ); } - $screenshothtml = $this->output->render(new image_gallery($images, $course->shortname)); + $imagegallery = new image_gallery($images, $course->shortname); + $imagegallery->displayfirstimageonly = true; + $screenshothtml = $this->output->render($imagegallery); } $table->data[] = array($coursenamehtml, $deschtml, $screenshothtml, $language, $addbuttonhtml); } diff --git a/blocks/community/styles.css b/blocks/community/styles.css index 9a5fc3649bb..e93ea130b66 100644 --- a/blocks/community/styles.css +++ b/blocks/community/styles.css @@ -23,7 +23,4 @@ #page-blocks-community-communitycourse .prioritisetr {background-color: #ffd4ff;} #page-blocks-community-communitycourse .additionaldesc {font-size: 80%; color: #aa6666;} #page-blocks-community-communitycourse .additionaladmindesc {font-size: 80%; color: #6666ff;} -#page-blocks-community-communitycourse .blockdescription {font-size: 80%; color: #555555;} - -.path-blocks-community .image_gallery a.imagelink {display:none;} -.path-blocks-community .image_gallery a#imagelink1 {display:inline;} \ No newline at end of file +#page-blocks-community-communitycourse .blockdescription {font-size: 80%; color: #555555;} \ No newline at end of file diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php index 413c5238650..7787b0134f4 100644 --- a/lib/outputcomponents.php +++ b/lib/outputcomponents.php @@ -2411,6 +2411,11 @@ class image_gallery implements renderable { */ public $grouping = null; + /** + * If set to true only the first image is visible. + */ + public $displayfirstimageonly = false; + /** * Constructs an image gallery component * @param array $images diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 2aa6fc23888..b15f040b3ed 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -2611,7 +2611,11 @@ NONJS; if (count($imagegallery->images) == 0) { return ''; } - $content = html_writer::start_tag('div', array('class'=>'image_gallery')); + $classes = array('image_gallery'); + if ($imagegallery->displayfirstimageonly) { + $classes[] = 'oneimageonly'; + } + $content = html_writer::start_tag('div', array('class'=>join(' ', $classes))); foreach ($imagegallery->images as $image) { $content .= html_writer::tag('a', html_writer::empty_tag('img', $image->thumb), $image->link); } diff --git a/theme/base/style/core.css b/theme/base/style/core.css index da2a9e07c89..8511c7ac43f 100644 --- a/theme/base/style/core.css +++ b/theme/base/style/core.css @@ -588,3 +588,6 @@ body.tag .managelink {padding: 5px;} .smartselect.compactmenu .smartselect_menu {z-index: 1000;overflow:hidden;} .smartselect.compactmenu .smartselect_submenu .smartselect_submenu {z-index: 1020;} .smartselect.compactmenu .smartselect_submenuitem:hover > .smartselect_menuitem_label {font-weight:bold;} + +.image_gallery.oneimageonly a.imagelink {display:none;} +.image_gallery.oneimageonly a#imagelink1 {display:inline;} \ No newline at end of file