/**
  * Filter disabled groups
  *
  * @return array
  */
 public function getActiveGroups()
 {
     $arrGroups = array();
     $objGroup = MemberGroupModel::findAllActive();
     if ($objGroup !== null) {
         while ($objGroup->next()) {
             $arrGroups[$objGroup->id] = $objGroup->name;
         }
     }
     return $arrGroups;
 }
 public static function getMemberGroups()
 {
     $arrOptions = array();
     $arrMemberGroups = \MemberGroupModel::findAllActive();
     if ($arrMemberGroups !== null) {
         foreach ($arrMemberGroups as $objMemberGroup) {
             $arrOptions[$objMemberGroup->id] = $objMemberGroup->name;
         }
     }
     return $arrOptions;
 }
Example #3
0
 /**
  * Set all user properties from a database record
  */
 protected function setUserFromDb()
 {
     $this->intId = $this->id;
     // Unserialize values
     foreach ($this->arrData as $k => $v) {
         if (!is_numeric($v)) {
             $this->{$k} = \StringUtil::deserialize($v);
         }
     }
     // Set language
     if ($this->language != '') {
         \System::getContainer()->get('request_stack')->getCurrentRequest()->setLocale($this->language);
         \System::getContainer()->get('translator')->setLocale($this->language);
         // Deprecated since Contao 4.0, to be removed in Contao 5.0
         $GLOBALS['TL_LANGUAGE'] = str_replace('_', '-', $this->language);
     }
     $GLOBALS['TL_USERNAME'] = $this->username;
     // Make sure that groups is an array
     if (!is_array($this->groups)) {
         $this->groups = $this->groups != '' ? array($this->groups) : array();
     }
     // Skip inactive groups
     if (($objGroups = \MemberGroupModel::findAllActive()) !== null) {
         $this->groups = array_intersect($this->groups, $objGroups->fetchEach('id'));
     }
     // Get the group login page
     if ($this->groups[0] > 0) {
         $objGroup = \MemberGroupModel::findPublishedById($this->groups[0]);
         if ($objGroup !== null && $objGroup->redirect && $objGroup->jumpTo) {
             $this->strLoginPage = $objGroup->jumpTo;
         }
     }
 }
Example #4
0
 /**
  * Set all user properties from a database record
  */
 protected function setUserFromDb()
 {
     $this->intId = $this->id;
     // Unserialize values
     foreach ($this->arrData as $k => $v) {
         if (!is_numeric($v)) {
             $this->{$k} = deserialize($v);
         }
     }
     // Set language
     if ($this->language != '') {
         $GLOBALS['TL_LANGUAGE'] = $this->language;
     }
     $GLOBALS['TL_USERNAME'] = $this->username;
     // Make sure that groups is an array
     if (!is_array($this->groups)) {
         $this->groups = $this->groups != '' ? array($this->groups) : array();
     }
     // Skip inactive groups
     if (($objGroups = \MemberGroupModel::findAllActive()) !== null) {
         $this->groups = array_intersect($this->groups, $objGroups->fetchEach('id'));
     }
     // Get the group login page
     if ($this->groups[0] > 0) {
         $objGroup = \MemberGroupModel::findPublishedById($this->groups[0]);
         if ($objGroup !== null && $objGroup->redirect && $objGroup->jumpTo) {
             $this->strLoginPage = $objGroup->jumpTo;
         }
     }
     // Restore session
     if (is_array($this->session)) {
         $this->Session->setData($this->session);
     } else {
         $this->session = array();
     }
 }