Overview

Namespaces

  • Budovy
  • Kdyby
    • BootstrapFormRenderer
      • DI
      • Latte
  • Nette
    • Application
      • Diagnostics
      • Responses
      • Routers
      • UI
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Diagnostics
      • Drivers
      • Reflection
      • Table
    • DI
      • Config
        • Adapters
      • Diagnostics
      • Extensions
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
      • Diagnostics
    • Iterators
    • Latte
      • Macros
    • Loaders
    • Localization
    • Mail
    • PhpGenerator
    • Reflection
    • Security
      • Diagnostics
    • Templating
    • Utils
  • NetteModule
  • Nextras
    • Datagrid
  • None
  • PHP
  • Tester
    • CodeCoverage
    • Runner
      • Output
  • Vodacek
    • Forms
      • Controls
  • WebLoader
    • Filter
    • Nette

Classes

  • AuthorizeScheduledTaskFactory
  • AuthorizeScheduledTaskPresenter
  • BasePresenter
  • BreakdownFactory
  • BreakdownPresenter
  • BreakdownRepository
  • BreakdownStatisticFactory
  • BreakdownStatisticPresenter
  • ContactBindingFactory
  • ContactbindingPresenter
  • ContactBindingRepository
  • ContactFactory
  • ContactPresenter
  • ContactRepository
  • DocumentFactory
  • DocumentPresenter
  • DocumentRepository
  • DocumentsDatagrid
  • DocumenttypeFactory
  • DocumenttypePresenter
  • DocumenttypeRepository
  • DownloadPresenter
  • EmailPresenter
  • ErrorPresenter
  • HomepagePresenter
  • OperationFactory
  • OperationPresenter
  • OperationRepository
  • PeriodicTaskFactory
  • PeriodicTaskPresenter
  • PeriodicTaskRealizationFactory
  • PeriodicTaskRealizationPresenter
  • PeriodicTaskRealizationRepository
  • PeriodicTaskRepository
  • PeriodicTaskStatisticFactory
  • PeriodicTaskStatisticPresenter
  • PlaceFactory
  • PlacePresenter
  • PlaceRepository
  • PriorityFactory
  • PriorityPresenter
  • PriorityRepository
  • Repository
  • RoleRepository
  • RouterFactory
  • ScheduledTaskFactory
  • ScheduledTaskPresenter
  • ScheduledTaskRealizationFactory
  • ScheduledTaskRealizationPresenter
  • ScheduledTaskRealizationRepository
  • ScheduledTaskRepository
  • ScheduledTaskStatisticFactory
  • ScheduledTaskStatisticPresenter
  • SignPresenter
  • UnitFactory
  • UnitPresenter
  • UnitRepository
  • UserFactory
  • UserManager
  • UserPresenter
  • UserRepository
  • Overview
  • Namespace
  • Class
  • Tree
  1: <?php
  2: namespace Budovy;
  3: 
  4: /**
  5:  * Sign in/out presenters.
  6:  */
  7: class OperationPresenter extends BasePresenter {
  8:     /** @var OperationRepository @inject */
  9:     public $operationRepository;
 10: 
 11:     /** @var ScheduledTaskRepository @inject */
 12:     public $scheduledTaskRepository;
 13: 
 14:     /** @var BreakdownRepository @inject */
 15:     public $breakdownRepository;
 16: 
 17:     /** @var PeriodicTaskRepository @inject */
 18:     public $periodicTaskRepository;
 19: 
 20:     /** @var OperationFactory @inject */
 21:     public $operationFactory;
 22: 
 23:     protected function createComponentGrid() {
 24:         $session = $this->getSession()->getSection('history');
 25:         $session->secoperation = (string)$this->getHttpRequest()->getUrl();
 26: 
 27:         return $this->operationFactory->createDataGrid();
 28:     }
 29: 
 30:     public function actionEdit($id) {
 31:         $item = $this->operationRepository->findById($id);
 32: 
 33:         if ($id > 0 && $item === false) {
 34:             $this->redirect('default');
 35:         }
 36: 
 37:         if ($id > 0) {
 38:             $this['editForm']->setDefaults($item);
 39:         } else {
 40:             $this['editForm']->setDefaults(array('daysbefore' => 7));
 41:         }
 42: 
 43:         $this->template->id = $id;
 44:     }
 45: 
 46:     public function renderPreview($id) {
 47:         $item = $this->operationRepository->findById($id);
 48: 
 49:         if ($item === false) {
 50:             $this->redirect('default');
 51:         }
 52: 
 53:         $this->template->periodicTaskRepository = $this->periodicTaskRepository;
 54:         $this->template->scheduledtasks = $this->scheduledTaskRepository->findBy(array('id_operation' => $item->id));
 55:         $this->template->periodictasks = $this->periodicTaskRepository->findBy(array('id_operation' => $item->id));
 56:         $this->template->breakdowns = $this->breakdownRepository->findBy(array('id_operation' => $item->id));
 57:         $this->template->data = $item;
 58:     }
 59: 
 60:     protected function createComponentEditForm() {
 61:         $session = $this->getSession()->getSection('history');
 62: 
 63:         if (isset($session->secoperation)) {
 64:             $backlink = $session->secoperation;
 65:         } else {
 66:             $backlink = $this->link('default');
 67:         }
 68: 
 69:         $form = $this->operationFactory->createEditForm($backlink);
 70:         $form->onSuccess[] = $this->editFormSubmitted;
 71: 
 72:         return $form;
 73:     }
 74: 
 75:     public function editFormSubmitted($form) {
 76:         $fdata = $form->getValues();
 77: 
 78:         $id = $this->getParameter('id');
 79: 
 80:         if ($id > 0) {
 81:             $this->operationRepository->updateById($id, $fdata);
 82: 
 83:             $this->flashMessage("Záznam byl upraven.", "success");
 84:         } else {
 85:             $this->operationRepository->insertData($fdata);
 86: 
 87:             $this->flashMessage("Záznam byl vložen.", "success");
 88:         }
 89: 
 90:         $session = $this->getSession()->getSection('history');
 91: 
 92:         if (isset($session->secoperation)) {
 93:             $backlink = $session->secoperation;
 94:         } else {
 95:             $backlink = $this->link('default');
 96:         }
 97: 
 98:         $this->redirectUrl($backlink);
 99:     }
100: 
101:     public function handleDelete($id) {
102:         try {
103:             $this->operationRepository->deleteById($id);
104:             $this->flashMessage("Záznam byl smazán.", "success");
105:         } catch (\PDOException $e) {
106:             $this->flashMessage("Záznam nelze smazat!", "error");
107:         }
108: 
109:         $this->redirect('this');
110:     }
111: }
API documentation generated by ApiGen 2.8.0