Commit 97599ad0 authored by Francois Marier's avatar Francois Marier Committed by Richard Mansfield
Browse files

artefact/comment: replace rating images with radio buttons



We'll be able to theme these ones to look like star ratings.
Signed-off-by: default avatarFrancois Marier <francois@catalyst.net.nz>
parent 0e4b7e8c
......@@ -72,8 +72,10 @@ $elements['message'] = array(
);
if (get_config_plugin('artefact', 'comment', 'commentratings')) {
$elements['rating'] = array(
'type' => 'text',
'type' => 'radio',
'title' => get_string('rating', 'artefact.comment'),
'options' => array('1' => '', '2' => '', '3' => '', '4' => '', '5' => ''),
'class' => 'star',
'defaultvalue' => $comment->get('rating'),
);
}
......
......@@ -473,8 +473,14 @@ class ArtefactTypeComment extends ArtefactType {
if (get_config_plugin('artefact', 'comment', 'commentratings') and $item->rating) {
$item->rating = valid_rating($item->rating);
$imageurl = $THEME->get_url("images/rating{$item->rating}.png", false, 'artefact/comment');
$item->ratingimage = '<img src="' . $imageurl . '" title="'. $item->rating . ' / 5">';
$item->ratingimage = '';
for ($i = MIN_RATING; $i <= MAX_RATING; $i++) {
$checked = '';
if ($i === $item->rating) {
$checked = 'checked="checked"';
}
$item->ratingimage .= '<input name="star'.$item->id.'" type="radio" class="star" '.$checked.' disabled="disabled"/>';
}
}
}
......@@ -552,8 +558,10 @@ class ArtefactTypeComment extends ArtefactType {
);
if (get_config_plugin('artefact', 'comment', 'commentratings')) {
$form['elements']['rating'] = array(
'type' => 'text',
'type' => 'radio',
'title' => get_string('rating', 'artefact.comment'),
'options' => array('1' => '', '2' => '', '3' => '', '4' => '', '5' => ''),
'class' => 'star',
);
}
$form['elements']['ispublic'] = array(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment