Esempio n. 1
0
 /**
  * Save the block configs
  */
 public function saveConfigs()
 {
     \app::addListener('error', array($this, 'catchError'));
     /* Test if new file contains errors */
     $testIfHasError = \tools::testSyntaxError($_POST['editor'], array('_this' => $this));
     /* If new file contains errors */
     if ($testIfHasError === TRUE) {
         /* If there's no errors, Save new file */
         \tools::file_put_contents(PROFILE_PATH . $this->getConfig('viewPath'), $_POST['editor']);
     }
 }
Esempio n. 2
0
 public function saveConfigs()
 {
     $viewPath = PROFILE_PATH . $this->getConfig('viewPath');
     /* Mode Read/Write */
     if ($_POST['mode'] === '') {
         $this->setConfig('pagination', $_POST['pagination']);
         $this->setConfig('nbitem', $_POST['nbitem']);
         $this->setConfig('selected', $_POST['properties']);
         $this->setConfig('filter', $_POST['filter']);
         $this->setConfig('sort', $_POST['sort']);
         $this->setConfig('group', $_POST['group']);
         $this->setConfig('regenerateview', $_POST['regenerateview']);
         if (isset($_POST['tables'])) {
             $this->setConfig('tables', $_POST['tables']);
         }
         if (isset($_POST['relations'])) {
             $myView = new \view($_POST['properties'], $_POST['relations']);
         } else {
             $myView = new \view($_POST['properties']);
         }
     } elseif ($_POST['mode'] === 'r') {
         $myView = $this->getConfig('view');
     }
     /* Pagination for all modes */
     $this->setConfig('pagination', $_POST['pagination']);
     $this->setConfig('nbitem', $_POST['nbitem']);
     if ($this->getConfig('pagination')) {
         $myView->setPagination(TRUE);
     }
     if ($this->getConfig('nbitem') != '') {
         $myView->limit($this->getConfig('nbitem'));
     }
     $this->setConfig('view', $myView);
     if ($_POST['mode'] === '') {
         /* Test for errors in view and save */
         \app::addListener('error', array($this, 'catchError'));
         /* Test if new file contains errors */
         $testIfHasError = \tools::testSyntaxError($_POST['editor'], array('_this' => $this, 'view' => $myView));
         /* If new file contains errors */
         if ($testIfHasError === TRUE) {
             /* If there's no errors, Save new file */
             if ($this->getConfig('regenerateview') == 0) {
                 \tools::file_put_contents($viewPath, $this->generateViewAction($_POST['properties']));
             } else {
                 \tools::file_put_contents($viewPath, $_POST['editor']);
             }
         }
     }
 }