existsProfileGroup() public static method

Check if a profile is in a group.
public static existsProfileGroup ( integer $id ) : boolean
$id integer Membership id.
return boolean
Example #1
0
 /**
  * Execute the action.
  */
 public function execute()
 {
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id !== null && BackendProfilesModel::existsProfileGroup($this->id)) {
         // call parent, this will probably add some general CSS/JS or other required files
         parent::execute();
         // get profile group
         $profileGroup = BackendProfilesModel::getProfileGroup($this->id);
         // delete profile group
         BackendProfilesModel::deleteProfileGroup($this->id);
         // trigger event
         BackendModel::triggerEvent($this->getModule(), 'after_profile_delete_from_group', array('id' => $this->id));
         // profile group was deleted, so redirect
         $this->redirect(BackendModel::createURLForAction('edit') . '&id=' . $profileGroup['profile_id'] . '&report=membership-deleted#tabGroups');
     } else {
         $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing');
     }
 }
Example #2
0
 /**
  * Execute the action.
  */
 public function execute()
 {
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     $this->profileId = $this->getParameter('profile_id', 'int');
     // does the item exists
     if ($this->id !== null && BackendProfilesModel::existsProfileGroup($this->id)) {
         // does profile exists
         if ($this->profileId !== null && BackendProfilesModel::exists($this->profileId)) {
             parent::execute();
             $this->getData();
             $this->loadForm();
             $this->validateForm();
             $this->parse();
             $this->display();
         } else {
             $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
         }
     } else {
         $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
     }
 }