@@ -246,7 +246,7 @@ function viewAction()
246
246
$ this ->Group ->addUser ($ member_group ,$ this ->userSession ->Dao );
247
247
}
248
248
249
- $ this ->Community ->plusOneView ($ communityDao );
249
+ $ this ->Community ->incrementViewCount ($ communityDao );
250
250
$ this ->view ->communityDao =$ communityDao ;
251
251
$ this ->view ->information =array ();
252
252
$ this ->view ->feeds =$ this ->Feed ->getFeedsByCommunity ($ this ->userSession ->Dao ,$ communityDao );
@@ -312,61 +312,11 @@ function createAction()
312
312
$ form =$ this ->Form ->Community ->createCreateForm ();
313
313
if ($ this ->_request ->isPost ()&&$ form ->isValid ($ this ->getRequest ()->getPost ()))
314
314
{
315
- if ($ this ->Community ->getByName ($ form ->getValue ('name ' ))!==false )
316
- {
317
- throw new Zend_Exception ("Community already exists. " );
318
- }
319
- $ communityDao =new CommunityDao ();
320
- $ communityDao ->setName (ucfirst ($ form ->getValue ('name ' )));
321
- $ communityDao ->setDescription ($ form ->getValue ('description ' ));
322
- $ communityDao ->setPrivacy ($ form ->getValue ('privacy ' ));
323
- $ communityDao ->setCreation (date ('c ' ));
324
- $ this ->Community ->save ($ communityDao );
325
-
326
- $ folderGlobal =$ this ->Folder ->createFolder ('community_ ' .$ communityDao ->getKey (),'Main folder of the community ' .$ communityDao ->getKey (),MIDAS_FOLDER_COMMUNITYPARENT );
327
- $ folderPublic =$ this ->Folder ->createFolder ('Public ' ,'Public folder of the community ' .$ communityDao ->getKey (),$ folderGlobal );
328
- $ folderPrivate =$ this ->Folder ->createFolder ('Private ' ,'Private folder of the community ' .$ communityDao ->getKey (),$ folderGlobal );
329
-
330
- $ adminGroup =$ this ->Group ->createGroup ($ communityDao ,'Admin group of community ' .$ communityDao ->getKey ());
331
- $ moderatorsGroup =$ this ->Group ->createGroup ($ communityDao ,'Moderators group of community ' .$ communityDao ->getKey ());
332
- $ memberGroup =$ this ->Group ->createGroup ($ communityDao ,'Members group of community ' .$ communityDao ->getKey ());
333
- $ anonymousGroup =$ this ->Group ->load (MIDAS_GROUP_ANONYMOUS_KEY );
334
-
335
- $ communityDao ->setFolderId ($ folderGlobal ->getKey ());
336
- $ communityDao ->setPublicfolderId ($ folderPublic ->getKey ());
337
- $ communityDao ->setPrivatefolderId ($ folderPrivate ->getKey ());
338
- $ communityDao ->setAdmingroupId ($ adminGroup ->getKey ());
339
- $ communityDao ->setModeratorgroupId ($ moderatorsGroup ->getKey ());
340
- $ communityDao ->setMembergroupId ($ memberGroup ->getKey ());
341
- $ this ->Community ->save ($ communityDao );
342
-
343
- $ this ->Group ->addUser ($ adminGroup ,$ this ->userSession ->Dao );
344
- $ this ->Group ->addUser ($ memberGroup ,$ this ->userSession ->Dao );
345
-
346
- $ feed =$ this ->Feed ->createFeed ($ this ->userSession ->Dao ,MIDAS_FEED_CREATE_COMMUNITY ,$ communityDao ,$ communityDao );
347
- $ this ->Feedpolicyuser ->createPolicy ($ this ->userSession ->Dao ,$ feed ,MIDAS_POLICY_ADMIN );
348
-
349
- $ this ->Folderpolicygroup ->createPolicy ($ adminGroup ,$ folderGlobal ,MIDAS_POLICY_ADMIN );
350
- $ this ->Folderpolicygroup ->createPolicy ($ adminGroup ,$ folderPublic ,MIDAS_POLICY_ADMIN );
351
- $ this ->Folderpolicygroup ->createPolicy ($ adminGroup ,$ folderPrivate ,MIDAS_POLICY_ADMIN );
352
- $ this ->Feedpolicygroup ->createPolicy ($ adminGroup ,$ feed ,MIDAS_POLICY_ADMIN );
353
-
354
- $ this ->Folderpolicygroup ->createPolicy ($ moderatorsGroup ,$ folderGlobal ,MIDAS_POLICY_READ );
355
- $ this ->Folderpolicygroup ->createPolicy ($ moderatorsGroup ,$ folderPublic ,MIDAS_POLICY_WRITE );
356
- $ this ->Folderpolicygroup ->createPolicy ($ moderatorsGroup ,$ folderPrivate ,MIDAS_POLICY_WRITE );
357
- $ this ->Feedpolicygroup ->createPolicy ($ moderatorsGroup ,$ feed ,MIDAS_POLICY_ADMIN );
358
-
359
- $ this ->Folderpolicygroup ->createPolicy ($ memberGroup ,$ folderGlobal ,MIDAS_POLICY_READ );
360
- $ this ->Folderpolicygroup ->createPolicy ($ memberGroup ,$ folderPublic ,MIDAS_POLICY_WRITE );
361
- $ this ->Folderpolicygroup ->createPolicy ($ memberGroup ,$ folderPrivate ,MIDAS_POLICY_WRITE );
362
- $ this ->Feedpolicygroup ->createPolicy ($ memberGroup ,$ feed ,MIDAS_POLICY_READ );
363
-
364
- if ($ communityDao ->getPrivacy ()!=MIDAS_COMMUNITY_PRIVATE )
365
- {
366
- $ this ->Folderpolicygroup ->createPolicy ($ anonymousGroup ,$ folderPublic ,MIDAS_POLICY_READ );
367
- $ this ->Feedpolicygroup ->createPolicy ($ anonymousGroup ,$ feed ,MIDAS_POLICY_READ );
368
- }
315
+ $ name = $ form ->getValue ('name ' );
316
+ $ description = $ form ->getValue ('description ' );
317
+ $ privacy = $ form ->getValue ('privacy ' );
369
318
319
+ $ communityDao = $ this ->Community ->createCommunity ($ name ,$ description ,$ privacy ,$ this ->userSession ->Dao );
370
320
$ this ->_redirect ("/community/ " .$ communityDao ->getKey ());
371
321
}
372
322
else
@@ -382,7 +332,7 @@ function createAction()
382
332
383
333
384
334
385
- /** valid entries (ajax)*/
335
+ /** valid entries (ajax)*/
386
336
public function validentryAction ()
387
337
{
388
338
if (!$ this ->getRequest ()->isXmlHttpRequest ())
0 commit comments