@@ -87,7 +87,7 @@ |
||
87 | 87 | <?php |
88 | 88 | echo Display::get_alphabet_options($firstLetterUserGroup); |
89 | 89 | echo Display::get_numeric_options(0, 9, $firstLetterUserGroup); |
90 | - ?> |
|
90 | + ?> |
|
91 | 91 | </select> |
92 | 92 | </td> |
93 | 93 | <td width="20%"> </td> |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | $tbl_course = Database:: get_main_table(TABLE_MAIN_COURSE); |
31 | 31 | |
32 | 32 | $tool_name = get_lang('AddUserGroupToURL'); |
33 | -$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
34 | -$interbreadcrumb[] = array ('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs')); |
|
33 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
34 | +$interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs')); |
|
35 | 35 | |
36 | 36 | Display::display_header($tool_name); |
37 | 37 | |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | |
47 | 47 | if (isset($_POST['form_sent']) && $_POST['form_sent']) { |
48 | 48 | $form_sent = $_POST['form_sent']; |
49 | - $userGroups = is_array($_POST['user_group_list']) ? $_POST['user_group_list'] : array() ; |
|
50 | - $urlList = is_array($_POST['url_list']) ? $_POST['url_list'] : array() ; |
|
49 | + $userGroups = is_array($_POST['user_group_list']) ? $_POST['user_group_list'] : array(); |
|
50 | + $urlList = is_array($_POST['url_list']) ? $_POST['url_list'] : array(); |
|
51 | 51 | $firstLetterUserGroup = $_POST['first_letter_user_group']; |
52 | 52 | |
53 | 53 | if ($form_sent == 1) { |
@@ -99,7 +99,10 @@ discard block |
||
99 | 99 | <td width="40%" align="center"> |
100 | 100 | <select name="user_group_list[]" multiple="multiple" size="20" style="width:400px;"> |
101 | 101 | <?php foreach ($dbUserGroups as $item) { ?> |
102 | - <option value="<?php echo $item['id']; ?>" <?php if (in_array($item['id'], $courses)) echo 'selected="selected"'; ?>><?php echo $item['name']; ?> |
|
102 | + <option value="<?php echo $item['id']; ?>" <?php if (in_array($item['id'], $courses)) { |
|
103 | + echo 'selected="selected"'; |
|
104 | +} |
|
105 | +?>><?php echo $item['name']; ?> |
|
103 | 106 | </option> |
104 | 107 | <?php } ?> |
105 | 108 | </select> |
@@ -110,7 +113,10 @@ discard block |
||
110 | 113 | <td width="40%" align="center"> |
111 | 114 | <select name="url_list[]" multiple="multiple" size="20" style="width:300px;"> |
112 | 115 | <?php foreach ($db_urls as $url_obj) { ?> |
113 | - <option value="<?php echo $url_obj['id']; ?>" <?php if (in_array($url_obj['id'], $url_list)) echo 'selected="selected"'; ?>><?php echo $url_obj['url']; ?> |
|
116 | + <option value="<?php echo $url_obj['id']; ?>" <?php if (in_array($url_obj['id'], $url_list)) { |
|
117 | + echo 'selected="selected"'; |
|
118 | +} |
|
119 | +?>><?php echo $url_obj['url']; ?> |
|
114 | 120 | </option> |
115 | 121 | <?php } ?> |
116 | 122 | </select> |
@@ -18,93 +18,93 @@ discard block |
||
18 | 18 | |
19 | 19 | $defaults = array(); |
20 | 20 | $term_preview = array( |
21 | - 'type' => 0, |
|
22 | - 'content' => '', |
|
23 | - 'changes' => '', |
|
21 | + 'type' => 0, |
|
22 | + 'content' => '', |
|
23 | + 'changes' => '', |
|
24 | 24 | ); |
25 | 25 | if ($form->validate()) { |
26 | - $check = Security::check_token('post'); |
|
27 | - if ($check) { |
|
28 | - $values = $form->getSubmitValues(); |
|
29 | - $lang = $values['language']; |
|
30 | - //language id |
|
31 | - $lang = api_get_language_id($lang); |
|
32 | - |
|
33 | - if (isset($values['type'])) { |
|
34 | - $type = $values['type']; |
|
35 | - } else { |
|
36 | - $type = 0; |
|
37 | - } |
|
38 | - if (isset($values['content'])) { |
|
39 | - $content = $values['content']; |
|
40 | - } else { |
|
41 | - $content = ''; |
|
42 | - } |
|
43 | - if (isset($values['changes'])) { |
|
44 | - $changes = $values['changes']; |
|
45 | - } else { |
|
46 | - $changes = ''; |
|
47 | - } |
|
48 | - $navigator_info = api_get_navigator(); |
|
49 | - |
|
50 | - if ($navigator_info['name']=='Internet Explorer' && $navigator_info['version']=='6') { |
|
51 | - if (isset($values['preview'])) { |
|
52 | - $submit ='preview'; |
|
53 | - } elseif (isset($values['save'])) { |
|
54 | - $submit ='save'; |
|
55 | - } elseif (isset($values['back'])) { |
|
56 | - $submit ='back'; |
|
57 | - } |
|
58 | - } else { |
|
59 | - $submit = $values['send']; |
|
60 | - } |
|
61 | - |
|
62 | - $default['content'] = $content; |
|
63 | - if (isset($values['language'])) { |
|
64 | - if ($submit == 'back') { |
|
65 | - header('Location: legal_add.php'); |
|
66 | - exit; |
|
67 | - } elseif ($submit == 'save') { |
|
68 | - $insert_result = LegalManager::add($lang, $content, $type, $changes); |
|
69 | - if ($insert_result ) { |
|
70 | - $message = get_lang('TermAndConditionSaved'); |
|
71 | - } else { |
|
72 | - $message = get_lang('TermAndConditionNotSaved'); |
|
73 | - } |
|
74 | - Security::clear_token(); |
|
75 | - $tok = Security::get_token(); |
|
76 | - header('Location: legal_list.php?action=show_message&message='.urlencode($message).'&sec_token='.$tok); |
|
77 | - exit(); |
|
78 | - } elseif ($submit=='preview') { |
|
79 | - $defaults['type'] = $type; |
|
80 | - $defaults['content'] = $content; |
|
81 | - $defaults['changes'] = $changes; |
|
82 | - $term_preview = $defaults; |
|
83 | - $term_preview['type'] = intval($_POST['type']); |
|
84 | - } else { |
|
85 | - $my_lang = $_POST['language']; |
|
86 | - if (isset($_POST['language'])){ |
|
87 | - $all_langs = api_get_languages(); |
|
88 | - if (in_array($my_lang, $all_langs['folder'])){ |
|
89 | - $language = api_get_language_id($my_lang); |
|
90 | - $term_preview = LegalManager::get_last_condition($language); |
|
91 | - $defaults = $term_preview; |
|
92 | - if (!$term_preview) { |
|
93 | - // there are not terms and conditions |
|
94 | - $term_preview['type']=-1; |
|
95 | - $defaults['type']=0; |
|
96 | - } |
|
97 | - } |
|
98 | - } |
|
99 | - } |
|
100 | - } |
|
101 | - } |
|
26 | + $check = Security::check_token('post'); |
|
27 | + if ($check) { |
|
28 | + $values = $form->getSubmitValues(); |
|
29 | + $lang = $values['language']; |
|
30 | + //language id |
|
31 | + $lang = api_get_language_id($lang); |
|
32 | + |
|
33 | + if (isset($values['type'])) { |
|
34 | + $type = $values['type']; |
|
35 | + } else { |
|
36 | + $type = 0; |
|
37 | + } |
|
38 | + if (isset($values['content'])) { |
|
39 | + $content = $values['content']; |
|
40 | + } else { |
|
41 | + $content = ''; |
|
42 | + } |
|
43 | + if (isset($values['changes'])) { |
|
44 | + $changes = $values['changes']; |
|
45 | + } else { |
|
46 | + $changes = ''; |
|
47 | + } |
|
48 | + $navigator_info = api_get_navigator(); |
|
49 | + |
|
50 | + if ($navigator_info['name']=='Internet Explorer' && $navigator_info['version']=='6') { |
|
51 | + if (isset($values['preview'])) { |
|
52 | + $submit ='preview'; |
|
53 | + } elseif (isset($values['save'])) { |
|
54 | + $submit ='save'; |
|
55 | + } elseif (isset($values['back'])) { |
|
56 | + $submit ='back'; |
|
57 | + } |
|
58 | + } else { |
|
59 | + $submit = $values['send']; |
|
60 | + } |
|
61 | + |
|
62 | + $default['content'] = $content; |
|
63 | + if (isset($values['language'])) { |
|
64 | + if ($submit == 'back') { |
|
65 | + header('Location: legal_add.php'); |
|
66 | + exit; |
|
67 | + } elseif ($submit == 'save') { |
|
68 | + $insert_result = LegalManager::add($lang, $content, $type, $changes); |
|
69 | + if ($insert_result ) { |
|
70 | + $message = get_lang('TermAndConditionSaved'); |
|
71 | + } else { |
|
72 | + $message = get_lang('TermAndConditionNotSaved'); |
|
73 | + } |
|
74 | + Security::clear_token(); |
|
75 | + $tok = Security::get_token(); |
|
76 | + header('Location: legal_list.php?action=show_message&message='.urlencode($message).'&sec_token='.$tok); |
|
77 | + exit(); |
|
78 | + } elseif ($submit=='preview') { |
|
79 | + $defaults['type'] = $type; |
|
80 | + $defaults['content'] = $content; |
|
81 | + $defaults['changes'] = $changes; |
|
82 | + $term_preview = $defaults; |
|
83 | + $term_preview['type'] = intval($_POST['type']); |
|
84 | + } else { |
|
85 | + $my_lang = $_POST['language']; |
|
86 | + if (isset($_POST['language'])){ |
|
87 | + $all_langs = api_get_languages(); |
|
88 | + if (in_array($my_lang, $all_langs['folder'])){ |
|
89 | + $language = api_get_language_id($my_lang); |
|
90 | + $term_preview = LegalManager::get_last_condition($language); |
|
91 | + $defaults = $term_preview; |
|
92 | + if (!$term_preview) { |
|
93 | + // there are not terms and conditions |
|
94 | + $term_preview['type']=-1; |
|
95 | + $defaults['type']=0; |
|
96 | + } |
|
97 | + } |
|
98 | + } |
|
99 | + } |
|
100 | + } |
|
101 | + } |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | $form->setDefaults($defaults); |
105 | 105 | |
106 | 106 | if (isset($_POST['send'])) { |
107 | - Security::clear_token(); |
|
107 | + Security::clear_token(); |
|
108 | 108 | } |
109 | 109 | $token = Security::get_token(); |
110 | 110 | |
@@ -115,34 +115,34 @@ discard block |
||
115 | 115 | |
116 | 116 | if (isset($_POST['language'])) { |
117 | 117 | |
118 | - $form->addElement('static', Security::remove_XSS($_POST['language'])); |
|
119 | - $form->addElement('hidden', 'language',Security::remove_XSS($_POST['language'])); |
|
120 | - $form->addHtmlEditor('content', get_lang('Content'), true, false, array('ToolbarSet' => 'terms_and_conditions', 'Width' => '100%', 'Height' => '250')); |
|
118 | + $form->addElement('static', Security::remove_XSS($_POST['language'])); |
|
119 | + $form->addElement('hidden', 'language',Security::remove_XSS($_POST['language'])); |
|
120 | + $form->addHtmlEditor('content', get_lang('Content'), true, false, array('ToolbarSet' => 'terms_and_conditions', 'Width' => '100%', 'Height' => '250')); |
|
121 | 121 | |
122 | - $form->addElement('radio', 'type', '', get_lang('HTMLText') ,'0'); |
|
123 | - $form->addElement('radio', 'type', '', get_lang('PageLink') ,'1'); |
|
124 | - $form->addElement('textarea', 'changes', get_lang('ExplainChanges'),array('width'=>'20')); |
|
122 | + $form->addElement('radio', 'type', '', get_lang('HTMLText') ,'0'); |
|
123 | + $form->addElement('radio', 'type', '', get_lang('PageLink') ,'1'); |
|
124 | + $form->addElement('textarea', 'changes', get_lang('ExplainChanges'),array('width'=>'20')); |
|
125 | 125 | |
126 | - $preview = LegalManager::show_last_condition($term_preview); |
|
126 | + $preview = LegalManager::show_last_condition($term_preview); |
|
127 | 127 | |
128 | - if ($term_preview['type']!=-1) { |
|
129 | - $form->addElement('label', get_lang('Preview'), $preview); |
|
130 | - } |
|
128 | + if ($term_preview['type']!=-1) { |
|
129 | + $form->addElement('label', get_lang('Preview'), $preview); |
|
130 | + } |
|
131 | 131 | |
132 | - // Submit & preview button |
|
132 | + // Submit & preview button |
|
133 | 133 | $navigator_info = api_get_navigator(); |
134 | 134 | |
135 | 135 | //ie6 fix |
136 | - if ($navigator_info['name']=='Internet Explorer' && $navigator_info['version']=='6') { |
|
137 | - $buttons = '<div class="row" align="center"> |
|
136 | + if ($navigator_info['name']=='Internet Explorer' && $navigator_info['version']=='6') { |
|
137 | + $buttons = '<div class="row" align="center"> |
|
138 | 138 | <div class="formw"> |
139 | 139 | <input type="submit" name="back" value="'.get_lang('Back').'"/> |
140 | 140 | <input type="submit" name="preview" value="'.get_lang('Preview').'"/> |
141 | 141 | <input type="submit" name="save" value="'.get_lang('Save').'"/> |
142 | 142 | </div> |
143 | 143 | </div>'; |
144 | - $form->addElement('html',$buttons); |
|
145 | - } else { |
|
144 | + $form->addElement('html',$buttons); |
|
145 | + } else { |
|
146 | 146 | $buttons = '<div class="row" align="center"> |
147 | 147 | <div class="formw"> |
148 | 148 | <button type="submit" class="back" name="send" value="back">'.get_lang('Back').'</button> |
@@ -150,11 +150,11 @@ discard block |
||
150 | 150 | <button type="submit" class="save" name="send" value="save">'.get_lang('Save').'</button> |
151 | 151 | </div> |
152 | 152 | </div>'; |
153 | - $form->addElement('html',$buttons); |
|
154 | - } |
|
153 | + $form->addElement('html',$buttons); |
|
154 | + } |
|
155 | 155 | } else { |
156 | - $form->addElement('select_language', 'language', get_lang('Language'),null,array()); |
|
157 | - $form->addElement('button', 'send', get_lang('Load')); |
|
156 | + $form->addElement('select_language', 'language', get_lang('Language'),null,array()); |
|
157 | + $form->addElement('button', 'send', get_lang('Load')); |
|
158 | 158 | |
159 | 159 | } |
160 | 160 | |
@@ -176,11 +176,11 @@ discard block |
||
176 | 176 | echo '</div>'; |
177 | 177 | |
178 | 178 | if (isset ($_GET['action'])) { |
179 | - switch ($_GET['action']) { |
|
180 | - case 'show_message' : |
|
181 | - Display :: display_normal_message(stripslashes($_GET['message'])); |
|
182 | - break; |
|
183 | - } |
|
179 | + switch ($_GET['action']) { |
|
180 | + case 'show_message' : |
|
181 | + Display :: display_normal_message(stripslashes($_GET['message'])); |
|
182 | + break; |
|
183 | + } |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | $form->setDefaults($defaults); |
@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | if ($form->validate()) { |
26 | 26 | $check = Security::check_token('post'); |
27 | 27 | if ($check) { |
28 | - $values = $form->getSubmitValues(); |
|
29 | - $lang = $values['language']; |
|
28 | + $values = $form->getSubmitValues(); |
|
29 | + $lang = $values['language']; |
|
30 | 30 | //language id |
31 | 31 | $lang = api_get_language_id($lang); |
32 | 32 | |
33 | 33 | if (isset($values['type'])) { |
34 | - $type = $values['type']; |
|
34 | + $type = $values['type']; |
|
35 | 35 | } else { |
36 | 36 | $type = 0; |
37 | 37 | } |
@@ -47,13 +47,13 @@ discard block |
||
47 | 47 | } |
48 | 48 | $navigator_info = api_get_navigator(); |
49 | 49 | |
50 | - if ($navigator_info['name']=='Internet Explorer' && $navigator_info['version']=='6') { |
|
50 | + if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') { |
|
51 | 51 | if (isset($values['preview'])) { |
52 | - $submit ='preview'; |
|
52 | + $submit = 'preview'; |
|
53 | 53 | } elseif (isset($values['save'])) { |
54 | - $submit ='save'; |
|
54 | + $submit = 'save'; |
|
55 | 55 | } elseif (isset($values['back'])) { |
56 | - $submit ='back'; |
|
56 | + $submit = 'back'; |
|
57 | 57 | } |
58 | 58 | } else { |
59 | 59 | $submit = $values['send']; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | exit; |
67 | 67 | } elseif ($submit == 'save') { |
68 | 68 | $insert_result = LegalManager::add($lang, $content, $type, $changes); |
69 | - if ($insert_result ) { |
|
69 | + if ($insert_result) { |
|
70 | 70 | $message = get_lang('TermAndConditionSaved'); |
71 | 71 | } else { |
72 | 72 | $message = get_lang('TermAndConditionNotSaved'); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $tok = Security::get_token(); |
76 | 76 | header('Location: legal_list.php?action=show_message&message='.urlencode($message).'&sec_token='.$tok); |
77 | 77 | exit(); |
78 | - } elseif ($submit=='preview') { |
|
78 | + } elseif ($submit == 'preview') { |
|
79 | 79 | $defaults['type'] = $type; |
80 | 80 | $defaults['content'] = $content; |
81 | 81 | $defaults['changes'] = $changes; |
@@ -83,16 +83,16 @@ discard block |
||
83 | 83 | $term_preview['type'] = intval($_POST['type']); |
84 | 84 | } else { |
85 | 85 | $my_lang = $_POST['language']; |
86 | - if (isset($_POST['language'])){ |
|
86 | + if (isset($_POST['language'])) { |
|
87 | 87 | $all_langs = api_get_languages(); |
88 | - if (in_array($my_lang, $all_langs['folder'])){ |
|
88 | + if (in_array($my_lang, $all_langs['folder'])) { |
|
89 | 89 | $language = api_get_language_id($my_lang); |
90 | 90 | $term_preview = LegalManager::get_last_condition($language); |
91 | 91 | $defaults = $term_preview; |
92 | 92 | if (!$term_preview) { |
93 | 93 | // there are not terms and conditions |
94 | - $term_preview['type']=-1; |
|
95 | - $defaults['type']=0; |
|
94 | + $term_preview['type'] = -1; |
|
95 | + $defaults['type'] = 0; |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | } |
109 | 109 | $token = Security::get_token(); |
110 | 110 | |
111 | -$form->addElement('hidden','sec_token'); |
|
111 | +$form->addElement('hidden', 'sec_token'); |
|
112 | 112 | //$form->setConstants(array('sec_token' => $token)); |
113 | 113 | $defaults['sec_token'] = $token; |
114 | 114 | $form->addElement('header', get_lang('DisplayTermsConditions')); |
@@ -116,24 +116,24 @@ discard block |
||
116 | 116 | if (isset($_POST['language'])) { |
117 | 117 | |
118 | 118 | $form->addElement('static', Security::remove_XSS($_POST['language'])); |
119 | - $form->addElement('hidden', 'language',Security::remove_XSS($_POST['language'])); |
|
119 | + $form->addElement('hidden', 'language', Security::remove_XSS($_POST['language'])); |
|
120 | 120 | $form->addHtmlEditor('content', get_lang('Content'), true, false, array('ToolbarSet' => 'terms_and_conditions', 'Width' => '100%', 'Height' => '250')); |
121 | 121 | |
122 | - $form->addElement('radio', 'type', '', get_lang('HTMLText') ,'0'); |
|
123 | - $form->addElement('radio', 'type', '', get_lang('PageLink') ,'1'); |
|
124 | - $form->addElement('textarea', 'changes', get_lang('ExplainChanges'),array('width'=>'20')); |
|
122 | + $form->addElement('radio', 'type', '', get_lang('HTMLText'), '0'); |
|
123 | + $form->addElement('radio', 'type', '', get_lang('PageLink'), '1'); |
|
124 | + $form->addElement('textarea', 'changes', get_lang('ExplainChanges'), array('width'=>'20')); |
|
125 | 125 | |
126 | 126 | $preview = LegalManager::show_last_condition($term_preview); |
127 | 127 | |
128 | - if ($term_preview['type']!=-1) { |
|
129 | - $form->addElement('label', get_lang('Preview'), $preview); |
|
128 | + if ($term_preview['type'] != -1) { |
|
129 | + $form->addElement('label', get_lang('Preview'), $preview); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | // Submit & preview button |
133 | 133 | $navigator_info = api_get_navigator(); |
134 | 134 | |
135 | 135 | //ie6 fix |
136 | - if ($navigator_info['name']=='Internet Explorer' && $navigator_info['version']=='6') { |
|
136 | + if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') { |
|
137 | 137 | $buttons = '<div class="row" align="center"> |
138 | 138 | <div class="formw"> |
139 | 139 | <input type="submit" name="back" value="'.get_lang('Back').'"/> |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | <input type="submit" name="save" value="'.get_lang('Save').'"/> |
142 | 142 | </div> |
143 | 143 | </div>'; |
144 | - $form->addElement('html',$buttons); |
|
144 | + $form->addElement('html', $buttons); |
|
145 | 145 | } else { |
146 | 146 | $buttons = '<div class="row" align="center"> |
147 | 147 | <div class="formw"> |
@@ -150,16 +150,16 @@ discard block |
||
150 | 150 | <button type="submit" class="save" name="send" value="save">'.get_lang('Save').'</button> |
151 | 151 | </div> |
152 | 152 | </div>'; |
153 | - $form->addElement('html',$buttons); |
|
153 | + $form->addElement('html', $buttons); |
|
154 | 154 | } |
155 | 155 | } else { |
156 | - $form->addElement('select_language', 'language', get_lang('Language'),null,array()); |
|
156 | + $form->addElement('select_language', 'language', get_lang('Language'), null, array()); |
|
157 | 157 | $form->addElement('button', 'send', get_lang('Load')); |
158 | 158 | |
159 | 159 | } |
160 | 160 | |
161 | 161 | $tool_name = get_lang('AddTermsAndConditions'); |
162 | -$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin')); |
|
162 | +$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin')); |
|
163 | 163 | Display :: display_header($tool_name); |
164 | 164 | |
165 | 165 | echo '<script> |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | |
173 | 173 | // action menu |
174 | 174 | echo '<div class="actions">'; |
175 | -echo '<a href="'.api_get_path(WEB_CODE_PATH).'admin/legal_list.php">'.Display::return_icon('search.gif',get_lang('EditTermsAndConditions'),'').get_lang('AllVersions').'</a>'; |
|
175 | +echo '<a href="'.api_get_path(WEB_CODE_PATH).'admin/legal_list.php">'.Display::return_icon('search.gif', get_lang('EditTermsAndConditions'), '').get_lang('AllVersions').'</a>'; |
|
176 | 176 | echo '</div>'; |
177 | 177 | |
178 | 178 | if (isset ($_GET['action'])) { |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $message = null; |
29 | 29 | $content = null; |
30 | 30 | |
31 | -$currentUrl = api_get_self() . "?name=$pluginName"; |
|
31 | +$currentUrl = api_get_self()."?name=$pluginName"; |
|
32 | 32 | |
33 | 33 | if (isset($pluginInfo['settings_form'])) { |
34 | 34 | $form = $pluginInfo['settings_form']; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | foreach ($values as $key => $value) { |
66 | 66 | api_add_setting( |
67 | - $value, Database::escape_string($pluginName . '_' . $key), |
|
67 | + $value, Database::escape_string($pluginName.'_'.$key), |
|
68 | 68 | $pluginName, |
69 | 69 | 'setting', |
70 | 70 | 'Plugins', |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | $interbreadcrumb[] = array( |
102 | - 'url' => api_get_path(WEB_CODE_PATH) . 'admin/index.php', |
|
102 | + 'url' => api_get_path(WEB_CODE_PATH).'admin/index.php', |
|
103 | 103 | 'name' => get_lang('PlatformAdmin') |
104 | 104 | ); |
105 | 105 | $interbreadcrumb[] = array( |
106 | - 'url' => api_get_path(WEB_CODE_PATH) . 'admin/settings.php?category=Plugins', |
|
106 | + 'url' => api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins', |
|
107 | 107 | 'name' => get_lang('Plugins') |
108 | 108 | ); |
109 | 109 |
@@ -114,7 +114,7 @@ |
||
114 | 114 | $from = intval($from); |
115 | 115 | $number_of_items = intval($number_of_items); |
116 | 116 | $column = intval($column); |
117 | - $direction = !in_array(strtolower(trim($direction)), ['asc','desc']) ? 'asc' : $direction; |
|
117 | + $direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction; |
|
118 | 118 | |
119 | 119 | $sql = "SELECT |
120 | 120 | id AS col0, |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | |
10 | 10 | api_protect_admin_script(); |
11 | 11 | |
12 | -$new_language = Security::remove_XSS($_REQUEST['new_language']); |
|
13 | -$language_variable = Security::remove_XSS($_REQUEST['variable_language']); |
|
14 | -$file_id = intval($_REQUEST['file_id']); |
|
12 | +$new_language = Security::remove_XSS($_REQUEST['new_language']); |
|
13 | +$language_variable = Security::remove_XSS($_REQUEST['variable_language']); |
|
14 | +$file_id = intval($_REQUEST['file_id']); |
|
15 | 15 | /** |
16 | 16 | * Code |
17 | 17 | */ |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | |
28 | 28 | //update variable language |
29 | 29 | // Replace double quotes to avoid parse errors |
30 | - $new_language = str_replace('"', '\"',$new_language); |
|
30 | + $new_language = str_replace('"', '\"', $new_language); |
|
31 | 31 | // Replace new line signs to avoid parse errors - see #6773 |
32 | - $new_language = str_replace("\n","\\n",$new_language); |
|
33 | - $all_file_of_directory[$language_variable]="\"".$new_language."\";"; |
|
32 | + $new_language = str_replace("\n", "\\n", $new_language); |
|
33 | + $all_file_of_directory[$language_variable] = "\"".$new_language."\";"; |
|
34 | 34 | $result_array = array(); |
35 | 35 | |
36 | 36 | foreach ($all_file_of_directory as $key_value=>$value_info) { |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | if (!empty($result_array)) { |
41 | 41 | foreach ($result_array as $key => $result) { |
42 | 42 | if ($result == false) { |
43 | - $variables_with_problems .=$key.' <br />'; |
|
43 | + $variables_with_problems .= $key.' <br />'; |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | } |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | <select name="firstLetterClass" onchange="javascript:document.formulaire.formSent.value='2'; document.formulaire.submit();"> |
91 | 91 | <option value="">--</option> |
92 | 92 | <?php |
93 | - echo Display::get_alphabet_options($first_letter_class); |
|
94 | - ?> |
|
93 | + echo Display::get_alphabet_options($first_letter_class); |
|
94 | + ?> |
|
95 | 95 | </select> |
96 | 96 | </td> |
97 | 97 | <td width="20%"> </td> |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | <select name="firstLetterCourse" onchange="javascript:document.formulaire.formSent.value='2'; document.formulaire.submit();"> |
103 | 103 | <option value="">--</option> |
104 | 104 | <?php |
105 | - echo Display::get_alphabet_options($first_letter_course); |
|
106 | - ?> |
|
105 | + echo Display::get_alphabet_options($first_letter_course); |
|
106 | + ?> |
|
107 | 107 | </select> |
108 | 108 | </td> |
109 | 109 | </tr> |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | $cidReset = true; |
10 | 10 | |
11 | 11 | require_once '../inc/global.inc.php'; |
12 | -$this_section=SECTION_PLATFORM_ADMIN; |
|
12 | +$this_section = SECTION_PLATFORM_ADMIN; |
|
13 | 13 | |
14 | 14 | api_protect_admin_script(); |
15 | 15 | |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $error_message = ''; |
19 | 19 | $first_letter_class = ''; |
20 | 20 | $first_letter_course = ''; |
21 | -$courses = array (); |
|
21 | +$courses = array(); |
|
22 | 22 | $classes = array(); |
23 | 23 | |
24 | 24 | $tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | $tool_name = get_lang('AddClassesToACourse'); |
28 | 28 | |
29 | -$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin')); |
|
29 | +$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin')); |
|
30 | 30 | |
31 | 31 | Display :: display_header($tool_name); |
32 | 32 | |
@@ -68,10 +68,10 @@ discard block |
||
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
71 | -$sql = "SELECT id,name FROM $tbl_class WHERE name LIKE '".$first_letter_class."%' ORDER BY ". (count($classes) > 0 ? "(id IN('".implode("','", $classes)."')) DESC," : "")." name"; |
|
71 | +$sql = "SELECT id,name FROM $tbl_class WHERE name LIKE '".$first_letter_class."%' ORDER BY ".(count($classes) > 0 ? "(id IN('".implode("','", $classes)."')) DESC," : "")." name"; |
|
72 | 72 | $result = Database::query($sql); |
73 | 73 | $db_classes = Database::store_result($result); |
74 | -$sql = "SELECT code,visual_code,title FROM $tbl_course WHERE visual_code LIKE '".$first_letter_course."%' ORDER BY ". (count($courses) > 0 ? "(code IN('".implode("','", $courses)."')) DESC," : "")." visual_code"; |
|
74 | +$sql = "SELECT code,visual_code,title FROM $tbl_course WHERE visual_code LIKE '".$first_letter_course."%' ORDER BY ".(count($courses) > 0 ? "(code IN('".implode("','", $courses)."')) DESC," : "")." visual_code"; |
|
75 | 75 | $result = Database::query($sql); |
76 | 76 | $db_courses = Database::store_result($result); |
77 | 77 | if (!empty ($error_message)) |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | foreach ($db_classes as $class) |
115 | 115 | { |
116 | 116 | ?> |
117 | - <option value="<?php echo $class['id']; ?>" <?php if(in_array($class['id'],$classes)) echo 'selected="selected"'; ?>><?php echo $class['name']; ?></option> |
|
117 | + <option value="<?php echo $class['id']; ?>" <?php if (in_array($class['id'], $classes)) echo 'selected="selected"'; ?>><?php echo $class['name']; ?></option> |
|
118 | 118 | <?php |
119 | 119 | } |
120 | 120 | ?> |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | foreach ($db_courses as $course) |
132 | 132 | { |
133 | 133 | ?> |
134 | - <option value="<?php echo $course['code']; ?>" <?php if(in_array($course['code'],$courses)) echo 'selected="selected"'; ?>><?php echo '('.$course['visual_code'].') '.$course['title']; ?></option> |
|
134 | + <option value="<?php echo $course['code']; ?>" <?php if (in_array($course['code'], $courses)) echo 'selected="selected"'; ?>><?php echo '('.$course['visual_code'].') '.$course['title']; ?></option> |
|
135 | 135 | <?php |
136 | 136 | } |
137 | 137 | ?> |
@@ -46,14 +46,15 @@ discard block |
||
46 | 46 | if (count($classes) == 0 || count($courses) == 0) |
47 | 47 | { |
48 | 48 | Display::display_error_message(get_lang('AtLeastOneClassAndOneCourse')); |
49 | - } |
|
50 | - elseif (api_substr($_POST['formSubmit'], -2) == '>>') // add classes to courses |
|
49 | + } elseif (api_substr($_POST['formSubmit'], -2) == '>>') { |
|
50 | + // add classes to courses |
|
51 | 51 | { |
52 | 52 | foreach ($courses as $course_code) |
53 | 53 | { |
54 | 54 | foreach ($classes as $class_id) |
55 | 55 | { |
56 | 56 | ClassManager :: subscribe_to_course($class_id, $course_code); |
57 | + } |
|
57 | 58 | } |
58 | 59 | } |
59 | 60 | Display::display_normal_message(get_lang('ClassesSubscribed')); |
@@ -114,7 +115,10 @@ discard block |
||
114 | 115 | foreach ($db_classes as $class) |
115 | 116 | { |
116 | 117 | ?> |
117 | - <option value="<?php echo $class['id']; ?>" <?php if(in_array($class['id'],$classes)) echo 'selected="selected"'; ?>><?php echo $class['name']; ?></option> |
|
118 | + <option value="<?php echo $class['id']; ?>" <?php if(in_array($class['id'],$classes)) { |
|
119 | + echo 'selected="selected"'; |
|
120 | +} |
|
121 | +?>><?php echo $class['name']; ?></option> |
|
118 | 122 | <?php |
119 | 123 | } |
120 | 124 | ?> |
@@ -131,7 +135,10 @@ discard block |
||
131 | 135 | foreach ($db_courses as $course) |
132 | 136 | { |
133 | 137 | ?> |
134 | - <option value="<?php echo $course['code']; ?>" <?php if(in_array($course['code'],$courses)) echo 'selected="selected"'; ?>><?php echo '('.$course['visual_code'].') '.$course['title']; ?></option> |
|
138 | + <option value="<?php echo $course['code']; ?>" <?php if(in_array($course['code'],$courses)) { |
|
139 | + echo 'selected="selected"'; |
|
140 | +} |
|
141 | +?>><?php echo '('.$course['visual_code'].') '.$course['title']; ?></option> |
|
135 | 142 | <?php |
136 | 143 | } |
137 | 144 | ?> |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | |
68 | 68 | //Column config |
69 | 69 | $column_model = array( |
70 | - array('name'=>'subject', 'index'=>'subject', 'width'=>'80', 'align'=>'left'), |
|
70 | + array('name'=>'subject', 'index'=>'subject', 'width'=>'80', 'align'=>'left'), |
|
71 | 71 | // array('name'=>'message', 'index'=>'message', 'width'=>'500', 'align'=>'left','sortable'=>'false'), |
72 | - array('name'=>'event_type_name', 'index'=>'event_type_name', 'width'=>'80', 'align'=>'left'), |
|
73 | - array('name'=>'language_id', 'index'=>'language_id', 'width'=>'80', 'align'=>'left'), |
|
74 | - array('name'=>'activated', 'index'=>'activated', 'width'=>'80', 'align'=>'left'), |
|
75 | - array('name'=>'actions', 'index'=>'actions', 'width'=>'100') |
|
72 | + array('name'=>'event_type_name', 'index'=>'event_type_name', 'width'=>'80', 'align'=>'left'), |
|
73 | + array('name'=>'language_id', 'index'=>'language_id', 'width'=>'80', 'align'=>'left'), |
|
74 | + array('name'=>'activated', 'index'=>'activated', 'width'=>'80', 'align'=>'left'), |
|
75 | + array('name'=>'actions', 'index'=>'actions', 'width'=>'100') |
|
76 | 76 | ); |
77 | 77 | //Autowidth |
78 | 78 | $extra_params['autowidth'] = 'true'; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $htmlHeadXtra[] = api_get_jqgrid_js(); |
83 | 83 | $htmlHeadXtra[] = '<script> |
84 | 84 | $(function() { |
85 | - '.Display::grid_js('event_email_template', $url,$columns,$column_model,$extra_params, array(), $action_links,true).' |
|
85 | + '.Display::grid_js('event_email_template', $url, $columns, $column_model, $extra_params, array(), $action_links, true).' |
|
86 | 86 | }); |
87 | 87 | </script>'; |
88 | 88 |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | public function deleteAction($id) { |
34 | - $event_email_template = new EventEmailTemplate(); |
|
34 | + $event_email_template = new EventEmailTemplate(); |
|
35 | 35 | return $event_email_template->delete($id); |
36 | 36 | } |
37 | 37 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | array('name'=>'language_id', 'index'=>'language_id', 'width'=>'80', 'align'=>'left'), |
74 | 74 | array('name'=>'activated', 'index'=>'activated', 'width'=>'80', 'align'=>'left'), |
75 | 75 | array('name'=>'actions', 'index'=>'actions', 'width'=>'100') |
76 | - ); |
|
76 | + ); |
|
77 | 77 | //Autowidth |
78 | 78 | $extra_params['autowidth'] = 'true'; |
79 | 79 | //height auto |
@@ -90,26 +90,26 @@ |
||
90 | 90 | { |
91 | 91 | $baseDir = api_get_path(SYS_ARCHIVE_PATH); |
92 | 92 | $uploadPath = 'pdfimport/'; |
93 | - $errors = array (); |
|
93 | + $errors = array(); |
|
94 | 94 | if (!is_dir($baseDir.$uploadPath)) { |
95 | 95 | @mkdir($baseDir.$uploadPath); |
96 | 96 | } |
97 | - if (!unzip_uploaded_file($_FILES['import_file'], $uploadPath, $baseDir, 1024*1024*1024)) { |
|
97 | + if (!unzip_uploaded_file($_FILES['import_file'], $uploadPath, $baseDir, 1024 * 1024 * 1024)) { |
|
98 | 98 | error_log('Could not unzip uploaded file in '.__FILE__.', line '.__LINE__); |
99 | 99 | return $errors; |
100 | 100 | } |
101 | 101 | $list = scandir($baseDir.$uploadPath); |
102 | 102 | $i = 0; |
103 | 103 | foreach ($list as $file) { |
104 | - if (substr($file,0,1) == '.' or !is_file($baseDir.$uploadPath.$file)) { |
|
104 | + if (substr($file, 0, 1) == '.' or !is_file($baseDir.$uploadPath.$file)) { |
|
105 | 105 | continue; |
106 | 106 | } |
107 | - $parts = preg_split('/_/',$file); |
|
107 | + $parts = preg_split('/_/', $file); |
|
108 | 108 | $course = api_get_course_info($parts[0]); |
109 | 109 | if (count($course) > 0) { |
110 | 110 | // Build file info because handle_uploaded_document() needs it (name, type, size, tmp_name) |
111 | 111 | $fileSize = filesize($baseDir.$uploadPath.$file); |
112 | - $docId = add_document($course, $subDir.'/'.$file, 'file', $fileSize, $parts[1].' '.substr($parts[2],0,-4)); |
|
112 | + $docId = add_document($course, $subDir.'/'.$file, 'file', $fileSize, $parts[1].' '.substr($parts[2], 0, -4)); |
|
113 | 113 | if ($docId > 0) { |
114 | 114 | if (!is_file($baseDir.$uploadPath.$file)) { |
115 | 115 | error_log($baseDir.$uploadPath.$file.' does not exists in '.__FILE__); |
@@ -157,27 +157,27 @@ discard block |
||
157 | 157 | $form->addElement('hidden', 'user_id', $user_id); |
158 | 158 | |
159 | 159 | if (api_is_western_name_order()) { |
160 | - // Firstname |
|
161 | - $form->addElement('text', 'firstname', get_lang('FirstName')); |
|
162 | - $form->applyFilter('firstname', 'html_filter'); |
|
163 | - $form->applyFilter('firstname', 'trim'); |
|
164 | - $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required'); |
|
165 | - // Lastname |
|
166 | - $form->addElement('text', 'lastname', get_lang('LastName')); |
|
167 | - $form->applyFilter('lastname', 'html_filter'); |
|
168 | - $form->applyFilter('lastname', 'trim'); |
|
169 | - $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required'); |
|
160 | + // Firstname |
|
161 | + $form->addElement('text', 'firstname', get_lang('FirstName')); |
|
162 | + $form->applyFilter('firstname', 'html_filter'); |
|
163 | + $form->applyFilter('firstname', 'trim'); |
|
164 | + $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required'); |
|
165 | + // Lastname |
|
166 | + $form->addElement('text', 'lastname', get_lang('LastName')); |
|
167 | + $form->applyFilter('lastname', 'html_filter'); |
|
168 | + $form->applyFilter('lastname', 'trim'); |
|
169 | + $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required'); |
|
170 | 170 | } else { |
171 | - // Lastname |
|
172 | - $form->addElement('text', 'lastname', get_lang('LastName')); |
|
173 | - $form->applyFilter('lastname', 'html_filter'); |
|
174 | - $form->applyFilter('lastname', 'trim'); |
|
175 | - $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required'); |
|
176 | - // Firstname |
|
177 | - $form->addElement('text', 'firstname', get_lang('FirstName')); |
|
178 | - $form->applyFilter('firstname', 'html_filter'); |
|
179 | - $form->applyFilter('firstname', 'trim'); |
|
180 | - $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required'); |
|
171 | + // Lastname |
|
172 | + $form->addElement('text', 'lastname', get_lang('LastName')); |
|
173 | + $form->applyFilter('lastname', 'html_filter'); |
|
174 | + $form->applyFilter('lastname', 'trim'); |
|
175 | + $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required'); |
|
176 | + // Firstname |
|
177 | + $form->addElement('text', 'firstname', get_lang('FirstName')); |
|
178 | + $form->applyFilter('firstname', 'html_filter'); |
|
179 | + $form->applyFilter('firstname', 'trim'); |
|
180 | + $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required'); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | // Official code |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | |
200 | 200 | // OpenID |
201 | 201 | if (api_get_setting('openid_authentication') == 'true') { |
202 | - $form->addElement('text', 'openid', get_lang('OpenIDURL')); |
|
202 | + $form->addElement('text', 'openid', get_lang('OpenIDURL')); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | // Phone |
@@ -225,18 +225,18 @@ discard block |
||
225 | 225 | $form->addHidden('cropResult', ''); |
226 | 226 | |
227 | 227 | $form->addRule( |
228 | - 'picture', |
|
229 | - get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', |
|
230 | - 'filetype', |
|
231 | - $allowed_picture_types |
|
228 | + 'picture', |
|
229 | + get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', |
|
230 | + 'filetype', |
|
231 | + $allowed_picture_types |
|
232 | 232 | ); |
233 | 233 | if (strlen($user_data['picture_uri']) > 0) { |
234 | - $form->addElement('checkbox', 'delete_picture', '', get_lang('DelImage')); |
|
234 | + $form->addElement('checkbox', 'delete_picture', '', get_lang('DelImage')); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | // Username |
238 | 238 | if (api_get_setting('login_is_email') != 'true') { |
239 | - $form->addElement('text', 'username', get_lang('LoginName'), array('maxlength' => USERNAME_MAX_LENGTH)); |
|
239 | + $form->addElement('text', 'username', get_lang('LoginName'), array('maxlength' => USERNAME_MAX_LENGTH)); |
|
240 | 240 | $form->addRule('username', get_lang('ThisFieldIsRequired'), 'required'); |
241 | 241 | $form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string)USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH); |
242 | 242 | $form->addRule('username', get_lang('OnlyLettersAndNumbersAllowed'), 'username'); |
@@ -308,15 +308,15 @@ discard block |
||
308 | 308 | |
309 | 309 | // Platform admin |
310 | 310 | if (api_is_platform_admin()) { |
311 | - $group = array(); |
|
312 | - $group[] =$form->createElement('radio', 'platform_admin', null, get_lang('Yes'), 1); |
|
313 | - $group[] =$form->createElement('radio', 'platform_admin', null, get_lang('No'), 0); |
|
311 | + $group = array(); |
|
312 | + $group[] =$form->createElement('radio', 'platform_admin', null, get_lang('Yes'), 1); |
|
313 | + $group[] =$form->createElement('radio', 'platform_admin', null, get_lang('No'), 0); |
|
314 | 314 | |
315 | - $user_data['status'] == 1 ? $display = 'block':$display = 'none'; |
|
315 | + $user_data['status'] == 1 ? $display = 'block':$display = 'none'; |
|
316 | 316 | |
317 | - $form->addElement('html', '<div id="id_platform_admin" style="display:'.$display.'">'); |
|
318 | - $form->addGroup($group, 'admin', get_lang('PlatformAdmin'), null, false); |
|
319 | - $form->addElement('html', '</div>'); |
|
317 | + $form->addElement('html', '<div id="id_platform_admin" style="display:'.$display.'">'); |
|
318 | + $form->addGroup($group, 'admin', get_lang('PlatformAdmin'), null, false); |
|
319 | + $form->addElement('html', '</div>'); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | //Language |
@@ -334,16 +334,16 @@ discard block |
||
334 | 334 | $form->addElement('label', get_lang('RegistrationDate'), $date); |
335 | 335 | |
336 | 336 | if (!$user_data['platform_admin']) { |
337 | - // Expiration Date |
|
338 | - $form->addElement('radio', 'radio_expiration_date', get_lang('ExpirationDate'), get_lang('NeverExpires'), 0); |
|
339 | - $group = array (); |
|
340 | - $group[] = $form->createElement('radio', 'radio_expiration_date', null, get_lang('Enabled'), 1); |
|
341 | - $group[] = $form->createElement('DateTimePicker', 'expiration_date', null, array('onchange' => 'javascript: enable_expiration_date();')); |
|
342 | - $form->addGroup($group, 'max_member_group', null, '', false); |
|
343 | - |
|
344 | - // Active account or inactive account |
|
345 | - $form->addElement('radio', 'active', get_lang('ActiveAccount'), get_lang('Active'), 1); |
|
346 | - $form->addElement('radio', 'active', '', get_lang('Inactive'), 0); |
|
337 | + // Expiration Date |
|
338 | + $form->addElement('radio', 'radio_expiration_date', get_lang('ExpirationDate'), get_lang('NeverExpires'), 0); |
|
339 | + $group = array (); |
|
340 | + $group[] = $form->createElement('radio', 'radio_expiration_date', null, get_lang('Enabled'), 1); |
|
341 | + $group[] = $form->createElement('DateTimePicker', 'expiration_date', null, array('onchange' => 'javascript: enable_expiration_date();')); |
|
342 | + $form->addGroup($group, 'max_member_group', null, '', false); |
|
343 | + |
|
344 | + // Active account or inactive account |
|
345 | + $form->addElement('radio', 'active', get_lang('ActiveAccount'), get_lang('Active'), 1); |
|
346 | + $form->addElement('radio', 'active', '', get_lang('Inactive'), 0); |
|
347 | 347 | } |
348 | 348 | |
349 | 349 | // EXTRA FIELDS |
@@ -366,18 +366,18 @@ discard block |
||
366 | 366 | $expiration_date = $user_data['expiration_date']; |
367 | 367 | |
368 | 368 | if (empty($expiration_date)) { |
369 | - $user_data['radio_expiration_date'] = 0; |
|
370 | - $user_data['expiration_date'] = api_get_local_time(); |
|
369 | + $user_data['radio_expiration_date'] = 0; |
|
370 | + $user_data['expiration_date'] = api_get_local_time(); |
|
371 | 371 | } else { |
372 | - $user_data['radio_expiration_date'] = 1; |
|
373 | - $user_data['expiration_date'] = api_get_local_time($expiration_date); |
|
372 | + $user_data['radio_expiration_date'] = 1; |
|
373 | + $user_data['expiration_date'] = api_get_local_time($expiration_date); |
|
374 | 374 | } |
375 | 375 | $form->setDefaults($user_data); |
376 | 376 | |
377 | 377 | $error_drh = false; |
378 | 378 | // Validate form |
379 | 379 | if ($form->validate()) { |
380 | - $user = $form->getSubmitValues(1); |
|
380 | + $user = $form->getSubmitValues(1); |
|
381 | 381 | $reset_password = intval($user['reset_password']); |
382 | 382 | if ($reset_password == 2 && empty($user['password'])) { |
383 | 383 | Display::addFlash(Display::return_message(get_lang('PasswordIsTooShort'))); |
@@ -385,18 +385,18 @@ discard block |
||
385 | 385 | exit(); |
386 | 386 | } |
387 | 387 | |
388 | - $is_user_subscribed_in_course = CourseManager::is_user_subscribed_in_course($user['user_id']); |
|
388 | + $is_user_subscribed_in_course = CourseManager::is_user_subscribed_in_course($user['user_id']); |
|
389 | 389 | |
390 | - if ($user['status'] == DRH && $is_user_subscribed_in_course) { |
|
391 | - $error_drh = true; |
|
392 | - } else { |
|
393 | - $picture_element = $form->getElement('picture'); |
|
394 | - $picture = $picture_element->getValue(); |
|
390 | + if ($user['status'] == DRH && $is_user_subscribed_in_course) { |
|
391 | + $error_drh = true; |
|
392 | + } else { |
|
393 | + $picture_element = $form->getElement('picture'); |
|
394 | + $picture = $picture_element->getValue(); |
|
395 | 395 | |
396 | - $picture_uri = $user_data['picture_uri']; |
|
397 | - if (isset($user['delete_picture']) && $user['delete_picture']) { |
|
398 | - $picture_uri = UserManager::delete_user_picture($user_id); |
|
399 | - } elseif (!empty($picture['name'])) { |
|
396 | + $picture_uri = $user_data['picture_uri']; |
|
397 | + if (isset($user['delete_picture']) && $user['delete_picture']) { |
|
398 | + $picture_uri = UserManager::delete_user_picture($user_id); |
|
399 | + } elseif (!empty($picture['name'])) { |
|
400 | 400 | $picture_uri = UserManager::update_user_picture( |
401 | 401 | $user_id, |
402 | 402 | $_FILES['picture']['name'], |
@@ -404,30 +404,30 @@ discard block |
||
404 | 404 | $user['cropResult'] |
405 | 405 | |
406 | 406 | ); |
407 | - } |
|
407 | + } |
|
408 | 408 | |
409 | - $lastname = $user['lastname']; |
|
410 | - $firstname = $user['firstname']; |
|
409 | + $lastname = $user['lastname']; |
|
410 | + $firstname = $user['firstname']; |
|
411 | 411 | $password = $user['password']; |
412 | 412 | $auth_source = isset($user['auth_source']) ? $user['auth_source'] : $userInfo['auth_source']; |
413 | - $official_code = $user['official_code']; |
|
414 | - $email = $user['email']; |
|
415 | - $phone = $user['phone']; |
|
416 | - $username = isset($user['username']) ? $user['username'] : $userInfo['username']; |
|
417 | - $status = intval($user['status']); |
|
418 | - $platform_admin = intval($user['platform_admin']); |
|
419 | - $send_mail = intval($user['send_mail']); |
|
420 | - $reset_password = intval($user['reset_password']); |
|
421 | - $hr_dept_id = isset($user['hr_dept_id']) ? intval($user['hr_dept_id']) : null; |
|
422 | - $language = $user['language']; |
|
423 | - |
|
424 | - if ($user['radio_expiration_date'] == '1' && !$user_data['platform_admin']) { |
|
413 | + $official_code = $user['official_code']; |
|
414 | + $email = $user['email']; |
|
415 | + $phone = $user['phone']; |
|
416 | + $username = isset($user['username']) ? $user['username'] : $userInfo['username']; |
|
417 | + $status = intval($user['status']); |
|
418 | + $platform_admin = intval($user['platform_admin']); |
|
419 | + $send_mail = intval($user['send_mail']); |
|
420 | + $reset_password = intval($user['reset_password']); |
|
421 | + $hr_dept_id = isset($user['hr_dept_id']) ? intval($user['hr_dept_id']) : null; |
|
422 | + $language = $user['language']; |
|
423 | + |
|
424 | + if ($user['radio_expiration_date'] == '1' && !$user_data['platform_admin']) { |
|
425 | 425 | $expiration_date = $user['expiration_date']; |
426 | - } else { |
|
427 | - $expiration_date = null; |
|
428 | - } |
|
426 | + } else { |
|
427 | + $expiration_date = null; |
|
428 | + } |
|
429 | 429 | |
430 | - $active = $user_data['platform_admin'] ? 1 : intval($user['active']); |
|
430 | + $active = $user_data['platform_admin'] ? 1 : intval($user['active']); |
|
431 | 431 | |
432 | 432 | //If the user is set to admin the status will be overwrite by COURSEMANAGER = 1 |
433 | 433 | if ($platform_admin == 1) { |
@@ -461,31 +461,31 @@ discard block |
||
461 | 461 | $reset_password |
462 | 462 | ); |
463 | 463 | |
464 | - if (api_get_setting('openid_authentication') == 'true' && !empty($user['openid'])) { |
|
465 | - $up = UserManager::update_openid($user_id, $user['openid']); |
|
466 | - } |
|
464 | + if (api_get_setting('openid_authentication') == 'true' && !empty($user['openid'])) { |
|
465 | + $up = UserManager::update_openid($user_id, $user['openid']); |
|
466 | + } |
|
467 | 467 | $currentUserId = api_get_user_id(); |
468 | - if ($user_id != $currentUserId) { |
|
469 | - if ($platform_admin == 1) { |
|
468 | + if ($user_id != $currentUserId) { |
|
469 | + if ($platform_admin == 1) { |
|
470 | 470 | UserManager::add_user_as_admin($user_id); |
471 | - } else { |
|
471 | + } else { |
|
472 | 472 | UserManager::remove_user_admin($user_id); |
473 | - } |
|
474 | - } |
|
473 | + } |
|
474 | + } |
|
475 | 475 | |
476 | 476 | $extraFieldValue = new ExtraFieldValue('user'); |
477 | 477 | $extraFieldValue->saveFieldValues($user); |
478 | 478 | |
479 | - $tok = Security::get_token(); |
|
480 | - header('Location: user_list.php?action=show_message&message='.urlencode(get_lang('UserUpdated')).'&sec_token='.$tok); |
|
481 | - exit(); |
|
482 | - } |
|
479 | + $tok = Security::get_token(); |
|
480 | + header('Location: user_list.php?action=show_message&message='.urlencode(get_lang('UserUpdated')).'&sec_token='.$tok); |
|
481 | + exit(); |
|
482 | + } |
|
483 | 483 | } |
484 | 484 | |
485 | 485 | $message = null; |
486 | 486 | if ($error_drh) { |
487 | - $err_msg = get_lang('StatusCanNotBeChangedToHumanResourcesManager'); |
|
488 | - $message = Display::return_message($err_msg, 'error'); |
|
487 | + $err_msg = get_lang('StatusCanNotBeChangedToHumanResourcesManager'); |
|
488 | + $message = Display::return_message($err_msg, 'error'); |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | $content = null; |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | } |
69 | 69 | </script>'; |
70 | 70 | |
71 | -$htmlHeadXtra[] = '<link href="'. api_get_path(WEB_PATH) .'web/assets/cropper/dist/cropper.min.css" rel="stylesheet">'; |
|
72 | -$htmlHeadXtra[] = '<script src="'. api_get_path(WEB_PATH) .'web/assets/cropper/dist/cropper.min.js"></script>'; |
|
71 | +$htmlHeadXtra[] = '<link href="'.api_get_path(WEB_PATH).'web/assets/cropper/dist/cropper.min.css" rel="stylesheet">'; |
|
72 | +$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_PATH).'web/assets/cropper/dist/cropper.min.js"></script>'; |
|
73 | 73 | $htmlHeadXtra[] = '<script> |
74 | 74 | $(document).ready(function() { |
75 | 75 | var $image = $("#previewImage"); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | } |
194 | 194 | |
195 | 195 | if (api_get_setting('login_is_email') == 'true') { |
196 | - $form->addRule('email', sprintf(get_lang('UsernameMaxXCharacters'), (string)USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH); |
|
196 | + $form->addRule('email', sprintf(get_lang('UsernameMaxXCharacters'), (string) USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH); |
|
197 | 197 | $form->addRule('email', get_lang('UserTaken'), 'username_available', $user_data['username']); |
198 | 198 | } |
199 | 199 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | |
208 | 208 | // Picture |
209 | 209 | $form->addElement('file', 'picture', get_lang('AddPicture'), array('id' => 'picture', 'class' => 'picture-form')); |
210 | -$allowed_picture_types = array ('jpg', 'jpeg', 'png', 'gif'); |
|
210 | +$allowed_picture_types = array('jpg', 'jpeg', 'png', 'gif'); |
|
211 | 211 | |
212 | 212 | $form->addHtml('<div class="form-group"> |
213 | 213 | <label for="cropImage" id="labelCropImage" class="col-sm-2 control-label"></label> |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | if (api_get_setting('login_is_email') != 'true') { |
239 | 239 | $form->addElement('text', 'username', get_lang('LoginName'), array('maxlength' => USERNAME_MAX_LENGTH)); |
240 | 240 | $form->addRule('username', get_lang('ThisFieldIsRequired'), 'required'); |
241 | - $form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string)USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH); |
|
241 | + $form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string) USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH); |
|
242 | 242 | $form->addRule('username', get_lang('OnlyLettersAndNumbersAllowed'), 'username'); |
243 | 243 | $form->addRule('username', get_lang('UserTaken'), 'username_available', $user_data['username']); |
244 | 244 | } |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | } |
276 | 276 | $form->addElement('radio', 'reset_password', null, get_lang('AutoGeneratePassword'), 1); |
277 | 277 | $group = array(); |
278 | -$group[] =$form->createElement('radio', 'reset_password', null, get_lang('EnterPassword'), 2); |
|
278 | +$group[] = $form->createElement('radio', 'reset_password', null, get_lang('EnterPassword'), 2); |
|
279 | 279 | $group[] = $form->createElement( |
280 | 280 | 'password', |
281 | 281 | 'password', |
@@ -309,10 +309,10 @@ discard block |
||
309 | 309 | // Platform admin |
310 | 310 | if (api_is_platform_admin()) { |
311 | 311 | $group = array(); |
312 | - $group[] =$form->createElement('radio', 'platform_admin', null, get_lang('Yes'), 1); |
|
313 | - $group[] =$form->createElement('radio', 'platform_admin', null, get_lang('No'), 0); |
|
312 | + $group[] = $form->createElement('radio', 'platform_admin', null, get_lang('Yes'), 1); |
|
313 | + $group[] = $form->createElement('radio', 'platform_admin', null, get_lang('No'), 0); |
|
314 | 314 | |
315 | - $user_data['status'] == 1 ? $display = 'block':$display = 'none'; |
|
315 | + $user_data['status'] == 1 ? $display = 'block' : $display = 'none'; |
|
316 | 316 | |
317 | 317 | $form->addElement('html', '<div id="id_platform_admin" style="display:'.$display.'">'); |
318 | 318 | $form->addGroup($group, 'admin', get_lang('PlatformAdmin'), null, false); |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | if (!$user_data['platform_admin']) { |
337 | 337 | // Expiration Date |
338 | 338 | $form->addElement('radio', 'radio_expiration_date', get_lang('ExpirationDate'), get_lang('NeverExpires'), 0); |
339 | - $group = array (); |
|
339 | + $group = array(); |
|
340 | 340 | $group[] = $form->createElement('radio', 'radio_expiration_date', null, get_lang('Enabled'), 1); |
341 | 341 | $group[] = $form->createElement('DateTimePicker', 'expiration_date', null, array('onchange' => 'javascript: enable_expiration_date();')); |
342 | 342 | $form->addGroup($group, 'max_member_group', null, '', false); |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | if ($studentBoss) { |
355 | 355 | foreach ($studentBoss as $bossId => $userData) { |
356 | 356 | $bossInfo = api_get_user_info($userData['user_id']); |
357 | - $studentBossToSelect[$bossInfo['user_id']] = $bossInfo['complete_name_with_username']; |
|
357 | + $studentBossToSelect[$bossInfo['user_id']] = $bossInfo['complete_name_with_username']; |
|
358 | 358 | } |
359 | 359 | } |
360 | 360 | |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | $jquery_ready_content = $returnParams['jquery_ready_content']; |
372 | 372 | |
373 | 373 | // the $jquery_ready_content variable collects all functions that will be load in the $(document).ready javascript function |
374 | -$htmlHeadXtra[] ='<script> |
|
374 | +$htmlHeadXtra[] = '<script> |
|
375 | 375 | $(document).ready(function(){ |
376 | 376 | '.$jquery_ready_content.' |
377 | 377 | }); |