get() public static method

Get all data for a given id.
public static get ( integer $id ) : array
$id integer The id for the record to get.
return array
Beispiel #1
0
 /**
  * @param $params
  */
 public static function afterFormSubmission($params)
 {
     $formId = isset($params['form_id']) ? $params['form_id'] : null;
     if ($formId) {
         $dataId = isset($params['data_id']) ? $params['data_id'] : null;
         if ($dataId) {
             $visitorId = isset($params['visitorId']) ? $params['visitorId'] : null;
             if ($visitorId) {
                 $postedFields = isset($params['fields']) ? $params['fields'] : null;
                 if ($postedFields) {
                     $form = BackendFormBuilderModel::get($formId);
                     if (!empty($form)) {
                         if (isset($form['method']) && $form['method'] == 'database_email') {
                             foreach ($postedFields as $field) {
                                 $value = isset($field['value']) ? unserialize($field['value']) : null;
                                 if ($value) {
                                     if (filter_var($value, FILTER_VALIDATE_EMAIL)) {
                                         self::mailEndUser($value, $postedFields, $form, $dataId);
                                         return;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Beispiel #2
0
 /**
  * Execute the action
  */
 public function execute()
 {
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id !== null && BackendFormBuilderModel::exists($this->id)) {
         parent::execute();
         // get all data for the item we want to edit
         $this->record = (array) BackendFormBuilderModel::get($this->id);
         // delete item
         BackendFormBuilderModel::delete($this->id);
         // trigger event
         BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id));
         // user was deleted, so redirect
         $this->redirect(BackendModel::createURLForAction('Index') . '&report=deleted&var=' . rawurlencode($this->record['name']));
     } else {
         // no item found, throw an exceptions, because somebody is f*****g with our URL
         $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
     }
 }
Beispiel #3
0
 /**
  * Get the data
  */
 private function getData()
 {
     $this->record = BackendFormBuilderModel::get($this->id);
 }
Beispiel #4
0
 /**
  * Get the data
  */
 private function getData()
 {
     $this->data = BackendFormBuilderModel::getData($this->id);
     $this->record = BackendFormBuilderModel::get($this->data['form_id']);
 }