30 private \ILIAS\ResourceStorage\Services
$irss;
31 private \ILIAS\Filesystem\Util\Archive\Archives
$archives;
38 bool $a_call_by_reference =
true 43 $this->db = $DIC->database();
44 $this->irss = $DIC->resourceStorage();
45 $this->archives = $DIC->archives();
51 public function update(
bool $a_skip_meta =
false): bool
62 'rid' => [
'text', $this->
getRID() ??
'']
64 [
'id' => [
'integer', $this->
getId()]]
70 public function read(): void
74 $q =
"SELECT * FROM file_based_lm WHERE id = " . $this->db->quote($this->
getId(),
"integer");
76 $lm_rec = $this->db->fetchAssoc(
$lm_set);
77 $this->
setStartFile((
string) ($lm_rec[
"startfile"] ??
''));
78 $this->
setRID((
string) ($lm_rec[
"rid"] ??
''));
81 public function create(
bool $a_skip_meta =
false):
int 83 $id = parent::create();
86 $empty_zip = $this->archives->zip(
90 $rid = $this->irss->manageContainer()->containerFromStream(
95 $this->
setRID($rid->serialize());
100 'id' => [
'integer', $this->
getId()],
102 'rid' => [
'text', $this->
getRID()]
113 public function maybeDetermineStartFile():
bool 115 $valid_start_files = [
"index.htm",
"index.html",
"start.htm",
"start.html"];
118 if ($resource !==
null) {
119 $zip = $this->irss->consume()->containerZIP($resource->getIdentification())->getZIP();
120 foreach ($zip->getFiles() as $file) {
121 if (in_array(basename($file), $valid_start_files,
true)) {
148 bool $a_omit_file_check =
false 150 $this->start_file = $a_file;
163 $rid = $this->irss->manage()->find($this->
getRID());
167 return $this->irss->manage()->getResource($rid);
170 public function setRID(
string $rid): void
176 public function delete():
bool 179 if (!parent::delete()) {
187 $this->db->manipulateF(
188 "DELETE FROM file_based_lm WHERE id = %s",
208 string $a_filename =
"" 210 preg_match(
"/.*htlm_([0-9]*)\.zip/", $a_filename, $match);
211 if (is_dir($a_dir .
"/htlm_" . ($match[1] ??
""))) {
212 $a_dir .=
"/htlm_" . ($match[1] ??
"");
218 public function cloneObject(
int $target_id,
int $copy_id = 0,
bool $omit_tree =
false): ?
ilObject 221 $new_obj = parent::cloneObject($target_id, $copy_id, $omit_tree);
227 if (!$cp_options->isRootNode($this->getRefId())) {
230 $new_obj->setOfflineStatus(
true);
ILIAS ResourceStorage Services $irss
__construct(int $a_id=0, bool $a_call_by_reference=true)
ILIAS Filesystem Util Archive Archives $archives
update(bool $a_skip_meta=false)
getDataDirectory(string $mode="filesystem")
File Based Learning Module (HTML) object.
static rCopy(string $a_sdir, string $a_tdir, bool $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static renameExecutables(string $a_dir)
setStartFile(string $a_file, bool $a_omit_file_check=false)
static isInfoEnabled(int $obj_id)
cloneMetaData(ilObject $target_obj)
Copy meta data.
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
create(bool $a_skip_meta=false)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
__construct(Container $dic, ilPlugin $plugin)
static _getInstance(int $a_copy_id)
populateByDirectoy(string $a_dir, string $a_filename="")
Populate by directory.