4 require_once(
"./Services/Preview/classes/class.ilPreviewSettings.php");
5 require_once(
"./Services/Preview/classes/class.ilFSStoragePreview.php");
71 $this->obj_id = $a_obj_id;
87 return $preview->create($a_obj, $a_force);
114 $status = $src->getRenderStatus();
117 if ($status == self::RENDER_STATUS_CREATED)
121 $dest->setRenderDate($src->getRenderDate());
122 $dest->setRenderStatus($src->getRenderStatus());
125 $dest->getStorage()->create();
128 ilUtil::rCopy($src->getStoragePath(), $dest->getStoragePath());
159 require_once(
"./Services/Preview/classes/class.ilRendererFactory.php");
161 return $renderer != null;
193 public function create($a_obj, $a_force =
false)
199 require_once(
"./Services/Preview/classes/class.ilRendererFactory.php");
203 if ($renderer == null)
215 if ($this->
getRenderStatus() == self::RENDER_STATUS_CREATED && !$a_force)
227 $renderer->render($this, $a_obj,
true);
238 public function delete()
249 $this->render_date =
false;
250 $this->render_status = self::RENDER_STATUS_NONE;
268 if ($handle = @opendir(
$path))
270 while (
false !== (
$file = readdir($handle)))
273 if (!is_file($filepath))
282 $size = @getimagesize($filepath);
285 $image[
"width"] =
$size[0];
286 $image[
"height"] =
$size[1];
289 $images[
$file] = $image;
338 $set = $ilDB->queryF(
339 "SELECT * FROM preview_data WHERE obj_id=%s",
343 while ($rec = $ilDB->fetchAssoc($set))
376 "DELETE FROM preview_data WHERE obj_id=%s",
399 if (empty($this->obj_type))
422 return ILIAS_ABSOLUTE_PATH . substr($this->
getStorage()->getPath(), 1);
434 return $path .
"/" . self::FILENAME_FORMAT;
454 $this->render_date = $a_date;
474 $this->render_status = $a_status;
484 if ($this->storage == null)
__construct($a_obj_id, $a_type="")
Creates a new ilPreview.
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
const RENDER_STATUS_FAILED
getObjType()
Gets the type of the object the preview is for.
exists()
Determines whether the preview exists or not.
getAbsoluteStoragePath()
Gets the absolute path where the previews are stored.
const RENDER_STATUS_PENDING
getFilePathFormat()
Gets the absolute file path for preview images that contains a placeholder in the file name ('%02d') ...
doCreate()
Create entry in database.
static lookupRenderStatus($a_obj_id)
Gets the render status for the object with the specified id.
init()
Initializes the preview object.
static getRenderer($preview)
Gets the renderer that is able to create a preview for the specified preview object.
static hasPreview($a_obj_id, $a_type="")
Determines whether the object with the specified reference id has a preview.
static createPreview($a_obj, $a_force=false)
Creates the preview for the object with the specified id.
static removeTrailingPathSeparators($path)
getRenderStatus()
Gets the status of the rendering process.
static getHtmlPath($relative_path)
get url of path
static isPreviewEnabled()
Gets whether the preview functionality is enabled.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
const RENDER_STATUS_CREATED
doRead()
Read data from database.
getObjId()
Gets the id of the object the preview is for.
static copyPreviews($a_src_id, $a_dest_id)
Copies the preview images from one preview to a new preview object.
doDelete()
Delete data from database.
doUpdate()
Update data in database.
setRenderStatus($a_status)
Sets the status of the rendering process.
getRenderDate()
Gets the date when the preview was rendered.
getStoragePath()
Gets the path where the previews are stored relative to the web directory.
static deletePreview($a_obj_id)
Deletes the preview for the object with the specified id.
setRenderDate($a_date)
Sets the date when the preview was rendered.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
save()
Saves the preview data to the database.
getImages()
Gets an array of preview images.
getStorage()
Gets the storage object for the preview.
create($a_obj, $a_force=false)
Creates the preview.