Пример #1
0
	/**
	 * @Acl allow blog-admin
	*/
	public function configsave($enableComments, $enableCommentsFor,
	                           $moderationEmail, $moderationTime)
	{
		$config = BlogConfig::get();
		$config->enableComments = $enableComments;
		$config->enableCommentsFor = $enableCommentsFor;
		$config->moderationEmail = $moderationEmail;
		$config->moderationTime = $moderationTime;
		try
		{
			$config->save();
		
			$this->notice(t('Saved blog configuration'));
			$this->redirect('admin/blog/config');
		}
		catch (ValidationException $e)
		{
			$this->_adminTab = 'BlogConfigureAdminTab';
		
			$this->openForOptions = BlogConfig::openForOptions();
			$this->moderationTimeOptions = BlogConfig::moderationTimeOptions();
			$this->blogConfig = $config;
			$this->error('Blog configuration not saved');
			$this->render('admin/config');
		}
	}