public function Advanced() {
      // Check permission
      $this->Permission('Garden.Settings.Manage');
      
      // Load up config options we'll be setting
      $Validation = new Gdn_Validation();
      $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
      $ConfigurationModel->SetField(array(
         'Vanilla.Discussions.PerPage',
         'Vanilla.Comments.AutoRefresh',
         'Vanilla.Comments.PerPage',
         'Garden.Html.AllowedElements',
         'Vanilla.Archive.Date',
         'Vanilla.Archive.Exclude',
         'Garden.EditContentTimeout',
         'Vanilla.AdminCheckboxes.Use',
         'Vanilla.Discussions.SortField' => 'd.DateLastComment',
         'Vanilla.Discussions.UserSortField'
      ));
      
      // Set the model on the form.
      $this->Form->SetModel($ConfigurationModel);
      
      // If seeing the form for the first time...
      if ($this->Form->AuthenticatedPostBack() === FALSE) {
         // Apply the config settings to the form.
         $this->Form->SetData($ConfigurationModel->Data);
      } else {
         // Define some validation rules for the fields being saved
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Discussions.PerPage', 'Required');
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Discussions.PerPage', 'Integer');
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Comments.AutoRefresh', 'Integer');
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Comments.PerPage', 'Required');
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Comments.PerPage', 'Integer');
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Archive.Date', 'Date');
         $ConfigurationModel->Validation->ApplyRule('Garden.EditContentTimeout', 'Integer');
         
         // Grab old config values to check for an update.
         $ArchiveDateBak = Gdn::Config('Vanilla.Archive.Date');
         $ArchiveExcludeBak = (bool)Gdn::Config('Vanilla.Archive.Exclude');
         
         // Save new settings
         $Saved = $this->Form->Save();
         if($Saved) {
            $ArchiveDate = Gdn::Config('Vanilla.Archive.Date');
            $ArchiveExclude = (bool)Gdn::Config('Vanilla.Archive.Exclude');
            
            if($ArchiveExclude != $ArchiveExcludeBak || ($ArchiveExclude && $ArchiveDate != $ArchiveDateBak)) {
               $DiscussionModel = new DiscussionModel();
               $DiscussionModel->UpdateDiscussionCount('All');
            }
            $this->InformMessage(T("Your changes have been saved."));
         }
      }
      
      $this->AddSideMenu('vanilla/settings/advanced');
      $this->AddJsFile('settings.js');
      $this->Title(T('Advanced Forum Settings'));
      
      // Render default view (settings/advanced.php)
      $this->Render();
   }
public function Advanced() {
      // Check permission
      $this->Permission('Garden.Settings.Manage');
      
      // Load up config options we'll be setting
      $Validation = new Gdn_Validation();
      $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
      $ConfigurationModel->SetField(array(
         'Vanilla.Discussions.PerPage',
         'Vanilla.Comments.AutoRefresh',
         'Vanilla.Comments.PerPage',
         'Garden.Html.AllowedElements',
         'Vanilla.Archive.Date',
         'Vanilla.Archive.Exclude',
         'Garden.EditContentTimeout',
         'Vanilla.AdminCheckboxes.Use',
         'Vanilla.Discussions.SortField' => 'd.DateLastComment',
         'Vanilla.Discussions.UserSortField'
      ));
      
      // Set the model on the form.
      $this->Form->SetModel($ConfigurationModel);
      
      // If seeing the form for the first time...
      if ($this->Form->AuthenticatedPostBack() === FALSE) {
         // Apply the config settings to the form.
         $this->Form->SetData($ConfigurationModel->Data);
      } else {
         // Define some validation rules for the fields being saved
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Discussions.PerPage', 'Required');
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Discussions.PerPage', 'Integer');
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Comments.AutoRefresh', 'Integer');
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Comments.PerPage', 'Required');
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Comments.PerPage', 'Integer');
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Archive.Date', 'Date');
         $ConfigurationModel->Validation->ApplyRule('Garden.EditContentTimeout', 'Integer');
         
         // Grab old config values to check for an update.
         $ArchiveDateBak = Gdn::Config('Vanilla.Archive.Date');
         $ArchiveExcludeBak = (bool)Gdn::Config('Vanilla.Archive.Exclude');
         
         // Save new settings
         $Saved = $this->Form->Save();
         if($Saved) {
            $ArchiveDate = Gdn::Config('Vanilla.Archive.Date');
            $ArchiveExclude = (bool)Gdn::Config('Vanilla.Archive.Exclude');
            
            if($ArchiveExclude != $ArchiveExcludeBak || ($ArchiveExclude && $ArchiveDate != $ArchiveDateBak)) {
               $DiscussionModel = new DiscussionModel();
               $DiscussionModel->UpdateDiscussionCount('All');
            }
            $this->InformMessage(T("Your changes have been saved."));
         }
      }
      
      $this->AddSideMenu('vanilla/settings/advanced');
      $this->AddJsFile('settings.js');
      $this->Title(T('Advanced Forum Settings'));
      
      // Render default view (settings/advanced.php)
      $this->Render();
   }
public function Advanced ( ) { // Check permission $ this -> Permission ( 'Garden.Settings.Manage' ) ; // Load up config options we'll be setting $ Validation = new Gdn_Validation ( ) ; $ ConfigurationModel = new Gdn_ConfigurationModel ( $ Validation ) ; $ ConfigurationModel -> SetField ( array ( 'Vanilla.Discussions.PerPage' , 'Vanilla.Comments.AutoRefresh' , 'Vanilla.Comments.PerPage' , 'Garden.Html.AllowedElements' , 'Vanilla.Archive.Date' , 'Vanilla.Archive.Exclude' , 'Garden.EditContentTimeout' , 'Vanilla.AdminCheckboxes.Use' , 'Vanilla.Discussions.SortField' => 'd.DateLastComment' , 'Vanilla.Discussions.UserSortField' ) ) ; // Set the model on the form. $ this -> Form -> SetModel ( $ ConfigurationModel ) ; // If seeing the form for the first time... if ( $ this -> Form -> AuthenticatedPostBack ( ) === FALSE ) { // Apply the config settings to the form. $ this -> Form -> SetData ( $ ConfigurationModel -> Data ) ; } else { // Define some validation rules for the fields being saved $ ConfigurationModel -> Validation -> ApplyRule ( 'Vanilla.Discussions.PerPage' , 'Required' ) ; $ ConfigurationModel -> Validation -> ApplyRule ( 'Vanilla.Discussions.PerPage' , 'Integer' ) ; $ ConfigurationModel -> Validation -> ApplyRule ( 'Vanilla.Comments.AutoRefresh' , 'Integer' ) ; $ ConfigurationModel -> Validation -> ApplyRule ( 'Vanilla.Comments.PerPage' , 'Required' ) ; $ ConfigurationModel -> Validation -> ApplyRule ( 'Vanilla.Comments.PerPage' , 'Integer' ) ; $ ConfigurationModel -> Validation -> ApplyRule ( 'Vanilla.Archive.Date' , 'Date' ) ; $ ConfigurationModel -> Validation -> ApplyRule ( 'Garden.EditContentTimeout' , 'Integer' ) ; // Grab old config values to check for an update. $ ArchiveDateBak = Gdn :: Config ( 'Vanilla.Archive.Date' ) ; $ ArchiveExcludeBak = ( bool ) Gdn :: Config ( 'Vanilla.Archive.Exclude' ) ; // Save new settings $ Saved = $ this -> Form -> Save ( ) ; if ( $ Saved ) { $ ArchiveDate = Gdn :: Config ( 'Vanilla.Archive.Date' ) ; $ ArchiveExclude = ( bool ) Gdn :: Config ( 'Vanilla.Archive.Exclude' ) ; if ( $ ArchiveExclude != $ ArchiveExcludeBak || ( $ ArchiveExclude && $ ArchiveDate != $ ArchiveDateBak ) ) { $ DiscussionModel = new DiscussionModel ( ) ; $ DiscussionModel -> UpdateDiscussionCount ( 'All' ) ; } $ this -> InformMessage ( T ( "Your changes have been saved." ) ) ; } } $ this -> AddSideMenu ( 'vanilla/settings/advanced' ) ; $ this -> AddJsFile ( 'settings.js' ) ; $ this -> Title ( T ( 'Advanced Forum Settings' ) ) ; // Render default view (settings/advanced.php) $ this -> Render ( ) ; }
Advanced settings.

Allows setting configuration values via form elements.

@since 2.0.0
@access public
Advanced settings .