@@ -124,7 +124,7 @@ |
||
| 124 | 124 | public function actionCreate(ArrayHash $program) |
| 125 | 125 | { |
| 126 | 126 | try { |
| 127 | - $result = false; |
|
| 127 | + $result = false; |
|
| 128 | 128 | $this->logInfo('Storing new program.'); |
| 129 | 129 | |
| 130 | 130 | $result = $this->getProgramRepository()->create($program); |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | public function setDefaults(BlockEntity $defaults): self |
| 103 | 103 | { |
| 104 | - $defaults = $this->guardDefaults($defaults); |
|
| 104 | + $defaults = $this->guardDefaults($defaults); |
|
| 105 | 105 | |
| 106 | 106 | $this['blockForm']->setDefaults($defaults->toArray()); |
| 107 | 107 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | ->setAttribute('size', 10) |
| 141 | 141 | ->setAttribute('placeholder', 0); |
| 142 | 142 | $form->addCheckbox('program') |
| 143 | - ->setDefaultValue(1); |
|
| 143 | + ->setDefaultValue(1); |
|
| 144 | 144 | $form->addCheckbox('display_progs') |
| 145 | 145 | ->setDefaultValue(0); |
| 146 | 146 | $form->addSelect('category', 'Kategorie:', $this->buildCategorySelect()); |
@@ -199,19 +199,19 @@ discard block |
||
| 199 | 199 | return $selectContent; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - /** |
|
| 203 | - * @param BlockEntity $defaults |
|
| 204 | - * @return BlockEntity |
|
| 205 | - */ |
|
| 202 | + /** |
|
| 203 | + * @param BlockEntity $defaults |
|
| 204 | + * @return BlockEntity |
|
| 205 | + */ |
|
| 206 | 206 | protected function guardDefaults(BlockEntity $defaults): BlockEntity |
| 207 | - { |
|
| 208 | - if(!array_key_exists($defaults->category, $this->buildCategorySelect()) ) |
|
| 209 | - { |
|
| 210 | - $defaults->category = 0; |
|
| 211 | - } |
|
| 212 | - |
|
| 213 | - return $defaults; |
|
| 214 | - } |
|
| 207 | + { |
|
| 208 | + if(!array_key_exists($defaults->category, $this->buildCategorySelect()) ) |
|
| 209 | + { |
|
| 210 | + $defaults->category = 0; |
|
| 211 | + } |
|
| 212 | + |
|
| 213 | + return $defaults; |
|
| 214 | + } |
|
| 215 | 215 | |
| 216 | 216 | /** |
| 217 | 217 | * @return BlockRepository |
@@ -10,9 +10,9 @@ |
||
| 10 | 10 | interface IProgramFormFactory |
| 11 | 11 | { |
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * @return \App\Components\Forms\ProgramForm |
|
| 15 | - */ |
|
| 16 | - public function create(): ProgramForm; |
|
| 13 | + /** |
|
| 14 | + * @return \App\Components\Forms\ProgramForm |
|
| 15 | + */ |
|
| 16 | + public function create(): ProgramForm; |
|
| 17 | 17 | |
| 18 | 18 | } |
@@ -10,9 +10,9 @@ |
||
| 10 | 10 | interface IBlockFormFactory |
| 11 | 11 | { |
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * @return \App\Components\Forms\BlockForm |
|
| 15 | - */ |
|
| 16 | - public function create(): BlockForm; |
|
| 13 | + /** |
|
| 14 | + * @return \App\Components\Forms\BlockForm |
|
| 15 | + */ |
|
| 16 | + public function create(): BlockForm; |
|
| 17 | 17 | |
| 18 | 18 | } |
@@ -76,24 +76,24 @@ discard block |
||
| 76 | 76 | ->fetchAll(); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - /** |
|
| 80 | - * @param int $id |
|
| 81 | - * @return BlockEntity |
|
| 82 | - */ |
|
| 79 | + /** |
|
| 80 | + * @param int $id |
|
| 81 | + * @return BlockEntity |
|
| 82 | + */ |
|
| 83 | 83 | public function find($id): BlockEntity |
| 84 | 84 | { |
| 85 | 85 | $block = parent::find($id); |
| 86 | 86 | return $this->hydrate($block); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - /** |
|
| 90 | - * @param IEntity $entity |
|
| 91 | - * @return bool|mixed |
|
| 92 | - * @throws Exception |
|
| 93 | - */ |
|
| 89 | + /** |
|
| 90 | + * @param IEntity $entity |
|
| 91 | + * @return bool|mixed |
|
| 92 | + * @throws Exception |
|
| 93 | + */ |
|
| 94 | 94 | public function save(IEntity $entity) |
| 95 | 95 | { |
| 96 | - $this->guardToGreaterThanFrom($entity->from, $entity->to); |
|
| 96 | + $this->guardToGreaterThanFrom($entity->from, $entity->to); |
|
| 97 | 97 | |
| 98 | 98 | if ($entity->getId() === null) { |
| 99 | 99 | $values = $entity->toArray(); |
@@ -251,10 +251,10 @@ discard block |
||
| 251 | 251 | ->fetch(); |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | - /** |
|
| 255 | - * @param $values |
|
| 256 | - * @return BlockEntity |
|
| 257 | - */ |
|
| 254 | + /** |
|
| 255 | + * @param $values |
|
| 256 | + * @return BlockEntity |
|
| 257 | + */ |
|
| 258 | 258 | public function hydrate($values): BlockEntity |
| 259 | 259 | { |
| 260 | 260 | $entity = new BlockEntity(); |
@@ -268,32 +268,32 @@ discard block |
||
| 268 | 268 | return $entity; |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | - /** |
|
| 272 | - * @param $block |
|
| 273 | - * @return mixed |
|
| 274 | - */ |
|
| 271 | + /** |
|
| 272 | + * @param $block |
|
| 273 | + * @return mixed |
|
| 274 | + */ |
|
| 275 | 275 | public function transform($block) |
| 276 | - { |
|
| 277 | - $block->from = date('H:i:s', mktime($block->start_hour, $block->start_minute, 0, 0, 0, 0)); |
|
| 278 | - $block->to = date('H:i:s', mktime($block->end_hour, $block->end_minute, 0, 0, 0, 0)); |
|
| 279 | - $block->meeting = $this->getMeetingId(); |
|
| 280 | - $block->program = strval($block->program) ?: '0'; |
|
| 281 | - $block->display_progs = strval($block->display_progs) ?: '0'; |
|
| 282 | - |
|
| 283 | - unset($block->start_hour); |
|
| 284 | - unset($block->end_hour); |
|
| 285 | - unset($block->start_minute); |
|
| 286 | - unset($block->end_minute); |
|
| 287 | - unset($block->backlink); |
|
| 288 | - |
|
| 289 | - return $block; |
|
| 290 | - } |
|
| 291 | - |
|
| 292 | - /** |
|
| 293 | - * @param $item |
|
| 294 | - * @param $id |
|
| 295 | - * @return mixed |
|
| 296 | - */ |
|
| 276 | + { |
|
| 277 | + $block->from = date('H:i:s', mktime($block->start_hour, $block->start_minute, 0, 0, 0, 0)); |
|
| 278 | + $block->to = date('H:i:s', mktime($block->end_hour, $block->end_minute, 0, 0, 0, 0)); |
|
| 279 | + $block->meeting = $this->getMeetingId(); |
|
| 280 | + $block->program = strval($block->program) ?: '0'; |
|
| 281 | + $block->display_progs = strval($block->display_progs) ?: '0'; |
|
| 282 | + |
|
| 283 | + unset($block->start_hour); |
|
| 284 | + unset($block->end_hour); |
|
| 285 | + unset($block->start_minute); |
|
| 286 | + unset($block->end_minute); |
|
| 287 | + unset($block->backlink); |
|
| 288 | + |
|
| 289 | + return $block; |
|
| 290 | + } |
|
| 291 | + |
|
| 292 | + /** |
|
| 293 | + * @param $item |
|
| 294 | + * @param $id |
|
| 295 | + * @return mixed |
|
| 296 | + */ |
|
| 297 | 297 | private function setIdentity($item, $id) |
| 298 | 298 | { |
| 299 | 299 | $ref = new ClassType($item); |
@@ -304,17 +304,17 @@ discard block |
||
| 304 | 304 | return $item; |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | - /** |
|
| 308 | - * @param date $from |
|
| 309 | - * @param date $to |
|
| 310 | - * @return void |
|
| 311 | - * @throws Exception |
|
| 312 | - */ |
|
| 313 | - private function guardToGreaterThanFrom($from, $to) |
|
| 314 | - { |
|
| 315 | - if($from > $to) { |
|
| 316 | - throw new Exception('Starting time is greater then finishing time.'); |
|
| 317 | - } |
|
| 318 | - } |
|
| 307 | + /** |
|
| 308 | + * @param date $from |
|
| 309 | + * @param date $to |
|
| 310 | + * @return void |
|
| 311 | + * @throws Exception |
|
| 312 | + */ |
|
| 313 | + private function guardToGreaterThanFrom($from, $to) |
|
| 314 | + { |
|
| 315 | + if($from > $to) { |
|
| 316 | + throw new Exception('Starting time is greater then finishing time.'); |
|
| 317 | + } |
|
| 318 | + } |
|
| 319 | 319 | |
| 320 | 320 | } |