community hub MDL-24243 course listing improvement

This commit is contained in:
jerome mouneyrac
2010-09-17 02:23:50 +00:00
parent 3b2b084554
commit fb6b45426f
4 changed files with 38 additions and 21 deletions
+16 -10
View File
@@ -94,17 +94,24 @@ class community_hub_search_form extends moodleform {
if (key_exists('id', $hub)) {
$params = array('hubid' => $hub['id'],
'filetype' => HUB_HUBSCREENSHOT_FILE_TYPE);
$imgurl = new moodle_url(HUB_HUBDIRECTORYURL . "/local/hubdirectory/webservice/download.php", $params);
$ascreenshothtml = html_writer::empty_tag('img', array('src' => $imgurl, 'alt' => $hub['name']));
$imgurl = new moodle_url(HUB_HUBDIRECTORYURL .
"/local/hubdirectory/webservice/download.php", $params);
$ascreenshothtml = html_writer::empty_tag('img',
array('src' => $imgurl, 'alt' => $hub['name']));
$hubdescription = '  ' . $hub['name'];
$hubdescription = '  ' . html_writer::tag('a', $hub['name'],
array('class' => 'hublink', 'href' => $hub['url'],
'onclick' => 'this.target="_blank"'));
$hubdescription .= $brtag;
$hubdescription .= html_writer::tag('span', $ascreenshothtml, array('class' => 'hubscreenshot'));
$hubdescription .= html_writer::tag('span', $hub['description'], array('class' => 'hubdescription'));
$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 .= html_writer::tag('span', $additionaldesc,
array('class' => 'hubadditionaldesc'));
$hubdescription .= $brtag;
$hubdescription .= html_writer::tag('span',
$hub['trusted'] ? get_string('hubtrusted', 'block_community') :
@@ -116,8 +123,7 @@ class community_hub_search_form extends moodleform {
} else {
$hubdescription = '  ';
$hubdescription .= html_writer::tag('a', $hub['name'],
array('class' => 'hublink', 'href' => $hub['url']));
array('class' => 'hublink', 'href' => $hub['url']));
}
if (empty($firsthub)) {
@@ -131,8 +137,8 @@ class community_hub_search_form extends moodleform {
}
//display enrol/download select box if the USER has the download capability on the course
if (has_capability('moodle/community:download',
get_context_instance(CONTEXT_COURSE, $this->_customdata['courseid']))) {
if (has_capability('moodle/community:download',
get_context_instance(CONTEXT_COURSE, $this->_customdata['courseid']))) {
$options = array(0 => get_string('enrollable', 'block_community'),
1 => get_string('downloadable', 'block_community'));
$mform->addElement('select', 'downloadable', get_string('enroldownload', 'block_community'),
+2 -1
View File
@@ -26,7 +26,7 @@
$string['activities'] = 'Activities';
$string['add'] = 'Add';
$string['addtocommunityblock'] = 'Bookmark';
$string['addtocommunityblock'] = 'Add to block';
$string['addcommunitycourse'] = 'Add community course';
$string['additionalcoursedesc'] = '{$a->lang} Creator: {$a->creatorname} - Publisher: {$a->publishername} - Subject: {$a->subject}
- Audience: {$a->audience} - Educational level: {$a->educationallevel} - License: {$a->license}';
@@ -76,6 +76,7 @@ $string['nocourse'] = 'No courses found';
$string['noratings'] = 'No ratings';
$string['operation'] = 'Operation';
$string['pluginname'] = 'Community';
$string['rateandcomment'] = 'Rate and comment';
$string['rating'] = 'Rating';
$string['removecommunitycourse'] = 'Remove community course';
$string['restorecourse'] = 'Restore course';
+19 -10
View File
@@ -77,7 +77,8 @@ class block_community_renderer extends plugin_renderer_base {
}
$visitlinkhtml = html_writer::tag('a', $linktext,
array('href' => $courseurl, 'class' => 'hubcoursedownload'));
array('href' => $courseurl, 'class' => 'hubcoursedownload',
'onclick' => 'this.target="_blank"'));
//create title html
$coursename = html_writer::tag('h3', $course->fullname,
@@ -238,10 +239,10 @@ class block_community_renderer extends plugin_renderer_base {
array('class' => 'current-rating',
'style' => 'width:' . $size . 'px;'));
$rating = html_writer::tag('ul', $rating ,
$rating = html_writer::tag('ul', $rating,
array('class' => 'star-rating clearfix'));
$rating .= html_writer::tag('div', ' (' . $course->rating->count . ')' ,
array('class' => 'ratingcount clearfix'));;
$rating .= html_writer::tag('div', ' (' . $course->rating->count . ')',
array('class' => 'ratingcount clearfix'));
}
}
@@ -254,8 +255,8 @@ class block_community_renderer extends plugin_renderer_base {
//display only if there is some comment if there is some comment
$commentcount = count($course->comments);
$coursecomments = html_writer::tag('div',
get_string('comments', 'block_community', $commentcount),
array('class'=>'commenttitle'));;
get_string('comments', 'block_community', $commentcount),
array('class' => 'commenttitle'));
foreach ($course->comments as $comment) {
$commentator = html_writer::tag('div',
@@ -264,11 +265,11 @@ class block_community_renderer extends plugin_renderer_base {
$commentdate = html_writer::tag('div',
' - ' . userdate($comment['date'], '%e/%m/%y'),
array('class' => 'hubcommentdate clearfix'));
$commenttext = html_writer::tag('div',
$comment['comment'],
array('class' => 'hubcommenttext'));
$coursecomments .= html_writer::tag('div',
$commentator . $commentdate . $commenttext,
array('class' => 'hubcomment'));
@@ -280,9 +281,17 @@ class block_community_renderer extends plugin_renderer_base {
$coursecomments = $coursecommenticon . html_writer::tag('div',
$coursecomments,
array('class' => 'yui3-overlay-loading',
'id' => 'commentoverlay-' . $course->id));
'id' => 'commentoverlay-' . $course->id));
}
//link rate and comment
$rateandcomment = html_writer::tag('div',
html_writer::tag('a', get_string('rateandcomment', 'block_community'),
array('href' => new moodle_url($huburl,
array('courseid' => $course->id)),
'onclick' => 'this.target="_blank"')),
array('class' => 'hubrateandcomment'));
//the main DIV tags
$buttonsdiv = html_writer::tag('div',
$addbuttonhtml . $downloadbuttonhtml . $visitlinkhtml,
@@ -293,7 +302,7 @@ class block_community_renderer extends plugin_renderer_base {
$coursedescdiv = html_writer::tag('div',
$deschtml . $additionaldeschtml
. $rating . $coursecomments,
. $rating . $coursecomments . $rateandcomment,
array('class' => 'coursedescription'));
$coursehtml =
$coursenamehtml . html_writer::tag('div',
+1
View File
@@ -151,3 +151,4 @@
font-size: 80%;
margin-top:15px;
}
#page-blocks-community-communitycourse .hubrateandcomment { font-size: 80%;}