@@ -1,26 +1,26 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Script to find a document with a specific title or path in all courses |
|
4 | - */ |
|
3 | + * Script to find a document with a specific title or path in all courses |
|
4 | + */ |
|
5 | 5 | /** |
6 | - * Code init - comment die() call to enable |
|
7 | - */ |
|
6 | + * Code init - comment die() call to enable |
|
7 | + */ |
|
8 | 8 | die(); |
9 | 9 | require '../../inc/global.inc.php'; |
10 | 10 | if (empty($_GET['doc'])) { |
11 | - echo "To add a document name to search, add ?doc=abc to the URL"; |
|
11 | + echo "To add a document name to search, add ?doc=abc to the URL"; |
|
12 | 12 | } else { |
13 | - echo "Received param ".Security::remove_XSS($_GET['doc'])."<br />"; |
|
13 | + echo "Received param ".Security::remove_XSS($_GET['doc'])."<br />"; |
|
14 | 14 | } |
15 | 15 | $courses_list = CourseManager::get_courses_list(); |
16 | 16 | foreach ($courses_list as $course) { |
17 | - $title = Database::escape_string($_GET['doc']); |
|
18 | - $td = Database::get_course_table(TABLE_DOCUMENT); |
|
19 | - $sql = "SELECT id, path FROM $td WHERE c_id = ".$course['id']." AND path LIKE '%$title%' OR title LIKE '%$title%'"; |
|
20 | - $res = Database::query($sql); |
|
21 | - if (Database::num_rows($res)>0) { |
|
17 | + $title = Database::escape_string($_GET['doc']); |
|
18 | + $td = Database::get_course_table(TABLE_DOCUMENT); |
|
19 | + $sql = "SELECT id, path FROM $td WHERE c_id = ".$course['id']." AND path LIKE '%$title%' OR title LIKE '%$title%'"; |
|
20 | + $res = Database::query($sql); |
|
21 | + if (Database::num_rows($res)>0) { |
|
22 | 22 | while ($row = Database::fetch_array($res)) { |
23 | - echo "Found doc ".$row['id']."-> ".$row['path']." in course ".$course['code']."<br />"; |
|
23 | + echo "Found doc ".$row['id']."-> ".$row['path']." in course ".$course['code']."<br />"; |
|
24 | + } |
|
24 | 25 | } |
25 | - } |
|
26 | 26 | } |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * This script gets users details of a given list of users |
|
4 | - * (given by e-mail) and prints the details in /tmp/list.txt |
|
5 | - * To enable script, prefix the first die(); with // |
|
6 | - * @package chamilo.cron.user_import |
|
7 | - */ |
|
3 | + * This script gets users details of a given list of users |
|
4 | + * (given by e-mail) and prints the details in /tmp/list.txt |
|
5 | + * To enable script, prefix the first die(); with // |
|
6 | + * @package chamilo.cron.user_import |
|
7 | + */ |
|
8 | 8 | /** |
9 | - * Initialization |
|
10 | - */ |
|
9 | + * Initialization |
|
10 | + */ |
|
11 | 11 | /* Example of input file: |
12 | 12 | [email protected] |
13 | 13 | [email protected] |
@@ -20,16 +20,16 @@ discard block |
||
20 | 20 | $users = Database::get_main_table(TABLE_MAIN_USER); |
21 | 21 | $string=''; |
22 | 22 | foreach ($list as $mail) { |
23 | - $mail = trim($mail); |
|
24 | - $sql = "SELECT user_id, official_code, firstname, lastname, email FROM $users WHERE email = '$mail'\n"; |
|
25 | - $res = Database::query($sql); |
|
26 | - if ($res === false) { die(mysql_error());} |
|
27 | - if (Database::num_rows($res) == 0) { |
|
23 | + $mail = trim($mail); |
|
24 | + $sql = "SELECT user_id, official_code, firstname, lastname, email FROM $users WHERE email = '$mail'\n"; |
|
25 | + $res = Database::query($sql); |
|
26 | + if ($res === false) { die(mysql_error());} |
|
27 | + if (Database::num_rows($res) == 0) { |
|
28 | 28 | $string .= 'No encontrado;'.$row['email']; |
29 | - } else { |
|
29 | + } else { |
|
30 | 30 | $row = Database::fetch_assoc($res); |
31 | - $string .= $row['user_id'].';'.$row['email'].';'.$row['firstname'].';'.$row['lastname'].';'.$row['official_code']."\r\n"; |
|
32 | - } |
|
31 | + $string .= $row['user_id'].';'.$row['email'].';'.$row['firstname'].';'.$row['lastname'].';'.$row['official_code']."\r\n"; |
|
32 | + } |
|
33 | 33 | } |
34 | 34 | echo $string; |
35 | 35 | file_put_contents('/tmp/list.txt',$string); |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | /** |
4 | - * Create course sessions procedure. It creates sessions for courses that haven't it yet. |
|
5 | - * If today is greater than OFFSET, it will create them also for the next quarter |
|
6 | - * @package chamilo.cron |
|
7 | - * @author Imanol Losada <[email protected]> |
|
8 | - */ |
|
4 | + * Create course sessions procedure. It creates sessions for courses that haven't it yet. |
|
5 | + * If today is greater than OFFSET, it will create them also for the next quarter |
|
6 | + * @package chamilo.cron |
|
7 | + * @author Imanol Losada <[email protected]> |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Initialization |
@@ -1,25 +1,25 @@ discard block |
||
1 | 1 | <?php /* For licensing terms, see /license.txt */ |
2 | 2 | /** |
3 | - * Cron script to list used, but undefined, language variables |
|
4 | - * @package chamilo.cron |
|
5 | - */ |
|
3 | + * Cron script to list used, but undefined, language variables |
|
4 | + * @package chamilo.cron |
|
5 | + */ |
|
6 | 6 | /** |
7 | - * Includes and declarations |
|
8 | - */ |
|
7 | + * Includes and declarations |
|
8 | + */ |
|
9 | 9 | die(); |
10 | 10 | require_once '../../inc/global.inc.php'; |
11 | 11 | $path = api_get_path(SYS_LANG_PATH).'english'; |
12 | 12 | ini_set('memory_limit','128M'); |
13 | 13 | /** |
14 | - * Main code |
|
15 | - */ |
|
14 | + * Main code |
|
15 | + */ |
|
16 | 16 | $terms = array(); |
17 | 17 | $list = SubLanguageManager::get_lang_folder_files_list($path); |
18 | 18 | foreach ($list as $entry) { |
19 | 19 | $file = $path.'/'.$entry; |
20 | 20 | if (is_file($file)) { |
21 | 21 | $terms = array_merge($terms,SubLanguageManager::get_all_language_variable_in_file($file,true)); |
22 | - } |
|
22 | + } |
|
23 | 23 | } |
24 | 24 | // get only the array keys (the language variables defined in language files) |
25 | 25 | $defined_terms = array_flip(array_keys($terms)); |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | foreach ($files as $file) { |
33 | 33 | //echo 'Analyzing '.$file."<br />"; |
34 | 34 | $shortfile = substr($file,$l); |
35 | - $lines = file($file); |
|
35 | + $lines = file($file); |
|
36 | 36 | foreach ($lines as $line) { |
37 | - $myterms = array(); |
|
37 | + $myterms = array(); |
|
38 | 38 | $res = preg_match_all('/get_lang\(\'(\\w*)\'\)/',$line,$myterms); |
39 | 39 | if ($res > 0) { |
40 | 40 | foreach($myterms[1] as $term) { |
41 | 41 | if (!isset($defined_terms[$term]) && !isset($defined_terms['lang'.$term])) { |
42 | - $undefined_terms[$term] = $shortfile; |
|
42 | + $undefined_terms[$term] = $shortfile; |
|
43 | 43 | //echo "Undefined: $term<br />"; |
44 | 44 | } |
45 | 45 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | if ($res > 0) { |
50 | 50 | foreach($myterms[1] as $term) { |
51 | 51 | if (!isset($defined_terms[$term]) && !isset($defined_terms['lang'.$term])) { |
52 | - $undefined_terms[$term] = $shortfile; |
|
52 | + $undefined_terms[$term] = $shortfile; |
|
53 | 53 | //echo "Undefined: $term<br />"; |
54 | 54 | } |
55 | 55 | } |
@@ -73,17 +73,17 @@ discard block |
||
73 | 73 | $list = scandir($base_path); |
74 | 74 | $files = array(); |
75 | 75 | foreach ($list as $item) { |
76 | - if (substr($item,0,1)=='.') {continue;} |
|
76 | + if (substr($item,0,1)=='.') {continue;} |
|
77 | 77 | $special_dirs = array(api_get_path(SYS_TEST_PATH),api_get_path(SYS_COURSE_PATH),api_get_path(SYS_LANG_PATH),api_get_path(SYS_ARCHIVE_PATH)); |
78 | 78 | if (in_array($base_path.$item.'/',$special_dirs)) {continue;} |
79 | 79 | if (is_dir($base_path.$item)) { |
80 | - $files = array_merge($files,get_all_php_files($base_path.$item.'/')); |
|
80 | + $files = array_merge($files,get_all_php_files($base_path.$item.'/')); |
|
81 | 81 | } else { |
82 | 82 | //only analyse php files |
83 | 83 | $sub = substr($item,-4); |
84 | - if ($sub == '.php' or $sub == '.tpl') { |
|
84 | + if ($sub == '.php' or $sub == '.tpl') { |
|
85 | 85 | $files[] = $base_path.$item; |
86 | - } |
|
86 | + } |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | $list = null; |
@@ -1,41 +1,41 @@ |
||
1 | 1 | <?php /* For licensing terms, see /license.txt */ |
2 | 2 | /** |
3 | - * Cron script to list unused, but defined, language variables |
|
4 | - * @package chamilo.cron.lang |
|
5 | - */ |
|
3 | + * Cron script to list unused, but defined, language variables |
|
4 | + * @package chamilo.cron.lang |
|
5 | + */ |
|
6 | 6 | /** |
7 | - * Includes and declarations |
|
8 | - */ |
|
7 | + * Includes and declarations |
|
8 | + */ |
|
9 | 9 | //die(); |
10 | 10 | require_once '../../inc/global.inc.php'; |
11 | 11 | $path = api_get_path(SYS_LANG_PATH).'english'; |
12 | 12 | ini_set('memory_limit','128M'); |
13 | 13 | /** |
14 | - * Main code |
|
15 | - */ |
|
14 | + * Main code |
|
15 | + */ |
|
16 | 16 | $terms = array(); |
17 | 17 | $list = SubLanguageManager::get_lang_folder_files_list($path); |
18 | 18 | $langs = scandir(api_get_path(SYS_LANG_PATH)); |
19 | 19 | foreach ($langs as $lang) { |
20 | - $dir = api_get_path(SYS_LANG_PATH).$lang; |
|
21 | - if (is_dir($dir) && substr($lang,0,1) != '.' && !empty($lang)) { |
|
20 | + $dir = api_get_path(SYS_LANG_PATH).$lang; |
|
21 | + if (is_dir($dir) && substr($lang,0,1) != '.' && !empty($lang)) { |
|
22 | 22 | echo "$lang..."; |
23 | 23 | $ok = true; |
24 | 24 | foreach ($list as $entry) { |
25 | - $file = $dir.'/'.$entry; |
|
26 | - $out = array(); |
|
27 | - if (is_file($file)) { |
|
25 | + $file = $dir.'/'.$entry; |
|
26 | + $out = array(); |
|
27 | + if (is_file($file)) { |
|
28 | 28 | //$terms = array_merge($terms,SubLanguageManager::get_all_language_variable_in_file($file,true)); |
29 | 29 | @exec('php5 -l '.$file,$out); |
30 | 30 | if (substr($out[0],0,2)!='No') { |
31 | - echo $out[0]."\n"; |
|
32 | - $ok = false; |
|
31 | + echo $out[0]."\n"; |
|
32 | + $ok = false; |
|
33 | + } |
|
33 | 34 | } |
34 | - } |
|
35 | 35 | } |
36 | 36 | if ($ok) { |
37 | - echo "OK\n"; |
|
37 | + echo "OK\n"; |
|
38 | + } |
|
38 | 39 | } |
39 | - } |
|
40 | 40 | } |
41 | 41 | echo "Done\n"; |
@@ -1,17 +1,17 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | /** |
4 | - * This script generates a directory based on the English language variables |
|
5 | - * but only composed of the 10,000 (can be configured) most frequent words |
|
6 | - * used in Chamilo. This implies first using the langstats.php script, which |
|
7 | - * in turn implies configuring an additional variable in configuration.php |
|
8 | - * (see langstats.php for more info). |
|
9 | - * When running the language_builder, please make sure this parameter is |
|
10 | - * set to 0 in the configuration.php file, otherwise it will take *ages*. |
|
11 | - */ |
|
4 | + * This script generates a directory based on the English language variables |
|
5 | + * but only composed of the 10,000 (can be configured) most frequent words |
|
6 | + * used in Chamilo. This implies first using the langstats.php script, which |
|
7 | + * in turn implies configuring an additional variable in configuration.php |
|
8 | + * (see langstats.php for more info). |
|
9 | + * When running the language_builder, please make sure this parameter is |
|
10 | + * set to 0 in the configuration.php file, otherwise it will take *ages*. |
|
11 | + */ |
|
12 | 12 | /** |
13 | - * Requires |
|
14 | - */ |
|
13 | + * Requires |
|
14 | + */ |
|
15 | 15 | require_once '../../inc/global.inc.php'; |
16 | 16 | require_once 'langstats.class.php'; |
17 | 17 | global $_configuration; |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | $langstats = new langstats(); |
20 | 20 | $orig_lang = 'english'; |
21 | 21 | /** |
22 | - * Init |
|
23 | - */ |
|
22 | + * Init |
|
23 | + */ |
|
24 | 24 | $words_limit = 10000; //change this if you want more words |
25 | 25 | $terms_limit = 3000; //change this if you think you'll need more terms |
26 | 26 | $terms = $langstats->get_popular_terms($terms_limit); |
@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | $lang_dir = api_get_path(SYS_LANG_PATH); |
31 | 31 | $arch_dir = api_get_path(SYS_ARCHIVE_PATH); |
32 | 32 | /** |
33 | - * Code run |
|
34 | - */ |
|
33 | + * Code run |
|
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,41 +59,41 @@ 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 />"; |
94 | 94 | /** |
95 | - * Display results |
|
96 | - */ |
|
95 | + * Display results |
|
96 | + */ |
|
97 | 97 | |
98 | 98 | echo "Difference between filtered and found in English:<br />"; |
99 | 99 | //print_r($terms_found); |
@@ -1,18 +1,18 @@ discard block |
||
1 | 1 | <?php /* For licensing terms, see /license.txt */ |
2 | 2 | /** |
3 | - * Cron script to list unused, but defined, language variables |
|
4 | - * @package chamilo.cron.lang |
|
5 | - */ |
|
3 | + * Cron script to list unused, but defined, language variables |
|
4 | + * @package chamilo.cron.lang |
|
5 | + */ |
|
6 | 6 | /** |
7 | - * Includes and declarations |
|
8 | - */ |
|
7 | + * Includes and declarations |
|
8 | + */ |
|
9 | 9 | die(); |
10 | 10 | require_once '../../inc/global.inc.php'; |
11 | 11 | $path = api_get_path(SYS_LANG_PATH).'english'; |
12 | 12 | ini_set('memory_limit', '128M'); |
13 | 13 | /** |
14 | - * Main code |
|
15 | - */ |
|
14 | + * Main code |
|
15 | + */ |
|
16 | 16 | $terms = array(); |
17 | 17 | $list = SubLanguageManager::get_lang_folder_files_list($path); |
18 | 18 | foreach ($list as $entry) { |
@@ -68,18 +68,18 @@ discard block |
||
68 | 68 | // defined terms, and this should prove the concept that there are much |
69 | 69 | // more variables than what we really use |
70 | 70 | if (count($usedTerms)<1) { |
71 | - die("No used terms<br />\n"); |
|
71 | + die("No used terms<br />\n"); |
|
72 | 72 | } else { |
73 | - echo "The following terms were defined but never used: <br />\n<table>"; |
|
73 | + echo "The following terms were defined but never used: <br />\n<table>"; |
|
74 | 74 | } |
75 | 75 | $i = 1; |
76 | 76 | foreach ($defined_terms as $term => $file) { |
77 | - // remove "lang" prefix just in case |
|
78 | - if (substr($term,0,4)=='lang') { $term = substr($term,4); } |
|
79 | - if (!isset($usedTerms[$term])) { |
|
77 | + // remove "lang" prefix just in case |
|
78 | + if (substr($term,0,4)=='lang') { $term = substr($term,4); } |
|
79 | + if (!isset($usedTerms[$term])) { |
|
80 | 80 | echo "<tr><td>$i</td><td>$term</td></tr>\n"; |
81 | 81 | $i++; |
82 | - } |
|
82 | + } |
|
83 | 83 | } |
84 | 84 | echo "</table>\n"; |
85 | 85 | |
@@ -88,17 +88,17 @@ discard block |
||
88 | 88 | $list = scandir($base_path); |
89 | 89 | $files = array(); |
90 | 90 | foreach ($list as $item) { |
91 | - if (substr($item,0,1)=='.') {continue;} |
|
91 | + if (substr($item,0,1)=='.') {continue;} |
|
92 | 92 | $special_dirs = array(api_get_path(SYS_TEST_PATH),api_get_path(SYS_COURSE_PATH),api_get_path(SYS_LANG_PATH),api_get_path(SYS_ARCHIVE_PATH)); |
93 | 93 | if (in_array($base_path.$item.'/',$special_dirs)) {continue;} |
94 | 94 | if (is_dir($base_path.$item)) { |
95 | - $files = array_merge($files,get_all_php_files($base_path.$item.'/')); |
|
95 | + $files = array_merge($files,get_all_php_files($base_path.$item.'/')); |
|
96 | 96 | } else { |
97 | 97 | //only analyse php files |
98 | 98 | $sub = substr($item,-4); |
99 | - if ($sub == '.php' or $sub == '.tpl') { |
|
99 | + if ($sub == '.php' or $sub == '.tpl') { |
|
100 | 100 | $files[] = $base_path.$item; |
101 | - } |
|
101 | + } |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | $list = null; |
@@ -14,23 +14,23 @@ discard block |
||
14 | 14 | $views = array('blocks', 'list'); |
15 | 15 | |
16 | 16 | if(isset($_GET['view']) && in_array($_GET['view'], $views)){ |
17 | - $dashboard_view = $_GET['view']; |
|
17 | + $dashboard_view = $_GET['view']; |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | $link_blocks_view = $link_list_view = null; |
21 | 21 | |
22 | 22 | if (isset($dashboard_view) && $dashboard_view == 'list') { |
23 | - $link_blocks_view = '<a href="'.api_get_self().'?view=blocks">'. |
|
24 | - Display::return_icon('blocks.png',get_lang('DashboardBlocks'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
23 | + $link_blocks_view = '<a href="'.api_get_self().'?view=blocks">'. |
|
24 | + Display::return_icon('blocks.png',get_lang('DashboardBlocks'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
25 | 25 | } else { |
26 | - $link_list_view = '<a href="'.api_get_self().'?view=list">'. |
|
27 | - Display::return_icon('edit.png',get_lang('EditBlocks'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
26 | + $link_list_view = '<a href="'.api_get_self().'?view=list">'. |
|
27 | + Display::return_icon('edit.png',get_lang('EditBlocks'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | $configuration_link = null; |
31 | 31 | if (api_is_platform_admin()) { |
32 | - $configuration_link = '<a href="'.api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins">' |
|
33 | - .Display::return_icon('settings.png',get_lang('ConfigureDashboardPlugin'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
32 | + $configuration_link = '<a href="'.api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins">' |
|
33 | + .Display::return_icon('settings.png',get_lang('ConfigureDashboardPlugin'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | echo '<div class="actions">'; |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | } |
88 | 88 | |
89 | 89 | } else { |
90 | - // block dashboard list |
|
91 | - if (isset($success)) { |
|
92 | - Display::display_confirmation_message(get_lang('BlocksHaveBeenUpdatedSuccessfully')); |
|
93 | - } |
|
94 | - $user_id = api_get_user_id(); |
|
95 | - DashboardManager::display_user_dashboard_list($user_id); |
|
90 | + // block dashboard list |
|
91 | + if (isset($success)) { |
|
92 | + Display::display_confirmation_message(get_lang('BlocksHaveBeenUpdatedSuccessfully')); |
|
93 | + } |
|
94 | + $user_id = api_get_user_id(); |
|
95 | + DashboardManager::display_user_dashboard_list($user_id); |
|
96 | 96 | } |
@@ -85,40 +85,40 @@ |
||
85 | 85 | $this->view->render(); |
86 | 86 | } |
87 | 87 | |
88 | - /** |
|
89 | - * This method allow store user blocks from dashboard manager |
|
90 | - * render to dashboard.php view |
|
91 | - */ |
|
92 | - public function store_user_block() |
|
88 | + /** |
|
89 | + * This method allow store user blocks from dashboard manager |
|
90 | + * render to dashboard.php view |
|
91 | + */ |
|
92 | + public function store_user_block() |
|
93 | 93 | { |
94 | - $data = array(); |
|
95 | - $user_id = $this->user_id; |
|
96 | - if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") { |
|
97 | - $enabled_blocks = $_POST['enabled_blocks']; |
|
98 | - $columns = $_POST['columns']; |
|
99 | - $affected_rows = DashboardManager::store_user_blocks($user_id, $enabled_blocks, $columns); |
|
100 | - if ($affected_rows) { |
|
101 | - $data['success'] = true; |
|
102 | - } |
|
103 | - } |
|
104 | - |
|
105 | - $data['dashboard_view'] = 'list'; |
|
106 | - |
|
107 | - // render to the view |
|
108 | - $this->view->set_data($data); |
|
109 | - $this->view->set_layout('layout'); |
|
110 | - $this->view->set_template('dashboard'); |
|
111 | - $this->view->render(); |
|
112 | - } |
|
113 | - |
|
114 | - /** |
|
115 | - * This method is used when you close a block from dashboard block interface |
|
116 | - * render to dashboard.php view |
|
117 | - */ |
|
118 | - public function close_user_block($path) |
|
94 | + $data = array(); |
|
95 | + $user_id = $this->user_id; |
|
96 | + if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") { |
|
97 | + $enabled_blocks = $_POST['enabled_blocks']; |
|
98 | + $columns = $_POST['columns']; |
|
99 | + $affected_rows = DashboardManager::store_user_blocks($user_id, $enabled_blocks, $columns); |
|
100 | + if ($affected_rows) { |
|
101 | + $data['success'] = true; |
|
102 | + } |
|
103 | + } |
|
104 | + |
|
105 | + $data['dashboard_view'] = 'list'; |
|
106 | + |
|
107 | + // render to the view |
|
108 | + $this->view->set_data($data); |
|
109 | + $this->view->set_layout('layout'); |
|
110 | + $this->view->set_template('dashboard'); |
|
111 | + $this->view->render(); |
|
112 | + } |
|
113 | + |
|
114 | + /** |
|
115 | + * This method is used when you close a block from dashboard block interface |
|
116 | + * render to dashboard.php view |
|
117 | + */ |
|
118 | + public function close_user_block($path) |
|
119 | 119 | { |
120 | - $user_id = $this->user_id; |
|
121 | - $result = DashboardManager::close_user_block($user_id, $path); |
|
122 | - $this->display($result); |
|
123 | - } |
|
120 | + $user_id = $this->user_id; |
|
121 | + $result = DashboardManager::close_user_block($user_id, $path); |
|
122 | + $this->display($result); |
|
123 | + } |
|
124 | 124 | } |