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 Fields 
 7:  * @author Jaromír Polášek
 8:  * @version 0.7.1.FORM
 9:  * Encoding UTF-8
10:  */
11: 
12: namespace App\Lib;
13: 
14: use Nette\Database\Table\ActiveRow,
15:     App\Lib\Statics\Cons,
16:     App\Lib\Statics\Vars;
17: 
18: /**
19:  * Objekt 
20:  */
21: class Fields extends Container {
22: 
23:     /** Konstruktor vytváří Kontejner na vlastnosti jednotlivých polí */
24:     public function __construct(ActiveRow $table) {
25:     parent::__construct($table->related(Cons::TABLE_TABLE . '_' . Cons::TABLE_FIELDS)->order(Cons::COLUMN_SEQ, 'ASC'));
26:     dump($this->container);
27:     }
28:     
29:     
30:     /**
31:      * Emuluje Nette funkci where z Nette\Database\Table. Aplikuje Podmínky 
32:      * výběru na objekt Fields
33:      * @param type $condition
34:      * @param type $parameters
35:      * @return \App\Lib\Fields
36:      */
37: //    public function where($condition, $parameters = array()) {
38: //  if (is_array($condition) && $parameters === array()) { // where(array('column1' => 1, 'column2 > ?' => 2))
39: //      foreach ($condition as $key => $val) {
40: //      (is_int($key)) ? $this->where($val) : $this->where($key, $val);
41: //      }
42: //  }
43: //  //$codition = split(' ',$condition, 1);
44: //  //foreach ($this->container as $field) {
45: //    //  if ($field[$condition] )
46: ////    }
47: //  return $this;
48: //    }
49: 
50:     /**
51:      * Vytvoří pole vlastností
52:      * @param \Nette\Database\Table\ActiveRow $activeRow
53:      * @return array
54:      */
55:     private function setRow(ActiveRow $activeRow) {
56:     return array(
57:         Cons::COLUMN_NAME => $activeRow[Cons::COLUMN_NAME],
58:         Cons::COLUMN_FIELD => $activeRow[Cons::COLUMN_FIELD],
59:         Cons::COLUMN_TYPE => $activeRow[Cons::COLUMN_TYPE],
60:         Cons::COLUMN_LENGHT => $activeRow[Cons::COLUMN_LENGHT],
61:         Cons::COLUMN_RELATION => $activeRow[Cons::COLUMN_RELATION],
62:         Cons::COLUMN_REQUIRED => Vars::trueFalse($activeRow[Cons::COLUMN_REQUIRED]),
63:         Cons::COLUMN_READONLY => Vars::trueFalse($activeRow[Cons::COLUMN_READONLY]),
64:         Cons::COLUMN_DEFAULT => $activeRow[Cons::COLUMN_DEFAULT],
65:         Cons::COLUMN_DESC => $activeRow[Cons::COLUMN_DESC]
66:     );
67:     }
68: 
69: }
70: 
sberp API API documentation generated by ApiGen