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: class PlaceRepository extends Repository {
 5:     /**
 6:      * Vraci data v poli ID => nazev
 7:      *
 8:      * @return array
 9:      */
10:     function getPairData() {
11:         return $this->getTable()->select('id, name')->order('name ASC')->fetchPairs('id', 'name');
12:     }
13: 
14:     /**
15:      * Vrati selection pro datagrid
16:      *
17:      * @param array $filter
18:      * @param array $order
19:      * @param int $page
20:      * @param int $limit
21:      * @return \Nette\Database\Table\Selection
22:      */
23:     function getGridSelection($filter, $order, $page, $limit) {
24:         $selection = $this->getTable();
25: 
26:         if (isset($order[0]))
27:             $selection->order(implode(' ', $order));
28: 
29:         $selection->page($page, $limit);
30: 
31:         return $this->addGridFilter($selection, $filter);
32:     }
33: 
34:     /**
35:      * Vrati pocet zaznamu pro datagrid
36:      *
37:      * @param array $filter
38:      * @return int
39:      */
40:     function getGridCount($filter) {
41:         $selection = $this->getTable()->select('COUNT(*) AS cnt');
42: 
43:         $result = $this->addGridFilter($selection, $filter)->fetch();
44: 
45:         return $result->cnt;
46:     }
47: 
48:     /**
49:      * Omezi selection na zaklade filtru pro datagrid
50:      *
51:      * @param \Nette\Database\Table\Selection $selection
52:      * @param Array $filter
53:      * @return \Nette\Database\Table\Selection
54:      */
55:     private function addGridFilter(\Nette\Database\Table\Selection $selection, $filter) {
56:         $filters = array();
57: 
58:         foreach ($filter as $k => $v) {
59:             $filters[$k . ' LIKE ?'] = "%$v%";
60:         }
61: 
62:         return $selection->where($filters);
63:     }
64: }
API documentation generated by ApiGen 2.8.0