Minor - Code conventions - refs #7611

1.10.x
Angel Fernando Quiroz Campos 11 years ago
parent faad0a8535
commit 577afc98a5
  1. 2
      main/exercice/MatchingDraggable.php
  2. 2
      main/exercice/answer.class.php
  3. 21
      main/inc/lib/display.lib.php

@ -204,7 +204,7 @@ class MatchingDraggable extends Question
} }
/** /**
* * Process the creation of answers
* @param type $form * @param type $form
*/ */
public function processAnswersCreation($form) public function processAnswersCreation($form)

@ -761,7 +761,7 @@ class Answer
} }
/** /**
* Get the necessary JavaScript for some ansers * Get the necessary JavaScript for some answers
* @return string * @return string
*/ */
public function getJs() { public function getJs() {

@ -946,17 +946,18 @@ class Display
$extra_attributes = array(), $extra_attributes = array(),
$show_blank_item = true, $show_blank_item = true,
$blank_item_text = null $blank_item_text = null
) { )
{
$html = ''; $html = '';
$extra = ''; $extra = '';
$default_id = 'id="'.$name.'" '; $default_id = 'id="' . $name . '" ';
foreach($extra_attributes as $key=>$parameter) { foreach ($extra_attributes as $key => $parameter) {
if ($key == 'id') { if ($key == 'id') {
$default_id = ''; $default_id = '';
} }
$extra .= $key.'="'.$parameter.'" '; $extra .= $key . '="' . $parameter . '" ';
} }
$html .= '<select name="'.$name.'" '.$default_id.' '.$extra.'>'; $html .= '<select name="' . $name . '" ' . $default_id . ' ' . $extra . '>';
if ($show_blank_item) { if ($show_blank_item) {
if (empty($blank_item_text)) { if (empty($blank_item_text)) {
@ -964,17 +965,17 @@ class Display
} else { } else {
$blank_item_text = Security::remove_XSS($blank_item_text); $blank_item_text = Security::remove_XSS($blank_item_text);
} }
$html .= self::tag('option', '-- '.$blank_item_text.' --', array('value'=>'-1')); $html .= self::tag('option', '-- ' . $blank_item_text . ' --', array('value' => '-1'));
} }
if ($values) { if ($values) {
foreach ($values as $key => $value) { foreach ($values as $key => $value) {
if(is_array($value) && isset($value['name'])) { if (is_array($value) && isset($value['name'])) {
$value = $value['name']; $value = $value['name'];
} }
$html .= '<option value="'.$key.'"'; $html .= '<option value="' . $key . '"';
if (is_array($default)) { if (is_array($default)) {
foreach($default as $item) { foreach ($default as $item) {
if ($item == $key) { if ($item == $key) {
$html .= ' selected="selected"'; $html .= ' selected="selected"';
break; break;
@ -986,7 +987,7 @@ class Display
} }
} }
$html .= '>'.$value.'</option>'; $html .= '>' . $value . '</option>';
} }
} }
$html .= '</select>'; $html .= '</select>';

Loading…
Cancel
Save