| 1 | 2 | simandl | <?php |
| 2 | | | |
| 3 | | | namespace Phem\Libraries\Forms\Model; |
| 4 | | | |
| 5 | | | /** |
| 6 | | | * @Entity(readOnly=true) @Table(name="povruc_form_group") |
| 7 | | | * |
| 8 | | | */ |
| 9 | | | class FormGroup |
| 10 | | | { |
| 11 | | | |
| 12 | | | /** @Id @Column(type="integer") */ |
| 13 | | | protected $id; |
| 14 | | | |
| 15 | | | /** |
| 16 | | | * @ManyToOne(targetEntity="Form",cascade={"persist"}) |
| 17 | | | * @JoinColumn(name="form", referencedColumnName="id") |
| 18 | | | */ |
| 19 | | | protected $form; |
| 20 | | | |
| 21 | | | /** @Column(type="string") */ |
| 22 | | | protected $name; |
| 23 | | | |
| 24 | | | /** @Column(type="string") */ |
| 25 | | | protected $caption; |
| 26 | | | |
| 27 | | | /** @Column(type="boolean") */ |
| 28 | | | protected $enabled; |
| 29 | | | |
| 30 | | | /** @Column(type="integer") */ |
| 31 | | | protected $order; |
| 32 | | | |
| 33 | | | /** |
| 34 | | | * |
| 35 | | | * @OneToMany(targetEntity="FormField", mappedBy="group",cascade={"all"}) |
| 36 | | | * @OrderBy({"order" = "ASC"}) |
| 37 | | | */ |
| 38 | | | protected $fields; |
| 39 | | | protected $show; |
| 40 | | | protected $defaultOpen; |
| 41 | | | |
| 42 | | | public function getId() |
| 43 | | | { |
| 44 | | | return $this->id; |
| 45 | | | } |
| 46 | | | |
| 47 | | | public function setId($id) |
| 48 | | | { |
| 49 | | | $this->id = $id; |
| 50 | | | } |
| 51 | | | |
| 52 | | | public function getForm() |
| 53 | | | { |
| 54 | | | return $this->form; |
| 55 | | | } |
| 56 | | | |
| 57 | | | public function setForm($form) |
| 58 | | | { |
| 59 | | | $this->form = $form; |
| 60 | | | } |
| 61 | | | |
| 62 | | | public function getName() |
| 63 | | | { |
| 64 | | | return $this->name; |
| 65 | | | } |
| 66 | | | |
| 67 | | | public function setName($name) |
| 68 | | | { |
| 69 | | | $this->name = $name; |
| 70 | | | } |
| 71 | | | |
| 72 | | | public function getCaption() |
| 73 | | | { |
| 74 | | | return $this->caption; |
| 75 | | | } |
| 76 | | | |
| 77 | | | public function setCaption($caption) |
| 78 | | | { |
| 79 | | | $this->caption = $caption; |
| 80 | | | } |
| 81 | | | |
| 82 | | | public function getEnabled() |
| 83 | | | { |
| 84 | | | return $this->enabled; |
| 85 | | | } |
| 86 | | | |
| 87 | | | public function setEnabled($enabled) |
| 88 | | | { |
| 89 | | | $this->enabled = $enabled; |
| 90 | | | } |
| 91 | | | |
| 92 | | | public function getOrder() |
| 93 | | | { |
| 94 | | | return $this->order; |
| 95 | | | } |
| 96 | | | |
| 97 | | | public function setOrder($order) |
| 98 | | | { |
| 99 | | | $this->order = $order; |
| 100 | | | } |
| 101 | | | |
| 102 | | | public function getFields() |
| 103 | | | { |
| 104 | | | return $this->fields; |
| 105 | | | } |
| 106 | | | |
| 107 | | | public function setFields($fields) |
| 108 | | | { |
| 109 | | | $this->fields = $fields; |
| 110 | | | } |
| 111 | | | |
| 112 | | | public function getShow() |
| 113 | | | { |
| 114 | | | return $this->show; |
| 115 | | | } |
| 116 | | | |
| 117 | | | public function setShow($show) |
| 118 | | | { |
| 119 | | | $this->show = $show; |
| 120 | | | } |
| 121 | | | |
| 122 | | | public function getDefaultOpen() |
| 123 | | | { |
| 124 | | | return $this->defaultOpen; |
| 125 | | | } |
| 126 | | | |
| 127 | | | public function setDefaultOpen($defaultOpen) |
| 128 | | | { |
| 129 | | | $this->defaultOpen = $defaultOpen; |
| 130 | | | } |
| 131 | | | |
| 132 | | | public function hasEnabledFields() |
| 133 | | | { |
| 134 | | | foreach ($this->getFields() as $field) |
| 135 | | | { |
| 136 | | | if ($field->getEnabled()) |
| 137 | | | { |
| 138 | | | return true; |
| 139 | | | } |
| 140 | | | } |
| 141 | | | return false; |
| 142 | | | } |
| 143 | | | |
| 144 | | | } |