コード例 #1
0
 public function loadDelete($parameters)
 {
     $group = new DinklyGroup();
     if (isset($parameters['id'])) {
         $group->init($parameters['id']);
         if (!$group->isNew()) {
             $group->delete();
             DinklyFlash::set('warning_group_message', 'Group successfully deleted');
             return $this->loadModule('admin', 'group', 'default', true);
         }
     }
     return false;
 }
コード例 #2
0
ファイル: DinklyUser.php プロジェクト: bigSiebs/poetry_vote
 public function addToGroups($group_ids)
 {
     if ($group_ids != array()) {
         foreach ($group_ids as $id) {
             $group = new DinklyGroup();
             $group->init($id);
             //If the group isn't new, that means it exists, which is a good thing
             if (!$group->isNew()) {
                 //Make sure this join record doesn't already exist first
                 $group_join = new DinklyUserGroup();
                 $group_join->initWithUserAndGroup($this->getId(), $id);
                 if ($group_join->isNew()) {
                     $group_join->setDinklyUserId($this->getId());
                     $group_join->setDinklyGroupId($id);
                     $group_join->save();
                 }
             }
         }
         return true;
     }
     return false;
 }