当前位置: 首页>>代码示例>>PHP>>正文


PHP Gdn_ConfigurationModel::SetField方法代码示例

本文整理汇总了PHP中Gdn_ConfigurationModel::SetField方法的典型用法代码示例。如果您正苦于以下问题:PHP Gdn_ConfigurationModel::SetField方法的具体用法?PHP Gdn_ConfigurationModel::SetField怎么用?PHP Gdn_ConfigurationModel::SetField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gdn_ConfigurationModel的用法示例。


在下文中一共展示了Gdn_ConfigurationModel::SetField方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: PluginController_SingleSignOn_Create

 public function PluginController_SingleSignOn_Create($Sender, $EventArguments)
 {
     $Sender->Head->Title('Single Sign-on');
     $Sender->AddSideMenu('garden/plugin/singlesignon');
     $Validation = new Gdn_Validation();
     $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
     $ConfigurationModel->SetField(array('Garden.Authenticator.Type', 'Garden.Authenticator.Encoding', 'Garden.Authenticator.AuthenticateUrl', 'Garden.Authenticator.SignInUrl', 'Garden.Authenticator.SignOutUrl', 'Garden.Authenticator.RegisterUrl', 'Garden.Cookie.Path'));
     // Set the model on the form.
     $Sender->Form = new Gdn_Form();
     $Sender->Form->SetModel($ConfigurationModel);
     // If seeing the form for the first time...
     if ($Sender->Form->AuthenticatedPostBack() === FALSE) {
         // Apply the config settings to the form.
         $Sender->Form->SetData($ConfigurationModel->Data);
         $Sender->Form->SetValue('EnableSSO', Gdn::Config('Garden.Authenticator.Type') == 'Handshake' ? 'TRUE' : '');
     } else {
         // Make sure to force some values
         $Sender->Form->SetFormValue('Garden.Authenticator.Type', $Sender->Form->GetFormValue('EnableSSO', '') == 'TRUE' ? 'Handshake' : 'Password');
         $Sender->Form->SetFormValue('Garden.Authenticator.Encoding', 'ini');
         $Sender->Form->SetFormValue('Garden.Cookie.Path', '/');
         // <-- Make sure that Vanilla's cookies don't have a path
         if ($Sender->Form->Save() !== FALSE) {
             $Sender->StatusMessage = Translate("Your changes have been saved successfully.");
         }
     }
     $Sender->Render(PATH_PLUGINS . DS . 'SingleSignOn' . DS . 'views' . DS . 'index.php');
 }
开发者ID:edelbalso,项目名称:Garden,代码行数:27,代码来源:default.php

示例2: Index

 /**
  * Display the embedded forum.
  * 
  * @since 2.0.18
  * @access public
  */
 public function Index()
 {
     $this->AddSideMenu('dashboard/embed');
     $this->Title('Embed Vanilla');
     $this->Form = new Gdn_Form();
     $Validation = new Gdn_Validation();
     $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
     $ConfigurationModel->SetField(array('Garden.TrustedDomains'));
     $this->Form->SetModel($ConfigurationModel);
     if ($this->Form->AuthenticatedPostBack() === FALSE) {
         // Format trusted domains as a string
         $TrustedDomains = GetValue('Garden.TrustedDomains', $ConfigurationModel->Data);
         if (is_array($TrustedDomains)) {
             $TrustedDomains = implode("\n", $TrustedDomains);
         }
         $ConfigurationModel->Data['Garden.TrustedDomains'] = $TrustedDomains;
         // Apply the config settings to the form.
         $this->Form->SetData($ConfigurationModel->Data);
     } else {
         // Format the trusted domains as an array based on newlines & spaces
         $TrustedDomains = $this->Form->GetValue('Garden.TrustedDomains');
         $TrustedDomains = explode(' ', str_replace("\n", ' ', $TrustedDomains));
         $TrustedDomains = array_unique(array_map('trim', $TrustedDomains));
         $this->Form->SetFormValue('Garden.TrustedDomains', $TrustedDomains);
         if ($this->Form->Save() !== FALSE) {
             $this->InformMessage(T("Your settings have been saved."));
         }
         // Reformat array as string so it displays properly in the form
         $this->Form->SetFormValue('Garden.TrustedDomains', implode("\n", $TrustedDomains));
     }
     $this->Render();
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:38,代码来源:class.embedcontroller.php

示例3: SettingsController_EventCalendar_Create

 /**
  * Allows customization of categories which allow new discussions to be events 
  * Sets config value Plugins.EventCalendar.CategoryIDs
  *
  * @param object $Sender SettingsController
  */
 public function SettingsController_EventCalendar_Create($Sender)
 {
     $Sender->Permission('Garden.Settings.Manage');
     $Sender->Title(T('Event Calendar Settings'));
     $Sender->AddSideMenu('settings/EventCalendar');
     $Sender->SetData('Info', T('Event Calendar Info', 'Creation of events can be regulated by category <strong>and</strong> user role. You can set up the categories here, but don\'t forget to assign some permissions in the <a href="/index.php?p=dashboard/role">standard permission section</a> in the dashboard, otherwise you users wouldn\'t be able to use this plugin!'));
     $Sender->SetData('CategoriesLabel', 'Please choose categories in which the creation of events should be allowed');
     $Validation = new Gdn_Validation();
     // $Validation->ApplyRule('Plugins.EventCalendar.CategoryIDs', 'RequiredArray', T('You have to choose at least one category. If you don\'t want to use the plugin any longer, please deactivate it'));
     $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
     $ConfigurationModel->SetField(array('Plugins.EventCalendar.CategoryIDs'));
     $Form = $Sender->Form;
     $Sender->Form->SetModel($ConfigurationModel);
     if ($Sender->Form->AuthenticatedPostBack() != FALSE) {
         if ($Sender->Form->Save() != FALSE) {
             $Sender->StatusMessage = T('Saved');
         }
     } else {
         $Sender->Form->SetData($ConfigurationModel->Data);
     }
     $CategoryModel = new Gdn_Model('Category');
     $Sender->CategoryData = $CategoryModel->GetWhere(array('AllowDiscussions' => 1, 'CategoryID <>' => -1));
     $Sender->EventCategory = C('Plugins.EventCalendar.CategoryIDs');
     $Sender->Render('settings', '', 'plugins/EventCalendar');
 }
开发者ID:shumoo,项目名称:EventCalendar,代码行数:31,代码来源:class.eventcalendar.plugin.php

示例4: PluginController_ShareThis_Create

 /**
  * Settings page.
  */
 public function PluginController_ShareThis_Create($Sender)
 {
     $Sender->Permission('Garden.Settings.Manage');
     $Sender->Title('ShareThis');
     $Sender->AddSideMenu('plugin/sharethis');
     $Sender->Form = new Gdn_Form();
     $PublisherNumber = C('Plugin.ShareThis.PublisherNumber', 'Publisher Number');
     $ViaHandle = C('Plugin.ShareThis.ViaHandle', '');
     $CopyNShare = C('Plugin.ShareThis.CopyNShare', false);
     $Validation = new Gdn_Validation();
     $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
     $ConfigArray = array('Plugin.ShareThis.PublisherNumber', 'Plugin.ShareThis.ViaHandle', 'Plugin.ShareThis.CopyNShare');
     if ($Sender->Form->AuthenticatedPostBack() === FALSE) {
         $ConfigArray['Plugin.ShareThis.PublisherNumber'] = $PublisherNumber;
         $ConfigArray['Plugin.ShareThis.ViaHandle'] = $ViaHandle;
         $ConfigArray['Plugin.ShareThis.CopyNShare'] = $CopyNShare;
     }
     $ConfigurationModel->SetField($ConfigArray);
     $Sender->Form->SetModel($ConfigurationModel);
     // If seeing the form for the first time...
     if ($Sender->Form->AuthenticatedPostBack() === FALSE) {
         // Apply the config settings to the form.
         $Sender->Form->SetData($ConfigurationModel->Data);
     } else {
         // Define some validation rules for the fields being saved
         $ConfigurationModel->Validation->ApplyRule('Plugin.ShareThis.PublisherNumber', 'Required');
         if ($Sender->Form->Save() !== FALSE) {
             $Sender->InformMessage(T("Your changes have been saved."));
         }
     }
     $Sender->Render('sharethis', '', 'plugins/ShareThis');
 }
开发者ID:nilsen,项目名称:addons,代码行数:35,代码来源:class.sharethis.plugin.php

示例5: Controller_Index

 public function Controller_Index($Sender)
 {
     // Prevent non-admins from accessing this page
     $Sender->Permission('Vanilla.Settings.Manage');
     $Sender->SetData('PluginDescription', $this->GetPluginKey('Description'));
     $Validation = new Gdn_Validation();
     $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
     $ConfigurationModel->SetField(array('Plugin.PrestigeSlider.RenderCondition' => 'all', 'Plugin.PrestigeSlider.ImageCount' => 0, 'Plugin.PrestigeSlider.Image1url' => '', 'Plugin.PrestigeSlider.Image2url' => '', 'Plugin.PrestigeSlider.Image3url' => '', 'Plugin.PrestigeSlider.Image4url' => '', 'Plugin.PrestigeSlider.Image5url' => '', 'Plugin.PrestigeSlider.Image1href' => '', 'Plugin.PrestigeSlider.Image2href' => '', 'Plugin.PrestigeSlider.Image3href' => '', 'Plugin.PrestigeSlider.Image4href' => '', 'Plugin.PrestigeSlider.Image5href' => ''));
     // Set the model on the form.
     $Sender->Form->SetModel($ConfigurationModel);
     // If seeing the form for the first time...
     if ($Sender->Form->AuthenticatedPostBack() === FALSE) {
         // Apply the config settings to the form.
         $Sender->Form->SetData($ConfigurationModel->Data);
     } else {
         $ConfigurationModel->Validation->ApplyRule('Plugin.PrestigeSlider.ImageCount', 'Required');
         $ConfigurationModel->Validation->ApplyRule('Plugin.PrestigeSlider.Image1url', 'Required');
         $Saved = $Sender->Form->Save();
         if ($Saved) {
             $Sender->StatusMessage = T("Your changes have been saved.");
         }
     }
     // GetView() looks for files inside plugins/PluginFolderName/views/ and returns their full path. Useful!
     $Sender->Render($this->GetView('settings.php'));
 }
开发者ID:hazulu,项目名称:PrestigeSlider,代码行数:25,代码来源:class.prestigeslider.plugin.php

示例6: Spam

 public function Spam()
 {
     $this->Permission('Vanilla.Spam.Manage');
     $this->AddSideMenu('vanilla/settings/spam');
     $Validation = new Gdn_Validation();
     $ConfigurationModel = new Gdn_ConfigurationModel('Configuration', PATH_CONF . DS . 'config.php', $Validation);
     $ConfigurationModel->SetField(array('Vanilla.Discussion.SpamCount', 'Vanilla.Discussion.SpamTime', 'Vanilla.Discussion.SpamLock', 'Vanilla.Comment.SpamCount', 'Vanilla.Comment.SpamTime', 'Vanilla.Comment.SpamLock', 'Vanilla.Comment.MaxLength'));
     // 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.Discussion.SpamCount', 'Required');
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Discussion.SpamCount', 'Integer');
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Discussion.SpamTime', 'Required');
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Discussion.SpamTime', 'Integer');
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Discussion.SpamLock', 'Required');
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Discussion.SpamLock', 'Integer');
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Comment.SpamCount', 'Required');
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Comment.SpamCount', 'Integer');
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Comment.SpamTime', 'Required');
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Comment.SpamTime', 'Integer');
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Comment.SpamLock', 'Required');
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Comment.SpamLock', 'Integer');
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Comment.MaxLength', 'Required');
         $ConfigurationModel->Validation->ApplyRule('Vanilla.Comment.MaxLength', 'Integer');
         if ($this->Form->Save() !== FALSE) {
             $this->StatusMessage = Translate("Your changes have been saved.");
         }
     }
     $this->Render();
 }
开发者ID:kidmax,项目名称:Garden,代码行数:35,代码来源:settings.php

示例7: Controller_Cookie

 public function Controller_Cookie($Sender)
 {
     $ExplodedDomain = explode('.', Gdn::Request()->RequestHost());
     if (sizeof($ExplodedDomain) == 1) {
         $GuessedCookieDomain = '';
     } else {
         $GuessedCookieDomain = '.' . implode('.', array_slice($ExplodedDomain, -2, 2));
     }
     $Validation = new Gdn_Validation();
     $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
     $ConfigurationModel->SetField(array('Plugin.ProxyConnect.NewCookieDomain'));
     // Set the model on the form.
     $Sender->Form->SetModel($ConfigurationModel);
     if ($Sender->Form->AuthenticatedPostBack()) {
         $NewCookieDomain = $Sender->Form->GetValue('Plugin.ProxyConnect.NewCookieDomain', '');
         SaveToConfig('Garden.Cookie.Domain', $NewCookieDomain);
     } else {
         $NewCookieDomain = $GuessedCookieDomain;
     }
     $Sender->SetData('GuessedCookieDomain', $GuessedCookieDomain);
     $CurrentCookieDomain = C('Garden.Cookie.Domain');
     $Sender->SetData('CurrentCookieDomain', $CurrentCookieDomain);
     $Sender->Form->SetData(array('Plugin.ProxyConnect.NewCookieDomain' => $NewCookieDomain));
     $Sender->Form->SetFormValue('Plugin.ProxyConnect.NewCookieDomain', $NewCookieDomain);
     return $this->GetView('cookie.php');
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:26,代码来源:class.proxyconnectmanual.plugin.php

示例8: Edit

   public function Edit($RouteIndex = FALSE) {
      $this->Permission('Garden.Routes.Manage');
      $this->AddSideMenu('dashboard/routes');
      $this->Route = Gdn::Router()->GetRoute($RouteIndex);
      
      $Validation = new Gdn_Validation();
      $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
      $ConfigurationModel->SetField(array('Route', 'Target', 'Type'));
      
      // Set the model on the form.
      $this->Form->SetModel($ConfigurationModel);
            
      // If seeing the form for the first time...
      if (!$this->Form->AuthenticatedPostBack()) {
      
         // Apply the route info to the form.
         if ($this->Route !== FALSE)
            $this->Form->SetData(array(
               'Route'  => $this->Route['Route'], 
               'Target' => $this->Route['Destination'], 
               'Type'   => $this->Route['Type']
            ));
            
      } else {
         // Define some validation rules for the fields being saved
         $ConfigurationModel->Validation->ApplyRule('Route', 'Required');
         $ConfigurationModel->Validation->ApplyRule('Target', 'Required');
         $ConfigurationModel->Validation->ApplyRule('Type', 'Required');
         
         // Validate & Save
         $FormPostValues = $this->Form->FormValues();
         
         // Dunno.
         if ($this->Route['Reserved'])
            $FormPostValues['Route'] = $this->Route['Route'];
            
         if ($ConfigurationModel->Validate($FormPostValues)) {
            $NewRouteName = ArrayValue('Route', $FormPostValues);

            if ($this->Route !== FALSE && $NewRouteName != $this->Route['Route'])
               Gdn::Router()->DeleteRoute($this->Route['Route']);
         
            Gdn::Router()->SetRoute(
               $NewRouteName,
               ArrayValue('Target', $FormPostValues),
               ArrayValue('Type', $FormPostValues)
            );

            $this->InformMessage(T("The route was saved successfully."));
            $this->RedirectUrl = Url('dashboard/routes');
         } else {
            $this->Form->SetValidationResults($ConfigurationModel->ValidationResults());
         }
      }
      
      $this->Render();
   }
开发者ID:nerdgirl,项目名称:Forums-ILoveBadTV,代码行数:57,代码来源:class.routescontroller.php

示例9: Controller_Index

 public function Controller_Index($Sender)
 {
     $Sender->Permission('Vanilla.Settings.Manage');
     $Sender->SetData('PluginDescription', $this->GetPluginKey('Description'));
     $Validation = new Gdn_Validation();
     $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
     $ConfigurationModel->SetField("Plugin.Chatwee.Code");
     $ConfigurationModel->SetField("Plugin.Chatwee.APIKey");
     $ConfigurationModel->SetField("Plugin.Chatwee.Chatid");
     $Sender->Form->SetModel($ConfigurationModel);
     if ($Sender->Form->AuthenticatedPostBack() === FALSE) {
         $Sender->Form->SetData($ConfigurationModel->Data);
     } else {
         $Data = $Sender->Form->FormValues();
         if ($Sender->Form->Save() !== FALSE) {
             $Sender->StatusMessage = T("Your settings have been saved.");
         }
     }
     $Sender->Render($this->GetView('chatwee.php'));
 }
开发者ID:Nordic-T,项目名称:vanilla-plugins,代码行数:20,代码来源:class.chatwee.plugin.php

示例10: SettingsController_DiscussionPolls_Create

 /**
  * Creates a settings page at /dashboard/settins/discussionpolls
  * @param VanillaController $Sender SettingsController
  */
 public function SettingsController_DiscussionPolls_Create($Sender)
 {
     $Sender->Permission('Garden.Settings.Manage');
     $Sender->AddCSSFile($this->GetResource('design/settings.discussionpolls.css', FALSE, FALSE));
     $Validation = new Gdn_Validation();
     $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
     $ConfigurationModel->SetField(array('Plugins.DiscussionPolls.EnableShowResults'));
     $ConfigurationModel->SetField(array('Plugins.DiscussionPolls.DisablePollTitle'));
     $Sender->Form->SetModel($ConfigurationModel);
     if ($Sender->Form->AuthenticatedPostBack() === FALSE) {
         $Sender->Form->SetData($ConfigurationModel->Data);
     } else {
         if ($Sender->Form->Save() !== FALSE) {
             $Sender->InformMessage('<span class="InformSprite Sliders"></span>' . T('Your changes have been saved.'), 'HasSprite');
         }
     }
     // Makes it look like a dashboard page
     $Sender->AddSideMenu('/dashboard/settings/discussionpolls');
     $Sender->Title('Discussion Polls Settings');
     $Sender->Render($this->ThemeView('settings'));
 }
开发者ID:Nordic-T,项目名称:vanilla-plugins,代码行数:25,代码来源:class.discussionpolls.plugin.php

示例11: PluginController_Embed_Create

	public function PluginController_Embed_Create($Sender) {
	  $Sender->Permission('Garden.Settings.Manage');
      $Sender->Title('Embed Vanilla');
		$Sender->AddCssFile($this->GetResource('design/settings.css', FALSE, FALSE));
      $Sender->AddSideMenu('plugin/embed');
      $Sender->Form = new Gdn_Form();
		
		$ThemeManager = new Gdn_ThemeManager();
		$Sender->SetData('AvailableThemes', $ThemeManager->AvailableThemes());
      $Sender->SetData('EnabledThemeFolder', $ThemeManager->EnabledTheme());
      $Sender->SetData('EnabledTheme', $ThemeManager->EnabledThemeInfo());
		$Sender->SetData('EnabledThemeName', $Sender->Data('EnabledTheme.Name', $Sender->Data('EnabledTheme.Folder')));

      $Validation = new Gdn_Validation();
      $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
      $ConfigurationModel->SetField(array('Plugins.EmbedVanilla.RemoteUrl', 'Plugins.EmbedVanilla.ForceRemoteUrl', 'Plugins.EmbedVanilla.EmbedDashboard'));
      
      $Sender->Form->SetModel($ConfigurationModel);
      if ($Sender->Form->AuthenticatedPostBack() === FALSE) {
         // Apply the config settings to the form.
         $Sender->Form->SetData($ConfigurationModel->Data);
      } else {
         // Define some validation rules for the fields being saved
         $ConfigurationModel->Validation->ApplyRule('Plugins.EmbedVanilla.RemoteUrl', 'WebAddress', 'The remote url you specified could not be validated as a functional url to redirect to.');
         if ($Sender->Form->Save() !== FALSE)
            $Sender->InformMessage(T("Your settings have been saved."));
      }
		
		// Handle changing the theme to the recommended one
		$ThemeFolder = GetValue(0, $Sender->RequestArgs);
		$TransientKey = GetValue(1, $Sender->RequestArgs);
		$Session = Gdn::Session();
      if ($Session->ValidateTransientKey($TransientKey) && $ThemeFolder != '') {
         try {
            foreach ($Sender->Data('AvailableThemes') as $ThemeName => $ThemeInfo) {
		         if ($ThemeInfo['Folder'] == $ThemeFolder)
                  $ThemeManager->EnableTheme($ThemeName);
            }
         } catch (Exception $Ex) {
            $Sender->Form->AddError($Ex);
         }
         if ($Sender->Form->ErrorCount() == 0)
            Redirect('/plugin/embed');

      }

      $Sender->Render(PATH_PLUGINS.'/embedvanilla/views/settings.php');
   }
开发者ID:nerdgirl,项目名称:Forums-ILoveBadTV,代码行数:48,代码来源:class.embedvanilla.plugin.php

示例12: Controller_Toggle

 public function Controller_Toggle($Sender)
 {
     $FileUploadStatus = Gdn::Config('Plugins.FileUpload.Enabled', FALSE);
     $Validation = new Gdn_Validation();
     $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
     $ConfigurationModel->SetField(array('FileUploadStatus'));
     // Set the model on the form.
     $Sender->Form->SetModel($ConfigurationModel);
     if ($Sender->Form->AuthenticatedPostBack()) {
         $FileUploadStatus = $Sender->Form->GetValue('FileUploadStatus') == 'ON' ? TRUE : FALSE;
         SaveToConfig('Plugins.FileUpload.Enabled', $FileUploadStatus);
     }
     $Sender->SetData('FileUploadStatus', $FileUploadStatus);
     $Sender->Form->SetData(array('FileUploadStatus' => $FileUploadStatus));
     $Sender->Render($this->GetView('toggle.php'));
 }
开发者ID:ru4,项目名称:arabbnota,代码行数:16,代码来源:class.fileupload.plugin.php

示例13: Edit

 public function Edit($RouteIndex = FALSE)
 {
     $this->Permission('Garden.Routes.Manage');
     $this->AddSideMenu('garden/routes');
     $Routes = Gdn::Config('Routes');
     $this->Route = FALSE;
     if (is_numeric($RouteIndex) && $RouteIndex !== FALSE) {
         $Keys = array_keys($Routes);
         $this->Route = ArrayValue($RouteIndex, $Keys);
     }
     $Validation = new Gdn_Validation();
     $ConfigurationModel = new Gdn_ConfigurationModel('Configuration', PATH_CONF . DS . 'config.php', $Validation);
     $ConfigurationModel->SetField(array('Route', 'Target'));
     // Set the model on the form.
     $this->Form->SetModel($ConfigurationModel);
     // If seeing the form for the first time...
     if (!$this->Form->AuthenticatedPostBack()) {
         // Apply the config settings to the form.
         if ($this->Route !== FALSE) {
             $this->Form->SetData(array('Route' => $this->Route, 'Target' => $Routes[$this->Route]));
         }
     } else {
         // Define some validation rules for the fields being saved
         $ConfigurationModel->Validation->ApplyRule('Route', 'Required');
         $ConfigurationModel->Validation->ApplyRule('Target', 'Required');
         // Validate & Save
         $FormPostValues = $this->Form->FormValues();
         if (in_array($this->Route, $this->ReservedRoutes)) {
             $FormPostValues['Route'] = $this->Route;
         }
         if ($ConfigurationModel->Validate($FormPostValues)) {
             $Config = Gdn::Factory(Gdn::AliasConfig);
             $Path = PATH_CONF . DS . 'config.php';
             $Config->Load($Path, 'Save');
             $Config->Set('Routes' . '.' . ArrayValue('Route', $FormPostValues), ArrayValue('Target', $FormPostValues));
             $Config->Save($Path);
             $this->StatusMessage = Translate("The route was saved successfully.");
             if ($this->_DeliveryType == DELIVERY_TYPE_ALL) {
                 $this->RedirectUrl = Url('garden/routes');
             }
         } else {
             $this->Form->SetValidationResults($ConfigurationModel->ValidationResults());
         }
     }
     $this->Render();
 }
开发者ID:Beyzie,项目名称:Garden,代码行数:46,代码来源:routes.php

示例14: PluginController_HidePanel_Create

 public function PluginController_HidePanel_Create(&$Sender, $Args = array())
 {
     $Sender->Permission('Garden.Settings.Manage');
     $Sender->Form = new Gdn_Form();
     $Validation = new Gdn_Validation();
     $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
     $ConfigurationModel->SetField(array('Plugins.HidePanel.HideToggle', 'Plugins.HidePanel.AllDisc', 'Plugins.HidePanel.Page1', 'Plugins.HidePanel.Page2', 'Plugins.HidePanel.Page3'));
     $Sender->Form->SetModel($ConfigurationModel);
     if ($Sender->Form->AuthenticatedPostBack() === FALSE) {
         $Sender->Form->SetData($ConfigurationModel->Data);
     } else {
         $Data = $Sender->Form->FormValues();
         if ($Sender->Form->Save() !== FALSE) {
             $Sender->StatusMessage = T("Your settings have been saved.");
         }
     }
     $Sender->Render($this->GetView('hpan-settings.php'));
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:18,代码来源:default.php

示例15: PluginController_AuthorTimeView_Create

 public function PluginController_AuthorTimeView_Create(&$Sender, $Args = array())
 {
     $Sender->Title('Author Time view');
     $Sender->AddSideMenu('plugin/authortimeview');
     $Sender->Form = new Gdn_Form();
     $Validation = new Gdn_Validation();
     $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
     $ConfigurationModel->SetField(array('Plugins.AuthorTimeView.Show_AuthorTime', 'Plugins.AuthorTimeView.Show_Vcount'));
     $Sender->Form->SetModel($ConfigurationModel);
     if ($Sender->Form->AuthenticatedPostBack() === FALSE) {
         $Sender->Form->SetData($ConfigurationModel->Data);
     } else {
         $Data = $Sender->Form->FormValues();
         if ($Sender->Form->Save() !== FALSE) {
             $Sender->StatusMessage = T("Your settings have been saved.");
         }
     }
     $Sender->Render($this->GetView('atv-settings.php'));
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:19,代码来源:default.php


注:本文中的Gdn_ConfigurationModel::SetField方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。