<?php

use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;

defined('_JEXEC') or die('Restricted access');

class guruAdminViewguruReviews extends HtmlView
{
    public function viewReport($tpl = null)
    {
        $this->setLayout('report');
        parent::display($tpl);
    }

    public function viewContent($tpl = null)
    {
        $this->setLayout('content');
        parent::display($tpl);
    }

    public function display($tpl = null)
    {
        ToolbarHelper::publishList('publish', 'GURU_APROVE');
        ToolbarHelper::custom('pending', 'check', '', 'GURU_PENDING_REVIEW');
        ToolbarHelper::unpublishList();

        $this->items = $this->get('Items');
        $this->pagination = $this->get('Pagination');
        $this->state = $this->get('State');

        parent::display($tpl);
    }

    public function renderRatingScore($score)
    {
        $html = '<div class="rating-score">';
        for ($i = 0; $i < 5; $i++) {
            if ($i < $score) {
                $html .= '<label class="star-on"></label>';
            } else {
                $html .= '<label></label>';
            }
        }

        $html .= '</div>';

        return $html;
    }
}
