function actionManageForums() { // Create the addForum form $form = new YDForm('forumForm'); $form->addElement('text', 'forumTitle', t('admin.newforumtitle'), array("size" => 40)); $form->addElement('text', 'forumPoids', t('admin.forumweightorder'), array()); $form->addElement('submit', 'cmdSubmit', t('admin.forumcreate')); // Add rules $form->addFormRule(array(&$this, 'checkNewForum')); $form->addRule('forumPoids', 'numeric', t('admin.forumweightinteger')); // Process the form if ($form->validate()) { // get and show results $forum = new ForumObject($form->getValue('forumTitle'), $form->getValue('forumPoids')); $forum->insert(); } // Future defaults values $form->setDefaults(array('forumTitle' => '')); $form->setDefaults(array('forumPoids' => '')); // retrieve existing forums $forumLogic = new ForumsLogic(); $forums = $forumLogic->retrieveAllByOrderSimple(); // Assign variables to the template $this->actionTpl->assign('form', $form->toArray()); $this->actionTpl->assign('forums', $forums); $content = new Page($this->actionTpl->fetch('templates/admin.forums.list.tpl'), t('admin.manageforums'), $this->menusAdmin); // Display the action template into the master template $this->display($content); }