Exemplo n.º 1
0
 /**
  *  @throws \Ip\Exception\Db
  */
 public function activate()
 {
     $savedTableTypes = ipGetOption(TableType::OPTION);
     if (empty($savedTableTypes)) {
         ipSetOption(TableType::OPTION, array());
         TableType::create(array('name' => 'default', 'language' => ipContent()->getLanguages()[0]->getId(), 'columnOption' => TableType::SHOW_ALL_COLUMNS, 'specificColumns' => array()))->save();
     }
     $this->createDataTableRepository();
 }
Exemplo n.º 2
0
 public function addTableType()
 {
     ipRequest()->mustBePost();
     $post = ipRequest()->getPost();
     $form = AdminFormHelper::createForm(false);
     $form->removeSpamCheck();
     $errors = $form->validate($post);
     if (!empty($errors)) {
         $data = array('status' => 'error', 'errors' => $errors);
         return new \Ip\Response\Json($data);
     }
     $tableTypeData = self::convertPostToTableTypeData($post);
     $tableType = TableType::create($tableTypeData);
     $tableType->save();
     $data = array('status' => 'ok', 'tableType' => $tableType->toArray());
     return new \Ip\Response\Json($data);
 }