当前位置: 首页>>代码示例>>PHP>>正文


PHP RSFormProHelper::getTranslatableProperties方法代码示例

本文整理汇总了PHP中RSFormProHelper::getTranslatableProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP RSFormProHelper::getTranslatableProperties方法的具体用法?PHP RSFormProHelper::getTranslatableProperties怎么用?PHP RSFormProHelper::getTranslatableProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RSFormProHelper的用法示例。


在下文中一共展示了RSFormProHelper::getTranslatableProperties方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getComponentFields

 function getComponentFields()
 {
     $db = JFactory::getDBO();
     $lang = JFactory::getLanguage();
     $return = array();
     $data = $this->getComponentData();
     $formId = JRequest::getInt('formId');
     $general = array('NAME', 'CAPTION', 'LABEL', 'DEFAULTVALUE', 'ITEMS', 'TEXT', 'DESCRIPTION', 'COMPONENTTYPE');
     $validations = array('REQUIRED', 'VALIDATIONRULE', 'VALIDATIONMESSAGE', 'VALIDATIONEXTRA');
     $componentId = $this->getComponentId();
     $componentType = $this->getComponentType();
     $results = $this->_getList("SELECT * FROM #__rsform_component_type_fields WHERE ComponentTypeId='" . $componentType . "' ORDER BY Ordering ASC");
     $translatable = RSFormProHelper::getTranslatableProperties();
     foreach ($results as $i => $result) {
         if ($result->FieldName == 'ADDITIONALATTRIBUTES') {
             $results[$i]->Ordering = 1001;
         }
     }
     usort($results, array('RSFormModelFormAjax', 'sortFields'));
     foreach ($results as $result) {
         $field = new stdClass();
         $field->name = $result->FieldName;
         $field->body = '';
         switch ($result->FieldType) {
             case 'textbox':
                 if ($lang->hasKey('RSFP_COMP_FIELD_' . $field->name)) {
                     $field->body = JText::_('RSFP_COMP_FIELD_' . $field->name);
                 } else {
                     $field->body = $field->name;
                 }
                 $field->body = '<span id="caption' . $field->name . '">' . $field->body . '</span>';
                 $field->body .= '<br/>';
                 if ($componentId > 0) {
                     $value = isset($data[$field->name]) ? $data[$field->name] : '';
                 } else {
                     $values = RSFormProHelper::isCode($result->FieldValues);
                     if ($lang->hasKey('RSFP_COMP_FVALUE_' . $values)) {
                         $value = JText::_('RSFP_COMP_FVALUE_' . $values);
                     } else {
                         $value = $values;
                     }
                 }
                 $additional = '';
                 if ($result->FieldName == 'FILESIZE') {
                     $additional = 'onkeyup="javascript:this.value=this.value.replace(/[^0-9]/g, \'\');"';
                 }
                 $field->body .= '<input type="text" id="' . $field->name . '" name="param[' . $field->name . ']" value="' . RSFormProHelper::htmlEscape($value) . '" ' . $additional . ' class="rsform_inp" />';
                 break;
             case 'textarea':
                 if ($lang->hasKey('RSFP_COMP_FIELD_' . $field->name)) {
                     $field->body = JText::_('RSFP_COMP_FIELD_' . $field->name);
                 } else {
                     $field->body = $field->name;
                 }
                 $field->body = '<span id="caption' . $field->name . '">' . $field->body . '</span>';
                 $field->body .= '<br />';
                 if ($componentId > 0) {
                     if (!isset($data[$field->name])) {
                         $data[$field->name] = '';
                     }
                     if ($lang->hasKey('RSFP_COMP_FVALUE_' . $data[$field->name])) {
                         $value = JText::_('RSFP_COMP_FVALUE_' . $data[$field->name]);
                     } else {
                         $value = $data[$field->name];
                     }
                 } else {
                     $values = RSFormProHelper::isCode($result->FieldValues);
                     if ($lang->hasKey('RSFP_COMP_FVALUE_' . $values)) {
                         $value = JText::_('RSFP_COMP_FVALUE_' . $values);
                     } else {
                         $value = $values;
                     }
                 }
                 $field->body .= '<textarea id="' . $field->name . '" name="param[' . $field->name . ']" rows="5" cols="20" class="rsform_txtarea">' . RSFormProHelper::htmlEscape($value) . '</textarea></td>';
                 break;
             case 'select':
                 if ($lang->hasKey('RSFP_COMP_FIELD_' . $field->name)) {
                     $field->body = JText::_('RSFP_COMP_FIELD_' . $field->name);
                 } else {
                     $field->body = $field->name;
                 }
                 $field->body = '<span id="caption' . $field->name . '">' . $field->body . '</span>';
                 $field->body .= '<br />';
                 $field->body .= '<select name="param[' . $field->name . ']" id="' . $field->name . '" onchange="changeValidation(this);">';
                 if (!isset($data[$field->name])) {
                     $data[$field->name] = '';
                 }
                 $result->FieldValues = str_replace("\r", '', $result->FieldValues);
                 $items = RSFormProHelper::isCode($result->FieldValues);
                 $items = explode("\n", $items);
                 foreach ($items as $item) {
                     $buf = explode('|', $item);
                     $option_value = $buf[0];
                     $option_shown = count($buf) == 1 ? $buf[0] : $buf[1];
                     if ($lang->hasKey('RSFP_COMP_FVALUE_' . $option_shown)) {
                         $label = JText::_('RSFP_COMP_FVALUE_' . $option_shown);
                     } else {
                         $label = $option_shown;
                     }
                     $field->body .= '<option ' . ($componentId > 0 && $data[$field->name] == $option_value ? 'selected="selected"' : '') . ' value="' . $option_value . '">' . RSFormProHelper::htmlEscape($label) . '</option>';
//.........这里部分代码省略.........
开发者ID:AlexanderKri,项目名称:joom-upd,代码行数:101,代码来源:formajax.php

示例2: saveFormPropertyTranslation

 function saveFormPropertyTranslation($formId, $componentId, &$params, $lang, $just_added)
 {
     $fields = RSFormProHelper::getTranslatableProperties();
     $translations = RSFormProHelper::getTranslations('properties', $formId, $lang, 'id');
     foreach ($fields as $field) {
         if (!isset($params[$field])) {
             continue;
         }
         $reference_id = $componentId . "." . $this->_db->escape($field);
         $query = array();
         $query[] = "`form_id`='" . $formId . "'";
         $query[] = "`lang_code`='" . $this->_db->escape($lang) . "'";
         $query[] = "`reference`='properties'";
         $query[] = "`reference_id`='" . $reference_id . "'";
         $query[] = "`value`='" . $params[$field] . "'";
         if (!isset($translations[$reference_id])) {
             $this->_db->setQuery("INSERT INTO #__rsform_translations SET " . implode(", ", $query));
             $this->_db->execute();
         } else {
             $this->_db->setQuery("UPDATE #__rsform_translations SET " . implode(", ", $query) . " WHERE id='" . (int) $translations[$reference_id] . "'");
             $this->_db->execute();
         }
         if (!$just_added) {
             unset($params[$field]);
         }
     }
 }
开发者ID:alvarovladimir,项目名称:messermeister_ab_rackservers,代码行数:27,代码来源:forms.php


注:本文中的RSFormProHelper::getTranslatableProperties方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。