@@ -95,6 +95,7 @@ function manageAction()
95
95
$ communityDao ->setName ($ formInfo ->getValue ('name ' ));
96
96
$ communityDao ->setDescription ($ formInfo ->getValue ('description ' ));
97
97
$ communityDao ->setPrivacy ($ formInfo ->getValue ('privacy ' ));
98
+ $ communityDao ->setCanJoin ($ formInfo ->getValue ('canJoin ' ));
98
99
$ this ->Community ->save ($ communityDao );
99
100
echo JsonComponent::encode (array (true ,$ this ->t ('Changes saved ' ),$ formInfo ->getValue ('name ' )));
100
101
}
@@ -155,6 +156,8 @@ function manageAction()
155
156
$ description ->setValue ($ communityDao ->getDescription ());
156
157
$ privacy =$ formInfo ->getElement ('privacy ' );
157
158
$ privacy ->setValue ($ communityDao ->getPrivacy ());
159
+ $ canJoin =$ formInfo ->getElement ('canJoin ' );
160
+ $ canJoin ->setValue ($ communityDao ->getCanJoin ());
158
161
$ submit =$ formInfo ->getElement ('submit ' );
159
162
$ submit ->setLabel ($ this ->t ('Save ' ));
160
163
$ this ->view ->infoForm =$ this ->getFormAsArray ($ formInfo );
@@ -240,7 +243,9 @@ function viewAction()
240
243
throw new Zend_Exception ("This community doesn't exist or you don't have the permissions. " );
241
244
}
242
245
$ joinCommunity =$ this ->_getParam ('joinCommunity ' );
243
- if ($ this ->userSession ->Dao !=null &&isset ($ joinCommunity )&&$ communityDao ->getPrivacy ()==MIDAS_COMMUNITY_PUBLIC )
246
+ $ canJoin =$ communityDao ->getCanJoin ()==MIDAS_COMMUNITY_CAN_JOIN ;
247
+ $ this ->view ->canJoin =$ canJoin ;
248
+ if ($ canJoin &&$ this ->userSession ->Dao !=null &&isset ($ joinCommunity )&&$ communityDao ->getPrivacy ()==MIDAS_COMMUNITY_PUBLIC )
244
249
{
245
250
$ member_group =$ communityDao ->getMemberGroup ();
246
251
$ this ->Group ->addUser ($ member_group ,$ this ->userSession ->Dao );
@@ -315,8 +320,9 @@ function createAction()
315
320
$ name = $ form ->getValue ('name ' );
316
321
$ description = $ form ->getValue ('description ' );
317
322
$ privacy = $ form ->getValue ('privacy ' );
323
+ $ canJoin = $ form ->getValue ('canJoin ' );
318
324
319
- $ communityDao = $ this ->Community ->createCommunity ($ name ,$ description ,$ privacy ,$ this ->userSession ->Dao );
325
+ $ communityDao = $ this ->Community ->createCommunity ($ name ,$ description ,$ privacy ,$ this ->userSession ->Dao , $ canJoin );
320
326
$ this ->_redirect ("/community/ " .$ communityDao ->getKey ());
321
327
}
322
328
else
0 commit comments