/**
  * This method controls what happens when you move to /dashboard/index in your app.
  */
 public function index($pageToShow = 0)
 {
     $page = false;
     if (isset($_POST['suggestion'])) {
         $suggestion = $_POST['suggestion'];
     } else {
         $suggestion = '';
     }
     if (isset($pageToShow)) {
         $page = $pageToShow;
     }
     if (isset($_POST['itemsToShow'])) {
         $itemsToShow = $_POST['itemsToShow'];
     } else {
         $itemsToShow = 3;
     }
     if (isset($_POST['orderBy'])) {
         $orderBy = $_POST['orderBy'];
     } else {
         $orderBy = 'material_id';
     }
     if (!$page) {
         $start = 0;
         $page = 1;
     } else {
         $start = ($page - 1) * $itemsToShow;
     }
     $numTotalRegister = MaterialModel::getNumRowAllMaterialsSuggested($suggestion);
     $totalPages = ceil($numTotalRegister / $itemsToShow);
     $this->View->render('dashboard/index', array('totalPages' => $totalPages, 'page' => $page, 'suggestion' => $suggestion, 'itemsToShow' => $itemsToShow, 'orderBy' => $orderBy, 'oeuvres' => OeuvreModel::getAllOeuvreByEmployee(Session::get('user_id')), 'oeuvres_materials' => DashboardModel::getAllOeuvreMaterials(), 'oeuvres_photos' => DashboardModel::getAllOeuvrePhotos(), 'materials' => MaterialModel::getMaterialsSuggestedPaginatedOrderBy($suggestion, $start, $itemsToShow, $orderBy)));
 }
 /**
  * This method controls what happens when you move to /dashboard/index in your app.
  */
 public function index()
 {
     $this->View->render('myOeuvre/index', array('myPhotoOeuvre' => OeuvreModel::getAllPhotoOeuvreByUserId()));
 }
 /**
  * This method controls what happens when you move to /oeuvre/delete(/XX) in your app.
  * Deletes a oeuvre. In a real application a deletion via GET/URL is not recommended, but for demo purposes it's
  * totally okay.
  * @param int $oeuvre_id id of the oeuvre
  */
 public function delete($oeuvre_id)
 {
     OeuvreModel::deleteOeuvre($oeuvre_id);
     Redirect::to('oeuvre');
 }