public function newAction()
 {
     $this->view->setRenderLevel(\Phalcon\Mvc\View::LEVEL_ACTION_VIEW);
     $this->persistent->parameters = null;
     $this->view->setViewsDir('../app/views/');
     $this->view->pick('dashboards/new');
     $formController = new \PRIME\Controllers\FormController();
     $form_body = $formController->renderAction($this->form_struct);
     $this->view->setVar("form_body", $form_body);
     $this->view->setVar("type", $this->dashboard_type);
     $form_type = '/dashboards/' . $this->dashboard_type . '/create';
     $this->view->setVar("form_type", $form_type);
     $this->tag->setDefault("weight", "0");
     $this->tag->setDefault("organisation_id", $this->organisation_id);
 }
 public function editAction($id)
 {
     $widget = Widget::findFirstByid($id);
     $this->view->setRenderLevel(\Phalcon\Mvc\View::LEVEL_ACTION_VIEW);
     $this->persistent->parameters = null;
     $this->view->setViewsDir('../app/views/');
     $this->view->pick('widgets/edit');
     $formController = new \PRIME\Controllers\FormController();
     $form_body = $formController->renderAction($this->form_struct);
     $this->tag->setDefault("id", $id);
     //$this->tag->setDefault("parameters", json_decode($widget->parameters));
     $this->view->setVar("form_body", $form_body);
     $this->view->setVar("type", $this->widget_name);
     $form_type = '/widgets/' . str_replace(" ", "_", strtolower($this->widget_name)) . '/save';
     $this->view->setVar("form_type", $form_type);
 }