@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | // Setting the section (for the tabs). |
16 | 16 | $this_section = SECTION_PLATFORM_ADMIN; |
17 | -$_SESSION['this_section']=$this_section; |
|
17 | +$_SESSION['this_section'] = $this_section; |
|
18 | 18 | |
19 | 19 | $action = isset($_GET['action']) ? $_GET['action'] : null; |
20 | 20 | $action_todo = false; |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | if (!empty($action)) { |
38 | - $interbreadcrumb[] = array ("url" => "system_announcements.php", "name" => get_lang('SystemAnnouncements')); |
|
38 | + $interbreadcrumb[] = array("url" => "system_announcements.php", "name" => get_lang('SystemAnnouncements')); |
|
39 | 39 | if ($action == 'add') { |
40 | - $interbreadcrumb[] = array ("url" => '#', "name" => get_lang('AddAnnouncement')); |
|
40 | + $interbreadcrumb[] = array("url" => '#', "name" => get_lang('AddAnnouncement')); |
|
41 | 41 | } |
42 | 42 | if ($action == 'edit') { |
43 | - $interbreadcrumb[] = array ("url" => '#', "name" => get_lang('Edit')); |
|
43 | + $interbreadcrumb[] = array("url" => '#', "name" => get_lang('Edit')); |
|
44 | 44 | } |
45 | 45 | } else { |
46 | 46 | $tool_name = get_lang('SystemAnnouncements'); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | // Actions |
69 | -switch($action) { |
|
69 | +switch ($action) { |
|
70 | 70 | case 'make_visible': |
71 | 71 | case 'make_invisible': |
72 | 72 | $status = false; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | Display :: display_confirmation_message(get_lang('AnnouncementDeleted')); |
82 | 82 | break; |
83 | 83 | case 'delete_selected': |
84 | - foreach($_POST['id'] as $index => $id) { |
|
84 | + foreach ($_POST['id'] as $index => $id) { |
|
85 | 85 | SystemAnnouncementManager :: delete_announcement($id); |
86 | 86 | } |
87 | 87 | Display :: display_confirmation_message(get_lang('AnnouncementDeleted')); |
@@ -137,11 +137,11 @@ discard block |
||
137 | 137 | $language_list = api_get_languages(); |
138 | 138 | $language_list_with_keys = array(); |
139 | 139 | $language_list_with_keys['all'] = get_lang('All'); |
140 | - for ($i=0; $i<count($language_list['name']) ; $i++) { |
|
140 | + for ($i = 0; $i < count($language_list['name']); $i++) { |
|
141 | 141 | $language_list_with_keys[$language_list['folder'][$i]] = $language_list['name'][$i]; |
142 | 142 | } |
143 | 143 | |
144 | - $form->addElement('select', 'lang',get_lang('Language'), $language_list_with_keys); |
|
144 | + $form->addElement('select', 'lang', get_lang('Language'), $language_list_with_keys); |
|
145 | 145 | $form->addHtmlEditor( |
146 | 146 | 'content', |
147 | 147 | get_lang('Content'), |
@@ -157,9 +157,9 @@ discard block |
||
157 | 157 | |
158 | 158 | $group = array(); |
159 | 159 | |
160 | - $group[]= $form->createElement('checkbox', 'visible_teacher', null, get_lang('Teacher')); |
|
161 | - $group[]= $form->createElement('checkbox', 'visible_student', null, get_lang('Student')); |
|
162 | - $group[]= $form->createElement('checkbox', 'visible_guest', null, get_lang('Guest')); |
|
160 | + $group[] = $form->createElement('checkbox', 'visible_teacher', null, get_lang('Teacher')); |
|
161 | + $group[] = $form->createElement('checkbox', 'visible_student', null, get_lang('Student')); |
|
162 | + $group[] = $form->createElement('checkbox', 'visible_guest', null, get_lang('Guest')); |
|
163 | 163 | |
164 | 164 | $form->addGroup($group, null, get_lang('Visible'), ''); |
165 | 165 | |
@@ -182,15 +182,15 @@ discard block |
||
182 | 182 | |
183 | 183 | $form->addElement('checkbox', 'send_mail', null, get_lang('SendMail')); |
184 | 184 | |
185 | - if (isset($_REQUEST['action']) && $_REQUEST['action']=='add') { |
|
185 | + if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'add') { |
|
186 | 186 | $form->addElement('checkbox', 'add_to_calendar', null, get_lang('AddToCalendar')); |
187 | - $text=get_lang('AddNews'); |
|
188 | - $class='add'; |
|
187 | + $text = get_lang('AddNews'); |
|
188 | + $class = 'add'; |
|
189 | 189 | $form->addElement('hidden', 'action', 'add'); |
190 | 190 | |
191 | 191 | } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit') { |
192 | - $text=get_lang('EditNews'); |
|
193 | - $class='save'; |
|
192 | + $text = get_lang('EditNews'); |
|
193 | + $class = 'save'; |
|
194 | 194 | $form->addElement('hidden', 'action', 'edit'); |
195 | 195 | } |
196 | 196 | $form->addElement('checkbox', 'send_email_test', null, get_lang('SendOnlyAnEmailToMySelfToTest')); |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | |
281 | 281 | if ($show_announcement_list) { |
282 | 282 | $announcements = SystemAnnouncementManager :: get_all_announcements(); |
283 | - $announcement_data = array (); |
|
283 | + $announcement_data = array(); |
|
284 | 284 | foreach ($announcements as $index => $announcement) { |
285 | 285 | $row = array(); |
286 | 286 | $row[] = $announcement->id; |
@@ -288,9 +288,9 @@ discard block |
||
288 | 288 | $row[] = $announcement->title; |
289 | 289 | $row[] = api_convert_and_format_date($announcement->date_start); |
290 | 290 | $row[] = api_convert_and_format_date($announcement->date_end); |
291 | - $row[] = "<a href=\"?id=".$announcement->id."&person=".SystemAnnouncementManager::VISIBLE_TEACHER."&action=". ($announcement->visible_teacher ? 'make_invisible' : 'make_visible')."\">".Display::return_icon(($announcement->visible_teacher ? 'eyes.png' : 'eyes-close.png'), get_lang('ShowOrHide'))."</a>"; |
|
292 | - $row[] = "<a href=\"?id=".$announcement->id."&person=".SystemAnnouncementManager::VISIBLE_STUDENT."&action=". ($announcement->visible_student ? 'make_invisible' : 'make_visible')."\">".Display::return_icon(($announcement->visible_student ? 'eyes.png' : 'eyes-close.png'), get_lang('ShowOrHide'))."</a>"; |
|
293 | - $row[] = "<a href=\"?id=".$announcement->id."&person=".SystemAnnouncementManager::VISIBLE_GUEST."&action=". ($announcement->visible_guest ? 'make_invisible' : 'make_visible')."\">".Display::return_icon(($announcement->visible_guest ? 'eyes.png' : 'eyes-close.png'), get_lang('ShowOrHide'))."</a>"; |
|
291 | + $row[] = "<a href=\"?id=".$announcement->id."&person=".SystemAnnouncementManager::VISIBLE_TEACHER."&action=".($announcement->visible_teacher ? 'make_invisible' : 'make_visible')."\">".Display::return_icon(($announcement->visible_teacher ? 'eyes.png' : 'eyes-close.png'), get_lang('ShowOrHide'))."</a>"; |
|
292 | + $row[] = "<a href=\"?id=".$announcement->id."&person=".SystemAnnouncementManager::VISIBLE_STUDENT."&action=".($announcement->visible_student ? 'make_invisible' : 'make_visible')."\">".Display::return_icon(($announcement->visible_student ? 'eyes.png' : 'eyes-close.png'), get_lang('ShowOrHide'))."</a>"; |
|
293 | + $row[] = "<a href=\"?id=".$announcement->id."&person=".SystemAnnouncementManager::VISIBLE_GUEST."&action=".($announcement->visible_guest ? 'make_invisible' : 'make_visible')."\">".Display::return_icon(($announcement->visible_guest ? 'eyes.png' : 'eyes-close.png'), get_lang('ShowOrHide'))."</a>"; |
|
294 | 294 | |
295 | 295 | $row[] = $announcement->lang; |
296 | 296 | $row[] = "<a href=\"?action=edit&id=".$announcement->id."\">".Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL)."</a> <a href=\"?action=delete&id=".$announcement->id."\" onclick=\"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."')) return false;\">".Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL)."</a>"; |
@@ -43,15 +43,15 @@ discard block |
||
43 | 43 | $table->set_column_filter(3, 'edit_filter'); |
44 | 44 | |
45 | 45 | function edit_filter($id,$url_params,$row) { |
46 | - global $charset; |
|
47 | - $return = '<a href="specific_fields_add.php?action=edit&field_id='.$row[0].'">'.Display::return_icon('edit.gif',get_lang('Edit')).'</a>'; |
|
48 | - $return .= ' <a href="'.api_get_self().'?action=delete&field_id='.$row[0].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset))."'".')) return false;">'.Display::return_icon('delete.gif',get_lang('Delete')).'</a>'; |
|
49 | - return $return; |
|
46 | + global $charset; |
|
47 | + $return = '<a href="specific_fields_add.php?action=edit&field_id='.$row[0].'">'.Display::return_icon('edit.gif',get_lang('Edit')).'</a>'; |
|
48 | + $return .= ' <a href="'.api_get_self().'?action=delete&field_id='.$row[0].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset))."'".')) return false;">'.Display::return_icon('delete.gif',get_lang('Delete')).'</a>'; |
|
49 | + return $return; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | if ($_REQUEST['action'] == 'delete') { |
53 | - delete_specific_field($_REQUEST['field_id']); |
|
54 | - header('Location: specific_fields.php?message='.get_lang('FieldRemoved')); |
|
53 | + delete_specific_field($_REQUEST['field_id']); |
|
54 | + header('Location: specific_fields.php?message='.get_lang('FieldRemoved')); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | // Start output |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | echo Display::display_normal_message(get_lang('SpecificSearchFieldsIntro')); |
62 | 62 | |
63 | 63 | if(!empty($_GET['message'])) { |
64 | - Display::display_confirmation_message($_GET['message']); |
|
64 | + Display::display_confirmation_message($_GET['message']); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | echo '<div class="actions">'; |
@@ -15,36 +15,36 @@ discard block |
||
15 | 15 | api_protect_admin_script(); |
16 | 16 | |
17 | 17 | // Breadcrumb |
18 | -$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
19 | -$interbreadcrumb[] = array ('url' => 'settings.php?category=Search', 'name' => get_lang('PlatformConfigSettings')); |
|
18 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
19 | +$interbreadcrumb[] = array('url' => 'settings.php?category=Search', 'name' => get_lang('PlatformConfigSettings')); |
|
20 | 20 | |
21 | 21 | $libpath = api_get_path(LIBRARY_PATH); |
22 | 22 | |
23 | 23 | include_once $libpath.'specific_fields_manager.lib.php'; |
24 | 24 | |
25 | 25 | // Create an add-field box |
26 | -$form = new FormValidator('add_field','post','','',null,false); |
|
27 | -$renderer =& $form->defaultRenderer(); |
|
26 | +$form = new FormValidator('add_field', 'post', '', '', null, false); |
|
27 | +$renderer = & $form->defaultRenderer(); |
|
28 | 28 | $renderer->setCustomElementTemplate('<span>{element}</span> '); |
29 | -$form->addElement('static','search_advanced_link',null,'<a href="specific_fields_add.php">'.Display::return_icon('fieldadd.gif').get_lang('AddSpecificSearchField').'</a>'); |
|
29 | +$form->addElement('static', 'search_advanced_link', null, '<a href="specific_fields_add.php">'.Display::return_icon('fieldadd.gif').get_lang('AddSpecificSearchField').'</a>'); |
|
30 | 30 | |
31 | 31 | // Create a sortable table with specific fields data |
32 | -$column_show = array(1,1,1); |
|
33 | -$column_order = array(3,2,1); |
|
32 | +$column_show = array(1, 1, 1); |
|
33 | +$column_order = array(3, 2, 1); |
|
34 | 34 | $extra_fields = get_specific_field_list(); |
35 | 35 | $number_of_extra_fields = count($extra_fields); |
36 | 36 | |
37 | -$table = new SortableTableFromArrayConfig($extra_fields,2,50,'',$column_show,$column_order); |
|
38 | -$table->set_header(0, ' ', false,null,'width="2%"', 'style="display:none"'); |
|
37 | +$table = new SortableTableFromArrayConfig($extra_fields, 2, 50, '', $column_show, $column_order); |
|
38 | +$table->set_header(0, ' ', false, null, 'width="2%"', 'style="display:none"'); |
|
39 | 39 | $table->set_header(1, get_lang('Code'), TRUE, 'width="10%"'); |
40 | 40 | $table->set_header(2, get_lang('Name')); |
41 | -$table->set_header(3, get_lang('Modify'),false,'width="10%"'); |
|
41 | +$table->set_header(3, get_lang('Modify'), false, 'width="10%"'); |
|
42 | 42 | $table->set_column_filter(3, 'edit_filter'); |
43 | 43 | |
44 | -function edit_filter($id,$url_params,$row) { |
|
44 | +function edit_filter($id, $url_params, $row) { |
|
45 | 45 | global $charset; |
46 | - $return = '<a href="specific_fields_add.php?action=edit&field_id='.$row[0].'">'.Display::return_icon('edit.gif',get_lang('Edit')).'</a>'; |
|
47 | - $return .= ' <a href="'.api_get_self().'?action=delete&field_id='.$row[0].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset))."'".')) return false;">'.Display::return_icon('delete.gif',get_lang('Delete')).'</a>'; |
|
46 | + $return = '<a href="specific_fields_add.php?action=edit&field_id='.$row[0].'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>'; |
|
47 | + $return .= ' <a href="'.api_get_self().'?action=delete&field_id='.$row[0].'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset))."'".')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>'; |
|
48 | 48 | return $return; |
49 | 49 | } |
50 | 50 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | Display::display_header(get_lang('SpecificSearchFields')); |
61 | 61 | echo Display::display_normal_message(get_lang('SpecificSearchFieldsIntro')); |
62 | 62 | |
63 | -if(!empty($_GET['message'])) { |
|
63 | +if (!empty($_GET['message'])) { |
|
64 | 64 | Display::display_confirmation_message($_GET['message']); |
65 | 65 | } |
66 | 66 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | $skill_profile = new SkillProfile(); |
25 | 25 | $skill_rel_user = new SkillRelUser(); |
26 | 26 | |
27 | -$url = api_get_path(WEB_AJAX_PATH).'skill.ajax.php'; |
|
27 | +$url = api_get_path(WEB_AJAX_PATH).'skill.ajax.php'; |
|
28 | 28 | |
29 | 29 | $tpl = new Template(get_lang('Skills')); |
30 | 30 | |
@@ -55,16 +55,16 @@ discard block |
||
55 | 55 | $_SESSION['skills'] = $skills; |
56 | 56 | |
57 | 57 | } else { |
58 | - $skills = isset($_SESSION['skills']) ? $_SESSION['skills']: array(); |
|
58 | + $skills = isset($_SESSION['skills']) ? $_SESSION['skills'] : array(); |
|
59 | 59 | } |
60 | 60 | } else { |
61 | - $skills = isset($_SESSION['skills']) ? $_SESSION['skills']: array(); |
|
61 | + $skills = isset($_SESSION['skills']) ? $_SESSION['skills'] : array(); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | $user_list = array(); |
65 | 65 | $count_skills = count($skills); |
66 | 66 | |
67 | -$users = $skill_rel_user->get_user_by_skills($skills); |
|
67 | +$users = $skill_rel_user->get_user_by_skills($skills); |
|
68 | 68 | |
69 | 69 | if (!empty($users)) { |
70 | 70 | foreach ($users as $user) { |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $user_list[$user['user_id']]['user'] = $user_info; |
73 | 73 | $my_user_skills = $skill_rel_user->get_user_skills($user['user_id']); |
74 | 74 | $user_skills = array(); |
75 | - $found_counts = 0 ; |
|
75 | + $found_counts = 0; |
|
76 | 76 | foreach ($my_user_skills as $my_skill) { |
77 | 77 | $found = false; |
78 | 78 | if (in_array($my_skill['skill_id'], $skills)) { |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $user_list[$user['user_id']]['total_found_skills'] = $found_counts; |
90 | 90 | } |
91 | 91 | $ordered_user_list = array(); |
92 | - foreach($user_list as $user_id => $user_data) { |
|
92 | + foreach ($user_list as $user_id => $user_data) { |
|
93 | 93 | $ordered_user_list[$user_data['total_found_skills']][] = $user_data; |
94 | 94 | } |
95 | 95 | if (!empty($ordered_user_list)) { |
@@ -103,14 +103,14 @@ discard block |
||
103 | 103 | |
104 | 104 | if (!empty($skills)) { |
105 | 105 | $counter = 0; |
106 | - foreach($skills as $hidden_skill_id) { |
|
106 | + foreach ($skills as $hidden_skill_id) { |
|
107 | 107 | $form->addElement('hidden', 'hidden_skills[]', $hidden_skill_id); |
108 | 108 | $counter++; |
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
112 | 112 | if (!empty($skills)) { |
113 | - foreach($skills as $my_skill) { |
|
113 | + foreach ($skills as $my_skill) { |
|
114 | 114 | $total_skills_to_search[$my_skill] = $my_skill; |
115 | 115 | } |
116 | 116 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $htmlHeadXtra[] = api_get_jqgrid_js(); |
19 | 19 | |
20 | 20 | // setting breadcrumbs |
21 | -$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin')); |
|
21 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
22 | 22 | |
23 | 23 | $tool_name = null; |
24 | 24 | |
@@ -39,23 +39,23 @@ discard block |
||
39 | 39 | $token = Security::get_token(); |
40 | 40 | |
41 | 41 | if ($action == 'add') { |
42 | - $interbreadcrumb[]=array('url' => 'extra_fields.php?type='.$extra_field->type,'name' => $extra_field->pageName); |
|
43 | - $interbreadcrumb[]=array('url' => 'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'],'name' => $extra_field_info['display_text']); |
|
44 | - $interbreadcrumb[]=array('url' => 'extra_field_options.php?type='.$extra_field->type.'&field_id='.$extra_field_info['id'], 'name' => get_lang('EditExtraFieldOptions')); |
|
45 | - $interbreadcrumb[]=array('url' => '#','name' => get_lang('Add')); |
|
42 | + $interbreadcrumb[] = array('url' => 'extra_fields.php?type='.$extra_field->type, 'name' => $extra_field->pageName); |
|
43 | + $interbreadcrumb[] = array('url' => 'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'], 'name' => $extra_field_info['display_text']); |
|
44 | + $interbreadcrumb[] = array('url' => 'extra_field_options.php?type='.$extra_field->type.'&field_id='.$extra_field_info['id'], 'name' => get_lang('EditExtraFieldOptions')); |
|
45 | + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Add')); |
|
46 | 46 | } elseif ($action == 'edit') { |
47 | - $interbreadcrumb[]=array('url' => 'extra_fields.php?type='.$extra_field->type,'name' => $extra_field->pageName); |
|
48 | - $interbreadcrumb[]=array('url' => 'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'],'name' => $extra_field_info['display_text']); |
|
49 | - $interbreadcrumb[]=array('url' => 'extra_field_options.php?type='.$extra_field->type.'&field_id='.$extra_field_info['id'], 'name' => get_lang('EditExtraFieldOptions')); |
|
47 | + $interbreadcrumb[] = array('url' => 'extra_fields.php?type='.$extra_field->type, 'name' => $extra_field->pageName); |
|
48 | + $interbreadcrumb[] = array('url' => 'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'], 'name' => $extra_field_info['display_text']); |
|
49 | + $interbreadcrumb[] = array('url' => 'extra_field_options.php?type='.$extra_field->type.'&field_id='.$extra_field_info['id'], 'name' => get_lang('EditExtraFieldOptions')); |
|
50 | 50 | |
51 | - $interbreadcrumb[]=array('url' => '#','name' => get_lang('Edit')); |
|
51 | + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Edit')); |
|
52 | 52 | } else { |
53 | - $interbreadcrumb[]=array('url' => 'extra_fields.php?type='.$extra_field->type,'name' => $extra_field->pageName); |
|
54 | - $interbreadcrumb[]=array( |
|
53 | + $interbreadcrumb[] = array('url' => 'extra_fields.php?type='.$extra_field->type, 'name' => $extra_field->pageName); |
|
54 | + $interbreadcrumb[] = array( |
|
55 | 55 | 'url' => 'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'], |
56 | 56 | 'name' => $extra_field_info['display_text'] |
57 | 57 | ); |
58 | - $interbreadcrumb[]=array('url' => '#','name' => get_lang('EditExtraFieldOptions')); |
|
58 | + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('EditExtraFieldOptions')); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | //jqgrid will use this URL to do the selects |
@@ -108,12 +108,12 @@ discard block |
||
108 | 108 | |
109 | 109 | //With this function we can add actions to the jgrid (edit, delete, etc) |
110 | 110 | $action_links = 'function action_formatter(cellvalue, options, rowObject) { |
111 | - return \'<a href="?action=edit&'.$params.'&id=\'+options.rowId+\'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'. |
|
112 | - ' <a onclick="javascript:if(!confirm('."\'".addslashes(get_lang("ConfirmYourChoice"))."\'".')) return false;" href="?sec_token='.$token.'&action=delete&'.$params.'&id=\'+options.rowId+\'">'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'. |
|
111 | + return \'<a href="?action=edit&'.$params.'&id=\'+options.rowId+\'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>'. |
|
112 | + ' <a onclick="javascript:if(!confirm('."\'".addslashes(get_lang("ConfirmYourChoice"))."\'".')) return false;" href="?sec_token='.$token.'&action=delete&'.$params.'&id=\'+options.rowId+\'">'.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'. |
|
113 | 113 | '\'; |
114 | 114 | }'; |
115 | 115 | |
116 | -$htmlHeadXtra[]='<script> |
|
116 | +$htmlHeadXtra[] = '<script> |
|
117 | 117 | $(function() { |
118 | 118 | // grid definition see the $obj->display() function |
119 | 119 | '.Display::grid_js( |
@@ -345,7 +345,10 @@ discard block |
||
345 | 345 | $searchForm->display(); |
346 | 346 | echo '</div>'; |
347 | 347 | ?> |
348 | -<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;"> |
|
348 | +<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) { |
|
349 | + echo '&add=true' ; |
|
350 | +} |
|
351 | +?>" style="margin:0px;"> |
|
349 | 352 | <?php |
350 | 353 | echo '<legend>'.$tool_name.': '.$data['name'].'</legend>'; |
351 | 354 | |
@@ -420,7 +423,10 @@ discard block |
||
420 | 423 | ?> |
421 | 424 | <br /> |
422 | 425 | <label class="control-label"> |
423 | - <input type="checkbox" <?php if ($user_with_any_group) echo 'checked="checked"';?> onchange="checked_in_no_group(this.checked);" name="user_with_any_group" id="user_with_any_group_id"> |
|
426 | + <input type="checkbox" <?php if ($user_with_any_group) { |
|
427 | + echo 'checked="checked"'; |
|
428 | +} |
|
429 | +?> onchange="checked_in_no_group(this.checked);" name="user_with_any_group" id="user_with_any_group_id"> |
|
424 | 430 | <?php echo get_lang('UsersRegisteredInAnyGroup'); ?> |
425 | 431 | </label> |
426 | 432 | </div> |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | api_protect_admin_script(true); |
19 | 19 | |
20 | 20 | // setting breadcrumbs |
21 | -$interbreadcrumb[]= array('url' => 'index.php','name' => get_lang('PlatformAdmin')); |
|
22 | -$interbreadcrumb[]= array('url' => 'usergroups.php','name' => get_lang('Classes')); |
|
21 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
22 | +$interbreadcrumb[] = array('url' => 'usergroups.php', 'name' => get_lang('Classes')); |
|
23 | 23 | |
24 | 24 | // Database Table Definitions |
25 | 25 | |
@@ -91,14 +91,14 @@ discard block |
||
91 | 91 | |
92 | 92 | </script>'; |
93 | 93 | |
94 | -$form_sent = 0; |
|
94 | +$form_sent = 0; |
|
95 | 95 | |
96 | 96 | $extra_field_list = UserManager::get_extra_fields(); |
97 | 97 | $new_field_list = array(); |
98 | 98 | if (is_array($extra_field_list)) { |
99 | 99 | foreach ($extra_field_list as $extra_field) { |
100 | 100 | //if is enabled to filter and is a "<select>" field type |
101 | - if ($extra_field[8]==1 && $extra_field[2]==4 ) { |
|
101 | + if ($extra_field[8] == 1 && $extra_field[2] == 4) { |
|
102 | 102 | $new_field_list[] = array( |
103 | 103 | 'name'=> $extra_field[3], |
104 | 104 | 'variable' => $extra_field[1], 'data'=> $extra_field[9] |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | foreach ($users as $user) { |
147 | 147 | $data[] = array($user['username'], $groupInfo['name']); |
148 | 148 | } |
149 | - $filename = 'export_user_class_' . api_get_local_time(); |
|
149 | + $filename = 'export_user_class_'.api_get_local_time(); |
|
150 | 150 | Export::arrayToCsv($data, $filename); |
151 | 151 | exit; |
152 | 152 | } |
@@ -156,11 +156,11 @@ discard block |
||
156 | 156 | // Filter by Extra Fields |
157 | 157 | $use_extra_fields = false; |
158 | 158 | if (is_array($extra_field_list)) { |
159 | - if (is_array($new_field_list) && count($new_field_list)>0 ) { |
|
159 | + if (is_array($new_field_list) && count($new_field_list) > 0) { |
|
160 | 160 | foreach ($new_field_list as $new_field) { |
161 | 161 | $varname = 'field_'.$new_field['variable']; |
162 | 162 | if (UserManager::is_extra_field_available($new_field['variable'])) { |
163 | - if (isset($_POST[$varname]) && $_POST[$varname]!='0') { |
|
163 | + if (isset($_POST[$varname]) && $_POST[$varname] != '0') { |
|
164 | 164 | $use_extra_fields = true; |
165 | 165 | $extra_field_result[] = UserManager::get_extra_user_data_by_value( |
166 | 166 | $new_field['variable'], |
@@ -174,10 +174,10 @@ discard block |
||
174 | 174 | |
175 | 175 | if ($use_extra_fields) { |
176 | 176 | $final_result = array(); |
177 | - if (count($extra_field_result)>1) { |
|
178 | - for ($i=0; $i<count($extra_field_result)-1; $i++) { |
|
179 | - if (is_array($extra_field_result[$i+1])) { |
|
180 | - $final_result = array_intersect($extra_field_result[$i], $extra_field_result[$i+1]); |
|
177 | + if (count($extra_field_result) > 1) { |
|
178 | + for ($i = 0; $i < count($extra_field_result) - 1; $i++) { |
|
179 | + if (is_array($extra_field_result[$i + 1])) { |
|
180 | + $final_result = array_intersect($extra_field_result[$i], $extra_field_result[$i + 1]); |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | } else { |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | |
197 | 197 | $searchForm = new FormValidator('search', 'get', api_get_self().'?id='.$id); |
198 | 198 | $searchForm->addHeader(get_lang('AdvancedSearch')); |
199 | -$renderer =& $searchForm->defaultRenderer(); |
|
199 | +$renderer = & $searchForm->defaultRenderer(); |
|
200 | 200 | |
201 | 201 | $searchForm->addElement('hidden', 'id', $id); |
202 | 202 | foreach ($filters as $param) { |
@@ -345,13 +345,13 @@ discard block |
||
345 | 345 | $searchForm->display(); |
346 | 346 | echo '</div>'; |
347 | 347 | ?> |
348 | -<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;"> |
|
348 | +<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if (!empty($_GET['add'])) echo '&add=true'; ?>" style="margin:0px;"> |
|
349 | 349 | <?php |
350 | 350 | echo '<legend>'.$tool_name.': '.$data['name'].'</legend>'; |
351 | 351 | |
352 | 352 | |
353 | 353 | if (is_array($extra_field_list)) { |
354 | - if (is_array($new_field_list) && count($new_field_list)>0) { |
|
354 | + if (is_array($new_field_list) && count($new_field_list) > 0) { |
|
355 | 355 | echo '<h3>'.get_lang('FilterByUser').'</h3>'; |
356 | 356 | foreach ($new_field_list as $new_field) { |
357 | 357 | echo $new_field['name']; |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | echo ' <select name="'.$varname.'">'; |
360 | 360 | echo '<option value="0">--'.get_lang('Select').'--</option>'; |
361 | 361 | foreach ($new_field['data'] as $option) { |
362 | - $checked=''; |
|
362 | + $checked = ''; |
|
363 | 363 | if (isset($_POST[$varname])) { |
364 | 364 | if ($_POST[$varname] == $option[1]) { |
365 | 365 | $checked = 'selected="true"'; |
@@ -386,15 +386,15 @@ discard block |
||
386 | 386 | <?php if ($data['group_type'] == UserGroup::SOCIAL_CLASS) { ?> |
387 | 387 | <select name="relation" id="relation"> |
388 | 388 | <option value=""><?php echo get_lang('SelectARelationType')?></option> |
389 | - <option value="<?php echo GROUP_USER_PERMISSION_ADMIN ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_ADMIN)?'selected=selected':'') ?> > |
|
389 | + <option value="<?php echo GROUP_USER_PERMISSION_ADMIN ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_ADMIN) ? 'selected=selected' : '') ?> > |
|
390 | 390 | <?php echo get_lang('Admin') ?></option> |
391 | - <option value="<?php echo GROUP_USER_PERMISSION_READER ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_READER)?'selected=selected':'') ?> > |
|
391 | + <option value="<?php echo GROUP_USER_PERMISSION_READER ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_READER) ? 'selected=selected' : '') ?> > |
|
392 | 392 | <?php echo get_lang('Reader') ?></option> |
393 | - <option value="<?php echo GROUP_USER_PERMISSION_PENDING_INVITATION ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_PENDING_INVITATION)?'selected=selected':'') ?> > |
|
393 | + <option value="<?php echo GROUP_USER_PERMISSION_PENDING_INVITATION ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_PENDING_INVITATION) ? 'selected=selected' : '') ?> > |
|
394 | 394 | <?php echo get_lang('PendingInvitation') ?></option> |
395 | - <option value="<?php echo GROUP_USER_PERMISSION_MODERATOR ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_MODERATOR)?'selected=selected':'') ?> > |
|
395 | + <option value="<?php echo GROUP_USER_PERMISSION_MODERATOR ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_MODERATOR) ? 'selected=selected' : '') ?> > |
|
396 | 396 | <?php echo get_lang('Moderator') ?></option> |
397 | - <option value="<?php echo GROUP_USER_PERMISSION_HRM ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_HRM)?'selected=selected':'') ?> > |
|
397 | + <option value="<?php echo GROUP_USER_PERMISSION_HRM ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_HRM) ? 'selected=selected' : '') ?> > |
|
398 | 398 | <?php echo get_lang('Drh') ?></option> |
399 | 399 | </select> |
400 | 400 | <?php } ?> |
@@ -414,13 +414,13 @@ discard block |
||
414 | 414 | 'elements_not_in_name', |
415 | 415 | $elements_not_in, |
416 | 416 | '', |
417 | - array('class'=>'col-md-7', 'multiple'=>'multiple','id'=>'elements_not_in','size'=>'15px'), |
|
417 | + array('class'=>'col-md-7', 'multiple'=>'multiple', 'id'=>'elements_not_in', 'size'=>'15px'), |
|
418 | 418 | false |
419 | 419 | ); |
420 | 420 | ?> |
421 | 421 | <br /> |
422 | 422 | <label class="control-label"> |
423 | - <input type="checkbox" <?php if ($user_with_any_group) echo 'checked="checked"';?> onchange="checked_in_no_group(this.checked);" name="user_with_any_group" id="user_with_any_group_id"> |
|
423 | + <input type="checkbox" <?php if ($user_with_any_group) echo 'checked="checked"'; ?> onchange="checked_in_no_group(this.checked);" name="user_with_any_group" id="user_with_any_group_id"> |
|
424 | 424 | <?php echo get_lang('UsersRegisteredInAnyGroup'); ?> |
425 | 425 | </label> |
426 | 426 | </div> |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | 'elements_in_name[]', |
445 | 445 | $elements_in, |
446 | 446 | '', |
447 | - array('class'=>'col-md-7', 'multiple'=>'multiple','id'=>'elements_in','size'=>'15px'), |
|
447 | + array('class'=>'col-md-7', 'multiple'=>'multiple', 'id'=>'elements_in', 'size'=>'15px'), |
|
448 | 448 | false |
449 | 449 | ); |
450 | 450 | unset($sessionUsersList); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | $this_section = SECTION_PLATFORM_ADMIN; |
12 | 12 | // User permissions |
13 | 13 | api_protect_admin_script(); |
14 | -$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
14 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
15 | 15 | Display :: display_header(get_lang('SystemStatus')); |
16 | 16 | $diag = new Diagnoser(); |
17 | 17 | $diag->show_html(); |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | require_once '../coursecopy/classes/CourseSelectForm.class.php'; |
29 | 29 | |
30 | 30 | if (function_exists('ini_set')) { |
31 | - api_set_memory_limit('256M'); |
|
32 | - ini_set('max_execution_time',0); |
|
31 | + api_set_memory_limit('256M'); |
|
32 | + ini_set('max_execution_time',0); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | // Displaying the header |
@@ -50,36 +50,36 @@ discard block |
||
50 | 50 | if ((isset($_POST['action']) && $_POST['action'] == 'course_select_form') || |
51 | 51 | (isset ($_POST['backup_option']) && $_POST['backup_option'] == 'full_backup') |
52 | 52 | ) { |
53 | - $export = false; |
|
54 | - if (isset ($_POST['action']) && $_POST['action'] == 'course_select_form') { |
|
55 | - $FileZip = create_zip(); |
|
56 | - $to_group_id = 0; |
|
57 | - $sql_session = "SELECT id, name FROM $tbl_session "; |
|
58 | - $query_session = Database::query($sql_session); |
|
59 | - $ListSession = array(); |
|
60 | - while ($rows_session = Database::fetch_assoc($query_session)) { |
|
61 | - $ListSession[$rows_session['id']] = $rows_session['name']; |
|
62 | - } |
|
53 | + $export = false; |
|
54 | + if (isset ($_POST['action']) && $_POST['action'] == 'course_select_form') { |
|
55 | + $FileZip = create_zip(); |
|
56 | + $to_group_id = 0; |
|
57 | + $sql_session = "SELECT id, name FROM $tbl_session "; |
|
58 | + $query_session = Database::query($sql_session); |
|
59 | + $ListSession = array(); |
|
60 | + while ($rows_session = Database::fetch_assoc($query_session)) { |
|
61 | + $ListSession[$rows_session['id']] = $rows_session['name']; |
|
62 | + } |
|
63 | 63 | |
64 | 64 | $groupCondition = " props.to_group_id = $to_group_id"; |
65 | 65 | if (empty($to_group_id)) { |
66 | 66 | $groupCondition = " (props.to_group_id = 0 OR props.to_group_id IS NULL)"; |
67 | 67 | } |
68 | 68 | |
69 | - $zip_folder=new PclZip($FileZip['TEMP_FILE_ZIP']); |
|
70 | - if(!isset($_POST['resource']) || count($_POST['resource']) == 0 ) { |
|
71 | - Display::display_error_message(get_lang('ErrorMsgSpecialExport')); |
|
72 | - } else { |
|
73 | - $Resource = $_POST['resource']; |
|
69 | + $zip_folder=new PclZip($FileZip['TEMP_FILE_ZIP']); |
|
70 | + if(!isset($_POST['resource']) || count($_POST['resource']) == 0 ) { |
|
71 | + Display::display_error_message(get_lang('ErrorMsgSpecialExport')); |
|
72 | + } else { |
|
73 | + $Resource = $_POST['resource']; |
|
74 | 74 | |
75 | - foreach ($Resource as $Code_course => $Sessions) { |
|
76 | - $_course = api_get_course_info($Code_course); |
|
77 | - $tbl_document = Database::get_course_table(TABLE_DOCUMENT); |
|
78 | - $tbl_property = Database::get_course_table(TABLE_ITEM_PROPERTY); |
|
79 | - $course_id = $_course['real_id']; |
|
75 | + foreach ($Resource as $Code_course => $Sessions) { |
|
76 | + $_course = api_get_course_info($Code_course); |
|
77 | + $tbl_document = Database::get_course_table(TABLE_DOCUMENT); |
|
78 | + $tbl_property = Database::get_course_table(TABLE_ITEM_PROPERTY); |
|
79 | + $course_id = $_course['real_id']; |
|
80 | 80 | |
81 | - //Add item to the zip file course |
|
82 | - $sql = "SELECT path FROM $tbl_document AS docs, $tbl_property AS props |
|
81 | + //Add item to the zip file course |
|
82 | + $sql = "SELECT path FROM $tbl_document AS docs, $tbl_property AS props |
|
83 | 83 | WHERE props.tool='".TOOL_DOCUMENT."' |
84 | 84 | AND docs.id=props.ref |
85 | 85 | AND docs.path LIKE '".$querypath."/%' |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | AND $groupCondition |
90 | 90 | AND docs.c_id = $course_id |
91 | 91 | AND props.c_id = $course_id"; |
92 | - $query = Database::query($sql ); |
|
93 | - while ($rows_course_file = Database::fetch_assoc($query)) { |
|
92 | + $query = Database::query($sql ); |
|
93 | + while ($rows_course_file = Database::fetch_assoc($query)) { |
|
94 | 94 | $zip_folder->add( |
95 | 95 | $FileZip['PATH_COURSE'].$_course['directory']."/document".$rows_course_file['path'], |
96 | 96 | PCLZIP_OPT_ADD_PATH, |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | PCLZIP_OPT_REMOVE_PATH, |
99 | 99 | $FileZip['PATH_COURSE'].$_course['directory']."/document".$FileZip['PATH_REMOVE'] |
100 | 100 | ); |
101 | - } |
|
101 | + } |
|
102 | 102 | |
103 | - foreach ($Sessions as $IdSession => $value){ |
|
104 | - $session_id = Security::remove_XSS($IdSession); |
|
105 | - //Add tem to the zip file session course |
|
106 | - $sql_session_doc = "SELECT path FROM $tbl_document AS docs, $tbl_property AS props |
|
103 | + foreach ($Sessions as $IdSession => $value){ |
|
104 | + $session_id = Security::remove_XSS($IdSession); |
|
105 | + //Add tem to the zip file session course |
|
106 | + $sql_session_doc = "SELECT path FROM $tbl_document AS docs, $tbl_property AS props |
|
107 | 107 | WHERE props.tool='".TOOL_DOCUMENT."' |
108 | 108 | AND docs.id=props.ref |
109 | 109 | AND docs.path LIKE '".$querypath."/%' |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | AND $groupCondition |
114 | 114 | AND docs.c_id = $course_id |
115 | 115 | AND props.c_id = $course_id"; |
116 | - $query_session_doc = Database::query($sql_session_doc); |
|
117 | - while ($rows_course_session_file = Database::fetch_assoc($query_session_doc)) { |
|
116 | + $query_session_doc = Database::query($sql_session_doc); |
|
117 | + while ($rows_course_session_file = Database::fetch_assoc($query_session_doc)) { |
|
118 | 118 | $zip_folder->add( |
119 | 119 | $FileZip['PATH_COURSE'].$_course['directory'].'/document'.$rows_course_session_file['path'], |
120 | 120 | PCLZIP_OPT_ADD_PATH, |
@@ -122,15 +122,15 @@ discard block |
||
122 | 122 | PCLZIP_OPT_REMOVE_PATH, |
123 | 123 | $FileZip['PATH_COURSE'].$_course['directory'].'/document'.$FileZip['PATH_REMOVE'] |
124 | 124 | ); |
125 | - } |
|
126 | - } |
|
127 | - } |
|
128 | - $name = rename_zip($FileZip); |
|
129 | - $export = true; |
|
130 | - } |
|
131 | - } else { |
|
132 | - $name = fullexportspecial(); |
|
133 | - } |
|
125 | + } |
|
126 | + } |
|
127 | + } |
|
128 | + $name = rename_zip($FileZip); |
|
129 | + $export = true; |
|
130 | + } |
|
131 | + } else { |
|
132 | + $name = fullexportspecial(); |
|
133 | + } |
|
134 | 134 | ?> |
135 | 135 | <!-- Manual download <script language="JavaScript"> |
136 | 136 | // setTimeout(\'download_backup()\',2000); |
@@ -143,23 +143,23 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | if ($export && $name) { |
146 | - Display::display_confirmation_message(get_lang('BackupCreated')); |
|
147 | - echo '<br /><a class="btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'course_info/download.php?archive='.urlencode($name).'&session=true">'.get_lang('Download').'</a>'; |
|
146 | + Display::display_confirmation_message(get_lang('BackupCreated')); |
|
147 | + echo '<br /><a class="btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'course_info/download.php?archive='.urlencode($name).'&session=true">'.get_lang('Download').'</a>'; |
|
148 | 148 | } else { |
149 | - // Display forms especial export |
|
150 | - if (isset ($_POST['backup_option']) && $_POST['backup_option'] == 'select_items') { |
|
151 | - $cb = new CourseBuilder(); |
|
152 | - $course = $cb->build_session_course(); |
|
153 | - if($course === false){ |
|
154 | - Display::display_error_message(get_lang('ErrorMsgSpecialExport')); |
|
155 | - form_special_export(); |
|
156 | - } else { |
|
157 | - Display::display_normal_message(get_lang('ToExportSpecialSelect')); |
|
158 | - CourseSelectForm :: display_form_session_export($course); |
|
159 | - } |
|
160 | - } else { |
|
161 | - form_special_export(); |
|
162 | - } |
|
149 | + // Display forms especial export |
|
150 | + if (isset ($_POST['backup_option']) && $_POST['backup_option'] == 'select_items') { |
|
151 | + $cb = new CourseBuilder(); |
|
152 | + $course = $cb->build_session_course(); |
|
153 | + if($course === false){ |
|
154 | + Display::display_error_message(get_lang('ErrorMsgSpecialExport')); |
|
155 | + form_special_export(); |
|
156 | + } else { |
|
157 | + Display::display_normal_message(get_lang('ToExportSpecialSelect')); |
|
158 | + CourseSelectForm :: display_form_session_export($course); |
|
159 | + } |
|
160 | + } else { |
|
161 | + form_special_export(); |
|
162 | + } |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /* FOOTER */ |
@@ -200,10 +200,10 @@ discard block |
||
200 | 200 | } |
201 | 201 | $temp_zip_file = $temp_zip_dir."/".md5(time()).".zip"; //create zipfile of given directory |
202 | 202 | return array('PATH' => $path, |
203 | - 'PATH_TEMP_ARCHIVE' => $temp_zip_dir, |
|
204 | - 'PATH_COURSE' => $sys_course_path, |
|
205 | - 'TEMP_FILE_ZIP' => $temp_zip_file, |
|
206 | - 'PATH_REMOVE' => $remove_dir); |
|
203 | + 'PATH_TEMP_ARCHIVE' => $temp_zip_dir, |
|
204 | + 'PATH_COURSE' => $sys_course_path, |
|
205 | + 'TEMP_FILE_ZIP' => $temp_zip_file, |
|
206 | + 'PATH_REMOVE' => $remove_dir); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | function rename_zip($FileZip) { |
@@ -287,9 +287,9 @@ discard block |
||
287 | 287 | $query_session_doc = Database::query($sql_session_doc); |
288 | 288 | while ($rows_course_session_file = Database::fetch_assoc($query_session_doc)) { |
289 | 289 | $zip_folder->add($FileZip['PATH_COURSE'].$_course['directory'].'/document'.$rows_course_session_file['path'], |
290 | - PCLZIP_OPT_ADD_PATH, $_course['directory']."/".$rows_session['name'], |
|
291 | - PCLZIP_OPT_REMOVE_PATH, $FileZip['PATH_COURSE'].$_course['directory'].'/document'.$FileZip['PATH_REMOVE'] |
|
292 | - ); |
|
290 | + PCLZIP_OPT_ADD_PATH, $_course['directory']."/".$rows_session['name'], |
|
291 | + PCLZIP_OPT_REMOVE_PATH, $FileZip['PATH_COURSE'].$_course['directory'].'/document'.$FileZip['PATH_REMOVE'] |
|
292 | + ); |
|
293 | 293 | } |
294 | 294 | } |
295 | 295 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | // setting the section (for the tabs) |
16 | 16 | $this_section = SECTION_PLATFORM_ADMIN; |
17 | 17 | // setting breadcrumbs |
18 | -$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin')); |
|
18 | +$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin')); |
|
19 | 19 | // Access restrictions |
20 | 20 | api_protect_admin_script(true); |
21 | 21 | $nameTools = get_lang('SpecialExports'); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | if (function_exists('ini_set')) { |
31 | 31 | api_set_memory_limit('256M'); |
32 | - ini_set('max_execution_time',0); |
|
32 | + ini_set('max_execution_time', 0); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | // Displaying the header |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | if (count($_POST) == 0) { |
42 | 42 | Display::display_normal_message(get_lang('SpecialExportsIntroduction')); |
43 | 43 | } |
44 | -$error =0; |
|
44 | +$error = 0; |
|
45 | 45 | /* MAIN CODE */ |
46 | 46 | |
47 | 47 | $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
@@ -66,17 +66,17 @@ discard block |
||
66 | 66 | $groupCondition = " (props.to_group_id = 0 OR props.to_group_id IS NULL)"; |
67 | 67 | } |
68 | 68 | |
69 | - $zip_folder=new PclZip($FileZip['TEMP_FILE_ZIP']); |
|
70 | - if(!isset($_POST['resource']) || count($_POST['resource']) == 0 ) { |
|
69 | + $zip_folder = new PclZip($FileZip['TEMP_FILE_ZIP']); |
|
70 | + if (!isset($_POST['resource']) || count($_POST['resource']) == 0) { |
|
71 | 71 | Display::display_error_message(get_lang('ErrorMsgSpecialExport')); |
72 | 72 | } else { |
73 | 73 | $Resource = $_POST['resource']; |
74 | 74 | |
75 | 75 | foreach ($Resource as $Code_course => $Sessions) { |
76 | - $_course = api_get_course_info($Code_course); |
|
76 | + $_course = api_get_course_info($Code_course); |
|
77 | 77 | $tbl_document = Database::get_course_table(TABLE_DOCUMENT); |
78 | 78 | $tbl_property = Database::get_course_table(TABLE_ITEM_PROPERTY); |
79 | - $course_id = $_course['real_id']; |
|
79 | + $course_id = $_course['real_id']; |
|
80 | 80 | |
81 | 81 | //Add item to the zip file course |
82 | 82 | $sql = "SELECT path FROM $tbl_document AS docs, $tbl_property AS props |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | AND $groupCondition |
90 | 90 | AND docs.c_id = $course_id |
91 | 91 | AND props.c_id = $course_id"; |
92 | - $query = Database::query($sql ); |
|
92 | + $query = Database::query($sql); |
|
93 | 93 | while ($rows_course_file = Database::fetch_assoc($query)) { |
94 | 94 | $zip_folder->add( |
95 | 95 | $FileZip['PATH_COURSE'].$_course['directory']."/document".$rows_course_file['path'], |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | ); |
101 | 101 | } |
102 | 102 | |
103 | - foreach ($Sessions as $IdSession => $value){ |
|
103 | + foreach ($Sessions as $IdSession => $value) { |
|
104 | 104 | $session_id = Security::remove_XSS($IdSession); |
105 | 105 | //Add tem to the zip file session course |
106 | 106 | $sql_session_doc = "SELECT path FROM $tbl_document AS docs, $tbl_property AS props |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | if (isset ($_POST['backup_option']) && $_POST['backup_option'] == 'select_items') { |
151 | 151 | $cb = new CourseBuilder(); |
152 | 152 | $course = $cb->build_session_course(); |
153 | - if($course === false){ |
|
153 | + if ($course === false) { |
|
154 | 154 | Display::display_error_message(get_lang('ErrorMsgSpecialExport')); |
155 | 155 | form_special_export(); |
156 | 156 | } else { |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | Display::display_footer(); |
167 | 167 | |
168 | 168 | function form_special_export() { |
169 | - $form = new FormValidator('special_exports','post'); |
|
169 | + $form = new FormValidator('special_exports', 'post'); |
|
170 | 170 | $renderer = $form->defaultRenderer(); |
171 | 171 | $renderer->setCustomElementTemplate('<div>{element}</div> '); |
172 | - $form->addElement('radio', 'backup_option', '', get_lang('SpecialCreateFullBackup'), 'full_backup'); |
|
173 | - $form->addElement('radio', 'backup_option', '', get_lang('SpecialLetMeSelectItems'), 'select_items'); |
|
174 | - $form->addElement('html','<br />'); |
|
172 | + $form->addElement('radio', 'backup_option', '', get_lang('SpecialCreateFullBackup'), 'full_backup'); |
|
173 | + $form->addElement('radio', 'backup_option', '', get_lang('SpecialLetMeSelectItems'), 'select_items'); |
|
174 | + $form->addElement('html', '<br />'); |
|
175 | 175 | $form->addButtonExport(get_lang('CreateBackup')); |
176 | 176 | $form->add_progress_bar(); |
177 | 177 | $values['backup_option'] = 'full_backup'; |
@@ -179,26 +179,26 @@ discard block |
||
179 | 179 | $form->display(); |
180 | 180 | } |
181 | 181 | |
182 | -function create_zip(){ |
|
182 | +function create_zip() { |
|
183 | 183 | $path = ''; |
184 | - if(empty($path)) { $path='/'; } |
|
185 | - $remove_dir = ($path!='/') ? substr($path,0,strlen($path) - strlen(basename($path))) : '/'; |
|
184 | + if (empty($path)) { $path = '/'; } |
|
185 | + $remove_dir = ($path != '/') ? substr($path, 0, strlen($path) - strlen(basename($path))) : '/'; |
|
186 | 186 | $sys_archive_path = api_get_path(SYS_ARCHIVE_PATH); |
187 | 187 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
188 | 188 | $temp_zip_dir = $sys_archive_path."temp"; |
189 | - if(!is_dir($temp_zip_dir)) { |
|
189 | + if (!is_dir($temp_zip_dir)) { |
|
190 | 190 | mkdir($temp_zip_dir, api_get_permissions_for_new_directories()); |
191 | 191 | } else { |
192 | - $handle=opendir($temp_zip_dir); |
|
193 | - while (false!==($file = readdir($handle))) { |
|
192 | + $handle = opendir($temp_zip_dir); |
|
193 | + while (false !== ($file = readdir($handle))) { |
|
194 | 194 | if ($file != "." && $file != "..") { |
195 | - $Diff = (time() - filemtime("$temp_zip_dir/$file"))/60/60; //the "age" of the file in hours |
|
196 | - if ($Diff > 4) unlink("$temp_zip_dir/$file"); //delete files older than 4 hours |
|
195 | + $Diff = (time() - filemtime("$temp_zip_dir/$file")) / 60 / 60; //the "age" of the file in hours |
|
196 | + if ($Diff > 4) unlink("$temp_zip_dir/$file"); //delete files older than 4 hours |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 | closedir($handle); |
200 | 200 | } |
201 | - $temp_zip_file = $temp_zip_dir."/".md5(time()).".zip"; //create zipfile of given directory |
|
201 | + $temp_zip_file = $temp_zip_dir."/".md5(time()).".zip"; //create zipfile of given directory |
|
202 | 202 | return array('PATH' => $path, |
203 | 203 | 'PATH_TEMP_ARCHIVE' => $temp_zip_dir, |
204 | 204 | 'PATH_COURSE' => $sys_course_path, |
@@ -207,17 +207,17 @@ discard block |
||
207 | 207 | } |
208 | 208 | |
209 | 209 | function rename_zip($FileZip) { |
210 | - Event::event_download(($FileZip['PATH'] == '/')?'full_export_'.date('Ymd').'.zip (folder)': basename($FileZip['PATH']).'.zip (folder)'); |
|
211 | - $name = ($FileZip['PATH']=='/')? 'full_export_'.date('Ymd').'.zip':basename($FileZip['PATH']).'.zip'; |
|
212 | - if(file_exists($FileZip['PATH_TEMP_ARCHIVE'].'/'.$name)){ unlink($FileZip['PATH_TEMP_ARCHIVE'].'/'.$name); } |
|
213 | - if(file_exists($FileZip['TEMP_FILE_ZIP'])) { |
|
210 | + Event::event_download(($FileZip['PATH'] == '/') ? 'full_export_'.date('Ymd').'.zip (folder)' : basename($FileZip['PATH']).'.zip (folder)'); |
|
211 | + $name = ($FileZip['PATH'] == '/') ? 'full_export_'.date('Ymd').'.zip' : basename($FileZip['PATH']).'.zip'; |
|
212 | + if (file_exists($FileZip['PATH_TEMP_ARCHIVE'].'/'.$name)) { unlink($FileZip['PATH_TEMP_ARCHIVE'].'/'.$name); } |
|
213 | + if (file_exists($FileZip['TEMP_FILE_ZIP'])) { |
|
214 | 214 | rename($FileZip['TEMP_FILE_ZIP'], $FileZip['PATH_TEMP_ARCHIVE'].'/'.$name); |
215 | 215 | return $name; |
216 | 216 | } else { return false; } |
217 | 217 | |
218 | 218 | } |
219 | 219 | |
220 | -function fullexportspecial(){ |
|
220 | +function fullexportspecial() { |
|
221 | 221 | global $tbl_session, $tbl_session_course, $export; |
222 | 222 | $FileZip = create_zip(); |
223 | 223 | $to_group_id = 0; |
@@ -235,10 +235,10 @@ discard block |
||
235 | 235 | } |
236 | 236 | |
237 | 237 | |
238 | - if (count($list_course) >0 ) { |
|
239 | - foreach($list_course as $_course) { |
|
240 | - if($FileZip['PATH'] == '/') { |
|
241 | - $querypath=''; // to prevent ...path LIKE '//%'... in query |
|
238 | + if (count($list_course) > 0) { |
|
239 | + foreach ($list_course as $_course) { |
|
240 | + if ($FileZip['PATH'] == '/') { |
|
241 | + $querypath = ''; // to prevent ...path LIKE '//%'... in query |
|
242 | 242 | } else { |
243 | 243 | $querypath = $FileZip['PATH']; |
244 | 244 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | AND $groupCondition |
256 | 256 | AND docs.c_id = $course_id |
257 | 257 | AND props.c_id = $course_id"; |
258 | - $query = Database::query($sql ); |
|
258 | + $query = Database::query($sql); |
|
259 | 259 | while ($rows_course_file = Database::fetch_assoc($query)) { |
260 | 260 | $rows_course_file['path']; |
261 | 261 | $zip_folder->add($FileZip['PATH_COURSE'].$_course['directory']."/document".$rows_course_file['path'], |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | } |
296 | 296 | |
297 | 297 | $name = rename_zip($FileZip); |
298 | - if ($name === false){ |
|
298 | + if ($name === false) { |
|
299 | 299 | $export = false; |
300 | 300 | return false; |
301 | 301 | } else { |
@@ -193,7 +193,10 @@ |
||
193 | 193 | while (false!==($file = readdir($handle))) { |
194 | 194 | if ($file != "." && $file != "..") { |
195 | 195 | $Diff = (time() - filemtime("$temp_zip_dir/$file"))/60/60; //the "age" of the file in hours |
196 | - if ($Diff > 4) unlink("$temp_zip_dir/$file"); //delete files older than 4 hours |
|
196 | + if ($Diff > 4) { |
|
197 | + unlink("$temp_zip_dir/$file"); |
|
198 | + } |
|
199 | + //delete files older than 4 hours |
|
197 | 200 | } |
198 | 201 | } |
199 | 202 | closedir($handle); |
@@ -37,12 +37,12 @@ discard block |
||
37 | 37 | |
38 | 38 | // Tool name |
39 | 39 | if (isset($_GET['action']) && $_GET['action'] == 'addnote') { |
40 | - $tool = 'NoteAddNew'; |
|
41 | - $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('ToolNotebook')); |
|
40 | + $tool = 'NoteAddNew'; |
|
41 | + $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('ToolNotebook')); |
|
42 | 42 | } |
43 | 43 | if (isset($_GET['action']) && $_GET['action'] == 'editnote') { |
44 | - $tool = 'ModifyNote'; |
|
45 | - $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('ToolNotebook')); |
|
44 | + $tool = 'ModifyNote'; |
|
45 | + $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('ToolNotebook')); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | // Displaying the header |
@@ -53,16 +53,16 @@ discard block |
||
53 | 53 | |
54 | 54 | // Action handling: Adding a note |
55 | 55 | if (isset($_GET['action']) && $_GET['action'] == 'addnote') { |
56 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
57 | - api_not_allowed(); |
|
58 | - } |
|
56 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
57 | + api_not_allowed(); |
|
58 | + } |
|
59 | 59 | |
60 | - if (!empty($_GET['isStudentView'])) { |
|
61 | - NotebookManager::display_notes(); |
|
62 | - exit; |
|
63 | - } |
|
60 | + if (!empty($_GET['isStudentView'])) { |
|
61 | + NotebookManager::display_notes(); |
|
62 | + exit; |
|
63 | + } |
|
64 | 64 | |
65 | - $_SESSION['notebook_view'] = 'creation_date'; |
|
65 | + $_SESSION['notebook_view'] = 'creation_date'; |
|
66 | 66 | |
67 | 67 | $form = new FormValidator( |
68 | 68 | 'note', |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | // Including the global initialization file |
11 | 11 | require_once '../inc/global.inc.php'; |
12 | 12 | |
13 | -$current_course_tool = TOOL_NOTEBOOK; |
|
13 | +$current_course_tool = TOOL_NOTEBOOK; |
|
14 | 14 | |
15 | 15 | // The section (tabs) |
16 | 16 | $this_section = SECTION_COURSES; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | NotebookManager::display_notes(); |
97 | 97 | } else { |
98 | 98 | echo '<div class="actions">'; |
99 | - echo '<a href="index.php">'.Display::return_icon('back.png',get_lang('BackToNotesList'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
99 | + echo '<a href="index.php">'.Display::return_icon('back.png', get_lang('BackToNotesList'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
100 | 100 | echo '</div>'; |
101 | 101 | $token = Security::get_token(); |
102 | 102 | $form->addElement('hidden', 'sec_token'); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | } else { |
148 | 148 | echo '<div class="actions">'; |
149 | 149 | echo '<a href="index.php">'. |
150 | - Display::return_icon('back.png',get_lang('BackToNotesList'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
150 | + Display::return_icon('back.png', get_lang('BackToNotesList'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
151 | 151 | echo '</div>'; |
152 | 152 | $token = Security::get_token(); |
153 | 153 | $form->addElement('hidden', 'sec_token'); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $doc_url = str_replace(' ', '+', $doc_url); |
29 | 29 | $doc_url = str_replace('/..', '', $doc_url); //echo $doc_url; |
30 | 30 | |
31 | -if (strpos($doc_url,'../') OR strpos($doc_url,'/..')) { |
|
31 | +if (strpos($doc_url, '../') OR strpos($doc_url, '/..')) { |
|
32 | 32 | $doc_url = ''; |
33 | 33 | } |
34 | 34 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | //remove last slash if present |
44 | 44 | //$doc_url = ($doc_url{strlen($doc_url)-1}=='/')?substr($doc_url,0,strlen($doc_url)-1):$doc_url; |
45 | 45 | //mod_rewrite can change /some/path/ to /some/path// in some cases, so clean them all off (René) |
46 | - while ($doc_url{$dul = strlen($doc_url)-1}=='/') $doc_url = substr($doc_url,0,$dul); |
|
46 | + while ($doc_url{$dul = strlen($doc_url) - 1} == '/') $doc_url = substr($doc_url, 0, $dul); |
|
47 | 47 | //create the path |
48 | 48 | $document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path |
49 | 49 | //redirect |
@@ -62,12 +62,12 @@ discard block |
||
62 | 62 | $sql = "SELECT filename FROM $tbl_announcement_attachment |
63 | 63 | WHERE c_id = $course_id AND path LIKE BINARY '$doc_url'"; |
64 | 64 | |
65 | -$result= Database::query($sql); |
|
65 | +$result = Database::query($sql); |
|
66 | 66 | if (Database::num_rows($result) > 0) { |
67 | - $row= Database::fetch_array($result); |
|
68 | - $title = str_replace(' ','_', $row['filename']); |
|
67 | + $row = Database::fetch_array($result); |
|
68 | + $title = str_replace(' ', '_', $row['filename']); |
|
69 | 69 | if (Security::check_abs_path($full_file_name, |
70 | - api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/upload/announcements/') |
|
70 | + api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/announcements/') |
|
71 | 71 | ) { |
72 | 72 | DocumentManager::file_send_for_download($full_file_name, true, $title); |
73 | 73 | } |
@@ -43,7 +43,9 @@ |
||
43 | 43 | //remove last slash if present |
44 | 44 | //$doc_url = ($doc_url{strlen($doc_url)-1}=='/')?substr($doc_url,0,strlen($doc_url)-1):$doc_url; |
45 | 45 | //mod_rewrite can change /some/path/ to /some/path// in some cases, so clean them all off (René) |
46 | - while ($doc_url{$dul = strlen($doc_url)-1}=='/') $doc_url = substr($doc_url,0,$dul); |
|
46 | + while ($doc_url{$dul = strlen($doc_url)-1}=='/') { |
|
47 | + $doc_url = substr($doc_url,0,$dul); |
|
48 | + } |
|
47 | 49 | //create the path |
48 | 50 | $document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path |
49 | 51 | //redirect |