/** * Displays homepage. * * @return mixed */ public function actionIndex() { if (!Yii::$app->getUser()->isGuest) { $itemRepository = new ItemRepository(); $tourRepository = new TourRepository(); $items = $itemRepository->getAllItemsData(); $tours = $tourRepository->getAllByNumber(); return $this->render('index', ['data' => $items, 'tours' => $tours]); } else { Yii::$app->session->setFlash('error', 'Please log in to acces the website features.'); $this->redirect(BASE_URL . 'web/index.php/site/login'); } }
public function actionMatierescompletes() { $item_id = isset($_POST['item_id']) && $_POST['item_id'] != '' ? $_POST['item_id'] : -1; $num_tour = isset($_POST['numero_tour']) && $_POST['numero_tour'] != '' ? $_POST['numero_tour'] : -1; if ($item_id != -1 && $num_tour != -1) { $tourRepository = new TourRepository(); $complete = $tourRepository->isMatiereComplete($num_tour, $item_id); echo $complete; } }