Minor - format code.

pull/2487/head
jmontoyaa 8 years ago
parent 95fe3edd39
commit 7652716cca
  1. 13
      custompages/language.inc.php
  2. 4
      main/admin/sub_language_ajax.inc.php
  3. 3
      main/inc/ajax/lp.ajax.php
  4. 1
      main/inc/lib/array.lib.php
  5. 3
      main/webservices/cm_webservice_inbox.php
  6. 62
      main/wiki/diff.inc.php
  7. 50
      main/wiki/wiki.inc.php
  8. 18
      main/work/work.lib.php

@ -2,7 +2,8 @@
/* For licensing terms, see /license.txt */
/**
* CustomPages : Browser language detection
* Include this file in your custom page if you want to set the language variable of the Chamilo session to the best pick according to the visitor's browser's options.
* Include this file in your custom page if you want to set the language variable of the Chamilo session
* to the best pick according to the visitor's browser's options.
* 2011, Jean-Karim Bockstael, CBlue <jeankarim@cblue.be>
* This requires the Chamilo system to be initialized
* (note that it's easier to do the following include in the parent page)
@ -12,12 +13,13 @@
* Returns the best match between available languages and visitor preferences
* @return string the best match as 2-chars code, null when none match
*/
function get_preferred_language($available_langs) {
function get_preferred_language($available_langs)
{
// Parsing the Accept-languages HTTP header
$langs = array();
foreach (explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $httplang) {
$rawlang = explode(';q=', $httplang);
if (strpos($rawlang[0], '-') !== FALSE) {
if (strpos($rawlang[0], '-') !== false) {
// We ignore the locale part, as in en-GB vs en-US
$rawlang[0] = substr($rawlang[0], 0, strpos($rawlang[0], '-'));
}
@ -35,12 +37,15 @@ function get_preferred_language($available_langs) {
}
}
}
// No match
return null;
}
/**
* Get a language variable in a specific language
*/
function custompages_get_lang($variable) {
function custompages_get_lang($variable)
{
return get_lang($variable, null, $_SESSION['user_language_choice']);
}

@ -15,9 +15,7 @@ api_protect_admin_script();
$new_language = Security::remove_XSS($_REQUEST['new_language']);
$language_variable = Security::remove_XSS($_REQUEST['variable_language']);
$file_id = intval($_REQUEST['file_id']);
/**
* Code
*/
if (isset($new_language) && isset($language_variable) && isset($file_id)) {
$file_language = $language_files_to_load[$file_id].'.inc.php';
$id_language = intval($_REQUEST['id']);

@ -296,7 +296,6 @@ switch ($action) {
}
exit;
/*
* Classes to create a special data structure to manipulate LP Items
* used only in this file
@ -351,7 +350,6 @@ class LP_item_order_list
}
}
}
}
class LP_item_order_item
@ -367,5 +365,4 @@ class LP_item_order_item
$this->id = $in_id;
$this->parent_item_id = $in_parent_id;
}
}

@ -7,7 +7,6 @@
* @package chamilo.library
*/
/**
* Removes duplicate values from a dimensional array
*

@ -207,7 +207,8 @@ class WSCMInbox extends WSCM
protected function set_message_as_read($user_id, $message_id)
{
$table_message = Database::get_main_table(TABLE_MESSAGE);
$query = "UPDATE $table_message SET msg_status = '".MESSAGE_STATUS_NEW."' WHERE user_receiver_id=".$user_id." AND id='".$message_id."';";
$query = "UPDATE $table_message SET msg_status = '".MESSAGE_STATUS_NEW."'
WHERE user_receiver_id=".$user_id." AND id='".$message_id."';";
Database::query($query);
}
}

@ -15,9 +15,7 @@
*
* @package Wiki
*/
/**
* Code
*/
define("DIFF_EQUAL", "=");
define("DIFF_ADDED", "+");
define("DIFF_DELETED", "-");
@ -72,25 +70,18 @@ function diff(
if (isset($deleted[$i]) && isset($added[$i])) {
$output .= $format_line_function($i, DIFF_DELETED, $deleted[$i]);
$output .= $format_line_function($i, DIFF_ADDED, $added[$i]);
} // line deleted
elseif (isset ($deleted[$i]) && !isset ($added[$i])) {
} elseif (isset($deleted[$i]) && !isset($added[$i])) {
// line deleted
$output .= $format_line_function($i, DIFF_DELETED, $deleted[$i]);
} // line added
elseif (isset ($added[$i]) && !isset ($deleted[$i])) {
} elseif (isset($added[$i]) && !isset($deleted[$i])) {
// line added
$output .= $format_line_function($i, DIFF_ADDED, $added[$i]);
} // line moved
elseif (isset ($moved[$i])) {
} elseif (isset($moved[$i])) {
// line moved
$output .= $format_line_function($i, DIFF_MOVED, $newArr[$i]);
} // line unchanged
elseif ($show_equals) {
} elseif ($show_equals) {
// line unchanged
$output .= $format_line_function($i, DIFF_EQUAL, $newArr[$i]);
} else {
// skip
}
}
@ -168,20 +159,37 @@ function format_table_line($line, $type, $value, $skip_empty = false)
switch ($type) {
case DIFF_EQUAL:
//return '<tr><td>' . $line. '&nbsp;:&nbsp;' . '&nbsp;=</td><td><span class="diffEqual" >' . $value . '</span></td></tr>' . "\n"; //juan carlos comentado
return '<tr><td></td><td bgcolor="#FFFFFF">'.$value.'</td></tr>'."\n"; //juan carlos muestra solo color (no tambi<EFBFBD>n la l<EFBFBD>nea). Adem<EFBFBD>s EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que est<EFBFBD> definido en la hoja de estilos como background-color, aceptando s<EFBFBD>lo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, adem<EFBFBD>s los cambios de otros objetos que no sean texto no se indican por ej. a<EFBFBD>adir una imagen, por esta raz<EFBFBD>n doy el color de fondo al td directamente.
return '<tr><td></td><td bgcolor="#FFFFFF">'.$value.'</td></tr>'."\n";
//juan carlos muestra solo color (no tambi<EFBFBD>n la l<EFBFBD>nea).
// Adem<EFBFBD>s EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que
// est<EFBFBD> definido en la hoja de estilos como background-color, aceptando s<EFBFBD>lo la propiedad color
// pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, adem<EFBFBD>s
// los cambios de otros objetos que no sean texto no se indican por ej. a<EFBFBD>adir una imagen,
// por esta raz<EFBFBD>n doy el color de fondo al td directamente.
break;
case DIFF_MOVED:
// return '<tr><td>' . $line. '&nbsp;:&nbsp;' . '&nbsp;M</td><td><span class="diffMoved" >' . $value . '</span></td></tr>' . "\n" //juan carlos comenta
return '<tr><td></td><td bgcolor="#FFFFAA">'.$value.'</td></tr>'."\n"; //juan carlos muestra solo color (no tambi<EFBFBD>n la l<EFBFBD>nea). Adem<EFBFBD>s EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que est<EFBFBD> definido en la hoja de estilos como background-color, aceptando s<EFBFBD>lo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, adem<EFBFBD>s los cambios de otros objetos que no sean texto no se indican por ej. a<EFBFBD>adir una imagen, por esta raz<EFBFBD>n doy el color de fondo al td directamente.
return '<tr><td></td><td bgcolor="#FFFFAA">'.$value.'</td></tr>'."\n";
//juan carlos muestra solo color (no tambi<EFBFBD>n la l<EFBFBD>nea). Adem<EFBFBD>s EN IEXPLORER VA BIEN PERO EN FIREFOX 3
// la etiqueta span no muestra el color de fondo que est<EFBFBD> definido en la hoja de estilos como
// background-color, aceptando s<EFBFBD>lo la propiedad color pero esta solo da color al texto con lo cual
// los cambios quedan poco resaltados, adem<EFBFBD>s los cambios de otros objetos que no sean texto no se indican
// por ej. a<EFBFBD>adir una imagen, por esta raz<EFBFBD>n doy el color de fondo al td directamente.
break;
case DIFF_ADDED:
// return '<tr><td>' . $line. '&nbsp;:&nbsp;' . '&nbsp;+</td><td><span class="diffAdded" >' . $value . '</span></td></tr>' . "\n" ; //juan carlos comentado
return '<tr><td></td><td bgcolor="#CCFFCC">'.$value.'</td></tr>'."\n"; //juan carlos muestra solo color (no tambi<EFBFBD>n la l<EFBFBD>nea). Adem<EFBFBD>s EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que est<EFBFBD> definido en la hoja de estilos como background-color, aceptando s<EFBFBD>lo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, adem<EFBFBD>s los cambios de otros objetos que no sean texto no se indican por ej. a<EFBFBD>adir una imagen, por esta raz<EFBFBD>n doy el color de fondo al td directamente.
return '<tr><td></td><td bgcolor="#CCFFCC">'.$value.'</td></tr>'."\n";
//juan carlos muestra solo color (no tambi<EFBFBD>n la l<EFBFBD>nea). Adem<EFBFBD>s EN IEXPLORER VA BIEN
// PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que est<EFBFBD> definido en la
// hoja de estilos como background-color, aceptando s<EFBFBD>lo la propiedad color pero esta solo
// da color al texto con lo cual los cambios quedan poco resaltados, adem<EFBFBD>s los cambios de
// otros objetos que no sean texto no se indican por ej. a<EFBFBD>adir una imagen, por esta raz<EFBFBD>n
// doy el color de fondo al td directamente.
break;
case DIFF_DELETED:
// return '<tr><td>' . $line. '&nbsp;:&nbsp;' . '&nbsp;-</td><td><span class="diffDeleted" >' . $value . '</span></td></tr>' . "\n" ; //juan carlos comentado
return '<tr><td></td><td bgcolor="#FFAAAA">'.$value.'</td></tr>'."\n"; //juan carlos muestra solo color (no tambi<EFBFBD>n la l<EFBFBD>nea). Adem<EFBFBD>s EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que est<EFBFBD> definido en la hoja de estilos como background-color, aceptando s<EFBFBD>lo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, adem<EFBFBD>s los cambios de otros objetos que no sean texto no se indican por ej. a<EFBFBD>adir una imagen, por esta raz<EFBFBD>n doy el color de fondo al td directamente.
return '<tr><td></td><td bgcolor="#FFAAAA">'.$value.'</td></tr>'."\n";
//juan carlos muestra solo color (no tambi<EFBFBD>n la l<EFBFBD>nea). Adem<EFBFBD>s EN IEXPLORER VA BIEN PERO EN FIREFOX 3
// la etiqueta span no muestra el color de fondo que est<EFBFBD> definido en la hoja de estilos como background-color,
// aceptando s<EFBFBD>lo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco
// resaltados, adem<EFBFBD>s los cambios de otros objetos que no sean texto no se indican por ej. a<EFBFBD>adir una imagen,
// por esta raz<EFBFBD>n doy el color de fondo al td directamente.
}
}

@ -263,19 +263,9 @@ class Wiki
strtolower(str_replace(' ', '_', $link))
)) {
$link = api_html_entity_decode($link);
$input_array[$key] = '<a href="'.api_get_path(
WEB_PATH
).'main/wiki/index.php?'.api_get_cidreq(
).'&action=addnew&amp;title='.Security::remove_XSS(
$link
).'&group_id='.$groupId.'" class="new_wiki_link">'.$title.'</a>';
$input_array[$key] = '<a href="'.api_get_path(WEB_PATH).'main/wiki/index.php?'.api_get_cidreq().'&action=addnew&amp;title='.Security::remove_XSS($link).'&group_id='.$groupId.'" class="new_wiki_link">'.$title.'</a>';
} else {
$input_array[$key] = '<a href="'.api_get_path(
WEB_PATH
).'main/wiki/index.php?'.api_get_cidreq(
).'&action=showpage&amp;title='.urlencode(
strtolower(str_replace(' ', '_', $link))
).'&group_id='.$groupId.'" class="wiki_link">'.$title.'</a>';
$input_array[$key] = '<a href="'.api_get_path(WEB_PATH).'main/wiki/index.php?'.api_get_cidreq().'&action=showpage&amp;title='.urlencode(strtolower(str_replace(' ', '_', $link))).'&group_id='.$groupId.'" class="wiki_link">'.$title.'</a>';
}
unset($input_array[$key - 1]);
unset($input_array[$key + 1]);
@ -1248,8 +1238,7 @@ class Wiki
)
) {
// menu discuss page
$actionsRight .= '<a href="index.php?'.api_get_cidreq(
).'&action=discuss&title='.api_htmlentities(
$actionsRight .= '<a href="index.php?'.api_get_cidreq().'&action=discuss&title='.api_htmlentities(
urlencode($page)
).'" '.self::is_active_navigation_tab('discuss').'>'.
Display::return_icon(
@ -1261,8 +1250,7 @@ class Wiki
}
//menu history
$actionsRight .= '<a href="index.php?'.api_get_cidreq(
).'&action=history&title='.api_htmlentities(
$actionsRight .= '<a href="index.php?'.api_get_cidreq().'&action=history&title='.api_htmlentities(
urlencode($page)
).'" '.self::is_active_navigation_tab('history').'>'.
Display::return_icon(
@ -1272,8 +1260,7 @@ class Wiki
ICON_SIZE_MEDIUM
).'</a>';
//menu linkspages
$actionsRight .= '<a href="index.php?'.api_get_cidreq(
).'action=links&title='.api_htmlentities(
$actionsRight .= '<a href="index.php?'.api_get_cidreq().'action=links&title='.api_htmlentities(
urlencode($page)
).'" '.self::is_active_navigation_tab('links').'>'.
Display::return_icon(
@ -1287,8 +1274,7 @@ class Wiki
if (api_is_allowed_to_edit(false, true) ||
api_is_platform_admin()
) {
$actionsRight .= '<a href="index.php?action=delete&'.api_get_cidreq(
).'&title='.api_htmlentities(
$actionsRight .= '<a href="index.php?action=delete&'.api_get_cidreq().'&title='.api_htmlentities(
urlencode($page)
).'"'.self::is_active_navigation_tab('delete').'>'.
Display::return_icon(
@ -1299,8 +1285,7 @@ class Wiki
).'</a>';
}
$actionsRight .= '<a href="index.php?'.api_get_cidreq(
).'&action=showpage&actionpage='.$lock_unlock_notify_page.'&title='.api_htmlentities(
$actionsRight .= '<a href="index.php?'.api_get_cidreq().'&action=showpage&actionpage='.$lock_unlock_notify_page.'&title='.api_htmlentities(
urlencode($page)
).'">'.
$notify_page.'</a>';
@ -1309,8 +1294,7 @@ class Wiki
if (api_is_allowed_to_edit(false, true) ||
api_is_platform_admin()
) {
$actionsRight .= '<a href="index.php?'.api_get_cidreq(
).'&action=export2doc&wiki_id='.$row['id'].'">'.
$actionsRight .= '<a href="index.php?'.api_get_cidreq().'&action=export2doc&wiki_id='.$row['id'].'">'.
Display::return_icon(
'export_to_documents.png',
get_lang('ExportToDocArea'),
@ -1319,8 +1303,7 @@ class Wiki
).'</a>';
}
$actionsRight .= '<a href="index.php?'.api_get_cidreq(
).'&action=export_to_pdf&wiki_id='.$row['id'].'">'.
$actionsRight .= '<a href="index.php?'.api_get_cidreq().'&action=export_to_pdf&wiki_id='.$row['id'].'">'.
Display::return_icon(
'pdf.png',
get_lang('ExportToPDF'),
@ -1393,13 +1376,10 @@ class Wiki
)
);
$footerWiki = get_lang(
'Progress'
).': '.($row['progress'] * 10).'%&nbsp;&nbsp;&nbsp;'.get_lang(
'Rating'
).': '.$row['score'].'&nbsp;&nbsp;&nbsp;'.get_lang(
'Words'
).': '.self::word_count($content);
$footerWiki =
get_lang('Progress').': '.($row['progress'] * 10).'%&nbsp;&nbsp;&nbsp;'.
get_lang('Rating').': '.$row['score'].'&nbsp;&nbsp;&nbsp;'.
get_lang('Words').': '.self::word_count($content);
echo Display::panel($pageWiki, $pageTitle, $footerWiki);
} //end filter visibility
@ -1771,9 +1751,7 @@ class Wiki
}
$sql = 'UPDATE '.$tbl_wiki.' SET
addlock_disc="'.Database::escape_string(
$status_addlock_disc
).'"
addlock_disc="'.Database::escape_string($status_addlock_disc).'"
WHERE
c_id = '.$course_id.' AND
reflink = "'.Database::escape_string($page).'" AND

@ -34,7 +34,8 @@ function display_action_links($id, $cur_dir_path, $action)
if (!empty($id)) {
$display_output .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&id='.$my_back_id.'">'.
Display::return_icon('back.png', get_lang('BackToWorksList'), '', ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('back.png', get_lang('BackToWorksList'), '', ICON_SIZE_MEDIUM).
'</a>';
}
if (api_is_allowed_to_edit(null, true) && $origin != 'learnpath') {
@ -3643,7 +3644,12 @@ function setWorkUploadForm($form, $uploadFormType = 0)
switch ($uploadFormType) {
case 0:
// File and text.
$form->addElement('file', 'file', get_lang('UploadADocument'), 'size="40" onchange="updateDocumentTitle(this.value)"');
$form->addElement(
'file',
'file',
get_lang('UploadADocument'),
'size="40" onchange="updateDocumentTitle(this.value)"'
);
$form->addProgress();
$form->addHtmlEditor('description', get_lang('Description'), false, false, getWorkDescriptionToolbar());
break;
@ -3654,7 +3660,12 @@ function setWorkUploadForm($form, $uploadFormType = 0)
break;
case 2:
// Only file.
$form->addElement('file', 'file', get_lang('UploadADocument'), 'size="40" onchange="updateDocumentTitle(this.value)"');
$form->addElement(
'file',
'file',
get_lang('UploadADocument'),
'size="40" onchange="updateDocumentTitle(this.value)"'
);
$form->addProgress();
$form->addRule('file', get_lang('ThisFieldIsRequired'), 'required');
break;
@ -4513,7 +4524,6 @@ function deleteWorkItem($item_id, $courseInfo)
$count = Database::num_rows($result);
if ($count > 0) {
// If the "considered_working_time" option is enabled, check
// whether some time should be removed from track_e_course_access
$consideredWorkingTime = api_get_configuration_value('considered_working_time');

Loading…
Cancel
Save