public function render()
 {
     $files = $this->webStorageIndex->getIndexByFilename();
     $this->view->setParameter('files', $files);
     $this->view->render();
     return $this;
 }
 public function deleteAction()
 {
     $id = empty($_GET['id']) ? '' : mysql_escape_string($_GET['id']);
     if ($this->webStorageIndex->indexHasId($id)) {
         $this->view->setParameter('file', $this->webStorageIndex->getIndexById($id));
         $timesheet = new Timesheet($id);
         if (isset($_POST['ispost']) && '1' == $_POST['ispost'] && isset($_POST['confirm_delete']) && '1' == $_POST['confirm_delete']) {
             $timesheet->delete();
             $this->redirectTo('/');
         } else {
             $this->view->setParameter('timesheet', $timesheet);
         }
     } else {
         $this->view->setTemplate('404_timesheet');
     }
 }
Example #3
0
 public function __construct($id)
 {
     $this->webStorageIndex = WebStorageIndex::getInstance();
     if ($this->webStorageIndex->indexHasId($id)) {
         $this->info = $this->webStorageIndex->getIndexById($id);
         $this->id = $id;
         $this->extractDataTimesheet(Yaml::parse(file_get_contents($this->info['absolutePath'])));
     } else {
         throw new MyTimesheetException('Timesheet with id "' . $id . '" does not exists in index.');
     }
 }
 public function __construct()
 {
     parent::__construct();
     $this->webStorageIndex = WebStorageIndex::getInstance();
 }
 public function preAction()
 {
     $this->webStorageIndex = WebStorageIndex::getInstance();
 }