MDL-31561: Implemented fix for honoring correct number of course
sections
This commit is contained in:
@@ -80,9 +80,17 @@ abstract class cc_convert_moodle2 {
|
||||
if ($docp->load($moodle_backup)) {
|
||||
//sections
|
||||
$sections = array();
|
||||
$coursef = new XMLGenericDocument();
|
||||
$course_file = $dir . DIRECTORY_SEPARATOR .'course' . DIRECTORY_SEPARATOR . 'course.xml';
|
||||
$coursef->load($course_file);
|
||||
$numsections = (int)$coursef->nodeValue('/course/numsections');
|
||||
$section_list = $docp->nodeList('/moodle_backup/information/contents/sections/section');
|
||||
if (!empty($section_list)) {
|
||||
$count = 0;
|
||||
foreach ($section_list as $node) {
|
||||
if ($count > $numsections) {
|
||||
break;
|
||||
}
|
||||
$sectionid = $docp->nodeValue('sectionid', $node);
|
||||
$sectiontitle = $docp->nodeValue('title' , $node);
|
||||
$sectionpath = $docp->nodeValue('directory', $node);
|
||||
@@ -92,7 +100,7 @@ abstract class cc_convert_moodle2 {
|
||||
DIRECTORY_SEPARATOR .
|
||||
$sectionpath .
|
||||
DIRECTORY_SEPARATOR .
|
||||
'section.xml';
|
||||
'section.xml';
|
||||
if ($secp->load($section_file)) {
|
||||
$rawvalue = $secp->nodeValue('/section/sequence');
|
||||
if ($rawvalue != '$@NULL@$') {
|
||||
@@ -100,6 +108,7 @@ abstract class cc_convert_moodle2 {
|
||||
}
|
||||
}
|
||||
$sections[$sectionid] = array($sectiontitle, $sequence);
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
//organization title
|
||||
|
||||
@@ -183,20 +183,14 @@ class cc_resource implements cc_i_resource {
|
||||
throw new Exception('The file doesnt exist!');
|
||||
}
|
||||
|
||||
//TODO: ver el tema de fpatch con el tema de unix y windows
|
||||
//$fpathtocheck = $this->adjust_path($manifestroot,$fname);
|
||||
//!empty($fpathtocheck) &&
|
||||
if (GetDepFiles($manifestroot, $fname, $this->folder, $this->files)) {
|
||||
array_unshift($this->files,$folder.$fname);
|
||||
$this->init_empty_new();
|
||||
$this->href = $folder.$fname;
|
||||
$this->identifierref = $folder.$fname;
|
||||
$this->filename = $fname;
|
||||
$this->isempty = false;
|
||||
$this->folder = $folder;
|
||||
} else {
|
||||
$this->init_clean();
|
||||
}
|
||||
GetDepFiles($manifestroot, $fname, $this->folder, $this->files);
|
||||
array_unshift($this->files,$folder.$fname);
|
||||
$this->init_empty_new();
|
||||
$this->href = $folder.$fname;
|
||||
$this->identifierref = $folder.$fname;
|
||||
$this->filename = $fname;
|
||||
$this->isempty = false;
|
||||
$this->folder = $folder;
|
||||
}
|
||||
|
||||
public function adjust_path($mroot, $fname) {
|
||||
|
||||
Reference in New Issue
Block a user