/** * Clone course files * * @access public * @static * * @param int source id * @param int target_id */ public static function _cloneFiles($a_source_id, $a_target_id) { $source = new ilFSStorageCourse($a_source_id); foreach (ilCourseFile::_readFilesByCourse($a_source_id) as $file_obj) { $new_file = new ilCourseFile(); $new_file->setCourseId($a_target_id); $new_file->setFileName($file_obj->getFileName()); $new_file->setFileSize($file_obj->getFileSize()); $new_file->setFileType($file_obj->getFileType()); $new_file->create(false); $target = new ilFSStorageCourse($a_target_id); $target->initInfoDirectory(); $source->copyFile($file_obj->getAbsolutePath(), $new_file->getAbsolutePath()); } }
/** * Edit info page informations * * @access public * */ public function editInfoObject(ilPropertyFormGUI $a_form = null) { include_once 'Modules/Course/classes/class.ilCourseFile.php'; global $ilErr, $ilAccess; $this->checkPermission('write'); /* if(!$ilAccess->checkAccess('write','',$this->object->getRefId())) { $ilErr->raiseError($this->lng->txt('msg_no_perm_read'),$ilErr->MESSAGE); } */ $this->setSubTabs('properties'); $this->tabs_gui->setTabActive('settings'); $this->tabs_gui->setSubTabActive('crs_info_settings'); if (!$a_form) { $a_form = $this->initInfoEditor(); } $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.edit_info.html', 'Modules/Course'); $this->tpl->setVariable('INFO_TABLE', $a_form->getHTML()); if (!count($files = ilCourseFile::_readFilesByCourse($this->object->getId()))) { return true; } $rows = array(); foreach ($files as $file) { $table_data['id'] = $file->getFileId(); $table_data['filename'] = $file->getFileName(); $table_data['filetype'] = $file->getFileType(); $table_data['filesize'] = $file->getFileSize(); $rows[] = $table_data; } include_once "./Modules/Course/classes/class.ilCourseInfoFileTableGUI.php"; $table_gui = new ilCourseInfoFileTableGUI($this, "edit"); $table_gui->setTitle($this->lng->txt("crs_info_download")); $table_gui->setData($rows); $table_gui->addCommandButton("cancel", $this->lng->txt("cancel")); $table_gui->addMultiCommand("confirmDeleteInfoFiles", $this->lng->txt("delete")); $table_gui->setSelectAllCheckbox("file_id"); $this->tpl->setVariable('INFO_FILE_TABLE', $table_gui->getHTML()); return true; }