Scrutinizer Auto-Fixes

This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
remotes/angel/1.11.x
Scrutinizer Auto-Fixer 8 years ago
parent 6a26112ba0
commit d8204561c5
  1. 4
      main/admin/skill_create.php
  2. 12
      main/course_progress/thematic_advance.php
  3. 8
      main/coursecopy/copy_course_session.php
  4. 10
      main/document/downloadfolder.inc.php
  5. 36
      main/inc/lib/glossary.lib.php
  6. 1
      main/inc/lib/model.lib.php
  7. 26
      main/inc/lib/skill.visualizer.lib.php
  8. 28
      main/session/add_courses_to_session.php
  9. 2
      src/Chamilo/CourseBundle/Entity/CToolIntro.php

@ -92,7 +92,7 @@ $jquery_ready_content = $returnParams['jquery_ready_content'];
if (!empty($jquery_ready_content)) { if (!empty($jquery_ready_content)) {
$htmlHeadXtra[] = '<script> $htmlHeadXtra[] = '<script>
$(document).ready(function(){ $(document).ready(function(){
' . $jquery_ready_content . ' ' . $jquery_ready_content.'
}); });
</script>'; </script>';
} }
@ -122,7 +122,7 @@ if ($createForm->validate()) {
); );
} }
header('Location: '.api_get_path(WEB_CODE_PATH) . 'admin/skill_list.php'); header('Location: '.api_get_path(WEB_CODE_PATH).'admin/skill_list.php');
exit; exit;
} }

@ -22,7 +22,7 @@ if ($action === 'thematic_advance_add' || $action === 'thematic_advance_edit') {
$form = new FormValidator( $form = new FormValidator(
'thematic_advance', 'thematic_advance',
'POST', 'POST',
api_get_self() . '?' . api_get_cidreq() api_get_self().'?'.api_get_cidreq()
); );
$form->addElement('header', $header_form); $form->addElement('header', $header_form);
//$form->addElement('hidden', 'thematic_advance_token',$token); //$form->addElement('hidden', 'thematic_advance_token',$token);
@ -191,7 +191,7 @@ if ($action === 'thematic_advance_add' || $action === 'thematic_advance_edit') {
$thematic = new Thematic(); $thematic = new Thematic();
$thematic->set_thematic_advance_attributes( $thematic->set_thematic_advance_attributes(
isset($values['thematic_advance_id']) ? $values['thematic_advance_id']: null, isset($values['thematic_advance_id']) ? $values['thematic_advance_id'] : null,
$values['thematic_id'], $values['thematic_id'],
$values['start_date_type'] == 1 && isset($values['attendance_select']) ? $values['attendance_select'] : 0, $values['start_date_type'] == 1 && isset($values['attendance_select']) ? $values['attendance_select'] : 0,
$values['content'], $values['content'],
@ -210,13 +210,13 @@ if ($action === 'thematic_advance_add' || $action === 'thematic_advance_edit') {
} }
} }
$redirectUrlParams = 'course_progress/index.php?' . api_get_cidreq() . '&' . $redirectUrlParams = 'course_progress/index.php?'.api_get_cidreq().'&'.
http_build_query([ http_build_query([
'action' => 'thematic_advance_list', 'action' => 'thematic_advance_list',
'thematic_id' => $values['thematic_id'] 'thematic_id' => $values['thematic_id']
]); ]);
header('Location: ' . api_get_path(WEB_CODE_PATH) . $redirectUrlParams); header('Location: '.api_get_path(WEB_CODE_PATH).$redirectUrlParams);
exit; exit;
} }
@ -226,10 +226,10 @@ if ($action === 'thematic_advance_add' || $action === 'thematic_advance_edit') {
// thematic advance list // thematic advance list
echo '<div class="actions">'; echo '<div class="actions">';
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=thematic_details">'. echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=thematic_details">'.
Display::return_icon('back.png', get_lang("BackTo"),'',ICON_SIZE_MEDIUM).'</a>'; Display::return_icon('back.png', get_lang("BackTo"), '', ICON_SIZE_MEDIUM).'</a>';
if (api_is_allowed_to_edit(false, true)) { if (api_is_allowed_to_edit(false, true)) {
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=thematic_advance_add&amp;thematic_id='.$thematic_id.'"> '. echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=thematic_advance_add&amp;thematic_id='.$thematic_id.'"> '.
Display::return_icon('add.png', get_lang('NewThematicAdvance'),'',ICON_SIZE_MEDIUM).'</a>'; Display::return_icon('add.png', get_lang('NewThematicAdvance'), '', ICON_SIZE_MEDIUM).'</a>';
} }
echo '</div>'; echo '</div>';
$table = new SortableTable( $table = new SortableTable(

@ -85,7 +85,7 @@ function make_select_session_list($name, $sessions, $attr = array())
function display_form() function display_form()
{ {
$html = ''; $html = '';
$sessions = SessionManager::get_sessions_list(array(), array('name', 'ASC')); $sessions = SessionManager::get_sessions_list(array(), array('name', 'ASC'));
// Link back to the documents overview // Link back to the documents overview
@ -109,7 +109,7 @@ function display_form()
//destination //destination
$html .= '<div class="form-group">'; $html .= '<div class="form-group">';
$html .= '<label class="col-sm-2 control-label">' . get_lang('DestinationCoursesFromSession') . ': </label>'; $html .= '<label class="col-sm-2 control-label">'.get_lang('DestinationCoursesFromSession').': </label>';
$html .= '<div class="col-sm-5" id="ajax_sessions_list_destination">'; $html .= '<div class="col-sm-5" id="ajax_sessions_list_destination">';
$html .= '<select class="form-control" name="sessions_list_destination" onchange="javascript: xajax_search_courses(this.value,\'destination\');">'; $html .= '<select class="form-control" name="sessions_list_destination" onchange="javascript: xajax_search_courses(this.value,\'destination\');">';
$html .= '<option value = "0">'.get_lang('ThereIsNotStillASession').'</option></select ></div>'; $html .= '<option value = "0">'.get_lang('ThereIsNotStillASession').'</option></select ></div>';
@ -131,7 +131,7 @@ function display_form()
$html .= '<button class="btn btn-success" type="submit" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;"><em class="fa fa-files-o"></em> '.get_lang('CopyCourse').'</button>'; $html .= '<button class="btn btn-success" type="submit" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;"><em class="fa fa-files-o"></em> '.get_lang('CopyCourse').'</button>';
// Add Security token // Add Security token
$html .= '<input type="hidden" value="' . Security::get_token() . '" name="sec_token">'; $html .= '<input type="hidden" value="'.Security::get_token().'" name="sec_token">';
$html .= '</div></div>'; $html .= '</div></div>';
$html .= '</form>'; $html .= '</form>';
@ -227,7 +227,7 @@ $xajax->processRequests();
/* HTML head extra */ /* HTML head extra */
$htmlHeadXtra[] = $xajax->getJavascript( api_get_path(WEB_LIBRARY_PATH).'xajax/'); $htmlHeadXtra[] = $xajax->getJavascript(api_get_path(WEB_LIBRARY_PATH).'xajax/');
$htmlHeadXtra[] = '<script> $htmlHeadXtra[] = '<script>
function checkSelected(id_select,id_radio,id_title,id_destination) { function checkSelected(id_select,id_radio,id_title,id_destination) {
var num=0; var num=0;

@ -52,7 +52,7 @@ if (empty($path)) {
// A student should not be able to download a root shared directory // A student should not be able to download a root shared directory
if (($path == '/shared_folder' || if (($path == '/shared_folder' ||
$path == '/shared_folder_session_' . api_get_session_id()) && $path == '/shared_folder_session_'.api_get_session_id()) &&
(!api_is_allowed_to_edit() || !api_is_platform_admin()) (!api_is_allowed_to_edit() || !api_is_platform_admin())
) { ) {
api_not_allowed(true); api_not_allowed(true);
@ -150,7 +150,7 @@ if (api_is_allowed_to_edit()) {
(props.session_id IN ('0', '$sessionId') OR props.session_id IS NULL) AND (props.session_id IN ('0', '$sessionId') OR props.session_id IS NULL) AND
docs.c_id = ".$courseId." "; docs.c_id = ".$courseId." ";
$sql.= DocumentManager::getSessionFolderFilters($querypath, $sessionId); $sql .= DocumentManager::getSessionFolderFilters($querypath, $sessionId);
$result = Database::query($sql); $result = Database::query($sql);
@ -215,7 +215,7 @@ if (api_is_allowed_to_edit()) {
$groupCondition $groupCondition
"; ";
$sql.= DocumentManager::getSessionFolderFilters($querypath, $sessionId); $sql .= DocumentManager::getSessionFolderFilters($querypath, $sessionId);
$result = Database::query($sql); $result = Database::query($sql);
$files = array(); $files = array();
@ -296,9 +296,9 @@ if (api_is_allowed_to_edit()) {
// Add all files in our final array to the zipfile // Add all files in our final array to the zipfile
for ($i = 0; $i < count($files_for_zipfile); $i++) { for ($i = 0; $i < count($files_for_zipfile); $i++) {
$zip->add( $zip->add(
$sysCoursePath . $courseInfo['path'] . '/document' . $files_for_zipfile[$i], $sysCoursePath.$courseInfo['path'].'/document'.$files_for_zipfile[$i],
PCLZIP_OPT_REMOVE_PATH, PCLZIP_OPT_REMOVE_PATH,
$sysCoursePath . $courseInfo['path'] . '/document' . $remove_dir, $sysCoursePath.$courseInfo['path'].'/document'.$remove_dir,
PCLZIP_CB_PRE_ADD, PCLZIP_CB_PRE_ADD,
'fixDocumentNameCallback' 'fixDocumentNameCallback'
); );

@ -47,9 +47,9 @@ class GlossaryManager
* *
* @return string The glossary description * @return string The glossary description
*/ */
public static function get_glossary_term_by_glossary_id ($glossary_id) public static function get_glossary_term_by_glossary_id($glossary_id)
{ {
$glossary_table = Database::get_course_table(TABLE_GLOSSARY); $glossary_table = Database::get_course_table(TABLE_GLOSSARY);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$sql = "SELECT description FROM $glossary_table $sql = "SELECT description FROM $glossary_table
WHERE c_id = $course_id AND glossary_id =".intval($glossary_id); WHERE c_id = $course_id AND glossary_id =".intval($glossary_id);
@ -72,7 +72,7 @@ class GlossaryManager
*/ */
public static function get_glossary_term_by_glossary_name($glossary_name) public static function get_glossary_term_by_glossary_name($glossary_name)
{ {
$glossary_table = Database::get_course_table(TABLE_GLOSSARY); $glossary_table = Database::get_course_table(TABLE_GLOSSARY);
$session_id = api_get_session_id(); $session_id = api_get_session_id();
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$sql_filter = api_get_session_condition($session_id); $sql_filter = api_get_session_condition($session_id);
@ -223,7 +223,7 @@ class GlossaryManager
$get_max = "SELECT MAX(display_order) FROM $t_glossary $get_max = "SELECT MAX(display_order) FROM $t_glossary
WHERE c_id = $course_id "; WHERE c_id = $course_id ";
$res_max = Database::query($get_max); $res_max = Database::query($get_max);
if (Database::num_rows($res_max)==0) { if (Database::num_rows($res_max) == 0) {
return 0; return 0;
} }
$row = Database::fetch_array($res_max); $row = Database::fetch_array($res_max);
@ -252,7 +252,7 @@ class GlossaryManager
WHERE WHERE
c_id = $course_id AND c_id = $course_id AND
name = '".Database::escape_string($term)."'"; name = '".Database::escape_string($term)."'";
if ($not_id<>'') { if ($not_id <> '') {
$sql .= " AND glossary_id <> '".intval($not_id)."'"; $sql .= " AND glossary_id <> '".intval($not_id)."'";
} }
$result = Database::query($sql); $result = Database::query($sql);
@ -375,25 +375,25 @@ class GlossaryManager
$actionsLeft = ''; $actionsLeft = '';
if (api_is_allowed_to_edit(null, true)) { if (api_is_allowed_to_edit(null, true)) {
$actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=addglossary&msg=add?'.api_get_cidreq().'">'. $actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=addglossary&msg=add?'.api_get_cidreq().'">'.
Display::return_icon('new_glossary_term.png',get_lang('TermAddNew'), '', ICON_SIZE_MEDIUM).'</a>'; Display::return_icon('new_glossary_term.png', get_lang('TermAddNew'), '', ICON_SIZE_MEDIUM).'</a>';
} }
$actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=export">'. $actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=export">'.
Display::return_icon('export_csv.png',get_lang('ExportGlossaryAsCSV'), '', ICON_SIZE_MEDIUM).'</a>'; Display::return_icon('export_csv.png', get_lang('ExportGlossaryAsCSV'), '', ICON_SIZE_MEDIUM).'</a>';
if (api_is_allowed_to_edit(null, true)) { if (api_is_allowed_to_edit(null, true)) {
$actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=import">'. $actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=import">'.
Display::return_icon('import_csv.png',get_lang('ImportGlossary'), '', ICON_SIZE_MEDIUM).'</a>'; Display::return_icon('import_csv.png', get_lang('ImportGlossary'), '', ICON_SIZE_MEDIUM).'</a>';
} }
$actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=export_to_pdf">'. $actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=export_to_pdf">'.
Display::return_icon('pdf.png',get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'</a>'; Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'</a>';
if (($view == 'table') || (!isset($view))) { if (($view == 'table') || (!isset($view))) {
$actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=list">'. $actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=list">'.
Display::return_icon('view_detailed.png',get_lang('ListView'), '', ICON_SIZE_MEDIUM).'</a>'; Display::return_icon('view_detailed.png', get_lang('ListView'), '', ICON_SIZE_MEDIUM).'</a>';
} else { } else {
$actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=table">'. $actionsLeft .= '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=table">'.
Display::return_icon('view_text.png',get_lang('TableView'), '', ICON_SIZE_MEDIUM).'</a>'; Display::return_icon('view_text.png', get_lang('TableView'), '', ICON_SIZE_MEDIUM).'</a>';
} }
/* BUILD SEARCH FORM */ /* BUILD SEARCH FORM */
@ -430,7 +430,7 @@ class GlossaryManager
$table->set_header(1, get_lang('TermDefinition'), true); $table->set_header(1, get_lang('TermDefinition'), true);
if (api_is_allowed_to_edit(null, true)) { if (api_is_allowed_to_edit(null, true)) {
$table->set_header(2, get_lang('Actions'), false, 'width=90px', array('class' => 'td_actions')); $table->set_header(2, get_lang('Actions'), false, 'width=90px', array('class' => 'td_actions'));
$table->set_column_filter(2, array('GlossaryManager','actions_filter')); $table->set_column_filter(2, array('GlossaryManager', 'actions_filter'));
} }
$content .= $table->return_table(); $content .= $table->return_table();
} }
@ -452,8 +452,8 @@ class GlossaryManager
$content = ''; $content = '';
foreach ($glossary_data as $key => $glossary_item) { foreach ($glossary_data as $key => $glossary_item) {
$actions = ''; $actions = '';
if (api_is_allowed_to_edit(null,true)) { if (api_is_allowed_to_edit(null, true)) {
$actions = '<div class="pull-right">'.self::actions_filter($glossary_item[2], '',$glossary_item).'</div>'; $actions = '<div class="pull-right">'.self::actions_filter($glossary_item[2], '', $glossary_item).'</div>';
} }
$content .= Display::panel($glossary_item[1], $glossary_item[0].' '.$actions); $content .= Display::panel($glossary_item[1], $glossary_item[0].' '.$actions);
} }
@ -466,7 +466,7 @@ class GlossaryManager
* @return integer Count of glossary terms * @return integer Count of glossary terms
* *
*/ */
public static function get_number_glossary_terms($session_id=0) public static function get_number_glossary_terms($session_id = 0)
{ {
// Database table definition // Database table definition
$t_glossary = Database::get_course_table(TABLE_GLOSSARY); $t_glossary = Database::get_course_table(TABLE_GLOSSARY);
@ -560,7 +560,7 @@ class GlossaryManager
while ($data = Database::fetch_array($res)) { while ($data = Database::fetch_array($res)) {
// Validation when belongs to a session // Validation when belongs to a session
$session_img = api_get_session_image($data['session_id'], $_user['status']); $session_img = api_get_session_image($data['session_id'], $_user['status']);
$array[0] = $data[0] . $session_img; $array[0] = $data[0].$session_img;
if (!$view || $view === 'table') { if (!$view || $view === 'table') {
$array[1] = str_replace(array('<p>', '</p>'), array('', '<br />'), $data[1]); $array[1] = str_replace(array('<p>', '</p>'), array('', '<br />'), $data[1]);
@ -590,13 +590,13 @@ class GlossaryManager
{ {
$glossary_id = $row[2]; $glossary_id = $row[2];
$return = '<a href="'.api_get_self().'?action=edit_glossary&glossary_id='.$glossary_id.'&'.api_get_cidreq().'&msg=edit">'. $return = '<a href="'.api_get_self().'?action=edit_glossary&glossary_id='.$glossary_id.'&'.api_get_cidreq().'&msg=edit">'.
Display::return_icon('edit.png',get_lang('Edit'),'',22).'</a>'; Display::return_icon('edit.png', get_lang('Edit'), '', 22).'</a>';
$glossary_data = self::get_glossary_information($glossary_id); $glossary_data = self::get_glossary_information($glossary_id);
$glossary_term = $glossary_data['name']; $glossary_term = $glossary_data['name'];
if (api_is_allowed_to_edit(null, true)) { if (api_is_allowed_to_edit(null, true)) {
if ($glossary_data['session_id'] == api_get_session_id()) { if ($glossary_data['session_id'] == api_get_session_id()) {
$return .= '<a href="'.api_get_self().'?action=delete_glossary&glossary_id='.$glossary_id.'&'.api_get_cidreq().'" onclick="return confirmation(\''.$glossary_term.'\');">'. $return .= '<a href="'.api_get_self().'?action=delete_glossary&glossary_id='.$glossary_id.'&'.api_get_cidreq().'" onclick="return confirmation(\''.$glossary_term.'\');">'.
Display::return_icon('delete.png', get_lang('Delete'),'',22).'</a>'; Display::return_icon('delete.png', get_lang('Delete'), '', 22).'</a>';
} else { } else {
$return = get_lang('EditionNotAvailableFromSession'); $return = get_lang('EditionNotAvailableFromSession');
} }

@ -25,6 +25,7 @@ class Model
/** /**
* Useful finder - experimental akelos like only use in notification.lib.php send function * Useful finder - experimental akelos like only use in notification.lib.php send function
* @param string $type
*/ */
public function find($type, $options = null) public function find($type, $options = null)
{ {

@ -27,7 +27,7 @@ class SkillVisualizer
{ {
$this->skills = $skills; $this->skills = $skills;
$this->type = $type; $this->type = $type;
$this->center_x = intval($offset_x + $this->canvas_x/2 - $this->block_size/2); $this->center_x = intval($offset_x + $this->canvas_x / 2 - $this->block_size / 2);
} }
function prepare_skill_box($skill, $position, $class) function prepare_skill_box($skill, $position, $class)
@ -39,9 +39,9 @@ class SkillVisualizer
$extra_class = 'second_window'; $extra_class = 'second_window';
} }
$this->html .= '<div id="block_'.$block_id.'" class = "open_block window '.$extra_class.' '.$class.'" style = "top:' . $position['y'] . 'px; left:' . $position['x'] . 'px;">'; $this->html .= '<div id="block_'.$block_id.'" class = "open_block window '.$extra_class.' '.$class.'" style = "top:'.$position['y'].'px; left:'.$position['x'].'px;">';
$content = $skill['name']; $content = $skill['name'];
$content .= '<div class="btn-group">'; $content .= '<div class="btn-group">';
$content .= Display::url(get_lang('Edit'), '#', array('id'=>'edit_block_'.$block_id, 'class'=>'edit_block btn')); $content .= Display::url(get_lang('Edit'), '#', array('id'=>'edit_block_'.$block_id, 'class'=>'edit_block btn'));
$content .= Display::url('+', '#', array('id'=>'edit_block_'.$block_id, 'class'=>'edit_block btn')); $content .= Display::url('+', '#', array('id'=>'edit_block_'.$block_id, 'class'=>'edit_block btn'));
@ -87,9 +87,9 @@ class SkillVisualizer
} }
//default_arrow_color //default_arrow_color
$this->js .= 'var e'.$block_id.' = prepare("block_' . $block_id.'", '.$end_point.');'."\n"; $this->js .= 'var e'.$block_id.' = prepare("block_'.$block_id.'", '.$end_point.');'."\n";
$this->js .= 'var e'.$skill['parent_id'].' = prepare("block_' . $skill['parent_id'].'", '.$end_point.');'."\n"; $this->js .= 'var e'.$skill['parent_id'].' = prepare("block_'.$skill['parent_id'].'", '.$end_point.');'."\n";
$this->js .= 'jsPlumb.connect({source: e'.$block_id.', target:e'.$skill['parent_id'].'});'."\n";; $this->js .= 'jsPlumb.connect({source: e'.$block_id.', target:e'.$skill['parent_id'].'});'."\n"; ;
} }
/** /**
@ -125,10 +125,10 @@ class SkillVisualizer
$brothers = array(); $brothers = array();
foreach ($this->skills as &$skill) { foreach ($this->skills as &$skill) {
if (!in_array($skill['parent_id'], array(0,1))) { if (!in_array($skill['parent_id'], array(0, 1))) {
continue; continue;
} }
$childs = isset($skill['children']) ? count($skill['children']) : 0 ; $childs = isset($skill['children']) ? count($skill['children']) : 0;
//$x = round($this->offsetX * sin(deg2rad($corner * $count))); //$x = round($this->offsetX * sin(deg2rad($corner * $count)));
//$y = round($this->offsetY * cos(deg2rad($corner * $count))); //$y = round($this->offsetY * cos(deg2rad($corner * $count)));
@ -144,10 +144,10 @@ class SkillVisualizer
if ($skill['parent_id'] == 0) { if ($skill['parent_id'] == 0) {
//$x = 130*$childs/2; //$x = 130*$childs/2;
//$x = $this->space_between_blocks_x*$childs/2; //$x = $this->space_between_blocks_x*$childs/2;
$x = $this->canvas_x/2 - $this->block_size/2; $x = $this->canvas_x / 2 - $this->block_size / 2;
} else { } else {
$max = isset($this->skills[$skill['parent_id']]['children']) ? count($this->skills[$skill['parent_id']]['children']) : 0; $max = isset($this->skills[$skill['parent_id']]['children']) ? count($this->skills[$skill['parent_id']]['children']) : 0;
foreach($this->skills[$skill['parent_id']]['children'] as $id => $sk) { foreach ($this->skills[$skill['parent_id']]['children'] as $id => $sk) {
if ($skill['id'] == $sk['id']) { if ($skill['id'] == $sk['id']) {
break; break;
} }
@ -155,17 +155,17 @@ class SkillVisualizer
} }
$parent_x = isset($this->skills[$skill['parent_id']]['x']) ? $this->skills[$skill['parent_id']]['x'] : 0; $parent_x = isset($this->skills[$skill['parent_id']]['x']) ? $this->skills[$skill['parent_id']]['x'] : 0;
//$x = $my_count*$this->space_between_blocks_x + $parent_x + $this->block_size - ($this->space_between_blocks_x*$max/2) ; //$x = $my_count*$this->space_between_blocks_x + $parent_x + $this->block_size - ($this->space_between_blocks_x*$max/2) ;
$x = $my_count*$this->space_between_blocks_x + $parent_x + $this->block_size - ($this->canvas_x/2 ) ; $x = $my_count * $this->space_between_blocks_x + $parent_x + $this->block_size - ($this->canvas_x / 2);
} }
$y = $skill['level']*$this->space_between_blocks_y; $y = $skill['level'] * $this->space_between_blocks_y;
$skill['x'] = $x; $skill['x'] = $x;
$skill['y'] = $y; $skill['y'] = $y;
//$skill['description'] = "{$brothers[$skill['parent_id']]} $x - $y"; //$skill['description'] = "{$brothers[$skill['parent_id']]} $x - $y";
//$skill['name'] = $skill['name']." | $x = $my_count * 150 + $parent_x - (150* $max/2) - 10*$childs "; //$skill['name'] = $skill['name']." | $x = $my_count * 150 + $parent_x - (150* $max/2) - 10*$childs ";
$this->add_item($skill, array('x' => $this->offset_x + $x, 'y' => $this->offset_y +$y)); $this->add_item($skill, array('x' => $this->offset_x + $x, 'y' => $this->offset_y + $y));
} }
return $this->get_html(); return $this->get_html();
} }

@ -23,7 +23,7 @@ $xajax->registerFunction(array('search_courses', 'AddCourseToSession', 'search_c
$this_section = SECTION_PLATFORM_ADMIN; $this_section = SECTION_PLATFORM_ADMIN;
// setting breadcrumbs // setting breadcrumbs
$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList')); $interbreadcrumb[] = array('url' => 'session_list.php', 'name' => get_lang('SessionList'));
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
'url' => "resume_session.php?id_session=".$sessionId, 'url' => "resume_session.php?id_session=".$sessionId,
'name' => get_lang('SessionOverview') 'name' => get_lang('SessionOverview')
@ -37,7 +37,7 @@ $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
// setting the name of the tool // setting the name of the tool
$tool_name= get_lang('SubscribeCoursesToSession'); $tool_name = get_lang('SubscribeCoursesToSession');
$add_type = 'multiple'; $add_type = 'multiple';
if (isset($_GET['add_type']) && $_GET['add_type'] != '') { if (isset($_GET['add_type']) && $_GET['add_type'] != '') {
@ -130,7 +130,7 @@ if ($ajax_search) {
ON ON
course.id = session_rel_course.c_id AND course.id = session_rel_course.c_id AND
session_rel_course.session_id = ".$sessionId." session_rel_course.session_id = ".$sessionId."
ORDER BY ".(sizeof($courses)?"(code IN(".implode(',', $courses).")) DESC,":"")." title"; ORDER BY ".(sizeof($courses) ? "(code IN(".implode(',', $courses).")) DESC," : "")." title";
if (api_is_multiple_url_enabled()) { if (api_is_multiple_url_enabled()) {
$tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
@ -144,7 +144,7 @@ if ($ajax_search) {
INNER JOIN $tbl_course_rel_access_url url_course INNER JOIN $tbl_course_rel_access_url url_course
ON (url_course.c_id = course.id) ON (url_course.c_id = course.id)
WHERE access_url_id = $access_url_id WHERE access_url_id = $access_url_id
ORDER BY ".(sizeof($courses)?"(code IN(".implode(',',$courses).")) DESC,":"")." title"; ORDER BY ".(sizeof($courses) ? "(code IN(".implode(',', $courses).")) DESC," : "")." title";
} }
} }
@ -160,7 +160,7 @@ if ($ajax_search) {
ON ON
course.id = session_rel_course.c_id AND course.id = session_rel_course.c_id AND
session_rel_course.session_id = ".$sessionId." session_rel_course.session_id = ".$sessionId."
ORDER BY ".(sizeof($courses)?"(code IN(".implode(',',$courses).")) DESC,":"")." title"; ORDER BY ".(sizeof($courses) ? "(code IN(".implode(',', $courses).")) DESC," : "")." title";
if (api_is_multiple_url_enabled()) { if (api_is_multiple_url_enabled()) {
$tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
@ -175,16 +175,16 @@ if ($ajax_search) {
INNER JOIN $tbl_course_rel_access_url url_course INNER JOIN $tbl_course_rel_access_url url_course
ON (url_course.c_id = course.id) ON (url_course.c_id = course.id)
WHERE access_url_id = $access_url_id WHERE access_url_id = $access_url_id
ORDER BY ".(sizeof($courses)?"(code IN(".implode(',',$courses).")) DESC,":"")." title"; ORDER BY ".(sizeof($courses) ? "(code IN(".implode(',', $courses).")) DESC," : "")." title";
} }
} }
$result = Database::query($sql); $result = Database::query($sql);
$Courses = Database::store_result($result); $Courses = Database::store_result($result);
foreach ($Courses as $course) { foreach ($Courses as $course) {
if ($course['session_id'] == $sessionId) { if ($course['session_id'] == $sessionId) {
$sessionCourses[$course['id']] = $course ; $sessionCourses[$course['id']] = $course;
} else { } else {
$nosessionCourses[$course['id']] = $course ; $nosessionCourses[$course['id']] = $course;
} }
} }
} }
@ -206,7 +206,7 @@ if (!api_is_platform_admin() && api_is_teacher()) {
unset($Courses); unset($Courses);
?> ?>
<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id_session=<?php echo $sessionId; ?><?php if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>> <form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id_session=<?php echo $sessionId; ?><?php if (!empty($_GET['add'])) echo '&add=true'; ?>" style="margin:0px;" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?>>
<legend><?php echo $tool_name.' ('.$session_info['name'].')'; ?></legend> <legend><?php echo $tool_name.' ('.$session_info['name'].')'; ?></legend>
<input type="hidden" name="formSent" value="1" /> <input type="hidden" name="formSent" value="1" />
@ -229,7 +229,7 @@ unset($Courses);
<div id="ajax_list_courses_multiple"> <div id="ajax_list_courses_multiple">
<select id="origin" name="NoSessionCoursesList[]" multiple="multiple" size="20" class="form-control"> <select id="origin" name="NoSessionCoursesList[]" multiple="multiple" size="20" class="form-control">
<?php foreach ($nosessionCourses as $enreg) { ?> <?php foreach ($nosessionCourses as $enreg) { ?>
<option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['title'].' ('.$enreg['visual_code'].')',ENT_QUOTES).'"'; if(in_array($enreg['code'],$CourseList)) echo 'selected="selected"'; ?>> <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['title'].' ('.$enreg['visual_code'].')', ENT_QUOTES).'"'; if (in_array($enreg['code'], $CourseList)) echo 'selected="selected"'; ?>>
<?php echo $enreg['title'].' ('.$enreg['visual_code'].')'; ?> <?php echo $enreg['title'].' ('.$enreg['visual_code'].')'; ?>
</option> </option>
<?php } ?> <?php } ?>
@ -241,7 +241,7 @@ unset($Courses);
?> ?>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<?php if($add_type == 'multiple') { ?> <?php if ($add_type == 'multiple') { ?>
<div class="code-course"> <div class="code-course">
<?php echo get_lang('FirstLetterCourse'); ?> : <?php echo get_lang('FirstLetterCourse'); ?> :
@ -249,7 +249,7 @@ unset($Courses);
<option value="%">--</option> <option value="%">--</option>
<?php <?php
echo Display :: get_alphabet_options(); echo Display :: get_alphabet_options();
echo Display :: get_numeric_options(0,9,''); echo Display :: get_numeric_options(0, 9, '');
?> ?>
</select> </select>
</div> </div>
@ -299,9 +299,9 @@ unset($Courses);
<select id='destination' name="SessionCoursesList[]" multiple="multiple" size="20" class="form-control"> <select id='destination' name="SessionCoursesList[]" multiple="multiple" size="20" class="form-control">
<?php <?php
foreach($sessionCourses as $enreg) { foreach ($sessionCourses as $enreg) {
?> ?>
<option value="<?php echo $enreg['id']; ?>" title="<?php echo htmlspecialchars($enreg['title'].' ('.$enreg['visual_code'].')',ENT_QUOTES); ?>"> <option value="<?php echo $enreg['id']; ?>" title="<?php echo htmlspecialchars($enreg['title'].' ('.$enreg['visual_code'].')', ENT_QUOTES); ?>">
<?php echo $enreg['title'].' ('.$enreg['visual_code'].')'; ?> <?php echo $enreg['title'].' ('.$enreg['visual_code'].')'; ?>
</option> </option>
<?php <?php

@ -94,7 +94,7 @@ class CToolIntro
/** /**
* Get id * Get id
* *
* @return string * @return integer
*/ */
public function getId() public function getId()
{ {

Loading…
Cancel
Save