Exemple #1
0
 /**
  * @param  string $selectedSids
  * @return string
  */
 private function getParentsSid($selectedSids)
 {
     $table = in_array('users', SJB_PageManager::getPageModule()) || SJB_Navigator::getURI() == '/registration-social/' ? 'user_profile_field_tree' : 'listing_field_tree';
     $result = SJB_DB::query("SELECT `parent_sid`, `level` FROM `{$table}` WHERE `sid` IN (?w)", $selectedSids);
     $parentSids = '';
     $allSids = '';
     foreach ($result as $value) {
         $allSids .= ',' . $value['parent_sid'];
         if ($value['level'] > 2) {
             $parentSids .= empty($parentSids) ? $value['parent_sid'] : ',' . $value['parent_sid'];
         }
     }
     if (!empty($parentSids)) {
         $allSids .= $this->getParentsSid($parentSids);
     }
     return $allSids;
 }