/** * 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 = ''; //instanciate sending date object $sendingDate = new CMS_date(); $sendingDate->setFromDBValue($this->_subfieldValues[1]->getValue()); //append field id to html field parameters (if not already exists) $htmlParameters .= !isset($inputParams['id']) ? ' id="' . $prefixName . $this->_field->getID() . '_0"' : ''; if ($params['chooseSendEmail']) { $checked = $this->_subfieldValues[0]->getValue() == '1' ? 'checked="checked"' : ''; $html .= ' <input' . $htmlParameters . ' type="checkbox" ' . $checked . ' name="' . $prefixName . $this->_field->getID() . '_0" value="1" /> <input type="hidden" name="' . $prefixName . $this->_field->getID() . '_1" value="' . $sendingDate->getLocalizedDate($language->getDateFormat()) . '" /> <input type="hidden" name="' . $prefixName . $this->_field->getID() . '_2" value="0" />'; } else { $html .= ' <input type="hidden" name="' . $prefixName . $this->_field->getID() . '_0" value="1" /> <input type="hidden" name="' . $prefixName . $this->_field->getID() . '_1" value="' . $sendingDate->getLocalizedDate($language->getDateFormat()) . '" /> <input type="hidden" name="' . $prefixName . $this->_field->getID() . '_2" value="0" />'; } //append html hidden field which store field name if ($html) { $html .= '<input type="hidden" name="polymodFields[' . $this->_field->getID() . ']" value="' . $this->_field->getID() . '" />'; } if (POLYMOD_DEBUG) { $html .= '<span class="admin_text_alert"> (Field : ' . $fieldID . ' - Value : ' . $this->_subfieldValues[0]->getValue() . ' - ' . $this->_subfieldValues[1]->getValue() . ')</span>'; } return $html; }
/** * 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; }
/** * 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); } global $cms_user; $params = $this->getParamsValues(); if (isset($inputParams['prefix'])) { $prefixName = $inputParams['prefix']; } else { $prefixName = ''; } //serialize all htmlparameters //$htmlParameters = $this->serializeHTMLParameters($inputParams); $html = ''; //create fieldname $fieldName = $prefixName . $this->_field->getID() . '_0'; //create field value $value = $this->_subfieldValues[0]->getValue(); if ($params['html']) { // Insert prefered text editor for textarea field $module = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID()); $toolbarset = !$params['toolbar'] ? $module : $params['toolbar']; if (class_exists('CMS_wysiwyg_toolbar')) { $toolbar = CMS_wysiwyg_toolbar::getByCode($toolbarset, $cms_user); $value = $toolbar->hasModulePlugins() ? CMS_textEditor::parseInnerContent($value, $module) : $value; } $CKEditor = new CKEditor(PATH_MAIN_WR . '/ckeditor/'); $CKEditor->returnOutput = true; $html .= $CKEditor->editor($fieldName, $value, array('language' => $language->getCode(), 'width' => $params['toolbarWidth'] ? $params['toolbarWidth'] : '100%', 'height' => sensitiveIO::isPositiveInteger($params['toolbarHeight']) ? $params['toolbarHeight'] : 200, 'customConfig' => PATH_MAIN_WR . '/ckeditor/config.php?toolbar=' . $toolbarset)); } else { //serialize all htmlparameters $htmlParameters = $this->serializeHTMLParameters($inputParams); //append field id to html field parameters (if not already exists) $htmlParameters .= !isset($inputParams['id']) ? ' id="' . $prefixName . $this->_field->getID() . '_0"' : ''; $width = '100%'; if ($params['toolbarWidth']) { $width = io::substr($params['toolbarWidth'], -1, 1) == '%' ? $params['toolbarWidth'] : $params['toolbarWidth'] . 'px'; } $html .= '<textarea type="text" name="' . $fieldName . '"' . $htmlParameters . ' style="width:' . $width . ';height:' . (sensitiveIO::isPositiveInteger($params['toolbarHeight']) ? $params['toolbarHeight'] : 200) . 'px">' . str_replace('<br />', "\n", str_replace(array("\n", "\r"), "", $value)) . '</textarea>' . "\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; }
/** * 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); } $params = $this->getParamsValues(); if (isset($inputParams['prefix'])) { $prefixName = $inputParams['prefix']; } else { $prefixName = ''; } //serialize all htmlparameters $htmlParameters = $this->serializeHTMLParameters($inputParams); $tdclass = isset($inputParams['tdclass']) ? ' class="' . $inputParams['tdclass'] . '"' : ''; $thclass = isset($inputParams['thclass']) ? ' class="' . $inputParams['thclass'] . '"' : ''; $rowspan = $params['makeZoom'] ? 2 : 1; $mandatoryTtitle = isset($params['legendMandatory']) && $params['legendMandatory'] ? '<span class="atm-red">*</span> ' : ''; $html = ' <table> <tr> <th' . $thclass . '>' . $mandatoryTtitle . $language->getMessage(self::MESSAGE_OBJECT_IMAGE_FIELD_LABEL, false, MOD_POLYMOD_CODENAME) . '</th> <td' . $tdclass . '><input' . $htmlParameters . ' name="' . $prefixName . $this->_field->getID() . '_1" value="' . $this->_subfieldValues[1]->getValue() . '" type="text" /></td> </tr> <tr> <th' . $thclass . ' rowspan="' . $rowspan . '">' . $language->getMessage(self::MESSAGE_OBJECT_IMAGE_FIELD_THUMBNAIL, false, MOD_POLYMOD_CODENAME) . '</th> <td' . $tdclass . '><input' . $htmlParameters . ' name="' . $prefixName . $this->_field->getID() . '_0" type="file" />'; if ($params['maxWidth'] > 0 && !$params['maxHeight']) { $html .= ' <small>' . $language->getMessage(self::MESSAGE_OBJECT_IMAGE_FIELD_DESC, array($params['maxWidth']), MOD_POLYMOD_CODENAME) . '</small>'; } elseif ($params['maxHeight'] && !$params['maxWidth']) { $html .= ' <small>' . $language->getMessage(self::MESSAGE_OBJECT_IMAGE_FIELD_DESC_HEIGHT, array($params['maxHeight']), MOD_POLYMOD_CODENAME) . '</small>'; } elseif ($params['maxWidth'] && $params['maxHeight']) { $html .= ' <small>' . $language->getMessage(self::MESSAGE_OBJECT_IMAGE_FIELD_DESC_HEIGHT_AND_WIDTH, array($params['maxWidth'], $params['maxHeight']), MOD_POLYMOD_CODENAME) . '</small>'; } $html .= '</td> </tr>'; if ($params['makeZoom']) { $checked = !$params['useDistinctZoom'] ? ' checked="checked"' : ''; $html .= ' <tr> <td' . $tdclass . '><label for="' . $prefixName . $this->_field->getID() . '_makeZoom"><input name="' . $prefixName . $this->_field->getID() . '_makeZoom" id="' . $prefixName . $this->_field->getID() . '_makeZoom" type="checkbox"' . $checked . ' value="1" />' . $language->getMessage(self::MESSAGE_OBJECT_IMAGE_FIELD_USE_ORIGINAL_AS_ZOOM, false, MOD_POLYMOD_CODENAME) . '</label></td> </tr>'; } if ($params['useDistinctZoom']) { $html .= ' <tr> <th' . $thclass . '>' . $language->getMessage(self::MESSAGE_OBJECT_IMAGE_FIELD_ZOOM, false, MOD_POLYMOD_CODENAME) . '</th> <td' . $tdclass . '><input' . $htmlParameters . ' name="' . $prefixName . $this->_field->getID() . '_2" type="file" /> <small>' . $language->getMessage(self::MESSAGE_OBJECT_IMAGE_FIELD_MAX_FILESIZE, array(ini_get("upload_max_filesize")), MOD_POLYMOD_CODENAME) . '</small></td> </tr>'; } //current image if ($this->_subfieldValues[0]->getValue()) { //get module codename $moduleCodename = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID()); $img = '<img src="' . PATH_MODULES_FILES_WR . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $this->_subfieldValues[0]->getValue() . '" border="0" alt="' . $this->_subfieldValues[1]->getValue() . '" title="' . $this->_subfieldValues[1]->getValue() . '" />'; if ($this->_subfieldValues[2]->getValue()) { $href = CMS_websitesCatalog::getCurrentDomain() . PATH_REALROOT_WR . "/" . self::OBJECT_IMAGE_POPUP_FILE . '?location=' . RESOURCE_DATA_LOCATION_EDITED . '&file=' . $this->_subfieldValues[2]->getValue() . '&label=' . urlencode($this->_subfieldValues[1]->getValue()) . '&module=' . $moduleCodename; $popup = OPEN_ZOOMIMAGE_IN_POPUP ? ' onclick="javascript:CMS_openPopUpImage(\'' . addslashes($href) . '\');return false;"' : ''; $img = '<a target="_blank" href="' . $href . '"' . $popup . ' title="' . $this->_subfieldValues[1]->getValue() . '">' . $img . '</a>'; } $html .= ' <tr> <th' . $thclass . '>' . $language->getMessage(self::MESSAGE_OBJECT_IMAGE_FIELD_ACTUAL_IMAGE, false, MOD_POLYMOD_CODENAME) . '</th> <td' . $tdclass . '>' . $img . ' <input type="hidden" name="' . $prefixName . $this->_field->getID() . '_0_hidden" value="' . $this->_subfieldValues[0]->getValue() . '" /> <input type="hidden" name="' . $prefixName . $this->_field->getID() . '_2_hidden" value="' . $this->_subfieldValues[2]->getValue() . '" /><br /> <label for="' . $prefixName . $this->_field->getID() . '_delete"><input name="' . $prefixName . $this->_field->getID() . '_delete" id="' . $prefixName . $this->_field->getID() . '_delete" type="checkbox" value="1" />' . $language->getMessage(self::MESSAGE_OBJECT_IMAGE_FIELD_DELETE, false, MOD_POLYMOD_CODENAME) . '</label> </td> </tr>'; } if (POLYMOD_DEBUG) { $html .= ' <tr> <td' . $tdclass . ' colspan="2"><span class="admin_text_alert">(Field : ' . $this->_field->getID() . ' - Image : ' . $this->_subfieldValues[0]->getValue() . ')</span></td> </tr>'; } $html .= ' </table>'; //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; }
/** * 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); } $params = $this->getParamsValues(); if (isset($inputParams['prefix'])) { $prefixName = $inputParams['prefix']; } else { $prefixName = ''; } //serialize all htmlparameters $htmlParameters = $this->serializeHTMLParameters($inputParams); $tdclass = isset($inputParams['tdclass']) ? ' class="' . $inputParams['tdclass'] . '"' : ''; $thclass = isset($inputParams['thclass']) ? ' class="' . $inputParams['thclass'] . '"' : ''; $html = ' <table> <tr> <th' . $thclass . '>' . $language->getMessage(self::MESSAGE_OBJECT_FILE_FIELD_LABEL, false, MOD_POLYMOD_CODENAME) . '</th> <td' . $tdclass . '><input' . $htmlParameters . ' name="' . $prefixName . $this->_field->getID() . '_0" value="' . $this->_subfieldValues[0]->getValue() . '" type="text" /></td> </tr>'; if ($params['useThumbnail']) { $html .= ' <tr> <th' . $thclass . '>' . $language->getMessage(self::MESSAGE_OBJECT_FILE_FIELD_THUMBNAIL, false, MOD_POLYMOD_CODENAME) . '</th> <td' . $tdclass . '><input' . $htmlParameters . ' name="' . $prefixName . $this->_field->getID() . '_1" type="file" />'; if ($params['thumbMaxWidth'] > 0 && !$params['thumbMaxHeight']) { $html .= ' <small>' . $language->getMessage(self::MESSAGE_OBJECT_FILE_FIELD_DESC, array($params['thumbMaxWidth']), MOD_POLYMOD_CODENAME) . '</small>'; } elseif ($params['thumbMaxHeight'] > 0 && !$params['thumbMaxWidth']) { $html .= ' <small>' . $language->getMessage(self::MESSAGE_OBJECT_IMAGE_FIELD_DESC_HEIGHT, array($params['thumbMaxHeight']), MOD_POLYMOD_CODENAME) . '</small>'; } elseif ($params['thumbMaxWidth'] && $params['thumbMaxHeight']) { $html .= ' <small>' . $language->getMessage(self::MESSAGE_OBJECT_IMAGE_FIELD_DESC_HEIGHT_AND_WIDTH, array($params['thumbMaxWidth'], $params['thumbMaxHeight']), MOD_POLYMOD_CODENAME) . '</small>'; } $html .= '</td> </tr>'; } $html .= ' <tr> <th' . $thclass . '>' . $language->getMessage(self::MESSAGE_OBJECT_FILE_FIELD_SOURCEFILE, false, MOD_POLYMOD_CODENAME) . '</th> <td' . $tdclass . '><input' . $htmlParameters . ' name="' . $prefixName . $this->_field->getID() . '_4" type="file" /> <small>' . $language->getMessage(self::MESSAGE_OBJECT_FILE_FIELD_MAX_FILESIZE, array(CMS_file::getMaxUploadFileSize('M') . 'M'), MOD_POLYMOD_CODENAME) . '</small></td> </tr>'; if ($params['allowFtp'] && is_dir(PATH_REALROOT_FS . $params['ftpDir'])) { $html .= ' <tr> <th' . $thclass . '>' . $language->getMessage(self::MESSAGE_OBJECT_FILE_FIELD_EXTERNALSOURCEFILE, false, MOD_POLYMOD_CODENAME) . '</th> <td' . $tdclass . '><input' . $htmlParameters . ' name="' . $prefixName . $this->_field->getID() . '_externalfile" type="text" /> <br /><small>' . $language->getMessage(self::MESSAGE_OBJECT_FILE_FIELD_EXTERNALSOURCEFILE_FTP, array($params['ftpDir']), MOD_POLYMOD_CODENAME) . '</small></td> </tr>'; } // If delete old file and no new file, set "delete" hidden input to mandatory check if ((!isset($_FILES[$prefixName . $this->_field->getID() . '_4']) || !$_FILES[$prefixName . $this->_field->getID() . '_4']['name']) && isset($_REQUEST[$prefixName . $this->_field->getID() . '_delete']) && $_REQUEST[$prefixName . $this->_field->getID() . '_delete']) { $html .= '<input name="' . $prefixName . $this->_field->getID() . '_delete" id="' . $prefixName . $this->_field->getID() . '_delete" type="hidden" value="1" />'; } //current file if ($this->_subfieldValues[4]->getValue()) { //get module codename $moduleCodename = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID()); $filepath = $this->_subfieldValues[3]->getValue() == self::OBJECT_FILE_TYPE_INTERNAL ? PATH_MODULES_FILES_WR . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $this->_subfieldValues[4]->getValue() : $this->_subfieldValues[4]->getValue(); $thumbnail = $this->_subfieldValues[1]->getValue() ? '<br /><a href="' . $filepath . '" target="_blank"><img src="' . PATH_MODULES_FILES_WR . '/' . $moduleCodename . '/' . RESOURCE_DATA_LOCATION_EDITED . '/' . $this->_subfieldValues[1]->getValue() . '" alt="' . $this->_subfieldValues[0]->getValue() . '" title="' . $this->_subfieldValues[0]->getValue() . '" border="0" /></a>' : ''; $icon = $this->_getFileIcon(); if ($icon) { $icon = '<img src="' . $icon . '" alt="' . $this->_getFileExtension() . '" title="' . $this->_getFileExtension() . '" border="0" /> '; } $file = '<a href="' . $filepath . '" target="_blank">' . $icon . $this->_subfieldValues[0]->getValue() . '</a> (' . $this->_subfieldValues[2]->getValue() . 'Mo)'; $html .= ' <tr> <th' . $thclass . '>' . $language->getMessage(self::MESSAGE_OBJECT_FILE_FIELD_ACTUAL_FILE, false, MOD_POLYMOD_CODENAME) . '</th> <td' . $tdclass . '>' . $file . ' <label for="' . $prefixName . $this->_field->getID() . '_delete"><input name="' . $prefixName . $this->_field->getID() . '_delete" id="' . $prefixName . $this->_field->getID() . '_delete" type="checkbox" value="1" />' . $language->getMessage(self::MESSAGE_OBJECT_FILE_FIELD_DELETE, false, MOD_POLYMOD_CODENAME) . '</label><br />' . $thumbnail . ' <input type="hidden" name="' . $prefixName . $this->_field->getID() . '_1_hidden" value="' . $this->_subfieldValues[1]->getValue() . '" /> <input type="hidden" name="' . $prefixName . $this->_field->getID() . '_2_hidden" value="' . $this->_subfieldValues[2]->getValue() . '" /> <input type="hidden" name="' . $prefixName . $this->_field->getID() . '_3_hidden" value="' . $this->_subfieldValues[3]->getValue() . '" /> <input type="hidden" name="' . $prefixName . $this->_field->getID() . '_4_hidden" value="' . $this->_subfieldValues[4]->getValue() . '" /> </td> </tr>'; } if (POLYMOD_DEBUG) { $html .= ' <tr> <td' . $tdclass . ' colspan="2"><span class="admin_text_alert">(Field : ' . $this->_field->getID() . ' <br />File : ' . $this->_subfieldValues[4]->getValue() . ' <br />Filesize : ' . $this->_subfieldValues[2]->getValue() . ' <br />Thumbnail : ' . $this->_subfieldValues[1]->getValue() . ' <br />DestinationType : ' . $this->_subfieldValues[3]->getValue() . ')</span></td> </tr>'; } $html .= '</table>'; //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; }
/** * 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); } $params = $this->getParamsValues(); if (isset($inputParams['prefix'])) { $prefixName = $inputParams['prefix']; } else { $prefixName = ''; } //serialize all htmlparameters $htmlParameters = $this->serializeHTMLParameters($inputParams); $html = ''; //get module $module = CMS_poly_object_catalog::getModuleCodenameForField($this->_field->getID()); // Get languages $a_all_languages = CMS_languagesCatalog::getAllLanguages($module); if (is_array($a_all_languages) && $a_all_languages) { // Hidden languages (from input param "hidden=fr,en,es") if (isset($inputParams['hidden'])) { $hiddenLanguageCodes = explode(',', $inputParams['hidden']); foreach ($hiddenLanguageCodes as $hiddenLanguageCode) { if (isset($a_all_languages[$hiddenLanguageCode])) { unset($a_all_languages[$hiddenLanguageCode]); } } } $html .= ' <select name="' . $prefixName . $this->_field->getID() . '_0"' . $htmlParameters . '> <option value="0">' . $language->getMessage(self::MESSAGE_OBJECT_LANGUAGE_CHOOSE_OBJECT) . '</option>'; foreach ($a_all_languages as $code => $aLanguage) { $selected = $this->_subfieldValues[0]->getValue() == $code ? ' selected="selected"' : ''; $html .= '<option value="' . $code . '"' . $selected . '>' . $aLanguage->getLabel() . '</option>'; } $html .= '</select>'; } else { $html .= $language->getMessage(self::MESSAGE_OBJECT_LANGUAGE_EMPTY_OBJECTS_SET); } if (POLYMOD_DEBUG) { $html .= '<span class="admin_text_alert"> (Field : ' . $fieldID . ' - Value : ' . $this->_subfieldValues[0]->getValue() . ')</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; }
/** * 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); } $params = $this->getParamsValues(); if (isset($inputParams['prefix'])) { $prefixName = $inputParams['prefix']; } else { $prefixName = ''; } //serialize all htmlparameters $htmlParameters = $this->serializeHTMLParameters($inputParams); $html = ''; //create fieldname $fieldName = $prefixName . $this->_field->getID() . '_0'; //create object CMS_date $date = new CMS_date(); $date->setFromDBValue($this->_subfieldValues[0]->getValue()); $wasNull = $date->isNull() ? true : false; if ($date->isNull() && ($params['setNow'] || $params['creationDate'])) { $date->setNow(); } if ($params['updateDate']) { $date->setNow(); } if ($params['moveDate'] && ($params['setNow'] && $wasNull || $params['creationDate'] && $wasNull || $params['updateDate'])) { $date->moveDate($params['moveDate']); } if (!$params['creationDate'] && !$params['updateDate']) { $html .= '<input type="text"' . $htmlParameters . ' id="' . $prefixName . $this->_field->getID() . '_0" name="' . $prefixName . $this->_field->getID() . '_0" value="' . $date->getLocalizedDate($language->getDateFormat()) . '" />'; if (isset($inputParams['calendar']) && $inputParams['calendar']) { $html .= ' <img src="' . PATH_ADMIN_IMAGES_WR . '/calendar/calendar.gif" class="admin_input_submit_content" align="absmiddle" title="' . $language->getMessage(MESSAGE_PAGE_ACTION_DATE) . '" onclick="displayCalendar(document.getElementById(\'' . $prefixName . $this->_field->getID() . '_0\'),\'' . $language->getCode() . '\',this);return false;" />'; } } else { $html .= $date->getLocalizedDate($language->getDateFormat()) . ' <input type="hidden" id="' . $prefixName . $this->_field->getID() . '_0" name="' . $prefixName . $this->_field->getID() . '_0" value="' . $date->getLocalizedDate($language->getDateFormat()) . '" />'; } if ($params['withHMS']) { if (!$date->isNull()) { $hms = $date->getHour() . ':' . $date->getMinute() . ':' . $date->getSecond(); } if (!$params['creationDate'] && !$params['updateDate']) { $html .= ' <input type="text"' . $htmlParameters . ' id="' . $prefixName . $this->_field->getID() . '_1" name="' . $prefixName . $this->_field->getID() . '_1" value="' . $hms . '" /> <small>(' . $language->getMessage(self::MESSAGE_OBJECT_DATE_DATE_COMMENT, array($language->getMessage(self::MESSAGE_OBJECT_DATE_HMS_FORMAT, false, MOD_POLYMOD_CODENAME))) . ')</small>'; } else { $html .= ' ' . $hms . '<input type="hidden" id="' . $prefixName . $this->_field->getID() . '_1" name="' . $prefixName . $this->_field->getID() . '_1" value="' . $hms . '" />'; } } 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; }