4require_once(
"./Services/Preview/classes/class.ilPreviewSettings.php");
 
    5require_once(
"./Services/Preview/classes/class.ilFSStoragePreview.php");
 
   71        $this->obj_id = $a_obj_id;
 
   87        return $preview->create($a_obj, $a_force);
 
  115        $status = $src->getRenderStatus();
 
  118        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)
 
  200        require_once(
"./Services/Preview/classes/class.ilRendererFactory.php");
 
  204        if ($renderer == 
null) {
 
  216        if ($this->
getRenderStatus() == self::RENDER_STATUS_CREATED && !$a_force) {
 
  228        $renderer->render($this, $a_obj, 
true);
 
  239    public function delete()
 
  249            $this->render_date = 
false;
 
  267            if ($handle = @opendir($path)) {
 
  268                while (
false !== ($file = readdir($handle))) {
 
  269                    $filepath = $path . 
"/" . $file;
 
  270                    if (!is_file($filepath)) {
 
  274                    if ($file != 
'.' && $file != 
'..' && strpos($file, 
"preview_") === 0) {
 
  279                        $size = @getimagesize($filepath);
 
  280                        if (
$size !== 
false) {
 
  281                            $image[
"width"] = 
$size[0];
 
  282                            $image[
"height"] = 
$size[1];
 
  285                        $images[$file] = $image;
 
  321                "obj_id" => array(
"integer", $this->
getObjId()),
 
  337        $set = 
$ilDB->queryF(
 
  338            "SELECT * FROM preview_data WHERE obj_id=%s",
 
  343        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
  364            array(
"obj_id" => array(
"integer", $this->
getObjId()))
 
  377            "DELETE FROM preview_data WHERE obj_id=%s",
 
  401        if (empty($this->obj_type)) {
 
  425        return ILIAS_ABSOLUTE_PATH . substr($this->
getStorage()->getPath(), 1);
 
  457        $this->render_date = $a_date;
 
  477        $this->render_status = $a_status;
 
  487        if ($this->storage == 
null) {
 
An exception for terminatinating execution or to throw for unit testing.
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)