public function index() { $model = new \Models\Ratings(); $data['title'] = "Vaše příběhy"; $data['tales'] = $model->getUserRatingsAndTales(Session::get('userID')); View::renderTemplate('header', $data); View::render('users\\tales', $data, $error); View::renderTemplate('footer', $data); }
public function edit($ratingID) { $model = new \Models\Ratings(); $data['title'] = "Recenze"; $data['rating'] = $model->getRatingAndTale($ratingID); if (isset($_POST['submit'])) { $postdata = array('originality' => $_POST['originality'], 'theme' => $_POST['theme'], 'quality' => $_POST['quality']); $where = array('ratingID' => $data['rating'][0]->ratingID); $model->update($postdata, $where); Url::redirect('ratings'); } View::renderTemplate('header', $data); View::render('review\\ratingsEdit', $data, $error); View::renderTemplate('footer', $data); }
public function setToReview($taleID) { if (Session::get('role') != "admin") { Url::redirect(''); } $modelRatings = new \Models\Ratings(); $modelUsers = new \Models\Users(); $modelTales = new \Models\Tales(); $data['title'] = "Přiřadit recenzi"; $data['reviewers'] = $modelUsers->getReviewers(); $data['tale'] = $modelTales->getTale($taleID); if (isset($_POST['submit'])) { $postdata = array('reviewerID' => $_POST['reviewerID'], 'reviewTaleID' => $data['tale'][0]->taleID); $modelRatings->add($postdata); Url::redirect('admin'); } View::renderTemplate('header', $data); View::render('admin\\adminReview', $data); View::renderTemplate('footer', $data); }