4require_once(
"./Services/Preview/classes/class.ilPreviewSettings.php");
5require_once(
"./Services/Preview/classes/class.ilFSStoragePreview.php");
71 $this->obj_id = $a_obj_id;
72 $this->obj_type = $a_type;
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)
211 if ($this->
getRenderStatus() == self::RENDER_STATUS_CREATED && !$a_force)
214 if ($a_obj->getLastUpdateDate() <= $this->getRenderDate())
223 $renderer->render($this, $a_obj,
true);
234 public function delete()
245 $this->render_date =
false;
264 if ($handle = @opendir(
$path))
266 while (
false !== (
$file = readdir($handle)))
269 if (!is_file($filepath))
278 $size = @getimagesize($filepath);
281 $image[
"width"] =
$size[0];
282 $image[
"height"] =
$size[1];
285 $images[
$file] = $image;
319 "obj_id" => array(
"integer", $this->
getObjId()),
334 $set =
$ilDB->queryF(
335 "SELECT * FROM preview_data WHERE obj_id=%s",
339 while ($rec =
$ilDB->fetchAssoc($set))
360 array(
"obj_id" => array(
"integer", $this->
getObjId()))
372 "DELETE FROM preview_data WHERE obj_id=%s",
395 if (empty($this->obj_type))
450 $this->render_date = $a_date;
470 $this->render_status = $a_status;
480 if ($this->storage ==
null)
static _lookupType($a_id, $a_reference=false)
lookup object type
static isPreviewEnabled()
Gets whether the preview functionality is enabled.
setRenderStatus($a_status)
Sets the status of the rendering process.
getFilePathFormat()
Gets the absolute file path for preview images that contains a placeholder in the file name ('%02d') ...
doUpdate()
Update data in database.
init()
Initializes the preview object.
static copyPreviews($a_src_id, $a_dest_id)
Copies the preview images from one preview to a new preview object.
static hasPreview($a_obj_id, $a_type="")
Determines whether the object with the specified reference id has a preview.
create($a_obj, $a_force=false)
Creates the preview.
doRead()
Read data from database.
static deletePreview($a_obj_id)
Deletes the preview for the object with the specified id.
getAbsoluteStoragePath()
Gets the absolute path where the previews are stored.
save()
Saves the preview data to the database.
exists()
Determines whether the preview exists or not.
__construct($a_obj_id, $a_type="")
Creates a new ilPreview.
getStorage()
Gets the storage object for the preview.
static createPreview($a_obj, $a_force=false)
Creates the preview for the object with the specified id.
getRenderStatus()
Gets the status of the rendering process.
setRenderDate($a_date)
Sets the date when the preview was rendered.
getImages()
Gets an array of preview images.
doDelete()
Delete data from database.
static lookupRenderStatus($a_obj_id)
Gets the render status for the object with the specified id.
const RENDER_STATUS_FAILED
const RENDER_STATUS_CREATED
doCreate()
Create entry in database.
getStoragePath()
Gets the path where the previews are stored relative to the web directory.
getObjType()
Gets the type of the object the preview is for.
getObjId()
Gets the id of the object the preview is for.
getRenderDate()
Gets the date when the preview was rendered.
const RENDER_STATUS_PENDING
static getRenderer($preview)
Gets the renderer that is able to create a preview for the specified preview object.
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static getHtmlPath($relative_path)
get url of path
static removeTrailingPathSeparators($path)
const ILIAS_ABSOLUTE_PATH