From 11712fac8f037caa097d67c9fc65b3aef39f1ede Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Fri, 31 Mar 2017 16:01:30 +0200 Subject: [PATCH 1/4] Minor - format code, update docs --- main/exercise/answer.class.php | 1 - main/survey/surveyUtil.class.php | 100 +++++++++++++++++++++---------- 2 files changed, 68 insertions(+), 33 deletions(-) diff --git a/main/exercise/answer.class.php b/main/exercise/answer.class.php index 979560677d..164bd5eac1 100755 --- a/main/exercise/answer.class.php +++ b/main/exercise/answer.class.php @@ -944,7 +944,6 @@ class Answer } } } - } } diff --git a/main/survey/surveyUtil.class.php b/main/survey/surveyUtil.class.php index b3a3cc2e5f..b901bed0ee 100755 --- a/main/survey/surveyUtil.class.php +++ b/main/survey/surveyUtil.class.php @@ -7,11 +7,13 @@ class SurveyUtil { /** - * Checks whether the given survey has a pagebreak question as the first or the last question. + * Checks whether the given survey has a pagebreak question as the first + * or the last question. * If so, break the current process, displaying an error message - * @param integer Survey ID (database ID) - * @param boolean Optional. Whether to continue the current process or exit when breaking condition found. Defaults to true (do not break). - * @return void + * @param integer $survey_id Survey ID (database ID) + * @param boolean $continue Optional. Whether to continue the current + * process or exit when breaking condition found. Defaults to true (do not break). + * @return void */ public static function check_first_last_question($survey_id, $continue = true) { @@ -56,7 +58,8 @@ class SurveyUtil * @author Patrick Cool , Ghent University * @version January 2007 */ - public static function remove_answer($user, $survey_id, $question_id, $course_id) { + public static function remove_answer($user, $survey_id, $question_id, $course_id) + { $course_id = intval($course_id); // table definition $table_survey_answer = Database::get_course_table(TABLE_SURVEY_ANSWER); @@ -83,8 +86,14 @@ class SurveyUtil * @author Patrick Cool , Ghent University * @version January 2007 */ - public static function store_answer($user, $survey_id, $question_id, $option_id, $option_value, $survey_data) - { + public static function store_answer( + $user, + $survey_id, + $question_id, + $option_id, + $option_value, + $survey_data + ) { // If the question_id is empty, don't store an answer if (empty($question_id)) { return false; @@ -115,7 +124,8 @@ class SurveyUtil Database::query($sql); $insertId = Database::insert_id(); - $sql = "UPDATE $table_survey_answer SET answer_id = $insertId WHERE iid = $insertId"; + $sql = "UPDATE $table_survey_answer SET answer_id = $insertId + WHERE iid = $insertId"; Database::query($sql); return true; } @@ -123,7 +133,7 @@ class SurveyUtil /** * This function checks the parameters that are used in this page * - * @return string The header, an error and the footer if any parameter fails, else it returns true + * @return string $people_filled The header, an error and the footer if any parameter fails, else it returns true * @author Patrick Cool , Ghent University * @version February 2007 */ @@ -189,7 +199,7 @@ class SurveyUtil * This function deals with the action handling * @param array $survey_data * @param array $people_filled - * @return void + * @return void * @author Patrick Cool , Ghent University * @version February 2007 */ @@ -280,7 +290,7 @@ class SurveyUtil * than a one-page display of all the questions * of the survey that is filled with the answers of the person who filled the survey. * - * @return string html code of the one-page survey with the answers of the selected user + * @return string html code of the one-page survey with the answers of the selected user * @author Patrick Cool , Ghent University * @version February 2007 - Updated March 2008 */ @@ -379,9 +389,7 @@ class SurveyUtil survey_question.question_id = survey_question_option.question_id AND survey_question_option.c_id = $course_id WHERE - survey_question.survey_id = '".Database::escape_string( - $_GET['survey_id'] - )."' AND + survey_question.survey_id = '".Database::escape_string($_GET['survey_id'])."' AND survey_question.c_id = $course_id ORDER BY survey_question.sort, survey_question_option.sort ASC"; $result = Database::query($sql); @@ -1189,7 +1197,7 @@ class SurveyUtil while ($row = Database::fetch_array($result)) { // We show the options if // 1. there is no question filter and the export button has not been clicked - // 2. there is a quesiton filter but the question is selected for display + // 2. there is a question filter but the question is selected for display if (!(isset($_POST['submit_question_filter'])) || ( is_array($_POST['questions_filter']) && in_array($row['question_id'], $_POST['questions_filter'])) @@ -1870,9 +1878,9 @@ class SurveyUtil /** * Get all the answers of a question grouped by user * - * @param integer Survey ID - * @param integer Question ID - * @return Array Array containing all answers of all users, grouped by user + * @param integer $survey_id Survey ID + * @param integer $question_id Question ID + * @return array Array containing all answers of all users, grouped by user * * @author Patrick Cool , Ghent University * @version February 2007 - Updated March 2008 @@ -1911,8 +1919,14 @@ class SurveyUtil * @author Patrick Cool , Ghent University * @version February 2007 */ - public static function comparative_check($answers_x, $answers_y, $option_x, $option_y, $value_x = 0, $value_y = 0) - { + public static function comparative_check( + $answers_x, + $answers_y, + $option_x, + $option_y, + $value_x = 0, + $value_y = 0 + ) { if ($value_x == 0) { $check_x = $option_x; } else { @@ -2040,11 +2054,11 @@ class SurveyUtil * This function saves all the invitations of course users and additional users in the database * and sends the invitations by email * - * @param array Users array can be both a list of course uids AND a list of additional emailaddresses - * @param string Title of the invitation, used as the title of the mail - * @param string Text of the invitation, used as the text of the mail. - * The text has to contain a **link** string or this will automatically be added to the end - * + * @param array Users array can be both a list of course uids AND a list of additional emailaddresses + * @param string Title of the invitation, used as the title of the mail + * @param string Text of the invitation, used as the text of the mail. + * The text has to contain a **link** string or this will automatically be added to the end + * @return int * @author Patrick Cool , Ghent University * @author Julio Montoya - Adding auto-generated link support * @version January 2007 @@ -2222,8 +2236,12 @@ class SurveyUtil * $param string $invitation_code - the unique invitation code for the URL * @return void */ - public static function send_invitation_mail($invitedUser, $invitation_code, $invitation_title, $invitation_text) - { + public static function send_invitation_mail( + $invitedUser, + $invitation_code, + $invitation_title, + $invitation_text + ) { $_user = api_get_user_info(); $_course = api_get_course_info(); @@ -2419,7 +2437,7 @@ class SurveyUtil { $course_id = api_get_course_int_id(); // Database table definition - $table_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION); + $table_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION); $sql = "SELECT * FROM $table_survey_invitation WHERE @@ -2466,7 +2484,12 @@ class SurveyUtil $parameters['cidReq'] = api_get_course_id(); // Create a sortable table with survey-data - $table = new SortableTable('surveys', 'get_number_of_surveys', 'get_survey_data_drh', 2); + $table = new SortableTable( + 'surveys', + 'get_number_of_surveys', + 'get_survey_data_drh', + 2 + ); $table->set_additional_parameters($parameters); $table->set_header(0, '', false); $table->set_header(1, get_lang('SurveyName')); @@ -2502,7 +2525,12 @@ class SurveyUtil } // Create a sortable table with survey-data - $table = new SortableTable('surveys', 'get_number_of_surveys', 'get_survey_data', 2); + $table = new SortableTable( + 'surveys', + 'get_number_of_surveys', + 'get_survey_data', + 2 + ); $table->set_additional_parameters($parameters); $table->set_header(0, '', false); $table->set_header(1, get_lang('SurveyName')); @@ -2536,7 +2564,12 @@ class SurveyUtil } // Create a sortable table with survey-data - $table = new SortableTable('surveys_coach', 'get_number_of_surveys_for_coach', 'get_survey_data_for_coach', 2); + $table = new SortableTable( + 'surveys_coach', + 'get_number_of_surveys_for_coach', + 'get_survey_data_for_coach', + 2 + ); $table->set_additional_parameters($parameters); $table->set_header(0, '', false); $table->set_header(1, get_lang('SurveyName')); @@ -2693,6 +2726,9 @@ class SurveyUtil return $obj->total_number_of_items; } + /** + * @return int + */ public static function get_number_of_surveys_for_coach() { $survey_tree = new SurveyTree(); @@ -2707,7 +2743,7 @@ class SurveyUtil * @param int $column * @param string $direction * @param bool $isDrh - * @return unknown + * @return array * * @author Patrick Cool , Ghent University * @author Julio Montoya , Beeznest - Adding intvals From f889aac51ab3b3ee202d5db3a1d3423a18b601cb Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Fri, 31 Mar 2017 16:02:09 +0200 Subject: [PATCH 2/4] Fix typos --- main/survey/surveyUtil.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main/survey/surveyUtil.class.php b/main/survey/surveyUtil.class.php index b901bed0ee..f1b90a04f1 100755 --- a/main/survey/surveyUtil.class.php +++ b/main/survey/surveyUtil.class.php @@ -3280,8 +3280,8 @@ class SurveyUtil */ public static function flagSurveyAsAnswered($surveyCode, $courseId) { - $currenUserId = api_get_user_id(); - $flag = sprintf("%s-%s-%d", $courseId, $surveyCode, $currenUserId); + $currentUserId = api_get_user_id(); + $flag = sprintf("%s-%s-%d", $courseId, $surveyCode, $currentUserId); if (!isset($_SESSION['filled_surveys'])) { $_SESSION['filled_surveys'] = array(); @@ -3298,8 +3298,8 @@ class SurveyUtil */ public static function isSurveyAnsweredFlagged($surveyCode, $courseId) { - $currenUserId = api_get_user_id(); - $flagToCheck = sprintf("%s-%s-%d", $courseId, $surveyCode, $currenUserId); + $currentUserId = api_get_user_id(); + $flagToCheck = sprintf("%s-%s-%d", $courseId, $surveyCode, $currentUserId); if (!isset($_SESSION['filled_surveys'])) { return false; From bc8e013df17571bccc9ddb0baa091e39772d5445 Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Fri, 31 Mar 2017 16:03:55 +0200 Subject: [PATCH 3/4] Fix typo, add int casting, --- main/survey/surveyUtil.class.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/main/survey/surveyUtil.class.php b/main/survey/surveyUtil.class.php index f1b90a04f1..bea0ed1ef9 100755 --- a/main/survey/surveyUtil.class.php +++ b/main/survey/surveyUtil.class.php @@ -3323,27 +3323,28 @@ class SurveyUtil /** * Check if the current survey has answers * - * @param $surveyId + * @param int $surveyId * @return boolean return true if the survey has answers, false otherwise */ public static function checkIfSurveyHasAnswers($surveyId) { $tableSurveyAnswer = Database::get_course_table(TABLE_SURVEY_ANSWER); $courseId = api_get_course_int_id(); + $surveyId = (int)$surveyId; + + if (empty($courseId) || empty($surveyId)) { + return false; + } $sql = "SELECT * FROM $tableSurveyAnswer WHERE c_id = $courseId AND - survey_id='".$surveyId."' + survey_id = '".$surveyId."' ORDER BY answer_id, user ASC"; $result = Database::query($sql); $response = Database::affected_rows($result); - if ($response > 0) { - return true; - } - - return false; + return $response > 0; } } From 0eed3a34b1d3dd1b3f523516f6f6076b6f6053f0 Mon Sep 17 00:00:00 2001 From: Alex Aragon Date: Fri, 31 Mar 2017 10:19:18 -0500 Subject: [PATCH 4/4] fix css silver line --- app/Resources/public/css/themes/silver_line/default.css | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/Resources/public/css/themes/silver_line/default.css b/app/Resources/public/css/themes/silver_line/default.css index 099bed801b..744116b828 100644 --- a/app/Resources/public/css/themes/silver_line/default.css +++ b/app/Resources/public/css/themes/silver_line/default.css @@ -194,4 +194,13 @@ border-color: #444; background: none; border: 1px solid #D3D3D3; box-shadow: none; +} +.navbar-nav .open .dropdown-menu .user-header, +.navbar-nav .open .dropdown-menu .user-header a, +.navbar-nav .open .dropdown-menu .user-body a{ + color: #FFF; +} +.navbar-nav .dropdown .dropdown-toggle +{ + margin-top: 0; } \ No newline at end of file