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 DocumenttypePresenter extends BasePresenter {
 8:     /** @var Budovy\DocumentRepository @inject */
 9:     public $documentRepository;
10: 
11:     /** @var Budovy\DocumenttypeRepository @inject */
12:     public $documenttypeRepository;
13: 
14:     /** @var DocumenttypeFactory @inject */
15:     public $documenttypeFactory;
16: 
17:     protected function createComponentGrid() {
18:         $session = $this->getSession()->getSection('history');
19:         $session->secdoctype = (string)$this->getHttpRequest()->getUrl();
20: 
21:         return $this->documenttypeFactory->createDataGrid();
22:     }
23: 
24:     public function actionEdit($id) {
25:         $item = $this->documenttypeRepository->findById($id);
26: 
27:         if ($id > 0 && $item === false) {
28:             $this->redirect('default');
29:         }
30: 
31:         if ($id > 0) {
32:             $this['editForm']->setDefaults($item);
33:         }
34: 
35:         $this->template->id = $id;
36:     }
37: 
38:     protected function createComponentEditForm() {
39:         $session = $this->getSession()->getSection('history');
40: 
41:         if (isset($session->secdoctype)) {
42:             $backlink = $session->secdoctype;
43:         } else {
44:             $backlink = $this->link('default');
45:         }
46: 
47:         $form = $this->documenttypeFactory->createEditForm($backlink);
48:         $form->onSuccess[] = $this->editFormSubmitted;
49: 
50:         return $form;
51:     }
52: 
53:     public function editFormSubmitted($form) {
54:         $fdata = $form->getValues();
55: 
56:         $id = $this->getParameter('id');
57: 
58:         if ($id > 0) {
59:             $this->documenttypeRepository->updateById($id, $fdata);
60: 
61:             $this->flashMessage("Záznam byl upraven.", "success");
62:         } else {
63:             $this->documenttypeRepository->insertData($fdata);
64: 
65:             $this->flashMessage("Záznam byl vložen.", "success");
66:         }
67: 
68:         $session = $this->getSession()->getSection('history');
69: 
70:         if (isset($session->secdoctype)) {
71:             $backlink = $session->secdoctype;
72:         } else {
73:             $backlink = $this->link('default');
74:         }
75: 
76:         $this->redirectUrl($backlink);
77:     }
78: 
79:     public function handleDelete($id) {
80:         try {
81:             $this->documenttypeRepository->deleteById($id);
82:             $this->flashMessage("Záznam byl smazán.", "success");
83:         } catch (\PDOException $e) {
84:             $this->flashMessage("Záznam nelze smazat!", "error");
85:         }
86: 
87:         $this->redirect('this');
88:     }
89: }
API documentation generated by ApiGen 2.8.0