diff --git a/main/admin/legal_add.php b/main/admin/legal_add.php index 02d08102e1..9b653e3771 100755 --- a/main/admin/legal_add.php +++ b/main/admin/legal_add.php @@ -25,6 +25,26 @@ $term_preview = [ 'content' => '', 'changes' => '', ]; + +$extraField = new ExtraField('terms_and_condition'); + +$types = LegalManager::getTreatmentTypeList(); +foreach ($types as $variable => $name) { + $label = 'PersonalData'.ucfirst($name).'Title'; + $params = [ + 'variable' => $variable, + 'display_text' => $label, + 'field_type' => ExtraField::FIELD_TYPE_TEXTAREA, + 'default_value' => '', + 'visible' => true, + 'changeable' => true, + 'filter' => true, + 'visible_to_self' => true, + 'visible_to_others' => true, + ]; + $extraField->save($params); +} + if ($form->validate()) { $check = Security::check_token('post'); if ($check) { @@ -67,7 +87,7 @@ if ($form->validate()) { $tok = Security::get_token(); header('Location: legal_list.php?sec_token='.$tok); exit(); - } elseif ($submit == 'preview') { + } elseif ($submit === 'preview') { $defaults['type'] = $type; $defaults['content'] = $content; $defaults['changes'] = $changes; @@ -128,7 +148,6 @@ if (isset($_POST['language'])) { } $termId = isset($term_preview['id']) ? $term_preview['id'] : 0; - $extraField = new ExtraField('terms_and_condition'); $returnParams = $extraField->addElements( $form, $termId, diff --git a/main/inc/ajax/admin.ajax.php b/main/inc/ajax/admin.ajax.php index 180d5d2973..3acb723b2d 100755 --- a/main/inc/ajax/admin.ajax.php +++ b/main/inc/ajax/admin.ajax.php @@ -1,5 +1,10 @@ (the code) - * @author Patrick Cool , Ghent University (the modifications) - * @author Yannick Warnier for the move to HTTP request - * @copyright (C) 2001 The phpBB Group - * * @return string language string with some layout (color) + * @throws \Exception + * @throws \InvalidArgumentException */ function check_system_version() { @@ -162,6 +163,16 @@ function check_system_version() $packager = 'chamilo'; } + $uniqueId = ''; + $entityManager = Database::getManager(); + /** @var BranchSyncRepository $branch */ + $repository = $entityManager->getRepository('ChamiloCoreBundle:BranchSync'); + /** @var BranchSync $branch */ + $branch = $repository->getTopBranch(); + if (is_a($branch, '\Chamilo\CoreBundle\Entity\BranchSync')) { + $uniqueId = $branch->getUniqueId(); + } + $data = [ 'url' => api_get_path(WEB_PATH), 'campus' => api_get_setting('siteName'), @@ -183,6 +194,7 @@ function check_system_version() // the default config file (main/install/configuration.dist.php) // or in the installed config file. The default value is 'chamilo' 'packager' => $packager, + 'unique_id' => $uniqueId, ]; $version = null; diff --git a/main/inc/lib/extra_field.lib.php b/main/inc/lib/extra_field.lib.php index 857626156e..0e000a09b0 100755 --- a/main/inc/lib/extra_field.lib.php +++ b/main/inc/lib/extra_field.lib.php @@ -1049,6 +1049,11 @@ class ExtraField extends Model $freezeElement = $field_details['visible_to_self'] == 0 || $field_details['changeable'] == 0; } + $translatedDisplayText = get_lang($field_details['display_text'], true); + if (!empty($translatedDisplayText)) { + $field_details['display_text'] = $translatedDisplayText; + } + switch ($field_details['field_type']) { case self::FIELD_TYPE_TEXT: $form->addElement( diff --git a/main/inc/lib/internationalization.lib.php b/main/inc/lib/internationalization.lib.php index 52e5f226af..b82baa490c 100755 --- a/main/inc/lib/internationalization.lib.php +++ b/main/inc/lib/internationalization.lib.php @@ -60,11 +60,11 @@ define('PERSON_NAME_EMAIL_ADDRESS', PERSON_NAME_WESTERN_ORDER); define('PERSON_NAME_DATA_EXPORT', PERSON_NAME_EASTERN_ORDER); /** - * Returns a translated (localized) string, called by its identificator. + * Returns a translated (localized) string, called by its ID. * - * @param string $variable this is the identificator (name) of the translated string to be retrieved - * @param string $reserved this parameter has been reserved for future use - * @param string $language (optional) Language indentificator. If it is omited, the current interface language is assumed. + * @param string $variable this is the ID (name) of the translated string to be retrieved + * @param bool $strict If variable is not found, then: if false: returns variable name with or without brackets; true: returns '' + * @param string $language (optional) Language ID. If it is omitted, the current interface language is assumed. * * @return string returns the requested string in the correspondent language * @@ -82,7 +82,7 @@ define('PERSON_NAME_DATA_EXPORT', PERSON_NAME_EASTERN_ORDER); * * @see http://translate.chamilo.org/ */ -function get_lang($variable, $reserved = null, $language = null) +function get_lang($variable, $strict = false, $language = null) { // For serving some old hacks: // By manipulating this global variable the translation may @@ -141,17 +141,18 @@ function get_lang($variable, $reserved = null, $language = null) // - from a local variable after reloading the language files - on test server mode or when requested language // is different than the genuine interface language. $read_global_variables = $is_interface_language; + $langvar = ''; if ($read_global_variables) { if (isset($GLOBALS[$variable])) { $langvar = $GLOBALS[$variable]; } elseif (isset($GLOBALS["lang$variable"])) { $langvar = $GLOBALS["lang$variable"]; - } else { + } elseif (!$strict) { $langvar = $show_special_markup ? SPECIAL_OPENING_TAG.$variable.SPECIAL_CLOSING_TAG : $variable; } } - if (empty($langvar) || !is_string($langvar)) { + if (empty($langvar) || !is_string($langvar) && !$strict) { $langvar = $show_special_markup ? SPECIAL_OPENING_TAG.$variable.SPECIAL_CLOSING_TAG : $variable; } $ret = $cache[$language][$variable] = $langvar; @@ -168,6 +169,7 @@ function get_lang($variable, $reserved = null, $language = null) * @param bool $setParentLanguageName * * @return string the current language of the interface + * @throws Exception */ function api_get_interface_language( $purified = false, diff --git a/main/inc/lib/legal.lib.php b/main/inc/lib/legal.lib.php index 58ba47357c..ed13faa939 100755 --- a/main/inc/lib/legal.lib.php +++ b/main/inc/lib/legal.lib.php @@ -386,21 +386,21 @@ class LegalManager public static function getTreatmentTypeList() { return [ - 101 => 'collection', - 102 => 'recording', - 103 => 'organization', - 104 => 'structure', - 105 => 'conservation', - 106 => 'adaptation', - 107 => 'extraction', - 108 => 'consultation', - 109 => 'usage', - 110 => 'communication', - 111 => 'interconnection', - 112 => 'limitation', - 113 => 'deletion', - 114 => 'destruction', - 115 => 'profiling', + 'privacy_terms_collection' => 'collection', + 'privacy_terms_recording' => 'recording', + 'privacy_terms_organization' => 'organization', + 'privacy_terms_structure' => 'structure', + 'privacy_terms_conservation' => 'conservation', + 'privacy_terms_adaptation' => 'adaptation', + 'privacy_terms_extraction' => 'extraction', + 'privacy_terms_consultation' => 'consultation', + 'privacy_terms_usage' => 'usage', + 'privacy_terms_communication' => 'communication', + 'privacy_terms_interconnection' => 'interconnection', + 'privacy_terms_limitation' => 'limitation', + 'privacy_terms_deletion' => 'deletion', + 'privacy_terms_destruction' => 'destruction', + 'privacy_terms_profiling' => 'profiling', ]; } } diff --git a/main/social/personal_data.php b/main/social/personal_data.php index ef3efe7abf..34f3098233 100755 --- a/main/social/personal_data.php +++ b/main/social/personal_data.php @@ -249,10 +249,33 @@ $webCoursePath = api_get_path(WEB_COURSE_PATH); foreach ($properties as $key => $value) { if (is_array($value) || is_object($value)) { switch ($key) { + case 'classes': + foreach ($value as $category => $subValue) { + $categoryName = 'Social group'; + if ($category == 0) { + $categoryName = 'Class'; + } + $personalDataContent .= '
  • '; + $personalDataContent .= ''.$categoryName.' >
  • '; + $personalDataContent .= ''; + } + break; case 'extraFields': $personalDataContent .= '
  • '.$key.':
  • '; break; @@ -261,15 +284,19 @@ foreach ($properties as $key => $value) { $personalDataContent .= '
  • '; $personalDataContent .= ''.get_lang($category).' >
  • '; $personalDataContent .= ''; @@ -280,13 +307,16 @@ foreach ($properties as $key => $value) { case 'roles': case 'achievedSkills': case 'sessionAsGeneralCoach': - case 'classes': case 'courses': case 'groupNames': case 'groups': $personalDataContent .= '
  • '.$key.':
  • '; break; @@ -294,8 +324,12 @@ foreach ($properties as $key => $value) { $personalDataContent .= '
  • '.$key.':