Proyectos de Subversion Moodle

Rev

Rev 98 | Rev 271 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 98 Rev 117
Línea 1... Línea 1...
1
<?php
1
<?php
Línea 2... Línea 2...
2
 
2
 
3
class block_cesa_course_rating extends block_base {
-
 
4
    
3
class block_cesa_course_rating extends block_base
5
    
-
 
6
    public function init() {
-
 
7
        $this->title = get_string('pluginname', 'block_cesa_course_rating');
-
 
Línea 8... Línea -...
8
    }
-
 
9
 
-
 
10
    public function applicable_formats() {
-
 
11
      
-
 
12
        return [
-
 
13
            'all' => false,
-
 
14
            'my' => false,
-
 
15
            'admin' => false,
-
 
16
            'course' => false,
-
 
17
            'course-view' => true,
-
 
18
            'enrol' => true,
-
 
19
        ];
-
 
20
        
-
 
21
    }
-
 
22
 
-
 
23
    function specialization() {
-
 
24
        global $CFG, $DB;
-
 
25
        if (empty($this->config)) {
-
 
26
            $this->instance->defaultregion = 'below-content';
-
 
27
            $this->instance->region = 'below-content';
-
 
28
            $DB->update_record('block_instances', $this->instance);
-
 
29
            
-
 
30
            $this->title = 'Students feedback';
-
 
31
        } else {
-
 
32
            $this->title = get_string('pluginname', 'block_cesa_course_rating');
-
 
33
        }
-
 
34
    }
-
 
35
 
-
 
36
    function instance_allow_multiple() {
-
 
37
        return false;
-
 
38
    }
-
 
39
 
-
 
40
    public function html_attributes() {
-
 
Línea -... Línea 4...
-
 
4
{
-
 
5
 
-
 
6
 
-
 
7
  public function init()
-
 
8
  {
-
 
9
    $this->title = get_string('pluginname', 'block_cesa_course_rating');
-
 
10
  }
-
 
11
 
-
 
12
  public function applicable_formats()
-
 
13
  {
-
 
14
 
-
 
15
    return [
-
 
16
      'all' => false,
-
 
17
      'my' => false,
-
 
18
      'admin' => false,
-
 
19
      'course' => false,
-
 
20
      'course-view' => true,
-
 
21
      'enrol' => true,
-
 
22
    ];
-
 
23
  }
-
 
24
 
-
 
25
  function specialization()
-
 
26
  {
-
 
27
    global $CFG, $DB;
-
 
28
    if (empty($this->config)) {
-
 
29
      $this->instance->defaultregion = 'below-content';
-
 
30
      $this->instance->region = 'below-content';
-
 
31
      $DB->update_record('block_instances', $this->instance);
-
 
32
 
-
 
33
      $this->title = 'Students feedback';
-
 
34
    } else {
-
 
35
      $this->title = get_string('pluginname', 'block_cesa_course_rating');
-
 
36
    }
-
 
37
  }
-
 
38
 
-
 
39
  function instance_allow_multiple()
-
 
40
  {
-
 
41
    return false;
-
 
42
  }
-
 
43
 
-
 
44
  public function html_attributes()
-
 
45
  {
41
      global $CFG;
46
    global $CFG;
42
      $attributes = parent::html_attributes();
47
    $attributes = parent::html_attributes();
43
 
48
 
44
      /*
49
    /*
45
      $ccn_mt = '';
50
      $ccn_mt = '';
46
      $ccn_mb = '';
51
      $ccn_mb = '';
Línea 87... Línea 92...
87
      
92
      
88
      $attributes['ccn_style'] = $ccn_stylize;
93
      $attributes['ccn_style'] = $ccn_stylize;
89
      // $attributes['class'] .= ' block_'. $this->name();
94
      // $attributes['class'] .= ' block_'. $this->name();
90
      $attributes['class'] .= ' '. $ccn_css_class;
95
      $attributes['class'] .= ' '. $ccn_css_class;
91
      */
-
 
92
      
-
 
93
      
-
 
94
      return $attributes;
-
 
Línea 95... Línea -...
95
    }
-
 
96
 
-
 
97
    public function has_config() {
-
 
Línea -... Línea 96...
-
 
96
      */
-
 
97
 
-
 
98
 
-
 
99
    return $attributes;
-
 
100
  }
-
 
101
 
-
 
102
  public function has_config()
-
 
103
  {
98
        return true;
104
    return true;
-
 
105
  }
99
    }
106
 
100
 
107
  public function get_content()
101
    public function get_content() {
108
  {
102
        global $CFG, $COURSE;
109
    global $CFG, $COURSE;
103
 
110
 
104
        if ($this->content !== null) {
111
    if ($this->content !== null) {
105
            // return $this->content;
112
      // return $this->content;
106
        }
113
    }
-
 
114
 
107
 
115
    $this->content = new stdClass;
-
 
116
 
-
 
117
    if (!empty($this->config->title)) {
-
 
118
      $this->content->title =  format_text($this->config->title, FORMAT_HTML, array('filter' => true));
108
        $this->content = new stdClass;
119
    } else {
109
 
120
      $this->content->title = get_string('pluginname', 'block_cesa_course_rating');
110
        if(!empty($this->config->title)){$this->content->title =  format_text($this->config->title, FORMAT_HTML, array('filter' => true));} else {$this->content->title = get_string('pluginname', 'block_cesa_course_rating');}
121
    }
111
 
122
 
112
        $courseid = $COURSE->id;
123
    $courseid = $COURSE->id;
113
        $context = get_context_instance(CONTEXT_COURSE, $courseid);
124
    $context = get_context_instance(CONTEXT_COURSE, $courseid);
114
 
125
 
115
        $canRate = has_capability('block/cesa_course_rating:rate', $context);
126
    $canRate = has_capability('block/cesa_course_rating:rate', $context);
116
        if($canRate == 1) {
127
    if ($canRate == 1) {
117
          $canRateClass = 'ccn-can-rate';
128
      $canRateClass = 'ccn-can-rate';
118
        } else {
129
    } else {
119
          $canRateClass = 'ccn-cannot-rate';
130
      $canRateClass = 'ccn-cannot-rate';
120
        }
131
    }
121
 
132
 
122
        $ccnSubmitRating = $this->submit_rating();
133
    $ccnSubmitRating = $this->submit_rating();
123
        $this->content->text = '';
134
    $this->content->text = '';
124
 
135
 
125
        $ccnRating    = number_format($this->overall_rating($COURSE->id), 1);
136
    $ccnRating    = number_format($this->overall_rating($COURSE->id), 1);
126
 
137
 
127
        $ccnStar      = '<li class="list-inline-item"><i class="fa fa-star"></i></li>';
138
    $ccnStar      = '<li class="list-inline-item"><i class="fa fa-star"></i></li>';
128
        $ccnStarHalf  = '<li class="list-inline-item"><i class="fa fa-star-half-o"></i></li>';
139
    $ccnStarHalf  = '<li class="list-inline-item"><i class="fa fa-star-half-o"></i></li>';
129
        $ccnStarVoid  = '<li class="list-inline-item"><i class="fa fa-star-o"></i></li>';
140
    $ccnStarVoid  = '<li class="list-inline-item"><i class="fa fa-star-o"></i></li>';
130
 
141
 
131
        if($ccnRating == 5) {
142
    if ($ccnRating == 5) {
132
          $ccnStars = str_repeat($ccnStar, 5);
143
      $ccnStars = str_repeat($ccnStar, 5);
133
        } elseif($ccnRating == 4.5) {
144
    } elseif ($ccnRating == 4.5) {
134
          $ccnStars = str_repeat($ccnStar, 4) . str_repeat($ccnStarHalf, 1);
145
      $ccnStars = str_repeat($ccnStar, 4) . str_repeat($ccnStarHalf, 1);
135
        } elseif($ccnRating == 4) {
146
    } elseif ($ccnRating == 4) {
136
          $ccnStars = str_repeat($ccnStar, 4) . str_repeat($ccnStarVoid, 1);
147
      $ccnStars = str_repeat($ccnStar, 4) . str_repeat($ccnStarVoid, 1);
137
        } elseif($ccnRating == 3.5) {
148
    } elseif ($ccnRating == 3.5) {
138
          $ccnStars = str_repeat($ccnStar, 3) . str_repeat($ccnStarHalf, 1) . str_repeat($ccnStarVoid, 1);
149
      $ccnStars = str_repeat($ccnStar, 3) . str_repeat($ccnStarHalf, 1) . str_repeat($ccnStarVoid, 1);
139
        } elseif($ccnRating == 3) {
150
    } elseif ($ccnRating == 3) {
140
          $ccnStars = str_repeat($ccnStar, 3) . str_repeat($ccnStarVoid, 2);
151
      $ccnStars = str_repeat($ccnStar, 3) . str_repeat($ccnStarVoid, 2);
141
        } elseif($ccnRating == 2.5) {
152
    } elseif ($ccnRating == 2.5) {
142
          $ccnStars = str_repeat($ccnStar, 2) . str_repeat($ccnStarHalf, 1)  . str_repeat($ccnStarVoid, 2);
153
      $ccnStars = str_repeat($ccnStar, 2) . str_repeat($ccnStarHalf, 1)  . str_repeat($ccnStarVoid, 2);
143
        } elseif($ccnRating == 2) {
154
    } elseif ($ccnRating == 2) {
144
          $ccnStars = str_repeat($ccnStar, 2) . str_repeat($ccnStarVoid, 3);
155
      $ccnStars = str_repeat($ccnStar, 2) . str_repeat($ccnStarVoid, 3);
145
        } elseif($ccnRating == 1.5) {
156
    } elseif ($ccnRating == 1.5) {
146
          $ccnStars = str_repeat($ccnStar, 1) . str_repeat($ccnStarHalf, 1)  . str_repeat($ccnStarVoid, 3);
157
      $ccnStars = str_repeat($ccnStar, 1) . str_repeat($ccnStarHalf, 1)  . str_repeat($ccnStarVoid, 3);
147
        } elseif($ccnRating == 0.5) {
158
    } elseif ($ccnRating == 0.5) {
148
          $ccnStars = str_repeat($ccnStarHalf, 1) . str_repeat($ccnStarVoid, 4);
159
      $ccnStars = str_repeat($ccnStarHalf, 1) . str_repeat($ccnStarVoid, 4);
149
        } else {
160
    } else {
150
          $ccnStars = str_repeat($ccnStarVoid, 5);
161
      $ccnStars = str_repeat($ccnStarVoid, 5);
151
        }
162
    }
152
 
163
 
153
        $ccnFive = $this->get_specific_average($COURSE->id, 5);
164
    $ccnFive = $this->get_specific_average($COURSE->id, 5);
154
        $ccnFour = $this->get_specific_average($COURSE->id, 4);
165
    $ccnFour = $this->get_specific_average($COURSE->id, 4);
Línea 155... Línea 166...
155
        $ccnThree = $this->get_specific_average($COURSE->id, 3);
166
    $ccnThree = $this->get_specific_average($COURSE->id, 3);
156
        $ccnTwo = $this->get_specific_average($COURSE->id, 2);
167
    $ccnTwo = $this->get_specific_average($COURSE->id, 2);
157
        $ccnOne = $this->get_specific_average($COURSE->id, 1);
168
    $ccnOne = $this->get_specific_average($COURSE->id, 1);
158
 
169
 
159
        $this->content->text .= '
170
    $this->content->text .= '
160
        	<div class="cs_row_five">
171
        	<div class="cs_row_five">
161
									<div class="student_feedback_container">
172
									<div class="student_feedback_container">
162
										<h4 data-ccn="title" class="aii_title">'.$this->content->title.'</h4>
173
										<h4 data-ccn="title" class="aii_title">' . $this->content->title . '</h4>
163
										<div class="s_feeback_content">
174
										<div class="s_feeback_content">
164
									        <ul class="skills">
175
									        <ul class="skills">
165
									        	<li class="list-inline-item">'.get_string('stars_5', 'block_cesa_course_rating').'</li>
176
									        	<li class="list-inline-item">' . get_string('stars_5', 'block_cesa_course_rating') . '</li>
166
									            <li class="list-inline-item progressbar1" data-width="'.$ccnFive.'" data-target="100">'.$ccnFive.'%</li>
177
									            <li class="list-inline-item progressbar1" data-width="' . $ccnFive . '" data-target="100">' . $ccnFive . '%</li>
167
									        </ul>
178
									        </ul>
168
									        <ul class="skills">
179
									        <ul class="skills">
169
									        	<li class="list-inline-item">'.get_string('stars_4', 'block_cesa_course_rating').'</li>
180
									        	<li class="list-inline-item">' . get_string('stars_4', 'block_cesa_course_rating') . '</li>
170
									            <li class="list-inline-item progressbar2" data-width="'.$ccnFour.'" data-target="100">'.$ccnFour.'%</li>
181
									            <li class="list-inline-item progressbar2" data-width="' . $ccnFour . '" data-target="100">' . $ccnFour . '%</li>
171
									        </ul>
182
									        </ul>
172
									        <ul class="skills">
183
									        <ul class="skills">
173
									        	<li class="list-inline-item">'.get_string('stars_3', 'block_cesa_course_rating').'</li>
184
									        	<li class="list-inline-item">' . get_string('stars_3', 'block_cesa_course_rating') . '</li>
174
									            <li class="list-inline-item progressbar3" data-width="'.$ccnThree.'" data-target="100">'.$ccnThree.'%</li>
185
									            <li class="list-inline-item progressbar3" data-width="' . $ccnThree . '" data-target="100">' . $ccnThree . '%</li>
175
									        </ul>
186
									        </ul>
176
									        <ul class="skills">
187
									        <ul class="skills">
177
									        	<li class="list-inline-item">'.get_string('stars_2', 'block_cesa_course_rating').'</li>
188
									        	<li class="list-inline-item">' . get_string('stars_2', 'block_cesa_course_rating') . '</li>
178
									            <li class="list-inline-item progressbar4" data-width="'.$ccnTwo.'" data-target="100">'.$ccnTwo.'%</li>
189
									            <li class="list-inline-item progressbar4" data-width="' . $ccnTwo . '" data-target="100">' . $ccnTwo . '%</li>
179
									        </ul>
190
									        </ul>
180
									        <ul class="skills">
191
									        <ul class="skills">
181
									        	<li class="list-inline-item">'.get_string('stars_1', 'block_cesa_course_rating').'</li>
192
									        	<li class="list-inline-item">' . get_string('stars_1', 'block_cesa_course_rating') . '</li>
182
									            <li class="list-inline-item progressbar5" data-width="'.$ccnOne.'" data-target="100">'.$ccnOne.'%</li>
193
									            <li class="list-inline-item progressbar5" data-width="' . $ccnOne . '" data-target="100">' . $ccnOne . '%</li>
183
									        </ul>
194
									        </ul>
184
										</div>
195
										</div>
185
										<div class="aii_average_review text-center '.$canRateClass.'">
196
										<div class="aii_average_review text-center ' . $canRateClass . '">
186
											<div class="av_content">
197
											<div class="av_content">
187
												<h2>'.$ccnRating.'</h2>
198
												<h2>' . $ccnRating . '</h2>
188
												<ul class="aii_rive_list mb0">
199
												<ul class="aii_rive_list mb0">
189
													'.$ccnStars.'
200
													' . $ccnStars . '
190
												</ul>
201
												</ul>
191
												<p>'.$this->count_ratings($COURSE->id).'</p>';
202
												<p>' . $this->count_ratings($COURSE->id) . '</p>';
192
                        if($canRate == 1){
203
    if ($canRate == 1) {
193
                          $this->content->text .= $ccnSubmitRating;
204
      $this->content->text .= $ccnSubmitRating;
194
                        }
205
    }
195
                      $this->content->text .='
206
    $this->content->text .= '
196
											</div>
207
											</div>
197
										</div>
-
 
198
									</div>
208
										</div>
Línea 199... Línea 209...
199
								</div>';
209
									</div>
-
 
210
								</div>';
200
        return $this->content;
211
    return $this->content;
201
 
212
  }
202
    }
213
 
203
 
214
  public function overall_rating($courseID)
204
    public function overall_rating($courseID) {
215
  {
205
        global $CFG, $DB;
216
    global $CFG, $DB;
206
        $sql = "  SELECT AVG(rating) AS average
217
    $sql = "  SELECT AVG(rating) AS average
207
                  FROM {block_cesa_course_rating}
218
                  FROM {block_cesa_course_rating}
208
                  WHERE course = $courseID
219
                  WHERE course = $courseID
209
               ";
220
               ";
210
        $totalAverage = -1;
221
    $totalAverage = -1;
211
        if ($getAverage = $DB->get_record_sql($sql)) {
222
    if ($getAverage = $DB->get_record_sql($sql)) {
212
            $totalAverage = round($getAverage->average * 2) / 2;
223
      $totalAverage = round($getAverage->average * 2) / 2;
-
 
224
    }
213
        }
225
    return $totalAverage;
214
        return $totalAverage;
226
  }
215
    }
227
 
216
 
228
  public function count_ratings($courseID)
217
    public function count_ratings($courseID) {
229
  {
218
        global $CFG, $DB;
230
    global $CFG, $DB;
219
        $countRecords = $DB->count_records('block_cesa_course_rating', array('course'=>$courseID));
231
    $countRecords = $DB->count_records('block_cesa_course_rating', array('course' => $courseID));
220
        $countRatings = '';
232
    $countRatings = '';
221
        if ($countRecords > 0) {
233
    if ($countRecords > 0) {
222
            $countRatings = get_string ('rated_by', 'block_cesa_course_rating', $countRecords);
234
      $countRatings = get_string('rated_by', 'block_cesa_course_rating', $countRecords);
223
        } else {
235
    } else {
-
 
236
      $countRatings = get_string('rated_by_none', 'block_cesa_course_rating');
224
            $countRatings = get_string ('rated_by_none', 'block_cesa_course_rating');
237
    }
225
        }
238
    return $countRatings;
226
        return $countRatings;
239
  }
227
    }
240
  public function count_ratings_external($courseID)
228
    public function count_ratings_external($courseID) {
241
  {
229
        global $CFG, $DB;
242
    global $CFG, $DB;
-
 
243
    $countRecords = $DB->count_records('block_cesa_course_rating', array('course' => $courseID));
230
        $countRecords = $DB->count_records('block_cesa_course_rating', array('course'=>$courseID));
244
    return $countRecords;
231
        return $countRecords;
245
  }
232
    }
246
 
233
 
247
  public function get_specific_average($courseID, $rating)
234
    public function get_specific_average($courseID, $rating) {
248
  {
235
        global $CFG, $DB;
249
    global $CFG, $DB;
236
        $countOnlyRating        = $DB->count_records('block_cesa_course_rating', array('course'=>$courseID, 'rating'=>$rating));
250
    $countOnlyRating        = $DB->count_records('block_cesa_course_rating', array('course' => $courseID, 'rating' => $rating));
237
        $countExcludingRating   = $DB->count_records_sql(
251
    $countExcludingRating   = $DB->count_records_sql(
238
        "       SELECT COUNT(*)
252
      "       SELECT COUNT(*)
239
                FROM {block_cesa_course_rating}
-
 
Línea 240... Línea -...
240
                WHERE course = $courseID
-
 
241
                AND rating <> $rating
-
 
242
        ");
-
 
243
 
253
                FROM {block_cesa_course_rating}
244
        $countTotal             = $DB->count_records('block_cesa_course_rating', array('course'=>$courseID));
-
 
245
 
-
 
Línea -... Línea 254...
-
 
254
                WHERE course = $courseID
-
 
255
                AND rating <> $rating
-
 
256
        "
-
 
257
    );
246
        if($countTotal == 0) {
258
 
-
 
259
    $countTotal             = $DB->count_records('block_cesa_course_rating', array('course' => $courseID));
-
 
260
 
Línea 247... Línea 261...
247
          $result = '0';
261
    if ($countTotal == 0) {
-
 
262
      $result = '0';
Línea 248... Línea 263...
248
        } else {
263
    } else {
Línea 249... Línea 264...
249
          $result = $countOnlyRating / $countTotal * 100;
264
      $result = $countOnlyRating / $countTotal * 100;
250
        }
265
    }
Línea 251... Línea 266...
251
        return $result;
266
    return $result;
252
 
267
  }
253
    }
268
 
254
 
269
  public function submit_rating()
255
    public function submit_rating() {
270
  {
256
 
271
 
257
      global $CFG, $COURSE;
272
    global $CFG, $COURSE;
258
 
-
 
259
      $courseid = $COURSE->id;
-
 
260
      $context = get_context_instance(CONTEXT_COURSE, $courseid);
-
 
261
 
-
 
262
      $ccnStar =  '<span class="fa fa-star"></span>';
-
 
263
      $return =   '<form id="ccn-star-rate" method="post" action="'.$CFG->wwwroot.'/blocks/cesa_course_rating/rate_course.php">
273
 
-
 
274
    $courseid = $COURSE->id;
-
 
275
    $context = get_context_instance(CONTEXT_COURSE, $courseid);
-
 
276
 
-
 
277
    $ccnStar =  '<span class="fa fa-star"></span>';
-
 
278
    $return =   '<form id="ccn-star-rate" method="post" action="' . $CFG->wwwroot . '/blocks/cesa_course_rating/rate_course.php">
Línea 264... Línea 279...
264
                    <input name="id" type="hidden" value="'.$courseid.'" />
279
                    <input name="id" type="hidden" value="' . $courseid . '" />
265
                    <div class="ccn-star-rate-inner">';
-
 
266
                      for ($i = 5; $i >= 1; $i--) {
-
 
267
                        $printCcnStar = str_repeat($ccnStar, $i);
-
 
268
                        $return .='    <input required type="radio" id="stars-'.$i.'" name="rating" value="'.$i.'" /><label for="stars-'.$i.'"></label>';
-
 
269
                      }
-
 
270
      $return .= '  </div>
-
 
271
                    <button class="btn btn-primary" type="submit">'.get_string('rate_course', 'block_cesa_course_rating').'</button>
-
 
272
                  </form>';
-
 
273
      return $return;
-
 
274
    }
-
 
275
 
-
 
276
    public function external_star_rating($courseID) {
-
 
277
 
-
 
278
      $ccnStar      = '<li class="list-inline-item"><i class="fa fa-star"></i></li>';
-
 
279
      $ccnStarHalf  = '<li class="list-inline-item"><i class="fa fa-star-half-o"></i></li>';
-
 
280
      $ccnStarVoid  = '<li class="list-inline-item"><i class="fa fa-star-o"></i></li>';
-
 
281
      $ccnRating    = $this->overall_rating($courseID);
-
 
282
 
-
 
283
      if($ccnRating == 5) {
-
 
284
        $ccnStars = str_repeat($ccnStar, 5);
-
 
285
      } elseif($ccnRating == 4.5) {
-
 
286
        $ccnStars = str_repeat($ccnStar, 4) . str_repeat($ccnStarHalf, 1);
-
 
287
      } elseif($ccnRating == 4) {
-
 
288
        $ccnStars = str_repeat($ccnStar, 4) . str_repeat($ccnStarVoid, 1);
-
 
289
      } elseif($ccnRating == 3.5) {
-
 
290
        $ccnStars = str_repeat($ccnStar, 3) . str_repeat($ccnStarHalf, 1) . str_repeat($ccnStarVoid, 1);
-
 
291
      } elseif($ccnRating == 3) {
-
 
292
        $ccnStars = str_repeat($ccnStar, 3) . str_repeat($ccnStarVoid, 2);
-
 
293
      } elseif($ccnRating == 2.5) {
-
 
294
        $ccnStars = str_repeat($ccnStar, 2) . str_repeat($ccnStarHalf, 1)  . str_repeat($ccnStarVoid, 2);
-
 
295
      } elseif($ccnRating == 2) {
-
 
296
        $ccnStars = str_repeat($ccnStar, 2) . str_repeat($ccnStarVoid, 3);
280
                    <div class="ccn-star-rate-inner">';
Línea -... Línea 281...
-
 
281
    for ($i = 5; $i >= 1; $i--) {
-
 
282
      $printCcnStar = str_repeat($ccnStar, $i);
-
 
283
      $return .= '    <input required type="radio" id="stars-' . $i . '" name="rating" value="' . $i . '" /><label for="stars-' . $i . '"></label>';
-
 
284
    }
-
 
285
    $return .= '  </div>
-
 
286
                    <button class="btn btn-primary" type="submit">' . get_string('rate_course', 'block_cesa_course_rating') . '</button>
-
 
287
                  </form>';
-
 
288
    return $return;
-
 
289
  }
-
 
290
 
-
 
291
  public function external_star_rating($courseID)
-
 
292
  {
-
 
293
 
-
 
294
    $ccnStar      = '<li class="list-inline-item"><i class="fa fa-star"></i></li>';
-
 
295
    $ccnStarHalf  = '<li class="list-inline-item"><i class="fa fa-star-half-o"></i></li>';
-
 
296
    $ccnStarVoid  = '<li class="list-inline-item"><i class="fa fa-star-o"></i></li>';
-
 
297
    $ccnRating    = $this->overall_rating($courseID);
-
 
298
 
-
 
299
    if ($ccnRating == 5) {
-
 
300
      $ccnStars = str_repeat($ccnStar, 5);
-
 
301
    } elseif ($ccnRating == 4.5) {
-
 
302
      $ccnStars = str_repeat($ccnStar, 4) . str_repeat($ccnStarHalf, 1);
-
 
303
    } elseif ($ccnRating == 4) {
-
 
304
      $ccnStars = str_repeat($ccnStar, 4) . str_repeat($ccnStarVoid, 1);
-
 
305
    } elseif ($ccnRating == 3.5) {
-
 
306
      $ccnStars = str_repeat($ccnStar, 3) . str_repeat($ccnStarHalf, 1) . str_repeat($ccnStarVoid, 1);
-
 
307
    } elseif ($ccnRating == 3) {
-
 
308
      $ccnStars = str_repeat($ccnStar, 3) . str_repeat($ccnStarVoid, 2);
-
 
309
    } elseif ($ccnRating == 2.5) {
-
 
310
      $ccnStars = str_repeat($ccnStar, 2) . str_repeat($ccnStarHalf, 1)  . str_repeat($ccnStarVoid, 2);
297
      } elseif($ccnRating == 1.5) {
311
    } elseif ($ccnRating == 2) {