Example #1
0
 public function generate_node()
 {
     cc2moodle::log_action('Creating Forum mods');
     $response = '';
     if (!empty(cc2moodle::$instances['instances'][MOODLE_TYPE_FORUM])) {
         foreach (cc2moodle::$instances['instances'][MOODLE_TYPE_FORUM] as $instance) {
             $response .= $this->create_node_course_modules_mod_forum($instance);
         }
     }
     return $response;
 }
 public function generate_node()
 {
     cc2moodle::log_action('Creating BasicLTI mods');
     $response = '';
     if (!empty(cc2moodle::$instances['instances'][MOODLE_TYPE_BASICLTI])) {
         foreach (cc2moodle::$instances['instances'][MOODLE_TYPE_BASICLTI] as $instance) {
             $response .= $this->create_node_course_modules_mod_basiclti($instance);
         }
     }
     return $response;
 }
 public function generate_node()
 {
     cc2moodle::log_action('Creating Resource mods');
     $response = '';
     $sheet_mod_resource = cc2moodle::loadsheet(SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_RESOURCE);
     if (!empty(cc2moodle::$instances['instances'][MOODLE_TYPE_RESOURCE])) {
         foreach (cc2moodle::$instances['instances'][MOODLE_TYPE_RESOURCE] as $instance) {
             $response .= $this->create_node_course_modules_mod_resource($sheet_mod_resource, $instance);
         }
     }
     return $response;
 }
Example #4
0
 public function generate_node()
 {
     cc2moodle::log_action('Creating Labels mods');
     $response = '';
     $sheet_mod_label = cc2moodle::loadsheet(SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_LABEL);
     if (!empty(cc2moodle::$instances['instances'][MOODLE_TYPE_LABEL])) {
         foreach (cc2moodle::$instances['instances'][MOODLE_TYPE_LABEL] as $instance) {
             $response .= $this->create_node_course_modules_mod_label($sheet_mod_label, $instance);
         }
     }
     return $response;
 }
Example #5
0
 public function generate_node_course_modules_mod()
 {
     cc2moodle::log_action('Creating Quiz mods');
     $node_course_modules_mod = '';
     $instances = $this->generate_instances();
     if (!empty($instances)) {
         foreach ($instances as $instance) {
             if ($instance['is_question_bank'] == 0) {
                 $node_course_modules_mod .= $this->create_node_course_modules_mod($instance);
             }
         }
     }
     return $node_course_modules_mod;
 }
Example #6
0
 public function move_files($files, $destination_folder)
 {
     global $CFG;
     if (!empty($files)) {
         foreach ($files as $file) {
             $source = cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $file->nodeValue;
             $destination = $destination_folder . DIRECTORY_SEPARATOR . $file->nodeValue;
             $destination_directory = dirname($destination);
             cc2moodle::log_action('Copy the file: ' . $source . ' to ' . $destination);
             //echo 'Copy the file: ' . $source . ' to ' . $destination . '<br>';
             if (!file_exists($destination_directory)) {
                 mkdir($destination_directory, $CFG->directorypermissions, true);
             }
             $copy_success = @copy($source, $destination);
             if (!$copy_success) {
                 notify('WARNING: Cannot copy the file ' . $source . ' to ' . $destination);
                 cc2moodle::log_action('Cannot copy the file ' . $source . ' to ' . $destination, false);
             }
         }
     }
 }