original_string: public function ManageCategories() {
        // Check permission
        $this->Permission('Garden.Settings.Manage');
        
        $this->AddSideMenu('vanilla/settings/managecategories');
        
        // Nested sortable always breaks when we update jQuery so we give it it's own old version of jquery.
        $this->RemoveJsFile('jquery.js');
        $this->AddJsFile('js/library/nestedSortable.1.3.4/jquery-1.7.2.min.js', '', array('Sort' => 0));
        
        $this->AddJsFile('categories.js');
        $this->AddJsFile('js/library/jquery.alphanumeric.js');
        $this->AddJsFile('js/library/nestedSortable.1.3.4/jquery-ui-1.8.11.custom.min.js');
        $this->AddJsFile('js/library/nestedSortable.1.3.4/jquery.ui.nestedSortable.js');
        $this->Title(T('Categories'));
        
        // Get category data
        $this->SetData('CategoryData', $this->CategoryModel->GetAll('TreeLeft'), TRUE);
        
        // Enable/Disable Categories
        if (Gdn::Session()->ValidateTransientKey(GetValue(1, $this->RequestArgs))) {
           $Toggle = GetValue(0, $this->RequestArgs, '');
           if ($Toggle == 'enable') {
              SaveToConfig('Vanilla.Categories.Use', TRUE);
           } else if ($Toggle == 'disable') {
              SaveToConfig('Vanilla.Categories.Use', FALSE);
           }
           Redirect('vanilla/settings/managecategories');
        }
        
        // Setup & save forms
        $Validation = new Gdn_Validation();
        $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
        $ConfigurationModel->SetField(array(
           'Vanilla.Categories.MaxDisplayDepth',
           'Vanilla.Categories.DoHeadings',
           'Vanilla.Categories.HideModule'
        ));
        
        // Set the model on the form.
        $this->Form->SetModel($ConfigurationModel);
        
        // Define MaxDepthOptions
        $DepthData = array();
        $DepthData['2'] = sprintf(T('more than %s deep'), Plural(1, '%s level', '%s levels'));
        $DepthData['3'] = sprintf(T('more than %s deep'), Plural(2, '%s level', '%s levels'));
        $DepthData['4'] = sprintf(T('more than %s deep'), Plural(3, '%s level', '%s levels')) ;
        $DepthData['0'] = T('never');
        $this->SetData('MaxDepthData', $DepthData);
        
        // 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 {
           if ($this->Form->Save() !== FALSE)
              $this->InformMessage(T("Your settings have been saved."));
        }
        
        // Render default view
        $this->Render();
     }
code: public function ManageCategories() {
        // Check permission
        $this->Permission('Garden.Settings.Manage');
        
        $this->AddSideMenu('vanilla/settings/managecategories');
        
        // Nested sortable always breaks when we update jQuery so we give it it's own old version of jquery.
        $this->RemoveJsFile('jquery.js');
        $this->AddJsFile('js/library/nestedSortable.1.3.4/jquery-1.7.2.min.js', '', array('Sort' => 0));
        
        $this->AddJsFile('categories.js');
        $this->AddJsFile('js/library/jquery.alphanumeric.js');
        $this->AddJsFile('js/library/nestedSortable.1.3.4/jquery-ui-1.8.11.custom.min.js');
        $this->AddJsFile('js/library/nestedSortable.1.3.4/jquery.ui.nestedSortable.js');
        $this->Title(T('Categories'));
        
        // Get category data
        $this->SetData('CategoryData', $this->CategoryModel->GetAll('TreeLeft'), TRUE);
        
        // Enable/Disable Categories
        if (Gdn::Session()->ValidateTransientKey(GetValue(1, $this->RequestArgs))) {
           $Toggle = GetValue(0, $this->RequestArgs, '');
           if ($Toggle == 'enable') {
              SaveToConfig('Vanilla.Categories.Use', TRUE);
           } else if ($Toggle == 'disable') {
              SaveToConfig('Vanilla.Categories.Use', FALSE);
           }
           Redirect('vanilla/settings/managecategories');
        }
        
        // Setup & save forms
        $Validation = new Gdn_Validation();
        $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
        $ConfigurationModel->SetField(array(
           'Vanilla.Categories.MaxDisplayDepth',
           'Vanilla.Categories.DoHeadings',
           'Vanilla.Categories.HideModule'
        ));
        
        // Set the model on the form.
        $this->Form->SetModel($ConfigurationModel);
        
        // Define MaxDepthOptions
        $DepthData = array();
        $DepthData['2'] = sprintf(T('more than %s deep'), Plural(1, '%s level', '%s levels'));
        $DepthData['3'] = sprintf(T('more than %s deep'), Plural(2, '%s level', '%s levels'));
        $DepthData['4'] = sprintf(T('more than %s deep'), Plural(3, '%s level', '%s levels')) ;
        $DepthData['0'] = T('never');
        $this->SetData('MaxDepthData', $DepthData);
        
        // 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 {
           if ($this->Form->Save() !== FALSE)
              $this->InformMessage(T("Your settings have been saved."));
        }
        
        // Render default view
        $this->Render();
     }
code_tokens: public function ManageCategories ( ) { // Check permission $ this -> Permission ( 'Garden.Settings.Manage' ) ; $ this -> AddSideMenu ( 'vanilla/settings/managecategories' ) ; // Nested sortable always breaks when we update jQuery so we give it it's own old version of jquery. $ this -> RemoveJsFile ( 'jquery.js' ) ; $ this -> AddJsFile ( 'js/library/nestedSortable.1.3.4/jquery-1.7.2.min.js' , '' , array ( 'Sort' => 0 ) ) ; $ this -> AddJsFile ( 'categories.js' ) ; $ this -> AddJsFile ( 'js/library/jquery.alphanumeric.js' ) ; $ this -> AddJsFile ( 'js/library/nestedSortable.1.3.4/jquery-ui-1.8.11.custom.min.js' ) ; $ this -> AddJsFile ( 'js/library/nestedSortable.1.3.4/jquery.ui.nestedSortable.js' ) ; $ this -> Title ( T ( 'Categories' ) ) ; // Get category data $ this -> SetData ( 'CategoryData' , $ this -> CategoryModel -> GetAll ( 'TreeLeft' ) , TRUE ) ; // Enable/Disable Categories if ( Gdn :: Session ( ) -> ValidateTransientKey ( GetValue ( 1 , $ this -> RequestArgs ) ) ) { $ Toggle = GetValue ( 0 , $ this -> RequestArgs , '' ) ; if ( $ Toggle == 'enable' ) { SaveToConfig ( 'Vanilla.Categories.Use' , TRUE ) ; } else if ( $ Toggle == 'disable' ) { SaveToConfig ( 'Vanilla.Categories.Use' , FALSE ) ; } Redirect ( 'vanilla/settings/managecategories' ) ; } // Setup & save forms $ Validation = new Gdn_Validation ( ) ; $ ConfigurationModel = new Gdn_ConfigurationModel ( $ Validation ) ; $ ConfigurationModel -> SetField ( array ( 'Vanilla.Categories.MaxDisplayDepth' , 'Vanilla.Categories.DoHeadings' , 'Vanilla.Categories.HideModule' ) ) ; // Set the model on the form. $ this -> Form -> SetModel ( $ ConfigurationModel ) ; // Define MaxDepthOptions $ DepthData = array ( ) ; $ DepthData [ '2' ] = sprintf ( T ( 'more than %s deep' ) , Plural ( 1 , '%s level' , '%s levels' ) ) ; $ DepthData [ '3' ] = sprintf ( T ( 'more than %s deep' ) , Plural ( 2 , '%s level' , '%s levels' ) ) ; $ DepthData [ '4' ] = sprintf ( T ( 'more than %s deep' ) , Plural ( 3 , '%s level' , '%s levels' ) ) ; $ DepthData [ '0' ] = T ( 'never' ) ; $ this -> SetData ( 'MaxDepthData' , $ DepthData ) ; // 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 { if ( $ this -> Form -> Save ( ) !== FALSE ) $ this -> InformMessage ( T ( "Your settings have been saved." ) ) ; } // Render default view $ this -> Render ( ) ; }
docstring: Enabling and disabling categories from list.
  
  @since 2.0.0
  @access public
docstring_tokens: Enabling and disabling categories from list .