ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilPreviewSettings Class Reference
+ Collaboration diagram for ilPreviewSettings:

Static Public Member Functions

static setPreviewEnabled ($a_value)
 Sets whether the preview functionality is enabled.
static isPreviewEnabled ()
 Gets whether the preview functionality is enabled.
static setMaximumPreviews ($a_value)
 Sets the maximum number of preview pictures per object.
static getMaximumPreviews ()
 Gets the maximum number of preview pictures per object.
static setImageSize ($a_value)
 Sets the size of the preview images in pixels.
static getImageSize ()
 Gets the size of the preview images in pixels.
static setImageQuality ($a_value)
 Sets the quality (compression) of the preview images (1-100).
static getImageQuality ()
 Gets the quality (compression) of the preview images (1-100).

Data Fields

const MAX_PREVIEWS_DEFAULT = 5
const MAX_PREVIEWS_MIN = 1
const MAX_PREVIEWS_MAX = 20
const IMAGE_SIZE_DEFAULT = 280
const IMAGE_SIZE_MIN = 50
const IMAGE_SIZE_MAX = 600
const IMAGE_QUALITY_DEFAULT = 85
const IMAGE_QUALITY_MIN = 20
const IMAGE_QUALITY_MAX = 100

Private Member Functions

 __construct ()
 Private constructor.

Static Private Member Functions

static getInstance ()
 Gets the instance of the ilPreviewSettings.
static adjustNumeric ($value, $min, $max, $default)
 Adjusts the numeric value to fit between the specified minimum and maximum.

Private Attributes

 $settings = null
 $preview_enabled = true
 $max_previews = self::MAX_PREVIEWS_DEFAULT
 $image_size = self::IMAGE_SIZE_DEFAULT
 $image_quality = self::IMAGE_QUALITY_DEFAULT

Static Private Attributes

static $instance = null

Detailed Description

Definition at line 13 of file class.ilPreviewSettings.php.

Constructor & Destructor Documentation

ilPreviewSettings::__construct ( )
private

Private constructor.

Definition at line 66 of file class.ilPreviewSettings.php.

{
$this->settings = new ilSetting("preview");
$this->preview_enabled = $this->settings->get('preview_enabled', false) == true;
$this->max_previews = $this->settings->get('max_previews_per_object', self::MAX_PREVIEWS_DEFAULT);
}

Member Function Documentation

static ilPreviewSettings::adjustNumeric (   $value,
  $min,
  $max,
  $default 
)
staticprivate

Adjusts the numeric value to fit between the specified minimum and maximum.

If the value is not numeric the default value is returned.

Parameters
object$valueThe value to adjust.
int$minThe allowed minimum (inclusive).
int$maxThe allowed maximum (inclusive).
int$defaultThe default value if the specified value is not numeric.
Returns
The adjusted value.

Definition at line 183 of file class.ilPreviewSettings.php.

Referenced by setImageQuality(), setImageSize(), and setMaximumPreviews().

{
// is number?
if (is_numeric($value))
{
// don't allow to large numbers
$value = (int)$value;
if ($value < $min)
$value = $min;
else if ($value > $max)
$value = $max;
}
else
{
$value = $default;
}
return $value;
}

+ Here is the caller graph for this function:

static ilPreviewSettings::getImageQuality ( )
static

Gets the quality (compression) of the preview images (1-100).

Returns
int The current value

Definition at line 156 of file class.ilPreviewSettings.php.

References getInstance().

{
return self::getInstance()->image_quality;
}

+ Here is the call graph for this function:

static ilPreviewSettings::getImageSize ( )
static

Gets the size of the preview images in pixels.

Returns
int The current value

Definition at line 134 of file class.ilPreviewSettings.php.

References getInstance().

Referenced by ilPreviewGUI\initPreview().

{
return self::getInstance()->image_size;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilPreviewSettings::getInstance ( )
staticprivate

Gets the instance of the ilPreviewSettings.

Returns
ilPreviewSettings

Definition at line 165 of file class.ilPreviewSettings.php.

References $instance.

Referenced by getImageQuality(), getImageSize(), getMaximumPreviews(), isPreviewEnabled(), setImageQuality(), setImageSize(), setMaximumPreviews(), and setPreviewEnabled().

{
if (self::$instance == null)
self::$instance = new ilPreviewSettings();
}

+ Here is the caller graph for this function:

static ilPreviewSettings::getMaximumPreviews ( )
static

Gets the maximum number of preview pictures per object.

Returns
int The current value

Definition at line 112 of file class.ilPreviewSettings.php.

References getInstance().

Referenced by ilObjFileAccessSettingsGUI\editPreviewSettings(), ilPreviewRenderer\getMaximumNumberOfPreviews(), and ilObjFileAccessSettingsGUI\initPreviewSettingsForm().

{
return self::getInstance()->max_previews;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilPreviewSettings::isPreviewEnabled ( )
static

Gets whether the preview functionality is enabled.

Returns
bool The current value

Definition at line 90 of file class.ilPreviewSettings.php.

References getInstance().

Referenced by ilPreview\copyPreviews(), ilPreview\create(), ilObjFileAccessSettingsGUI\editPreviewSettings(), ilPreview\hasPreview(), and ilObjFileAccessSettingsGUI\initPreviewSettingsForm().

{
return self::getInstance()->preview_enabled;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilPreviewSettings::setImageQuality (   $a_value)
static

Sets the quality (compression) of the preview images (1-100).

Parameters
int$a_valueThe new value

Definition at line 144 of file class.ilPreviewSettings.php.

References $instance, adjustNumeric(), and getInstance().

{
$instance->image_quality = self::adjustNumeric($a_value, self::IMAGE_QUALITY_MIN, self::IMAGE_QUALITY_MAX, self::IMAGE_QUALITY_DEFAULT);
$instance->settings->set('preview_image_quality', $instance->image_quality);
}

+ Here is the call graph for this function:

static ilPreviewSettings::setImageSize (   $a_value)
static

Sets the size of the preview images in pixels.

Parameters
int$a_valueThe new value

Definition at line 122 of file class.ilPreviewSettings.php.

References $instance, adjustNumeric(), and getInstance().

{
$instance->image_size = self::adjustNumeric($a_value, self::IMAGE_SIZE_MIN, self::IMAGE_SIZE_MAX, self::IMAGE_SIZE_DEFAULT);
$instance->settings->set('preview_image_size', $instance->image_size);
}

+ Here is the call graph for this function:

static ilPreviewSettings::setMaximumPreviews (   $a_value)
static

Sets the maximum number of preview pictures per object.

Parameters
int$a_valueThe new value

Definition at line 100 of file class.ilPreviewSettings.php.

References $instance, adjustNumeric(), and getInstance().

Referenced by ilObjFileAccessSettingsGUI\savePreviewSettings().

{
$instance->max_previews = self::adjustNumeric($a_value, self::MAX_PREVIEWS_MIN, self::MAX_PREVIEWS_MAX, self::MAX_PREVIEWS_DEFAULT);
$instance->settings->set('max_previews_per_object', $instance->max_previews);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilPreviewSettings::setPreviewEnabled (   $a_value)
static

Sets whether the preview functionality is enabled.

Parameters
bool$a_valueThe new value

Definition at line 78 of file class.ilPreviewSettings.php.

References $instance, and getInstance().

Referenced by ilObjFileAccessSettingsGUI\savePreviewSettings().

{
$instance->preview_enabled = $a_value == true;
$instance->settings->set('preview_enabled', $instance->preview_enabled);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilPreviewSettings::$image_quality = self::IMAGE_QUALITY_DEFAULT
private

Definition at line 61 of file class.ilPreviewSettings.php.

ilPreviewSettings::$image_size = self::IMAGE_SIZE_DEFAULT
private

Definition at line 55 of file class.ilPreviewSettings.php.

ilPreviewSettings::$instance = null
staticprivate
ilPreviewSettings::$max_previews = self::MAX_PREVIEWS_DEFAULT
private

Definition at line 49 of file class.ilPreviewSettings.php.

ilPreviewSettings::$preview_enabled = true
private

Definition at line 43 of file class.ilPreviewSettings.php.

ilPreviewSettings::$settings = null
private

Definition at line 37 of file class.ilPreviewSettings.php.

const ilPreviewSettings::IMAGE_QUALITY_DEFAULT = 85

Definition at line 23 of file class.ilPreviewSettings.php.

const ilPreviewSettings::IMAGE_QUALITY_MAX = 100

Definition at line 25 of file class.ilPreviewSettings.php.

const ilPreviewSettings::IMAGE_QUALITY_MIN = 20

Definition at line 24 of file class.ilPreviewSettings.php.

const ilPreviewSettings::IMAGE_SIZE_DEFAULT = 280

Definition at line 19 of file class.ilPreviewSettings.php.

const ilPreviewSettings::IMAGE_SIZE_MAX = 600

Definition at line 21 of file class.ilPreviewSettings.php.

const ilPreviewSettings::IMAGE_SIZE_MIN = 50

Definition at line 20 of file class.ilPreviewSettings.php.

const ilPreviewSettings::MAX_PREVIEWS_DEFAULT = 5

Definition at line 15 of file class.ilPreviewSettings.php.

const ilPreviewSettings::MAX_PREVIEWS_MAX = 20
const ilPreviewSettings::MAX_PREVIEWS_MIN = 1

Definition at line 16 of file class.ilPreviewSettings.php.


The documentation for this class was generated from the following file: