Minor - format code

pull/3293/head
Julio Montoya 6 years ago
parent d857202234
commit 8b077e0ac1
  1. 77
      main/exercise/exercise.class.php
  2. 26
      main/inc/lib/usermanager.lib.php
  3. 4
      main/survey/create_new_survey.php
  4. 12
      main/survey/survey_question.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;
}
}

@ -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);
}
}

@ -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',

@ -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()
@ -559,8 +560,10 @@ class survey_question
* 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
*
* @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
*/

Loading…
Cancel
Save