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: use Nette\Object;
  5: use Nette\Utils\Paginator;
  6: use Nette\Utils\Html;
  7: use Nette\Application\UI;
  8: use Kdyby\BootstrapFormRenderer\BootstrapRenderer;
  9: 
 10: class ContactBindingFactory extends Object {
 11:     /**
 12:      * @var ContactBindingRepository
 13:      */
 14:     private $contactBindingRepository;
 15: 
 16:     /**
 17:      * @var UnitRepository
 18:      */
 19:     private $unitRepository;
 20: 
 21:     /**
 22:      * @var OperationRepository
 23:      */
 24:     private $operationRepository;
 25: 
 26:     /**
 27:      * @var ContactRepository
 28:      */
 29:     private $contactRepository;
 30: 
 31:     /**
 32:      * @var PlaceRepository
 33:      */
 34:     protected $placeRepository;
 35: 
 36:     function __construct(ContactBindingRepository $contactBindingRepository, UnitRepository $unitRepository, OperationRepository $operationRepository, ContactRepository $contactRepository, PlaceRepository $placeRepository) {
 37:         $this->contactBindingRepository = $contactBindingRepository;
 38:         $this->unitRepository = $unitRepository;
 39:         $this->operationRepository = $operationRepository;
 40:         $this->contactRepository = $contactRepository;
 41:         $this->placeRepository = $placeRepository;
 42:     }
 43: 
 44:     function createDataGrid() {
 45:         $grid = new \Nextras\Datagrid\Datagrid;
 46: 
 47:         $grid->addColumn('contact', 'Kontakt')->enableSort();
 48:         $grid->addColumn('place', 'Umístění')->enableSort();
 49:         $grid->addColumn('unit', 'Jednotka')->enableSort();
 50:         $grid->addColumn('operation', 'Úkon')->enableSort();
 51: 
 52:         $grid->setDatasourceCallback(function ($filter, $order, Paginator $paginator = null) {
 53:             return $this->contactBindingRepository->getGridSelection($filter, $order, $paginator->page, $paginator->itemsPerPage);
 54:         });
 55: 
 56:         $grid->setFilterFormFactory(function () {
 57:             $form = new \Nette\Forms\Container;
 58: 
 59:             $form->addSelect('contact', 'Kontakt', array('' => '') + $this->contactRepository->getPairData());
 60:             $form->addSelect('place', 'Umístění', array('' => '') + $this->placeRepository->getPairData());
 61:             $form->addSelect('unit', 'Jednotka', array('' => '') + $this->unitRepository->getPairData());
 62:             $form->addSelect('operation', 'Operace', array('' => '') + $this->operationRepository->getPairData());
 63: 
 64:             $form->addSubmit('filter', 'Hledej');
 65:             $form->addSubmit('cancel', 'Zrušit');
 66: 
 67:             $pretyp = $form['filter']->getControlPrototype();
 68:             $pretyp->setName("button");
 69:             $pretyp->type = 'submit';
 70:             $pretyp->class = 'ico-btn';
 71:             $pretyp->create('i class="fa fa-search"');
 72: 
 73:             $pretyp = $form['cancel']->getControlPrototype();
 74:             $pretyp->setName("button");
 75:             $pretyp->type = 'submit';
 76:             $pretyp->class = 'ico-btn';
 77:             $pretyp->create('i class="fa fa-times-circle-o"');
 78: 
 79:             return $form;
 80:         });
 81: 
 82:         $grid->setPagination(20, function ($filter, $order) {
 83:             return $this->contactBindingRepository->getGridCount($filter);
 84:         });
 85: 
 86:         $grid->addCellsTemplate(__DIR__ . '/../templates/Contactbinding/grid.latte');
 87: 
 88:         return $grid;
 89:     }
 90: 
 91:     function createEditForm($backlink) {
 92:         $form = new UI\Form;
 93: 
 94:         $form->setRenderer(new BootstrapRenderer());
 95: 
 96:         $form->getElementPrototype()->class = 'form-horizontal';
 97: 
 98:         $form->addSelect('id_unit', 'Jednotka', $this->unitRepository->getPairData());
 99:         $form->addSelect('id_operation', 'Operace', $this->operationRepository->getPairData());
100:         $form->addSelect('id_contact', 'Kontakt', $this->contactRepository->getPairData());
101: 
102:         $form->addSubmit('saving', 'Uložit a zpět')
103:         ->setAttribute('class', 'btn btn-primary');
104: 
105:         $form->addSubmit('back')
106:         ->setAttribute('class', 'btn btn-inverse')
107:         ->getControlPrototype()
108:         ->setName('a')
109:         ->href($backlink)
110:         ->add(Html::el('i')->class('fa fa-reply'))
111:         ->add(Html::el('span', ' Zpět'));
112: 
113:         return $form;
114:     }
115: }
API documentation generated by ApiGen 2.8.0