Esempio n. 1
0
 public function __call($name, $arguments)
 {
     $value = '';
     $aParams = explode('_', $name);
     $method = array_shift($aParams);
     if ('get' == $method) {
         $returnType = SJB_Array::get($arguments, 0);
         $fieldType = SJB_Array::get($arguments, 1);
         $listingFieldID = SJB_Array::get($arguments, 2);
         $value = null;
         switch ($returnType) {
             case 'array':
             case 'string':
             case 'int':
                 $type = '(' . $returnType . ')';
                 break;
             default:
                 $type = '(string)';
                 break;
         }
         $val = '$this->oProfile->' . implode('->', array_map('strtolower', $aParams));
         $exec = 'return (!empty(' . $val . ')) ? ' . $type . $val . ': \'\';';
         switch ($fieldType) {
             case 'tree':
                 $exec = 'return (!empty(' . $val . ')) ? ' . $type . $val . ': \'\';';
                 $value = eval($exec);
                 if (is_array($value)) {
                     if (isset($value[0])) {
                         $value = $value[0];
                     }
                 }
                 $value = $this->getTreeValues($value, $listingFieldID);
                 break;
             case 'array':
                 $listingFieldSID = SJB_ListingFieldManager::getListingFieldSIDByID($listingFieldID);
                 if (!empty($listingFieldSID)) {
                     $exec = 'return (!empty(' . $val . ')) ? ' . $val . ': \'\';';
                     $value = eval($exec);
                     $value = SJB_ListingFieldManager::getListItemSIDByValue($value, $listingFieldSID);
                     $value = eval('return ' . $type . ' $value;');
                 }
                 break;
             default:
                 $value = eval($exec);
                 break;
         }
     }
     return $value;
 }
Esempio n. 2
0
 function getPropertyVariablesToAssign()
 {
     $propertyVariables = parent::getPropertyVariablesToAssign();
     $profileFieldAsDv = SJB_Array::get($propertyVariables, 'profile_field_as_dv');
     if ($profileFieldAsDv && !isset($this->property_info['parentID'])) {
         $fieldValue = SJB_UserProfileFieldManager::getListItemValueBySID($profileFieldAsDv);
         if ($fieldValue) {
             $listingListItemSID = SJB_ListingFieldManager::getListItemSIDByValue($fieldValue, SJB_Array::get($this->property_info, 'sid'));
             $propertyVariables['profile_field_as_dv'] = $listingListItemSID;
         }
     }
     $defaultValue = SJB_Array::get($propertyVariables, 'default_value');
     if ($defaultValue == 'default_country') {
         $propertyVariables['default_value'] = SJB_Settings::getSettingByName('default_country');
     }
     $propertyVariables['hidden'] = $this->property_info['hidden'];
     $newPropertyVariables = array('list_values' => $this->list_values, 'caption' => $this->property_info['caption'], 'sort_by_alphabet' => $this->property_info['sort_by_alphabet']);
     return array_merge($newPropertyVariables, $propertyVariables);
 }
Esempio n. 3
0
 public function get_Country($returnType, $listingFieldID)
 {
     $value = SJB_Countries::getCountryNameByISO2((string) $this->oProfile->location->country->code);
     if (!empty($value)) {
         $listingFieldSID = SJB_ListingFieldManager::getListingFieldSIDByID($listingFieldID);
         if ($listingFieldSID) {
             $value = SJB_ListingFieldManager::getListItemSIDByValue($value, $listingFieldSID);
             return eval('return (' . $returnType . ') $value;');
         }
     }
 }