Overview

Namespaces

  • App
    • Components
    • Interfaces
    • Lib
      • Files
      • Forms
        • Controls
      • Html
      • Repair
      • Statics
    • Model
    • Modules
      • BaseModule
        • Presenters
      • PartnersModule
        • Presenters
      • ProductModule
        • Presenters
      • SaleModule
        • Model
        • Presenters
      • SettingsModule
        • Model
        • Presenters
      • StoreModule
        • Model
        • Presenters
    • Presenters
    • Router
  • PHP

Classes

  • DateTime
  • SplFileInfo

Interfaces

  • ArrayAccess
  • Countable
  • Exception
  • Iterator
  • Traversable
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Download
 1: <?php
 2: 
 3: /**
 4:  * Project sberp
 5:  *
 6:  * @file Component
 7:  * @author Jaromír Polášek
 8:  * @version 0.7.1.FORM
 9:  * Encoding UTF-8
10:  */
11: 
12: namespace App\Components;
13: 
14: use Nette\Application\UI\Control,
15:     Nette\ComponentModel\IContainer,
16:     App\Interfaces as I,
17:     App\Model\Action;
18: /**
19:  * Základní Komponenta. Obsahuje základní metody a proměné pro předání paramerů a vytvoření komponenty
20:  */
21: abstract class Component extends Control implements I\IComponent, I\Iparams {
22: 
23:     /** @var \App\Model\Action Objekt akce */
24:     protected $action;
25:     /** @var App\Lib\Table|App\Lib\Tree Objekt dat */
26:     protected $data;
27:     /** @var string Název komponenty */
28:     protected $name;
29:     /** @var Mixed Parametry předávané komponentě */
30:     protected $params;
31:     /** @var array Ovládaví prvky komponenty */
32:     protected $buttons = array();
33:     /** @var string $class CSS styl */
34:     protected $class = '';
35:     /** @var string výchozí šablona /*/
36:     protected $controlTemplate;
37:     
38:     /**
39:      * Konstruktor požaduje service Action a user, pro řízení přistupu k datům
40:      * @param \App\Component\Action $action
41:      * @param \App\Component\IContainer $parent
42:      * @param string $name
43:      */
44:     public function __construct(Action $action, IContainer $parent = NULL, $name = NULL) {
45:     parent::__construct($parent, $name);
46:     $this->action = $action;
47:     $this->controlTemplate = __DIR__ . '/templates/Component.latte';
48:     }
49: 
50:     /**
51:      * Hlavní metoda komponenty. předává šabloně data
52:      */
53:     public function render() {
54:     $template = $this->template;
55:     $template->setFile($this->controlTemplate);
56:     $template->name = $this->action->table->name;
57:     $template->desc = $this->action->table->desc;
58:     $template->source = $this->action->source;
59:     $template->buttons = $this->buttons;
60:     $template->class = $this->class;
61:     $template->data = $this->create();
62:     $template->render();
63:     }
64: 
65:     /**
66:      * Vytvoří komponentu
67:      */
68:     abstract function create();
69: 
70:     /**
71:      * Univerzální metoda pro předání parametru komponentě. 
72:      * @param Mixed $params
73:      */
74:     public function setParams($params) {
75:     $this->params = $params;
76:     $this->action->params = $this->params;
77:     }
78: }
79: 
sberp API API documentation generated by ApiGen