CMS  Version 3.9
ImageGridItem Class Reference

Public Member Functions

 __construct ($grid, $image_id, $title, $text, $onclick="return false;")
 
 draw ($size, $attrs)
 

Public Attributes

 $grid
 
 $item
 
 $id
 
 $image_id
 
 $title
 
 $text
 
 $onclick
 
 $cssClass = null
 

Detailed Description

Definition at line 9 of file image_grid.inc.

Constructor & Destructor Documentation

◆ __construct()

ImageGridItem::__construct (   $grid,
  $image_id,
  $title,
  $text,
  $onclick = "return false;" 
)

Definition at line 20 of file image_grid.inc.

21  {
22  $this->grid = $grid;
23  $this->image_id = $image_id;
24  $this->title = $title;
25  $this->text = $text;
26  $this->onclick = $onclick;
27  }
$bookmark title

Member Function Documentation

◆ draw()

ImageGridItem::draw (   $size,
  $attrs 
)

Definition at line 29 of file image_grid.inc.

30  {
31  $imageSize = $this->grid->retinaMode ? $size * 2 : $size;
32  $mode = $this->grid->useBackgroundImages ? "thumbnail" : "iconize";
33 
34  $src = $this->image_id ? "/action/image/{$mode}?image_id={$this->image_id}&size={$imageSize}" : "/fakoli/images/noimage.gif";
35 
36  $dataAttrs = "";
37  foreach($attrs as $name => $value)
38  {
39  $dataAttrs .= "$name='$value' ";
40  }
41 
42  $cssClass = $this->cssClass ? "class='{$this->cssClass}' " : "";
43 
44  if ($this->grid->useBackgroundImages)
45  {
46  $styles = $this->grid->inlineSizing ? "width: {$size}px; height: {$size}px; margin: 10px'" : "";
47 ?>
48  <li <?echo $cssClass?>data-details='<?echo $this->id?>' style='background-image: url(<?echo $src?>);background-size: cover;<?echo $styles?>' onclick='<?echo $this->onclick?>'><div class='title'><?echo $this->title?></div></li>
49 <?
50  }
51  else
52  {
53 ?>
54  <li <?echo $cssClass?>data-details='<?echo $this->id?>' <?echo $dataAttrs?>style='width: <?echo $size + 10?>px; height: <?echo $size + 40?>px; margin: 10px'><div onclick='<?echo $this->onclick?>' style='width: <?echo $size ?>px; height: <?echo $size + 40?>px'><img src="<?echo $src?>" alt="<?echo $this->title?>" style='width: <?echo $size?>px; height: <?echo $size?>px'></img><br/><?echo $this->title?></div></li>
55 <?
56  }
57  }
$table cssClass
$src
Definition: page.inc:37
$helpTree style
Definition: tree.inc:46
$size
Definition: download.inc:47
$name
Definition: upload.inc:54
$mode
$styles

Member Data Documentation

◆ $cssClass

ImageGridItem::$cssClass = null

Definition at line 18 of file image_grid.inc.

◆ $grid

ImageGridItem::$grid

Definition at line 11 of file image_grid.inc.

◆ $id

ImageGridItem::$id

Definition at line 13 of file image_grid.inc.

◆ $image_id

ImageGridItem::$image_id

Definition at line 14 of file image_grid.inc.

◆ $item

ImageGridItem::$item

Definition at line 12 of file image_grid.inc.

◆ $onclick

ImageGridItem::$onclick

Definition at line 17 of file image_grid.inc.

◆ $text

ImageGridItem::$text

Definition at line 16 of file image_grid.inc.

◆ $title

ImageGridItem::$title

Definition at line 15 of file image_grid.inc.


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