function isEmpty() { if ($this->getComplexParent()) { return parent::isEmpty() && !SJB_UploadFileManager::isFileReadyForUpload($this->property_info['id'], $this->getComplexParent()); } return parent::isEmpty() && !SJB_UploadFileManager::isFileReadyForUpload($this->property_info['id']); }
function getPropertyVariablesToAssign() { $form = new SJB_Form($this->complex); $form_fields = $form->getFormFieldsInfo(); $propertyVariables = parent::getPropertyVariablesToAssign(); $complexElements = array(1 => ''); $newPropertyVariables = array('form_fields' => $form_fields, 'caption' => $this->property_info['caption'], 'complexElements' => $complexElements); $propertyVariables = array_merge($newPropertyVariables, $propertyVariables); if (!empty($propertyVariables['value'])) { if (is_string($propertyVariables['value'])) { $propertyVariables['value'] = unserialize($propertyVariables['value']); } if (is_array($propertyVariables['value'])) { foreach ($propertyVariables['value'] as $complexElement) { if (is_array($complexElement)) { foreach ($complexElement as $key => $val) { if (!isset($complexElements[$key])) { $complexElements[$key] = ''; } } } } } $propertyVariables['complexElements'] = $complexElements; } return $propertyVariables; }
function getPropertyVariablesToAssign() { $form = new SJB_Form($this->child); $form_fields = $form->getFormFieldsInfo(); $propertyVariables = parent::getPropertyVariablesToAssign(); $properties = $this->child->getProperties(); $propertyVariables['value'] = array(); foreach ($properties as $name => $property) { $variablesToAssign = $property->getPropertyVariablesToAssign(); $form_fields[$name]['hidden'] = $variablesToAssign['hidden']; if ($variablesToAssign['value'] === '') { continue; } else { if (empty($variablesToAssign['value']) && !empty($variablesToAssign['profile_field_as_dv'])) { $propertyVariables['value'][$name] = $variablesToAssign['profile_field_as_dv']; } else { if (empty($variablesToAssign['value']) && !empty($variablesToAssign['default_value'])) { $propertyVariables['value'][$name] = $variablesToAssign['default_value']; } else { $propertyVariables['value'][$name] = $variablesToAssign['value']; } } } } $newPropertyVariables = array('form_fields' => $form_fields, 'caption' => $this->property_info['caption'], 'parentID' => $this->property_info['id'], 'useAutocomplete' => $this->property_info['use_autocomplete'], 'type' => $this->property_info['type'], 'isClassifieds' => $this->property_info['is_classifieds'], 'enable_search_by_radius' => $this->property_info['enable_search_by_radius']); $propertyVariables = array_merge($newPropertyVariables, $propertyVariables); return $propertyVariables; }
function getPropertyVariablesToAssign() { $values = parent::getPropertyVariablesToAssign(); if ($this->convertToDBDate && !is_array($this->property_info['value'])) { $values['mysql_date'] = SJB_I18N::getInstance()->getInput('date', $this->property_info['value']); } return $values; }
function SJB_YouTubeType($property_info) { parent::SJB_Type($property_info); if (isset($this->property_info['value'])) { $this->property_info['value'] = strip_tags($this->property_info['value']); } $this->default_template = 'youtube.tpl'; }
function SJB_EmailType($property_info) { parent::SJB_Type($property_info); $this->default_template = 'email.tpl'; $this->email_confirmation = false; if (isset($property_info['email_confirmation'])) { $this->email_confirmation = $property_info['email_confirmation']; } }
function getPropertyVariablesToAssign() { $propertyVariables = parent::getPropertyVariablesToAssign(); $gallery = new SJB_ListingGallery(); $gallery->setListingSID($this->object_sid); $pictures_info = $gallery->getPicturesInfo(); $newPropertyVariables = array('pictures' => $pictures_info, 'number_of_pictures' => count($pictures_info)); return array_merge($newPropertyVariables, $propertyVariables); }
function SJB_MonetaryType($property_info) { parent::SJB_Type($property_info); $this->sql_type = 'DECIMAL'; $this->currency_values = isset($property_info['currency_values']) ? $property_info['currency_values'] : array(); if (isset($this->property_info['value']) && !is_array($this->property_info['value'])) { $value = $this->property_info['value']; unset($this->property_info['value']); $this->property_info['value']['value'] = $value; } $this->default_template = 'monetary.tpl'; }
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); }
function getPropertyVariablesToAssign() { $propertyVariables = parent::getPropertyVariablesToAssign(); $propertyVariables['choiceLimit'] = SJB_Array::get($this->property_info, 'choiceLimit'); $displayListValues = array(); $listValues = array(); foreach ($this->list_values as $key => $list_values) { $displayListValues[$list_values['id']] = $list_values['caption']; $listValues[$key]['id'] = $list_values['id']; $listValues[$key]['caption'] = $list_values['caption']; } $arrValues = array('value' => $this->property_info['value'], 'default_value' => $this->property_info['default_value'], 'profile_field_as_dv' => $this->property_info['profile_field_as_dv']); $value = array(); foreach ($arrValues as $valueID => $arrValue) { if (is_array($arrValue)) { $value[$valueID] = $this->cleanRemovedItems($arrValue, $displayListValues); } else { $itemSIDs = explode(',', $arrValue); $value[$valueID] = $this->cleanRemovedItems($itemSIDs, $displayListValues); } } $newPropertyVariables = array('value' => $value['value'], 'display_list_values' => $displayListValues, 'default_value' => $value['default_value'], 'profile_field_as_dv' => $value['profile_field_as_dv'], 'list_values' => $listValues, 'caption' => $this->property_info['caption'], 'no_first_option' => $this->property_info['no_first_option'], 'comment' => $this->property_info['comment'], 'sort_by_alphabet' => $this->property_info['sort_by_alphabet']); return array_merge($propertyVariables, $newPropertyVariables); }
function isValid($addValidParam = false) { $this->property_info['addValidParam'] = $addValidParam; return SJB_Type::isValid(); }
function SJB_StringType($property_info) { parent::SJB_Type($property_info); $this->default_template = 'string.tpl'; }
function SJB_GeoType($property_info) { parent::SJB_Type($property_info); $this->default_template = 'geo.tpl'; }
function getPropertyVariablesToAssign() { $propertyVariables = parent::getPropertyVariablesToAssign(); $newPropertyVariables = array('minimum' => $this->minimum, 'maximum' => $this->maximum); return array_merge($newPropertyVariables, $propertyVariables); }
function SJB_CaptchaType($property_info) { SJB_Event::dispatch('getPropertyInfo', $property_info, true); parent::SJB_Type($property_info); $this->default_template = 'captcha.tpl'; }
function getPropertyVariablesToAssign() { $propertyVariables = parent::getPropertyVariablesToAssign(); $newPropertyVariables = array('caption' => $this->property_info['caption'], 'comment' => SJB_Array::get($this->property_info, 'comment', '')); return array_merge($newPropertyVariables, $propertyVariables); }
function getPropertyVariablesToAssign() { return parent::getPropertyVariablesToAssign(); }
function SJB_PasswordType($property_info) { parent::SJB_Type($property_info); $this->default_template = 'password.tpl'; }
function getKeywordValue() { $keywords = ''; if (!parent::isEmpty() && SJB_Settings::getSettingByName('get_keyword_from_file')) { $fileId = $this->property_info['id'] . "_" . $this->object_sid; $fileInfo = SJB_UploadFileManager::getUploadedFileInfo($fileId); if ($fileInfo) { $uploadManager = new SJB_UploadFileManager(); $uploadManager->setFileGroup("files"); $fileUrl = $uploadManager->getUploadedFileLink($fileId, $fileInfo, true); $fileExtension = substr(strrchr($fileInfo['saved_file_name'], "."), 1); if (file_exists($fileUrl)) { switch ($fileExtension) { case 'doc': $doc = new doc(); $doc->read($fileUrl); $keywords = preg_replace('/[^[:punct:]\\w]/', '', strip_tags($doc->parse())); break; case 'docx': $keywords = SJB_HelperFunctions::docx2text($fileUrl); $keywords = preg_replace('/[^[:punct:]\\w]/', '', strip_tags(html_entity_decode($keywords))); break; case 'xls': case 'xlsx': $fileInfo['tmp_name'] = $fileUrl; $fileObj = new SJB_ImportFileXLS($fileInfo); $fileObj->parse(); $data = $fileObj->getData(); $keywords = ''; foreach ($data as $val) { $val = array_unique($val); $val = array_diff($val, array('')); $keywords .= implode(' ', $val); } $keywords = preg_replace("/[[:punct:]^\\s]/ui", " ", $keywords); break; case 'pdf': $outFilename = str_replace("." . $fileExtension, '.txt', $fileUrl); exec("pdftotext {$fileUrl} {$outFilename}"); if (file_exists($outFilename)) { $keywords = file_get_contents($outFilename); $keywords = preg_replace('/[^[:punct:]\\w]/', '', strip_tags(html_entity_decode($keywords))); unlink($outFilename); } break; case 'txt': $keywords = file_get_contents($fileUrl); $keywords = preg_replace('/[^[:punct:]\\w]/', '', strip_tags(html_entity_decode($keywords))); break; } } } } return $keywords; }