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