public function createAction()
 {
     // Get form
     $this->view->form = $form = new Ynsocialads_Form_Admin_Module_Create();
     // Check stuff
     if (!$this->getRequest()->isPost()) {
         return;
     }
     if (!$form->isValid($this->getRequest()->getPost())) {
         return;
     }
     // Save
     $values = $form->getValues();
     $module = Engine_Api::_()->getDbtable('modules', 'ynsocialads')->createRow();
     //get title module
     $module_core_table = Engine_Api::_()->getDbtable('modules', 'core');
     $module_core_select = $module_core_table->select()->where('name = ?', $values['module_name'])->limit(1);
     $module_core = $module_core_table->fetchRow($module_core_select);
     if ($module_core) {
         $module->module_title = $values['module_title'];
     } else {
         $form->addError("Can not find module name.");
         return;
     }
     $module->module_name = strtolower($values['module_name']);
     $module->table_item = $values['table_item'];
     $module->title_field = $values['title_field'];
     $module->body_field = $values['body_field'];
     $module->owner_field = $values['owner_field'];
     $module->save();
     return $this->_forward('success', 'utility', 'core', array('messages' => array(Zend_Registry::get('Zend_Translate')->_('Module Added.')), 'format' => 'smoothbox', 'smoothboxClose' => true, 'parentRefresh' => true));
 }
Exemple #2
0
 public function init()
 {
     parent::init();
     $this->setTitle('Edit Module');
     $this->setDescription("");
     $this->submit->setLabel('Edit');
 }