diff --git a/blocks/community/forms.php b/blocks/community/forms.php index 424f6719dad..317f2986b8a 100644 --- a/blocks/community/forms.php +++ b/blocks/community/forms.php @@ -53,10 +53,41 @@ class community_hub_search_form extends moodleform { //Public hub list $options = array(); - $mform->addElement('static','huburlstring',get_string('selecthub', 'block_community')); - $mform->addHelpButton('huburlstring', 'selecthub', 'block_community'); + // $mform->addElement('static','huburlstring',get_string('selecthub', 'block_community')); + foreach ($hubs as $hub) { - $mform->addElement('radio','huburl',null,' '.$hub['name'], $hub['url']); + $params = array('hubid' => $hub['id'], + 'filetype' => HUBSCREENSHOT_FILE_TYPE); + $imgurl = new moodle_url(HUBDIRECTORYURL . "/local/hubdirectory/webservice/download.php", $params); + $ascreenshothtml = html_writer::empty_tag('img', array('src' => $imgurl, 'alt' => $hub['name'])); + $brtag = html_writer::empty_tag('br'); + $hubdescription = '  '.$hub['name']; + $hubdescription .= $brtag; + $hubdescription .= html_writer::tag('span', $ascreenshothtml, array('class' => 'hubscreenshot')); + $hubdescription .= html_writer::tag('span', $hub['description'], array('class' => 'hubdescription')); + $hubdescription .= $brtag; + $additionaldesc = get_string('sites', 'block_community'). ': ' . $hub['sites'] . ' - ' . + get_string('courses', 'block_community'). ': ' . $hub['courses']; + $hubdescription .= html_writer::tag('span', $additionaldesc, array('class' => 'hubadditionaldesc')); + $hubdescription .= $brtag; + $hubdescription .= html_writer::tag('span', + $hub['trusted']?get_string('hubtrusted', 'block_community'):get_string('hubnottrusted', 'block_community'), + array('class' => $hub['trusted']?'trusted':'nottrusted')); + $hubdescription = html_writer::tag('span', + $hubdescription, + array('class' => $hub['trusted']?'hubtrusted':'hubnottrusted')); + + $radiotitle = ''; + if (empty($firsthub)) { + $radiotitle = get_string('selecthub', 'block_community'); + } + $mform->addElement('radio','huburl',$radiotitle, $hubdescription, $hub['url']); + if (empty($firsthub)) { + $mform->addHelpButton('huburl', 'selecthub', 'block_community'); + $mform->setDefault('huburl', true); + $firsthub = true; + } + } $options = array(0 => get_string('enrollable', 'block_community'), diff --git a/blocks/community/lang/en/block_community.php b/blocks/community/lang/en/block_community.php index d82086ec316..414460422ee 100644 --- a/blocks/community/lang/en/block_community.php +++ b/blocks/community/lang/en/block_community.php @@ -28,7 +28,7 @@ $string['activities'] = 'Activities'; $string['add'] = 'Add'; $string['addtocommunityblock'] = 'Add to community block'; $string['addcommunitycourse'] = 'Add community course'; -$string['additionalcoursedesc'] = '{$a->contributornames} - {$a->coverage} - Creator: {$a->creatorname} - Publisher: {$a->publishername} - Subject: {$a->subject} +$string['additionalcoursedesc'] = 'Creator: {$a->creatorname} - Publisher: {$a->publishername} - Subject: {$a->subject} - Audience: {$a->audience} - Educational level: {$a->educationallevel}'; $string['addcourse'] = 'Search'; $string['audience'] = 'Designed for'; @@ -39,6 +39,8 @@ $string['contributors'] = ' - Contributors: {$a}'; $string['coursedesc'] = 'Description'; $string['courselang'] = 'Language'; $string['coursename'] = 'Name'; +$string['courses'] = 'Courses'; +$string['coverage'] = 'Coverage: {$a}'; $string['download'] = 'Download'; $string['downloadable'] = 'courses I can download'; $string['downloadtemplate'] = 'Create course from template'; @@ -50,12 +52,15 @@ $string['enroldownload_help'] = 'Some courses listed in the selected hub are bei Others are course templates provided for you to download and use on your own Moodle site.'; $string['enrollable'] = 'courses I can enrol in'; $string['hub'] = 'hub'; +$string['hubnottrusted'] = 'Not trusted'; +$string['hubtrusted'] = 'This hub is trusted by Moodle.org'; $string['keywords'] = 'Keywords'; $string['keywords_help'] = 'You can search for courses containing specific text in the name, description and other fields of the database.'; $string['language'] = 'Language'; $string['language_help'] = 'You can search for courses written in a specific language.'; $string['licence'] = 'License'; $string['licence_help'] = 'You can search for courses that are licensed in a particular way.'; +$string['moredetails'] = 'More details'; $string['mycommunities'] = 'My communities:'; $string['nocourse'] = 'No courses found'; $string['operation'] = 'Operation'; @@ -67,5 +72,6 @@ $string['searchcommunitycourse'] = 'Search community course'; $string['searchcourse'] = 'Search community course'; $string['selecthub'] = 'Select hub'; $string['selecthub_help'] = 'Select hub where to search the courses.'; +$string['sites'] = 'Sites'; $string['subject'] = 'Subject'; $string['subject_help'] = 'To narrow your search to courses about a particular subject, choose one from this list.'; diff --git a/blocks/community/renderer.php b/blocks/community/renderer.php index 7908a9bbaa7..603651e664c 100644 --- a/blocks/community/renderer.php +++ b/blocks/community/renderer.php @@ -102,6 +102,14 @@ class block_community_renderer extends plugin_renderer_base { $deschtml = $course->description; //the description /// courses and sites number display under the description, in smaller $deschtml .= html_writer::empty_tag('br'); + if ($course->contributornames) { + $additionaldesc .= get_string('contributors', 'block_community', $course->contributornames); + $additionaldesc .= ' - '; + } + if ($course->coverage) { + $additionaldesc .= get_string('coverage', 'block_community', $course->coverage); + $additionaldesc .= ' - '; + } $additionaldesc = get_string('additionalcoursedesc', 'block_community', $course); $deschtml .= html_writer::tag('span', $additionaldesc, array('class' => 'additionaldesc')); //add content to the course description @@ -110,15 +118,24 @@ class block_community_renderer extends plugin_renderer_base { $blockhtml = ''; foreach ($course->contents as $content) { if ($content['moduletype'] == 'block') { - $blockhtml .= ' - ' . $content['modulename'] . " (" . $content['contentcount'] . ")"; + if (!empty($blockhtml)) { + $blockhtml .= ' - '; + } + $blockhtml .= get_string('pluginname', 'block_'.$content['modulename']). " (".$content['contentcount'].")"; } else { - $activitieshtml .= ' - ' . $content['modulename'] . " (" . $content['contentcount'] . ")"; + if (!empty($activitieshtml)) { + $activitieshtml .= ' - '; + } + $activitieshtml .= get_string('modulename', $content['modulename']). " (".$content['contentcount'].")"; } } - $deschtml .= html_writer::empty_tag('br') . html_writer::tag('span', - get_string('blocks', 'block_community') . " : " . $blockhtml, array('class' => 'blockdescription')); - $deschtml .= html_writer::empty_tag('br') . html_writer::tag('span', - get_string('activities', 'block_community') . " : " . $activitieshtml, array('class' => 'activitiesdescription')); + $blocksandactivities = html_writer::tag('span', + get_string('blocks', 'block_community')." : ".$blockhtml); + $blocksandactivities .= html_writer::empty_tag('br').html_writer::tag('span', + get_string('activities', 'block_community')." : ".$activitieshtml); + + $deschtml .= print_collapsible_region($blocksandactivities, 'blockdescription', + 'blocksandactivities', get_string('moredetails','block_community'), '', false,true); } //retrieve language string diff --git a/lib/hublib.php b/lib/hublib.php index b6a8f2d62a8..0f89d276090 100644 --- a/lib/hublib.php +++ b/lib/hublib.php @@ -135,10 +135,15 @@ define('EDULEVEL_OTHER', 'other'); ///// FILE TYPES ///// /** - * FILE TYPE: SCREENSHOTS + * FILE TYPE: COURSE SCREENSHOT */ define('SCREENSHOT_FILE_TYPE', 'screenshot'); +/** + * FILE TYPE: HUB SCREENSHOT + */ +define('HUBSCREENSHOT_FILE_TYPE', 'hubscreenshot'); + /** * FILE TYPE: BACKUP */