@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | - $user_labels = is_array($data['meta']) ? $data['meta'] : []; |
|
| 2 | + $user_labels = is_array($data['meta']) ? $data['meta'] : []; |
|
| 3 | 3 | $options = !empty($data['options']) ? $data['options'] : []; |
| 4 | 4 | |
| 5 | - $uid = $data['key'] . $data['unique_id']; |
|
| 6 | - if($asset_classname){ |
|
| 5 | + $uid = $data['key'] . $data['unique_id']; |
|
| 6 | + if ($asset_classname) { |
|
| 7 | 7 | $name = 'assetInjectionform[' . $asset_classname . '][' . $data['unique_id'] . '][' . $data['key'] . ']'; |
| 8 | 8 | $nameMeta = "assetInjectionform[{$asset_classname}][{$data['unique_id']}][_meta_][{$data['key']}]"; |
| 9 | - }else{ |
|
| 9 | + }else { |
|
| 10 | 10 | $name = $data['key']; |
| 11 | 11 | $nameMeta = "_meta_[{$data['key']}]"; |
| 12 | 12 | } |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | if($asset_classname){ |
| 7 | 7 | $name = 'assetInjectionform[' . $asset_classname . '][' . $data['unique_id'] . '][' . $data['key'] . ']'; |
| 8 | 8 | $nameMeta = "assetInjectionform[{$asset_classname}][{$data['unique_id']}][_meta_][{$data['key']}]"; |
| 9 | - }else{ |
|
| 9 | + } else{ |
|
| 10 | 10 | $name = $data['key']; |
| 11 | 11 | $nameMeta = "_meta_[{$data['key']}]"; |
| 12 | 12 | } |
@@ -9,17 +9,17 @@ |
||
| 9 | 9 | {{ $datastore->render('content') }} |
| 10 | 10 | |
| 11 | 11 | |
| 12 | - <?php if($children):?> |
|
| 12 | + <?php if ($children):?> |
|
| 13 | 13 | <nav> |
| 14 | 14 | <div class="nav nav-tabs" id="asset-tab" role="tablist"> |
| 15 | - <?php foreach($children as $idx => $child): ?> |
|
| 16 | - <a class="nav-item nav-link<?php echo $idx === 0 ?' active' : '';?>" id="child-{{ $idx }}-tab" data-toggle="tab" href="#asset-{{ $idx }}" role="tab" aria-controls="asset-{{ $idx }}" aria-selected="true">{{ $child->prop('title') }}</a> |
|
| 15 | + <?php foreach ($children as $idx => $child): ?> |
|
| 16 | + <a class="nav-item nav-link<?php echo $idx === 0 ? ' active' : ''; ?>" id="child-{{ $idx }}-tab" data-toggle="tab" href="#asset-{{ $idx }}" role="tab" aria-controls="asset-{{ $idx }}" aria-selected="true">{{ $child->prop('title') }}</a> |
|
| 17 | 17 | <?php endforeach; ?> |
| 18 | 18 | |
| 19 | 19 | </div> |
| 20 | 20 | </nav> |
| 21 | 21 | <div class="tab-content" id="asset-tabContent"> |
| 22 | - <?php foreach($children as $idx => $child): ?> |
|
| 22 | + <?php foreach ($children as $idx => $child): ?> |
|
| 23 | 23 | <div class="tab-pane fade<?php echo $idx === 0 ? ' show active' : ''; ?>" id="asset-{{ $idx }}" role="tabpanel" aria-labelledby="asset-{{ $idx }}-tab"> |
| 24 | 24 | {{ $child->prop('content')}} |
| 25 | 25 | </div> |
@@ -11,37 +11,37 @@ |
||
| 11 | 11 | { |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | - * @return string |
|
| 15 | - */ |
|
| 16 | - public function getEditButtonAttribute() |
|
| 17 | - { |
|
| 18 | - return '<a href="'.route('admin.ams.content.update', ['asset' => $this->content_path, 'id' => $this->id]).'" data-toggle="tooltip" data-placement="top" title="'.__('buttons.general.crud.edit').'" class="btn btn-primary"><i class="fas fa-edit"></i></a>'; |
|
| 14 | + * @return string |
|
| 15 | + */ |
|
| 16 | + public function getEditButtonAttribute() |
|
| 17 | + { |
|
| 18 | + return '<a href="'.route('admin.ams.content.update', ['asset' => $this->content_path, 'id' => $this->id]).'" data-toggle="tooltip" data-placement="top" title="'.__('buttons.general.crud.edit').'" class="btn btn-primary"><i class="fas fa-edit"></i></a>'; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | - * @return string |
|
| 23 | - */ |
|
| 24 | - public function getDeleteButtonAttribute() |
|
| 25 | - { |
|
| 22 | + * @return string |
|
| 23 | + */ |
|
| 24 | + public function getDeleteButtonAttribute() |
|
| 25 | + { |
|
| 26 | 26 | |
| 27 | - return '<a href="'.route('admin.ams.content.destroy', $this).'" |
|
| 27 | + return '<a href="'.route('admin.ams.content.destroy', $this).'" |
|
| 28 | 28 | data-method="delete" |
| 29 | 29 | data-trans-button-cancel="'.__('buttons.general.cancel').'" |
| 30 | 30 | data-trans-button-confirm="'.__('buttons.general.crud.delete').'" |
| 31 | 31 | data-trans-title="'.__('strings.backend.general.are_you_sure').'" |
| 32 | 32 | class="btn btn-danger"><i class="fas fa-trash" data-toggle="tooltip" data-placement="top" title="'.__('buttons.general.crud.delete').'"></i></a> '; |
| 33 | 33 | |
| 34 | - } |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @return string |
|
| 38 | - */ |
|
| 39 | - public function getActionButtonsAttribute() |
|
| 40 | - { |
|
| 36 | + /** |
|
| 37 | + * @return string |
|
| 38 | + */ |
|
| 39 | + public function getActionButtonsAttribute() |
|
| 40 | + { |
|
| 41 | 41 | |
| 42 | 42 | if($this->id) |
| 43 | 43 | { |
| 44 | - return '<div class="btn-group" role="group" aria-label="'.__('labels.backend.access.users.user_actions').'"> |
|
| 44 | + return '<div class="btn-group" role="group" aria-label="'.__('labels.backend.access.users.user_actions').'"> |
|
| 45 | 45 | '.$this->edit_button.' |
| 46 | 46 | '.$this->delete_button.' |
| 47 | 47 | </div>'; |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | public function getEditButtonAttribute() |
| 17 | 17 | { |
| 18 | - return '<a href="'.route('admin.ams.content.update', ['asset' => $this->content_path, 'id' => $this->id]).'" data-toggle="tooltip" data-placement="top" title="'.__('buttons.general.crud.edit').'" class="btn btn-primary"><i class="fas fa-edit"></i></a>'; |
|
| 18 | + return '<a href="' . route('admin.ams.content.update', ['asset' => $this->content_path, 'id' => $this->id]) . '" data-toggle="tooltip" data-placement="top" title="' . __('buttons.general.crud.edit') . '" class="btn btn-primary"><i class="fas fa-edit"></i></a>'; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | /** |
@@ -24,12 +24,12 @@ discard block |
||
| 24 | 24 | public function getDeleteButtonAttribute() |
| 25 | 25 | { |
| 26 | 26 | |
| 27 | - return '<a href="'.route('admin.ams.content.destroy', $this).'" |
|
| 27 | + return '<a href="' . route('admin.ams.content.destroy', $this) . '" |
|
| 28 | 28 | data-method="delete" |
| 29 | - data-trans-button-cancel="'.__('buttons.general.cancel').'" |
|
| 30 | - data-trans-button-confirm="'.__('buttons.general.crud.delete').'" |
|
| 31 | - data-trans-title="'.__('strings.backend.general.are_you_sure').'" |
|
| 32 | - class="btn btn-danger"><i class="fas fa-trash" data-toggle="tooltip" data-placement="top" title="'.__('buttons.general.crud.delete').'"></i></a> '; |
|
| 29 | + data-trans-button-cancel="'.__('buttons.general.cancel') . '" |
|
| 30 | + data-trans-button-confirm="'.__('buttons.general.crud.delete') . '" |
|
| 31 | + data-trans-title="'.__('strings.backend.general.are_you_sure') . '" |
|
| 32 | + class="btn btn-danger"><i class="fas fa-trash" data-toggle="tooltip" data-placement="top" title="'.__('buttons.general.crud.delete') . '"></i></a> '; |
|
| 33 | 33 | |
| 34 | 34 | } |
| 35 | 35 | |
@@ -39,34 +39,34 @@ discard block |
||
| 39 | 39 | public function getActionButtonsAttribute() |
| 40 | 40 | { |
| 41 | 41 | |
| 42 | - if($this->id) |
|
| 42 | + if ($this->id) |
|
| 43 | 43 | { |
| 44 | - return '<div class="btn-group" role="group" aria-label="'.__('labels.backend.access.users.user_actions').'"> |
|
| 45 | - '.$this->edit_button.' |
|
| 46 | - '.$this->delete_button.' |
|
| 44 | + return '<div class="btn-group" role="group" aria-label="' . __('labels.backend.access.users.user_actions') . '"> |
|
| 45 | + '.$this->edit_button . ' |
|
| 46 | + '.$this->delete_button . ' |
|
| 47 | 47 | </div>'; |
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - public function getContentPathAttribute(){ |
|
| 51 | + public function getContentPathAttribute() { |
|
| 52 | 52 | return Helpers::getPath($this->type); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | |
| 56 | - public function getDatastoreAttribute(){ |
|
| 57 | - if($this->id){ |
|
| 56 | + public function getDatastoreAttribute() { |
|
| 57 | + if ($this->id) { |
|
| 58 | 58 | return DatastoreFactory::getAsset($this->type, $this->id); |
| 59 | 59 | } |
| 60 | - if($this->type){ |
|
| 60 | + if ($this->type) { |
|
| 61 | 61 | return DatastoreFactory::dispence($this->type); |
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - public function getRouteAttribute(){ |
|
| 65 | + public function getRouteAttribute() { |
|
| 66 | 66 | return $this->type ? Helpers::callStatic($this->type, 'route', [$this]) : null; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - public function routeChild($parentSlug){ |
|
| 69 | + public function routeChild($parentSlug) { |
|
| 70 | 70 | return $this->type ? Helpers::callStatic($this->type, 'route', [$this, $parentSlug]) : null; |
| 71 | 71 | |
| 72 | 72 | } |
@@ -17,10 +17,10 @@ discard block |
||
| 17 | 17 | protected $table = 'datastore'; |
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | - * @var array |
|
| 21 | - */ |
|
| 22 | - protected $dates = [ |
|
| 23 | - 'start_date', |
|
| 20 | + * @var array |
|
| 21 | + */ |
|
| 22 | + protected $dates = [ |
|
| 23 | + 'start_date', |
|
| 24 | 24 | 'end_date', |
| 25 | 25 | 'updated_at', |
| 26 | 26 | 'created_at' |
@@ -28,9 +28,9 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | public function properties() |
| 31 | - { |
|
| 32 | - return $this->hasMany(Datastore::class); |
|
| 33 | - } |
|
| 31 | + { |
|
| 32 | + return $this->hasMany(Datastore::class); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | 35 | public function assets() |
| 36 | 36 | { |
@@ -53,14 +53,14 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | - * The has Many Relationship |
|
| 57 | - * |
|
| 58 | - * @var array |
|
| 59 | - */ |
|
| 60 | - public function comments() |
|
| 61 | - { |
|
| 62 | - return $this->hasMany(DatastoreComments::class)->whereNull('parent_id'); |
|
| 63 | - } |
|
| 56 | + * The has Many Relationship |
|
| 57 | + * |
|
| 58 | + * @var array |
|
| 59 | + */ |
|
| 60 | + public function comments() |
|
| 61 | + { |
|
| 62 | + return $this->hasMany(DatastoreComments::class)->whereNull('parent_id'); |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | 65 | |
| 66 | 66 | |
@@ -42,11 +42,11 @@ |
||
| 42 | 42 | return $this->hasOne(DatastorePages::class, 'asset'); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - public function items(){ |
|
| 45 | + public function items() { |
|
| 46 | 46 | return $this->hasMany(DatastoreDatastore::class, 'datastore2_id', 'id'); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public function parents(){ |
|
| 49 | + public function parents() { |
|
| 50 | 50 | return $this->hasManyThrough(self::class, DatastoreDatastore::class, 'datastore_id', 'id', 'id', 'datastore2_id'); |
| 51 | 51 | |
| 52 | 52 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $this->ownDatastore[] = self::getAssetById($ds->id); |
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | - }else{ |
|
| 83 | + } else{ |
|
| 84 | 84 | $this->__model = new DatastoreModel(); |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -150,20 +150,16 @@ discard block |
||
| 150 | 150 | if ($k == 'value_equals') |
| 151 | 151 | { |
| 152 | 152 | $this->__value_equals = $v; |
| 153 | - } |
|
| 154 | - else if ($k == 'status_equals') |
|
| 153 | + } else if ($k == 'status_equals') |
|
| 155 | 154 | { |
| 156 | 155 | $this->__status_equals = $v; |
| 157 | - } |
|
| 158 | - else if ($k == 'start_date') |
|
| 156 | + } else if ($k == 'start_date') |
|
| 159 | 157 | { |
| 160 | 158 | $this->__start_date = $v; |
| 161 | - } |
|
| 162 | - else if ($k == 'end_date') |
|
| 159 | + } else if ($k == 'end_date') |
|
| 163 | 160 | { |
| 164 | 161 | $this->__end_date = $v; |
| 165 | - } |
|
| 166 | - else |
|
| 162 | + } else |
|
| 167 | 163 | { |
| 168 | 164 | $this->$k = (isset($this->$k)) ? $this->$k : $v; |
| 169 | 165 | } |
@@ -229,8 +225,7 @@ discard block |
||
| 229 | 225 | } |
| 230 | 226 | } |
| 231 | 227 | //echo '<pre>$this->ownDatastore: '; print_r($this->ownDatastore); echo '</pre>'; die(); |
| 232 | - } |
|
| 233 | - else |
|
| 228 | + } else |
|
| 234 | 229 | { |
| 235 | 230 | // nope - net to create some datastore beans to represent our properties |
| 236 | 231 | foreach ($this->__asset->properties as $prop => $data) |
@@ -306,13 +301,11 @@ discard block |
||
| 306 | 301 | if (isset($this->__asset_properties[$prop]['temp'])) |
| 307 | 302 | { |
| 308 | 303 | return $this->__asset_properties[$prop]['temp']->value; |
| 309 | - } |
|
| 310 | - else |
|
| 304 | + } else |
|
| 311 | 305 | { |
| 312 | 306 | return $this->ownDatastore[$this->__asset_properties[$prop]]->value; |
| 313 | 307 | } |
| 314 | - } |
|
| 315 | - else |
|
| 308 | + } else |
|
| 316 | 309 | { |
| 317 | 310 | return false; |
| 318 | 311 | } |
@@ -332,44 +325,36 @@ discard block |
||
| 332 | 325 | if ($this->__value_equals && $this->__value_equals == $prop) |
| 333 | 326 | { |
| 334 | 327 | $this->val(Helpers::callStatic($this->type, 'valueEquals', array($val))); |
| 335 | - } |
|
| 336 | - else if ($this->__status_equals && $this->__status_equals == $prop) |
|
| 328 | + } else if ($this->__status_equals && $this->__status_equals == $prop) |
|
| 337 | 329 | { |
| 338 | 330 | $this->status($val); |
| 339 | - } |
|
| 340 | - else if ($this->__start_date && $this->__start_date == $prop) |
|
| 331 | + } else if ($this->__start_date && $this->__start_date == $prop) |
|
| 341 | 332 | { |
| 342 | 333 | $this->start_date($val); |
| 343 | - } |
|
| 344 | - else if ($this->__end_date && $this->__end_date == $prop) |
|
| 334 | + } else if ($this->__end_date && $this->__end_date == $prop) |
|
| 345 | 335 | { |
| 346 | 336 | $this->end_date($val); |
| 347 | 337 | } |
| 348 | - } |
|
| 349 | - else |
|
| 338 | + } else |
|
| 350 | 339 | { |
| 351 | 340 | $this->ownDatastore[$this->__asset_properties[$prop]]->value = $val; |
| 352 | 341 | // if value equals is set, set it too |
| 353 | 342 | if ($this->__value_equals && $this->__value_equals == $prop) |
| 354 | 343 | { |
| 355 | 344 | $this->val(Helpers::callStatic($this->type, 'valueEquals', array($val))); |
| 356 | - } |
|
| 357 | - else if ($this->__status_equals && $this->__status_equals == $prop) |
|
| 345 | + } else if ($this->__status_equals && $this->__status_equals == $prop) |
|
| 358 | 346 | { |
| 359 | 347 | $this->status($val); |
| 360 | - } |
|
| 361 | - else if ($this->__start_date && $this->__start_date == $prop) |
|
| 348 | + } else if ($this->__start_date && $this->__start_date == $prop) |
|
| 362 | 349 | { |
| 363 | 350 | $this->start_date($val); |
| 364 | - } |
|
| 365 | - else if ($this->__end_date && $this->__end_date == $prop) |
|
| 351 | + } else if ($this->__end_date && $this->__end_date == $prop) |
|
| 366 | 352 | { |
| 367 | 353 | $this->end_date($val); |
| 368 | 354 | } |
| 369 | 355 | } |
| 370 | 356 | return $this; |
| 371 | - } |
|
| 372 | - else |
|
| 357 | + } else |
|
| 373 | 358 | { |
| 374 | 359 | throw new DatastoreException('The property "' . $prop . '" is not defined for the "' . $this->type . '" asset'); |
| 375 | 360 | } |
@@ -476,8 +461,7 @@ discard block |
||
| 476 | 461 | if (isset($this->__asset_properties[$prop]['temp'])) |
| 477 | 462 | { |
| 478 | 463 | return $this->__asset_properties[$prop]['temp']->getMarkup($template); |
| 479 | - } |
|
| 480 | - else |
|
| 464 | + } else |
|
| 481 | 465 | { |
| 482 | 466 | if (isset($this->__asset_properties[$prop])) |
| 483 | 467 | { |
@@ -555,8 +539,7 @@ discard block |
||
| 555 | 539 | if (isset($this->__asset_properties[$prop]['temp'])) |
| 556 | 540 | { |
| 557 | 541 | echo $this->__asset_properties[$prop]['temp']->getForm($template, $prop); |
| 558 | - } |
|
| 559 | - else |
|
| 542 | + } else |
|
| 560 | 543 | { |
| 561 | 544 | if (isset($this->__asset_properties[$prop])) |
| 562 | 545 | { |
@@ -578,8 +561,7 @@ discard block |
||
| 578 | 561 | if (isset($this->__asset_properties[$prop]['temp'])) |
| 579 | 562 | { |
| 580 | 563 | return $this->__asset_properties[$prop]['temp']->getForm($template, $_prop); |
| 581 | - } |
|
| 582 | - else |
|
| 564 | + } else |
|
| 583 | 565 | { |
| 584 | 566 | if (isset($this->__asset_properties[$prop])) |
| 585 | 567 | { |
@@ -614,8 +596,7 @@ discard block |
||
| 614 | 596 | { |
| 615 | 597 | $output .= $this->returnForm($prop, false, $_prop); |
| 616 | 598 | } |
| 617 | - } |
|
| 618 | - else |
|
| 599 | + } else |
|
| 619 | 600 | { |
| 620 | 601 | return $this->propGetForm($template, $_prop); |
| 621 | 602 | } |
@@ -640,8 +621,7 @@ discard block |
||
| 640 | 621 | if (isset($_prop['unique_id'])) |
| 641 | 622 | { |
| 642 | 623 | $vars['_unique_id'] = $_prop['unique_id']; |
| 643 | - } |
|
| 644 | - else |
|
| 624 | + } else |
|
| 645 | 625 | { |
| 646 | 626 | $vars['_unique_id'] = md5(uniqid(rand(), true)); //UUID ?? |
| 647 | 627 | } |
@@ -672,8 +652,7 @@ discard block |
||
| 672 | 652 | if ($uid) |
| 673 | 653 | { |
| 674 | 654 | $unique_id = md5($uid); |
| 675 | - } |
|
| 676 | - else |
|
| 655 | + } else |
|
| 677 | 656 | { |
| 678 | 657 | $unique_id = md5(uniqid(rand(), true)); |
| 679 | 658 | } |
@@ -687,8 +666,7 @@ discard block |
||
| 687 | 666 | $xvars['unique_id'] = $unique_id; |
| 688 | 667 | |
| 689 | 668 | $output .= Helpers::callStatic($this->__asset_properties[$prop]['temp']->type, 'form', array($xvars, $this->type)); |
| 690 | - } |
|
| 691 | - else |
|
| 669 | + } else |
|
| 692 | 670 | { |
| 693 | 671 | if (isset($this->__asset_properties[$prop])) |
| 694 | 672 | { |
@@ -919,8 +897,7 @@ discard block |
||
| 919 | 897 | if (isset($this->__asset_properties[$pr]['temp'])) |
| 920 | 898 | { |
| 921 | 899 | $this->__asset_properties[$pr]['temp']->meta = $pv; |
| 922 | - } |
|
| 923 | - else |
|
| 900 | + } else |
|
| 924 | 901 | { |
| 925 | 902 | $this->ownDatastore[$this->__asset_properties[$pr]]->meta = $pv; |
| 926 | 903 | } |
@@ -17,11 +17,11 @@ |
||
| 17 | 17 | |
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | - * @property mixed $meta_keywords |
|
| 21 | - * @property mixed $meta_description |
|
| 22 | - * @property mixed $page_js |
|
| 23 | - * @property mixed $page_css |
|
| 24 | - */ |
|
| 20 | + * @property mixed $meta_keywords |
|
| 21 | + * @property mixed $meta_description |
|
| 22 | + * @property mixed $page_js |
|
| 23 | + * @property mixed $page_css |
|
| 24 | + */ |
|
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | class Datastore{ |
@@ -24,14 +24,14 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | |
| 26 | 26 | |
| 27 | -class Datastore{ |
|
| 27 | +class Datastore { |
|
| 28 | 28 | |
| 29 | - protected $__asset = false; |
|
| 30 | - protected $__asset_properties = []; |
|
| 31 | - protected $__value_equals = null; |
|
| 32 | - protected $__status_equals = false; |
|
| 33 | - protected $__start_date = null; |
|
| 34 | - protected $__end_date = null; |
|
| 29 | + protected $__asset = false; |
|
| 30 | + protected $__asset_properties = []; |
|
| 31 | + protected $__value_equals = null; |
|
| 32 | + protected $__status_equals = false; |
|
| 33 | + protected $__start_date = null; |
|
| 34 | + protected $__end_date = null; |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * |
@@ -64,17 +64,17 @@ discard block |
||
| 64 | 64 | { |
| 65 | 65 | $this->__model = DatastoreModel::findOrFail($id); |
| 66 | 66 | |
| 67 | - if(!$this->__model){ |
|
| 67 | + if (!$this->__model) { |
|
| 68 | 68 | //could not load <div class="">thr</div> |
| 69 | 69 | throw new DatastoreException("Record not found"); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | foreach ($this->__model->toArray() as $k => $v) |
| 73 | 73 | { |
| 74 | - if($k === 'options' || $k === 'meta'){ |
|
| 74 | + if ($k === 'options' || $k === 'meta') { |
|
| 75 | 75 | $v = json_decode($v, true); |
| 76 | 76 | } |
| 77 | - if(in_array($k, ['created_at','updated_at','date_start','date_end'])){ |
|
| 77 | + if (in_array($k, ['created_at', 'updated_at', 'date_start', 'date_end'])) { |
|
| 78 | 78 | $v = Carbon::parse($v); |
| 79 | 79 | } |
| 80 | 80 | $this->{$k} = $v; |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $this->ownDatastore[] = self::getAssetById($ds->id); |
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | - }else{ |
|
| 92 | + }else { |
|
| 93 | 93 | $this->__model = new DatastoreModel(); |
| 94 | 94 | } |
| 95 | 95 | } |
@@ -101,23 +101,23 @@ discard block |
||
| 101 | 101 | * |
| 102 | 102 | * @return void |
| 103 | 103 | */ |
| 104 | - public static function getAssetById($id){ |
|
| 104 | + public static function getAssetById($id) { |
|
| 105 | 105 | $datastore = new self($id); |
| 106 | 106 | $datastore->setAssetType($datastore->type); |
| 107 | 107 | return $datastore; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - public static function find($id){ |
|
| 111 | - if(!is_array($id)){ |
|
| 112 | - if(is_object($id)){ |
|
| 110 | + public static function find($id) { |
|
| 111 | + if (!is_array($id)) { |
|
| 112 | + if (is_object($id)) { |
|
| 113 | 113 | return self::getAssetById($id->id); |
| 114 | 114 | } |
| 115 | 115 | return self::getAssetById($id); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - if(is_array($id)){ |
|
| 118 | + if (is_array($id)) { |
|
| 119 | 119 | $assets = []; |
| 120 | - foreach($id as $i){ |
|
| 120 | + foreach ($id as $i) { |
|
| 121 | 121 | $assets[] = self::getAssetById($i); |
| 122 | 122 | } |
| 123 | 123 | return $assets; |
@@ -138,8 +138,8 @@ discard block |
||
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | |
| 141 | - public function ownDatastore(){ |
|
| 142 | - return ($this->ownDatastore)?$this->ownDatastore: array(); |
|
| 141 | + public function ownDatastore() { |
|
| 142 | + return ($this->ownDatastore) ? $this->ownDatastore : array(); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
@@ -200,9 +200,9 @@ discard block |
||
| 200 | 200 | |
| 201 | 201 | if (!isset($this->__asset_properties[$p])) |
| 202 | 202 | { |
| 203 | - $this->__asset_properties[$p]['temp'] = self::getAsset($this->__asset->properties[$p]['type']); |
|
| 203 | + $this->__asset_properties[$p]['temp'] = self::getAsset($this->__asset->properties[$p]['type']); |
|
| 204 | 204 | $this->__asset_properties[$p]['temp']->name = (isset($this->__asset->properties[$p]['name'])) ? $this->__asset->properties[$p]['name'] : null; |
| 205 | - $this->__asset_properties[$p]['temp']->key = $p; |
|
| 205 | + $this->__asset_properties[$p]['temp']->key = $p; |
|
| 206 | 206 | $this->__asset_properties[$p]['temp']->private = (isset($this->__asset->properties[$p]['private'])) ? $this->__asset->properties[$p]['private'] : false; // accessibility |
| 207 | 207 | $this->__asset_properties[$p]['temp']->value = (isset($this->__asset->properties[$p]['value'])) ? $this->__asset->properties[$p]['value'] : null; // the actual value of the property |
| 208 | 208 | $this->__asset_properties[$p]['temp']->options = (isset($this->__asset->properties[$p]['options'])) ? $this->__asset->properties[$p]['options'] : null; // additional options specific to the property |
@@ -211,8 +211,8 @@ discard block |
||
| 211 | 211 | $this->__asset_properties[$p]['temp']->help = (isset($this->__asset->properties[$p]['help'])) ? $this->__asset->properties[$p]['help'] : null; // additional options specific to the property |
| 212 | 212 | $this->__asset_properties[$p]['temp']->required = (isset($this->__asset->properties[$p]['required'])) ? $this->__asset->properties[$p]['required'] : true; // is the property required |
| 213 | 213 | $this->__asset_properties[$p]['temp']->limit = (isset($this->__asset->properties[$p]['limit'])) ? $this->__asset->properties[$p]['limit'] : null; // additional options specific to the property |
| 214 | - $this->__asset_properties[$p]['temp']->warning = (isset($this->__asset->properties[$p]['warning'])) ? $this->__asset->properties[$p]['warning'] : null; // additional options specific to the property |
|
| 215 | - $this->__asset_properties[$p]['temp']->max_instances = (isset($this->__asset->properties[$p]['max_instances'])) ? $this->__asset->properties[$p]['max_instances'] : 0; // there can be only one |
|
| 214 | + $this->__asset_properties[$p]['temp']->warning = (isset($this->__asset->properties[$p]['warning'])) ? $this->__asset->properties[$p]['warning'] : null; // additional options specific to the property |
|
| 215 | + $this->__asset_properties[$p]['temp']->max_instances = (isset($this->__asset->properties[$p]['max_instances'])) ? $this->__asset->properties[$p]['max_instances'] : 0; // there can be only one |
|
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | 218 | |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | $this->__asset_properties[$each->key] = array('temp' => $each); |
| 232 | 232 | @$this->ownDatastore[$idx]->required = (isset($this->__asset->properties[$each->key]['required'])) ? $this->__asset->properties[$each->key]['required'] : true; |
| 233 | 233 | @$this->ownDatastore[$idx]->limit = (isset($this->__asset->properties[$each->key]['limit'])) ? $this->__asset->properties[$each->key]['limit'] : null; |
| 234 | - @$this->ownDatastore[$idx]->warning = (isset($this->__asset->properties[$each->key]['warning'])) ? $this->__asset->properties[$each->key]['warning'] : null; |
|
| 234 | + @$this->ownDatastore[$idx]->warning = (isset($this->__asset->properties[$each->key]['warning'])) ? $this->__asset->properties[$each->key]['warning'] : null; |
|
| 235 | 235 | @$this->ownDatastore[$idx]->help = (isset($this->__asset->properties[$each->key]['help'])) ? $this->__asset->properties[$each->key]['help'] : null; |
| 236 | 236 | @$this->ownDatastore[$idx]->max_instances = (isset($this->__asset->properties[$each->key]['max_instances'])) ? $this->__asset->properties[$each->key]['max_instances'] : 0; |
| 237 | 237 | @$this->ownDatastore[$idx]->options = (isset($this->__asset->properties[$each->key]['options'])) ? $this->__asset->properties[$each->key]['options'] : null; |
@@ -246,19 +246,19 @@ discard block |
||
| 246 | 246 | { |
| 247 | 247 | |
| 248 | 248 | // we need to create a temporary new bean to store new data |
| 249 | - $this->__asset_properties[$prop]['temp'] = self::getAsset($this->__asset->properties[$prop]['type']); |
|
| 250 | - $this->__asset_properties[$prop]['temp']->name = (isset($this->__asset->properties[$prop]['name'])) ? $this->__asset->properties[$prop]['name'] : null; |
|
| 251 | - $this->__asset_properties[$prop]['temp']->key = $prop; |
|
| 249 | + $this->__asset_properties[$prop]['temp'] = self::getAsset($this->__asset->properties[$prop]['type']); |
|
| 250 | + $this->__asset_properties[$prop]['temp']->name = (isset($this->__asset->properties[$prop]['name'])) ? $this->__asset->properties[$prop]['name'] : null; |
|
| 251 | + $this->__asset_properties[$prop]['temp']->key = $prop; |
|
| 252 | 252 | $this->__asset_properties[$prop]['temp']->private = (isset($this->__asset->properties[$prop]['private'])) ? $this->__asset->properties[$prop]['private'] : false; // accessibility |
| 253 | - $this->__asset_properties[$prop]['temp']->value = (isset($this->__asset->properties[$prop]['value'])) ? $this->__asset->properties[$prop]['value'] : null; // the actual value of the property |
|
| 253 | + $this->__asset_properties[$prop]['temp']->value = (isset($this->__asset->properties[$prop]['value'])) ? $this->__asset->properties[$prop]['value'] : null; // the actual value of the property |
|
| 254 | 254 | $this->__asset_properties[$prop]['temp']->options = (isset($this->__asset->properties[$prop]['options'])) ? $this->__asset->properties[$prop]['options'] : null; // additional options specific to the property |
| 255 | 255 | $this->__asset_properties[$prop]['temp']->callback = (isset($this->__asset->properties[$prop]['callback'])) ? $this->__asset->properties[$prop]['callback'] : null; // additional options specific to the property |
| 256 | 256 | $this->__asset_properties[$prop]['temp']->meta = (isset($this->__asset->properties[$prop]['meta'])) ? $this->__asset->properties[$prop]['meta'] : null; // additional options specific to the property |
| 257 | 257 | $this->__asset_properties[$prop]['temp']->help = (isset($this->__asset->properties[$prop]['help'])) ? $this->__asset->properties[$prop]['help'] : null; // additional options specific to the property |
| 258 | 258 | $this->__asset_properties[$prop]['temp']->required = (isset($this->__asset->properties[$prop]['required'])) ? $this->__asset->properties[$prop]['required'] : true; // is the property required |
| 259 | - $this->__asset_properties[$prop]['temp']->limit = (isset($this->__asset->properties[$prop]['limit'])) ? $this->__asset->properties[$prop]['limit'] : null; // additional options specific to the property |
|
| 260 | - $this->__asset_properties[$prop]['temp']->warning = (isset($this->__asset->properties[$prop]['warning'])) ? $this->__asset->properties[$prop]['warning'] : null; // additional options specific to the property |
|
| 261 | - $this->__asset_properties[$prop]['temp']->max_instances = (isset($this->__asset->properties[$prop]['max_instances'])) ? $this->__asset->properties[$prop]['max_instances'] : null; // there can be only one |
|
| 259 | + $this->__asset_properties[$prop]['temp']->limit = (isset($this->__asset->properties[$prop]['limit'])) ? $this->__asset->properties[$prop]['limit'] : null; // additional options specific to the property |
|
| 260 | + $this->__asset_properties[$prop]['temp']->warning = (isset($this->__asset->properties[$prop]['warning'])) ? $this->__asset->properties[$prop]['warning'] : null; // additional options specific to the property |
|
| 261 | + $this->__asset_properties[$prop]['temp']->max_instances = (isset($this->__asset->properties[$prop]['max_instances'])) ? $this->__asset->properties[$prop]['max_instances'] : null; // there can be only one |
|
| 262 | 262 | |
| 263 | 263 | } |
| 264 | 264 | } |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | */ |
| 274 | 274 | public static function getKey($string) |
| 275 | 275 | { |
| 276 | - $new = Helpers::splitByCaps($string); |
|
| 276 | + $new = Helpers::splitByCaps($string); |
|
| 277 | 277 | $explode = explode(' ', $new); |
| 278 | 278 | |
| 279 | 279 | if (isset($explode[0]) && $explode[0] == 'Ams') |
@@ -328,8 +328,8 @@ discard block |
||
| 328 | 328 | break; |
| 329 | 329 | |
| 330 | 330 | case 2: |
| 331 | - $prop = func_get_arg(0); |
|
| 332 | - $val = func_get_arg(1); |
|
| 331 | + $prop = func_get_arg(0); |
|
| 332 | + $val = func_get_arg(1); |
|
| 333 | 333 | if (isset($this->__asset_properties[$prop])) |
| 334 | 334 | { |
| 335 | 335 | // check whether this is new or existing |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | break; |
| 406 | 406 | |
| 407 | 407 | default: |
| 408 | - $val = func_get_arg(0); |
|
| 408 | + $val = func_get_arg(0); |
|
| 409 | 409 | $this->value = $val; |
| 410 | 410 | } |
| 411 | 411 | } |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | |
| 432 | 432 | foreach ($props as $prop) |
| 433 | 433 | { |
| 434 | - if (!in_array($prop->name, array('status_equals', 'properties','help','value_equals'))) |
|
| 434 | + if (!in_array($prop->name, array('status_equals', 'properties', 'help', 'value_equals'))) |
|
| 435 | 435 | { |
| 436 | 436 | $record->{$prop->name} = isset($asset->{$prop->name}) ? $asset->{$prop->name} : NULL; |
| 437 | 437 | } |
@@ -439,15 +439,15 @@ discard block |
||
| 439 | 439 | |
| 440 | 440 | if ($asset->__status_equals) |
| 441 | 441 | { |
| 442 | - $record->status = isset($record->{$asset->__status_equals})? $record->{$asset->__status_equals} : $this->prop($this->__status_equals); |
|
| 442 | + $record->status = isset($record->{$asset->__status_equals}) ? $record->{$asset->__status_equals} : $this->prop($this->__status_equals); |
|
| 443 | 443 | } |
| 444 | 444 | if ($asset->__start_date) |
| 445 | 445 | { |
| 446 | - $record->start_date = isset($record->{$asset->__start_date})? $record->{$asset->__start_date} : $this->prop($this->__start_date); |
|
| 446 | + $record->start_date = isset($record->{$asset->__start_date}) ? $record->{$asset->__start_date} : $this->prop($this->__start_date); |
|
| 447 | 447 | } |
| 448 | 448 | if ($asset->__end_date) |
| 449 | 449 | { |
| 450 | - $record->end_date = isset($record->{$asset->__end_date})? $record->{$asset->__end_date} : $this->prop($this->__end_date); |
|
| 450 | + $record->end_date = isset($record->{$asset->__end_date}) ? $record->{$asset->__end_date} : $this->prop($this->__end_date); |
|
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | $record->options = json_encode($record->options); |
@@ -503,8 +503,8 @@ discard block |
||
| 503 | 503 | public function getMarkup($template = false) |
| 504 | 504 | { |
| 505 | 505 | |
| 506 | - $vars = $this->export(); |
|
| 507 | - $vars['_unique_id'] = uniqid(); |
|
| 506 | + $vars = $this->export(); |
|
| 507 | + $vars['_unique_id'] = uniqid(); |
|
| 508 | 508 | |
| 509 | 509 | // we also want to know what asset this property belongs to |
| 510 | 510 | $output = Helpers::callStatic($this->type, 'render', array($vars, $template)); |
@@ -537,7 +537,7 @@ discard block |
||
| 537 | 537 | if ($this->__status_equals) |
| 538 | 538 | { |
| 539 | 539 | |
| 540 | - $data['status'] = isset($data[$this->__status_equals])? $data[$this->__status_equals] : $this->prop($this->__status_equals); |
|
| 540 | + $data['status'] = isset($data[$this->__status_equals]) ? $data[$this->__status_equals] : $this->prop($this->__status_equals); |
|
| 541 | 541 | } |
| 542 | 542 | if ($this->__start_date) |
| 543 | 543 | { |
@@ -598,9 +598,9 @@ discard block |
||
| 598 | 598 | } |
| 599 | 599 | } |
| 600 | 600 | |
| 601 | - public function getFieldValues(){ |
|
| 601 | + public function getFieldValues() { |
|
| 602 | 602 | $data = []; |
| 603 | - foreach(array_keys($this->__asset->properties) as $key){ |
|
| 603 | + foreach (array_keys($this->__asset->properties) as $key) { |
|
| 604 | 604 | $data[$key] = $this->prop($key); |
| 605 | 605 | } |
| 606 | 606 | return $data; |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | return $output; |
| 665 | 665 | } |
| 666 | 666 | |
| 667 | - public function propGetValue($prop){ |
|
| 667 | + public function propGetValue($prop) { |
|
| 668 | 668 | dd($prop); |
| 669 | 669 | } |
| 670 | 670 | |
@@ -692,8 +692,8 @@ discard block |
||
| 692 | 692 | { |
| 693 | 693 | if (isset($this->__asset_properties[$prop]['temp'])) |
| 694 | 694 | { |
| 695 | - $xvars = $this->__asset_properties[$prop]['temp']->export(); |
|
| 696 | - $xvars['unique_id'] = $unique_id; |
|
| 695 | + $xvars = $this->__asset_properties[$prop]['temp']->export(); |
|
| 696 | + $xvars['unique_id'] = $unique_id; |
|
| 697 | 697 | |
| 698 | 698 | $output .= Helpers::callStatic($this->__asset_properties[$prop]['temp']->type, 'form', array($xvars, $this->type)); |
| 699 | 699 | } |
@@ -701,8 +701,8 @@ discard block |
||
| 701 | 701 | { |
| 702 | 702 | if (isset($this->__asset_properties[$prop])) |
| 703 | 703 | { |
| 704 | - $xvars = $this->ownDatastore[$this->__asset_properties[$prop]]->export(); |
|
| 705 | - $xvars['unique_id'] = $unique_id; |
|
| 704 | + $xvars = $this->ownDatastore[$this->__asset_properties[$prop]]->export(); |
|
| 705 | + $xvars['unique_id'] = $unique_id; |
|
| 706 | 706 | |
| 707 | 707 | $output .= Helpers::callStatic($this->ownDatastore[$this->__asset_properties[$prop]]->type, 'form', array($xvars, $this->type)); |
| 708 | 708 | } |
@@ -718,8 +718,8 @@ discard block |
||
| 718 | 718 | return $output; |
| 719 | 719 | } |
| 720 | 720 | |
| 721 | - public function hasMetadataForm(){ |
|
| 722 | - if ($this->namespace == 'asset' && !$this->is_child){ |
|
| 721 | + public function hasMetadataForm() { |
|
| 722 | + if ($this->namespace == 'asset' && !$this->is_child) { |
|
| 723 | 723 | return ($this->meta_description !== 'off' || $this->meta_keywords !== 'off'); |
| 724 | 724 | } |
| 725 | 725 | return false; |
@@ -766,8 +766,8 @@ discard block |
||
| 766 | 766 | return $output; |
| 767 | 767 | } |
| 768 | 768 | |
| 769 | - public function hasDeveloperForm(){ |
|
| 770 | - if ($this->namespace == 'asset' && !$this->is_child){ |
|
| 769 | + public function hasDeveloperForm() { |
|
| 770 | + if ($this->namespace == 'asset' && !$this->is_child) { |
|
| 771 | 771 | return ($this->page_js !== 'off' || $this->page_css !== 'off'); |
| 772 | 772 | } |
| 773 | 773 | return false; |
@@ -795,7 +795,7 @@ discard block |
||
| 795 | 795 | $output .= Helpers::callStatic(ASSET::METATEXT, 'form', array($data, 'metatext')); |
| 796 | 796 | } |
| 797 | 797 | |
| 798 | - if ($this->page_js !== 'off' ) |
|
| 798 | + if ($this->page_js !== 'off') |
|
| 799 | 799 | { |
| 800 | 800 | $data = array( |
| 801 | 801 | 'name' => 'Custom JS', |
@@ -826,11 +826,11 @@ discard block |
||
| 826 | 826 | $messages = array(); |
| 827 | 827 | foreach ($this->__asset->properties as $key => $property) |
| 828 | 828 | { |
| 829 | - if($property['type'] !== \Phpsa\Datastore\Ams\AutoCallBackAdderAsset::class && (empty($property['required']) || $property['required'] === true) ) |
|
| 829 | + if ($property['type'] !== \Phpsa\Datastore\Ams\AutoCallBackAdderAsset::class && (empty($property['required']) || $property['required'] === true)) |
|
| 830 | 830 | { |
| 831 | 831 | $rules = empty($property['validation_rules']) ? 'required' : $property['validation_rules']; |
| 832 | - if(!empty($property['validation_messages'])){ |
|
| 833 | - if(is_string($property['validation_messages'])){ |
|
| 832 | + if (!empty($property['validation_messages'])) { |
|
| 833 | + if (is_string($property['validation_messages'])) { |
|
| 834 | 834 | $messages[$key . '.required'] = $property['validation_messages']; |
| 835 | 835 | } |
| 836 | 836 | } |
@@ -843,7 +843,7 @@ discard block |
||
| 843 | 843 | { |
| 844 | 844 | $validator = Validator::make($request, $config, $messages); |
| 845 | 845 | |
| 846 | - if($validator->fails()){ |
|
| 846 | + if ($validator->fails()) { |
|
| 847 | 847 | throw new ValidationException($validator); |
| 848 | 848 | } |
| 849 | 849 | } |
@@ -967,7 +967,7 @@ discard block |
||
| 967 | 967 | public function getStatusValue() :string |
| 968 | 968 | { |
| 969 | 969 | $options = $this->statusOptions(); |
| 970 | - return (! empty($options) && Helpers::isAssocArray($options) && isset($options[$this->status])) ? $options[$this->status] : $this->status; |
|
| 970 | + return (!empty($options) && Helpers::isAssocArray($options) && isset($options[$this->status])) ? $options[$this->status] : $this->status; |
|
| 971 | 971 | } |
| 972 | 972 | |
| 973 | 973 | /** |
@@ -999,9 +999,9 @@ discard block |
||
| 999 | 999 | */ |
| 1000 | 1000 | public function statusIsActive() :bool |
| 1001 | 1001 | { |
| 1002 | - if($this->__status_equals){ |
|
| 1002 | + if ($this->__status_equals) { |
|
| 1003 | 1003 | |
| 1004 | - if(!isset($this->__asset->properties[$this->__status_equals]['published'])){ |
|
| 1004 | + if (!isset($this->__asset->properties[$this->__status_equals]['published'])) { |
|
| 1005 | 1005 | throw new DatastoreException("Statused assests need a published option in the asset definition"); |
| 1006 | 1006 | } |
| 1007 | 1007 | |
@@ -1052,7 +1052,7 @@ discard block |
||
| 1052 | 1052 | * |
| 1053 | 1053 | * @return string|null |
| 1054 | 1054 | */ |
| 1055 | - public function getTitleField() :?string |
|
| 1055 | + public function getTitleField() : ?string |
|
| 1056 | 1056 | { |
| 1057 | 1057 | return $this->__value_equals; |
| 1058 | 1058 | } |
@@ -150,10 +150,10 @@ |
||
| 150 | 150 | public $meta_description = null; |
| 151 | 151 | |
| 152 | 152 | /** |
| 153 | - * set to 'off' to turn it off |
|
| 154 | - * |
|
| 155 | - * @var [type] |
|
| 156 | - */ |
|
| 153 | + * set to 'off' to turn it off |
|
| 154 | + * |
|
| 155 | + * @var [type] |
|
| 156 | + */ |
|
| 157 | 157 | public $meta_keywords = null; |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -293,8 +293,7 @@ |
||
| 293 | 293 | $out = $props[$lookup]; |
| 294 | 294 | unset($obj, $props); |
| 295 | 295 | return $out; |
| 296 | - } |
|
| 297 | - else |
|
| 296 | + } else |
|
| 298 | 297 | { |
| 299 | 298 | unset($obj, $props); |
| 300 | 299 | return false; |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @author Craig Smith <[email protected]> |
| 34 | 34 | */ |
| 35 | -class Asset{ |
|
| 35 | +class Asset { |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * Constants for the different asset types! |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | const AUTOCALLBACKADDER = AutoCallBackAdderAsset::class; // ajax powered autocomplete backed on a callback |
| 45 | - const AUTOCALLBACK = AutoCallBackAsset::class; // ajax powered autocomplete backed on a callback |
|
| 45 | + const AUTOCALLBACK = AutoCallBackAsset::class; // ajax powered autocomplete backed on a callback |
|
| 46 | 46 | const AUTOCOMPLETE = AutoCompleteAsset::class; |
| 47 | 47 | const BOOL = BooleanAsset::class; |
| 48 | 48 | const DATEPICKER = DatepickerAsset::class; |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | const HTML = HtmlAsset::class; |
| 53 | 53 | const IDENTITY = IdentityAsset::class; |
| 54 | 54 | const IMG = ImageAsset::class; |
| 55 | - const METATEXT = MetatextAsset::class; |
|
| 55 | + const METATEXT = MetatextAsset::class; |
|
| 56 | 56 | const STRING = StringAsset::class; |
| 57 | 57 | const SUBHEADING = SubHeadingAsset::class; |
| 58 | 58 | const TEXT = TextAsset::class; |
@@ -65,70 +65,70 @@ discard block |
||
| 65 | 65 | * |
| 66 | 66 | * @var string |
| 67 | 67 | */ |
| 68 | - public $help = null; |
|
| 68 | + public $help = null; |
|
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | 71 | * Sets the required rule for a property |
| 72 | 72 | * |
| 73 | 73 | * @var bool |
| 74 | 74 | */ |
| 75 | - public $required = true; |
|
| 75 | + public $required = true; |
|
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | 78 | * which property is the actual value name for your asset - target one of the properties |
| 79 | 79 | * |
| 80 | 80 | * @var string |
| 81 | 81 | */ |
| 82 | - public $value_equals = null; |
|
| 82 | + public $value_equals = null; |
|
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | 85 | * Assets namespace, most often extended as an asset, however may be a property if adding a new input type. |
| 86 | 86 | * |
| 87 | 87 | * @var string |
| 88 | 88 | */ |
| 89 | - public $namespace = self::ASSET; |
|
| 89 | + public $namespace = self::ASSET; |
|
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | 92 | * Generally left alone unless overrideing to be a property then should have the instance class |
| 93 | 93 | * |
| 94 | 94 | * @var string |
| 95 | 95 | */ |
| 96 | - public $type = 'asset'; |
|
| 96 | + public $type = 'asset'; |
|
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | 99 | * Properties for thie asset - used to define the property assets to use to build up the asset |
| 100 | 100 | * |
| 101 | 101 | * @var array |
| 102 | 102 | */ |
| 103 | - public $properties = array(); |
|
| 103 | + public $properties = array(); |
|
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | 106 | * Public name - This is used to identify |
| 107 | 107 | * |
| 108 | 108 | * @var [type] |
| 109 | 109 | */ |
| 110 | - public $name = null; |
|
| 110 | + public $name = null; |
|
| 111 | 111 | |
| 112 | 112 | /** |
| 113 | 113 | * just a shortname to use instead of the full $name above |
| 114 | 114 | * |
| 115 | 115 | * @var string |
| 116 | 116 | */ |
| 117 | - public $shortname = null; |
|
| 117 | + public $shortname = null; |
|
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | 120 | * the max number of instances, 0 means unlimited - normally used for presets like the robots.txt |
| 121 | 121 | * |
| 122 | 122 | * @var int |
| 123 | 123 | */ |
| 124 | - public $max_instances = 0; |
|
| 124 | + public $max_instances = 0; |
|
| 125 | 125 | |
| 126 | 126 | /** |
| 127 | 127 | * IE if private is true, we do not show the page link block... and idsable the meta |
| 128 | 128 | * but if private is false, we show the page link and let meta decide for itself: |
| 129 | 129 | * @var bool |
| 130 | 130 | */ |
| 131 | - public $private = false; |
|
| 131 | + public $private = false; |
|
| 132 | 132 | |
| 133 | 133 | /** |
| 134 | 134 | * @deprecated Initial - |
@@ -136,14 +136,14 @@ discard block |
||
| 136 | 136 | * |
| 137 | 137 | * @var [type] |
| 138 | 138 | */ |
| 139 | - public $embedded = null; |
|
| 139 | + public $embedded = null; |
|
| 140 | 140 | |
| 141 | 141 | /** |
| 142 | 142 | * @deprecated version |
| 143 | 143 | * * @TODO - Remove from here and from teh database object |
| 144 | 144 | * @var [type] |
| 145 | 145 | */ |
| 146 | - public $theme = null; |
|
| 146 | + public $theme = null; |
|
| 147 | 147 | |
| 148 | 148 | /** |
| 149 | 149 | * set to 'off' to turn it off |
@@ -157,14 +157,14 @@ discard block |
||
| 157 | 157 | * |
| 158 | 158 | * @var [type] |
| 159 | 159 | */ |
| 160 | - public $meta_keywords = null; |
|
| 160 | + public $meta_keywords = null; |
|
| 161 | 161 | |
| 162 | 162 | /** |
| 163 | 163 | * set to 'off' to turn it off |
| 164 | 164 | * |
| 165 | 165 | * @var [type] |
| 166 | 166 | */ |
| 167 | - public $page_css = null; |
|
| 167 | + public $page_css = null; |
|
| 168 | 168 | |
| 169 | 169 | /** |
| 170 | 170 | * set to 'off' to turn it off |
@@ -174,12 +174,12 @@ discard block |
||
| 174 | 174 | public $page_js = null; |
| 175 | 175 | |
| 176 | 176 | |
| 177 | - public $options = false; // Options for the element -- should actually be removed from the database table most likely |
|
| 178 | - public $status_equals = null; // does the asset has a status linked to a prop |
|
| 179 | - public $start_date = null; // does the asset has a start date linked to a prop |
|
| 180 | - public $end_date = null; // does the asset has an end date linked to a prop |
|
| 181 | - public $comment_equals = null; // does the asset allow comments (linked to a specific property - similar to status_equals) |
|
| 182 | - public $warning = null; // field for warnings - deprected in favour of validation_messages |
|
| 177 | + public $options = false; // Options for the element -- should actually be removed from the database table most likely |
|
| 178 | + public $status_equals = null; // does the asset has a status linked to a prop |
|
| 179 | + public $start_date = null; // does the asset has a start date linked to a prop |
|
| 180 | + public $end_date = null; // does the asset has an end date linked to a prop |
|
| 181 | + public $comment_equals = null; // does the asset allow comments (linked to a specific property - similar to status_equals) |
|
| 182 | + public $warning = null; // field for warnings - deprected in favour of validation_messages |
|
| 183 | 183 | //public $published = null; //published status |
| 184 | 184 | //public $validation_messages = null //validation messages |
| 185 | 185 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | public $module = null; |
| 188 | 188 | public $value = null; |
| 189 | 189 | public $status = null; |
| 190 | - public $meta = false; // ancillary meta info/data - similar to options |
|
| 190 | + public $meta = false; // ancillary meta info/data - similar to options |
|
| 191 | 191 | public $callback = null; |
| 192 | 192 | |
| 193 | 193 | /** |
@@ -195,36 +195,36 @@ discard block |
||
| 195 | 195 | * |
| 196 | 196 | * @var [type] |
| 197 | 197 | */ |
| 198 | - public $children = null; |
|
| 198 | + public $children = null; |
|
| 199 | 199 | |
| 200 | 200 | /** |
| 201 | 201 | * Is this a child only asset? if marked as true does not auto display on menu options and can only be linked in as a child property to an asset. |
| 202 | 202 | * |
| 203 | 203 | * @var bool |
| 204 | 204 | */ |
| 205 | - public $is_child = false; |
|
| 205 | + public $is_child = false; |
|
| 206 | 206 | |
| 207 | 207 | /** |
| 208 | 208 | * Asset that can be a child, ie an article belonging to a category |
| 209 | 209 | * |
| 210 | 210 | * @var [type] |
| 211 | 211 | */ |
| 212 | - public $accept = null; |
|
| 212 | + public $accept = null; |
|
| 213 | 213 | |
| 214 | 214 | /** |
| 215 | 215 | * assets that can be children, a value means it is limited to that many children, -1 means unlimited |
| 216 | 216 | * @TodO update this to better display with a selct / multiSelect null / 0 / -1 or any falsy is unlimited, else it is limited to that number... |
| 217 | 217 | * @var [type] |
| 218 | 218 | */ |
| 219 | - public $accept_limit = null; |
|
| 219 | + public $accept_limit = null; |
|
| 220 | 220 | |
| 221 | 221 | |
| 222 | 222 | /** |
| 223 | 223 | * generate the route for this asset |
| 224 | 224 | * Overwrite this in your own assets to generate your own route |
| 225 | 225 | */ |
| 226 | - public static function route(DatastorePages $record, $route = null){ |
|
| 227 | - if(null === $route){ |
|
| 226 | + public static function route(DatastorePages $record, $route = null) { |
|
| 227 | + if (null === $route) { |
|
| 228 | 228 | $route = 'frontend.ams.page.slug'; |
| 229 | 229 | } |
| 230 | 230 | $page = $record->page; |
@@ -255,8 +255,8 @@ discard block |
||
| 255 | 255 | * |
| 256 | 256 | * @return array |
| 257 | 257 | */ |
| 258 | - public static function getDefaultProperties(){ |
|
| 259 | - $obj = new ReflectionClass(get_called_class()); |
|
| 258 | + public static function getDefaultProperties() { |
|
| 259 | + $obj = new ReflectionClass(get_called_class()); |
|
| 260 | 260 | return $obj->getDefaultProperties(); |
| 261 | 261 | } |
| 262 | 262 | |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | public static function getValueLabel() |
| 271 | 271 | { |
| 272 | 272 | $props = self::getDefaultProperties(); |
| 273 | - if(empty($props['value_equals']) || empty($props['properties'][$props['value_equals']]['name'])){ |
|
| 273 | + if (empty($props['value_equals']) || empty($props['properties'][$props['value_equals']]['name'])) { |
|
| 274 | 274 | throw new DatastoreException("value_equals is a required parameter"); |
| 275 | 275 | } |
| 276 | 276 | |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | { |
| 338 | 338 | $args['unique_id'] = uniqid(); |
| 339 | 339 | } |
| 340 | - $data['data'] = $args; |
|
| 340 | + $data['data'] = $args; |
|
| 341 | 341 | $data['asset_classname'] = $injectedform; |
| 342 | 342 | return View::make($template, $data)->render(); |
| 343 | 343 | } |
@@ -353,9 +353,9 @@ discard block |
||
| 353 | 353 | public static function render($args = [], $params = false) |
| 354 | 354 | { |
| 355 | 355 | |
| 356 | - if(is_string($params)){ |
|
| 356 | + if (is_string($params)) { |
|
| 357 | 357 | $template = $params; |
| 358 | - } else { |
|
| 358 | + }else { |
|
| 359 | 359 | $template = is_array($params) && !empty($params['view']) ? $params['view'] : self::getAssetView(); |
| 360 | 360 | } |
| 361 | 361 | |
@@ -395,8 +395,8 @@ discard block |
||
| 395 | 395 | * @return void |
| 396 | 396 | * @author Craig Smith <[email protected]> |
| 397 | 397 | */ |
| 398 | - public static function getPath($className = null){ |
|
| 399 | - if(null === $className) { |
|
| 398 | + public static function getPath($className = null) { |
|
| 399 | + if (null === $className) { |
|
| 400 | 400 | $className = get_called_class(); |
| 401 | 401 | } |
| 402 | 402 | return Helpers::getPath($className); |
@@ -12,23 +12,23 @@ |
||
| 12 | 12 | class DatastoreRolesSeeder extends Seeder |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Run the database seed. |
|
| 17 | - */ |
|
| 18 | - public function run() |
|
| 19 | - { |
|
| 15 | + /** |
|
| 16 | + * Run the database seed. |
|
| 17 | + */ |
|
| 18 | + public function run() |
|
| 19 | + { |
|
| 20 | 20 | |
| 21 | - // Create Roles |
|
| 22 | - $cms = Role::create(['name' => 'cms']); |
|
| 21 | + // Create Roles |
|
| 22 | + $cms = Role::create(['name' => 'cms']); |
|
| 23 | 23 | |
| 24 | - // Create Permissions |
|
| 25 | - $permissions = ['manage datastore']; |
|
| 24 | + // Create Permissions |
|
| 25 | + $permissions = ['manage datastore']; |
|
| 26 | 26 | |
| 27 | - foreach ($permissions as $permission) { |
|
| 28 | - Permission::create(['name' => $permission]); |
|
| 27 | + foreach ($permissions as $permission) { |
|
| 28 | + Permission::create(['name' => $permission]); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | $cms->givePermissionTo('manage datastore'); |
| 32 | 32 | |
| 33 | - } |
|
| 33 | + } |
|
| 34 | 34 | } |
@@ -10,41 +10,41 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class CreateDatastoreDatastoreTable extends Migration |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * Run the migrations. |
|
| 15 | - * |
|
| 16 | - * @return void |
|
| 17 | - */ |
|
| 18 | - public function up() |
|
| 19 | - { |
|
| 20 | - Schema::create('datastore_datastore', function (Blueprint $table) { |
|
| 21 | - $table->bigIncrements('id'); |
|
| 22 | - $table->unsignedBigInteger('datastore_id')->nullable(); |
|
| 23 | - $table->unsignedBigInteger('datastore2_id')->nullable(); |
|
| 13 | + /** |
|
| 14 | + * Run the migrations. |
|
| 15 | + * |
|
| 16 | + * @return void |
|
| 17 | + */ |
|
| 18 | + public function up() |
|
| 19 | + { |
|
| 20 | + Schema::create('datastore_datastore', function (Blueprint $table) { |
|
| 21 | + $table->bigIncrements('id'); |
|
| 22 | + $table->unsignedBigInteger('datastore_id')->nullable(); |
|
| 23 | + $table->unsignedBigInteger('datastore2_id')->nullable(); |
|
| 24 | 24 | |
| 25 | 25 | $table->unique(['datastore2_id', 'datastore_id']); |
| 26 | - $table->index('datastore_id'); |
|
| 27 | - $table->index('datastore2_id'); |
|
| 26 | + $table->index('datastore_id'); |
|
| 27 | + $table->index('datastore2_id'); |
|
| 28 | 28 | |
| 29 | 29 | |
| 30 | - $table->foreign('datastore_id')->references('id')->on('datastore')->onDelete('CASCADE')->onUpdate('RESTRICT'); |
|
| 30 | + $table->foreign('datastore_id')->references('id')->on('datastore')->onDelete('CASCADE')->onUpdate('RESTRICT'); |
|
| 31 | 31 | $table->foreign('datastore2_id')->references('id')->on('datastore')->onDelete('CASCADE')->onUpdate('RESTRICT'); |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | |
| 35 | - }); |
|
| 35 | + }); |
|
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | |
| 39 | - } |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Reverse the migrations. |
|
| 43 | - * |
|
| 44 | - * @return void |
|
| 45 | - */ |
|
| 46 | - public function down() |
|
| 47 | - { |
|
| 48 | - Schema::dropIfExists('datastore_datastore'); |
|
| 49 | - } |
|
| 41 | + /** |
|
| 42 | + * Reverse the migrations. |
|
| 43 | + * |
|
| 44 | + * @return void |
|
| 45 | + */ |
|
| 46 | + public function down() |
|
| 47 | + { |
|
| 48 | + Schema::dropIfExists('datastore_datastore'); |
|
| 49 | + } |
|
| 50 | 50 | } |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | public function up() |
| 19 | 19 | { |
| 20 | - Schema::create('datastore_datastore', function (Blueprint $table) { |
|
| 20 | + Schema::create('datastore_datastore', function(Blueprint $table) { |
|
| 21 | 21 | $table->bigIncrements('id'); |
| 22 | 22 | $table->unsignedBigInteger('datastore_id')->nullable(); |
| 23 | 23 | $table->unsignedBigInteger('datastore2_id')->nullable(); |
@@ -10,68 +10,68 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class CreateDatastoreTable extends Migration |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * Run the migrations. |
|
| 15 | - * |
|
| 16 | - * @return void |
|
| 17 | - */ |
|
| 18 | - public function up() |
|
| 19 | - { |
|
| 20 | - Schema::create('datastore', function (Blueprint $table) { |
|
| 13 | + /** |
|
| 14 | + * Run the migrations. |
|
| 15 | + * |
|
| 16 | + * @return void |
|
| 17 | + */ |
|
| 18 | + public function up() |
|
| 19 | + { |
|
| 20 | + Schema::create('datastore', function (Blueprint $table) { |
|
| 21 | 21 | $table->bigIncrements('id'); |
| 22 | - $table->string('type', 255)->nullable(); |
|
| 23 | - $table->string('namespace', 255)->nullable(); |
|
| 24 | - $table->string('module', 255); |
|
| 25 | - $table->string('name', 255)->nullable(); |
|
| 26 | - $table->string('key', 255)->nullable(); |
|
| 27 | - $table->unsignedTinyInteger('private')->nullable()->default(0); |
|
| 28 | - $table->longText('value')->nullable(); |
|
| 29 | - $table->string('options', 255)->nullable(); |
|
| 30 | - $table->string('meta', 255)->nullable(); |
|
| 31 | - $table->string('accept', 255)->nullable()->comment('comma separated list of assets it accepts as related'); |
|
| 32 | - $table->string('accept_limit', 255)->nullable(); |
|
| 33 | - $table->unsignedBigInteger('datastore_id')->nullable(); |
|
| 34 | - $table->string('shortname', 255)->nullable(); |
|
| 35 | - $table->string('children', 255)->nullable(); |
|
| 36 | - $table->unsignedTinyInteger('is_child')->nullable(); |
|
| 37 | - $table->string('status', 255)->nullable(); |
|
| 38 | - $table->string('embedded', 255)->nullable(); |
|
| 39 | - $table->string('theme', 50)->nullable(); |
|
| 40 | - $table->text('meta_description')->nullable(); |
|
| 41 | - $table->text('meta_keywords')->nullable(); |
|
| 42 | - $table->text('page_css')->nullable(); |
|
| 43 | - $table->text('page_js')->nullable(); |
|
| 44 | - $table->string('limit', 20)->nullable(); |
|
| 45 | - $table->string('warning', 20)->nullable(); |
|
| 46 | - $table->string('callback', 255)->nullable(); |
|
| 47 | - $table->unsignedTinyInteger('required')->nullable(); |
|
| 48 | - $table->string('comment_equals', 255)->nullable(); |
|
| 49 | - $table->integer('max_instances')->nullable()->default(0); |
|
| 50 | - $table->date('start_date')->nullable(); |
|
| 51 | - $table->date('end_date')->nullable(); |
|
| 22 | + $table->string('type', 255)->nullable(); |
|
| 23 | + $table->string('namespace', 255)->nullable(); |
|
| 24 | + $table->string('module', 255); |
|
| 25 | + $table->string('name', 255)->nullable(); |
|
| 26 | + $table->string('key', 255)->nullable(); |
|
| 27 | + $table->unsignedTinyInteger('private')->nullable()->default(0); |
|
| 28 | + $table->longText('value')->nullable(); |
|
| 29 | + $table->string('options', 255)->nullable(); |
|
| 30 | + $table->string('meta', 255)->nullable(); |
|
| 31 | + $table->string('accept', 255)->nullable()->comment('comma separated list of assets it accepts as related'); |
|
| 32 | + $table->string('accept_limit', 255)->nullable(); |
|
| 33 | + $table->unsignedBigInteger('datastore_id')->nullable(); |
|
| 34 | + $table->string('shortname', 255)->nullable(); |
|
| 35 | + $table->string('children', 255)->nullable(); |
|
| 36 | + $table->unsignedTinyInteger('is_child')->nullable(); |
|
| 37 | + $table->string('status', 255)->nullable(); |
|
| 38 | + $table->string('embedded', 255)->nullable(); |
|
| 39 | + $table->string('theme', 50)->nullable(); |
|
| 40 | + $table->text('meta_description')->nullable(); |
|
| 41 | + $table->text('meta_keywords')->nullable(); |
|
| 42 | + $table->text('page_css')->nullable(); |
|
| 43 | + $table->text('page_js')->nullable(); |
|
| 44 | + $table->string('limit', 20)->nullable(); |
|
| 45 | + $table->string('warning', 20)->nullable(); |
|
| 46 | + $table->string('callback', 255)->nullable(); |
|
| 47 | + $table->unsignedTinyInteger('required')->nullable(); |
|
| 48 | + $table->string('comment_equals', 255)->nullable(); |
|
| 49 | + $table->integer('max_instances')->nullable()->default(0); |
|
| 50 | + $table->date('start_date')->nullable(); |
|
| 51 | + $table->date('end_date')->nullable(); |
|
| 52 | 52 | $table->string('lang', 255)->nullable(); |
| 53 | 53 | $table->timestamps(); |
| 54 | 54 | |
| 55 | 55 | |
| 56 | 56 | |
| 57 | 57 | |
| 58 | - $table->index('datastore_id', 'index_foreignkey_datastore'); |
|
| 58 | + $table->index('datastore_id', 'index_foreignkey_datastore'); |
|
| 59 | 59 | |
| 60 | - $table->foreign('datastore_id', 'datastore_ibfk_1')->references('id')->on('datastore')->onDelete('CASCADE')->onUpdate('RESTRICT'); |
|
| 60 | + $table->foreign('datastore_id', 'datastore_ibfk_1')->references('id')->on('datastore')->onDelete('CASCADE')->onUpdate('RESTRICT'); |
|
| 61 | 61 | |
| 62 | - }); |
|
| 62 | + }); |
|
| 63 | 63 | |
| 64 | 64 | |
| 65 | 65 | |
| 66 | - } |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * Reverse the migrations. |
|
| 70 | - * |
|
| 71 | - * @return void |
|
| 72 | - */ |
|
| 73 | - public function down() |
|
| 74 | - { |
|
| 75 | - Schema::dropIfExists('datastore'); |
|
| 76 | - } |
|
| 68 | + /** |
|
| 69 | + * Reverse the migrations. |
|
| 70 | + * |
|
| 71 | + * @return void |
|
| 72 | + */ |
|
| 73 | + public function down() |
|
| 74 | + { |
|
| 75 | + Schema::dropIfExists('datastore'); |
|
| 76 | + } |
|
| 77 | 77 | } |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | public function up() |
| 19 | 19 | { |
| 20 | - Schema::create('datastore', function (Blueprint $table) { |
|
| 20 | + Schema::create('datastore', function(Blueprint $table) { |
|
| 21 | 21 | $table->bigIncrements('id'); |
| 22 | 22 | $table->string('type', 255)->nullable(); |
| 23 | 23 | $table->string('namespace', 255)->nullable(); |