Minor - format code, remove unused code "return_datetime_from_array"

pull/2458/head
jmontoyaa 8 years ago
parent 5b88f00797
commit 0d24dda390
  1. 2
      main/exercise/MatchingDraggable.php
  2. 6
      main/gradebook/lib/GradebookUtils.php
  3. 65
      main/gradebook/lib/fe/scoredisplayform.class.php
  4. 11
      main/gradebook/lib/fe/userform.class.php
  5. 12
      main/gradebook/lib/fe/usertable.class.php
  6. 3
      main/gradebook/lib/gradebook_data_generator.class.php
  7. 157
      main/inc/lib/text.lib.php
  8. 18
      main/inc/lib/thematic.lib.php

@ -35,7 +35,7 @@ class MatchingDraggable extends Question
$answer = new Answer($this->id);
$answer->read();
if (count($answer->nbrAnswers) > 0) {
if (!empty($answer->nbrAnswers) && count($answer->nbrAnswers) > 0) {
for ($i = 1; $i <= $answer->nbrAnswers; $i++) {
$correct = $answer->isCorrect($i);
if (empty($correct)) {

@ -245,13 +245,15 @@ class GradebookUtils
$modify_icons .= '&nbsp;<a onclick="javascript:if (!confirm(\''.addslashes(get_lang('ConfirmToUnlockElement')).'\')) return false;" href="'.api_get_self().'?'.api_get_cidreq().'&category_id='.$cat->get_id().'&action=unlock">'.
Display::return_icon('lock.png', get_lang('UnLockEvaluation'), '', ICON_SIZE_SMALL).'</a>';
} else {
$modify_icons .= '&nbsp;<a href="#">'.Display::return_icon('lock_na.png', get_lang('GradebookLockedAlert'), '', ICON_SIZE_SMALL).'</a>';
$modify_icons .= '&nbsp;<a href="#">'.
Display::return_icon('lock_na.png', get_lang('GradebookLockedAlert'), '', ICON_SIZE_SMALL).'</a>';
}
$modify_icons .= '&nbsp;<a href="gradebook_flatview.php?export_pdf=category&selectcat='.$cat->get_id().'" >'.Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL).'</a>';
} else {
$modify_icons .= '&nbsp;<a onclick="javascript:if (!confirm(\''.addslashes(get_lang('ConfirmToLockElement')).'\')) return false;" href="'.api_get_self().'?'.api_get_cidreq().'&category_id='.$cat->get_id().'&action=lock">'.
Display::return_icon('unlock.png', get_lang('LockEvaluation'), '', ICON_SIZE_SMALL).'</a>';
$modify_icons .= '&nbsp;<a href="#" >'.Display::return_icon('pdf_na.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL).'</a>';
$modify_icons .= '&nbsp;<a href="#" >'.
Display::return_icon('pdf_na.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL).'</a>';
}
}

@ -21,28 +21,29 @@ class ScoreDisplayForm extends FormValidator
$customdisplays = $displayscore->get_custom_score_display_settings();
$nr_items = (count($customdisplays) != '0') ? count($customdisplays) : '1';
$this->setDefaults([
'scorecolpercent' => $displayscore->get_color_split_value()
]);
$this->setDefaults(
[
'scorecolpercent' => $displayscore->get_color_split_value(),
]
);
$this->addElement('hidden', 'maxvalue', '100');
$this->addElement('hidden', 'minvalue', '0');
$counter = 1;
//setting the default values
// Setting the default values
if (is_array($customdisplays)) {
foreach ($customdisplays as $customdisplay) {
$this->setDefaults([
'endscore['.$counter.']' => $customdisplay['score'],
'displaytext['.$counter.']' => $customdisplay['display']
]);
$this->setDefaults(
[
'endscore['.$counter.']' => $customdisplay['score'],
'displaytext['.$counter.']' => $customdisplay['display'],
]
);
$counter++;
}
}
$scorecol = [];
//settings for the colored score
// Settings for the colored score
$this->addElement('header', get_lang('ScoreEdit'));
if ($displayscore->is_coloring_enabled()) {
@ -67,8 +68,7 @@ class ScoreDisplayForm extends FormValidator
$this->addRule(['scorecolpercent', 'minvalue'], get_lang('UnderMin'), 'compare', '>');
}
//Settings for the scoring system
// Settings for the scoring system
if ($displayscore->is_custom()) {
$this->addElement('html', '<br /><b>'.get_lang('ScoringSystem').'</b>');
$this->addElement('static', null, null, get_lang('ScoreInfo'));
@ -85,30 +85,23 @@ class ScoreDisplayForm extends FormValidator
for ($counter = 1; $counter <= 20; $counter++) {
$renderer = & $this->defaultRenderer();
$elementTemplateTwoLabel =
'<div id='.$counter.' style="display: '.(($counter <= $nr_items) ? 'inline' : 'none').';">
<!-- BEGIN required --><span class="form_required">*</span> <!-- END required -->
'<div id='.$counter.' style="display: '.(($counter <= $nr_items) ? 'inline' : 'none').';">
<!-- BEGIN required --><span class="form_required">*</span> <!-- END required -->
<label class="control-label">{label}</label>
<div class="form-group">
<label class="col-sm-2 control-label">
</label>
</label>
<div class="col-sm-1">
<!-- BEGIN error --><span class="form_error">{error}</span><br />
<!-- END error -->&nbsp<b>'.get_lang('And').'</b>
</div>
<div class="col-sm-2">
{element}
</div>
</div>
<div class="col-sm-1">
=
</div>
';
</div>';
$elementTemplateTwoLabel2 = '
<div class="col-sm-2">
@ -125,13 +118,17 @@ class ScoreDisplayForm extends FormValidator
</div>
</div>';
$scorebetw = [];
$this->addElement('text', 'endscore['.$counter.']', null, [
'size' => 5,
'maxlength' => 5,
'id' => 'txta-'.$counter,
'input-size' => 2
]);
$this->addElement(
'text',
'endscore['.$counter.']',
null,
[
'size' => 5,
'maxlength' => 5,
'id' => 'txta-'.$counter,
'input-size' => 2,
]
);
$this->addElement(
'text',

@ -17,8 +17,8 @@ class UserForm extends FormValidator
* @param int form_type 1 = user_info
* @param user array
* @param string form name
* @param method
* @param action
* @param string $method
* @param string $action
*/
public function __construct($form_type, $user, $form_name, $method = 'post', $action = null)
{
@ -61,7 +61,12 @@ class UserForm extends FormValidator
$this->addElement('static', 'fname', get_lang('FirstName'), $this->user_info['firstname']);
}
$this->addElement('static', 'uname', get_lang('UserName'), $this->user_info['username']);
$this->addElement('static', 'email', get_lang('Email'), '<a href="mailto:'.$this->user_info['email'].'">'.$this->user_info['email'].'</a>');
$this->addElement(
'static',
'email',
get_lang('Email'),
'<a href="mailto:'.$this->user_info['email'].'">'.$this->user_info['email'].'</a>'
);
$this->addElement('static', 'ofcode', get_lang('OfficialCode'), $this->user_info['official_code']);
$this->addElement('static', 'phone', get_lang('Phone'), $this->user_info['phone']);
$this->addButtonSave(get_lang('Back'), 'submit');

@ -124,15 +124,15 @@ class UserTable extends SortableTable
// evaluation
case 'E':
return '&nbsp;'
. '<a href="gradebook_view_result.php?selecteval='.$item->get_id().'&'.api_get_cidreq().'">'
. $item->get_name()
. '</a>';
.'<a href="gradebook_view_result.php?selecteval='.$item->get_id().'&'.api_get_cidreq().'">'
.$item->get_name()
.'</a>';
// link
case 'L':
return '&nbsp;<a href="'.$item->get_link().'">'
. $item->get_name()
. '</a>'
. '&nbsp;['.$item->get_type_name().']';
.$item->get_name()
.'</a>'
.'&nbsp;['.$item->get_type_name().']';
}
}
}

@ -113,7 +113,8 @@ class GradebookDataGenerator
$row = [];
$row[] = $item;
$row[] = $item->get_name();
// display the 2 first line of description, and all description on mouseover (https://support.chamilo.org/issues/6588)
// display the 2 first line of description and all description
// on mouseover (https://support.chamilo.org/issues/6588)
$row[] = '<span title="'.api_remove_tags_with_space($item->get_description()).'">'.
api_get_short_text_from_html($item->get_description(), 160).'</span>';
$totalWeight += $item->get_weight();

@ -68,7 +68,12 @@ function api_set_encoding_html(&$string, $encoding)
}
} else {
$count = 1;
$string = str_ireplace('</head>', '<meta http-equiv="Content-Type" content="text/html; charset='.$encoding.'"/></head>', $string, $count);
$string = str_ireplace(
'</head>',
'<meta http-equiv="Content-Type" content="text/html; charset='.$encoding.'"/></head>',
$string,
$count
);
}
$string = api_convert_encoding($string, $encoding, $old_encoding);
}
@ -76,9 +81,10 @@ function api_set_encoding_html(&$string, $encoding)
/**
* Returns the title of a html document.
* @param string $string The contents of the input document.
* @param string $output_encoding The encoding of the retrieved title. If the value is not set, the system encoding is assumend.
* @param string $input_encoding The encoding of the input document. If the value is not set, it is detected.
* @return string The retrieved title, html-entities and extra-whitespace between the words are cleaned.
* @param string $output_encoding The encoding of the retrieved title.
* If the value is not set, the system encoding is assumed.
* @param string $input_encoding The encoding of the input document. If the value is not set, it is detected.
* @return string The retrieved title, html-entities and extra-whitespace between the words are cleaned.
*/
function api_get_title_html(&$string, $output_encoding = null, $input_encoding = null)
{
@ -89,7 +95,17 @@ function api_get_title_html(&$string, $output_encoding = null, $input_encoding =
if (empty($input_encoding)) {
$input_encoding = api_detect_encoding_html($string);
}
return trim(@preg_replace('/\s+/', ' ', api_html_entity_decode(api_convert_encoding($matches[1], $output_encoding, $input_encoding), ENT_QUOTES, $output_encoding)));
return trim(
@preg_replace(
'/\s+/',
' ',
api_html_entity_decode(
api_convert_encoding($matches[1], $output_encoding, $input_encoding),
ENT_QUOTES,
$output_encoding
)
)
);
}
return '';
}
@ -105,7 +121,8 @@ define('_PCRE_XML_ENCODING', '/<\?xml.*encoding=[\'"](.*?)[\'"].*\?>/m');
/**
* Detects encoding of xml-formatted text.
* @param string $string The input xml-formatted text.
* @param string $default_encoding This is the default encoding to be returned if there is no way the xml-text's encoding to be detected. If it not spesified, the system encoding is assumed then.
* @param string $default_encoding This is the default encoding to be returned
* if there is no way the xml-text's encoding to be detected. If it not spesified, the system encoding is assumed then.
* @return string Returns the detected encoding.
* @todo The second parameter is to be eliminated. See api_detect_encoding_html().
*/
@ -125,10 +142,12 @@ function api_detect_encoding_xml($string, $default_encoding = null)
/**
* Converts character encoding of a xml-formatted text. If inside the text the encoding is declared, it is modified accordingly.
* Converts character encoding of a xml-formatted text.
* If inside the text the encoding is declared, it is modified accordingly.
* @param string $string The text being converted.
* @param string $to_encoding The encoding that text is being converted to.
* @param string $from_encoding (optional) The encoding that text is being converted from. If it is omited, it is tried to be detected then.
* @param string $from_encoding (optional) The encoding that text is being converted from.
* If it is omited, it is tried to be detected then.
* @return string Returns the converted xml-text.
*/
function api_convert_encoding_xml($string, $to_encoding, $from_encoding = null)
@ -137,9 +156,11 @@ function api_convert_encoding_xml($string, $to_encoding, $from_encoding = null)
}
/**
* Converts character encoding of a xml-formatted text into UTF-8. If inside the text the encoding is declared, it is set to UTF-8.
* Converts character encoding of a xml-formatted text into UTF-8.
* If inside the text the encoding is declared, it is set to UTF-8.
* @param string $string The text being converted.
* @param string $from_encoding (optional) The encoding that text is being converted from. If it is omited, it is tried to be detected then.
* @param string $from_encoding (optional) The encoding that text is being converted from.
* If it is omited, it is tried to be detected then.
* @return string Returns the converted xml-text.
*/
function api_utf8_encode_xml($string, $from_encoding = null)
@ -148,9 +169,11 @@ function api_utf8_encode_xml($string, $from_encoding = null)
}
/**
* Converts character encoding of a xml-formatted text from UTF-8 into a specified encoding. If inside the text the encoding is declared, it is modified accordingly.
* Converts character encoding of a xml-formatted text from UTF-8 into a specified encoding.
* If inside the text the encoding is declared, it is modified accordingly.
* @param string $string The text being converted.
* @param string $to_encoding (optional) The encoding that text is being converted to. If it is omited, the platform character set is assumed.
* @param string $to_encoding (optional) The encoding that text is being converted to.
* If it is omitted, the platform character set is assumed.
* @return string Returns the converted xml-text.
*/
function api_utf8_decode_xml($string, $to_encoding = 'UTF-8')
@ -159,10 +182,12 @@ function api_utf8_decode_xml($string, $to_encoding = 'UTF-8')
}
/**
* Converts character encoding of a xml-formatted text. If inside the text the encoding is declared, it is modified accordingly.
* Converts character encoding of a xml-formatted text.
* If inside the text the encoding is declared, it is modified accordingly.
* @param string $string The text being converted.
* @param string $to_encoding The encoding that text is being converted to.
* @param string $from_encoding (optional) The encoding that text is being converted from. If the value is empty, it is tried to be detected then.
* @param string $from_encoding (optional) The encoding that text is being converted from.
* If the value is empty, it is tried to be detected then.
* @return string Returns the converted xml-text.
*/
function _api_convert_encoding_xml(&$string, $to_encoding, $from_encoding)
@ -172,11 +197,16 @@ function _api_convert_encoding_xml(&$string, $to_encoding, $from_encoding)
}
$to_encoding = api_refine_encoding_id($to_encoding);
if (!preg_match('/<\?xml.*\?>/m', $string, $matches)) {
return api_convert_encoding('<?xml version="1.0" encoding="'.$to_encoding.'"?>'."\n".$string, $to_encoding, $from_encoding);
return api_convert_encoding(
'<?xml version="1.0" encoding="'.$to_encoding.'"?>'."\n".$string,
$to_encoding,
$from_encoding
);
}
if (!preg_match(_PCRE_XML_ENCODING, $string)) {
if (strpos($matches[0], 'standalone') !== false) {
// The encoding option should precede the standalone option, othewise DOMDocument fails to load the document.
// The encoding option should precede the standalone option,
// othewise DOMDocument fails to load the document.
$replace = str_replace('standalone', ' encoding="'.$to_encoding.'" standalone', $matches[0]);
} else {
$replace = str_replace('?>', ' encoding="'.$to_encoding.'"?>', $matches[0]);
@ -265,7 +295,8 @@ function api_camel_case_to_underscore($string)
* Converts a string with underscores into camel case.
* Works correctly with ASCII strings only, implementation for human-language strings is not necessary.
* @param string $string The input string (ASCII)
* @param bool $capitalise_first_char (optional) If true (default), the function capitalises the first char in the result string.
* @param bool $capitalise_first_char (optional)
* If true (default), the function capitalises the first char in the result string.
* @return string The converted result string
*/
function api_underscore_to_camel_case($string, $capitalise_first_char = true)
@ -287,9 +318,11 @@ function _api_camelize($match)
*
* @author Brouckaert Olivier
* @param string $text The text to truncate.
* @param integer $length The approximate desired length. The length of the suffix below is to be added to have the total length of the result string.
* @param string $suffix A suffix to be added as a replacement.
* @param string $encoding (optional) The encoding to be used. If it is omitted, the platform character set will be used by default.
* @param integer $length The approximate desired length. The length of the suffix below is to be added to
* have the total length of the result string.
* @param string $suffix A suffix to be added as a replacement.
* @param string $encoding (optional) The encoding to be used. If it is omitted,
* the platform character set will be used by default.
* @param boolean $middle If this parameter is true, truncation is done in the middle of the string.
* @return string Truncated string, decorated with the given suffix (replacement).
*/
@ -303,7 +336,23 @@ function api_trunc_str($text, $length = 30, $suffix = '...', $middle = false, $e
return $text;
}
if ($middle) {
return rtrim(api_substr($text, 0, round($length / 2), $encoding)).$suffix.ltrim(api_substr($text, - round($length / 2), $text_length, $encoding));
return rtrim(
api_substr(
$text,
0,
round($length / 2),
$encoding
)
).
$suffix.
ltrim(
api_substr(
$text,
-round($length / 2),
$text_length,
$encoding
)
);
}
return rtrim(api_substr($text, 0, $length, $encoding)).$suffix;
}
@ -364,7 +413,8 @@ function _make_url_clickable_cb($matches)
$url = $matches[2];
if (')' == $matches[3] && strpos($url, '(')) {
// If the trailing character is a closing parethesis, and the URL has an opening parenthesis in it, add the closing parenthesis to the URL.
// If the trailing character is a closing parethesis, and the URL has an opening
// parenthesis in it, add the closing parenthesis to the URL.
// Then we can let the parenthesis balancer do its thing below.
$url .= $matches[3];
$suffix = '';
@ -399,7 +449,8 @@ function _make_url_clickable_cb($matches)
*
* @param string $url The URL to be cleaned.
* @param array $protocols Optional. An array of acceptable protocols.
* Defaults to 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn' if not set.
* Defaults to 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher',
* 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn' if not set.
* @param string $_context Private. Use esc_url_raw() for database usage.
* @return string The cleaned $url after the 'clean_url' filter is applied.
*/
@ -464,7 +515,8 @@ function esc_url($url, $protocols = null, $_context = 'display')
* @since wordpress 2.8.1
* @access private
*
* @param string|array $search The value being searched for, otherwise known as the needle. An array may be used to designate multiple needles.
* @param string|array $search The value being searched for, otherwise known as the needle.
* An array may be used to designate multiple needles.
* @param string $subject The string being searched and replaced on, otherwise known as the haystack.
* @return string The string with the replaced svalues.
*/
@ -542,7 +594,8 @@ function _make_email_clickable_cb($matches)
function make_clickable($text)
{
$r = '';
$textarr = preg_split('/(<[^<>]+>)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE); // split out HTML tags
// split out HTML tags
$textarr = preg_split('/(<[^<>]+>)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
$nested_code_pre = 0; // Keep track of how many levels link is nested inside <pre> or <code>
foreach ($textarr as $piece) {
if (preg_match('|^<code[\s>]|i', $piece) || preg_match('|^<pre[\s>]|i', $piece)) {
@ -551,7 +604,10 @@ function make_clickable($text)
$nested_code_pre--;
}
if ($nested_code_pre || empty($piece) || ($piece[0] === '<' && !preg_match('|^<\s*[\w]{1,20}+://|', $piece))) {
if ($nested_code_pre ||
empty($piece) ||
($piece[0] === '<' && !preg_match('|^<\s*[\w]{1,20}+://|', $piece))
) {
$r .= $piece;
continue;
}
@ -559,7 +615,8 @@ function make_clickable($text)
// Long strings might contain expensive edge cases ...
if (10000 < strlen($piece)) {
// ... break it up
foreach (_split_str_by_whitespace($piece, 2100) as $chunk) { // 2100: Extra room for scheme and leading and trailing paretheses
foreach (_split_str_by_whitespace($piece, 2100) as $chunk) {
// 2100: Extra room for scheme and leading and trailing paretheses
if (2101 < strlen($chunk)) {
$r .= $chunk; // Too big, no whitespace: bail.
} else {
@ -585,8 +642,16 @@ function make_clickable($text)
// Tell PCRE to spend more time optimizing since, when used on a page load, it will probably be used several times.
$ret = preg_replace_callback($url_clickable, '_make_url_clickable_cb', $ret);
$ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is', '_make_web_ftp_clickable_cb', $ret);
$ret = preg_replace_callback('#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i', '_make_email_clickable_cb', $ret);
$ret = preg_replace_callback(
'#([\s>])((www|ftp)\.[\w\\x80-\\xff\#$%&~/.\-;:=,?@\[\]+]+)#is',
'_make_web_ftp_clickable_cb',
$ret
);
$ret = preg_replace_callback(
'#([\s>])([.0-9a-z_+-]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})#i',
'_make_email_clickable_cb',
$ret
);
$ret = substr($ret, 1, -1); // Remove our whitespace padding.
$r .= $ret;
@ -606,7 +671,8 @@ function make_clickable($text)
*
* Joining the returned chunks with empty delimiters reconstructs the input string losslessly.
*
* Input string must have no null characters (or eventual transformations on output chunks must not care about null characters)
* Input string must have no null characters (or eventual transformations on output chunks
* must not care about null characters)
*
* <code>
* _split_str_by_whitespace( "1234 67890 1234 67890a cd 1234 890 123456789 1234567890a 45678 1 3 5 7 90 ", 10 ) ==
@ -752,7 +818,7 @@ function get_week_from_day($date)
/**
* This function splits the string into words and then joins them back together again one by one.
* Example: "Test example of a long string"
* substrwords(5) = Test ... *
* substrwords(5) = Test ... *
* @param string
* @param int the max number of character
* @param string how the string will be end
@ -820,35 +886,6 @@ function format_file_size($file_size)
return $file_size;
}
function return_datetime_from_array($array)
{
$year = '0000';
$month = $day = $hours = $minutes = $seconds = '00';
if (isset($array['Y']) && (isset($array['F']) || isset($array['M'])) && isset($array['d']) && isset($array['H']) && isset($array['i'])) {
$year = $array['Y'];
$month = isset($array['F']) ? $array['F'] : $array['M'];
if (intval($month) < 10) {
$month = '0'.$month;
}
$day = $array['d'];
if (intval($day) < 10) {
$day = '0'.$day;
}
$hours = $array['H'];
if (intval($hours) < 10) {
$hours = '0'.$hours;
}
$minutes = $array['i'];
if (intval($minutes) < 10) {
$minutes = '0'.$minutes;
}
}
if (checkdate($month, $day, $year)) {
$datetime = $year.'-'.$month.'-'.$day.' '.$hours.':'.$minutes.':'.$seconds;
}
return $datetime;
}
/**
* Converts an string CLEANYO[admin][amann,acostea]
* into an array:

@ -486,6 +486,7 @@ class Thematic
global $thematic_id;
$table = Database::get_course_table(TABLE_THEMATIC_ADVANCE);
$course_id = api_get_course_int_id();
$thematic_id = (int) $thematic_id;
$sql = "SELECT COUNT(id) AS total_number_of_items
FROM $table
@ -517,6 +518,7 @@ class Thematic
}
$data = [];
$course_id = api_get_course_int_id();
$thematic_id = (int) $thematic_id;
if (api_is_allowed_to_edit(null, true)) {
$sql = "SELECT id AS col0, start_date AS col1, duration AS col2, content AS col3
FROM $table
@ -542,8 +544,10 @@ class Thematic
$thematic_advance[1] = api_get_local_time($thematic_advance[1]);
$thematic_advance[1] = api_format_date($thematic_advance[1], DATE_TIME_FORMAT_LONG);
$actions = '';
$actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_edit&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('edit.png', get_lang('Edit'), '', 22).'</a>';
$actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_advance_delete&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('delete.png', get_lang('Delete'), '', 22).'</a></center>';
$actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_edit&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.
Display::return_icon('edit.png', get_lang('Edit'), '', 22).'</a>';
$actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_advance_delete&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.
Display::return_icon('delete.png', get_lang('Delete'), '', 22).'</a></center>';
$data[] = [$i, $thematic_advance[1], $thematic_advance[2], $thematic_advance[3], $actions];
$i++;
}
@ -565,7 +569,7 @@ class Thematic
// set current course
$table = Database::get_course_table(TABLE_THEMATIC_ADVANCE);
$thematic_id = intval($thematic_id);
$thematic_id = (int) $thematic_id;
$data = [];
$sql = "SELECT * FROM $table
WHERE c_id = $course_id AND thematic_id = $thematic_id ";
@ -610,8 +614,9 @@ class Thematic
}
}
// DATE_TIME_FORMAT_LONG
$thematic_advance_item = '<div><strong>'.api_convert_and_format_date($thematic_advance['start_date'], DATE_TIME_FORMAT_LONG).$session_star.'</strong></div>';
// $thematic_advance_item .= '<div>'.get_lang('DurationInHours').' : '.$thematic_advance['duration'].'</div>';
$thematic_advance_item = '<div><strong>'.
api_convert_and_format_date($thematic_advance['start_date'], DATE_TIME_FORMAT_LONG).
$session_star.'</strong></div>';
$thematic_advance_item .= '<div>'.$thematic_advance['duration'].' '.get_lang('HourShort').'</div>';
$thematic_advance_item .= '<div>'.Security::remove_XSS($thematic_advance['content'], STUDENT).'</div>';
$return_array[$thematic_id][$thematic_advance['id']] = $thematic_advance_item;
@ -810,8 +815,7 @@ class Thematic
/**
* delete thematic advance
* @param int Thematic advance id
* @param integer $id
* @param int $id Thematic advance id
* @return int Affected rows
*/
public function thematic_advance_destroy($id)

Loading…
Cancel
Save