Minor - format code.

pull/2487/head
jmontoyaa 9 years ago
parent 240e237a7d
commit f641619280
  1. 19
      main/inc/lib/extra_field.lib.php
  2. 7
      main/inc/lib/extra_field_option.lib.php
  3. 2
      main/inc/lib/extra_field_value.lib.php
  4. 2
      main/inc/lib/sessionmanager.lib.php

@ -539,7 +539,11 @@ class ExtraField extends Model
); );
if ($field['field_type'] == self::FIELD_TYPE_TAG) { if ($field['field_type'] == self::FIELD_TYPE_TAG) {
$tags = UserManager::get_user_tags_to_string($itemId, $field['id'], false); $tags = UserManager::get_user_tags_to_string(
$itemId,
$field['id'],
false
);
$extra_data['extra_'.$field['variable']] = $tags; $extra_data['extra_'.$field['variable']] = $tags;
continue; continue;
@ -549,7 +553,11 @@ class ExtraField extends Model
$field_value = $field_value['value']; $field_value = $field_value['value'];
switch ($field['field_type']) { switch ($field['field_type']) {
case self::FIELD_TYPE_TAG: case self::FIELD_TYPE_TAG:
$tags = UserManager::get_user_tags_to_string($itemId, $field['id'], false); $tags = UserManager::get_user_tags_to_string(
$itemId,
$field['id'],
false
);
$extra_data['extra_'.$field['variable']] = $tags; $extra_data['extra_'.$field['variable']] = $tags;
break; break;
@ -1077,7 +1085,6 @@ class ExtraField extends Model
if (isset($optionList[$defaultValueId]) && if (isset($optionList[$defaultValueId]) &&
isset($optionList[$defaultValueId]['priority']) isset($optionList[$defaultValueId]['priority'])
) { ) {
if (!empty($optionList[$defaultValueId]['priority'])) { if (!empty($optionList[$defaultValueId]['priority'])) {
$priorityId = $optionList[$defaultValueId]['priority']; $priorityId = $optionList[$defaultValueId]['priority'];
$option = new ExtraFieldOption($this->type); $option = new ExtraFieldOption($this->type);
@ -1303,7 +1310,6 @@ class ExtraField extends Model
$tagsSelect->setMultiple(true); $tagsSelect->setMultiple(true);
$selectedOptions = []; $selectedOptions = [];
if ($this->type === 'user') { if ($this->type === 'user') {
// The magic should be here // The magic should be here
$user_tags = UserManager::get_user_tags($itemId, $field_details['id']); $user_tags = UserManager::get_user_tags($itemId, $field_details['id']);
@ -1314,7 +1320,6 @@ class ExtraField extends Model
$tag['tag'], $tag['tag'],
$tag['tag'] $tag['tag']
); );
$selectedOptions[] = $tag['tag']; $selectedOptions[] = $tag['tag'];
} }
} }
@ -2316,8 +2321,8 @@ JAVASCRIPT;
'op' => 'cn', 'op' => 'cn',
); );
//Second // Second
$search_options['value'] = $field['id'].':'; $search_options['value'] = $field['id'].':';
$search_options['dataInit'] = 'register_second_select'; $search_options['dataInit'] = 'register_second_select';
$column_model[] = array( $column_model[] = array(

@ -1,6 +1,8 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\ExtraFieldOptions;
/** /**
* Class ExtraFieldOption * Class ExtraFieldOption
* Handles the extra fields for various objects (users, sessions, courses) * Handles the extra fields for various objects (users, sessions, courses)
@ -31,7 +33,6 @@ class ExtraFieldOption extends Model
$this->type = $type; $this->type = $type;
$extraField = new ExtraField($this->type); $extraField = new ExtraField($this->type);
$this->extraField = $extraField; $this->extraField = $extraField;
$this->table = Database::get_main_table(TABLE_EXTRA_FIELD_OPTIONS); $this->table = Database::get_main_table(TABLE_EXTRA_FIELD_OPTIONS);
$this->tableExtraField = Database::get_main_table(TABLE_EXTRA_FIELD); $this->tableExtraField = Database::get_main_table(TABLE_EXTRA_FIELD);
} }
@ -44,7 +45,6 @@ class ExtraFieldOption extends Model
return $this->extraField; return $this->extraField;
} }
/** /**
* Gets the number of options already available in the table for this item type * Gets the number of options already available in the table for this item type
* @return int Number of options available * @return int Number of options available
@ -453,6 +453,7 @@ class ExtraFieldOption extends Model
} }
$options = []; $options = [];
/** @var ExtraFieldOptions $row */
foreach ($result as $row) { foreach ($result as $row) {
$option = [ $option = [
'id' => $row->getId(), 'id' => $row->getId(),
@ -494,7 +495,7 @@ class ExtraFieldOption extends Model
->findSecondaryOptions($option); ->findSecondaryOptions($option);
$optionsInfo = []; $optionsInfo = [];
/** @var ExtraFieldOptions $subOption */
foreach ($subOptions as $subOption) { foreach ($subOptions as $subOption) {
$optionsInfo[] = [ $optionsInfo[] = [
'id' => $subOption->getId(), 'id' => $subOption->getId(),

@ -111,6 +111,7 @@ class ExtraFieldValue extends Model
} }
$field_variable = $fieldDetails['variable']; $field_variable = $fieldDetails['variable'];
if (isset($params['extra_'.$field_variable])) { if (isset($params['extra_'.$field_variable])) {
$value = $params['extra_'.$field_variable]; $value = $params['extra_'.$field_variable];
} else { } else {
@ -310,7 +311,6 @@ class ExtraFieldValue extends Model
'value' => $value, 'value' => $value,
'comment' => $comment 'comment' => $comment
); );
self::save($newParams, $showQuery); self::save($newParams, $showQuery);
} }
} }

@ -4465,7 +4465,6 @@ class SessionManager
$error_message = get_lang('NotCSV'); $error_message = get_lang('NotCSV');
} else { } else {
$tag_names = array(); $tag_names = array();
foreach ($content as $key => $enreg) { foreach ($content as $key => $enreg) {
$enreg = explode(';', trim($enreg)); $enreg = explode(';', trim($enreg));
if ($key) { if ($key) {
@ -4659,7 +4658,6 @@ class SessionManager
} }
if ($my_session_result === false) { if ($my_session_result === false) {
// Creating a session. // Creating a session.
$sql = "INSERT IGNORE INTO $tbl_session SET $sql = "INSERT IGNORE INTO $tbl_session SET
name = '$session_name', name = '$session_name',

Loading…
Cancel
Save