/**
  * Returns eZXML content to insert into XML blocks (ezxmltext datatype)
  * eZXML is generated from HTML content provided as argument
  * @param string $htmlContent Input HTML string
  * @return string Generated eZXML string
  * @see SQLIContentUtils::getRichContent()
  */
 protected function getRichContent($htmlContent)
 {
     return SQLIContentUtils::getRichContent($htmlContent);
 }
 /**
  * @param int $remoteNodeID
  * @param int $localParentNodeID
  *
  * @return eZContentObject
  * @throws Exception
  */
 public function import($remoteNodeID, $localParentNodeID)
 {
     if (!class_exists('OCOpenDataApiNode')) {
         throw new Exception("Libreria OCOpenDataApiNode non trovata");
     }
     $apiNodeUrl = rtrim($this->attributes['definition']['Url'], '/') . '/api/opendata/v1/content/node/' . $remoteNodeID;
     $remoteApiNode = OCOpenDataApiNode::fromLink($apiNodeUrl);
     if (!$remoteApiNode instanceof OCOpenDataApiNode) {
         throw new Exception("Url remoto \"{$apiNodeUrl}\" non raggiungibile");
     }
     $attributeList = array();
     foreach ($this->remoteClassAttributes as $identifier) {
         if (isset($remoteApiNode->fields[$identifier])) {
             $fieldArray = $remoteApiNode->fields[$identifier];
             $localeIdentifier = isset($this->mapAttributes[$identifier]) ? $this->mapAttributes[$identifier] : false;
             if ($localeIdentifier) {
                 if (strpos($localeIdentifier, '::') === 0) {
                     $localeIdentifier = str_replace('::', '', $localeIdentifier);
                     $attributeList[$localeIdentifier] = $this->importAttribute($identifier, $localeIdentifier, $fieldArray);
                 } else {
                     switch ($fieldArray['type']) {
                         case 'ezxmltext':
                             $attributeList[$localeIdentifier] = SQLIContentUtils::getRichContent($fieldArray['value']);
                             break;
                         case 'ezbinaryfile':
                         case 'ezimage':
                             $attributeList[$localeIdentifier] = !empty($fieldArray['value']) ? SQLIContentUtils::getRemoteFile($fieldArray['value']) : '';
                             break;
                         default:
                             $attributeList[$localeIdentifier] = $fieldArray['string_value'];
                             break;
                     }
                 }
             }
         }
     }
     $params = array();
     $params['class_identifier'] = $this->mapClassIdentifier;
     $params['remote_id'] = static::REMOTE_PREFIX . $remoteApiNode->metadata['objectRemoteId'];
     $params['parent_node_id'] = $localParentNodeID;
     $params['attributes'] = $attributeList;
     $newObject = eZContentFunctions::createAndPublishObject($params);
     if (!$newObject instanceof eZContentObject) {
         throw new Exception("Fallita la creazione dell'oggetto da nodo remoto");
     }
     return $newObject;
 }
 public function getRichContent()
 {
     $this->input = self::parser($this->input);
     return SQLIContentUtils::getRichContent($this->input);
 }
 private function getAttributesStringArray(eZContentObject $eZContentObject)
 {
     $attributeList = array();
     $excludedAttributes = array();
     $excludedAttributesOfClass = array();
     # filtro i campi da scartare per la specifica classe
     $classidentifier = $this->remoteApiNode->metadata['classIdentifier'];
     #print_r('$classidentifier=');
     #print_r($classidentifier);
     $excludedAttributes = $this->itFiltersUtil->getExcludedAttributes();
     //echo '<pre>';
     //print_r('ARRAY ATTRIBUTI DA SCARTARE $excludedAttributes:');
     //print_r($excludedAttributes);
     $excludedAttributesOfClass = $excludedAttributes[$classidentifier];
     //print_r('  CLASSE=');
     //print_r($classidentifier);
     //print_r('  ARRAY ATTRIBUTI DA SCARTARE PER LA MIA CLASSE $excludedAttributes:');
     //print_r($excludedAttributesOfClass);
     foreach ((array) $this->remoteApiNode->fields as $identifier => $fieldArray) {
         if (!in_array($fieldArray['identifier'], (array) $excludedAttributesOfClass)) {
             switch ($fieldArray['type']) {
                 case 'ezxmltext':
                     $attributeList[$identifier] = SQLIContentUtils::getRichContent($fieldArray['value']);
                     break;
                 case 'ezbinaryfile':
                 case 'ezimage':
                     if (!empty($fieldArray['value'])) {
                         $attributeList[$identifier] = SQLIContentUtils::getRemoteFile($fieldArray['value']);
                     }
                     break;
                     /*
                     case 'ezobjectrelationlist':
                     $parentNodeID = $this->findRelationObjectLocation( $identifier, $parentNodeID );
                     $attributeList[$identifier] = $this->createRelationObjects( $fieldArray, $parentNodeID, $isUpdate );
                     break;
                     */
                 /*
                 case 'ezobjectrelationlist':
                 $parentNodeID = $this->findRelationObjectLocation( $identifier, $parentNodeID );
                 $attributeList[$identifier] = $this->createRelationObjects( $fieldArray, $parentNodeID, $isUpdate );
                 break;
                 */
                 case 'eztags':
                     $attributeList[$identifier] = $this->createLocalTags($identifier, $fieldArray['string_value']);
                     break;
                 default:
                     $attributeList[$identifier] = $fieldArray['string_value'];
                     break;
             }
         }
     }
     return $attributeList;
 }