Example #1
0
                    $selected = $field->getValue("type") == $anObjectType->getID() ? ' selected="selected"' : '';
                    $content .= '<option value="' . $anObjectType->getID() . '"' . $selected . ' title="' . htmlspecialchars($anObjectType->getDescription($cms_language)) . '">' . $anObjectType->getObjectLabel($cms_language) . ' (' . $objectModule->getLabel($cms_language) . ')</option>';
                }
            }
        }
        $content .= '</optgroup>';
    }
    if (sizeof($poly_types) > 1) {
        $content .= '<optgroup label="' . $cms_language->getMessage(MESSAGE_PAGE_FIELD_MULTI) . ' ' . $cms_language->getMessage(MESSAGE_PAGE_FIELD_POLY_OBJECTS) . '">';
        //multi poly objects
        foreach ($poly_types as $anObjectType) {
            //a poly object can't use itself or can't use an object who already use itself (infinite loop)
            if ($object->getID() != $anObjectType->getID() && !in_array($anObjectType->getID(), $objectUseage)) {
                //load fields objects for object
                $objectFields = CMS_poly_object_catalog::getFieldsDefinition($anObjectType->getID());
                $objectModule = CMS_modulesCatalog::getByCodename(CMS_poly_object_catalog::getModuleCodenameForObjectType($anObjectType->getID()));
                //a poly object can't be empty
                if (sizeof($objectFields)) {
                    $selected = $field->getValue("type") == 'multi|' . $anObjectType->getID() ? ' selected="selected"' : '';
                    $content .= '<option value="multi|' . $anObjectType->getID() . '"' . $selected . ' title="' . htmlspecialchars($anObjectType->getDescription($cms_language)) . '">' . $anObjectType->getObjectLabel($cms_language) . ' (' . $objectModule->getLabel($cms_language) . ')</option>';
                }
            }
        }
        $content .= '</optgroup>';
    }
    $content .= '
			</select>';
} else {
    $content .= '
			<strong>' . $typeObject->getObjectLabel($cms_language) . '</strong>
			<input type="hidden" name="type" value="' . $field->getValue("type") . '" />';
Example #2
0
 /**
  * Module script task
  * @param array $parameters the task parameters
  *		task : string task to execute
  *		object : string module codename for the task
  *		field : string module uid
  *		...	: optional field relative parameters
  * @return Boolean true/false
  * @access public
  */
 function scriptTask($parameters)
 {
     //if script concern a field, pass to it
     if (isset($parameters['field']) && sensitiveIO::isPositiveInteger($parameters['field'])) {
         if (!is_object($this->_objectValues[$parameters['field']]) || !method_exists($this->_objectValues[$parameters['field']], 'scriptTask')) {
             return false;
         }
         //then pass task to field
         return $this->_objectValues[$parameters['field']]->scriptTask($parameters);
     } else {
         //this is an object related script
         switch ($parameters['task']) {
             case 'emailNotification':
                 //instanciate user
                 $user = CMS_profile_usersCatalog::getByID($parameters['validator']);
                 if ($this->userHasClearance($user, CLEARANCE_MODULE_EDIT)) {
                     //get Object definition
                     $objectDef = $this->getObjectDefinition();
                     //get module
                     $codename = CMS_poly_object_catalog::getModuleCodenameForObjectType($objectDef->getID());
                     switch ($parameters['type']) {
                         case 'validate':
                             $group_email = new CMS_emailsCatalog();
                             $languages = CMS_languagesCatalog::getAllLanguages();
                             $subjects = array();
                             $bodies = array();
                             //editors
                             $editorsIds = $parameters['editors'];
                             $editors = array();
                             foreach ($editorsIds as $editorId) {
                                 $editor = CMS_profile_usersCatalog::getByID($editorId);
                                 if (is_a($editor, 'CMS_profile_user') && !$editor->hasError()) {
                                     $editors[] = $editor;
                                 }
                             }
                             //$editors = $this->getEditors();
                             $editorsInfos = '';
                             foreach ($editors as $editor) {
                                 $editorsInfos .= $editorsInfos ? ",\n" : '';
                                 $editorsInfos .= $editor->getFullName() . ($editor->getEmail() ? ' (' . $editor->getEmail() . ')' : '');
                             }
                             foreach ($languages as $language) {
                                 $subjects[$language->getCode()] = $language->getMessage(self::MESSAGE_POLYMOD_ACTION_EMAIL_SUBJECT, array($objectDef->getLabel($language)), MOD_POLYMOD_CODENAME);
                                 $bodies[$language->getCode()] = $language->getMessage(MESSAGE_EMAIL_VALIDATION_AWAITS) . "\n" . $language->getMessage(self::MESSAGE_POLYMOD_ACTION_EMAIL_BODY, array($objectDef->getLabel($language), $this->getLabel(), $editorsInfos), MOD_POLYMOD_CODENAME);
                             }
                             $group_email->setUserMessages(array($user), $bodies, $subjects, ALERT_LEVEL_VALIDATION, $codename);
                             $group_email->sendMessages();
                             break;
                         case 'delete':
                             $group_email = new CMS_emailsCatalog();
                             $languages = CMS_languagesCatalog::getAllLanguages();
                             $subjects = array();
                             $bodies = array();
                             //editors
                             $editorsIds = $parameters['editors'];
                             $editors = array();
                             foreach ($editorsIds as $editorId) {
                                 $editor = CMS_profile_usersCatalog::getByID($editorId);
                                 if (is_a($editor, 'CMS_profile_user') && !$editor->hasError()) {
                                     $editors[] = $editor;
                                 }
                             }
                             //$editors = $this->getEditors();
                             $editorsInfos = '';
                             foreach ($editors as $editor) {
                                 $editorsInfos .= $editorsInfos ? ",\n" : '';
                                 $editorsInfos .= $editor->getFullName() . ($editor->getEmail() ? ' (' . $editor->getEmail() . ')' : '');
                             }
                             foreach ($languages as $language) {
                                 $subjects[$language->getCode()] = $language->getMessage(self::MESSAGE_POLYMOD_ACTION_EMAIL_DELETE_SUBJECT, array($objectDef->getLabel($language)), MOD_POLYMOD_CODENAME);
                                 $bodies[$language->getCode()] = $language->getMessage(MESSAGE_EMAIL_VALIDATION_AWAITS) . "\n" . $language->getMessage(self::MESSAGE_POLYMOD_ACTION_EMAIL_DELETE_BODY, array($objectDef->getLabel($language), $this->getLabel(), $editorsInfos), MOD_POLYMOD_CODENAME);
                             }
                             $group_email->setUserMessages(array($user), $bodies, $subjects, ALERT_LEVEL_VALIDATION, $codename);
                             $group_email->sendMessages();
                             break;
                         default:
                             $this->raiseError('Unknown script task to do : ' . print_r($parameters, true));
                             return false;
                             break;
                     }
                 }
                 return true;
                 break;
             default:
                 $this->raiseError('Unknown script task to do : ' . print_r($parameters, true));
                 return false;
                 break;
         }
     }
 }
Example #3
0
if ($id) {
    $ids = explode('-', $id);
    $selectedPluginID = (int) $ids[1];
    $selectedItem = (int) $ids[2];
} else {
    $selectedPluginID = $selectedItem = 0;
}
//Select WYSIWYG Plugin
$pluginDefinitions = CMS_poly_object_catalog::getAllPluginDefinitionsForObject();
//check for user rights
$availablePlugin = array();
$availablePluginCount = 0;
if (sizeof($pluginDefinitions)) {
    foreach ($pluginDefinitions as $id => $pluginDefinition) {
        $objectID = $pluginDefinition->getValue('objectID');
        $polyModuleCodename = CMS_poly_object_catalog::getModuleCodenameForObjectType($objectID);
        if ($cms_user->hasModuleClearance($polyModuleCodename, CLEARANCE_MODULE_EDIT)) {
            $availablePlugin[$polyModuleCodename][$id] = $pluginDefinition;
            $availablePluginCount++;
        }
    }
}
//if no plugin available, display error and quit
if (!sizeof($availablePlugin)) {
    //messages
    $cms_message = $cms_language->getMessage(MESSAGE_PAGE_ERROR_NO_PLUGIN, false, MOD_POLYMOD_CODENAME);
    $view->setActionMessage($cms_message);
    $view->show();
}
$items = '';
$activeTab = 0;
Example #4
0
}
$oembedDefinition = CMS_polymod_oembed_definition_catalog::getByCodename($page->getCodename());
if (!$oembedDefinition) {
    header('HTTP/1.x 404 Not Found', true, 404);
    exit;
}
$pageLang = $page->getLanguage(true);
$cms_language = new CMS_language($pageLang);
define('CURRENT_PAGE', $page->getID());
$website = $page->getWebsite();
$htmlDefinition = $oembedDefinition->getHtml();
$module = CMS_poly_object_catalog::getModuleCodenameForObjectType($oembedDefinition->getObjectdefinition());
$polymodModule = CMS_modulesCatalog::getByCodename($module);
$transformedDefinition = $polymodModule->convertDefinitionString($htmlDefinition, false);
$parameters = array();
$parameters['module'] = CMS_poly_object_catalog::getModuleCodenameForObjectType($oembedDefinition->getObjectdefinition());
$parameters['objectID'] = $oembedDefinition->getObjectdefinition();
$parameters['public'] = true;
$parameters['cache'] = false;
$parameters['pageID'] = CURRENT_PAGE;
$definitionParsing = new CMS_polymod_definition_parsing($transformedDefinition, true, CMS_polymod_definition_parsing::BLOCK_PARAM_MODE, $parameters['module']);
$compiledDefinition = $definitionParsing->getContent(CMS_polymod_definition_parsing::OUTPUT_PHP, $parameters);
$urlParts = parse_url($url);
if (!isset($urlParts['query'])) {
    die("Incorrect parameters");
}
parse_str($urlParts['query']);
$parameterName = $oembedDefinition->getParameter();
$embededObject = CMS_poly_object_catalog::getObjectByID(${$parameterName}, false, true);
if (!$embededObject) {
    die("Incorrect parameters");
Example #5
0
 /**
  * Treat given content tag by this module for the specified treatment mode, visualization mode and object.
  *
  * @param string $tag The CMS_XMLTag.
  * @param string $tagContent previous tag content.
  * @param integer $treatmentMode The current treatment mode (see constants on top of CMS_modulesTags class for accepted values).
  * @param integer $visualizationMode The current visualization mode (see constants on top of cms_page class for accepted values).
  * @param object $treatedObject The reference object to treat.
  * @param array $treatmentParameters : optionnal parameters used for the treatment. Usually an array of objects.
  * @return string the tag content treated.
  * @access public
  */
 function treatWantedTag(&$tag, $tagContent, $treatmentMode, $visualizationMode, &$treatedObject, $treatmentParameters)
 {
     switch ($treatmentMode) {
         case MODULE_TREATMENT_BLOCK_TAGS:
             return parent::treatWantedTag($tag, $tagContent, $treatmentMode, $visualizationMode, $treatedObject, $treatmentParameters);
             break;
         case MODULE_TREATMENT_CLIENTSPACE_TAGS:
             return parent::treatWantedTag($tag, $tagContent, $treatmentMode, $visualizationMode, $treatedObject, $treatmentParameters);
             break;
         case MODULE_TREATMENT_PAGECONTENT_TAGS:
             if (!$treatedObject instanceof CMS_page) {
                 $this->raiseError('$treatedObject must be a CMS_page object');
                 return false;
             }
             switch ($tag->getName()) {
                 case "span":
                     $ids = explode('-', $tag->getAttribute('id'));
                     $selectedPluginID = (int) $ids[1];
                     $selectedItem = (int) $ids[2];
                     //then create the code to paste for the current selected object if any
                     if (sensitiveIO::isPositiveInteger($selectedItem) && sensitiveIO::isPositiveInteger($selectedPluginID)) {
                         //get plugin
                         $selectedPlugin = new CMS_poly_plugin_definitions($selectedPluginID);
                         //get plugin definition
                         $definition = $selectedPlugin->getValue('compiledDefinition');
                         //set parsing parameters
                         $parameters = array();
                         $parameters['itemID'] = $selectedItem;
                         $parameters['pageID'] = $treatedObject->getID();
                         $parameters['public'] = $visualizationMode == PAGE_VISUALMODE_HTML_PUBLIC || $visualizationMode == PAGE_VISUALMODE_PRINT || $visualizationMode == PAGE_VISUALMODE_HTML_PUBLIC_INDEXABLE ? true : false;
                         //get originaly selected text
                         if (!$selectedPlugin->needSelection()) {
                             $parameters['selection'] = '';
                         } else {
                             $hasSelection = preg_match('#<!--(.*)-->#s', $tag->getInnerContent(), $matches);
                             $parameters['selection'] = io::decodeEntities($hasSelection ? $matches[1] : $tag->getInnerContent());
                             //$parameters['selection'] = io::decodeEntities($tag->getInnerContent());
                         }
                         $tagContent = '<?php $parameters = ' . var_export($parameters, true) . ';' . "\n" . io::substr($definition, 5);
                         //save in global var the page ID who need this module so we can add the header code later.
                         CMS_module::moduleUsage($treatedObject->getID(), $this->_codename, array('block' => true));
                         //Cache management
                         if ($parameters['public']) {
                             //create definition hash
                             $cacheHash = md5(serialize(array('definition' => $tagContent, 'parameters' => $parameters)));
                             $tagContent = CMS_cache::wrapCode($cacheHash, $tagContent);
                         }
                     }
                     return $tagContent;
                     break;
             }
             break;
         case MODULE_TREATMENT_PAGEHEADER_TAGS:
             $content = parent::treatWantedTag($tag, $tagContent, $treatmentMode, $visualizationMode, $treatedObject, $treatmentParameters);
             if ($treatedObject instanceof CMS_page && $tag->getName() === "atm-meta-tags") {
                 $oembed = CMS_polymod_oembed_definition_catalog::getByCodename($treatedObject->getCodename());
                 if ($oembed && CMS_poly_object_catalog::getModuleCodenameForObjectType($oembed->getObjectdefinition()) === $this->_codename) {
                     $content .= '<?php ' . "\n" . 'echo CMS_polymod_oembed_definition::getDiscoveryEndpoint(); ?>';
                 }
             }
             return $content;
             break;
         case MODULE_TREATMENT_WYSIWYG_INNER_TAGS:
             switch ($tag->getName()) {
                 case "span":
                     global $cms_language;
                     $ids = explode('-', $tag->getAttribute('id'));
                     $selectedPluginID = (int) $ids[1];
                     $selectedItem = (int) $ids[2];
                     //then create the code to paste for the current selected object if any
                     if (sensitiveIO::isPositiveInteger($selectedItem) && sensitiveIO::isPositiveInteger($selectedPluginID)) {
                         //get plugin
                         $selectedPlugin = new CMS_poly_plugin_definitions($selectedPluginID);
                         //get selected item
                         $item = CMS_poly_object_catalog::getObjectByID($selectedItem, false, $visualizationMode == PAGE_VISUALMODE_HTML_PUBLIC || $visualizationMode == PAGE_VISUALMODE_PRINT || $visualizationMode == PAGE_VISUALMODE_HTML_PUBLIC_INDEXABLE ? true : false);
                         if ($item && !$item->hasError()) {
                             //get originaly selected text if any
                             $selectedText = '';
                             if ($selectedPlugin->needSelection()) {
                                 $hasSelection = preg_match('#<!--(.*)-->#s', $tag->getInnerContent(), $matches);
                                 $selectedText = $hasSelection ? $matches[1] : $tag->getInnerContent();
                                 $tagContent = '<span id="polymod-' . $selectedPluginID . '-' . $selectedItem . '" class="polymod" title="' . io::htmlspecialchars($selectedPlugin->getLabel($cms_language) . ' : ' . trim($item->getLabel($cms_language))) . '">' . $selectedText . '</span>';
                             } else {
                                 $tagContent = '<span id="polymod-' . $selectedPluginID . '-' . $selectedItem . '" class="polymod" title="' . io::htmlspecialchars($selectedPlugin->getLabel($cms_language) . ' : ' . trim($item->getLabel($cms_language))) . '">' . CMS_poly_definition_functions::pluginCode($selectedPluginID, $selectedItem, '', $visualizationMode == PAGE_VISUALMODE_HTML_PUBLIC || $visualizationMode == PAGE_VISUALMODE_PRINT || $visualizationMode == PAGE_VISUALMODE_HTML_PUBLIC_INDEXABLE ? true : false, true) . '</span>';
                             }
                         } else {
                             $tagContent = '';
                         }
                     }
                     //strip cache comment
                     $tagContent = preg_replace('#<!--{cache:(.*)}-->#Us', '', $tagContent);
                     //encode all ampersand without reencode already encoded ampersand
                     $tagContent = sensitiveIO::reencodeAmpersand($tagContent);
                     return $tagContent;
                     break;
             }
             return $tagContent;
             break;
         case MODULE_TREATMENT_WYSIWYG_OUTER_TAGS:
             switch ($tag->getName()) {
                 case "span":
                     $ids = explode('-', $tag->getAttribute('id'));
                     $selectedPluginID = (int) $ids[1];
                     $selectedItem = (int) $ids[2];
                     //then create the code to paste for the current selected object if any
                     if (sensitiveIO::isPositiveInteger($selectedItem) && sensitiveIO::isPositiveInteger($selectedPluginID)) {
                         //get plugin
                         $selectedPlugin = new CMS_poly_plugin_definitions($selectedPluginID);
                         //get originaly selected text if any
                         $selectedText = $commentSelectedText = '';
                         if ($selectedPlugin->needSelection()) {
                             $hasSelection = preg_match('#<!--(.*)-->#s', $tag->getInnerContent(), $matches);
                             $selectedText = $hasSelection ? $matches[1] : $tag->getInnerContent();
                             $commentSelectedText = '<!--' . ($hasSelection ? $matches[1] : $tag->getInnerContent()) . '-->';
                         }
                         $tagContent = '<span id="polymod-' . $selectedPluginID . '-' . $selectedItem . '" class="polymod">' . "\n" . '<?php echo CMS_poly_definition_functions::pluginCode(\'' . $selectedPluginID . '\', \'' . $selectedItem . '\', ' . var_export($selectedText, true) . ', true); ?>' . "\n" . $commentSelectedText . '</span>';
                     }
                     return $tagContent;
                     break;
             }
             return $tagContent;
             break;
     }
     return $tag->getContent();
 }
 /**
  * This method sets the HTML
  * @return  the current object
  */
 public function setHtml($v)
 {
     $module = CMS_poly_object_catalog::getModuleCodenameForObjectType($this->objectdefinition);
     $polymod = CMS_modulesCatalog::getByCodename($module);
     $this->setCompiledHtml($polymod->convertDefinitionString($v, false));
     return $this;
 }
 /**
  * Get plugin object as an array structure used for export
  *
  * @param array $params The export parameters. Not used here
  * @param array $files The reference to the found files used by object
  * @return array : the object array structure
  * @access public
  */
 public function asArray($params = array(), &$files)
 {
     $module = CMS_modulesCatalog::getByCodename(CMS_poly_object_catalog::getModuleCodenameForObjectType($this->getValue('objectID')));
     $aClass = array('id' => $this->getID(), 'uuid' => $this->getValue('uuid'), 'labels' => CMS_object_i18nm::getValues($this->getValue('labelID')), 'descriptions' => CMS_object_i18nm::getValues($this->getValue('descriptionID')), 'objectID' => $this->getValue('objectID'), 'params' => array('query' => $this->getValue('query'), 'definition' => $this->getValue('definition')));
     if ($aClass['params']['definition']) {
         $aClass['params']['definition'] = $module->convertDefinitionString($aClass['params']['definition'], true);
     }
     return $aClass;
 }
 /**
  * This function is called to catch and launch all FE forms actions
  *
  * @param array $formIDs : the forms ids to check for actions
  * @param integer $pageID : the current page id
  * @param boolean $public : the data status
  * @param string $languageCode : the language code used
  * @param reference array $polymodFormsError : the forms error status to return
  * @param reference array $polymodFormsItem : reference to the forms item
  * @return boolean : true on success, false on failure
  * @access public
  * @static
  */
 static function formActions($formIDs, $pageID, $languageCode, $public, &$polymodFormsError, &$polymodFormsItems)
 {
     global $cms_language, $cms_user;
     if (!is_array($formIDs)) {
         return false;
     }
     foreach ($formIDs as $formID) {
         if (io::request('formID') && io::request('formID') == $formID) {
             if (!isset($cms_language) || $cms_language->getCode() != $languageCode) {
                 $cms_language = new CMS_language($languageCode);
             }
             //instanciate item
             $item = '';
             if (io::request('object', 'io::isPositiveInteger', '')) {
                 //check user rights on module
                 $module = CMS_poly_object_catalog::getModuleCodenameForObjectType(io::request('object'));
                 //Check user rights
                 //here assume than user should only need the view right on module, because admin right allow Automne administration access
                 if (!is_object($cms_user) || !$cms_user->hasModuleClearance($module, CLEARANCE_MODULE_VIEW)) {
                     CMS_grandFather::raiseError('No user found or user has no administration rights on module ' . $module);
                     return false;
                 }
                 //instanciate object
                 $object = CMS_poly_object_catalog::getObjectDefinition(io::request('object'));
                 if ($object && io::request('item', 'io::isPositiveInteger', '')) {
                     $search = new CMS_object_search($object, false);
                     $search->addWhereCondition('item', io::request('item'));
                     $items = $search->search();
                     if (isset($items[io::request('item')])) {
                         $item = $items[io::request('item')];
                     } else {
                         $item = new CMS_poly_object($object->getID());
                     }
                 } else {
                     $item = new CMS_poly_object($object->getID());
                 }
             }
             if (is_object($item) && !$item->hasError()) {
                 //get item fieldsObjects
                 $fieldsObjects =& $item->getFieldsObjects();
                 //checks and assignments
                 $item->setDebug(false);
                 //first, check mandatory values
                 foreach ($fieldsObjects as $fieldID => $aFieldObject) {
                     //if field is part of formular
                     if (isset($_REQUEST['polymodFields'][$fieldID])) {
                         if (!$item->checkMandatory($fieldID, $_REQUEST, '')) {
                             $polymodFormsError[$formID]['required'][$fieldID] = $fieldID;
                         }
                     }
                 }
                 //second, set values for all fields
                 foreach ($fieldsObjects as $fieldID => $aFieldObject) {
                     //if field is part of formular
                     if (isset($_REQUEST['polymodFields'][$fieldID])) {
                         //if form use a callback, call it
                         //do not use call_user_function here
                         $funcName = 'form_' . $formID . '_' . $fieldID;
                         if (!$item->setValues($fieldID, $_REQUEST, '')) {
                             $polymodFormsError[$formID]['malformed'][] = $fieldID;
                         } elseif (!isset($polymodFormsError[$formID]['required'][$fieldID]) && function_exists('form_' . $formID . '_' . $fieldID) && !$funcName($formID, $fieldID, $item)) {
                             $polymodFormsError[$formID]['malformed'][] = $fieldID;
                         }
                     }
                 }
                 //set publication dates if needed
                 if (isset($_REQUEST['polymodFields']) && $_REQUEST['polymodFields']) {
                     if ($object->isPrimaryResource()) {
                         // Dates management
                         $dt_beg = new CMS_date();
                         $dt_beg->setDebug(false);
                         $dt_beg->setFormat($cms_language->getDateFormat());
                         $dt_end = new CMS_date();
                         $dt_end->setDebug(false);
                         $dt_end->setFormat($cms_language->getDateFormat());
                         if (!($dt_set_1 = $dt_beg->setLocalizedDate(@$_REQUEST["pub_start"], true))) {
                             $polymodFormsError[$formID]['malformed'][] = 'pub_start';
                         }
                         if (!($dt_set_2 = $dt_end->setLocalizedDate(@$_REQUEST["pub_end"], true))) {
                             $polymodFormsError[$formID]['malformed'][] = 'pub_end';
                         }
                         //if $dt_beg && $dt_end, $dt_beg must be lower than $dt_end
                         if (!$dt_beg->isNull() && !$dt_end->isNull()) {
                             if (CMS_date::compare($dt_beg, $dt_end, '>')) {
                                 $polymodFormsError[$formID]['malformed'][] = 'pub_start';
                                 $polymodFormsError[$formID]['malformed'][] = 'pub_end';
                                 $dt_set_1 = $dt_set_2 = false;
                             }
                         }
                         if ($dt_set_1 && $dt_set_2) {
                             $item->setPublicationDates($dt_beg, $dt_end);
                         }
                     }
                 }
                 //Check form token
                 if (!isset($_POST["atm-token"]) || !CMS_session::checkToken(MOD_POLYMOD_CODENAME . '-' . $formID, $_POST["atm-token"])) {
                     $polymodFormsError[$formID]['error'][] = 'form-token';
                     return false;
                 } else {
                     //Token is used so expire it
                     CMS_session::expireToken(MOD_POLYMOD_CODENAME . '-' . $formID);
                 }
                 if (!$polymodFormsError[$formID]) {
                     //save the data
                     if (!$item->writeToPersistence()) {
                         $polymodFormsError[$formID]['error'][] = 'write';
                         $polymodFormsError[$formID]['filled'] = 0;
                     } else {
                         $polymodFormsError[$formID]['filled'] = 1;
                         //if form use a callback, call it
                         //do not use call_user_function here
                         $funcName = 'form_' . $formID;
                         if (function_exists('form_' . $formID) && !$funcName($formID, $item)) {
                             $polymodFormsError[$formID]['filled'] = 0;
                             $polymodFormsError[$formID]['error'][] = 'callback';
                         }
                     }
                     //if item is a primary resource, unlock it
                     if ($object->isPrimaryResource()) {
                         $item->unlock();
                     }
                 } else {
                     $polymodFormsError[$formID]['filled'] = 0;
                 }
                 //save item for later use
                 $polymodFormsItems[$formID] = $item;
             } else {
                 $polymodFormsError[$formID]['filled'] = 0;
                 $polymodFormsError[$formID]['error'][] = 'right';
                 CMS_grandFather::raiseError('No item found or user has no administration rights on item... ');
                 return false;
             }
         }
     }
     return true;
 }
 /**
  * Return an options tag list (for select tag) of all module objects infos
  *
  * @param string $codename the module codename
  * @param CMS_language $language : current language
  * @param string $selectedValue : the current selected value of the list
  * @param integer $objectID : the module object ID to restrict the list (default false : all objects of the module)
  * @return string : the options tag list
  * @access public
  * @static
  */
 function viewObjectInfosList($codename, &$language, $selectedValue, $objectID = false)
 {
     //get module structure
     $objectsStructure = CMS_poly_module_structure::getModuleStructure($codename, true);
     if ($objectID && isset($objectsStructure['object' . $objectID])) {
         $currentPath = '[\'object' . $objectID . '\']';
         $selected = $currentPath == $selectedValue ? ' selected="selected"' : '';
         $list = '<option value="' . $currentPath . '" style="font-weight: bold;"' . $selected . '>' . $objectsStructure['objectInfos']['object' . $objectID]->getObjectLabel($language) . '</option>';
         $list .= CMS_poly_module_structure::_viewObjectInfosList($objectID, $language, $objectsStructure, $selectedValue, '[object' . $objectID . ']');
     } else {
         $list = '';
         foreach ($objectsStructure as $objectID => $objectStructure) {
             if ($objectID != 'objectInfos' && CMS_poly_object_catalog::getModuleCodenameForObjectType(io::substr($objectID, 6)) == $codename) {
                 $currentPath = '[\'' . $objectID . '\']';
                 $selected = $currentPath == $selectedValue ? ' selected="selected"' : '';
                 $list .= '<option value="' . $currentPath . '" style="font-weight: bold;"' . $selected . '>' . $objectsStructure['objectInfos'][$objectID]->getObjectLabel($language) . '</option>';
                 $list .= CMS_poly_module_structure::_viewObjectInfosList(io::substr($objectID, 6), $language, $objectsStructure, $selectedValue, $currentPath);
             }
         }
     }
     return $list;
 }
 /**
  * Get rss object as an array structure used for export
  *
  * @param array $params The export parameters. Not used here
  * @param array $files The reference to the found files used by object
  * @return array : the object array structure
  * @access public
  */
 public function asArray($params = array(), &$files)
 {
     $module = CMS_modulesCatalog::getByCodename(CMS_poly_object_catalog::getModuleCodenameForObjectType($this->getValue('objectID')));
     $aClass = array('id' => $this->getID(), 'uuid' => $this->getValue('uuid'), 'labels' => CMS_object_i18nm::getValues($this->getValue('labelID')), 'descriptions' => CMS_object_i18nm::getValues($this->getValue('descriptionID')), 'objectID' => $this->getValue('objectID'), 'params' => array('link' => $this->getValue('link'), 'author' => $this->getValue('author'), 'copyright' => $this->getValue('copyright'), 'namespaces' => $this->getValue('namespaces'), 'categories' => $this->getValue('categories'), 'ttl' => $this->getValue('ttl'), 'email' => $this->getValue('email'), 'definition' => $this->getValue('definition')));
     if ($aClass['params']['definition']) {
         $aClass['params']['definition'] = $module->convertDefinitionString($aClass['params']['definition'], true);
     }
     return $aClass;
 }