@@ -28,15 +28,15 @@ |
||
28 | 28 | switch ($_GET["cmd"]) { |
29 | 29 | case "clear_stapi": |
30 | 30 | echo "Are you sure you are willing to erease all storage api data (no backup)? <a href='cli.php?cmd=clear_stapi_confirm' >Yes</a>"; |
31 | - break; |
|
31 | + break; |
|
32 | 32 | case "clear_stapi_confirm": |
33 | 33 | Database::query("delete from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES)); |
34 | - Database::query("delete from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK)); |
|
35 | - echo "Done"; |
|
36 | - break; |
|
34 | + Database::query("delete from ".Database::get_main_table(TABLE_TRACK_STORED_VALUES_STACK)); |
|
35 | + echo "Done"; |
|
36 | + break; |
|
37 | 37 | default: |
38 | 38 | echo "UNKNOWN COMMAND"; |
39 | - break; |
|
39 | + break; |
|
40 | 40 | } |
41 | 41 | /** |
42 | 42 | * Footer |
@@ -60,8 +60,8 @@ |
||
60 | 60 | $user['error'] = get_lang('UserNameNotAvailable'); |
61 | 61 | $errors[] = $user; |
62 | 62 | } |
63 | - } |
|
64 | - } |
|
63 | + } |
|
64 | + } |
|
65 | 65 | |
66 | 66 | // 3. Check status. |
67 | 67 | if (isset($user['Status']) && !api_status_exists($user['Status'])) { |
@@ -22,59 +22,59 @@ |
||
22 | 22 | $output = false; |
23 | 23 | $ls = new langstats(); |
24 | 24 | if ($ls === false) { |
25 | - exit($ls->error); |
|
25 | + exit($ls->error); |
|
26 | 26 | } |
27 | 27 | $list = $ls->get_popular_terms($x_most_popular); |
28 | 28 | if ($_GET['output'] == 1) { |
29 | - $output = true; |
|
30 | - $variables_origin = $ls->get_variables_origin(); |
|
29 | + $output = true; |
|
30 | + $variables_origin = $ls->get_variables_origin(); |
|
31 | 31 | } |
32 | 32 | /** |
33 | 33 | * Display |
34 | 34 | */ |
35 | 35 | if (count($list)==0) { echo 'No terms loaded so far'; } |
36 | 36 | if (count($list)>0) { |
37 | - $i = 1; |
|
38 | - $j = 1; |
|
39 | - $k = 0; |
|
40 | - $files = array(); |
|
41 | - $trans = array(); |
|
42 | - echo 'Number of records: '.count($list).'<br />'; |
|
43 | - echo '<table><tr><th>Index</th><th>Registration order</th><th>Term</th>'.($output==1?'<th>Origin</th>':'').'<th>Count</th></tr>'; |
|
44 | - foreach($list as $elem) { |
|
37 | + $i = 1; |
|
38 | + $j = 1; |
|
39 | + $k = 0; |
|
40 | + $files = array(); |
|
41 | + $trans = array(); |
|
42 | + echo 'Number of records: '.count($list).'<br />'; |
|
43 | + echo '<table><tr><th>Index</th><th>Registration order</th><th>Term</th>'.($output==1?'<th>Origin</th>':'').'<th>Count</th></tr>'; |
|
44 | + foreach($list as $elem) { |
|
45 | 45 | if ($k > $terms_limit) { break; } |
46 | 46 | $fixed_elem = $elem; |
47 | 47 | if ($output) { |
48 | - if (empty($variables_origin[$elem['term_name']]) && !empty($variables_origin['lang'.$elem['term_name']])) { |
|
48 | + if (empty($variables_origin[$elem['term_name']]) && !empty($variables_origin['lang'.$elem['term_name']])) { |
|
49 | 49 | $fixed_elem = array('id' => $elem['id'], 'term_name' => 'lang'.$elem['term_name'], 'term_count' => $elem['term_count']); |
50 | - } |
|
51 | - if (empty($variables_origin[$fixed_elem['term_name']])) { |
|
50 | + } |
|
51 | + if (empty($variables_origin[$fixed_elem['term_name']])) { |
|
52 | 52 | continue; |
53 | - } |
|
54 | - $files[$variables_origin[$fixed_elem['term_name']]][] = $fixed_elem['term_name']; |
|
55 | - $translation = get_lang($fixed_elem['term_name']); |
|
56 | - $k += str_word_count($translation); |
|
57 | - $trans[$fixed_elem['term_name']] = $translation; |
|
58 | - $j++; |
|
53 | + } |
|
54 | + $files[$variables_origin[$fixed_elem['term_name']]][] = $fixed_elem['term_name']; |
|
55 | + $translation = get_lang($fixed_elem['term_name']); |
|
56 | + $k += str_word_count($translation); |
|
57 | + $trans[$fixed_elem['term_name']] = $translation; |
|
58 | + $j++; |
|
59 | 59 | } |
60 | 60 | echo '<tr><td>',$i, |
61 | - '</td><td>',$fixed_elem['id'], |
|
62 | - '</td><td>',$fixed_elem['term_name']; |
|
61 | + '</td><td>',$fixed_elem['id'], |
|
62 | + '</td><td>',$fixed_elem['term_name']; |
|
63 | 63 | if ($output) { |
64 | - echo '</td><td>'.$variables_origin[$fixed_elem['term_name']]; |
|
64 | + echo '</td><td>'.$variables_origin[$fixed_elem['term_name']]; |
|
65 | 65 | } |
66 | 66 | echo '</td><td>',$fixed_elem['term_count'],'</td></tr>'; |
67 | 67 | $i++; |
68 | - } |
|
69 | - echo '</table>'; |
|
70 | - if ($output) { |
|
68 | + } |
|
69 | + echo '</table>'; |
|
70 | + if ($output) { |
|
71 | 71 | @mkdir('/tmp/lang'); |
72 | 72 | foreach ($files as $file => $terms) { |
73 | - @touch('/tmp/lang/'.$file); |
|
74 | - file_put_contents('/tmp/lang/'.$file,"<?php".PHP_EOL); |
|
75 | - foreach ($terms as $term) { |
|
73 | + @touch('/tmp/lang/'.$file); |
|
74 | + file_put_contents('/tmp/lang/'.$file,"<?php".PHP_EOL); |
|
75 | + foreach ($terms as $term) { |
|
76 | 76 | file_put_contents('/tmp/lang/'.$file,'$'.$term.' = "'.str_replace('"','\"',$trans[$term]).'";'.PHP_EOL, FILE_APPEND); |
77 | - } |
|
77 | + } |
|
78 | 78 | } |
79 | - } |
|
79 | + } |
|
80 | 80 | } |
@@ -33,15 +33,15 @@ discard block |
||
33 | 33 | * Code run |
34 | 34 | */ |
35 | 35 | foreach ($terms as $row) { |
36 | - if ($words_counter > 10000) { break; } |
|
37 | - $words = str_word_count(get_lang($row['term_name'],null,$orig_lang)); |
|
38 | - $words_counter += $words; |
|
39 | - $terms_in_limit[$row['term_name']] = $i; |
|
40 | - //echo "Term <b>".$row['term_name']."</b> is <b>'".get_lang($row['term_name'],null,$orig_lang)."'</b> which means $words words<br /><br />\n"; |
|
41 | - //if ($words_counter%1000 >= 0) { |
|
36 | + if ($words_counter > 10000) { break; } |
|
37 | + $words = str_word_count(get_lang($row['term_name'],null,$orig_lang)); |
|
38 | + $words_counter += $words; |
|
39 | + $terms_in_limit[$row['term_name']] = $i; |
|
40 | + //echo "Term <b>".$row['term_name']."</b> is <b>'".get_lang($row['term_name'],null,$orig_lang)."'</b> which means $words words<br /><br />\n"; |
|
41 | + //if ($words_counter%1000 >= 0) { |
|
42 | 42 | //echo "Reached $words_counter words at term $i (".$row['term_name']." used ".$row['term_count']." times)...<br />\n"; |
43 | - //} |
|
44 | - $i++; |
|
43 | + //} |
|
44 | + $i++; |
|
45 | 45 | } |
46 | 46 | //echo $words_counter.'<br />'; |
47 | 47 | |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | |
50 | 50 | echo "Scanning English files, trying to find these terms...<br />\n"; |
51 | 51 | if (!is_dir($arch_dir.'/langstats')) { |
52 | - mkdir($arch_dir.'/langstats'); |
|
53 | - mkdir($arch_dir.'/langstats/'.$orig_lang); |
|
52 | + mkdir($arch_dir.'/langstats'); |
|
53 | + mkdir($arch_dir.'/langstats/'.$orig_lang); |
|
54 | 54 | } |
55 | 55 | $list_files = scandir($lang_dir.'/'.$orig_lang); |
56 | 56 | $j = 1; |
@@ -59,35 +59,35 @@ discard block |
||
59 | 59 | $global_var = array(); //keep the combination of all vars |
60 | 60 | $terms_in_limit = array_flip($terms_in_limit); |
61 | 61 | foreach ($list_files as $file) { |
62 | - if (substr($file,0,1) == '.') {continue;} |
|
63 | - //echo "'".substr($file,0,-8)."',<br />"; //print in a PHP array format |
|
64 | - $vars = file($lang_dir.'/'.$orig_lang.'/'.$file); |
|
65 | - $local_var = array(); |
|
66 | - $file_string = '<?php'."\n"; |
|
67 | - foreach ($vars as $line) { |
|
62 | + if (substr($file,0,1) == '.') {continue;} |
|
63 | + //echo "'".substr($file,0,-8)."',<br />"; //print in a PHP array format |
|
64 | + $vars = file($lang_dir.'/'.$orig_lang.'/'.$file); |
|
65 | + $local_var = array(); |
|
66 | + $file_string = '<?php'."\n"; |
|
67 | + foreach ($vars as $line) { |
|
68 | 68 | $var = array(); |
69 | 69 | $res = preg_match('/^(\$\w*)/',$line,$var); |
70 | 70 | if ($res>0) { |
71 | - //echo $var[1]."<br />"; |
|
71 | + //echo $var[1]."<br />"; |
|
72 | 72 | |
73 | - if (in_array(substr($var[1],1),$terms_in_limit)) { |
|
73 | + if (in_array(substr($var[1],1),$terms_in_limit)) { |
|
74 | 74 | //echo "Var ".$var[1]." was in the limit<br />"; |
75 | 75 | $local_var[$var[1]] = $line; |
76 | 76 | $file_string .= $line; |
77 | 77 | $terms_found[] = substr($var[1],1); //e.g. store Tools |
78 | 78 | $words_found += str_word_count(get_lang($var[1],null,$orig_lang)); |
79 | - } elseif (in_array(substr($var[1],5),$terms_in_limit)) { |
|
79 | + } elseif (in_array(substr($var[1],5),$terms_in_limit)) { |
|
80 | 80 | //echo "Var ".$var[1]." was in the limit<br />"; |
81 | 81 | $local_var[$var[1]] = $line; |
82 | 82 | $file_string .= $line; |
83 | 83 | $terms_found[] = substr($var[1],5); //e.g. store langTools |
84 | 84 | $words_found += str_word_count(get_lang(substr($var[1],5),null,$orig_lang)); |
85 | - } //else do not care |
|
85 | + } //else do not care |
|
86 | 86 | } |
87 | - } |
|
88 | - echo "Writing ".$arch_dir.'/langstats/'.$orig_lang.'/'.$file."<br />\n"; |
|
89 | - file_put_contents($arch_dir.'/langstats/'.$orig_lang.'/'.$file,$file_string); |
|
90 | - $global_var += $local_var; |
|
87 | + } |
|
88 | + echo "Writing ".$arch_dir.'/langstats/'.$orig_lang.'/'.$file."<br />\n"; |
|
89 | + file_put_contents($arch_dir.'/langstats/'.$orig_lang.'/'.$file,$file_string); |
|
90 | + $global_var += $local_var; |
|
91 | 91 | }; |
92 | 92 | $terms_diff = count($global_var)-count($terms_in_limit); |
93 | 93 | echo count($global_var)." terms found in English files (summing up to $words_found words). Some terms ($terms_diff in this case) might have appeared in two different files<br />"; |
@@ -625,7 +625,6 @@ discard block |
||
625 | 625 | * The other configuration parameters have not been changed. |
626 | 626 | * |
627 | 627 | * This is how we can get most used paths, for common purpose: |
628 | - |
|
629 | 628 | * api_get_path(REL_PATH) /chamilo/ |
630 | 629 | * api_get_path(REL_COURSE_PATH) /chamilo/courses/ |
631 | 630 | * api_get_path(REL_CODE_PATH) /chamilo/main/ |
@@ -1803,7 +1802,6 @@ discard block |
||
1803 | 1802 | |
1804 | 1803 | /** |
1805 | 1804 | * Returns the current course info array. |
1806 | - |
|
1807 | 1805 | * Now if the course_code is given, the returned array gives info about that |
1808 | 1806 | * particular course, not specially the current one. |
1809 | 1807 | * @param int $id Numeric ID of the course |
@@ -2734,7 +2732,7 @@ discard block |
||
2734 | 2732 | switch ($session_user_status) { |
2735 | 2733 | case 0: |
2736 | 2734 | $session_status['status'] = 'student'; |
2737 | - break; |
|
2735 | + break; |
|
2738 | 2736 | case 2: |
2739 | 2737 | $session_status['status'] = 'coach'; |
2740 | 2738 | break; |
@@ -6492,7 +6490,7 @@ discard block |
||
6492 | 6490 | function api_get_jquery_ui_js($include_jqgrid = false) { |
6493 | 6491 | $libraries = array(); |
6494 | 6492 | if ($include_jqgrid) { |
6495 | - $libraries[]='jqgrid'; |
|
6493 | + $libraries[]='jqgrid'; |
|
6496 | 6494 | } |
6497 | 6495 | return api_get_jquery_libraries_js($libraries); |
6498 | 6496 | } |
@@ -1682,7 +1682,7 @@ discard block |
||
1682 | 1682 | $html .= '<label class="checkbox-inline"> |
1683 | 1683 | <input type="radio" name="allowSelfReg" value="0" id="allowSelfReg0" '. ($allowSelfReg == 'false' ? '' : 'checked="checked" ') .' /> '. get_lang('No') .' |
1684 | 1684 | </label>'; |
1685 | - $html .= '<label class="checkbox-inline"> |
|
1685 | + $html .= '<label class="checkbox-inline"> |
|
1686 | 1686 | <input type="radio" name="allowSelfReg" value="0" id="allowSelfReg0" '. ($allowSelfReg == 'approval' ? '' : 'checked="checked" ') .' /> '. get_lang('AfterApproval') .' |
1687 | 1687 | </label>'; |
1688 | 1688 | $html .= '</div>'; |
@@ -1716,7 +1716,7 @@ discard block |
||
1716 | 1716 | </div>'; |
1717 | 1717 | |
1718 | 1718 | echo panel($html, get_lang('Platform'), 'platform'); |
1719 | - ?> |
|
1719 | + ?> |
|
1720 | 1720 | <div class='form-group'> |
1721 | 1721 | <div class="col-sm-6"> |
1722 | 1722 | <button type="submit" class="btn btn-default pull-right" name="step3" value="< <?php echo get_lang('Previous'); ?>" ><em class="fa fa-backward"> </em> <?php echo get_lang('Previous'); ?></button> |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | if (Database::num_rows($result) == 0) { |
214 | 214 | $condition = ''; |
215 | 215 | } else { |
216 | - //great, there is an specific auto launch for this session we leave the $condition |
|
216 | + //great, there is an specific auto launch for this session we leave the $condition |
|
217 | 217 | } |
218 | 218 | } |
219 | 219 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $lp_data = Database::fetch_array($result,'ASSOC'); |
226 | 226 | if (!empty($lp_data['id'])) { |
227 | 227 | if (api_is_platform_admin() || api_is_allowed_to_edit()) { |
228 | - $show_autolaunch_lp_warning = true; |
|
228 | + $show_autolaunch_lp_warning = true; |
|
229 | 229 | } else { |
230 | 230 | $session_key = 'lp_autolaunch_'.$session_id.'_'.api_get_course_int_id().'_'.api_get_user_id(); |
231 | 231 | if (!isset($_SESSION[$session_key])) { |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | //if (!isset($_SESSION[$forumKey])) { |
255 | 255 | //redirecting to the LP |
256 | 256 | $url = api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq().'&id_session='.$session_id; |
257 | - // $_SESSION[$forumKey] = true; |
|
257 | + // $_SESSION[$forumKey] = true; |
|
258 | 258 | header("Location: $url"); |
259 | 259 | exit; |
260 | 260 | //} |
@@ -280,13 +280,13 @@ discard block |
||
280 | 280 | if (api_get_setting('course.homepage_view') == 'activity' || |
281 | 281 | api_get_setting('course.homepage_view') == 'activity_big' |
282 | 282 | ) { |
283 | - require 'activity.php'; |
|
283 | + require 'activity.php'; |
|
284 | 284 | } elseif (api_get_setting('course.homepage_view') == '2column') { |
285 | - require '2column.php'; |
|
285 | + require '2column.php'; |
|
286 | 286 | } elseif (api_get_setting('course.homepage_view') == '3column') { |
287 | - require '3column.php'; |
|
287 | + require '3column.php'; |
|
288 | 288 | } elseif (api_get_setting('course.homepage_view') == 'vertical_activity') { |
289 | - require 'vertical_activity.php'; |
|
289 | + require 'vertical_activity.php'; |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | $content = '<div id="course_tools">'.$content.'</div>'; |
@@ -7,12 +7,12 @@ discard block |
||
7 | 7 | $last_access = ''; |
8 | 8 | // get the last time the user accessed the tool |
9 | 9 | if (isset($_SESSION[$_course['id']]) && $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX] == '') { |
10 | - $last_access = get_last_tool_access(TOOL_DROPBOX); |
|
11 | - $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX] = $last_access; |
|
10 | + $last_access = get_last_tool_access(TOOL_DROPBOX); |
|
11 | + $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX] = $last_access; |
|
12 | 12 | } else { |
13 | - if (isset($_SESSION[$_course['id']])) { |
|
14 | - $last_access = $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX]; |
|
15 | - } |
|
13 | + if (isset($_SESSION[$_course['id']])) { |
|
14 | + $last_access = $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX]; |
|
15 | + } |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | $postAction = isset($_POST['action']) ? $_POST['action'] : null; |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | |
50 | 50 | // Display the form for adding a new dropbox item. |
51 | 51 | if ($action == 'add') { |
52 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
53 | - api_not_allowed(); |
|
54 | - } |
|
52 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
53 | + api_not_allowed(); |
|
54 | + } |
|
55 | 55 | display_add_form( |
56 | 56 | $dropbox_unid, |
57 | 57 | $viewReceivedCategory, |
@@ -61,56 +61,56 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | if (isset($_POST['submitWork'])) { |
64 | - $check = Security::check_token(); |
|
65 | - if ($check) { |
|
64 | + $check = Security::check_token(); |
|
65 | + if ($check) { |
|
66 | 66 | store_add_dropbox(); |
67 | - } |
|
67 | + } |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // Display the form for adding a category |
71 | 71 | if ($action == 'addreceivedcategory' || $action == 'addsentcategory') { |
72 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
73 | - api_not_allowed(); |
|
74 | - } |
|
75 | - $categoryName = isset($_POST['category_name']) ? $_POST['category_name'] : ''; |
|
76 | - display_addcategory_form($categoryName, '', $_GET['action']); |
|
72 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
73 | + api_not_allowed(); |
|
74 | + } |
|
75 | + $categoryName = isset($_POST['category_name']) ? $_POST['category_name'] : ''; |
|
76 | + display_addcategory_form($categoryName, '', $_GET['action']); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | // Editing a category: displaying the form |
80 | 80 | if ($action == 'editcategory' && isset($_GET['id'])) { |
81 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
82 | - api_not_allowed(); |
|
83 | - } |
|
84 | - if (!$_POST) { |
|
85 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
86 | - api_not_allowed(); |
|
87 | - } |
|
88 | - display_addcategory_form('', $_GET['id'], 'editcategory'); |
|
89 | - } |
|
81 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
82 | + api_not_allowed(); |
|
83 | + } |
|
84 | + if (!$_POST) { |
|
85 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
86 | + api_not_allowed(); |
|
87 | + } |
|
88 | + display_addcategory_form('', $_GET['id'], 'editcategory'); |
|
89 | + } |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | // Storing a new or edited category |
93 | 93 | if (isset($_POST['StoreCategory'])) { |
94 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
95 | - api_not_allowed(); |
|
96 | - } |
|
97 | - $return_information = store_addcategory(); |
|
98 | - if ($return_information['type'] == 'confirmation') { |
|
99 | - Display :: display_confirmation_message($return_information['message']); |
|
100 | - } |
|
101 | - if ($return_information['type'] == 'error') { |
|
102 | - Display :: display_error_message(get_lang('FormHasErrorsPleaseComplete').'<br />'.$return_information['message']); |
|
103 | - display_addcategory_form($_POST['category_name'], $_POST['edit_id'], $postAction); |
|
104 | - } |
|
94 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
95 | + api_not_allowed(); |
|
96 | + } |
|
97 | + $return_information = store_addcategory(); |
|
98 | + if ($return_information['type'] == 'confirmation') { |
|
99 | + Display :: display_confirmation_message($return_information['message']); |
|
100 | + } |
|
101 | + if ($return_information['type'] == 'error') { |
|
102 | + Display :: display_error_message(get_lang('FormHasErrorsPleaseComplete').'<br />'.$return_information['message']); |
|
103 | + display_addcategory_form($_POST['category_name'], $_POST['edit_id'], $postAction); |
|
104 | + } |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
108 | 108 | // Move a File |
109 | 109 | if (($action == 'movesent' || $action == 'movereceived') AND isset($_GET['move_id'])) { |
110 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
111 | - api_not_allowed(); |
|
112 | - } |
|
113 | - display_move_form( |
|
110 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
111 | + api_not_allowed(); |
|
112 | + } |
|
113 | + display_move_form( |
|
114 | 114 | str_replace('move', '', $action), |
115 | 115 | $_GET['move_id'], |
116 | 116 | get_dropbox_categories(str_replace('move', '', $action)), |
@@ -121,33 +121,33 @@ discard block |
||
121 | 121 | ); |
122 | 122 | } |
123 | 123 | if (isset($_POST['do_move'])) { |
124 | - Display :: display_confirmation_message(store_move($_POST['id'], $_POST['move_target'], $_POST['part'])); |
|
124 | + Display :: display_confirmation_message(store_move($_POST['id'], $_POST['move_target'], $_POST['part'])); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | // Delete a file |
128 | 128 | if (($action == 'deletereceivedfile' || $action == 'deletesentfile') AND isset($_GET['id']) AND is_numeric($_GET['id'])) { |
129 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
130 | - api_not_allowed(); |
|
131 | - } |
|
132 | - $dropboxfile = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor); |
|
133 | - if ($action == 'deletereceivedfile') { |
|
134 | - $dropboxfile->deleteReceivedWork($_GET['id']); |
|
135 | - $message = get_lang('ReceivedFileDeleted'); |
|
136 | - } |
|
137 | - if ($action == 'deletesentfile') { |
|
138 | - $dropboxfile->deleteSentWork($_GET['id']); |
|
139 | - $message = get_lang('SentFileDeleted'); |
|
140 | - } |
|
141 | - Display :: display_confirmation_message($message); |
|
129 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
130 | + api_not_allowed(); |
|
131 | + } |
|
132 | + $dropboxfile = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor); |
|
133 | + if ($action == 'deletereceivedfile') { |
|
134 | + $dropboxfile->deleteReceivedWork($_GET['id']); |
|
135 | + $message = get_lang('ReceivedFileDeleted'); |
|
136 | + } |
|
137 | + if ($action == 'deletesentfile') { |
|
138 | + $dropboxfile->deleteSentWork($_GET['id']); |
|
139 | + $message = get_lang('SentFileDeleted'); |
|
140 | + } |
|
141 | + Display :: display_confirmation_message($message); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | // Delete a category |
145 | 145 | if (($action == 'deletereceivedcategory' || $action == 'deletesentcategory') AND isset($_GET['id']) AND is_numeric($_GET['id'])) { |
146 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
147 | - api_not_allowed(); |
|
148 | - } |
|
149 | - $message = delete_category($action, $_GET['id']); |
|
150 | - Display :: display_confirmation_message($message); |
|
146 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
147 | + api_not_allowed(); |
|
148 | + } |
|
149 | + $message = delete_category($action, $_GET['id']); |
|
150 | + Display :: display_confirmation_message($message); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | // Do an action on multiple files |
@@ -162,27 +162,27 @@ discard block |
||
162 | 162 | $postAction == 'delete_sent' || |
163 | 163 | $postAction == 'download_sent') |
164 | 164 | ) { |
165 | - $display_message = handle_multiple_actions(); |
|
166 | - Display :: display_normal_message($display_message); |
|
165 | + $display_message = handle_multiple_actions(); |
|
166 | + Display :: display_normal_message($display_message); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | // Store Feedback |
170 | 170 | |
171 | 171 | if (isset($_POST['feedback'])) { |
172 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
173 | - api_not_allowed(); |
|
174 | - } |
|
175 | - $check = Security::check_token(); |
|
176 | - if ($check) { |
|
177 | - $display_message = store_feedback(); |
|
178 | - Display :: display_normal_message($display_message); |
|
179 | - Security::check_token(); |
|
180 | - } |
|
172 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
173 | + api_not_allowed(); |
|
174 | + } |
|
175 | + $check = Security::check_token(); |
|
176 | + if ($check) { |
|
177 | + $display_message = store_feedback(); |
|
178 | + Display :: display_normal_message($display_message); |
|
179 | + Security::check_token(); |
|
180 | + } |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | // Error Message |
184 | 184 | if (isset($_GET['error']) AND !empty($_GET['error'])) { |
185 | - Display :: display_normal_message(get_lang($_GET['error'])); |
|
185 | + Display :: display_normal_message(get_lang($_GET['error'])); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | $dropbox_data_sent = array(); |
@@ -190,96 +190,96 @@ discard block |
||
190 | 190 | $dropbox_data_recieved = array(); |
191 | 191 | |
192 | 192 | if ($action != 'add') { |
193 | - // Getting all the categories in the dropbox for the given user |
|
194 | - $dropbox_categories = get_dropbox_categories(); |
|
195 | - // Greating the arrays with the categories for the received files and for the sent files |
|
196 | - foreach ($dropbox_categories as $category) { |
|
197 | - if ($category['received'] == '1') { |
|
198 | - $dropbox_received_category[] = $category; |
|
199 | - } |
|
200 | - if ($category['sent'] == '1') { |
|
201 | - $dropbox_sent_category[] = $category; |
|
202 | - } |
|
203 | - } |
|
204 | - |
|
205 | - // ACTIONS |
|
206 | - if ($view == 'received' || !$dropbox_cnf['sent_received_tabs']) { |
|
207 | - //echo '<h3>'.get_lang('ReceivedFiles').'</h3>'; |
|
208 | - |
|
209 | - // This is for the categories |
|
210 | - if (isset($viewReceivedCategory) AND $viewReceivedCategory != '') { |
|
211 | - $view_dropbox_category_received = $viewReceivedCategory; |
|
212 | - } else { |
|
213 | - $view_dropbox_category_received = 0; |
|
214 | - } |
|
215 | - |
|
216 | - /* Menu Received */ |
|
217 | - |
|
218 | - if (api_get_session_id() == 0) { |
|
219 | - echo '<div class="actions">'; |
|
220 | - if ($view_dropbox_category_received != 0 && api_is_allowed_to_session_edit(false, true)) { |
|
221 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&view_sent_category='.$viewSentCategory.'&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
222 | - echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_received]['cat_name']).'</strong> '; |
|
223 | - $movelist[0] = 'Root'; // move_received selectbox content |
|
224 | - } else { |
|
225 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory&view='.$view.'">'.Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
226 | - } |
|
227 | - echo '</div>'; |
|
228 | - } else { |
|
229 | - if (api_is_allowed_to_session_edit(false, true)) { |
|
230 | - echo '<div class="actions">'; |
|
231 | - if ($view_dropbox_category_received != 0 && api_is_allowed_to_session_edit(false, true)) { |
|
232 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&view_sent_category='.$viewSentCategory.'&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
233 | - echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_received]['cat_name']).'</strong> '; |
|
234 | - $movelist[0] = 'Root'; // move_received selectbox content |
|
235 | - } else { |
|
236 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory&view='.$view.'">'.Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
237 | - } |
|
238 | - echo '</div>'; |
|
239 | - } |
|
240 | - } |
|
241 | - } |
|
242 | - |
|
243 | - if (!$view || $view == 'sent' || !$dropbox_cnf['sent_received_tabs']) { |
|
244 | - // This is for the categories |
|
245 | - if (isset($viewSentCategory) AND $viewSentCategory != '') { |
|
246 | - $view_dropbox_category_sent = $viewSentCategory; |
|
247 | - } else { |
|
248 | - $view_dropbox_category_sent = 0; |
|
249 | - } |
|
250 | - |
|
251 | - /* Menu Sent */ |
|
252 | - |
|
253 | - if (api_get_session_id() == 0) { |
|
254 | - echo '<div class="actions">'; |
|
255 | - if ($view_dropbox_category_sent != 0) { |
|
256 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
257 | - echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_sent]['cat_name']).'</strong> '; |
|
258 | - } else { |
|
259 | - echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=addsentcategory\">".Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM)."</a>\n"; |
|
260 | - } |
|
261 | - if (empty($viewSentCategory)) { |
|
262 | - echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".Display::return_icon('upload_file.png', get_lang('UploadNewFile'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
263 | - } |
|
264 | - echo '</div>'; |
|
265 | - } else { |
|
266 | - if (api_is_allowed_to_session_edit(false, true)) { |
|
267 | - echo '<div class="actions">'; |
|
268 | - if ($view_dropbox_category_sent != 0) { |
|
269 | - echo get_lang('CurrentlySeeing').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_sent]['cat_name']).'</strong> '; |
|
270 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
271 | - } else { |
|
272 | - echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=addsentcategory\">".Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM)."</a>\n"; |
|
273 | - } |
|
274 | - if (empty($viewSentCategory)) { |
|
275 | - echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".Display::return_icon('upload_file.png', get_lang('UploadNewFile'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
276 | - } |
|
277 | - echo '</div>'; |
|
278 | - } |
|
279 | - } |
|
280 | - } |
|
281 | - /* THE MENU TABS */ |
|
282 | - if ($dropbox_cnf['sent_received_tabs']) { |
|
193 | + // Getting all the categories in the dropbox for the given user |
|
194 | + $dropbox_categories = get_dropbox_categories(); |
|
195 | + // Greating the arrays with the categories for the received files and for the sent files |
|
196 | + foreach ($dropbox_categories as $category) { |
|
197 | + if ($category['received'] == '1') { |
|
198 | + $dropbox_received_category[] = $category; |
|
199 | + } |
|
200 | + if ($category['sent'] == '1') { |
|
201 | + $dropbox_sent_category[] = $category; |
|
202 | + } |
|
203 | + } |
|
204 | + |
|
205 | + // ACTIONS |
|
206 | + if ($view == 'received' || !$dropbox_cnf['sent_received_tabs']) { |
|
207 | + //echo '<h3>'.get_lang('ReceivedFiles').'</h3>'; |
|
208 | + |
|
209 | + // This is for the categories |
|
210 | + if (isset($viewReceivedCategory) AND $viewReceivedCategory != '') { |
|
211 | + $view_dropbox_category_received = $viewReceivedCategory; |
|
212 | + } else { |
|
213 | + $view_dropbox_category_received = 0; |
|
214 | + } |
|
215 | + |
|
216 | + /* Menu Received */ |
|
217 | + |
|
218 | + if (api_get_session_id() == 0) { |
|
219 | + echo '<div class="actions">'; |
|
220 | + if ($view_dropbox_category_received != 0 && api_is_allowed_to_session_edit(false, true)) { |
|
221 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&view_sent_category='.$viewSentCategory.'&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
222 | + echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_received]['cat_name']).'</strong> '; |
|
223 | + $movelist[0] = 'Root'; // move_received selectbox content |
|
224 | + } else { |
|
225 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory&view='.$view.'">'.Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
226 | + } |
|
227 | + echo '</div>'; |
|
228 | + } else { |
|
229 | + if (api_is_allowed_to_session_edit(false, true)) { |
|
230 | + echo '<div class="actions">'; |
|
231 | + if ($view_dropbox_category_received != 0 && api_is_allowed_to_session_edit(false, true)) { |
|
232 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&view_sent_category='.$viewSentCategory.'&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
233 | + echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_received]['cat_name']).'</strong> '; |
|
234 | + $movelist[0] = 'Root'; // move_received selectbox content |
|
235 | + } else { |
|
236 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory&view='.$view.'">'.Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
237 | + } |
|
238 | + echo '</div>'; |
|
239 | + } |
|
240 | + } |
|
241 | + } |
|
242 | + |
|
243 | + if (!$view || $view == 'sent' || !$dropbox_cnf['sent_received_tabs']) { |
|
244 | + // This is for the categories |
|
245 | + if (isset($viewSentCategory) AND $viewSentCategory != '') { |
|
246 | + $view_dropbox_category_sent = $viewSentCategory; |
|
247 | + } else { |
|
248 | + $view_dropbox_category_sent = 0; |
|
249 | + } |
|
250 | + |
|
251 | + /* Menu Sent */ |
|
252 | + |
|
253 | + if (api_get_session_id() == 0) { |
|
254 | + echo '<div class="actions">'; |
|
255 | + if ($view_dropbox_category_sent != 0) { |
|
256 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
257 | + echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_sent]['cat_name']).'</strong> '; |
|
258 | + } else { |
|
259 | + echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=addsentcategory\">".Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM)."</a>\n"; |
|
260 | + } |
|
261 | + if (empty($viewSentCategory)) { |
|
262 | + echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".Display::return_icon('upload_file.png', get_lang('UploadNewFile'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
263 | + } |
|
264 | + echo '</div>'; |
|
265 | + } else { |
|
266 | + if (api_is_allowed_to_session_edit(false, true)) { |
|
267 | + echo '<div class="actions">'; |
|
268 | + if ($view_dropbox_category_sent != 0) { |
|
269 | + echo get_lang('CurrentlySeeing').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_sent]['cat_name']).'</strong> '; |
|
270 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
271 | + } else { |
|
272 | + echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=addsentcategory\">".Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM)."</a>\n"; |
|
273 | + } |
|
274 | + if (empty($viewSentCategory)) { |
|
275 | + echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".Display::return_icon('upload_file.png', get_lang('UploadNewFile'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
276 | + } |
|
277 | + echo '</div>'; |
|
278 | + } |
|
279 | + } |
|
280 | + } |
|
281 | + /* THE MENU TABS */ |
|
282 | + if ($dropbox_cnf['sent_received_tabs']) { |
|
283 | 283 | ?> |
284 | 284 | <ul class="nav nav-tabs"> |
285 | 285 | <li <?php if (!$view || $view == 'sent') { echo 'class="active"'; } ?> > |
@@ -293,150 +293,150 @@ discard block |
||
293 | 293 | </li> |
294 | 294 | </ul> |
295 | 295 | <?php |
296 | - } |
|
296 | + } |
|
297 | 297 | /* RECEIVED FILES */ |
298 | - if ($view == 'received' || !$dropbox_cnf['sent_received_tabs']) { |
|
299 | - // This is for the categories |
|
300 | - if (isset($viewReceivedCategory) AND $viewReceivedCategory != '') { |
|
301 | - $view_dropbox_category_received = $viewReceivedCategory; |
|
302 | - } else { |
|
303 | - $view_dropbox_category_received = 0; |
|
304 | - } |
|
305 | - |
|
306 | - // Object initialisation |
|
307 | - $dropbox_person = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor); |
|
308 | - // note: are the $is_courseAdmin and $is_courseTutor parameters needed???? |
|
309 | - |
|
310 | - // Constructing the array that contains the total number of feedback messages per document. |
|
311 | - $number_feedback = get_total_number_feedback(); |
|
312 | - |
|
313 | - // Sorting and paging options |
|
314 | - $sorting_options = array(); |
|
315 | - $paging_options = array(); |
|
316 | - |
|
317 | - // The headers of the sortable tables |
|
318 | - $column_header = array(); |
|
319 | - $column_header[] = array('', false, ''); |
|
320 | - $column_header[] = array(get_lang('Type'), true, 'style="width:40px"', 'style="text-align:center"'); |
|
321 | - $column_header[] = array(get_lang('ReceivedTitle'), true, ''); |
|
322 | - $column_header[] = array(get_lang('Size'), true, ''); |
|
323 | - $column_header[] = array(get_lang('Authors'), true, ''); |
|
324 | - $column_header[] = array(get_lang('LastResent'), true); |
|
325 | - |
|
326 | - if (api_get_session_id() == 0) { |
|
327 | - $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
328 | - } elseif (api_is_allowed_to_session_edit(false,true)) { |
|
329 | - $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
330 | - } |
|
331 | - |
|
332 | - $column_header[] = array('RealDate', true); |
|
333 | - $column_header[] = array('RealSize', true); |
|
334 | - |
|
335 | - // An array with the setting of the columns -> 1: columns that we will show, 0:columns that will be hide |
|
336 | - $column_show[] = 1; |
|
337 | - $column_show[] = 1; |
|
338 | - $column_show[] = 1; |
|
339 | - $column_show[] = 1; |
|
340 | - $column_show[] = 1; |
|
341 | - $column_show[] = 1; |
|
342 | - |
|
343 | - if (api_get_session_id() == 0) { |
|
344 | - $column_show[] = 1; |
|
345 | - } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
346 | - $column_show[] = 1; |
|
347 | - } |
|
348 | - $column_show[] = 0; |
|
349 | - |
|
350 | - // Here we change the way how the columns are going to be sort |
|
351 | - // in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate |
|
352 | - // because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48" |
|
353 | - |
|
354 | - $column_order[3] = 8; |
|
355 | - $column_order[5] = 7; |
|
356 | - |
|
357 | - // The content of the sortable table = the received files |
|
358 | - foreach ($dropbox_person -> receivedWork as $dropbox_file) { |
|
359 | - $dropbox_file_data = array(); |
|
360 | - if ($view_dropbox_category_received == $dropbox_file->category) { |
|
298 | + if ($view == 'received' || !$dropbox_cnf['sent_received_tabs']) { |
|
299 | + // This is for the categories |
|
300 | + if (isset($viewReceivedCategory) AND $viewReceivedCategory != '') { |
|
301 | + $view_dropbox_category_received = $viewReceivedCategory; |
|
302 | + } else { |
|
303 | + $view_dropbox_category_received = 0; |
|
304 | + } |
|
305 | + |
|
306 | + // Object initialisation |
|
307 | + $dropbox_person = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor); |
|
308 | + // note: are the $is_courseAdmin and $is_courseTutor parameters needed???? |
|
309 | + |
|
310 | + // Constructing the array that contains the total number of feedback messages per document. |
|
311 | + $number_feedback = get_total_number_feedback(); |
|
312 | + |
|
313 | + // Sorting and paging options |
|
314 | + $sorting_options = array(); |
|
315 | + $paging_options = array(); |
|
316 | + |
|
317 | + // The headers of the sortable tables |
|
318 | + $column_header = array(); |
|
319 | + $column_header[] = array('', false, ''); |
|
320 | + $column_header[] = array(get_lang('Type'), true, 'style="width:40px"', 'style="text-align:center"'); |
|
321 | + $column_header[] = array(get_lang('ReceivedTitle'), true, ''); |
|
322 | + $column_header[] = array(get_lang('Size'), true, ''); |
|
323 | + $column_header[] = array(get_lang('Authors'), true, ''); |
|
324 | + $column_header[] = array(get_lang('LastResent'), true); |
|
325 | + |
|
326 | + if (api_get_session_id() == 0) { |
|
327 | + $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
328 | + } elseif (api_is_allowed_to_session_edit(false,true)) { |
|
329 | + $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
330 | + } |
|
331 | + |
|
332 | + $column_header[] = array('RealDate', true); |
|
333 | + $column_header[] = array('RealSize', true); |
|
334 | + |
|
335 | + // An array with the setting of the columns -> 1: columns that we will show, 0:columns that will be hide |
|
336 | + $column_show[] = 1; |
|
337 | + $column_show[] = 1; |
|
338 | + $column_show[] = 1; |
|
339 | + $column_show[] = 1; |
|
340 | + $column_show[] = 1; |
|
341 | + $column_show[] = 1; |
|
342 | + |
|
343 | + if (api_get_session_id() == 0) { |
|
344 | + $column_show[] = 1; |
|
345 | + } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
346 | + $column_show[] = 1; |
|
347 | + } |
|
348 | + $column_show[] = 0; |
|
349 | + |
|
350 | + // Here we change the way how the columns are going to be sort |
|
351 | + // in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate |
|
352 | + // because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48" |
|
353 | + |
|
354 | + $column_order[3] = 8; |
|
355 | + $column_order[5] = 7; |
|
356 | + |
|
357 | + // The content of the sortable table = the received files |
|
358 | + foreach ($dropbox_person -> receivedWork as $dropbox_file) { |
|
359 | + $dropbox_file_data = array(); |
|
360 | + if ($view_dropbox_category_received == $dropbox_file->category) { |
|
361 | 361 | // we only display the files that are in the category that we are in. |
362 | - $dropbox_file_data[] = $dropbox_file->id; |
|
362 | + $dropbox_file_data[] = $dropbox_file->id; |
|
363 | 363 | |
364 | - if (!is_array($_SESSION['_seen'][$_course['id']][TOOL_DROPBOX])) { |
|
365 | - $_SESSION['_seen'][$_course['id']][TOOL_DROPBOX] = array(); |
|
366 | - } |
|
364 | + if (!is_array($_SESSION['_seen'][$_course['id']][TOOL_DROPBOX])) { |
|
365 | + $_SESSION['_seen'][$_course['id']][TOOL_DROPBOX] = array(); |
|
366 | + } |
|
367 | 367 | |
368 | - // New icon |
|
369 | - $new_icon = ''; |
|
370 | - if ($dropbox_file->last_upload_date > $last_access && |
|
368 | + // New icon |
|
369 | + $new_icon = ''; |
|
370 | + if ($dropbox_file->last_upload_date > $last_access && |
|
371 | 371 | !in_array($dropbox_file->id, $_SESSION['_seen'][$_course['id']][TOOL_DROPBOX]) |
372 | 372 | ) { |
373 | - $new_icon = ' '.Display::return_icon('new_dropbox_message.png', get_lang('New'),'',ICON_SIZE_SMALL); |
|
374 | - } |
|
373 | + $new_icon = ' '.Display::return_icon('new_dropbox_message.png', get_lang('New'),'',ICON_SIZE_SMALL); |
|
374 | + } |
|
375 | 375 | |
376 | - $link_open = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">'; |
|
377 | - $dropbox_file_data[] = $link_open.DocumentManager::build_document_icon_tag('file', $dropbox_file->title).'</a>'; |
|
378 | - $dropbox_file_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'. |
|
376 | + $link_open = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">'; |
|
377 | + $dropbox_file_data[] = $link_open.DocumentManager::build_document_icon_tag('file', $dropbox_file->title).'</a>'; |
|
378 | + $dropbox_file_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'. |
|
379 | 379 | Display::return_icon('save.png', get_lang('Download'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$dropbox_file->title.'</a>'.$new_icon.'<br />'.$dropbox_file->description; |
380 | - $file_size = $dropbox_file->filesize; |
|
381 | - $dropbox_file_data[] = format_file_size($file_size); |
|
382 | - $dropbox_file_data[] = $dropbox_file->author; |
|
380 | + $file_size = $dropbox_file->filesize; |
|
381 | + $dropbox_file_data[] = format_file_size($file_size); |
|
382 | + $dropbox_file_data[] = $dropbox_file->author; |
|
383 | 383 | |
384 | - $last_upload_date = api_get_local_time($dropbox_file->last_upload_date); |
|
385 | - $dropbox_file_data[] = date_to_str_ago($dropbox_file->last_upload_date).'<br /><span class="dropbox_date">'. |
|
384 | + $last_upload_date = api_get_local_time($dropbox_file->last_upload_date); |
|
385 | + $dropbox_file_data[] = date_to_str_ago($dropbox_file->last_upload_date).'<br /><span class="dropbox_date">'. |
|
386 | 386 | api_format_date($last_upload_date).'</span>'; |
387 | 387 | |
388 | - $action_icons = check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').' |
|
388 | + $action_icons = check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').' |
|
389 | 389 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=viewfeedback&id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('discuss.png', get_lang('Comment'),'',ICON_SIZE_SMALL).'</a> |
390 | 390 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=movereceived&move_id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('move.png', get_lang('Move'),'',ICON_SIZE_SMALL).'</a> |
391 | 391 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletereceivedfile&id='.$dropbox_file->id.'&'.$sort_params.'" onclick="javascript: return confirmation(\''.$dropbox_file->title.'\');">'. |
392 | 392 | Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'; |
393 | 393 | |
394 | - // This is a hack to have an additional row in a sortable table |
|
395 | - |
|
396 | - if ($action == 'viewfeedback' AND isset($_GET['id']) and is_numeric($_GET['id']) AND $dropbox_file->id == $_GET['id']) { |
|
397 | - $action_icons .= "</td></tr>"; // Ending the normal row of the sortable table |
|
398 | - $action_icons .= '<tr><td colspan="2"><a href="'.api_get_path(WEB_CODE_PATH).'dropbox/index.php?"'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory."&view_sent_category=".$viewSentCategory."&view=".$view.'&'.$sort_params."\">".get_lang('CloseFeedback')."</a></td><td colspan=\"7\">".feedback($dropbox_file->feedback2)."</td></tr>"; |
|
399 | - } |
|
400 | - if (api_get_session_id() == 0) { |
|
401 | - $dropbox_file_data[] = $action_icons; |
|
402 | - } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
403 | - $dropbox_file_data[] = $action_icons; |
|
404 | - } |
|
405 | - $action_icons = ''; |
|
406 | - $dropbox_file_data[] = $last_upload_date; |
|
407 | - $dropbox_file_data[] = $file_size; |
|
408 | - $dropbox_data_recieved[] = $dropbox_file_data; |
|
409 | - } |
|
410 | - } |
|
411 | - |
|
412 | - // The content of the sortable table = the categories (if we are not in the root) |
|
413 | - if ($view_dropbox_category_received == 0) { |
|
414 | - foreach ($dropbox_categories as $category) { |
|
415 | - /* Note: This can probably be shortened since the categories |
|
394 | + // This is a hack to have an additional row in a sortable table |
|
395 | + |
|
396 | + if ($action == 'viewfeedback' AND isset($_GET['id']) and is_numeric($_GET['id']) AND $dropbox_file->id == $_GET['id']) { |
|
397 | + $action_icons .= "</td></tr>"; // Ending the normal row of the sortable table |
|
398 | + $action_icons .= '<tr><td colspan="2"><a href="'.api_get_path(WEB_CODE_PATH).'dropbox/index.php?"'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory."&view_sent_category=".$viewSentCategory."&view=".$view.'&'.$sort_params."\">".get_lang('CloseFeedback')."</a></td><td colspan=\"7\">".feedback($dropbox_file->feedback2)."</td></tr>"; |
|
399 | + } |
|
400 | + if (api_get_session_id() == 0) { |
|
401 | + $dropbox_file_data[] = $action_icons; |
|
402 | + } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
403 | + $dropbox_file_data[] = $action_icons; |
|
404 | + } |
|
405 | + $action_icons = ''; |
|
406 | + $dropbox_file_data[] = $last_upload_date; |
|
407 | + $dropbox_file_data[] = $file_size; |
|
408 | + $dropbox_data_recieved[] = $dropbox_file_data; |
|
409 | + } |
|
410 | + } |
|
411 | + |
|
412 | + // The content of the sortable table = the categories (if we are not in the root) |
|
413 | + if ($view_dropbox_category_received == 0) { |
|
414 | + foreach ($dropbox_categories as $category) { |
|
415 | + /* Note: This can probably be shortened since the categories |
|
416 | 416 | for the received files are already in the |
417 | 417 | $dropbox_received_category array;*/ |
418 | - $dropbox_category_data = array(); |
|
419 | - if ($category['received'] == '1') { |
|
420 | - $movelist[$category['cat_id']] = $category['cat_name']; |
|
418 | + $dropbox_category_data = array(); |
|
419 | + if ($category['received'] == '1') { |
|
420 | + $movelist[$category['cat_id']] = $category['cat_name']; |
|
421 | 421 | // This is where the checkbox icon for the files appear |
422 | - $dropbox_category_data[] = $category['cat_id']; |
|
423 | - // The icon of the category |
|
424 | - $link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$category['cat_id'].'&view_sent_category='.$viewSentCategory.'&view='.$view.'">'; |
|
425 | - $dropbox_category_data[] = $link_open.DocumentManager::build_document_icon_tag('folder', $category['cat_name']).'</a>'; |
|
426 | - $dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=received">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$category['cat_name'].'</a>'; |
|
427 | - $dropbox_category_data[] = ''; |
|
428 | - $dropbox_category_data[] = ''; |
|
429 | - $dropbox_category_data[] = ''; |
|
430 | - $dropbox_category_data[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=editcategory&id='.$category['cat_id'].'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a> |
|
422 | + $dropbox_category_data[] = $category['cat_id']; |
|
423 | + // The icon of the category |
|
424 | + $link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$category['cat_id'].'&view_sent_category='.$viewSentCategory.'&view='.$view.'">'; |
|
425 | + $dropbox_category_data[] = $link_open.DocumentManager::build_document_icon_tag('folder', $category['cat_name']).'</a>'; |
|
426 | + $dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=received">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$category['cat_name'].'</a>'; |
|
427 | + $dropbox_category_data[] = ''; |
|
428 | + $dropbox_category_data[] = ''; |
|
429 | + $dropbox_category_data[] = ''; |
|
430 | + $dropbox_category_data[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=editcategory&id='.$category['cat_id'].'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a> |
|
431 | 431 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletereceivedcategory&id='.$category['cat_id'].'" onclick="javascript: return confirmation(\''.Security::remove_XSS($category['cat_name']).'\');">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'; |
432 | - } |
|
433 | - if (is_array($dropbox_category_data) && count($dropbox_category_data) > 0) { |
|
434 | - $dropbox_data_recieved[] = $dropbox_category_data; |
|
435 | - } |
|
436 | - } |
|
437 | - } |
|
438 | - |
|
439 | - // Displaying the table |
|
432 | + } |
|
433 | + if (is_array($dropbox_category_data) && count($dropbox_category_data) > 0) { |
|
434 | + $dropbox_data_recieved[] = $dropbox_category_data; |
|
435 | + } |
|
436 | + } |
|
437 | + } |
|
438 | + |
|
439 | + // Displaying the table |
|
440 | 440 | $additional_get_parameters = array( |
441 | 441 | 'view' => $view, |
442 | 442 | 'view_received_category' => $viewReceivedCategory, |
@@ -447,15 +447,15 @@ discard block |
||
447 | 447 | 'download_received' => get_lang('Download') |
448 | 448 | ); |
449 | 449 | |
450 | - if (is_array($movelist)) { |
|
451 | - foreach ($movelist as $catid => $catname){ |
|
452 | - $selectlist['move_received_'.$catid] = get_lang('Move') . '->'. Security::remove_XSS($catname); |
|
453 | - } |
|
454 | - } |
|
450 | + if (is_array($movelist)) { |
|
451 | + foreach ($movelist as $catid => $catname){ |
|
452 | + $selectlist['move_received_'.$catid] = get_lang('Move') . '->'. Security::remove_XSS($catname); |
|
453 | + } |
|
454 | + } |
|
455 | 455 | |
456 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
457 | - $selectlist = array(); |
|
458 | - } |
|
456 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
457 | + $selectlist = array(); |
|
458 | + } |
|
459 | 459 | echo '<div class="files-table">'; |
460 | 460 | Display::display_sortable_config_table( |
461 | 461 | 'dropbox', |
@@ -469,154 +469,154 @@ discard block |
||
469 | 469 | $selectlist |
470 | 470 | ); |
471 | 471 | echo '</div>'; |
472 | - } |
|
473 | - |
|
474 | - /* SENT FILES */ |
|
475 | - |
|
476 | - if (!$view || $view == 'sent' || !$dropbox_cnf['sent_received_tabs']) { |
|
477 | - // This is for the categories |
|
478 | - if (isset($viewSentCategory) AND $viewSentCategory != '') { |
|
479 | - $view_dropbox_category_sent = $viewSentCategory; |
|
480 | - } else { |
|
481 | - $view_dropbox_category_sent = 0; |
|
482 | - } |
|
483 | - |
|
484 | - // Object initialisation |
|
485 | - $dropbox_person = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor); |
|
486 | - |
|
487 | - // Constructing the array that contains the total number of feedback messages per document. |
|
488 | - $number_feedback = get_total_number_feedback(); |
|
489 | - |
|
490 | - // Sorting and paging options |
|
491 | - $sorting_options = array(); |
|
492 | - $paging_options = array(); |
|
493 | - |
|
494 | - // The headers of the sortable tables |
|
495 | - $column_header = array(); |
|
496 | - |
|
497 | - $column_header[] = array('', false, ''); |
|
498 | - $column_header[] = array(get_lang('Type'), true, 'style="width:40px"', 'style="text-align:center"'); |
|
499 | - $column_header[] = array(get_lang('SentTitle'), true, ''); |
|
500 | - $column_header[] = array(get_lang('Size'), true, ''); |
|
501 | - $column_header[] = array(get_lang('SentTo'), true, ''); |
|
502 | - $column_header[] = array(get_lang('LastResent'), true, ''); |
|
503 | - |
|
504 | - if (api_get_session_id() == 0) { |
|
505 | - $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
506 | - } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
507 | - $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
508 | - } |
|
509 | - |
|
510 | - $column_header[] = array('RealDate', true); |
|
511 | - $column_header[] = array('RealSize', true); |
|
512 | - |
|
513 | - $column_show = array(); |
|
514 | - $column_order = array(); |
|
515 | - |
|
516 | - // An array with the setting of the columns -> 1: columns that we will show, 0:columns that will be hide |
|
517 | - $column_show[] = 1; |
|
518 | - $column_show[] = 1; |
|
519 | - $column_show[] = 1; |
|
520 | - $column_show[] = 1; |
|
521 | - $column_show[] = 1; |
|
522 | - $column_show[] = 1; |
|
523 | - if (api_get_session_id() == 0) { |
|
524 | - $column_show[] = 1; |
|
525 | - } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
526 | - $column_show[] = 1; |
|
527 | - } |
|
528 | - $column_show[] = 0; |
|
529 | - |
|
530 | - // Here we change the way how the colums are going to be sort |
|
531 | - // in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate |
|
532 | - // because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48" |
|
533 | - |
|
534 | - $column_order[3] = 8; |
|
535 | - $column_order[5] = 7; |
|
536 | - |
|
537 | - // The content of the sortable table = the received files |
|
538 | - foreach ($dropbox_person->sentWork as $dropbox_file) { |
|
539 | - $dropbox_file_data = array(); |
|
540 | - |
|
541 | - if ($view_dropbox_category_sent == $dropbox_file->category) { |
|
542 | - $dropbox_file_data[] = $dropbox_file->id; |
|
543 | - $link_open = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">'; |
|
544 | - $dropbox_file_data[] = $link_open.DocumentManager::build_document_icon_tag('file', $dropbox_file->title).'</a>'; |
|
545 | - $dropbox_file_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'. |
|
472 | + } |
|
473 | + |
|
474 | + /* SENT FILES */ |
|
475 | + |
|
476 | + if (!$view || $view == 'sent' || !$dropbox_cnf['sent_received_tabs']) { |
|
477 | + // This is for the categories |
|
478 | + if (isset($viewSentCategory) AND $viewSentCategory != '') { |
|
479 | + $view_dropbox_category_sent = $viewSentCategory; |
|
480 | + } else { |
|
481 | + $view_dropbox_category_sent = 0; |
|
482 | + } |
|
483 | + |
|
484 | + // Object initialisation |
|
485 | + $dropbox_person = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor); |
|
486 | + |
|
487 | + // Constructing the array that contains the total number of feedback messages per document. |
|
488 | + $number_feedback = get_total_number_feedback(); |
|
489 | + |
|
490 | + // Sorting and paging options |
|
491 | + $sorting_options = array(); |
|
492 | + $paging_options = array(); |
|
493 | + |
|
494 | + // The headers of the sortable tables |
|
495 | + $column_header = array(); |
|
496 | + |
|
497 | + $column_header[] = array('', false, ''); |
|
498 | + $column_header[] = array(get_lang('Type'), true, 'style="width:40px"', 'style="text-align:center"'); |
|
499 | + $column_header[] = array(get_lang('SentTitle'), true, ''); |
|
500 | + $column_header[] = array(get_lang('Size'), true, ''); |
|
501 | + $column_header[] = array(get_lang('SentTo'), true, ''); |
|
502 | + $column_header[] = array(get_lang('LastResent'), true, ''); |
|
503 | + |
|
504 | + if (api_get_session_id() == 0) { |
|
505 | + $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
506 | + } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
507 | + $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
508 | + } |
|
509 | + |
|
510 | + $column_header[] = array('RealDate', true); |
|
511 | + $column_header[] = array('RealSize', true); |
|
512 | + |
|
513 | + $column_show = array(); |
|
514 | + $column_order = array(); |
|
515 | + |
|
516 | + // An array with the setting of the columns -> 1: columns that we will show, 0:columns that will be hide |
|
517 | + $column_show[] = 1; |
|
518 | + $column_show[] = 1; |
|
519 | + $column_show[] = 1; |
|
520 | + $column_show[] = 1; |
|
521 | + $column_show[] = 1; |
|
522 | + $column_show[] = 1; |
|
523 | + if (api_get_session_id() == 0) { |
|
524 | + $column_show[] = 1; |
|
525 | + } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
526 | + $column_show[] = 1; |
|
527 | + } |
|
528 | + $column_show[] = 0; |
|
529 | + |
|
530 | + // Here we change the way how the colums are going to be sort |
|
531 | + // in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate |
|
532 | + // because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48" |
|
533 | + |
|
534 | + $column_order[3] = 8; |
|
535 | + $column_order[5] = 7; |
|
536 | + |
|
537 | + // The content of the sortable table = the received files |
|
538 | + foreach ($dropbox_person->sentWork as $dropbox_file) { |
|
539 | + $dropbox_file_data = array(); |
|
540 | + |
|
541 | + if ($view_dropbox_category_sent == $dropbox_file->category) { |
|
542 | + $dropbox_file_data[] = $dropbox_file->id; |
|
543 | + $link_open = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">'; |
|
544 | + $dropbox_file_data[] = $link_open.DocumentManager::build_document_icon_tag('file', $dropbox_file->title).'</a>'; |
|
545 | + $dropbox_file_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'. |
|
546 | 546 | Display::return_icon('save.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$dropbox_file->title.'</a><br />'.$dropbox_file->description; |
547 | - $file_size = $dropbox_file->filesize; |
|
548 | - $dropbox_file_data[] = format_file_size($file_size); |
|
547 | + $file_size = $dropbox_file->filesize; |
|
548 | + $dropbox_file_data[] = format_file_size($file_size); |
|
549 | 549 | $receivers_celldata = null; |
550 | - foreach ($dropbox_file->recipients as $recipient) { |
|
551 | - $userInfo = api_get_user_info($recipient['user_id']); |
|
552 | - $receivers_celldata = UserManager::getUserProfileLink($userInfo).', '.$receivers_celldata; |
|
553 | - } |
|
554 | - $receivers_celldata = trim(trim($receivers_celldata), ','); // Removing the trailing comma. |
|
555 | - $dropbox_file_data[] = $receivers_celldata; |
|
556 | - $last_upload_date = api_get_local_time($dropbox_file->last_upload_date); |
|
557 | - $dropbox_file_data[] = date_to_str_ago($dropbox_file->last_upload_date).'<br /><span class="dropbox_date">'. |
|
558 | - api_format_date($last_upload_date).'</span>'; |
|
559 | - |
|
560 | - //$dropbox_file_data[] = $dropbox_file->author; |
|
561 | - $receivers_celldata = ''; |
|
562 | - |
|
563 | - $action_icons = check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').' |
|
550 | + foreach ($dropbox_file->recipients as $recipient) { |
|
551 | + $userInfo = api_get_user_info($recipient['user_id']); |
|
552 | + $receivers_celldata = UserManager::getUserProfileLink($userInfo).', '.$receivers_celldata; |
|
553 | + } |
|
554 | + $receivers_celldata = trim(trim($receivers_celldata), ','); // Removing the trailing comma. |
|
555 | + $dropbox_file_data[] = $receivers_celldata; |
|
556 | + $last_upload_date = api_get_local_time($dropbox_file->last_upload_date); |
|
557 | + $dropbox_file_data[] = date_to_str_ago($dropbox_file->last_upload_date).'<br /><span class="dropbox_date">'. |
|
558 | + api_format_date($last_upload_date).'</span>'; |
|
559 | + |
|
560 | + //$dropbox_file_data[] = $dropbox_file->author; |
|
561 | + $receivers_celldata = ''; |
|
562 | + |
|
563 | + $action_icons = check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').' |
|
564 | 564 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=viewfeedback&id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('discuss.png', get_lang('Comment'),'',ICON_SIZE_SMALL).'</a> |
565 | 565 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=movesent&move_id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('move.png', get_lang('Move'),'',ICON_SIZE_SMALL).'</a> |
566 | 566 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletesentfile&id='.$dropbox_file->id.'&'.$sort_params.'" onclick="javascript: return confirmation(\''.$dropbox_file->title.'\');">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'; |
567 | - // This is a hack to have an additional row in a sortable table |
|
568 | - if ($action == 'viewfeedback' && isset($_GET['id']) && is_numeric($_GET['id']) && $dropbox_file->id == $_GET['id']) { |
|
569 | - $action_icons .= "</td></tr>\n"; // ending the normal row of the sortable table |
|
570 | - $action_icons .= "<tr><td colspan=\"2\">"; |
|
571 | - $action_icons .= "<a href=\"".api_get_path(WEB_CODE_PATH)."dropbox/index.php?".api_get_cidreq()."&view_received_category=".$viewReceivedCategory."&view_sent_category=".$viewSentCategory."&view=".$view.'&'.$sort_params."\">".get_lang('CloseFeedback')."</a>"; |
|
572 | - $action_icons .= "</td><td colspan=\"7\">".feedback($dropbox_file->feedback2)."</td></tr>"; |
|
573 | - } |
|
574 | - $dropbox_file_data[] = $action_icons; |
|
575 | - $dropbox_file_data[] = $last_upload_date; |
|
576 | - $dropbox_file_data[] = $file_size; |
|
577 | - $action_icons = ''; |
|
578 | - $dropbox_data_sent[] = $dropbox_file_data; |
|
579 | - } |
|
580 | - } |
|
567 | + // This is a hack to have an additional row in a sortable table |
|
568 | + if ($action == 'viewfeedback' && isset($_GET['id']) && is_numeric($_GET['id']) && $dropbox_file->id == $_GET['id']) { |
|
569 | + $action_icons .= "</td></tr>\n"; // ending the normal row of the sortable table |
|
570 | + $action_icons .= "<tr><td colspan=\"2\">"; |
|
571 | + $action_icons .= "<a href=\"".api_get_path(WEB_CODE_PATH)."dropbox/index.php?".api_get_cidreq()."&view_received_category=".$viewReceivedCategory."&view_sent_category=".$viewSentCategory."&view=".$view.'&'.$sort_params."\">".get_lang('CloseFeedback')."</a>"; |
|
572 | + $action_icons .= "</td><td colspan=\"7\">".feedback($dropbox_file->feedback2)."</td></tr>"; |
|
573 | + } |
|
574 | + $dropbox_file_data[] = $action_icons; |
|
575 | + $dropbox_file_data[] = $last_upload_date; |
|
576 | + $dropbox_file_data[] = $file_size; |
|
577 | + $action_icons = ''; |
|
578 | + $dropbox_data_sent[] = $dropbox_file_data; |
|
579 | + } |
|
580 | + } |
|
581 | 581 | |
582 | 582 | $moveList = array(); |
583 | - // The content of the sortable table = the categories (if we are not in the root) |
|
584 | - if ($view_dropbox_category_sent == 0) { |
|
585 | - foreach ($dropbox_categories as $category) { |
|
586 | - $dropbox_category_data = array(); |
|
583 | + // The content of the sortable table = the categories (if we are not in the root) |
|
584 | + if ($view_dropbox_category_sent == 0) { |
|
585 | + foreach ($dropbox_categories as $category) { |
|
586 | + $dropbox_category_data = array(); |
|
587 | 587 | |
588 | - if ($category['sent'] == '1') { |
|
588 | + if ($category['sent'] == '1') { |
|
589 | 589 | |
590 | 590 | $moveList[$category['cat_id']] = $category['cat_name']; |
591 | - $dropbox_category_data[] = $category['cat_id']; |
|
592 | - // This is where the checkbox icon for the files appear. |
|
593 | - $link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$category['cat_id'].'&view='.$view.'">'; |
|
594 | - $dropbox_category_data[] = $link_open.DocumentManager::build_document_icon_tag('folder', Security::remove_XSS($category['cat_name'])).'</a>'; |
|
595 | - $dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=sent">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.Security::remove_XSS($category['cat_name']).'</a>'; |
|
596 | - //$dropbox_category_data[] = ''; |
|
597 | - $dropbox_category_data[] = ''; |
|
598 | - //$dropbox_category_data[] = ''; |
|
599 | - $dropbox_category_data[] = ''; |
|
600 | - $dropbox_category_data[] = ''; |
|
601 | - $dropbox_category_data[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=editcategory&id='.$category['cat_id'].'">'. |
|
591 | + $dropbox_category_data[] = $category['cat_id']; |
|
592 | + // This is where the checkbox icon for the files appear. |
|
593 | + $link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$category['cat_id'].'&view='.$view.'">'; |
|
594 | + $dropbox_category_data[] = $link_open.DocumentManager::build_document_icon_tag('folder', Security::remove_XSS($category['cat_name'])).'</a>'; |
|
595 | + $dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=sent">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.Security::remove_XSS($category['cat_name']).'</a>'; |
|
596 | + //$dropbox_category_data[] = ''; |
|
597 | + $dropbox_category_data[] = ''; |
|
598 | + //$dropbox_category_data[] = ''; |
|
599 | + $dropbox_category_data[] = ''; |
|
600 | + $dropbox_category_data[] = ''; |
|
601 | + $dropbox_category_data[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=editcategory&id='.$category['cat_id'].'">'. |
|
602 | 602 | Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a> |
603 | 603 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletesentcategory&id='.$category['cat_id'].'" onclick="javascript: return confirmation(\''.Security::remove_XSS($category['cat_name']).'\');">'. |
604 | 604 | Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'; |
605 | - } |
|
606 | - if (is_array($dropbox_category_data) && count($dropbox_category_data) > 0) { |
|
607 | - $dropbox_data_sent[] = $dropbox_category_data; |
|
608 | - } |
|
609 | - } |
|
610 | - } |
|
611 | - |
|
612 | - // Displaying the table |
|
613 | - $additional_get_parameters = array( |
|
605 | + } |
|
606 | + if (is_array($dropbox_category_data) && count($dropbox_category_data) > 0) { |
|
607 | + $dropbox_data_sent[] = $dropbox_category_data; |
|
608 | + } |
|
609 | + } |
|
610 | + } |
|
611 | + |
|
612 | + // Displaying the table |
|
613 | + $additional_get_parameters = array( |
|
614 | 614 | 'view' => $view, |
615 | 615 | 'view_received_category' => $viewReceivedCategory, |
616 | 616 | 'view_sent_category' => $viewSentCategory |
617 | 617 | ); |
618 | 618 | |
619 | - $selectlist = array( |
|
619 | + $selectlist = array( |
|
620 | 620 | 'delete_received' => get_lang('Delete'), |
621 | 621 | 'download_received' => get_lang('Download') |
622 | 622 | ); |
@@ -627,12 +627,12 @@ discard block |
||
627 | 627 | } |
628 | 628 | } |
629 | 629 | |
630 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
631 | - $selectlist = array('download_received' => get_lang('Download')); |
|
632 | - } |
|
630 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
631 | + $selectlist = array('download_received' => get_lang('Download')); |
|
632 | + } |
|
633 | 633 | |
634 | 634 | echo '<div class="files-table">'; |
635 | - Display::display_sortable_config_table( |
|
635 | + Display::display_sortable_config_table( |
|
636 | 636 | 'dropbox', |
637 | 637 | $column_header, |
638 | 638 | $dropbox_data_sent, |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | $selectlist |
645 | 645 | ); |
646 | 646 | echo '</div>'; |
647 | - } |
|
647 | + } |
|
648 | 648 | } |
649 | 649 | |
650 | 650 | Display::display_footer(); |
@@ -852,14 +852,14 @@ discard block |
||
852 | 852 | $email = false; |
853 | 853 | } |
854 | 854 | |
855 | - if ($email) { |
|
856 | - $condition = "LOWER(email) = '".Database::escape_string($username)."' "; |
|
857 | - } else { |
|
855 | + if ($email) { |
|
856 | + $condition = "LOWER(email) = '".Database::escape_string($username)."' "; |
|
857 | + } else { |
|
858 | 858 | $condition = "LOWER(username) = '".Database::escape_string($username)."'"; |
859 | 859 | } |
860 | 860 | |
861 | - $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
862 | - $query = "SELECT |
|
861 | + $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
862 | + $query = "SELECT |
|
863 | 863 | user_id AS uid, |
864 | 864 | lastname AS lastName, |
865 | 865 | firstname AS firstName, |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | auth_source |
875 | 875 | FROM $tbl_user |
876 | 876 | WHERE ( $condition AND active = 1) "; |
877 | - $result = Database::query($query); |
|
877 | + $result = Database::query($query); |
|
878 | 878 | $num_rows = Database::num_rows($result); |
879 | 879 | if ($result && $num_rows > 0) { |
880 | 880 | return Database::fetch_assoc($result); |