| @@ 19-41 (lines=23) @@ | ||
| 16 | * |
|
| 17 | * @param Anax\DI\DIInterface $di a service container |
|
| 18 | */ |
|
| 19 | public function __construct(DIInterface $di) |
|
| 20 | { |
|
| 21 | parent::__construct($di); |
|
| 22 | $this->form->create( |
|
| 23 | [ |
|
| 24 | "id" => __CLASS__, |
|
| 25 | "legend" => "Delete an item", |
|
| 26 | ], |
|
| 27 | [ |
|
| 28 | "select" => [ |
|
| 29 | "type" => "select", |
|
| 30 | "label" => "Select item to delete:", |
|
| 31 | "options" => $this->getAllItems(), |
|
| 32 | ], |
|
| 33 | ||
| 34 | "submit" => [ |
|
| 35 | "type" => "submit", |
|
| 36 | "value" => "Delete item", |
|
| 37 | "callback" => [$this, "callbackSubmit"], |
|
| 38 | ], |
|
| 39 | ] |
|
| 40 | ); |
|
| 41 | } |
|
| 42 | ||
| 43 | ||
| 44 | /** |
|
| @@ 20-46 (lines=27) @@ | ||
| 17 | * |
|
| 18 | * @param Anax\DI\DIInterface $di a service container |
|
| 19 | */ |
|
| 20 | public function __construct(DIInterface $di, $id) |
|
| 21 | { |
|
| 22 | parent::__construct($di); |
|
| 23 | ||
| 24 | $this->form->create( |
|
| 25 | [ |
|
| 26 | "id" => __CLASS__, |
|
| 27 | "legend" => "Create new comment", |
|
| 28 | ], |
|
| 29 | [ |
|
| 30 | "text" => [ |
|
| 31 | "type" => "textarea" |
|
| 32 | ], |
|
| 33 | ||
| 34 | "hidden" => [ |
|
| 35 | "type" => "hidden", |
|
| 36 | "value" => $id, |
|
| 37 | ], |
|
| 38 | ||
| 39 | "submit" => [ |
|
| 40 | "type" => "submit", |
|
| 41 | "value" => "Create comment", |
|
| 42 | "callback" => [$this, "callbackSubmit"], |
|
| 43 | ], |
|
| 44 | ] |
|
| 45 | ); |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * Callback for submit-button which should return true if it could |
|
| @@ 22-55 (lines=34) @@ | ||
| 19 | * |
|
| 20 | * @param Anax\DI\DIInterface $di a service container |
|
| 21 | */ |
|
| 22 | public function __construct(DIInterface $di) |
|
| 23 | { |
|
| 24 | parent::__construct($di); |
|
| 25 | ||
| 26 | $this->form->create( |
|
| 27 | [ |
|
| 28 | "id" => __CLASS__, |
|
| 29 | "legend" => "Create Post", |
|
| 30 | ], |
|
| 31 | [ |
|
| 32 | "title" => [ |
|
| 33 | "type" => "text", |
|
| 34 | ], |
|
| 35 | ||
| 36 | "text" => [ |
|
| 37 | "type" => "text", |
|
| 38 | ], |
|
| 39 | ||
| 40 | "tags" => [ |
|
| 41 | "type" => "text", |
|
| 42 | ], |
|
| 43 | ||
| 44 | "submit" => [ |
|
| 45 | "type" => "submit", |
|
| 46 | "value" => "Create Post", |
|
| 47 | "callback" => [$this, "callbackSubmit"], |
|
| 48 | ], |
|
| 49 | ] |
|
| 50 | ); |
|
| 51 | } |
|
| 52 | ||
| 53 | ||
| 54 | /** |
|
| 55 | * Callback for submit-button which should return true if it could |
|
| 56 | * carry out its work and false if something failed. |
|
| 57 | * |
|
| 58 | * @return boolean true if okey, false if something went wrong. |
|