/**
  * 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 multidimentionnal array : the object values structure
  * @access public
  */
 function getValue($name, $parameters = '')
 {
     if (in_array($name, array('fieldname', 'required', 'fieldID', 'value'))) {
         return parent::getValue($name, $parameters);
     }
     $params = $this->getParamsValues();
     if ($name == 'hasValue') {
         return $this->_subfieldValues[0]->getValue() ? true : false;
     }
     //oembed values : first, get size parameters
     @(list($width, $height) = explode(',', str_replace(';', ',', $parameters)));
     if (!io::isPositiveInteger($width)) {
         $width = '';
     }
     if (!io::isPositiveInteger($height)) {
         $height = '';
     }
     //load oembed object
     if (in_array($name, array('html', 'width', 'height'))) {
         //size specific values : get oembed object at queried size
         if (!isset($this->_oembedObjects[$width . '-' . $height])) {
             $this->_oembedObjects[$width . '-' . $height] = new CMS_oembed($this->_subfieldValues[0]->getValue(), $width, $height, $params['embedlyKey']);
         }
         $oembed = $this->_oembedObjects[$width . '-' . $height];
     } else {
         if ($this->_oembedObjects) {
             //load current oembed object
             $oembed = current($this->_oembedObjects);
         } else {
             $this->_oembedObjects[$width . '-' . $height] = new CMS_oembed($this->_subfieldValues[0]->getValue(), $width, $height, $params['embedlyKey']);
             $oembed = $this->_oembedObjects[$width . '-' . $height];
         }
     }
     if (!$oembed->hasProvider()) {
         return '';
     }
     if ($name == 'authorName') {
         $name = 'author_name';
     }
     if ($name == 'authorUrl') {
         $name = 'author_url';
     }
     if ($name == 'authorName') {
         $name = 'author_name';
     }
     if ($name == 'providerUrl') {
         $name = 'provider_url';
     }
     switch ($name) {
         case 'html':
             return $oembed->getHTML(array('class' => 'atm-embed'));
             break;
         case 'thumb':
             return $oembed->getThumbnail(array('class' => 'atm-thumb-embed'));
             break;
         case 'providerName':
             return io::htmlspecialchars($oembed->getProviderName());
             break;
         case 'url':
             return $this->_subfieldValues[0]->getValue();
             break;
         case 'datas':
             return $oembed->getDatas();
             break;
         default:
             return io::htmlspecialchars($oembed->getData($name));
             break;
     }
 }
 /**
  * Return the needed form field tag for current object field
  *
  * @param array $values : parameters values array(parameterName => parameterValue) in :
  *     id : the form field id to set
  * @param multidimentionnal array $tags : xml2Array content of atm-function tag
  * @return string : the form field HTML tag
  * @access public
  */
 function getInput($fieldID, $language, $inputParams)
 {
     //hidden field : use parent method
     if (isset($inputParams['hidden']) && ($inputParams['hidden'] == 'true' || $inputParams['hidden'] == 1)) {
         return parent::getInput($fieldID, $language, $inputParams);
     }
     if (isset($inputParams['prefix'])) {
         $prefixName = $inputParams['prefix'];
         unset($inputParams['prefix']);
     } else {
         $prefixName = '';
     }
     $params = $this->getParamsValues();
     //serialize all htmlparameters
     $htmlParameters = $this->serializeHTMLParameters($inputParams);
     $html = '';
     //create fieldname
     $fieldName = $prefixName . $this->_field->getID() . '_0';
     //append field id to html field parameters (if not already exists)
     $htmlParameters .= !isset($inputParams['id']) ? ' id="' . $prefixName . $this->_field->getID() . '_0"' : '';
     //create field value
     $value = isset($inputParams['value']) ? $inputParams['value'] : $this->_subfieldValues[0]->getValue();
     //then create field HTML
     $html .= $html ? '<br />' : '';
     $checked = $value ? 'checked="checked"' : '';
     $html .= '<input ' . $htmlParameters . ' ' . $checked . ' type="checkbox" name="' . $fieldName . '" value="1" />' . "\n";
     if (POLYMOD_DEBUG) {
         $html .= ' <span class="admin_text_alert">(Field : ' . $this->_field->getID() . ' - SubField : 0)</span>';
     }
     //append html hidden field which store field name
     if ($html) {
         $html .= '<input type="hidden" name="polymodFields[' . $this->_field->getID() . ']" value="' . $this->_field->getID() . '" />';
     }
     return $html;
 }
Exemple #3
0
 /**
  * get labels for object structure and functions
  *
  * @return array : the labels of object structure and functions
  * @access public
  */
 function getLabelsStructure(&$language)
 {
     $labels = parent::getLabelsStructure($language);
     unset($labels['structure']['value']);
     $labels['structure']['validhref'] = $language->getMessage(self::MESSAGE_OBJECT_HREF_VALIDHREF_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['hrefvalue'] = $language->getMessage(self::MESSAGE_OBJECT_HREF_HREFVALUE_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['hreflabel'] = $language->getMessage(self::MESSAGE_OBJECT_HREF_HREFLABEL_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['hreftarget'] = $language->getMessage(self::MESSAGE_OBJECT_HREF_HREFTARGET_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['hreftype'] = $language->getMessage(self::MESSAGE_OBJECT_HREF_HREFTYPE_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['popupWidth'] = $language->getMessage(self::MESSAGE_OBJECT_HREF_POPUPWIDTH_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['popupHeight'] = $language->getMessage(self::MESSAGE_OBJECT_HREF_POPUPHEIGHT_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['hrefHTML'] = $language->getMessage(self::MESSAGE_OBJECT_HREF_HREFHTML_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     return $labels;
 }
 /**
  * get labels for object structure and functions
  *
  * @return array : the labels of object structure and functions
  * @access public
  */
 function getLabelsStructure(&$language, $objectName)
 {
     $labels = parent::getLabelsStructure($language);
     $params = $this->getParamsValues();
     unset($labels['structure']['value']);
     if ($params['multiUserGroup']) {
         unset($labels['structure']['label']);
         unset($labels['structure']['value']);
         $labels['structure']['count'] = $language->getMessage(self::MESSAGE_OBJECT_USERGROUP_COUNT_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
         $labels['structure']['ids'] = $language->getMessage(self::MESSAGE_OBJECT_USERGROUP_IDS_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
         $labels['structure']['values'] = $language->getMessage(self::MESSAGE_OBJECT_USERGROUP_VALUES_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
         $labels['structure']['values:id'] = $language->getMessage(self::MESSAGE_OBJECT_USERGROUP_VALUESID_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
         $labels['structure']['values:label'] = $language->getMessage(self::MESSAGE_OBJECT_USERGROUP_VALUESLABEL_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
         if (!$params['isGroup']) {
             $labels['structure']['values:email'] = $language->getMessage(self::MESSAGE_OBJECT_USERGROUP_VALUESEMAIL_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
         }
     } else {
         $labels['structure']['id'] = $language->getMessage(self::MESSAGE_OBJECT_USERGROUP_ID_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
         $labels['structure']['label'] = $language->getMessage(self::MESSAGE_OBJECT_USERGROUP_LABEL_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
         if (!$params['isGroup']) {
             $labels['structure']['email'] = $language->getMessage(self::MESSAGE_OBJECT_USERGROUP_EMAIL_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
         }
     }
     $labels['function']['selectOptions'] = $language->getMessage(self::MESSAGE_OBJECT_USERGROUP_FUNCTION_SELECTEDOPTIONS_DESCRIPTION, array('{' . $objectName . '}'), MOD_POLYMOD_CODENAME);
     return $labels;
 }
Exemple #5
0
 /**
  * Get field parameters as an array structure used for export
  *
  * @return array : the object array structure
  * @access public
  */
 public function asArray()
 {
     $aParameters = parent::asArray();
     $moduleCodename = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID());
     $module = CMS_modulesCatalog::getByCodename($moduleCodename);
     //convert definitions
     $aParameters['emailSubject'] = $module->convertDefinitionString($aParameters['emailSubject'], true);
     $aParameters['emailBody']['html'] = $module->convertDefinitionString($aParameters['emailBody']['html'], true);
     $aParameters['emailBody']['pageURL'] = $module->convertDefinitionString($aParameters['emailBody']['pageURL'], true);
     return $aParameters;
 }
Exemple #6
0
    /**
     * Return the needed form field tag for current object field
     *
     * @param array $values : parameters values array(parameterName => parameterValue) in :
     *     id : the form field id to set
     * @param multidimentionnal array $tags : xml2Array content of atm-function tag
     * @return string : the form field HTML tag
     * @access public
     */
    function getInput($fieldID, $language, $inputParams)
    {
        if (isset($this->_objectValues[$fieldID])) {
            if (is_a($this->_objectValues[$fieldID], 'CMS_poly_object')) {
                if (isset($inputParams['prefix'])) {
                    $prefixName = $inputParams['prefix'];
                    unset($inputParams['prefix']);
                } else {
                    $prefixName = '';
                }
                //serialize all htmlparameters
                $htmlParameters = CMS_object_common::serializeHTMLParameters($inputParams);
                $html = '';
                //get searched objects conditions
                $searchedObjects = is_array($this->_objectFieldsDefinition[$fieldID]->getParameter('searchedObjects')) ? $this->_objectFieldsDefinition[$fieldID]->getParameter('searchedObjects') : array();
                $objectsNames = CMS_poly_object_catalog::getListOfNamesForObject($this->_objectValues[$fieldID]->getObjectID(), false, $searchedObjects);
                if (is_array($objectsNames) && $objectsNames) {
                    //append field id to html field parameters (if not already exists)
                    $htmlParameters .= !isset($inputParams['id']) ? ' id="' . $prefixName . $this->_objectFieldsDefinition[$fieldID]->getID() . '_0"' : '';
                    if (isset($inputParams['hidden']) && ($inputParams['hidden'] == 'true' || $inputParams['hidden'] == 1)) {
                        //create field value
                        $value = isset($inputParams['value']) ? $inputParams['value'] : $this->_polyObjectValues[$fieldID]->getValue();
                        $html .= '<input type="hidden"' . $htmlParameters . ' name="' . $prefixName . $this->_objectFieldsDefinition[$fieldID]->getID() . '_0" value="' . $value . '" />' . "\n";
                    } else {
                        $html .= '<select name="' . $prefixName . $this->_objectFieldsDefinition[$fieldID]->getID() . '_0"' . $htmlParameters . '>
									<option value="0">' . $language->getMessage(self::MESSAGE_POLYMOD_CHOOSE_OBJECT) . '</option>';
                        foreach ($objectsNames as $objectID => $objectName) {
                            $selected = is_object($this->_polyObjectValues[$fieldID]) && $this->_polyObjectValues[$fieldID]->getValue() == $objectID || $inputParams['defaultvalue'] == $objectID && (!is_object($this->_polyObjectValues[$fieldID]) || !$this->_polyObjectValues[$fieldID]->getValue()) ? ' selected="selected"' : '';
                            $html .= '<option value="' . $objectID . '"' . $selected . '>' . io::htmlspecialchars(io::decodeEntities($objectName)) . '</option>' . "\n";
                        }
                        $html .= '</select>';
                    }
                    if (POLYMOD_DEBUG) {
                        $html .= '<span class="admin_text_alert"> (Field : ' . $fieldID . ' - Value : ' . $this->_polyObjectValues[$fieldID]->getValue() . ' - objectID : ' . $this->_objectValues[$fieldID]->getObjectID() . ')</span>';
                    }
                } else {
                    $html .= $language->getMessage(self::MESSAGE_POLYMOD_EMPTY_OBJECTS_SET);
                }
                //append html hidden field which store field name
                if ($html) {
                    $html .= '<input type="hidden" name="polymodFields[' . $this->_objectFieldsDefinition[$fieldID]->getID() . ']" value="' . $this->_objectFieldsDefinition[$fieldID]->getID() . '" />';
                }
                return $html;
            } elseif (is_object($this->_objectValues[$fieldID])) {
                //return html for other type of objects fields
                return $this->_objectValues[$fieldID]->getInput($fieldID, $language, $inputParams);
            }
        }
        return '';
    }
Exemple #7
0
 /**
  * Get field search SQL request (used by class CMS_object_search)
  *
  * @param integer $fieldID : this field id in object (aka $this->_field->getID())
  * @param mixed $value : the value to search
  * @param string $operator : additionnal search operator
  * @param string $where : where clauses to add to SQL
  * @param boolean $public : values are public or edited ? (default is edited)
  * @return string : the SQL request
  * @access public
  */
 function getFieldSearchSQL($fieldID, $value, $operator, $where, $public = false)
 {
     $supportedOperator = array('like', '!=', '=', 'any', 'all', 'phrase', 'beginswith');
     $supportedOperatorForArray = array('in', 'not in', 'any', 'all');
     // No operator : use default search
     if (!$operator) {
         return parent::getFieldSearchSQL($fieldID, $value, $operator, $where, $public);
     }
     // Check supported operators
     if ($operator && !in_array($operator, array_merge($supportedOperator, $supportedOperatorForArray))) {
         $this->raiseError("Unknown search operator : " . $operator . ", use default search instead");
         $operator = false;
     }
     // Check operators for array value
     if (is_array($value) && $operator && !in_array($operator, $supportedOperatorForArray)) {
         $this->raiseError("Can't use this operator : " . $operator . " with an array value, return empty sql");
         return '';
     }
     $statusSuffix = $public ? "_public" : "_edited";
     $cleanedWords = array();
     if (is_array($value)) {
         if ($operator == 'any' || $operator == 'all') {
             // in this case, we do a specific cleanup
             foreach ($value as $i => $val) {
                 $cleanedWords[] = str_replace(array('%', '_'), array('\\%', '\\_'), $val);
             }
         } else {
             foreach ($value as $i => $val) {
                 $value[$i] = "'" . SensitiveIO::sanitizeSQLString($val) . "'";
             }
             $value = '(' . implode(',', $value) . ')';
         }
     } elseif (strtolower($value) == 'null') {
         $value = "''";
     } else {
         if ($operator == 'any' || $operator == 'all') {
             $words = array();
             $words = array_map("trim", array_unique(explode(" ", $value)));
             foreach ($words as $aWord) {
                 if ($aWord && $aWord != '' && io::strlen($aWord) >= 3) {
                     $aWord = str_replace(array('%', '_'), array('\\%', '\\_'), $aWord);
                     $cleanedWords[] = $aWord;
                 }
             }
         } elseif ($operator != 'phrase' && $operator != 'beginswith') {
             // we keep this for backward compatibility, where the user can specify his search with % at the beginning / end
             $value = "'" . SensitiveIO::sanitizeSQLString($value) . "'";
         }
     }
     $whereClause = '';
     switch ($operator) {
         case 'any':
             $whereClause .= '(';
             //then add keywords
             $count = '0';
             foreach ($cleanedWords as $aWord) {
                 $whereClause .= $count ? ' or ' : '';
                 $count++;
                 $whereClause .= "value like '%" . $aWord . "%'";
                 if (htmlentities($aWord) != $aWord) {
                     $whereClause .= " or value like '%" . htmlentities($aWord) . "%'";
                 }
             }
             $whereClause .= ')';
             break;
         case 'all':
             $whereClause .= '(';
             //then add keywords
             $count = '0';
             foreach ($cleanedWords as $aWord) {
                 $whereClause .= $count ? ' and ' : '';
                 $count++;
                 if (htmlentities($aWord) != $aWord) {
                     $whereClause .= "(value like '%" . $aWord . "%' or value like '%" . htmlentities($aWord) . "%')";
                 } else {
                     $whereClause .= "value like '%" . $aWord . "%'";
                 }
             }
             $whereClause .= ')';
             break;
         case 'phrase':
             $value = str_replace(array('%', '_'), array('\\%', '\\_'), trim($value));
             if (htmlentities($value) != $value) {
                 $whereClause .= "(value like '%" . $value . "%' or value like '%" . htmlentities($value) . "%')";
             } else {
                 $whereClause .= "value like '%" . $value . "%'";
             }
             break;
         case 'beginswith':
             $value = str_replace(array('%', '_'), array('\\%', '\\_'), trim($value));
             if (htmlentities($value) != $value) {
                 $whereClause .= "(value like '" . $value . "%' or value like '" . htmlentities($value) . "%')";
             } else {
                 $whereClause .= "value like '" . $value . "%'";
             }
             break;
         default:
             $whereClause .= " value " . $operator . " " . $value;
             break;
     }
     $sql = "\n\t\t\tselect\n\t\t\t\tdistinct objectID\n\t\t\tfrom\n\t\t\t\tmod_subobject_text" . $statusSuffix . "\n\t\t\twhere\n\t\t\t\tobjectFieldID = '" . SensitiveIO::sanitizeSQLString($fieldID) . "'\n\t\t\t\tand " . $whereClause . "\n\t\t\t\t{$where}";
     return $sql;
 }
Exemple #8
0
 /**
  * get labels for object structure and functions
  *
  * @return array : the labels of object structure and functions
  * @access public
  */
 function getLabelsStructure(&$language)
 {
     $labels = parent::getLabelsStructure($language);
     unset($labels['structure']['value']);
     $labels['structure']['image|width,height'] = $language->getMessage(self::MESSAGE_OBJECT_IMAGE_IMAGE_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['imageZoom|width,height'] = $language->getMessage(self::MESSAGE_OBJECT_IMAGE_IMAGEZOOM_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['imageHTML'] = $language->getMessage(self::MESSAGE_OBJECT_IMAGE_IMAGEHTML_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['imageLabel'] = $language->getMessage(self::MESSAGE_OBJECT_IMAGE_IMAGELABEL_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['imageName'] = $language->getMessage(self::MESSAGE_OBJECT_IMAGE_IMAGENAME_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['imageZoomName'] = $language->getMessage(self::MESSAGE_OBJECT_IMAGE_IMAGEZOOMNAME_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['imagePath'] = $language->getMessage(self::MESSAGE_OBJECT_IMAGE_IMAGEPATH_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['imageMaxWidth'] = $language->getMessage(self::MESSAGE_OBJECT_IMAGE_IMAGEMAXWIDTH_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['imageMaxheight'] = $language->getMessage(self::MESSAGE_OBJECT_IMAGE_IMAGEMAXHEIGHT_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['imageWidth'] = $language->getMessage(self::MESSAGE_OBJECT_IMAGE_IMAGEWIDTH_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['imageHeight'] = $language->getMessage(self::MESSAGE_OBJECT_IMAGE_IMAGEHEIGHT_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['imageZoomWidth'] = $language->getMessage(self::MESSAGE_OBJECT_IMAGE_IMAGEZOOMWIDTH_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['imageZoomHeight'] = $language->getMessage(self::MESSAGE_OBJECT_IMAGE_IMAGEZOOMHEIGHT_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['imageSize'] = $language->getMessage(self::MESSAGE_OBJECT_IMAGE_IMAGESIZE_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['imageZoomSize'] = $language->getMessage(self::MESSAGE_OBJECT_IMAGE_IMAGEZOOMSIZE_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['alternativeDomain'] = $language->getMessage(self::MESSAGE_OBJECT_IMAGE_PARAMETER_ALTERNATIVE_DOMAIN, false, MOD_POLYMOD_CODENAME);
     return $labels;
 }
 /**
  * Treat fields parameters to import
  *
  * @param array $params The import parameters.
  *		array(
  *				create	=> false|true : create missing objects (default : true)
  *				update	=> false|true : update existing objects (default : true)
  *				files	=> false|true : use files from PATH_TMP_FS (default : true)
  *			)
  * @param CMS_language $cms_language The CMS_langage to use
  * @param array $idsRelation : Reference : The relations between import datas ids and real imported ids
  * @param string $infos : Reference : The import infos returned
  * @return array : the treated parameters
  * @access public
  */
 function importParams($params, $cms_language, &$idsRelation, &$infos)
 {
     //here we need to convert categories ids used in parameters
     $params = parent::treatParams($params, '');
     //then try to convert categories ids if needed
     if (isset($params['rootCategory']) && $params['rootCategory'] && isset($idsRelation['categories'][$params['rootCategory']])) {
         $params['rootCategory'] = $idsRelation['categories'][$params['rootCategory']];
     }
     if (isset($params['defaultValue']) && $params['defaultValue'] && isset($idsRelation['categories'][$params['defaultValue']])) {
         $params['defaultValue'] = $idsRelation['categories'][$params['defaultValue']];
     }
     return $params;
 }
 /**
  * get labels for object structure and functions
  *
  * @return array : the labels of object structure and functions
  * @access public
  */
 function getLabelsStructure(&$language)
 {
     $labels = parent::getLabelsStructure($language);
     $params = $this->getParamsValues();
     unset($labels['structure']['value']);
     $labels['structure']['longitude'] = $language->getMessage(self::MESSAGE_OBJECT_COORDINATES_LONGITUDE_DESCRIPTION, false, $this->_messagesModule);
     $labels['structure']['latitude'] = $language->getMessage(self::MESSAGE_OBJECT_COORDINATES_LATITUDE_DESCRIPTION, false, $this->_messagesModule);
     return $labels;
 }
Exemple #11
0
 /**
  * get labels for object structure and functions
  *
  * @return array : the labels of object structure and functions
  * @access public
  */
 function getLabelsStructure(&$language)
 {
     $labels = parent::getLabelsStructure($language);
     unset($labels['structure']['value']);
     $labels['structure']['file|width,height'] = $language->getMessage(self::MESSAGE_OBJECT_FILE_FILE_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['thumb|width,height'] = $language->getMessage(self::MESSAGE_OBJECT_FILE_THUMB_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['fileHTML'] = $language->getMessage(self::MESSAGE_OBJECT_FILE_FILEHTML_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['fileLabel'] = $language->getMessage(self::MESSAGE_OBJECT_FILE_FILELABEL_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['filename'] = $language->getMessage(self::MESSAGE_OBJECT_FILE_FILENAME_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['thumbname'] = $language->getMessage(self::MESSAGE_OBJECT_FILE_FILETHUMBNAME_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['filePath'] = $language->getMessage(self::MESSAGE_OBJECT_FILE_FILEPATH_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['thumbWidth'] = $language->getMessage(self::MESSAGE_OBJECT_FILE_THUMBWIDTH_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['thumbHeight'] = $language->getMessage(self::MESSAGE_OBJECT_FILE_THUMBHEIGHT_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['imageWidth'] = $language->getMessage(self::MESSAGE_OBJECT_FILE_IMAGEWIDTH_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['imageHeight'] = $language->getMessage(self::MESSAGE_OBJECT_FILE_IMAGEHEIGHT_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['thumbMaxWidth'] = $language->getMessage(self::MESSAGE_OBJECT_FILE_IMAGEMAXWIDTH_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['thumbMaxheight'] = $language->getMessage(self::MESSAGE_OBJECT_FILE_IMAGEMAXHEIGHT_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['fileSize'] = $language->getMessage(self::MESSAGE_OBJECT_FILE_FILESIZE_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['fileIcon'] = $language->getMessage(self::MESSAGE_OBJECT_FILE_FILEICON_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['fileExtension'] = $language->getMessage(self::MESSAGE_OBJECT_FILE_FILEEXTENTION_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['thumbExtension'] = $language->getMessage(self::MESSAGE_OBJECT_FILE_THUMBEXTENTION_DESCRIPTION, false, MOD_POLYMOD_CODENAME);
     $labels['structure']['alternativeDomain'] = $language->getMessage(self::MESSAGE_OBJECT_FILE_PARAMETER_ALTERNATIVE_DOMAIN, false, MOD_POLYMOD_CODENAME);
     return $labels;
 }
 /**
  * get labels for object structure and functions
  *
  * @return array : the labels of object structure and functions
  * @access public
  */
 function getLabelsStructure(&$language, $objectName)
 {
     $labels = parent::getLabelsStructure($language);
     $labels['function']['selectOptions'] = $language->getMessage(self::MESSAGE_OBJECT_LANGUAGE_FUNCTION_SELECTEDOPTIONS_DESCRIPTION, array('{' . $objectName . '}'), MOD_POLYMOD_CODENAME);
     return $labels;
 }
 /**
  * Get field search SQL request (used by class CMS_object_search)
  *
  * @param integer $fieldID : this field id in object (aka $this->_field->getID())
  * @param mixed $value : the value to search
  * @param string $operator : additionnal search operator
  * @param string $where : where clauses to add to SQL
  * @param boolean $public : values are public or edited ? (default is edited)
  * @return string : the SQL request
  * @access public
  */
 function getFieldSearchSQL($fieldID, $value, $operator, $where, $public = false)
 {
     $supportedOperator = array('<', '<=', '>', '>=');
     if ($operator && !in_array($operator, $supportedOperator)) {
         $this->_raiseError(get_class($this) . " : getFieldSearchSQL : unkown search operator : " . $operator . ", use default search instead");
         $operator = false;
     }
     if (!$operator) {
         return parent::getFieldSearchSQL($fieldID, $value, $operator, $where, $public);
     }
     $statusSuffix = $public ? "_public" : "_edited";
     $sql = "\n\t\t\tselect\n\t\t\t\tdistinct objectID\n\t\t\tfrom\n\t\t\t\tmod_subobject_integer" . $statusSuffix . "\n\t\t\twhere\n\t\t\t\tobjectFieldID = '" . SensitiveIO::sanitizeSQLString($fieldID) . "'\n\t\t\t\tand value " . $operator . " '" . SensitiveIO::sanitizeSQLString($value) . "'\n\t\t\t\t{$where}";
     return $sql;
 }
Exemple #14
0
 /**
  * set object Values
  *
  * @param array $values : the POST result values
  * @param string $prefixname : the prefix used for post names
  * @return boolean true on success, false on failure
  * @access public
  */
 function writeToPersistence()
 {
     $params = $this->getParamsValues();
     $date = new CMS_date();
     if ($this->_subfieldValues[0]->getValue()) {
         $date->setFromDBValue($this->_subfieldValues[0]->getValue());
     }
     if ($params['updateDate'] || $date->isNull() && ($params['setNow'] || $params['creationDate'])) {
         $date->setNow();
         if ($params['moveDate']) {
             $date->moveDate($params['moveDate']);
         }
         if (!$this->_subfieldValues[0]->setValue($date->getDBValue())) {
             return false;
         }
     }
     return parent::writeToPersistence();
 }