/**
  * This method controls what happens when you move to /note/index in your app.
  * Gets all notes (of the user).
  */
 public function index($pageToShow)
 {
     $itemsToShow = 3;
     $page = false;
     if (isset($pageToShow)) {
         $page = $pageToShow;
     }
     if (!$page) {
         $start = 0;
         $page = 1;
     } else {
         $start = ($page - 1) * $itemsToShow;
     }
     $numTotalRegister = MaterialModel::getNumRowAllMaterials();
     $totalPages = ceil($numTotalRegister / $itemsToShow);
     $this->View->render('material/index', array('totalPages' => $totalPages, 'page' => $page, 'itemsToShow' => $itemsToShow, 'orderBy' => "material_id", 'materials' => MaterialModel::getAllMaterialsPaginated($start, $itemsToShow)));
 }