Skip to content

Commit

Permalink
Small Edit
Browse files Browse the repository at this point in the history
  • Loading branch information
petersphilo authored Mar 7, 2023
1 parent 58cce23 commit b38d22f
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 26 deletions.
24 changes: 13 additions & 11 deletions Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public static function onSidebarInit($event) {
if (Yii::$app->hasModule('social_invite')) {

$SISortOrderSet=800;
/**/
if (Setting::Get('SISortOrder', 'social_invite') >= 0) {
$SISortOrderSet = Setting::Get('SISortOrder', 'social_invite');
$social_invite=Yii::$app->getModule('social_invite');
if ($social_invite->settings->get('SISortOrder') >= 0) {
$SISortOrderSet = $social_invite->settings->get('SISortOrder');
}

$event->sender->addWidget(widgets\Sidebar::className(), array(), array('sortOrder' => intval($SISortOrderSet)));
Expand All @@ -41,19 +41,21 @@ public function getConfigUrl() {
*/
public function enable()
{
$social_invite=Yii::$app->getModule('social_invite');

parent::enable();

if (Setting::Get('theGroup', 'social_invite') == '') {
Setting::Set('theGroup', 0, 'social_invite');
if ($social_invite->settings->get('theGroup') == '') {
$social_invite->settings->set('theGroup', 0);
}
if (Setting::Get('theSpace', 'social_invite') == '') {
Setting::Set('theSpace', 1, 'social_invite');
if ($social_invite->settings->get('theSpace') == '') {
$social_invite->settings->set('theSpace', 1);
}
if (Setting::Get('ResponsiveTop', 'social_invite') == '') {
Setting::Set('ResponsiveTop', 0, 'social_invite');
if ($social_invite->settings->get('ResponsiveTop') == '') {
$social_invite->settings->set('ResponsiveTop', 0);
}
if (Setting::Get('SISortOrder', 'social_invite') == '') {
Setting::Set('SISortOrder', 160, 'social_invite');
if ($social_invite->settings->get('SISortOrder') == '') {
$social_invite->settings->set('SISortOrder', 160);
}
}

Expand Down
18 changes: 10 additions & 8 deletions controllers/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,18 @@ public function behaviors(){
public function actionConfig(){
if(Yii::$app->request->get('SocInviteDL')){$this->MyDataRequest(); }
else{
$social_invite=Yii::$app->getModule('social_invite');

$form = new ConfigureForm();
$form->theGroup = Json::decode(Setting::Get('theGroup', 'social_invite'));
$form->theSpace = Setting::Get('theSpace', 'social_invite');
$form->ResponsiveTop = Setting::Get('ResponsiveTop', 'social_invite');
$form->SISortOrder = Setting::Get('SISortOrder', 'social_invite');
$form->theGroup = Json::decode($social_invite->settings->get('theGroup'));
$form->theSpace = $social_invite->settings->get('theSpace');
$form->ResponsiveTop = $social_invite->settings->get('ResponsiveTop');
$form->SISortOrder = $social_invite->settings->get('SISortOrder');
if ($form->load(Yii::$app->request->post()) && $form->validate()) {
$form->theGroup = Setting::Set('theGroup', Json::encode($form->theGroup), 'social_invite');
$form->theSpace = Setting::Set('theSpace', $form->theSpace, 'social_invite');
$form->ResponsiveTop = Setting::Set('ResponsiveTop', $form->ResponsiveTop, 'social_invite');
$form->SISortOrder = Setting::Set('SISortOrder', $form->SISortOrder, 'social_invite');
$form->theGroup = $social_invite->settings->set('theGroup', Json::encode($form->theGroup));
$form->theSpace = $social_invite->settings->set('theSpace', $form->theSpace);
$form->ResponsiveTop = $social_invite->settings->set('ResponsiveTop', $form->ResponsiveTop);
$form->SISortOrder = $social_invite->settings->set('SISortOrder', $form->SISortOrder);
return $this->redirect(['/social_invite/config/config']);
}

Expand Down
5 changes: 5 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@


### 1.1.1

small edit


### 1.1

- added possibility to select multiple groups
Expand Down
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"keywords": [
"users", "invite"
],
"version": "1.1.0",
"version": "1.1.1",
"humhub": {
"minVersion": "1.12.0"
},
Expand Down
6 changes: 4 additions & 2 deletions views/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
* @var $model \humhub\modules\social_invite\models\ConfigureForm
*/

$ReadTheGroup=Json::decode(Setting::Get('theGroup', 'social_invite'));
$social_invite=Yii::$app->getModule('social_invite');

$ReadTheGroup=Json::decode($social_invite->settings->get('theGroup'));
if(is_int($ReadTheGroup)){$ReadTheGroup=[$ReadTheGroup];}
$ReadTheSpace=Setting::Get('theSpace', 'social_invite');
$ReadTheSpace=$social_invite->settings->get('theSpace');

$BlankGroupName=Yii::t('SocialInviteModule.base','Empty Group (to select no group)');

Expand Down
4 changes: 3 additions & 1 deletion widgets/Sidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ class Sidebar extends Widget

public function run()
{
$AuthorizedGroupArr = Json::decode(Setting::Get('theGroup', 'social_invite'));
$social_invite=Yii::$app->getModule('social_invite');

$AuthorizedGroupArr = Json::decode($social_invite->settings->get('theGroup'));
if(is_int($AuthorizedGroupArr)){$AuthorizedGroupArr=[$AuthorizedGroupArr];}
$userID = Yii::$app->user->id;

Expand Down
7 changes: 4 additions & 3 deletions widgets/views/sidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
use Yii;
//use yii\helpers\Json;

//$theGroupEcho = Json::decode(Setting::Get('theGroup', 'social_invite'));
$theSpaceEcho = Setting::Get('theSpace', 'social_invite');
$ResponsiveTopEcho = Setting::Get('ResponsiveTop', 'social_invite');
$social_invite=Yii::$app->getModule('social_invite');

$theSpaceEcho = $social_invite->settings->get('theSpace');
$ResponsiveTopEcho = $social_invite->settings->get('ResponsiveTop');

?>
<div class="panel panel-default" id="social_invite-panel">
Expand Down

0 comments on commit b38d22f

Please sign in to comment.