diff --git a/main/document/document.php b/main/document/document.php index f9f23061d4..f1f91580da 100755 --- a/main/document/document.php +++ b/main/document/document.php @@ -1471,7 +1471,7 @@ if ($isAllowedToEdit || 'post', api_get_self()."?add_as_template=$document_id_for_template" ); - $frmAddTemplate ->addHeader(get_lang('AddAsTemplate')); + $frmAddTemplate->addHeader(get_lang('AddAsTemplate')); $frmAddTemplate->addText('template_title', get_lang('TemplateName'), true); $frmAddTemplate->addFile('template_image', get_lang('TemplateImage'), ['id' => 'template_image']); $frmAddTemplate->addButtonSave(get_lang('CreateTemplate'), 'create_template'); diff --git a/main/exercise/exercise.class.php b/main/exercise/exercise.class.php index 88733086e6..66ee3001c5 100755 --- a/main/exercise/exercise.class.php +++ b/main/exercise/exercise.class.php @@ -9937,6 +9937,44 @@ class Exercise return count($answers); } + public static function allowAction($action) + { + if (api_is_platform_admin()) { + return true; + } + + $limitTeacherAccess = api_get_configuration_value('limit_exercise_teacher_access'); + $disableClean = api_get_configuration_value('disable_clean_exercise_results_for_teachers'); + + switch ($action) { + case 'delete': + if (api_is_allowed_to_edit(null, true)) { + if ($limitTeacherAccess) { + return false; + } + + return true; + } + break; + case 'clean_results': + if (api_is_allowed_to_edit(null, true)) { + if ($limitTeacherAccess) { + return false; + } + + if ($disableClean) { + return false; + } + + return true; + } + + break; + } + + return false; + } + /** * Get number of questions in exercise by user attempt. * @@ -10449,43 +10487,4 @@ class Exercise return $group; } - - public static function allowAction($action) - { - if (api_is_platform_admin()) { - return true; - } - - $limitTeacherAccess = api_get_configuration_value('limit_exercise_teacher_access'); - $disableClean = api_get_configuration_value('disable_clean_exercise_results_for_teachers'); - - switch ($action) { - case 'delete': - if (api_is_allowed_to_edit(null, true)) { - if ($limitTeacherAccess) { - return false; - } - - return true; - } - break; - case 'clean_results': - if (api_is_allowed_to_edit(null, true)) { - if ($limitTeacherAccess) { - return false; - } - - if ($disableClean) { - return false; - } - - return true; - } - - break; - } - - - return false; - } } diff --git a/main/inc/lib/usermanager.lib.php b/main/inc/lib/usermanager.lib.php index 2ca958880e..a7f2b7f657 100755 --- a/main/inc/lib/usermanager.lib.php +++ b/main/inc/lib/usermanager.lib.php @@ -7002,6 +7002,19 @@ SQL; return Database::num_rows($result) > 0; } + /** + * @param int $userInfo + * + * @throws Exception + */ + public static function deleteUserFiles($userId) + { + $path = self::getUserPathById($userId, 'system'); + + $fs = new Filesystem(); + $fs->remove($path); + } + /** * @return EncoderFactory */ @@ -7095,17 +7108,4 @@ SQL; return $url; } - - /** - * @param int $userInfo - * - * @throws Exception - */ - public static function deleteUserFiles($userId) - { - $path = self::getUserPathById($userId, 'system'); - - $fs = new Filesystem(); - $fs->remove($path); - } } diff --git a/main/survey/create_new_survey.php b/main/survey/create_new_survey.php index 46f3a09eda..bcac0d3137 100755 --- a/main/survey/create_new_survey.php +++ b/main/survey/create_new_survey.php @@ -267,7 +267,7 @@ if (Gradebook::is_active()) { $surveytypes[0] = get_lang('Normal'); $surveytypes[1] = get_lang('Conditional'); -if ($action == 'add') { +if ($action === 'add') { $form->addElement('hidden', 'survey_type', 0); $survey_tree = new SurveyTree(); $list_surveys = $survey_tree->createList($survey_tree->surveylist); @@ -281,7 +281,7 @@ $form->addElement('checkbox', 'shuffle', null, get_lang('ActivateShuffle')); $input_name_list = null; -if ($action == 'edit' && !empty($survey_id)) { +if ($action === 'edit' && !empty($survey_id)) { if ($survey_data['anonymous'] == 0) { $form->addElement( 'checkbox', diff --git a/main/survey/survey_question.php b/main/survey/survey_question.php index 51365e4e32..20201cb94d 100644 --- a/main/survey/survey_question.php +++ b/main/survey/survey_question.php @@ -538,6 +538,7 @@ class survey_question * Get the JS for questions that can depend on a previous question * (and that hides those questions until something changes in the previous * question). + * * @return string HTML code */ public static function getJs() @@ -555,12 +556,14 @@ class survey_question } /** - * Get the question parents recursively, if any. This function depends on - * the existence of a parent_id field, which depends on the + * Get the question parents recursively, if any. This function depends on + * the existence of a parent_id field, which depends on the * 'survey_question_dependency' setting and its corresponding SQL * requirements. - * @param int $questionId The c_survey_question.question.id - * @param array $list An array of parents to be extended by this method + * + * @param int $questionId The c_survey_question.question.id + * @param array $list An array of parents to be extended by this method + * * @return array The completed array of parents */ public static function getParents($questionId, $list = []) @@ -587,7 +590,9 @@ class survey_question /** * Creates the JS code for the given parent question so that it shows * the children questions when a specific answer of the parent is selected. + * * @param array $question An array with the question details + * * @return string JS code to add to the HTML survey question page */ public static function getQuestionJs($question) @@ -628,8 +633,10 @@ class survey_question } /** - * Returns the (children) questions that have the given question as parent + * Returns the (children) questions that have the given question as parent. + * * @param array $question An array describing the parent question + * * @return array The questions that have the given question as parent */ public static function getDependency($question) @@ -651,7 +658,8 @@ class survey_question } /** - * This method is not implemented at this level (returns null) + * This method is not implemented at this level (returns null). + * * @param array $questionData * @param array $answers */