<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/
class Forum_AdminSettingsController extends Core_Controller_Action_Admin
{
  public function indexAction()
  {
    $this->view->navigation = $navigation = Engine_Api::_()->getApi('menus', 'core')
      ->getNavigation('forum_admin_main', array(), 'forum_admin_main_settings');

    $settings = Engine_Api::_()->getApi('settings', 'core');
    $this->view->form = $form = new Forum_Form_Admin_Settings_Global();

    //$form->bbcode->setValue($settings->getSetting('forum_bbcode', 1));
    //$form->html->setValue($settings->getSetting('forum_html', 0));

    $form->topic_length->setValue($settings->getSetting('forum_topic_pagelength'));
    $form->forum_length->setValue($settings->getSetting('forum_forum_pagelength'));

    if( $this->getRequest()->isPost()&& $form->isValid($this->getRequest()->getPost()))
    {
      $values = $form->getValues();
      $settings->setSetting('forum_topic_pagelength', $values['topic_length']);
      $settings->setSetting('forum_forum_pagelength', $values['forum_length']);

      //$settings->setSetting('forum_bbcode', $values['bbcode']);
      //$settings->setSetting('forum_html', $values['html']);

      $form->addNotice('Your changes have been saved.');
    }
  }
}
