@@ -6,24 +6,24 @@ |
||
6 | 6 | */ |
7 | 7 | class HTML_QuickForm_Compare_Fields extends HTML_QuickForm_Rule_Compare |
8 | 8 | { |
9 | - /** |
|
10 | - * Function to check an array of fields |
|
11 | - * @param array of field names |
|
9 | + /** |
|
10 | + * Function to check an array of fields |
|
11 | + * @param array of field names |
|
12 | 12 | * @param string operator ==, >=, etc |
13 | 13 | * @param string the value to compare |
14 | - * @return boolean True if date is valid |
|
15 | - */ |
|
16 | - function validate($values = [], $operator_and_max_value = null) { |
|
14 | + * @return boolean True if date is valid |
|
15 | + */ |
|
16 | + function validate($values = [], $operator_and_max_value = null) { |
|
17 | 17 | if (is_array($values) && !empty($values) && !empty($operator_and_max_value)) { |
18 | - $final_value = 0; |
|
19 | - foreach ($values as $value) { |
|
20 | - $final_value += $value; |
|
21 | - } |
|
22 | - $params = explode('@', $operator_and_max_value); |
|
23 | - $operator = $params[0]; |
|
24 | - $max_value = $params[1]; |
|
25 | - return parent::validate(array($final_value, $max_value), $operator); |
|
18 | + $final_value = 0; |
|
19 | + foreach ($values as $value) { |
|
20 | + $final_value += $value; |
|
21 | + } |
|
22 | + $params = explode('@', $operator_and_max_value); |
|
23 | + $operator = $params[0]; |
|
24 | + $max_value = $params[1]; |
|
25 | + return parent::validate(array($final_value, $max_value), $operator); |
|
26 | 26 | } |
27 | 27 | return false; |
28 | - } |
|
28 | + } |
|
29 | 29 | } |
30 | 30 | \ No newline at end of file |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | public function __construct() |
17 | 17 | { |
18 | 18 | parent::__construct(); |
19 | - $this->table = Database::get_main_table(TABLE_GRADE_MODEL); |
|
19 | + $this->table = Database::get_main_table(TABLE_GRADE_MODEL); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | { |
56 | 56 | // action links |
57 | 57 | echo '<div class="actions" style="margin-bottom:20px">'; |
58 | - echo '<a href="grade_models.php">'.Display::return_icon('back.png',get_lang('Back'),'','32').'</a>'; |
|
59 | - echo '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png',get_lang('Add'),'','32').'</a>'; |
|
58 | + echo '<a href="grade_models.php">'.Display::return_icon('back.png', get_lang('Back'), '', '32').'</a>'; |
|
59 | + echo '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'), '', '32').'</a>'; |
|
60 | 60 | echo '</div>'; |
61 | 61 | echo Display::grid_html('grade_model'); |
62 | 62 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | if ($action == 'edit') { |
114 | 114 | if (!empty($components)) { |
115 | - $nr_items = count($components) -1; |
|
115 | + $nr_items = count($components) - 1; |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $form->addElement('hidden', 'components['.$i.'][id]', null); |
131 | 131 | |
132 | 132 | $template_percentage = |
133 | - '<div id=' . $i . ' style="display: '.(($i<=$nr_items)?'inline':'none').';" class="control-group"> |
|
133 | + '<div id='.$i.' style="display: '.(($i <= $nr_items) ? 'inline' : 'none').';" class="control-group"> |
|
134 | 134 | <p> |
135 | 135 | <label class="control-label">{label}</label> |
136 | 136 | <div class="controls"> |
@@ -143,11 +143,11 @@ discard block |
||
143 | 143 | |
144 | 144 | $template_title = |
145 | 145 | ' {element} <!-- BEGIN error --> <span class="form_error">{error}</span><!-- END error --> |
146 | - <a href="javascript:plusItem(' . ($counter+1) . ')"> |
|
147 | - '.Display::return_icon('add.png', get_lang('Add'), ['id' => 'plus-' . ($counter+1), 'style' => 'display: '.(($counter>=$nr_items) ? 'inline':'none') ]).' |
|
146 | + <a href="javascript:plusItem(' . ($counter + 1).')"> |
|
147 | + '.Display::return_icon('add.png', get_lang('Add'), ['id' => 'plus-'.($counter + 1), 'style' => 'display: '.(($counter >= $nr_items) ? 'inline' : 'none')]).' |
|
148 | 148 | </a> |
149 | - <a href="javascript:minItem(' . ($counter) . ')"> |
|
150 | - '.Display::return_icon('delete.png', get_lang('Delete'), ['id' => 'min-' . ($counter), 'style' => 'display: '.(($counter>=$nr_items) ? 'inline':'none') ]).' |
|
149 | + <a href="javascript:minItem(' . ($counter).')"> |
|
150 | + '.Display::return_icon('delete.png', get_lang('Delete'), ['id' => 'min-'.($counter), 'style' => 'display: '.(($counter >= $nr_items) ? 'inline' : 'none')]).' |
|
151 | 151 | </a> |
152 | 152 | </div></p></div>'; |
153 | 153 | $renderer->setElementTemplate($template_title, 'components['.$i.'][title]'); |