Merge branch '1.11.x' of github.com:chamilo/chamilo-lms into 1.11.x

pull/2487/head
Angel Fernando Quiroz Campos 9 years ago
commit b7ec2137a7
  1. 4
      main/admin/skill_create.php
  2. 12
      main/course_progress/thematic_advance.php
  3. 8
      main/coursecopy/copy_course_session.php
  4. 2
      main/document/document.php
  5. 10
      main/document/downloadfolder.inc.php
  6. 36
      main/inc/lib/glossary.lib.php
  7. 1
      main/inc/lib/model.lib.php
  8. 26
      main/inc/lib/skill.visualizer.lib.php
  9. 6
      main/inc/lib/usermanager.lib.php
  10. 28
      main/session/add_courses_to_session.php
  11. 15
      src/Chamilo/CourseBundle/Component/CourseCopy/CourseSelectForm.php
  12. 7
      src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Announcement.php
  13. 22
      src/Chamilo/CourseBundle/Component/CourseCopy/Resources/CalendarEvent.php
  14. 223
      src/Chamilo/CourseBundle/Component/CourseCopy/Resources/CourseCopyLearnpath.php
  15. 2
      src/Chamilo/CourseBundle/Component/CourseCopy/Resources/CourseCopyTestCategory.php
  16. 1
      src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Forum.php
  17. 8
      src/Chamilo/CourseBundle/Component/CourseCopy/Resources/QuizQuestion.php
  18. 2
      src/Chamilo/CourseBundle/Component/CourseCopy/Resources/ScormDocument.php
  19. 2
      src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Survey.php
  20. 2
      src/Chamilo/CourseBundle/Component/CourseCopy/Resources/SurveyInvitation.php
  21. 12
      src/Chamilo/CourseBundle/Component/CourseCopy/Resources/SurveyQuestion.php
  22. 3
      src/Chamilo/CourseBundle/Component/CourseCopy/Resources/ToolIntro.php
  23. 2
      src/Chamilo/CourseBundle/Component/CourseCopy/Resources/Wiki.php
  24. 2
      src/Chamilo/CourseBundle/Entity/CToolIntro.php
  25. 21
      tests/behat/features/bootstrap/FeatureContext.php
  26. 20
      tests/behat/features/profile.feature
  27. 20
      tests/behat/features/registration.feature

@ -92,7 +92,7 @@ $jquery_ready_content = $returnParams['jquery_ready_content'];
if (!empty($jquery_ready_content)) {
$htmlHeadXtra[] = '<script>
$(document).ready(function(){
' . $jquery_ready_content . '
' . $jquery_ready_content.'
});
</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;
}

@ -22,7 +22,7 @@ if ($action === 'thematic_advance_add' || $action === 'thematic_advance_edit') {
$form = new FormValidator(
'thematic_advance',
'POST',
api_get_self() . '?' . api_get_cidreq()
api_get_self().'?'.api_get_cidreq()
);
$form->addElement('header', $header_form);
//$form->addElement('hidden', 'thematic_advance_token',$token);
@ -191,7 +191,7 @@ if ($action === 'thematic_advance_add' || $action === 'thematic_advance_edit') {
$thematic = new Thematic();
$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['start_date_type'] == 1 && isset($values['attendance_select']) ? $values['attendance_select'] : 0,
$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([
'action' => 'thematic_advance_list',
'thematic_id' => $values['thematic_id']
]);
header('Location: ' . api_get_path(WEB_CODE_PATH) . $redirectUrlParams);
header('Location: '.api_get_path(WEB_CODE_PATH).$redirectUrlParams);
exit;
}
@ -226,10 +226,10 @@ if ($action === 'thematic_advance_add' || $action === 'thematic_advance_edit') {
// thematic advance list
echo '<div class="actions">';
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)) {
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>';
$table = new SortableTable(

@ -85,7 +85,7 @@ function make_select_session_list($name, $sessions, $attr = array())
function display_form()
{
$html = '';
$html = '';
$sessions = SessionManager::get_sessions_list(array(), array('name', 'ASC'));
// Link back to the documents overview
@ -109,7 +109,7 @@ function display_form()
//destination
$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 .= '<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>';
@ -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>';
// 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 .= '</form>';
@ -227,7 +227,7 @@ $xajax->processRequests();
/* 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>
function checkSelected(id_select,id_radio,id_title,id_destination) {
var num=0;

@ -1971,7 +1971,7 @@ if (isset($_GET['createdir']) && isset($_POST['dirname']) && $_POST['dirname'] !
$document_id = DocumentManager::get_document_id($courseInfo, $_POST['dirname']);
}
$selector = '';
if (!$is_certificate_mode) {
if (!$is_certificate_mode && !isset($_GET['move'])) {
$selector = DocumentManager::build_directory_selector(
$folders,
$document_id,

@ -52,7 +52,7 @@ if (empty($path)) {
// A student should not be able to download a root shared directory
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_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
docs.c_id = ".$courseId." ";
$sql.= DocumentManager::getSessionFolderFilters($querypath, $sessionId);
$sql .= DocumentManager::getSessionFolderFilters($querypath, $sessionId);
$result = Database::query($sql);
@ -215,7 +215,7 @@ if (api_is_allowed_to_edit()) {
$groupCondition
";
$sql.= DocumentManager::getSessionFolderFilters($querypath, $sessionId);
$sql .= DocumentManager::getSessionFolderFilters($querypath, $sessionId);
$result = Database::query($sql);
$files = array();
@ -296,9 +296,9 @@ if (api_is_allowed_to_edit()) {
// Add all files in our final array to the zipfile
for ($i = 0; $i < count($files_for_zipfile); $i++) {
$zip->add(
$sysCoursePath . $courseInfo['path'] . '/document' . $files_for_zipfile[$i],
$sysCoursePath.$courseInfo['path'].'/document'.$files_for_zipfile[$i],
PCLZIP_OPT_REMOVE_PATH,
$sysCoursePath . $courseInfo['path'] . '/document' . $remove_dir,
$sysCoursePath.$courseInfo['path'].'/document'.$remove_dir,
PCLZIP_CB_PRE_ADD,
'fixDocumentNameCallback'
);

@ -47,9 +47,9 @@ class GlossaryManager
*
* @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();
$sql = "SELECT description FROM $glossary_table
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)
{
$glossary_table = Database::get_course_table(TABLE_GLOSSARY);
$glossary_table = Database::get_course_table(TABLE_GLOSSARY);
$session_id = api_get_session_id();
$course_id = api_get_course_int_id();
$sql_filter = api_get_session_condition($session_id);
@ -223,7 +223,7 @@ class GlossaryManager
$get_max = "SELECT MAX(display_order) FROM $t_glossary
WHERE c_id = $course_id ";
$res_max = Database::query($get_max);
if (Database::num_rows($res_max)==0) {
if (Database::num_rows($res_max) == 0) {
return 0;
}
$row = Database::fetch_array($res_max);
@ -252,7 +252,7 @@ class GlossaryManager
WHERE
c_id = $course_id AND
name = '".Database::escape_string($term)."'";
if ($not_id<>'') {
if ($not_id <> '') {
$sql .= " AND glossary_id <> '".intval($not_id)."'";
}
$result = Database::query($sql);
@ -375,25 +375,25 @@ class GlossaryManager
$actionsLeft = '';
if (api_is_allowed_to_edit(null, true)) {
$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">'.
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)) {
$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">'.
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))) {
$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 {
$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 */
@ -430,7 +430,7 @@ class GlossaryManager
$table->set_header(1, get_lang('TermDefinition'), 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_column_filter(2, array('GlossaryManager','actions_filter'));
$table->set_column_filter(2, array('GlossaryManager', 'actions_filter'));
}
$content .= $table->return_table();
}
@ -452,8 +452,8 @@ class GlossaryManager
$content = '';
foreach ($glossary_data as $key => $glossary_item) {
$actions = '';
if (api_is_allowed_to_edit(null,true)) {
$actions = '<div class="pull-right">'.self::actions_filter($glossary_item[2], '',$glossary_item).'</div>';
if (api_is_allowed_to_edit(null, true)) {
$actions = '<div class="pull-right">'.self::actions_filter($glossary_item[2], '', $glossary_item).'</div>';
}
$content .= Display::panel($glossary_item[1], $glossary_item[0].' '.$actions);
}
@ -466,7 +466,7 @@ class GlossaryManager
* @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
$t_glossary = Database::get_course_table(TABLE_GLOSSARY);
@ -560,7 +560,7 @@ class GlossaryManager
while ($data = Database::fetch_array($res)) {
// Validation when belongs to a session
$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') {
$array[1] = str_replace(array('<p>', '</p>'), array('', '<br />'), $data[1]);
@ -590,13 +590,13 @@ class GlossaryManager
{
$glossary_id = $row[2];
$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_term = $glossary_data['name'];
if (api_is_allowed_to_edit(null, true)) {
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.'\');">'.
Display::return_icon('delete.png', get_lang('Delete'),'',22).'</a>';
Display::return_icon('delete.png', get_lang('Delete'), '', 22).'</a>';
} else {
$return = get_lang('EditionNotAvailableFromSession');
}

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

@ -27,7 +27,7 @@ class SkillVisualizer
{
$this->skills = $skills;
$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)
@ -39,9 +39,9 @@ class SkillVisualizer
$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 .= 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'));
@ -87,9 +87,9 @@ class SkillVisualizer
}
//default_arrow_color
$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 .= 'jsPlumb.connect({source: e'.$block_id.', target:e'.$skill['parent_id'].'});'."\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 .= 'jsPlumb.connect({source: e'.$block_id.', target:e'.$skill['parent_id'].'});'."\n"; ;
}
/**
@ -125,10 +125,10 @@ class SkillVisualizer
$brothers = array();
foreach ($this->skills as &$skill) {
if (!in_array($skill['parent_id'], array(0,1))) {
if (!in_array($skill['parent_id'], array(0, 1))) {
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)));
//$y = round($this->offsetY * cos(deg2rad($corner * $count)));
@ -144,10 +144,10 @@ class SkillVisualizer
if ($skill['parent_id'] == 0) {
//$x = 130*$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 {
$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']) {
break;
}
@ -155,17 +155,17 @@ class SkillVisualizer
}
$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->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['y'] = $y;
//$skill['description'] = "{$brothers[$skill['parent_id']]} $x - $y";
//$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();
}

@ -739,6 +739,12 @@ class UserManager
TicketManager::deleteUserFromTicketSystem($user_id);
}
$tableExists = $connection->getSchemaManager()->tablesExist(['c_lp_category_user']);
if ($tableExists) {
$sql = "DELETE FROM c_lp_category_user WHERE user_id = $user_id";
Database::query($sql);
}
// Delete user from database
$sql = "DELETE FROM $table_user WHERE id = '".$user_id."'";
Database::query($sql);

@ -23,7 +23,7 @@ $xajax->registerFunction(array('search_courses', 'AddCourseToSession', 'search_c
$this_section = SECTION_PLATFORM_ADMIN;
// setting breadcrumbs
$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
$interbreadcrumb[] = array('url' => 'session_list.php', 'name' => get_lang('SessionList'));
$interbreadcrumb[] = array(
'url' => "resume_session.php?id_session=".$sessionId,
'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);
// setting the name of the tool
$tool_name= get_lang('SubscribeCoursesToSession');
$tool_name = get_lang('SubscribeCoursesToSession');
$add_type = 'multiple';
if (isset($_GET['add_type']) && $_GET['add_type'] != '') {
@ -130,7 +130,7 @@ if ($ajax_search) {
ON
course.id = session_rel_course.c_id AND
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()) {
$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
ON (url_course.c_id = course.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
course.id = session_rel_course.c_id AND
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()) {
$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
ON (url_course.c_id = course.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);
$Courses = Database::store_result($result);
foreach ($Courses as $course) {
if ($course['session_id'] == $sessionId) {
$sessionCourses[$course['id']] = $course ;
$sessionCourses[$course['id']] = $course;
} else {
$nosessionCourses[$course['id']] = $course ;
$nosessionCourses[$course['id']] = $course;
}
}
}
@ -206,7 +206,7 @@ if (!api_is_platform_admin() && api_is_teacher()) {
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>
<input type="hidden" name="formSent" value="1" />
@ -229,7 +229,7 @@ unset($Courses);
<div id="ajax_list_courses_multiple">
<select id="origin" name="NoSessionCoursesList[]" multiple="multiple" size="20" class="form-control">
<?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'].')'; ?>
</option>
<?php } ?>
@ -241,7 +241,7 @@ unset($Courses);
?>
</div>
<div class="col-md-4">
<?php if($add_type == 'multiple') { ?>
<?php if ($add_type == 'multiple') { ?>
<div class="code-course">
<?php echo get_lang('FirstLetterCourse'); ?> :
@ -249,7 +249,7 @@ unset($Courses);
<option value="%">--</option>
<?php
echo Display :: get_alphabet_options();
echo Display :: get_numeric_options(0,9,'');
echo Display :: get_numeric_options(0, 9, '');
?>
</select>
</div>
@ -299,9 +299,9 @@ unset($Courses);
<select id='destination' name="SessionCoursesList[]" multiple="multiple" size="20" class="form-control">
<?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'].')'; ?>
</option>
<?php

@ -21,10 +21,14 @@ class CourseSelectForm
* Display the form
* @param array $course
* @param array $hidden_fields Hidden fields to add to the form.
* @param boolean $avoid_serialize the document array will be serialize. This is used in the course_copy.php file
* @param boolean $avoid_serialize the document array will be serialize.
* This is used in the course_copy.php file
*/
public static function display_form($course, $hidden_fields = null, $avoid_serialize = false)
{
public static function display_form(
$course,
$hidden_fields = null,
$avoid_serialize = false
) {
global $charset;
$resource_titles[RESOURCE_ASSET] = get_lang('Assets');
$resource_titles[RESOURCE_GRADEBOOK] = get_lang('Gradebook');
@ -142,7 +146,7 @@ class CourseSelectForm
</script>
<?php
// get destination course title
if (!empty($hidden_fields['destination_course'])) {
if (!empty($hidden_fields['destination_course'])) {
$sessionTitle = !empty($hidden_fields['destination_session']) ? ' ('.api_get_session_name($hidden_fields['destination_session']).')' : null;
$course_infos = CourseManager::get_course_information($hidden_fields['destination_course']);
echo '<h3>';
@ -259,11 +263,9 @@ class CourseSelectForm
foreach ($forum_categories as $forum_category_id => $forum_category) {
echo '<li>';
echo '<label class="checkbox">';
echo '<input type="checkbox" id="resource_'.RESOURCE_FORUMCATEGORY.'_'.$forum_category_id.'" my_rel="'.$forum_category_id.'" onclick="javascript:check_category(this);" name="resource['.RESOURCE_FORUMCATEGORY.']['.$forum_category_id.']" /> ';
$forum_category->show();
echo '</label>';
echo '</li>';
if (isset($forums[$forum_category_id])) {
@ -394,7 +396,6 @@ class CourseSelectForm
public static function get_posted_course($from = '', $session_id = 0, $course_code = '')
{
$course = null;
if (isset($_POST['course'])) {
$course = Course::unserialize(base64_decode($_POST['course']));
} else {

@ -66,11 +66,10 @@ class Announcement extends Resource
$this->date = $date;
$this->display_order = $display_order;
$this->email_sent = $email_sent;
$this->attachment_path = $path;
$this->attachment_path = $path;
$this->attachment_filename = $filename;
$this->attachment_size = $size;
$this->attachment_comment = $comment;
$this->attachment_size = $size;
$this->attachment_comment = $comment;
}
/**

@ -63,19 +63,19 @@ class CalendarEvent extends Resource
$attachment_comment = null,
$all_day = 0
) {
parent::__construct($id, RESOURCE_EVENT);
parent::__construct($id, RESOURCE_EVENT);
$this->title = $title;
$this->content = $content;
$this->start_date = $start_date;
$this->end_date = $end_date;
$this->all_day = $all_day;
$this->title = $title;
$this->content = $content;
$this->start_date = $start_date;
$this->end_date = $end_date;
$this->all_day = $all_day;
$this->attachment_path = $attachment_path;
$this->attachment_filename = $attachment_filename;
$this->attachment_size = $attachment_size;
$this->attachment_comment = $attachment_comment;
}
$this->attachment_path = $attachment_path;
$this->attachment_filename = $attachment_filename;
$this->attachment_size = $attachment_size;
$this->attachment_comment = $attachment_comment;
}
/**
* Show this Event

@ -84,120 +84,119 @@ class CourseCopyLearnpath extends Resource
*/
public $author;
/**
* Author's image
*/
public $preview_image;
/**
* Create a new learnpath
* @param integer ID
* @param integer Type (1,2,3,...)
* @param string $name
* @param string $path
* @param string $ref
* @param string $description
* @param string $content_local
* @param string $default_encoding
* @param string $default_view_mode
* @param bool $prevent_reinit
* @param bool $force_commit
* @param string $content_maker
* @param integer $display_order
* @param string $js_lib
* @param string $content_license
* @param integer $debug
* @param string $visibility
* @param array $items
*/
public function __construct(
$id,
$type,
$name,
$path,
$ref,
$description,
$content_local,
$default_encoding,
$default_view_mode,
$prevent_reinit,
$force_commit,
$content_maker,
$display_order,
$js_lib,
$content_license,
$debug,
$visibility,
$author,
$preview_image,
$use_max_score,
$autolaunch,
$created_on,
$modified_on,
$publicated_on,
$expired_on,
$session_id,
$items
) {
parent::__construct($id, RESOURCE_LEARNPATH);
$this->lp_type = $type;
$this->name = $name;
$this->path = $path;
$this->ref = $ref;
$this->description = $description;
$this->content_local = $content_local;
$this->default_encoding = $default_encoding;
$this->default_view_mod = $default_view_mode;
$this->prevent_reinit = $prevent_reinit;
$this->force_commit = $force_commit;
$this->content_maker = $content_maker;
$this->display_order = $display_order;
$this->js_lib = $js_lib;
$this->content_license = $content_license;
$this->debug = $debug;
$this->visibility = $visibility;
$this->use_max_score = $use_max_score;
$this->autolaunch = $autolaunch;
$this->created_on = $created_on;
$this->modified_on = $modified_on;
$this->publicated_on = $publicated_on;
$this->expired_on = $expired_on;
$this->session_id = $session_id;
/**
* Author's image
*/
public $preview_image;
$this->author = $author;
$this->preview_image = $preview_image;
/**
* Create a new learnpath
* @param integer ID
* @param integer Type (1,2,3,...)
* @param string $name
* @param string $path
* @param string $ref
* @param string $description
* @param string $content_local
* @param string $default_encoding
* @param string $default_view_mode
* @param bool $prevent_reinit
* @param bool $force_commit
* @param string $content_maker
* @param integer $display_order
* @param string $js_lib
* @param string $content_license
* @param integer $debug
* @param string $visibility
* @param array $items
*/
public function __construct(
$id,
$type,
$name,
$path,
$ref,
$description,
$content_local,
$default_encoding,
$default_view_mode,
$prevent_reinit,
$force_commit,
$content_maker,
$display_order,
$js_lib,
$content_license,
$debug,
$visibility,
$author,
$preview_image,
$use_max_score,
$autolaunch,
$created_on,
$modified_on,
$publicated_on,
$expired_on,
$session_id,
$items
) {
parent::__construct($id, RESOURCE_LEARNPATH);
$this->lp_type = $type;
$this->name = $name;
$this->path = $path;
$this->ref = $ref;
$this->description = $description;
$this->content_local = $content_local;
$this->default_encoding = $default_encoding;
$this->default_view_mod = $default_view_mode;
$this->prevent_reinit = $prevent_reinit;
$this->force_commit = $force_commit;
$this->content_maker = $content_maker;
$this->display_order = $display_order;
$this->js_lib = $js_lib;
$this->content_license = $content_license;
$this->debug = $debug;
$this->visibility = $visibility;
$this->use_max_score = $use_max_score;
$this->autolaunch = $autolaunch;
$this->created_on = $created_on;
$this->modified_on = $modified_on;
$this->publicated_on = $publicated_on;
$this->expired_on = $expired_on;
$this->session_id = $session_id;
$this->author = $author;
$this->preview_image = $preview_image;
$this->items = $items;
}
$this->items = $items;
}
/**
* Get the items
*/
function get_items()
{
return $this->items;
}
/**
* Get the items
*/
function get_items()
{
return $this->items;
}
/**
* Check if a given resource is used as an item in this chapter
*/
function has_item($resource)
{
foreach ($this->items as $item) {
if ($item['id'] == $resource->get_id() &&
isset($item['type']) && $item['type'] == $resource->get_type()
) {
return true;
}
}
return false;
}
/**
* Check if a given resource is used as an item in this chapter
*/
function has_item($resource)
{
foreach ($this->items as $item) {
if ($item['id'] == $resource->get_id() &&
isset($item['type']) && $item['type'] == $resource->get_type()
) {
return true;
}
}
return false;
}
/**
* Show this learnpath
*/
function show() {
parent::show();
echo $this->name;
}
/**
* Show this learnpath
*/
function show()
{
parent::show();
echo $this->name;
}
}

@ -35,7 +35,7 @@ class CourseCopyTestCategory extends Resource
/**
* Show the test_category title, used in the partial recycle_course.php form
*/
function show()
public function show()
{
parent::show();
echo $this->title;

@ -117,5 +117,4 @@ class Forum extends Resource
parent::show();
echo $this->obj->forum_title;
}
}

@ -97,6 +97,14 @@ class QuizQuestion extends Resource
/**
* Add an answer to this QuizQuestion
* @param int $answer_id
* @param string $answer_text
* @param string $correct
* @param string $comment
* @param string $ponderation
* @param string $position
* @param string $hotspot_coordinates
* @param string $hotspot_type
*/
public function add_answer(
$answer_id,

@ -21,7 +21,7 @@ class ScormDocument extends Resource
*/
public function __construct($id, $path, $title)
{
parent::__construct($id,RESOURCE_SCORM);
parent::__construct($id, RESOURCE_SCORM);
$this->path = 'scorm'.$path;
$this->title = $title;
}

@ -80,7 +80,7 @@ class Survey extends Resource
* @param string $lang
* @param string $avail_from
* @param string $avail_till
* @param char $is_shared
* @param string $is_shared
* @param string $template
* @param string $intro
* @param string $surveythanks

@ -33,7 +33,7 @@ class SurveyInvitation extends Resource
/**
* Create a new SurveyInvitation
* @param int $id
* @param int $id
* @param string $code
* @param string $user
* @param string $invitation_code

@ -47,15 +47,15 @@ class SurveyQuestion extends Resource
/**
* Create a new SurveyQuestion
* @param int $id
* @param int $survey_id
* @param int $id
* @param int $survey_id
* @param string $survey_question
* @param string $survey_question_comment
* @param string $type
* @param string $display
* @param int $sort
* @param int $shared_question_id
* @param int $max_value
* @param int $sort
* @param int $shared_question_id
* @param int $max_value
*/
public function __construct(
$id,
@ -83,7 +83,7 @@ class SurveyQuestion extends Resource
/**
* Add an answer option to this SurveyQuestion
* @param string $option_text
* @param int $sort
* @param int $sort
*/
public function add_answer($option_text,$sort)
{

@ -35,8 +35,7 @@ class ToolIntro extends Resource
public function show()
{
parent::show();
switch ($this->id)
{
switch ($this->id) {
case TOOL_DOCUMENT:
$lang_id = 'Documents';
break;

@ -47,7 +47,7 @@ class Wiki extends Resource
$progress,
$version
) {
parent::__construct($id,RESOURCE_WIKI);
parent::__construct($id, RESOURCE_WIKI);
$this->id = $id;
$this->page_id = $page_id;
$this->reflink = $reflink;

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

@ -27,6 +27,7 @@ class FeatureContext extends MinkContext
$this->pressButton('submitAuth');
$this->getSession()->back();
}
/**
* @Given /^I am a session administrator$/
*/
@ -40,6 +41,7 @@ class FeatureContext extends MinkContext
]));
$this->pressButton('submitAuth');
}
/**
* @Given /^I am a teacher$/
*/
@ -51,6 +53,7 @@ class FeatureContext extends MinkContext
$this->fillField('password', 'mmosquera');
$this->pressButton('submitAuth');
}
/**
* @Given /^I am a teacher in course "([^"]*)"$/
* @Todo implement
@ -61,6 +64,7 @@ class FeatureContext extends MinkContext
//$result = ...
//if ($result !== false) { ... }
}
/**
* @Given /^I am a student$/
*/
@ -68,10 +72,11 @@ class FeatureContext extends MinkContext
{
$this->visit('/index.php?logout=logout');
$this->iAmOnHomepage();
$this->fillField('login', 'mbrandybuck');
$this->fillField('password', 'mbrandybuck');
$this->fillField('login', 'acostea');
$this->fillField('password', 'acostea');
$this->pressButton('submitAuth');
}
/**
* @Given /^I am an HR manager$/
*/
@ -83,6 +88,7 @@ class FeatureContext extends MinkContext
$this->fillField('password', 'ptook');
$this->pressButton('submitAuth');
}
/**
* @Given /^I am a student boss$/
*/
@ -94,6 +100,7 @@ class FeatureContext extends MinkContext
$this->fillField('password', 'abaggins');
$this->pressButton('submitAuth');
}
/**
* @Given /^I am an invitee$/
*/
@ -105,6 +112,7 @@ class FeatureContext extends MinkContext
$this->fillField('password', 'bproudfoot');
$this->pressButton('submitAuth');
}
/**
* @Given /^course "([^"]*)" exists$/
*/
@ -114,6 +122,7 @@ class FeatureContext extends MinkContext
$this->visit('/main/admin/course_list.php?keyword=' . $argument);
$this->assertPageContainsText($argument);
}
/**
* @Given /^course "([^"]*)" is deleted$/
*/
@ -123,6 +132,7 @@ class FeatureContext extends MinkContext
$this->visit('/main/admin/course_list.php?keyword=' . $argument);
$this->clickLink('Delete');
}
/**
* @Given /^I am in course "([^"]*)"$/
* @Todo redefine function to be different from I am on course TEMP homepage
@ -132,6 +142,7 @@ class FeatureContext extends MinkContext
$this->visit('/main/course_home/course_home.php?cDir=' . $argument);
$this->assertElementNotOnPage('.alert-danger');
}
/**
* @Given /^I am on course "([^"]*)" homepage$/
*/
@ -140,6 +151,7 @@ class FeatureContext extends MinkContext
$this->visit('/main/course_home/course_home.php?cDir=' . $argument);
$this->assertElementNotOnPage('.alert-danger');
}
/**
* @Given /^I am a "([^"]*)" user$/
*/
@ -243,6 +255,7 @@ class FeatureContext extends MinkContext
$this->selectOption('show_admin_toolbar', 'do_not_show');
$this->pressButton('submit');
}
/**
* @Given /^Admin top bar is enabled$/
*/
@ -277,8 +290,8 @@ class FeatureContext extends MinkContext
}
/**
* @Then /^I fill in ckeditor field "([^"]*)" with "([^"]*)"$/
*/
* @Then /^I fill in ckeditor field "([^"]*)" with "([^"]*)"$/
*/
public function iFillInWysiwygOnFieldWith($locator, $value)
{
// Just in case wait that ckeditor is loaded

@ -0,0 +1,20 @@
Feature: Profile page
A student should update his profile information.
Background:
Given I am a student
Scenario: Update profile with first name Andrew then restore Andrea
Given I am on "/main/auth/profile.php"
When I fill in the following:
| firstname | Andrew |
And I press "Save settings"
And wait for the page to be loaded
Then I should see "Your new profile has been saved"
And I should see "Andrew"
Then I fill in the following:
| firstname | Andrea |
And I press "Save settings"
Then I should see "Your new profile has been saved"
Then I am on "/main/social/home.php"
Then I should see "Andrea"

@ -0,0 +1,20 @@
Feature: User registration
In order to enter the system
I need to be able to create my account
Scenario: Enter the registration form
Given I am on the homepage
Then I should see "Sign up"
Then I follow "Sign up!"
Then I should see "Registration"
And I fill in the following:
| firstname | user registration first name |
| lastname | user registration last name |
| email | user-registration@example.com |
| official_code | user registration |
| username | user_registration |
| pass1 | user-registration |
| pass2 | user-registration |
And I press "Register"
And wait for the page to be loaded
Then I should see "Your personal settings have been registered"
Loading…
Cancel
Save