Ejemplo n.º 1
0
 public function loadAddPermission($parameters)
 {
     if (isset($parameters['id'])) {
         if (isset($_POST['permission'])) {
             $group = new DinklyGroup();
             $group->init($parameters['id']);
             $group->addPermissions($_POST['permission']);
             DinklyFlash::set('good_group_message', 'Permissions updated');
             return $this->loadModule('admin', 'group', 'detail', true, true, array('id' => $group->getId()));
         }
     }
     return false;
 }
Ejemplo n.º 2
0
 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;
 }