/** * Get soap values * * @return string $xml XML definition * @access public */ function getSoapValues($fieldID, $language) { $xml = '<field id="' . $fieldID . '" label="' . sensitiveIO::sanitizeHTMLString($this->getFieldLabel($language)) . '" required="' . $this->_field->getValue('required') . '">' . "\n"; foreach ($this->_subfields as $subFieldID => $subFieldDefinition) { if (is_object($this->_subfieldValues[$subFieldID])) { $xml .= '<subfield id="' . $subFieldID . '" name="' . $subFieldDefinition['internalName'] . '" type="' . $subFieldDefinition['type'] . '" required="' . $subFieldDefinition['required'] . '">' . "\n"; switch ($subFieldDefinition['type']) { case 'integer': case 'date': $xml .= $this->_subfieldValues[$subFieldID]->getValue(); break; case 'text': case 'string': default: $xml .= '<![CDATA[' . $this->_subfieldValues[$subFieldID]->getValue() . ']]>'; break; } $xml .= "\n" . '</subfield>' . "\n"; } } $xml .= '</field>' . "\n"; return $xml; }
/** * Return a list of all objects names of given type * * @param boolean $public are the needed datas public ? (default false) * @param array $searchConditions, search conditions to add. Format : array(conditionType => conditionValue) * @return array(integer objectID => string objectName) * @access public * @static */ function getListOfNamesForObject($public = false, $searchConditions = array()) { return CMS_poly_object_catalog::getListOfNamesForObject(io::substr($this->_field->getValue('type'), 6), $public, $searchConditions); }
/** * get an object value * * @param string $name : the name of the value to get * @param string $parameters (optional) : parameters for the value to get * @return mixed : the object values structure * @access public */ function getValue($name, $parameters = '') { global $cms_language; // @TODOV4 : Manage language into database ! $languages = array(); $languages['fr'] = array('January' => 'Janvier', 'February' => 'Février', 'March' => 'Mars', 'April' => 'Avril', 'May' => 'Mai', 'June' => 'Juin', 'July' => 'Juillet', 'August' => 'Août', 'September' => 'Septembre', 'October' => 'Octobre', 'November' => 'Novembre', 'December' => 'Décembre', 'Monday' => 'Lundi', 'Tuesday' => 'Mardi', 'Wednesday' => 'Mercredi', 'Thursday' => 'Jeudi', 'Friday' => 'Vendredi', 'Saturday' => 'Samedi', 'Sunday' => 'Dimanche', 'Jan' => 'Jan', 'Feb' => 'Fév', 'Mar' => 'Mar', 'Apr' => 'Avr', 'May' => 'Mai', 'Jun' => 'Jui', 'Jul' => 'Jui', 'Aug' => 'Aoû', 'Sep' => 'Sep', 'Oct' => 'Oct', 'Nov' => 'Nov', 'Dec' => 'Déc', 'Mon' => 'Lun', 'Tue' => 'Mar', 'Wed' => 'Mer', 'Thu' => 'Jeu', 'Fri' => 'Ven', 'Sat' => 'Sam', 'Sun' => 'Dim'); switch ($name) { case 'id': return (string) $this->_ID; break; case 'label': if ($parameters == 'js') { return sensitiveIO::sanitizeJSString($this->getLabel()); } else { return $this->getLabel(); } break; case 'objectname': return $this->getFieldLabel($cms_language); break; case 'objectdescription': return $this->getFieldDesc($cms_language); break; case 'objecttype': return $this->_objectID; break; case 'resource': if ($this->_objectResourceStatus == 1) { return parent::getID(); } return; break; case 'formatedDateStart': if ($this->_objectResourceStatus == 1) { $date = parent::getPublicationDateStart(); if (io::strtolower($parameters) == 'rss') { $date = date('r', $date->getTimeStamp()); } else { $date = date($parameters, $date->getTimeStamp()); if (is_object($cms_language) && isset($languages[$cms_language->getCode()])) { $date = str_replace(array_keys($languages[$cms_language->getCode()]), $languages[$cms_language->getCode()], $date); } } return io::htmlspecialchars($date); } break; case 'formatedDateEnd': if ($this->_objectResourceStatus == 1) { $date = parent::getPublicationDateEnd(); if (is_a($date, 'CMS_date')) { if (io::strtolower($parameters) == 'rss') { $date = date('r', $date->getTimeStamp()); } else { $date = date($parameters, $date->getTimeStamp()); if (is_object($cms_language) && isset($languages[$cms_language->getCode()])) { $date = str_replace(array_keys($languages[$cms_language->getCode()]), $languages[$cms_language->getCode()], $date); } } return io::htmlspecialchars($date); } } break; case 'dateStartNotNull': if ($this->_objectResourceStatus == 1) { $date = parent::getPublicationDateStart(); return !$date->isNull(); } break; case 'dateStartTimestamp': if ($this->_objectResourceStatus == 1) { $date = parent::getPublicationDateStart(); return $date->getTimestamp(); } break; case 'dateEndNotNull': if ($this->_objectResourceStatus == 1) { $date = parent::getPublicationDateEnd(); return !$date->isNull(); } break; case 'dateEndTimestamp': if ($this->_objectResourceStatus == 1) { $date = parent::getPublicationDateEnd(); return $date->getTimestamp(); } break; //field related values, may not exists ... //field related values, may not exists ... case 'fieldID': if (!is_a($this->_field, 'CMS_poly_object_field')) { $this->raiseError("Can't get 'fieldID' value for an object which is not a field of another object ..."); return ''; } return $this->_field->getID(); break; case 'description': if (!is_a($this->_field, 'CMS_poly_object_field')) { $this->raiseError("Can't get 'description' value for an object which is not a field of another object ..."); return ''; } return io::htmlspecialchars($this->_field->getFieldDescription($cms_language)); break; case 'required': if (!is_a($this->_field, 'CMS_poly_object_field')) { $this->raiseError("Can't get 'required' value for an object which is not a field of another object ..."); return false; } return $this->_field->getValue("required") ? true : false; break; case 'fieldname': if (!is_a($this->_field, 'CMS_poly_object_field')) { $this->raiseError("Can't get 'fieldname' value for an object which is not a field of another object ..."); return ''; } //get label of current field $fieldLabel = new CMS_object_i18nm($this->_field->getValue("labelID")); return $fieldLabel->getValue($cms_language->getCode()); break; default: $this->raiseError("Unknown value to get : " . $name); return false; break; } }