diff --git a/main/inc/lib/blog.lib.php b/main/inc/lib/blog.lib.php index 1d0b1c8624..bd76d5f015 100755 --- a/main/inc/lib/blog.lib.php +++ b/main/inc/lib/blog.lib.php @@ -2649,18 +2649,24 @@ class Blog // Get tasks for this month if ($_user['user_id']) { - $sql = " SELECT task_rel_user.*, DAYOFMONTH(target_date) as task_day, task.title, blog.blog_name - FROM $tbl_blogs_tasks_rel_user task_rel_user - INNER JOIN $tbl_blogs_tasks task ON task_rel_user.task_id = task.task_id - INNER JOIN $tbl_blogs blog ON task_rel_user.blog_id = blog.blog_id - WHERE - task_rel_user.c_id = $course_id AND - task.c_id = $course_id AND - blog.c_id = $course_id AND - task_rel_user.user_id = ".$_user['user_id']." AND - MONTH(target_date) = '$month' AND - YEAR(target_date) = '$year' - ORDER BY target_date ASC"; + $sql = "SELECT + task_rel_user.*, + DAYOFMONTH(target_date) as task_day, + task.title, + blog.blog_name + FROM $tbl_blogs_tasks_rel_user task_rel_user + INNER JOIN $tbl_blogs_tasks task + ON task_rel_user.task_id = task.task_id + INNER JOIN $tbl_blogs blog + ON task_rel_user.blog_id = blog.blog_id + WHERE + task_rel_user.c_id = $course_id AND + task.c_id = $course_id AND + blog.c_id = $course_id AND + task_rel_user.user_id = ".$_user['user_id']." AND + MONTH(target_date) = '$month' AND + YEAR(target_date) = '$year' + ORDER BY target_date ASC"; $result = Database::query($sql); if (Database::num_rows($result) > 0) { @@ -2722,11 +2728,7 @@ class Blog if (isset($tasks[$curday]) && is_array($tasks[$curday])) { // Add tasks to calendar foreach ($tasks[$curday] as $task) { - $html .= ''; + $html .= ''; $html .= Display::return_icon('blog_task.gif', get_lang('ExecuteThisTask')); $html .= ''; } @@ -2752,11 +2754,14 @@ class Blog */ public static function displayBlogCreateForm() { - $form = new FormValidator('add_blog', 'post', 'blog_admin.php?action=add'); + $form = new FormValidator( + 'add_blog', + 'post', + 'blog_admin.php?action=add' + ); $form->addElement('header', get_lang('AddBlog')); $form->addElement('text', 'blog_name', get_lang('Title')); $form->addElement('textarea', 'blog_subtitle', get_lang('SubTitle')); - $form->addElement('hidden', 'new_blog_submit', 'true'); $form->addButtonSave(get_lang('SaveProject')); @@ -2791,11 +2796,14 @@ class Blog $blog['blog_subtitle'] = Security::remove_XSS($_POST['blog_subtitle']); } - $form = new FormValidator('edit_blog', 'post', 'blog_admin.php?action=edit&blog_id='.intval($_GET['blog_id'])); + $form = new FormValidator( + 'edit_blog', + 'post', + 'blog_admin.php?action=edit&blog_id='.intval($_GET['blog_id']) + ); $form->addElement('header', get_lang('EditBlog')); $form->addElement('text', 'blog_name', get_lang('Title')); $form->addElement('textarea', 'blog_subtitle', get_lang('SubTitle')); - $form->addElement('hidden', 'edit_blog_submit', 'true'); $form->addElement('hidden', 'blog_id', $blog['blog_id']); $form->addButtonSave(get_lang('Save')); @@ -2916,8 +2924,10 @@ class Blog $course_id = api_get_course_int_id(); - $sql = "SELECT path, filename, comment FROM $blog_table_attachment - WHERE c_id = $course_id AND blog_id = $blog_id $where"; + $sql = "SELECT path, filename, comment + FROM $blog_table_attachment + WHERE c_id = $course_id AND blog_id = $blog_id + $where"; $result = Database::query($sql); if (Database::num_rows($result) != 0) { @@ -2997,27 +3007,28 @@ class Blog $userId = intval($userId); $sql = "SELECT DISTINCT blog.blog_id, post_id, title, full_text, post.date_creation - FROM $tbl_blogs blog - INNER JOIN $tbl_blog_post post - ON (blog.blog_id = post.blog_id AND blog.c_id = post.c_id) - WHERE - blog.c_id = $courseId AND - post.c_id = $courseId AND - author_id = $userId AND - visibility = 1 - ORDER BY post.date_creation DESC "; + FROM $tbl_blogs blog + INNER JOIN $tbl_blog_post post + ON (blog.blog_id = post.blog_id AND blog.c_id = post.c_id) + WHERE + blog.c_id = $courseId AND + post.c_id = $courseId AND + author_id = $userId AND + visibility = 1 + ORDER BY post.date_creation DESC "; $result = Database::query($sql); $return_data = ''; if (Database::num_rows($result) != 0) { while ($row = Database::fetch_array($result)) { $return_data .= '

'; - $return_data .= '
'.Display::return_icon( + $return_data .= '
'. + Display::return_icon( 'blog_article.png', get_lang('BlogPosts') - ).' '.$row['title'].'        
'.get_lang( - 'SeeBlog' - ).'
'; + ).' '. + $row['title'].'        
'. + get_lang('SeeBlog').'
'; $return_data .= '
'; $return_data .= $row['full_text']; $return_data .= '

'; @@ -3043,22 +3054,22 @@ class Blog $courseId = intval($courseId); $sql = "SELECT DISTINCT blog.blog_id, comment_id, title, comment, comment.date_creation - FROM $tbl_blogs blog - INNER JOIN $tbl_blog_comment comment - ON (blog.blog_id = comment.blog_id AND blog.c_id = comment.c_id) - WHERE blog.c_id = $courseId AND - comment.c_id = $courseId AND - author_id = $userId AND - visibility = 1 - ORDER BY blog_name"; + FROM $tbl_blogs blog + INNER JOIN $tbl_blog_comment comment + ON (blog.blog_id = comment.blog_id AND blog.c_id = comment.c_id) + WHERE blog.c_id = $courseId AND + comment.c_id = $courseId AND + author_id = $userId AND + visibility = 1 + ORDER BY blog_name"; $result = Database::query($sql); $return_data = ''; if (Database::num_rows($result) != 0) { while ($row = Database::fetch_array($result)) { $return_data .= '

'; - $return_data .= '
'.$row['title'].'        
'.get_lang('SeeBlog').'
'; + $return_data .= '
'. + $row['title'].'        
'. + get_lang('SeeBlog').'
'; $return_data .= '
'; $return_data .= $row['comment']; $return_data .= '
'; @@ -3107,4 +3118,3 @@ class Blog return api_htmlentities($extract); } } - diff --git a/main/lp/learnpathItem.class.php b/main/lp/learnpathItem.class.php index 9c01575013..287588484b 100755 --- a/main/lp/learnpathItem.class.php +++ b/main/lp/learnpathItem.class.php @@ -1225,7 +1225,7 @@ class learnpathItem $in_files_list ); } - } elseif (strstr($second_part,'..') === 0) { + } elseif (strstr($second_part, '..') === 0) { // Link is relative but going back in the hierarchy. $files_list[] = array( $second_part, @@ -1651,10 +1651,14 @@ class learnpathItem /** * @param string $origin + * @param string $time + * * @return string */ - public static function getScormTimeFromParameter($origin = 'php', $time = null) - { + public static function getScormTimeFromParameter( + $origin = 'php', + $time = null + ) { $h = get_lang('h'); if (!isset($time)) { if ($origin == 'js') { @@ -1959,8 +1963,6 @@ class learnpathItem }*/ // If we don't init start time here, the time is sometimes calculated from the last start time. $this->current_start_time = time(); - - //error_log('New LP - reinit blocked by setting', 0); } } @@ -2010,7 +2012,6 @@ class learnpathItem $this->prereq_alert = ''; // First parse all parenthesis by using a sequential loop // (looking for less-inclusives first). - if ($prereqs_string == '_true_') { return true; @@ -2132,7 +2133,6 @@ class learnpathItem } } else { // No ANDs found, look for <> - if (self::DEBUG > 1) { error_log( 'New LP - Didnt find any =, looking for <>', @@ -2206,7 +2206,6 @@ class learnpathItem } } else { // Finally, look for sets/groups - if (self::DEBUG > 1) { error_log( 'New LP - Didnt find any ~, looking for groups', @@ -2384,7 +2383,7 @@ class learnpathItem if ($returnstatus) { //AND origin_lp_item_id = '.$user_id.' $sql = 'SELECT exe_result, exe_weighting - FROM ' . Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES).' + FROM '.Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES).' WHERE exe_exo_id = ' . $items[$refs_list[$prereqs_string]]->path.' AND exe_user_id = ' . $user_id.' AND @@ -2424,7 +2423,6 @@ class learnpathItem } } else { // 3. for multiple attempts we check that there are minimum 1 item completed. - // Checking in the database. $sql = 'SELECT exe_result, exe_weighting FROM ' . Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES).'