Autodoc
  • Namespace
  • Class
  • Tree

Namespaces

  • BlueTihi
    • Context
  • Brickrouge
    • Element
      • Nodes
    • Renderer
    • Widget
  • ICanBoogie
    • ActiveRecord
    • AutoConfig
    • CLDR
    • Composer
    • Core
    • Event
    • Exception
    • HTTP
      • Dispatcher
      • Request
    • I18n
      • Translator
    • Mailer
    • Modules
      • Taxonomy
        • Support
      • Thumbnailer
        • Versions
    • Object
    • Operation
      • Dispatcher
    • Prototype
    • Routes
    • Routing
      • Dispatcher
    • Session
  • Icybee
    • ActiveRecord
      • Model
    • ConfigOperation
    • Document
    • EditBlock
    • Element
      • ActionbarContextual
      • ActionbarSearch
      • ActionbarToolbar
    • FormBlock
    • Installer
    • ManageBlock
    • Modules
      • Articles
      • Cache
        • Collection
        • ManageBlock
      • Comments
        • ManageBlock
      • Contents
        • ManageBlock
      • Dashboard
      • Editor
        • Collection
      • Files
        • File
        • ManageBlock
      • Forms
        • Form
        • ManageBlock
      • I18n
      • Images
        • ManageBlock
      • Members
      • Modules
        • ManageBlock
      • Nodes
        • ManageBlock
        • Module
      • Pages
        • BreadcrumbElement
        • LanguagesElement
        • ManageBlock
        • NavigationBranchElement
        • NavigationElement
        • Page
        • PageController
      • Registry
      • Search
      • Seo
      • Sites
        • ManageBlock
      • Taxonomy
        • Terms
          • ManageBlock
        • Vocabulary
          • ManageBlock
      • Users
        • ManageBlock
        • NonceLogin
        • Roles
      • Views
        • ActiveRecordProvider
        • Collection
        • View
    • Operation
      • ActiveRecord
      • Constructor
      • Module
      • Widget
    • Rendering
  • None
  • Patron
  • PHP

Classes

  • ContactForm
  • DefaultsOperation
  • EditBlock
  • EmailComposer
  • Form
  • FormEditor
  • FormEditorElement
  • Hooks
  • ManageBlock
  • Model
  • Module
  • NotifyParams
  • PopForm
  • PostOperation
  • PressContactForm
  • QuickContactForm

Interfaces

  • AlterNotify
 1 <?php
 2 
 3 /*
 4  * This file is part of the Icybee package.
 5  *
 6  * (c) Olivier Laviale <olivier.laviale@gmail.com>
 7  *
 8  * For the full copyright and license information, please view the LICENSE
 9  * file that was distributed with this source code.
10  */
11 
12 namespace Icybee\Modules\Forms;
13 
14 /**
15  * Post a form.
16  *
17  * Note: The form is retrieved by a hook attached to the
18  * {@link \ICanBoogie\Operation\GetFormEvent} event, just like any other operation.
19  *
20  * @property \ICanBoogie\Form $form
21  * @property Form $record
22  */
23 class PostOperation extends \ICanBoogie\Operation
24 {
25     /**
26      * Controls for the operation: form.
27      */
28     protected function get_controls()
29     {
30         return array
31         (
32             self::CONTROL_FORM => true
33         )
34 
35         + parent::get_controls();
36     }
37 
38     /**
39      * Returns the form record associated with the operation.
40      *
41      * @return Form
42      */
43     protected function lazy_get_record()
44     {
45         $nid = $this->request[Module::OPERATION_POST_ID];
46 
47         if (!$nid)
48         {
49             return;
50         }
51 
52         return $this->module->model[$nid];
53     }
54 
55     protected function validate(\ICanboogie\Errors $errors)
56     {
57         return !count($errors);
58     }
59 
60     /**
61      * Processes the form submission.
62      *
63      * The `finalize` method of the form is used to finalize the operation and obtain a result.
64      * The method is optional, and if the form doesn't define it the value `true` is returned
65      * instead.
66      *
67      * @return mixed The result of the operation.
68      */
69     protected function process()
70     {
71         $form = $this->form;
72 
73         $rc = method_exists($form, 'finalize') ? $form->finalize($this) : true;
74 
75         if ($rc && $this->request->is_xhr)
76         {
77             $this->response->message = $this->record->complete;
78         }
79 
80         return $rc;
81     }
82 }
Autodoc API documentation generated by ApiGen 2.8.0