@@ -28,10 +28,10 @@ |
||
28 | 28 | error_log('In xajax_save_objectives('.$lp_id.','.$user_id.','.$view_id.','.$item_id.',"'.(count($objectives) > 0 ? count($objectives) : '').'")', 0); |
29 | 29 | } |
30 | 30 | $mylp = learnpath::getLpFromSession(api_get_course_id(), $lp_id, $user_id); |
31 | - $mylpi =& $mylp->items[$item_id]; |
|
32 | - if (is_array($objectives) && count($objectives)>0){ |
|
33 | - foreach ($objectives as $index=>$objective){ |
|
34 | - $mylpi->add_objective($index,$objectives[$index]); |
|
31 | + $mylpi = & $mylp->items[$item_id]; |
|
32 | + if (is_array($objectives) && count($objectives) > 0) { |
|
33 | + foreach ($objectives as $index=>$objective) { |
|
34 | + $mylpi->add_objective($index, $objectives[$index]); |
|
35 | 35 | } |
36 | 36 | $mylpi->write_objectives_to_db(); |
37 | 37 | } |
@@ -309,9 +309,9 @@ discard block |
||
309 | 309 | $myname = $oOrganization->get_name(); |
310 | 310 | $myname = api_utf8_decode($myname); |
311 | 311 | |
312 | - $sql = "INSERT INTO $new_lp (c_id, lp_type, name, ref, description, path, force_commit, default_view_mod, default_encoding, js_lib,display_order, session_id, use_max_score)" . |
|
312 | + $sql = "INSERT INTO $new_lp (c_id, lp_type, name, ref, description, path, force_commit, default_view_mod, default_encoding, js_lib,display_order, session_id, use_max_score)". |
|
313 | 313 | "VALUES ($courseId , 2,'".$myname."', '".$oOrganization->get_ref()."','','".$this->subdir."', 0, 'embedded', '".$this->manifest_encoding."', 'scorm_api.php', $dsp, $sessionId, $userMaxScore)"; |
314 | - if ($this->debug > 1) { error_log('New LP - In import_manifest(), inserting path: '. $sql, 0); } |
|
314 | + if ($this->debug > 1) { error_log('New LP - In import_manifest(), inserting path: '.$sql, 0); } |
|
315 | 315 | |
316 | 316 | Database::query($sql); |
317 | 317 | $lp_id = Database::insert_id(); |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | $path = ''; |
366 | 366 | $type = 'dir'; |
367 | 367 | if (isset($this->resources[$item['identifierref']])) { |
368 | - $oRes =& $this->resources[$item['identifierref']]; |
|
368 | + $oRes = & $this->resources[$item['identifierref']]; |
|
369 | 369 | $path = @$oRes->get_path(); |
370 | 370 | if (!empty($path)) { |
371 | 371 | $temptype = $oRes->get_scorm_type(); |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | $item['parameters'] = Database::escape_string($item['parameters']); |
417 | 417 | |
418 | 418 | $sql = "INSERT INTO $new_lp_item (c_id, lp_id,item_type,ref,title, path,min_score,max_score, $field_add parent_item_id,previous_item_id,next_item_id, prerequisite,display_order,launch_data, parameters) |
419 | - VALUES ($courseId, $lp_id, '$type', '$identifier', '$title', '$path' , 0, $max_score, $value_add $parent, $previous, 0, '$prereq', ".$item['rel_order'] .", '".$item['datafromlms']."', '".$item['parameters']."' )"; |
|
419 | + VALUES ($courseId, $lp_id, '$type', '$identifier', '$title', '$path' , 0, $max_score, $value_add $parent, $previous, 0, '$prereq', ".$item['rel_order'].", '".$item['datafromlms']."', '".$item['parameters']."' )"; |
|
420 | 420 | |
421 | 421 | Database::query($sql); |
422 | 422 | if ($this->debug > 1) { error_log('New LP - In import_manifest(), inserting item : '.$sql, 0); } |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | foreach ($specific_fields as $specific_field) { |
451 | 451 | if (isset($_REQUEST[$specific_field['code']])) { |
452 | 452 | $sterms = trim($_REQUEST[$specific_field['code']]); |
453 | - $all_specific_terms .= ' '. $sterms; |
|
453 | + $all_specific_terms .= ' '.$sterms; |
|
454 | 454 | if (!empty($sterms)) { |
455 | 455 | $sterms = explode(',', $sterms); |
456 | 456 | foreach ($sterms as $sterm) { |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | } |
460 | 460 | } |
461 | 461 | } |
462 | - $body_to_index = $all_specific_terms .' '. $title; |
|
462 | + $body_to_index = $all_specific_terms.' '.$title; |
|
463 | 463 | $ic_slide->addValue("content", $body_to_index); |
464 | 464 | // TODO: Add a comment to say terms separated by commas. |
465 | 465 | $courseid = api_get_course_id(); |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | SE_COURSE_ID => $courseid, |
470 | 470 | SE_TOOL_ID => TOOL_LEARNPATH, |
471 | 471 | SE_DATA => array('lp_id' => $lp_id, 'lp_item'=> $previous, 'document_id' => ''), // TODO: Unify with other lp types. |
472 | - SE_USER => (int)api_get_user_id(), |
|
472 | + SE_USER => (int) api_get_user_id(), |
|
473 | 473 | ); |
474 | 474 | $ic_slide->xapian_data = serialize($xapian_data); |
475 | 475 | $di->addChunk($ic_slide); |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | public function import_package($zip_file_info, $current_dir = '', $courseInfo = array()) |
516 | 516 | { |
517 | 517 | if ($this->debug > 0) { |
518 | - error_log('In scorm::import_package('.print_r($zip_file_info,true).',"'.$current_dir.'") method', 0); |
|
518 | + error_log('In scorm::import_package('.print_r($zip_file_info, true).',"'.$current_dir.'") method', 0); |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | $courseInfo = empty($courseInfo) ? api_get_course_info() : $courseInfo; |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | $zip_file_name = $zip_file_info['name']; |
527 | 527 | |
528 | 528 | if ($this->debug > 1) { |
529 | - error_log('New LP - import_package() - zip file path = ' . $zip_file_path . ', zip file name = ' . $zip_file_name, 0); |
|
529 | + error_log('New LP - import_package() - zip file path = '.$zip_file_path.', zip file name = '.$zip_file_name, 0); |
|
530 | 530 | } |
531 | 531 | |
532 | 532 | $course_rel_dir = api_get_course_path($courseInfo['code']).'/scorm'; // scorm dir web path starting from /courses |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | $current_dir = api_replace_dangerous_char(trim($current_dir)); // Current dir we are in, inside scorm/ |
535 | 535 | |
536 | 536 | if ($this->debug > 1) { |
537 | - error_log( 'New LP - import_package() - current_dir = ' . $current_dir, 0); |
|
537 | + error_log('New LP - import_package() - current_dir = '.$current_dir, 0); |
|
538 | 538 | } |
539 | 539 | |
540 | 540 | // Get name of the zip file without the extension. |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | $file_info = pathinfo($zip_file_name); |
543 | 543 | $filename = $file_info['basename']; |
544 | 544 | $extension = $file_info['extension']; |
545 | - $file_base_name = str_replace('.'.$extension,'',$filename); // Filename without its extension. |
|
545 | + $file_base_name = str_replace('.'.$extension, '', $filename); // Filename without its extension. |
|
546 | 546 | $this->zipname = $file_base_name; // Save for later in case we don't have a title. |
547 | 547 | |
548 | 548 | if ($this->debug > 1) { error_log("New LP - base file name is : ".$file_base_name, 0); } |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | $slash_count = substr_count($shortest_path, '/'); |
589 | 589 | foreach ($manifest_list as $manifest_path) { |
590 | 590 | $tmp_slash_count = substr_count($manifest_path, '/'); |
591 | - if ($tmp_slash_count<$slash_count) { |
|
591 | + if ($tmp_slash_count < $slash_count) { |
|
592 | 592 | $shortest_path = $manifest_path; |
593 | 593 | $slash_count = $tmp_slash_count; |
594 | 594 | } |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | $this->subdir .= '/'.dirname($shortest_path); // Do not concatenate because already done above. |
598 | 598 | $manifest = $shortest_path; |
599 | 599 | if ($this->debug > 1) { error_log('New LP - Package type is now '.$package_type, 0); } |
600 | - if ($package_type== '') { |
|
600 | + if ($package_type == '') { |
|
601 | 601 | // && defined('CHECK_FOR_SCORM') && CHECK_FOR_SCORM) |
602 | 602 | if ($this->debug > 1) { error_log('New LP - Package type is empty', 0); } |
603 | 603 | return api_failure::set_failure('not_scorm_content'); |
@@ -613,8 +613,8 @@ discard block |
||
613 | 613 | $new_dir = '/'.$new_dir; |
614 | 614 | } |
615 | 615 | |
616 | - if ($new_dir[strlen($new_dir)-1] == '/') { |
|
617 | - $new_dir = substr($new_dir,0,-1); |
|
616 | + if ($new_dir[strlen($new_dir) - 1] == '/') { |
|
617 | + $new_dir = substr($new_dir, 0, -1); |
|
618 | 618 | } |
619 | 619 | |
620 | 620 | /* Uncompressing phase */ |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | if ($file != '.' && $file != '..') { |
656 | 656 | $filetype = 'file'; |
657 | 657 | |
658 | - if (is_dir($course_sys_dir . $new_dir . $file)) { |
|
658 | + if (is_dir($course_sys_dir.$new_dir.$file)) { |
|
659 | 659 | $filetype = 'folder'; |
660 | 660 | } |
661 | 661 | |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | } |
685 | 685 | } |
686 | 686 | } |
687 | - @rename($course_sys_dir.$new_dir.$file,$course_sys_dir.$new_dir.$safe_file); |
|
687 | + @rename($course_sys_dir.$new_dir.$file, $course_sys_dir.$new_dir.$safe_file); |
|
688 | 688 | if ($this->debug >= 1) { error_log('New LP - Renaming '.$course_sys_dir.$new_dir.$file.' to '.$course_sys_dir.$new_dir.$safe_file, 0); } |
689 | 689 | } |
690 | 690 | } |
@@ -873,7 +873,7 @@ discard block |
||
873 | 873 | if ($this->debug > 0) { error_log('In scorm::get_res_path('.$id.') method', 0); } |
874 | 874 | $path = ''; |
875 | 875 | if (isset($this->resources[$id])) { |
876 | - $oRes =& $this->resources[$id]; |
|
876 | + $oRes = & $this->resources[$id]; |
|
877 | 877 | $path = @$oRes->get_path(); |
878 | 878 | } |
879 | 879 | return $path; |
@@ -889,7 +889,7 @@ discard block |
||
889 | 889 | if ($this->debug > 0) { error_log('In scorm::get_res_type('.$id.') method', 0); } |
890 | 890 | $type = ''; |
891 | 891 | if (isset($this->resources[$id])) { |
892 | - $oRes =& $this->resources[$id]; |
|
892 | + $oRes = & $this->resources[$id]; |
|
893 | 893 | $temptype = $oRes->get_scorm_type(); |
894 | 894 | if (!empty($temptype)) { |
895 | 895 | $type = $temptype; |
@@ -908,9 +908,9 @@ discard block |
||
908 | 908 | $title = ''; |
909 | 909 | if (isset($this->manifest['organizations']['default'])) { |
910 | 910 | $title = $this->organizations[$this->manifest['organizations']['default']]->get_name(); |
911 | - } elseif (count($this->organizations)==1) { |
|
911 | + } elseif (count($this->organizations) == 1) { |
|
912 | 912 | // This will only get one title but so we don't need to know the index. |
913 | - foreach($this->organizations as $id => $value) { |
|
913 | + foreach ($this->organizations as $id => $value) { |
|
914 | 914 | $title = $this->organizations[$id]->get_name(); |
915 | 915 | break; |
916 | 916 | } |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | $a_dir = realpath($dir.'/../../archive/'); |
16 | 16 | $list = scandir($a_dir); |
17 | 17 | // calculate 7 days |
18 | -$t = time()-(86400*7); |
|
18 | +$t = time() - (86400 * 7); |
|
19 | 19 | foreach ($list as $item) { |
20 | - if (substr($item,0,1) == '.') { |
|
20 | + if (substr($item, 0, 1) == '.') { |
|
21 | 21 | continue; |
22 | 22 | } |
23 | 23 | $stat = @stat($a_dir.'/'.$item); |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | * Delete a file or recursively delete a directory |
35 | 35 | * @param string $str Path to file or directory |
36 | 36 | */ |
37 | -function recursive_delete($str){ |
|
37 | +function recursive_delete($str) { |
|
38 | 38 | if (is_file($str)) { |
39 | 39 | return @unlink($str); |
40 | 40 | } elseif (is_dir($str)) { |
41 | - $scan = glob(rtrim($str,'/').'/*'); |
|
41 | + $scan = glob(rtrim($str, '/').'/*'); |
|
42 | 42 | foreach ($scan as $index=>$path) { |
43 | 43 | recursive_delete($path); |
44 | 44 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * @package chamilo.cron |
6 | 6 | * @author Imanol Losada <[email protected]> |
7 | 7 | */ |
8 | -require_once __DIR__ . '/../inc/global.inc.php'; |
|
8 | +require_once __DIR__.'/../inc/global.inc.php'; |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Initialization |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | foreach ($sessions as $sessionId => $userIds) { |
66 | 66 | $userId = 0; |
67 | - $userIds = $userIds ? " AND sessionUser.user_id NOT IN (" . implode(", ", $userIds) . ")" : null; |
|
67 | + $userIds = $userIds ? " AND sessionUser.user_id NOT IN (".implode(", ", $userIds).")" : null; |
|
68 | 68 | $query = " |
69 | 69 | SELECT sessionUser.session_id, sessionUser.user_id, session.name, session.access_end_date |
70 | 70 | FROM $sessionUserTable AS sessionUser |
@@ -156,10 +156,10 @@ discard block |
||
156 | 156 | $administrator['completeName'], |
157 | 157 | $administrator['email'] |
158 | 158 | ); |
159 | - echo "Email sent to $userCompleteName (" . $user['email'] . ")\n"; |
|
160 | - echo "Session: " . $session['name'] . "\n"; |
|
161 | - echo "Date end: " . $session['access_end_date'] . "\n"; |
|
162 | - echo "Days remaining: " . $daysRemaining->format("%d") . "\n\n"; |
|
159 | + echo "Email sent to $userCompleteName (".$user['email'].")\n"; |
|
160 | + echo "Session: ".$session['name']."\n"; |
|
161 | + echo "Date end: ".$session['access_end_date']."\n"; |
|
162 | + echo "Days remaining: ".$daysRemaining->format("%d")."\n\n"; |
|
163 | 163 | } |
164 | 164 | echo "======================================================================\n\n"; |
165 | 165 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @author Angel Fernando Quiroz Campos <[email protected]> |
7 | 7 | * @package chamilo.cron |
8 | 8 | */ |
9 | -require_once __DIR__ . '/../inc/global.inc.php'; |
|
9 | +require_once __DIR__.'/../inc/global.inc.php'; |
|
10 | 10 | |
11 | 11 | if (php_sapi_name() != 'cli') { |
12 | 12 | exit; //do not run from browser |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | ->getResult(); |
33 | 33 | |
34 | 34 | if (empty($sessions)) { |
35 | - echo "No sessions finishing today $endDate" . PHP_EOL; |
|
35 | + echo "No sessions finishing today $endDate".PHP_EOL; |
|
36 | 36 | exit; |
37 | 37 | } |
38 | 38 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $sessionUsers = $session->getUsers(); |
51 | 51 | |
52 | 52 | if (empty($sessionUsers)) { |
53 | - echo 'No users to send mail' . PHP_EOL; |
|
53 | + echo 'No users to send mail'.PHP_EOL; |
|
54 | 54 | exit; |
55 | 55 | } |
56 | 56 | |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | $administrator['email'] |
82 | 82 | ); |
83 | 83 | |
84 | - echo '============' . PHP_EOL; |
|
85 | - echo "Email sent to: {$user->getCompleteName()} ({$user->getEmail()})" . PHP_EOL; |
|
86 | - echo "Session: {$session->getName()}" . PHP_EOL; |
|
87 | - echo "End date: {$session->getAccessEndDate()->format('Y-m-d h:i')}" . PHP_EOL; |
|
84 | + echo '============'.PHP_EOL; |
|
85 | + echo "Email sent to: {$user->getCompleteName()} ({$user->getEmail()})".PHP_EOL; |
|
86 | + echo "Session: {$session->getName()}".PHP_EOL; |
|
87 | + echo "End date: {$session->getAccessEndDate()->format('Y-m-d h:i')}".PHP_EOL; |
|
88 | 88 | } |
89 | 89 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $totalSize = $row['total']; |
98 | 98 | |
99 | 99 | if ($debug) { |
100 | - echo "Total size in table $table " . (round($totalSize / 1024)) . " MB \n"; |
|
100 | + echo "Total size in table $table ".(round($totalSize / 1024))." MB \n"; |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | $table = Database::get_course_table(TABLE_FORUM_ATTACHMENT); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $subTotal = $row['total']; |
108 | 108 | $totalSize += $subTotal; |
109 | 109 | if ($debug) { |
110 | - echo "Total size in table $table " . (round($subTotal / 1024)) . " MB \n"; |
|
110 | + echo "Total size in table $table ".(round($subTotal / 1024))." MB \n"; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | $totalSize = $totalSize / 1024; |
@@ -7,7 +7,7 @@ |
||
7 | 7 | /** |
8 | 8 | * Initialization |
9 | 9 | */ |
10 | -if (PHP_SAPI!='cli') { |
|
10 | +if (PHP_SAPI != 'cli') { |
|
11 | 11 | die('Run this script through the command line or comment this line in the code'); |
12 | 12 | } |
13 | 13 |
@@ -12,13 +12,13 @@ |
||
12 | 12 | } else { |
13 | 13 | echo "Received param ".Security::remove_XSS($_GET['doc'])."<br />"; |
14 | 14 | } |
15 | -$courses_list = CourseManager::get_courses_list(); |
|
15 | +$courses_list = CourseManager::get_courses_list(); |
|
16 | 16 | foreach ($courses_list as $course) { |
17 | 17 | $title = Database::escape_string($_GET['doc']); |
18 | 18 | $td = Database::get_course_table(TABLE_DOCUMENT); |
19 | 19 | $sql = "SELECT id, path FROM $td WHERE c_id = ".$course['id']." AND path LIKE '%$title%' OR title LIKE '%$title%'"; |
20 | 20 | $res = Database::query($sql); |
21 | - if (Database::num_rows($res)>0) { |
|
21 | + if (Database::num_rows($res) > 0) { |
|
22 | 22 | while ($row = Database::fetch_array($res)) { |
23 | 23 | echo "Found doc ".$row['id']."-> ".$row['path']." in course ".$course['code']."<br />"; |
24 | 24 | } |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | FROM $users WHERE email = '$mail'\n"; |
35 | 35 | $res = Database::query($sql); |
36 | 36 | if ($res === false) { |
37 | - echo 'Error in database with email ' . $mail . "\n"; |
|
37 | + echo 'Error in database with email '.$mail."\n"; |
|
38 | 38 | } |
39 | 39 | if (Database::num_rows($res) == 0) { |
40 | - echo '[Error] Email not found in database: ' . $row['email'] . "\n"; |
|
40 | + echo '[Error] Email not found in database: '.$row['email']."\n"; |
|
41 | 41 | } else { |
42 | 42 | $row = Database::fetch_assoc($res); |
43 | - $pass = api_substr($row['username'], 0, 4) . rand(0, 9) . rand(0, 9); |
|
43 | + $pass = api_substr($row['username'], 0, 4).rand(0, 9).rand(0, 9); |
|
44 | 44 | |
45 | 45 | if ($user) { |
46 | 46 | |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | null, |
72 | 72 | PERSON_NAME_EMAIL_ADDRESS |
73 | 73 | ); |
74 | - $emailsubject = '[' . api_get_setting('siteName') . '] ' . get_lang('YourReg', null, $l) . ' ' . api_get_setting('siteName'); |
|
75 | - $emailbody = get_lang('Dear', null, $l) . ' ' . api_get_person_name($user['FirstName'], $user['LastName']) . ",\n\n" . get_lang('YouAreReg', null, $l) . " " . api_get_setting('siteName') . " " . get_lang('WithTheFollowingSettings', null, $l) . "\n\n" . get_lang('Username', null, $l) . " : " . $user['UserName'] . "\n" . get_lang('Pass', null, $l) . " : " . $user['Password'] . "\n\n" . get_lang('Address', null, $l) . " " . api_get_setting('siteName') . " " . get_lang('Is', null, $l) . " : " . api_get_path(WEB_PATH) . " \n\n" . get_lang('Problem', null, $l) . "\n\n" . get_lang('Formula', null, $l) . ",\n\n" . api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname')) . "\n" . get_lang('Manager', null, $l) . " " . api_get_setting('siteName') . "\nT. " . api_get_setting('administratorTelephone') . "\n" . get_lang('Email', null, $l) . " : " . api_get_setting('emailAdministrator') . ""; |
|
74 | + $emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg', null, $l).' '.api_get_setting('siteName'); |
|
75 | + $emailbody = get_lang('Dear', null, $l).' '.api_get_person_name($user['FirstName'], $user['LastName']).",\n\n".get_lang('YouAreReg', null, $l)." ".api_get_setting('siteName')." ".get_lang('WithTheFollowingSettings', null, $l)."\n\n".get_lang('Username', null, $l)." : ".$user['UserName']."\n".get_lang('Pass', null, $l)." : ".$user['Password']."\n\n".get_lang('Address', null, $l)." ".api_get_setting('siteName')." ".get_lang('Is', null, $l)." : ".api_get_path(WEB_PATH)." \n\n".get_lang('Problem', null, $l)."\n\n".get_lang('Formula', null, $l).",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n".get_lang('Manager', null, $l)." ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n".get_lang('Email', null, $l)." : ".api_get_setting('emailAdministrator').""; |
|
76 | 76 | $sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS); |
77 | 77 | $email_admin = api_get_setting('emailAdministrator'); |
78 | 78 | @api_mail_html( |