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)) { 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;

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

@ -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();
} }

@ -739,6 +739,12 @@ class UserManager
TicketManager::deleteUserFromTicketSystem($user_id); 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 // Delete user from database
$sql = "DELETE FROM $table_user WHERE id = '".$user_id."'"; $sql = "DELETE FROM $table_user WHERE id = '".$user_id."'";
Database::query($sql); Database::query($sql);

@ -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

@ -21,10 +21,14 @@ class CourseSelectForm
* Display the form * Display the form
* @param array $course * @param array $course
* @param array $hidden_fields Hidden fields to add to the form. * @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; global $charset;
$resource_titles[RESOURCE_ASSET] = get_lang('Assets'); $resource_titles[RESOURCE_ASSET] = get_lang('Assets');
$resource_titles[RESOURCE_GRADEBOOK] = get_lang('Gradebook'); $resource_titles[RESOURCE_GRADEBOOK] = get_lang('Gradebook');
@ -142,7 +146,7 @@ class CourseSelectForm
</script> </script>
<?php <?php
// get destination course title // 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; $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']); $course_infos = CourseManager::get_course_information($hidden_fields['destination_course']);
echo '<h3>'; echo '<h3>';
@ -259,11 +263,9 @@ class CourseSelectForm
foreach ($forum_categories as $forum_category_id => $forum_category) { foreach ($forum_categories as $forum_category_id => $forum_category) {
echo '<li>'; echo '<li>';
echo '<label class="checkbox">'; 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.']" /> '; 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(); $forum_category->show();
echo '</label>'; echo '</label>';
echo '</li>'; echo '</li>';
if (isset($forums[$forum_category_id])) { if (isset($forums[$forum_category_id])) {
@ -394,7 +396,6 @@ class CourseSelectForm
public static function get_posted_course($from = '', $session_id = 0, $course_code = '') public static function get_posted_course($from = '', $session_id = 0, $course_code = '')
{ {
$course = null; $course = null;
if (isset($_POST['course'])) { if (isset($_POST['course'])) {
$course = Course::unserialize(base64_decode($_POST['course'])); $course = Course::unserialize(base64_decode($_POST['course']));
} else { } else {

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

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

@ -84,120 +84,119 @@ class CourseCopyLearnpath extends Resource
*/ */
public $author; public $author;
/** /**
* Author's image * Author's image
*/ */
public $preview_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;
$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
/** */
* Get the items function get_items()
*/ {
function get_items() return $this->items;
{ }
return $this->items;
}
/** /**
* Check if a given resource is used as an item in this chapter * Check if a given resource is used as an item in this chapter
*/ */
function has_item($resource) function has_item($resource)
{ {
foreach ($this->items as $item) { foreach ($this->items as $item) {
if ($item['id'] == $resource->get_id() && if ($item['id'] == $resource->get_id() &&
isset($item['type']) && $item['type'] == $resource->get_type() isset($item['type']) && $item['type'] == $resource->get_type()
) { ) {
return true; return true;
} }
} }
return false; return false;
} }
/** /**
* Show this learnpath * Show this learnpath
*/ */
function show() { function show()
parent::show(); {
echo $this->name; 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 * Show the test_category title, used in the partial recycle_course.php form
*/ */
function show() public function show()
{ {
parent::show(); parent::show();
echo $this->title; echo $this->title;

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

@ -97,6 +97,14 @@ class QuizQuestion extends Resource
/** /**
* Add an answer to this QuizQuestion * 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( public function add_answer(
$answer_id, $answer_id,

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

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

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

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

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

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

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

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