Exemplo n.º 1
0
 /**
  * Saves the form
  * 
  * @return boolean
  */
 public function save()
 {
     $settingsManager = Yii::$app->settings;
     $settingsManager->set('theme', $this->theme);
     $settingsManager->set('paginationSize', $this->paginationSize);
     $settingsManager->set('displayNameFormat', $this->displayName);
     Yii::$app->getModule('space')->settings->set('spaceOrder', $this->spaceOrder);
     Yii::$app->getModule('admin')->settings->set('defaultDateInputFormat', $this->dateInputDisplayFormat);
     if ($this->logo) {
         $logoImage = new \humhub\libs\LogoImage();
         $logoImage->setNew($this->logo);
     }
     \humhub\libs\DynamicConfig::rewrite();
     return true;
 }
Exemplo n.º 2
0
 /**
  * E-Mail Mailing Settings
  */
 public function actionDesign()
 {
     $form = new \humhub\modules\admin\models\forms\DesignSettingsForm();
     #$assetPrefix = Yii::$app->assetManager->publish(dirname(__FILE__) . '/../resources', true, 0, defined('YII_DEBUG'));
     #Yii::$app->clientScript->registerScriptFile($assetPrefix . '/uploadLogo.js');
     if ($form->load(Yii::$app->request->post())) {
         $files = \yii\web\UploadedFile::getInstancesByName('logo');
         if (count($files) != 0) {
             $file = $files[0];
             $form->logo = $file;
         }
         if ($form->validate()) {
             Setting::Set('theme', $form->theme);
             Setting::Set('paginationSize', $form->paginationSize);
             Setting::Set('displayNameFormat', $form->displayName);
             Setting::Set('spaceOrder', $form->spaceOrder, 'space');
             if ($form->logo) {
                 $logoImage = new \humhub\libs\LogoImage();
                 $logoImage->setNew($form->logo);
             }
             // read and save colors from current theme
             \humhub\components\Theme::setColorVariables($form->theme);
             Yii::$app->getSession()->setFlash('data-saved', Yii::t('AdminModule.controllers_SettingController', 'Saved'));
             Yii::$app->response->redirect(Url::toRoute('/admin/setting/design'));
         }
     } else {
         $form->theme = Setting::Get('theme');
         $form->paginationSize = Setting::Get('paginationSize');
         $form->displayName = Setting::Get('displayNameFormat');
         $form->spaceOrder = Setting::Get('spaceOrder', 'space');
     }
     $themes = \humhub\components\Theme::getThemes();
     return $this->render('design', array('model' => $form, 'themes' => $themes, 'logo' => new \humhub\libs\LogoImage()));
 }
Exemplo n.º 3
0
 /**
  * E-Mail Mailing Settings
  */
 public function actionDesign()
 {
     $form = new \humhub\modules\admin\models\forms\DesignSettingsForm();
     $form->theme = Setting::Get('theme');
     $form->paginationSize = Setting::Get('paginationSize');
     $form->displayName = Setting::Get('displayNameFormat');
     $form->spaceOrder = Setting::Get('spaceOrder', 'space');
     if ($form->load(Yii::$app->request->post())) {
         $files = \yii\web\UploadedFile::getInstancesByName('logo');
         if (count($files) != 0) {
             $file = $files[0];
             $form->logo = $file;
         }
         if ($form->validate()) {
             Setting::Set('theme', $form->theme);
             Setting::Set('paginationSize', $form->paginationSize);
             Setting::Set('displayNameFormat', $form->displayName);
             Setting::Set('spaceOrder', $form->spaceOrder, 'space');
             if ($form->logo) {
                 $logoImage = new \humhub\libs\LogoImage();
                 $logoImage->setNew($form->logo);
             }
             // read and save colors from current theme
             \humhub\components\Theme::setColorVariables($form->theme);
             DynamicConfig::rewrite();
             Yii::$app->getSession()->setFlash('data-saved', Yii::t('AdminModule.controllers_SettingController', 'Saved'));
             Yii::$app->response->redirect(Url::toRoute('/admin/setting/design'));
         }
     }
     $themes = [];
     foreach (\humhub\components\Theme::getThemes() as $theme) {
         $themes[$theme->name] = $theme->name;
     }
     return $this->render('design', array('model' => $form, 'themes' => $themes, 'logo' => new \humhub\libs\LogoImage()));
 }