本文整理汇总了PHP中humhub\models\Setting::Set方法的典型用法代码示例。如果您正苦于以下问题:PHP Setting::Set方法的具体用法?PHP Setting::Set怎么用?PHP Setting::Set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类humhub\models\Setting
的用法示例。
在下文中一共展示了Setting::Set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: up
public function up()
{
$this->dropTable(UserChatMessage::tableName());
$this->createTable(UserChatMessage::tableName(), ['id' => $this->primaryKey(), 'message' => $this->text()->notNull(), 'created_at' => $this->dateTime()->notNull(), 'created_by' => $this->integer()->notNull()]);
Setting::Set('theme', 'theme_bright.css', 'humhubchat');
Setting::Set('timeout', '1', 'humhubchat');
}
示例2: actionIndex
/**
* Configuration Action for Super Admins.
*/
public function actionIndex()
{
$post = $this->getPost(array('SmsProviderConfigureForm', 'AnySmsConfigureForm', 'ClickatellConfigureForm', 'SpryngConfigureForm'));
if ($post != null) {
$provider = $post['provider'];
$form = $this->getSmsProviderForm($provider);
// provider changed => just change the provider setting and reload the correct form
if ($provider != Setting::Get('provider', 'sms')) {
$form = new \humhub\modules\sms\forms\SmsProviderConfigureForm();
} else {
$form = $this->getSmsProviderForm($provider);
}
$form->setAttributes($post);
if ($form->validate()) {
foreach ($form->attributeNames() as $attributeName) {
Setting::Set($attributeName, $form->{$attributeName}, 'sms');
}
return $this->redirect(['/sms/config']);
}
} else {
$provider = Setting::Get('provider', 'sms');
$form = $this->getSmsProviderForm($provider);
foreach ($form->attributeNames() as $attributeName) {
$form->{$attributeName} = Setting::Get($attributeName, 'sms');
}
}
return $this->render('index', array('model' => $form));
}
示例3: onCronDailyRun
/**
* Check if there is a new Humhub Version available and sends a notification
* to super admins
*
* @param \yii\base\Event $event
*/
public static function onCronDailyRun($event)
{
$controller = $event->sender;
if (!Yii::$app->getModule('admin')->dailyCheckForNewVersion) {
return;
}
if (!Yii::$app->params['humhub']['apiEnabled']) {
return;
}
$controller->stdout("Checking for new HumHub version... ");
$latestVersion = libs\HumHubAPI::getLatestHumHubVersion();
if ($latestVersion != "") {
$adminUserQuery = User::find()->where(['super_admin' => 1]);
$latestNotifiedVersion = Setting::Get('lastVersionNotify', 'admin');
$adminsNotified = !($latestNotifiedVersion == "" || version_compare($latestVersion, $latestNotifiedVersion, ">"));
$newVersionAvailable = version_compare($latestVersion, Yii::$app->version, ">");
$updateNotification = new notifications\NewVersionAvailable();
// Cleanup existing notifications
if (!$newVersionAvailable || $newVersionAvailable && !$adminsNotified) {
foreach ($adminUserQuery->all() as $admin) {
$updateNotification->delete($admin);
}
}
// Create new notification
if ($newVersionAvailable && !$adminsNotified) {
$updateNotification->sendBulk($adminUserQuery);
Setting::Set('lastVersionNotify', $latestVersion, 'admin');
}
}
$controller->stdout('done. ' . PHP_EOL, \yii\helpers\Console::FG_GREEN);
}
示例4: actionAuto
public function actionAuto()
{
$this->stdout("Install:\n\n", Console::FG_YELLOW);
\humhub\modules\installer\libs\InitialData::bootstrap();
Setting::Set('name', "HumHub Test");
Setting::Set('systemEmailName', "humhub@example.com", 'mailing');
Setting::Set('systemEmailName', "humhub@example.com", 'mailing');
Setting::Set('secret', \humhub\libs\UUID::v4());
$user = new User();
$user->group_id = 1;
$user->username = "Admin";
$user->auth_mode = 'local';
$user->email = 'humhub@example.com';
$user->status = User::STATUS_ENABLED;
$user->language = '';
$user->last_activity_email = new \yii\db\Expression('NOW()');
if (!$user->save()) {
throw new \yii\base\Exception("Could not save user");
}
$user->profile->title = "System Administration";
$user->profile->firstname = "John";
$user->profile->lastname = "Doe";
$user->profile->save();
$password = new Password();
$password->user_id = $user->id;
$password->setPassword('test');
$password->save();
return self::EXIT_CODE_NORMAL;
}
示例5: actionDaily
/**
* Executes daily cron tasks.
*/
public function actionDaily()
{
$this->stdout("Executing daily tasks:\n\n", Console::FG_YELLOW);
$this->trigger(self::EVENT_ON_DAILY_RUN);
$this->stdout("\n\nAll cron tasks finished.\n\n", Console::FG_GREEN);
Setting::Set('cronLastDailyRun', time());
return self::EXIT_CODE_NORMAL;
}
示例6: enable
/**
* Enables this module
*/
public function enable()
{
if (!Yii::$app->hasModule('mostactiveusers')) {
// set default config values
Setting::Set('noUsers', 5, 'mostactiveusers');
}
parent::enable();
}
示例7: actionIndex
/**
* Configuration action for super admins.
*/
public function actionIndex()
{
$form = new ConfigureForm();
$form->disableZipSupport = Setting::Get('disableZipSupport', 'cfiles');
if ($form->load(Yii::$app->request->post()) && $form->validate()) {
Setting::Set('disableZipSupport', $form->disableZipSupport, 'cfiles');
}
return $this->render('index', array('model' => $form));
}
示例8: actionIndex
public function actionIndex()
{
$form = new ModuleConfigForm();
$form->apiKey = Setting::Get('apiKey', 'dropbox');
if ($form->load(Yii::$app->request->post()) && $form->validate()) {
Setting::Set('apiKey', $form->apiKey, 'dropbox');
}
return $this->render('index', array('model' => $form));
}
示例9: actionConfig
/**
* Configuration Action for Super Admins
*/
public function actionConfig()
{
$form = new ConfigureForm();
$form->noUsers = Setting::Get('noUsers', 'mostactiveusers');
if ($form->load(Yii::$app->request->post()) && $form->validate()) {
$form->noUsers = Setting::Set('noUsers', $form->noUsers, 'mostactiveusers');
return $this->redirect(['/mostactiveusers/config/config']);
}
return $this->render('config', array('model' => $form));
}
示例10: actionIndex
/**
* Configuration Action for Super Admins
*/
public function actionIndex()
{
$form = new \humhub\modules\birthday\models\BirthdayConfigureForm();
$form->shownDays = Setting::Get('shownDays', 'birthday');
if ($form->load(Yii::$app->request->post()) && $form->validate()) {
$form->shownDays = Setting::Set('shownDays', $form->shownDays, 'birthday');
return $this->redirect(['/birthday/config']);
}
return $this->render('index', array('model' => $form));
}
示例11: actionIndex
public function actionIndex()
{
$form = new ConfigureForm();
$form->baseUrl = Setting::Get('baseUrl', 'notes');
$form->apiKey = Setting::Get('apiKey', 'notes');
if ($form->load(Yii::$app->request->post()) && $form->validate()) {
$form->baseUrl = Setting::Set('baseUrl', $form->baseUrl, 'notes');
$form->apiKey = Setting::Set('apiKey', $form->apiKey, 'notes');
return $this->redirect(['/notes/config']);
}
return $this->render('index', array('model' => $form));
}
示例12: up
public function up()
{
$allowedExtensions = Setting::Get('allowedExtensions', 'embeddedmedia');
if ($allowedExtensions != "") {
Setting::Set('allowedExtensions', '', 'embeddedmedia');
Setting::SetText('allowedExtensions', $allowedExtensions, 'embeddedmedia');
}
$showFilesWidgetBlacklist = Setting::Get('showFilesWidgetBlacklist', 'embeddedmedia');
if ($showFilesWidgetBlacklist != "") {
Setting::Set('showFilesWidgetBlacklist', '', 'embeddedmedia');
Setting::SetText('showFilesWidgetBlacklist', $showFilesWidgetBlacklist, 'embeddedmedia');
}
}
示例13: actionSettings
/**
* General Space Settings
*/
public function actionSettings()
{
$form = new \humhub\modules\admin\models\forms\SpaceSettingsForm();
$form->defaultJoinPolicy = Setting::Get('defaultJoinPolicy', 'space');
$form->defaultVisibility = Setting::Get('defaultVisibility', 'space');
if ($form->load(Yii::$app->request->post()) && $form->validate()) {
Setting::Set('defaultJoinPolicy', $form->defaultJoinPolicy, 'space');
Setting::Set('defaultVisibility', $form->defaultVisibility, 'space');
// set flash message
Yii::$app->getSession()->setFlash('data-saved', Yii::t('AdminModule.controllers_SpaceController', 'Saved'));
$this->redirect(Url::toRoute('settings'));
}
return $this->render('settings', array('model' => $form));
}
示例14: actionConfig
/**
* Configuration Action for Super Admins
*/
public function actionConfig()
{
$form = new ConfigureForm();
$form->gcmAPIKey = Setting::Get('gcmAPIKey', 'gcm');
//$form->gcmURL = Setting::Get('gcmURL', 'gcm');
if (!($form->gcmURL = Setting::Get('gcmURL', 'gcm'))) {
$form->gcmURL = 'https://android.googleapis.com/gcm/send';
}
if ($form->load(Yii::$app->request->post()) && $form->validate()) {
$form->gcmAPIKey = Setting::Set('gcmAPIKey', $form->gcmAPIKey, 'gcm');
$form->gcmURL = Setting::Set('gcmURL', $form->gcmURL, 'gcm');
return $this->redirect(['/gcm/config/config']);
}
return $this->render('config', array('model' => $form));
}
示例15: actionIndex
public function actionIndex()
{
$form = new \humhub\modules\humhubchat\forms\SettingsForm();
if ($form->load(Yii::$app->request->post())) {
if ($form->validate()) {
Setting::Set('theme', $form->theme, 'humhubchat');
Setting::Set('timeout', $form->timeout, 'humhubchat');
Yii::$app->session->setFlash('data-saved', Yii::t('Humhub-chatModule.base', 'Saved'));
// $this->redirect(Url::toRoute('index'));
}
} else {
$form->theme = Setting::Get('theme', 'humhubchat');
$form->timeout = Setting::Get('timeout', 'humhubchat');
}
return $this->render('index', ['model' => $form]);
}