Merge branch '1.11.x' of github.com:chamilo/chamilo-lms into 1.11.x

remotes/angel/1.11.x
Angel Fernando Quiroz Campos 8 years ago
commit 34ea1196ef
  1. 106
      main/inc/lib/extra_field.lib.php
  2. 4
      tests/scripts/build_translation_request_file.php

@ -282,7 +282,7 @@ class ExtraField extends Model
$result = Database::query($sql);
if (Database::num_rows($result)) {
$row = Database::fetch_array($result, 'ASSOC');
$row['display_text'] = ExtraField::translateDisplayName($row['variable'], $row['display_text']);
$row['display_text'] = self::translateDisplayName($row['variable'], $row['display_text']);
// All the options of the field
$sql = "SELECT * FROM $this->table_field_options
@ -315,7 +315,7 @@ class ExtraField extends Model
$result = Database::query($sql);
if (Database::num_rows($result)) {
$row = Database::fetch_array($result, 'ASSOC');
$row['display_text'] = ExtraField::translateDisplayName($row['variable'], $row['display_text']);
$row['display_text'] = self::translateDisplayName($row['variable'], $row['display_text']);
// All the tags of the field
$sql = "SELECT * FROM $this->table_field_tag
@ -521,7 +521,7 @@ class ExtraField extends Model
$field['id']
);
if ($field['field_type'] == ExtraField::FIELD_TYPE_TAG) {
if ($field['field_type'] == self::FIELD_TYPE_TAG) {
$tags = UserManager::get_user_tags_to_string($itemId, $field['id'], false);
$extra_data['extra_'.$field['variable']] = $tags;
@ -531,12 +531,12 @@ class ExtraField extends Model
if ($field_value) {
$field_value = $field_value['value'];
switch ($field['field_type']) {
case ExtraField::FIELD_TYPE_TAG:
case self::FIELD_TYPE_TAG:
$tags = UserManager::get_user_tags_to_string($itemId, $field['id'], false);
$extra_data['extra_'.$field['variable']] = $tags;
break;
case ExtraField::FIELD_TYPE_DOUBLE_SELECT:
case self::FIELD_TYPE_DOUBLE_SELECT:
$selected_options = explode(
'::',
$field_value
@ -547,11 +547,11 @@ class ExtraField extends Model
$extra_data['extra_'.$field['variable']]['extra_'.$field['variable'].'_second'] = $secondOption;
break;
case ExtraField::FIELD_TYPE_SELECT_MULTIPLE:
case self::FIELD_TYPE_SELECT_MULTIPLE:
$field_value = explode(';', $field_value);
$extra_data['extra_'.$field['variable']] = $field_value;
break;
case ExtraField::FIELD_TYPE_RADIO:
case self::FIELD_TYPE_RADIO:
$extra_data['extra_'.$field['variable']]['extra_'.$field['variable']] = $field_value;
break;
default:
@ -877,7 +877,7 @@ class ExtraField extends Model
}
switch ($field_details['field_type']) {
case ExtraField::FIELD_TYPE_TEXT:
case self::FIELD_TYPE_TEXT:
$form->addElement(
'text',
'extra_'.$field_details['variable'],
@ -890,7 +890,7 @@ class ExtraField extends Model
$form->freeze('extra_'.$field_details['variable']);
}
break;
case ExtraField::FIELD_TYPE_TEXTAREA:
case self::FIELD_TYPE_TEXTAREA:
$form->addHtmlEditor(
'extra_'.$field_details['variable'],
$field_details['display_text'],
@ -904,7 +904,7 @@ class ExtraField extends Model
$form->freeze('extra_'.$field_details['variable']);
}
break;
case ExtraField::FIELD_TYPE_RADIO:
case self::FIELD_TYPE_RADIO:
$group = array();
if (isset($field_details['options']) && !empty($field_details['options'])) {
foreach ($field_details['options'] as $option_details) {
@ -927,7 +927,7 @@ class ExtraField extends Model
$form->freeze('extra_'.$field_details['variable']);
}
break;
case ExtraField::FIELD_TYPE_CHECKBOX:
case self::FIELD_TYPE_CHECKBOX:
$group = array();
if (isset($field_details['options']) && !empty($field_details['options'])) {
foreach ($field_details['options'] as $option_details) {
@ -969,7 +969,7 @@ class ExtraField extends Model
$form->freeze('extra_'.$field_details['variable']);
}
break;
case ExtraField::FIELD_TYPE_SELECT:
case self::FIELD_TYPE_SELECT:
$get_lang_variables = false;
if (in_array(
$field_details['variable'],
@ -1134,7 +1134,7 @@ class ExtraField extends Model
$form->freeze('extra_'.$field_details['variable']);
}
break;
case ExtraField::FIELD_TYPE_SELECT_MULTIPLE:
case self::FIELD_TYPE_SELECT_MULTIPLE:
$options = array();
foreach ($field_details['options'] as $option_id => $option_details) {
$options[$option_details['option_value']] = $option_details['display_text'];
@ -1150,13 +1150,13 @@ class ExtraField extends Model
$form->freeze('extra_'.$field_details['variable']);
}
break;
case ExtraField::FIELD_TYPE_DATE:
case self::FIELD_TYPE_DATE:
$form->addDatePicker('extra_'.$field_details['variable'], $field_details['display_text']);
if ($freezeElement) {
$form->freeze('extra_'.$field_details['variable']);
}
break;
case ExtraField::FIELD_TYPE_DATETIME:
case self::FIELD_TYPE_DATETIME:
$form->addDateTimePicker(
'extra_'.$field_details['variable'],
$field_details['display_text']
@ -1170,7 +1170,7 @@ class ExtraField extends Model
$form->freeze('extra_'.$field_details['variable']);
}
break;
case ExtraField::FIELD_TYPE_DOUBLE_SELECT:
case self::FIELD_TYPE_DOUBLE_SELECT:
$first_select_id = 'first_extra_'.$field_details['variable'];
$url = api_get_path(WEB_AJAX_PATH).'extra_field.ajax.php?1=1';
@ -1205,7 +1205,7 @@ class ExtraField extends Model
}
}
$options = ExtraField::extra_field_double_select_convert_array_to_ordered_array(
$options = self::extra_field_double_select_convert_array_to_ordered_array(
$field_details['options']
);
$values = array('' => get_lang('Select'));
@ -1249,7 +1249,7 @@ class ExtraField extends Model
$form->freeze('extra_'.$field_details['variable']);
}
break;
case ExtraField::FIELD_TYPE_DIVIDER:
case self::FIELD_TYPE_DIVIDER:
$form->addHtml('
<div class="form-group ">
<div class="col-sm-12">
@ -1260,7 +1260,7 @@ class ExtraField extends Model
</div>
');
break;
case ExtraField::FIELD_TYPE_TAG:
case self::FIELD_TYPE_TAG:
$variable = $field_details['variable'];
$field_id = $field_details['id'];
@ -1364,7 +1364,7 @@ class ExtraField extends Model
EOF;
}
break;
case ExtraField::FIELD_TYPE_TIMEZONE:
case self::FIELD_TYPE_TIMEZONE:
$form->addElement(
'select',
'extra_'.$field_details['variable'],
@ -1376,7 +1376,7 @@ EOF;
$form->freeze('extra_'.$field_details['variable']);
}
break;
case ExtraField::FIELD_TYPE_SOCIAL_PROFILE:
case self::FIELD_TYPE_SOCIAL_PROFILE:
// get the social network's favicon
$extra_data_variable = isset($extraData['extra_'.$field_details['variable']]) ? $extraData['extra_'.$field_details['variable']] : null;
$field_default_value = isset($field_details['field_default_value']) ? $field_details['field_default_value'] : null;
@ -1408,7 +1408,7 @@ EOF;
$form->freeze('extra_'.$field_details['variable']);
}
break;
case ExtraField::FIELD_TYPE_MOBILE_PHONE_NUMBER:
case self::FIELD_TYPE_MOBILE_PHONE_NUMBER:
$form->addElement(
'text',
'extra_'.$field_details[1],
@ -1427,7 +1427,7 @@ EOF;
$form->freeze('extra_'.$field_details['variable']);
}
break;
case ExtraField::FIELD_TYPE_INTEGER:
case self::FIELD_TYPE_INTEGER:
$form->addElement(
'number',
'extra_'.$field_details['variable'],
@ -1443,7 +1443,7 @@ EOF;
$form->freeze('extra_'.$field_details['variable']);
}
break;
case ExtraField::FIELD_TYPE_FILE_IMAGE:
case self::FIELD_TYPE_FILE_IMAGE:
$fieldVariable = "extra_{$field_details['variable']}";
$fieldTexts = [
$field_details['display_text']
@ -1484,7 +1484,7 @@ EOF;
$form->freeze('extra_'.$field_details['variable']);
}
break;
case ExtraField::FIELD_TYPE_FLOAT:
case self::FIELD_TYPE_FLOAT:
$form->addElement(
'number',
'extra_'.$field_details['variable'],
@ -1500,7 +1500,7 @@ EOF;
$form->freeze('extra_'.$field_details['variable']);
}
break;
case ExtraField::FIELD_TYPE_FILE:
case self::FIELD_TYPE_FILE:
$fieldVariable = "extra_{$field_details['variable']}";
$fieldTexts = array(
$field_details['display_text']
@ -1535,7 +1535,7 @@ EOF;
$form->freeze('extra_'.$field_details['variable']);
}
break;
case ExtraField::FIELD_TYPE_VIDEO_URL:
case self::FIELD_TYPE_VIDEO_URL:
$form->addUrl(
"extra_{$field_details['variable']}",
$field_details['display_text'],
@ -1546,7 +1546,7 @@ EOF;
$form->freeze('extra_'.$field_details['variable']);
}
break;
case ExtraField::FIELD_TYPE_LETTERS_ONLY:
case self::FIELD_TYPE_LETTERS_ONLY:
$form->addTextLettersOnly(
"extra_{$field_details['variable']}",
$field_details['display_text']
@ -1557,7 +1557,7 @@ EOF;
$form->freeze('extra_'.$field_details['variable']);
}
break;
case ExtraField::FIELD_TYPE_ALPHANUMERIC:
case self::FIELD_TYPE_ALPHANUMERIC:
$form->addTextAlphanumeric(
"extra_{$field_details['variable']}",
$field_details['display_text']
@ -1570,7 +1570,7 @@ EOF;
$form->freeze('extra_'.$field_details['variable']);
}
break;
case ExtraField::FIELD_TYPE_LETTERS_SPACE:
case self::FIELD_TYPE_LETTERS_SPACE:
$form->addTextLettersAndSpaces(
"extra_{$field_details['variable']}",
$field_details['display_text']
@ -1581,7 +1581,7 @@ EOF;
$form->freeze('extra_'.$field_details['variable']);
}
break;
case ExtraField::FIELD_TYPE_ALPHANUMERIC_SPACE:
case self::FIELD_TYPE_ALPHANUMERIC_SPACE:
$form->addTextAlphanumericAndSpaces(
"extra_{$field_details['variable']}",
$field_details['display_text']
@ -1594,7 +1594,7 @@ EOF;
$form->freeze('extra_'.$field_details['variable']);
}
break;
case ExtraField::FIELD_TYPE_GEOLOCALIZATION:
case self::FIELD_TYPE_GEOLOCALIZATION:
$dataValue = isset($extraData['extra_'.$field_details['variable']])
? $extraData['extra_'.$field_details['variable']]
: '';
@ -1734,7 +1734,7 @@ EOF;
</div>
');
break;
case ExtraField::FIELD_TYPE_GEOLOCALIZATION_COORDINATES:
case self::FIELD_TYPE_GEOLOCALIZATION_COORDINATES:
$dataValue = isset($extraData['extra_'.$field_details['variable']])
? $extraData['extra_'.$field_details['variable']]
: '';
@ -2089,11 +2089,11 @@ EOF;
);
$fieldWithOptions = array(
ExtraField::FIELD_TYPE_RADIO,
ExtraField::FIELD_TYPE_SELECT_MULTIPLE,
ExtraField::FIELD_TYPE_SELECT,
ExtraField::FIELD_TYPE_TAG,
ExtraField::FIELD_TYPE_DOUBLE_SELECT,
self::FIELD_TYPE_RADIO,
self::FIELD_TYPE_SELECT_MULTIPLE,
self::FIELD_TYPE_SELECT,
self::FIELD_TYPE_TAG,
self::FIELD_TYPE_DOUBLE_SELECT,
);
if ($action == 'edit') {
@ -2104,7 +2104,7 @@ EOF;
);
$form->addElement('label', null, $url);
if ($defaults['field_type'] == ExtraField::FIELD_TYPE_SELECT) {
if ($defaults['field_type'] == self::FIELD_TYPE_SELECT) {
$urlWorkFlow = Display::url(
get_lang('EditExtraFieldWorkFlow'),
'extra_field_workflow.php?type='.$this->type.'&field_id='.$id
@ -2153,7 +2153,7 @@ EOF;
if ($action == 'edit') {
$option = new ExtraFieldOption($this->type);
if ($defaults['field_type'] == ExtraField::FIELD_TYPE_DOUBLE_SELECT) {
if ($defaults['field_type'] == self::FIELD_TYPE_DOUBLE_SELECT) {
$form->freeze('field_options');
}
$defaults['field_options'] = $option->get_field_options_by_field_to_string($id);
@ -2346,9 +2346,9 @@ JAVASCRIPT;
if (isset($extra_field_info['field_type']) && in_array(
$extra_field_info['field_type'],
array(
ExtraField::FIELD_TYPE_SELECT,
ExtraField::FIELD_TYPE_SELECT,
ExtraField::FIELD_TYPE_DOUBLE_SELECT
self::FIELD_TYPE_SELECT,
self::FIELD_TYPE_SELECT,
self::FIELD_TYPE_DOUBLE_SELECT
)
)
) {
@ -2363,7 +2363,7 @@ JAVASCRIPT;
$info = $this->get($extra['id']);
$extra_fields_info[$extra['id']] = $info;
}
if (isset($info['field_type']) && $info['field_type'] == ExtraField::FIELD_TYPE_DOUBLE_SELECT) {
if (isset($info['field_type']) && $info['field_type'] == self::FIELD_TYPE_DOUBLE_SELECT) {
$double_fields[$info['id']] = $info;
}
$counter++;
@ -2401,9 +2401,9 @@ JAVASCRIPT;
if (isset($extra_field_info['field_type']) && in_array(
$extra_field_info['field_type'],
array(
ExtraField::FIELD_TYPE_SELECT,
ExtraField::FIELD_TYPE_SELECT,
ExtraField::FIELD_TYPE_DOUBLE_SELECT
self::FIELD_TYPE_SELECT,
self::FIELD_TYPE_SELECT,
self::FIELD_TYPE_DOUBLE_SELECT
)
)
) {
@ -2420,7 +2420,7 @@ JAVASCRIPT;
)
";
} else if (isset($extra_field_info['field_type']) &&
$extra_field_info['field_type'] == ExtraField::FIELD_TYPE_TAG
$extra_field_info['field_type'] == self::FIELD_TYPE_TAG
) {
$options['where'] = str_replace(
$extra_info['field'],
@ -2546,7 +2546,7 @@ JAVASCRIPT;
$original_field = str_replace($stringToSearch, '', $rule->field);
$field_option = $this->get_handler_field_info_by_field_variable($original_field);
if ($field_option['field_type'] == ExtraField::FIELD_TYPE_DOUBLE_SELECT) {
if ($field_option['field_type'] == self::FIELD_TYPE_DOUBLE_SELECT) {
if (isset($double_select[$rule->field])) {
$data = explode('#', $rule->data);
$rule->data = $data[1].'::'.$double_select[$rule->field];
@ -2619,19 +2619,19 @@ JAVASCRIPT;
$displayedValue = get_lang('None');
switch ($field['field_type']) {
case ExtraField::FIELD_TYPE_CHECKBOX:
case self::FIELD_TYPE_CHECKBOX:
if ($valueData !== false && $valueData['value'] == '1') {
$displayedValue = get_lang('Yes');
} else {
$displayedValue = get_lang('No');
}
break;
case ExtraField::FIELD_TYPE_DATE:
case self::FIELD_TYPE_DATE:
if ($valueData !== false && !empty($valueData['value'])) {
$displayedValue = api_format_date($valueData['value'], DATE_FORMAT_LONG_NO_DAY);
}
break;
case ExtraField::FIELD_TYPE_FILE_IMAGE:
case self::FIELD_TYPE_FILE_IMAGE:
if ($valueData === false || empty($valueData['value'])) {
break;
}
@ -2652,7 +2652,7 @@ JAVASCRIPT;
array('target' => '_blank')
);
break;
case ExtraField::FIELD_TYPE_FILE:
case self::FIELD_TYPE_FILE:
if ($valueData === false || empty($valueData['value'])) {
break;
}

@ -7,8 +7,8 @@
/**
* Includes and declarations
*/
//die();
require_once '../../inc/global.inc.php';
die();
require_once '../../main/inc/global.inc.php';
$path = api_get_path(SYS_LANG_PATH);
$referenceLanguage = 'english';
$language = 'german';

Loading…
Cancel
Save