Remove unused code

pull/3924/head
Julio Montoya 3 years ago
parent b91766a86f
commit fd84d9b483
  1. 1
      psalm.xml
  2. 49
      public/main/admin/settings.lib.php
  3. 7
      public/main/announcements/index.html
  4. 7
      public/main/auth/index.html
  5. 5
      public/main/create_course/add_course.php
  6. 148
      public/main/inc/lib/lp_item.lib.php

@ -100,7 +100,6 @@
<file name="public/main/inc/lib/internationalization.lib.php"/> <file name="public/main/inc/lib/internationalization.lib.php"/>
<file name="public/main/inc/lib/legal.lib.php"/> <file name="public/main/inc/lib/legal.lib.php"/>
<file name="public/main/inc/lib/link.lib.php"/> <file name="public/main/inc/lib/link.lib.php"/>
<file name="public/main/inc/lib/lp_item.lib.php"/>
<file name="public/main/inc/lib/MailTemplateManager.php"/> <file name="public/main/inc/lib/MailTemplateManager.php"/>
<file name="public/main/inc/lib/message.lib.php"/> <file name="public/main/inc/lib/message.lib.php"/>
<file name="public/main/inc/lib/model.lib.php"/> <file name="public/main/inc/lib/model.lib.php"/>

@ -1312,55 +1312,6 @@ function deleteTemplate($id)
echo Display::return_message(get_lang('Template deleted'), 'confirm'); echo Display::return_message(get_lang('Template deleted'), 'confirm');
} }
/**
* Returns the list of timezone identifiers used to populate the select
* This function is called through a call_user_func() in the generate_settings_form function.
*
* @return array List of timezone identifiers
*
* @author Guillaume Viguier <guillaume.viguier@beeznest.com>
*
* @since Chamilo 1.8.7
*/
function select_timezone_value()
{
return api_get_timezones();
}
/**
* Returns an array containing the list of options used to populate the gradebook_number_decimals variable
* This function is called through a call_user_func() in the generate_settings_form function.
*
* @return array List of gradebook_number_decimals options
*
* @author Guillaume Viguier <guillaume.viguier@beeznest.com>
*/
function select_gradebook_number_decimals()
{
return ['0', '1', '2'];
}
/**
* Get the options for a select element to select gradebook default grade model.
*
* @return array
*/
function select_gradebook_default_grade_model_id()
{
$grade_model = new GradeModel();
$models = $grade_model->get_all();
$options = [];
$options[-1] = get_lang('none');
if (!empty($models)) {
foreach ($models as $model) {
$options[$model['id']] = $model['name'];
}
}
return $options;
}
/** /**
* @param array $settings * @param array $settings
* @param array $settings_by_access_list * @param array $settings_by_access_list

@ -1,7 +0,0 @@
<html>
<head>
<meta http-equiv="refresh" content="0; url=announcements.php">
</head>
<body>
</body>
</html>

@ -1,7 +0,0 @@
<html>
<head>
<meta http-equiv="refresh" content="0; url=courses.php">
</head>
<body>
</body>
</html>

@ -55,11 +55,6 @@ $htmlHeadXtra[] = '<script>
}); });
</script>'; </script>';
/*$interbreadcrumb[] = [
'url' => api_get_path(WEB_PATH).'user_portal.php',
'name' => get_lang('My courses'),
];*/
// Displaying the header. // Displaying the header.
$tool_name = $course_validation_feature ? get_lang('Create a course request') : get_lang('Add a new course'); $tool_name = $course_validation_feature ? get_lang('Create a course request') : get_lang('Add a new course');

@ -1,148 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @deprecated use entities
* Class lp_item
* made to manipulate data of lp_item table.
*
* This class is still incomplete
* You can add lp_item database manipulation function here
*/
class LpItem
{
public $c_id = 0;
public $id = 0;
public $lp_id = 0;
public $item_type = '';
public $ref = '';
public $title = '';
public $description = '';
public $path = '';
public $min_score = 0;
public $max_score = 0;
public $mastery_score = 0;
public $parent_item_id = 0;
public $previous_item_id = 0;
public $next_item_id = 0;
public $display_order = 0;
public $prerequisite = '';
public $parameters = '';
public $launch_data = '';
public $max_time_allowed = '';
public $terms = '';
public $search_did = 0;
public $audio = '';
/**
* LpItem constructor.
*
* @param int $in_c_id
* @param int $in_id
*/
public function __construct($in_c_id = 0, $in_id = 0)
{
if ($in_c_id > 0 && $in_id > 0) {
$item_view_table = Database::get_course_table(TABLE_LP_ITEM);
$sql = "SELECT * FROM $item_view_table
WHERE
iid=".intval($in_id);
$res = Database::query($sql);
$data = Database::fetch_array($res);
if (Database::num_rows($res) > 0) {
//$this->c_id = $data['c_id'];
$this->id = $data['iid'];
$this->lp_id = $data['lp_id'];
$this->item_type = $data['item_type'];
$this->ref = $data['ref'];
$this->title = $data['title'];
$this->description = $data['description'];
$this->path = $data['path'];
$this->min_score = $data['min_score'];
$this->max_score = $data['max_score'];
$this->mastery_score = $data['mastery_score'];
$this->parent_item_id = $data['parent_item_id'];
$this->previous_item_id = $data['previous_item_id'];
$this->next_item_id = $data['next_item_id'];
$this->display_order = $data['display_order'];
$this->prerequisite = $data['prerequisite'];
$this->parameters = $data['parameters'];
$this->launch_data = $data['launch_data'];
$this->max_time_allowed = $data['max_time_allowed'];
$this->terms = $data['terms'];
$this->search_did = $data['search_did'];
$this->audio = $data['audio'];
}
}
}
/**
* Update in database.
*/
public function update()
{
$table = Database::get_course_table(TABLE_LP_ITEM);
if ($this->c_id > 0 && $this->id > 0) {
$sql = "UPDATE $table SET
lp_id = '".intval($this->lp_id)."' ,
item_type = '".Database::escape_string($this->item_type)."' ,
ref = '".Database::escape_string($this->ref)."' ,
title = '".Database::escape_string($this->title)."' ,
description = '".Database::escape_string($this->description)."' ,
path = '".Database::escape_string($this->path)."' ,
min_score = '".Database::escape_string($this->min_score)."' ,
max_score = '".Database::escape_string($this->max_score)."' ,
mastery_score = '".Database::escape_string($this->mastery_score)."' ,
parent_item_id = '".Database::escape_string($this->parent_item_id)."' ,
previous_item_id = '".Database::escape_string($this->previous_item_id)."' ,
next_item_id = '".Database::escape_string($this->next_item_id)."' ,
display_order = '".Database::escape_string($this->display_order)."' ,
prerequisite = '".Database::escape_string($this->prerequisite)."' ,
parameters = '".Database::escape_string($this->parameters)."' ,
launch_data = '".Database::escape_string($this->launch_data)."' ,
max_time_allowed = '".Database::escape_string($this->max_time_allowed)."' ,
terms = '".Database::escape_string($this->terms)."' ,
search_did = '".Database::escape_string($this->search_did)."' ,
audio = '".Database::escape_string($this->audio)."'
WHERE c_id=".$this->c_id." AND id=".$this->id;
Database::query($sql);
}
}
/**
* Create extra field for learning path item.
*
* @param string $variable
* @param int $fieldType
* @param string $displayText
* @param string|null $default Optional.
* @param bool $changeable Optional.
* @param bool $visibleToSelf Optional.
* @param bool $visibleToOthers Optional.
*
* @return bool|int
*/
public static function createExtraField(
$variable,
$fieldType,
$displayText,
$default = null,
$changeable = false,
$visibleToSelf = false,
$visibleToOthers = false
) {
$extraField = new ExtraField('lp_item');
$params = [
'variable' => $variable,
'field_type' => $fieldType,
'display_text' => $displayText,
'default_value' => $default,
'changeable' => $changeable,
'visible_to_self' => $visibleToSelf,
'visible_to_others' => $visibleToOthers,
];
return $extraField->save($params);
}
}
Loading…
Cancel
Save