Ejemplo n.º 1
0
 public function orderFieldsAction($modelName, $recursiveDepth)
 {
     $fields = array();
     if ($modelName !== '0') {
         try {
             $fields = ContentOverviewPropertiesForm::getModelFieldOptions(ModelManager::getInstance(), $modelName, true, false, $recursiveDepth);
         } catch (Exception $exception) {
             Zibo::getInstance()->runEvent(Zibo::EVENT_LOG, $exception->getMessage(), $exception->getTraceAsString());
         }
     }
     $view = new JsonView(array('fields' => $fields));
     $this->response->setView($view);
 }
 /**
  * Action to show and edit the properties of this widget
  * @return null
  */
 public function propertiesAction()
 {
     $contentProperties = $this->getContentProperties();
     $form = new ContentOverviewPropertiesForm($this->request->getBasePath(), $this->properties->getNode(), $contentProperties);
     if ($form->isSubmitted()) {
         if ($form->isCancelled()) {
             $this->response->setRedirect($this->request->getBaseUrl());
             return false;
         }
         try {
             $form->validate();
             $contentProperties = $form->getContentProperties();
             $contentProperties->setToWidgetProperties($this->properties, $this->locale);
             $this->response->setRedirect($this->request->getBaseUrl());
             return true;
         } catch (ValidationException $exception) {
         }
     }
     $ajaxUrl = Zibo::getInstance()->getRequest()->getBaseUrl() . Request::QUERY_SEPARATOR . AjaxController::ROUTE . Request::QUERY_SEPARATOR;
     $fieldsAction = $ajaxUrl . AjaxController::ACTION_FIELDS . Request::QUERY_SEPARATOR;
     $orderFieldsAction = $ajaxUrl . AjaxController::ACTION_ORDER_FIELDS . Request::QUERY_SEPARATOR;
     $view = new ContentOverviewPropertiesView($form, $fieldsAction, $orderFieldsAction);
     $this->response->setView($view);
     return false;
 }