10 public function init()
14 Yii::import(
'fg.widgets.form.helpers.FGFormWidgetHelper');
15 $this->processFormHTML();
16 $this->showErrors =
true;
17 if(isset($this->notPublish)):$this->showErrors=
false;endif;
18 $this->formdata = array();
19 if(isset($_SESSION[
'formdatas']) && isset($_SESSION[
'formdatas'][$this->
id])):
20 $this->formdata = $_SESSION[
'formdatas'][$this->id];
26 $errors = FGFormWidgetHelper::getErrors($this->model->id);
27 if($this->showErrors):
28 $this->render(
'fg.widgets.form.views.form', array(
30 'formdata' => $this->formdata
33 $this->render(
'fg.widgets.form.views.form',array(
'formdata' => $this->formdata));
37 protected function processFormHTML()
39 $attrs =
'action="'.Yii::app()->createUrl(
'/fg/form/submit').
'"';
40 $this->model->html = str_replace(
'<form',
'<form '.$attrs, $this->model->html);
43 $this->model->html = str_replace(
'class="ui-droppable ui-sortable',
'class="anfrage', $this->model->html);
48 $this->model->html = str_replace(
'"/proxy',
'"', $this->model->html);
51 $hiddenFields = array(
52 'form_id' => $this->model->id,
53 'return_url' => Yii::app()->request->requestUri,
54 'referer' => Yii::app()->request->urlReferrer,
55 'submitAction' =>
"submit"
58 foreach($hiddenFields as $k => $v) {
59 $fields .= CHtml::hiddenField($k, $v);
61 $this->model->html = str_replace(
'</form>', $fields.
'</form>', $this->model->html);