@@ -74,9 +74,9 @@ |
||
74 | 74 | $styleCss = $this->editor->getConfigAttribute('style'); |
75 | 75 | |
76 | 76 | if ($styleCss) { |
77 | - $style = true; |
|
77 | + $style = true; |
|
78 | 78 | } else { |
79 | - $style = false; |
|
79 | + $style = false; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | return $this->buildEditor($style); |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | $value = api_format_date($value, DATE_TIME_FORMAT_LONG_24H); |
45 | 45 | } |
46 | 46 | |
47 | - return $this->getElementJS() . ' |
|
47 | + return $this->getElementJS().' |
|
48 | 48 | <div class="input-group"> |
49 | 49 | <span class="input-group-addon"> |
50 | - <input ' . $this->_getAttrString($this->_attributes) . '> |
|
50 | + <input ' . $this->_getAttrString($this->_attributes).'> |
|
51 | 51 | </span> |
52 | - <input class="form-control" type="text" readonly id="' . $id . '_alt" value="' . $value . '"> |
|
52 | + <input class="form-control" type="text" readonly id="' . $id.'_alt" value="'.$value.'"> |
|
53 | 53 | </div> |
54 | 54 | '; |
55 | 55 | } |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | $js .= "<script> |
80 | 80 | $(function() { |
81 | 81 | $('#$id').hide().datepicker({ |
82 | - defaultDate: '" . $this->getValue() . "', |
|
82 | + defaultDate: '".$this->getValue()."', |
|
83 | 83 | dateFormat: 'yy-mm-dd', |
84 | 84 | altField: '#{$id}_alt', |
85 | - altFormat: \"" . get_lang('DateFormatLongNoDayJS') . "\", |
|
85 | + altFormat: \"".get_lang('DateFormatLongNoDayJS')."\", |
|
86 | 86 | showOn: 'both', |
87 | - buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true) . "', |
|
87 | + buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true)."', |
|
88 | 88 | buttonImageOnly: true, |
89 | - buttonText: '" . get_lang('SelectDate') . "', |
|
89 | + buttonText: '" . get_lang('SelectDate')."', |
|
90 | 90 | changeMonth: true, |
91 | 91 | changeYear: true, |
92 | 92 | yearRange: 'c-60y:c+5y' |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | $value = api_format_date($value, DATE_TIME_FORMAT_LONG_24H); |
39 | 39 | } |
40 | 40 | |
41 | - return $this->getElementJS() . ' |
|
41 | + return $this->getElementJS().' |
|
42 | 42 | <div class="input-group"> |
43 | 43 | <span class="input-group-addon"> |
44 | - <input ' . $this->_getAttrString($this->_attributes) . '> |
|
44 | + <input ' . $this->_getAttrString($this->_attributes).'> |
|
45 | 45 | </span> |
46 | - <input class="form-control" type="text" readonly id="' . $id . '_alt" value="' . $value . '"> |
|
46 | + <input class="form-control" type="text" readonly id="' . $id.'_alt" value="'.$value.'"> |
|
47 | 47 | </div> |
48 | 48 | '; |
49 | 49 | } |
@@ -73,18 +73,18 @@ discard block |
||
73 | 73 | $js .= "<script> |
74 | 74 | $(function() { |
75 | 75 | $('#$id').hide().datetimepicker({ |
76 | - defaultDate: '" . $this->getValue() . "', |
|
76 | + defaultDate: '".$this->getValue()."', |
|
77 | 77 | dateFormat: 'yy-mm-dd', |
78 | 78 | timeFormat: 'HH:mm', |
79 | 79 | altField: '#{$id}_alt', |
80 | - altFormat: \"" . get_lang('DateFormatLongNoDayJS') . "\", |
|
81 | - altTimeFormat: \"" . get_lang('TimeFormatNoSecJS') . "\", |
|
82 | - altSeparator: \" " . get_lang('AtTime') . " \", |
|
80 | + altFormat: \"".get_lang('DateFormatLongNoDayJS')."\", |
|
81 | + altTimeFormat: \"" . get_lang('TimeFormatNoSecJS')."\", |
|
82 | + altSeparator: \" " . get_lang('AtTime')." \", |
|
83 | 83 | altFieldTimeOnly: false, |
84 | 84 | showOn: 'both', |
85 | - buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true) . "', |
|
85 | + buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true)."', |
|
86 | 86 | buttonImageOnly: true, |
87 | - buttonText: '" . get_lang('SelectDate') . "', |
|
87 | + buttonText: '" . get_lang('SelectDate')."', |
|
88 | 88 | changeMonth: true, |
89 | 89 | changeYear: true |
90 | 90 | }); |
@@ -7,16 +7,16 @@ |
||
7 | 7 | */ |
8 | 8 | class HTML_QuickForm_Rule_Date extends HTML_QuickForm_Rule |
9 | 9 | { |
10 | - /** |
|
11 | - * Check a date |
|
12 | - * @see HTML_QuickForm_Rule |
|
13 | - * @param string $date example 2014-04-30 |
|
10 | + /** |
|
11 | + * Check a date |
|
12 | + * @see HTML_QuickForm_Rule |
|
13 | + * @param string $date example 2014-04-30 |
|
14 | 14 | * @param array $options |
15 | 15 | * |
16 | - * @return boolean True if date is valid |
|
17 | - */ |
|
18 | - public function validate($date, $options) |
|
19 | - { |
|
16 | + * @return boolean True if date is valid |
|
17 | + */ |
|
18 | + public function validate($date, $options) |
|
19 | + { |
|
20 | 20 | return api_is_valid_date($date, 'Y-m-d'); |
21 | - } |
|
21 | + } |
|
22 | 22 | } |
@@ -6,24 +6,24 @@ |
||
6 | 6 | */ |
7 | 7 | class HTML_QuickForm_Rule_UsernameAvailable extends HTML_QuickForm_Rule |
8 | 8 | { |
9 | - /** |
|
10 | - * Function to check if a username is available |
|
11 | - * @see HTML_QuickForm_Rule |
|
12 | - * @param string $username Wanted username |
|
13 | - * @param string $current_username |
|
14 | - * @return boolean True if username is available |
|
15 | - */ |
|
16 | - function validate($username, $current_username = null) { |
|
17 | - $user_table = Database::get_main_table(TABLE_MAIN_USER); |
|
9 | + /** |
|
10 | + * Function to check if a username is available |
|
11 | + * @see HTML_QuickForm_Rule |
|
12 | + * @param string $username Wanted username |
|
13 | + * @param string $current_username |
|
14 | + * @return boolean True if username is available |
|
15 | + */ |
|
16 | + function validate($username, $current_username = null) { |
|
17 | + $user_table = Database::get_main_table(TABLE_MAIN_USER); |
|
18 | 18 | $username = Database::escape_string($username); |
19 | 19 | $current_username = Database::escape_string($current_username); |
20 | 20 | |
21 | - $sql = "SELECT * FROM $user_table WHERE username = '$username'"; |
|
22 | - if (!is_null($current_username)) { |
|
23 | - $sql .= " AND username != '$current_username'"; |
|
24 | - } |
|
25 | - $res = Database::query($sql); |
|
26 | - $number = Database::num_rows($res); |
|
27 | - return $number == 0; |
|
28 | - } |
|
21 | + $sql = "SELECT * FROM $user_table WHERE username = '$username'"; |
|
22 | + if (!is_null($current_username)) { |
|
23 | + $sql .= " AND username != '$current_username'"; |
|
24 | + } |
|
25 | + $res = Database::query($sql); |
|
26 | + $number = Database::num_rows($res); |
|
27 | + return $number == 0; |
|
28 | + } |
|
29 | 29 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @return boolean True if the 2 given dates match the operator |
13 | 13 | */ |
14 | 14 | function validate($values, $operator = null) { |
15 | - $datetime1 = api_strtotime($values[0]); |
|
15 | + $datetime1 = api_strtotime($values[0]); |
|
16 | 16 | $datetime2 = api_strtotime($values[1]); |
17 | 17 | |
18 | 18 | if (strpos($operator, 'allow_empty') !== false) { |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | return true; |
22 | 22 | } |
23 | 23 | } |
24 | - $result = parent::validate(array($datetime1, $datetime2), $operator); |
|
24 | + $result = parent::validate(array($datetime1, $datetime2), $operator); |
|
25 | 25 | return $result; |
26 | 26 | } |
27 | 27 | } |
@@ -21,7 +21,7 @@ |
||
21 | 21 | return true; |
22 | 22 | } |
23 | 23 | } |
24 | - $result = parent::validate(array($datetime1, $datetime2), $operator); |
|
24 | + $result = parent::validate(array($datetime1, $datetime2), $operator); |
|
25 | 25 | return $result; |
26 | 26 | } |
27 | 27 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | function validate($html, $mode = NO_HTML) |
18 | 18 | { |
19 | - $allowed_tags = self::get_allowed_tags ($mode, $fullpage); |
|
19 | + $allowed_tags = self::get_allowed_tags($mode, $fullpage); |
|
20 | 20 | $cleaned_html = kses($html, $allowed_tags); |
21 | 21 | return $html == $cleaned_html; |
22 | 22 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | // Include the allowed tags. |
34 | 34 | //include(dirname(__FILE__).'/allowed_tags.inc.php'); |
35 | 35 | global $allowed_tags_student, $allowed_tags_student_full_page, $allowed_tags_teacher, $allowed_tags_teacher_full_page; |
36 | - switch($mode) |
|
36 | + switch ($mode) |
|
37 | 37 | { |
38 | 38 | case NO_HTML: |
39 | 39 | return array(); |
@@ -25,8 +25,6 @@ |
||
25 | 25 | * Get allowed tags |
26 | 26 | * @param int $mode NO_HTML, STUDENT_HTML, TEACHER_HTML, |
27 | 27 | * STUDENT_HTML_FULLPAGE or TEACHER_HTML_FULLPAGE |
28 | - * @param boolean $fullpage If true, the allowed tags for full-page editing |
|
29 | - * are returned. |
|
30 | 28 | */ |
31 | 29 | static function get_allowed_tags($mode) |
32 | 30 | { |
@@ -27,10 +27,10 @@ |
||
27 | 27 | */ |
28 | 28 | function validate($value, $options = null) |
29 | 29 | { |
30 | - if(is_array($value)) |
|
31 | - { |
|
32 | - $value = implode(null,$value); |
|
33 | - } |
|
30 | + if(is_array($value)) |
|
31 | + { |
|
32 | + $value = implode(null,$value); |
|
33 | + } |
|
34 | 34 | if ((string)$value == '') { |
35 | 35 | return false; |
36 | 36 | } |
@@ -27,11 +27,11 @@ |
||
27 | 27 | */ |
28 | 28 | function validate($value, $options = null) |
29 | 29 | { |
30 | - if(is_array($value)) |
|
30 | + if (is_array($value)) |
|
31 | 31 | { |
32 | - $value = implode(null,$value); |
|
32 | + $value = implode(null, $value); |
|
33 | 33 | } |
34 | - if ((string)$value == '') { |
|
34 | + if ((string) $value == '') { |
|
35 | 35 | return false; |
36 | 36 | } |
37 | 37 | return true; |
@@ -9,18 +9,18 @@ |
||
9 | 9 | class HTML_QuickForm_Rule_FileName extends HTML_QuickForm_Rule |
10 | 10 | { |
11 | 11 | |
12 | - /** |
|
13 | - * @param $value array Uploaded file info (from $_FILES) |
|
14 | - * @param null $options |
|
15 | - * @return bool |
|
16 | - */ |
|
17 | - public function validate($value, $options = null) |
|
18 | - { |
|
19 | - if ((isset($elementValue['error']) && $elementValue['error'] == 0) || |
|
20 | - (!empty($elementValue['tmp_name']) && $elementValue['tmp_name'] != 'none')) { |
|
21 | - return is_uploaded_file($elementValue['tmp_name']); |
|
22 | - } else { |
|
23 | - return false; |
|
24 | - } |
|
25 | - } |
|
12 | + /** |
|
13 | + * @param $value array Uploaded file info (from $_FILES) |
|
14 | + * @param null $options |
|
15 | + * @return bool |
|
16 | + */ |
|
17 | + public function validate($value, $options = null) |
|
18 | + { |
|
19 | + if ((isset($elementValue['error']) && $elementValue['error'] == 0) || |
|
20 | + (!empty($elementValue['tmp_name']) && $elementValue['tmp_name'] != 'none')) { |
|
21 | + return is_uploaded_file($elementValue['tmp_name']); |
|
22 | + } else { |
|
23 | + return false; |
|
24 | + } |
|
25 | + } |
|
26 | 26 | } |