ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilAccordionGUI Class Reference

Accordion user interface class. More...

+ Collaboration diagram for ilAccordionGUI:

Public Member Functions

 __construct ()
 Constructor.
 setOrientation ($a_orientation)
 Set Orientation.
 getOrientation ()
 Get Orientation.
 setContainerClass ($a_containerclass)
 Set Container CSS Class.
 getContainerClass ()
 Get Container CSS Class.
 setHeaderClass ($a_headerclass)
 Set Header CSS Class.
 getHeaderClass ()
 Get Header CSS Class.
 setContentClass ($a_contentclass)
 Set Content CSS Class.
 getContentClass ()
 Get Content CSS Class.
 setContentWidth ($a_contentwidth)
 Set ContentWidth.
 getContentWidth ()
 Get ContentWidth.
 setContentHeight ($a_contentheight)
 Set ContentHeight.
 getContentHeight ()
 Get ContentHeight.
 addItem ($a_header, $a_content)
 Add item.
 getItems ()
 Get all items.
 getHTML ()
 Get accordion html.

Static Public Member Functions

static addJavaScript ()
 Add javascript files that are necessary to run accordion.
static addCss ()
 Add required css.

Data Fields

const VERTICAL = "vertical"
const HORIZONTAL = "horizontal"

Protected Attributes

 $items = array()

Static Protected Attributes

static $accordion_cnt = 0

Detailed Description

Accordion user interface class.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id:$

Definition at line 11 of file class.ilAccordionGUI.php.

Constructor & Destructor Documentation

ilAccordionGUI::__construct ( )

Constructor.

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

References setOrientation(), and VERTICAL.

+ Here is the call graph for this function:

Member Function Documentation

static ilAccordionGUI::addCss ( )
static

Add required css.

Definition at line 167 of file class.ilAccordionGUI.php.

References $tpl.

Referenced by ilTableTemplatesTableGUI\__construct(), ilObjStyleSheetGUI\_getTemplatePreview(), getHTML(), ilPCTabsGUI\initForm(), ilLMPresentationGUI\layout(), and ilPageObjectGUI\showPage().

{
global $tpl;
$tpl->addCss("./Services/Accordion/css/accordion.css");
}

+ Here is the caller graph for this function:

ilAccordionGUI::addItem (   $a_header,
  $a_content 
)

Add item.

Definition at line 177 of file class.ilAccordionGUI.php.

{
$this->items[] = array("header" => $a_header,
"content" => $a_content);
}
static ilAccordionGUI::addJavaScript ( )
static

Add javascript files that are necessary to run accordion.

Definition at line 153 of file class.ilAccordionGUI.php.

References $tpl, ilYuiUtil\initAnimation(), ilYuiUtil\initDom(), and ilYuiUtil\initEvent().

Referenced by ilLMPresentationGUI\layout(), and ilPageObjectGUI\showPage().

{
global $tpl;
include_once("./Services/YUI/classes/class.ilYuiUtil.php");
$tpl->addJavaScript("./Services/Accordion/js/accordion.js", true, 3);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAccordionGUI::getContainerClass ( )

Get Container CSS Class.

Returns
string Container CSS Class

Definition at line 65 of file class.ilAccordionGUI.php.

Referenced by getHTML().

{
return $this->containerclass;
}

+ Here is the caller graph for this function:

ilAccordionGUI::getContentClass ( )

Get Content CSS Class.

Returns
string Content CSS Class

Definition at line 105 of file class.ilAccordionGUI.php.

Referenced by getHTML().

{
return $this->contentclass;
}

+ Here is the caller graph for this function:

ilAccordionGUI::getContentHeight ( )

Get ContentHeight.

Returns
integer ContentHeight

Definition at line 145 of file class.ilAccordionGUI.php.

Referenced by getHTML().

{
return $this->contentheight;
}

+ Here is the caller graph for this function:

ilAccordionGUI::getContentWidth ( )

Get ContentWidth.

Returns
integer ContentWidth

Definition at line 125 of file class.ilAccordionGUI.php.

Referenced by getHTML().

{
return $this->contentwidth;
}

+ Here is the caller graph for this function:

ilAccordionGUI::getHeaderClass ( )

Get Header CSS Class.

Returns
string Header CSS Class

Definition at line 85 of file class.ilAccordionGUI.php.

Referenced by getHTML().

{
return $this->headerclass;
}

+ Here is the caller graph for this function:

ilAccordionGUI::getHTML ( )

Get accordion html.

Definition at line 194 of file class.ilAccordionGUI.php.

References $tpl, addCss(), getContainerClass(), getContentClass(), getContentHeight(), getContentWidth(), getHeaderClass(), getItems(), getOrientation(), HORIZONTAL, and VERTICAL.

{
self::$accordion_cnt++;
$or_short = ($this->getOrientation() == ilAccordionGUI::HORIZONTAL)
? "H"
: "V";
$width = (int) $this->getContentWidth();
$height = (int) $this->getContentHeight();
{
if ($width == 0)
{
$width = 200;
}
if ($height == 0)
{
$height = 100;
}
}
$this->addJavascript();
$this->addCss();
$tpl = new ilTemplate("tpl.accordion.html", true, true, "Services/Accordion");
foreach ($this->getItems() as $item)
{
$tpl->setCurrentBlock("item");
$tpl->setVariable("HEADER", $item["header"]);
$tpl->setVariable("CONTENT", $item["content"]);
$tpl->setVariable("HEADER_CLASS", $this->getHeaderClass()
? $this->getHeaderClass() : "il_".$or_short."AccordionHead");
$tpl->setVariable("CONTENT_CLASS", $this->getContentClass()
? $this->getContentClass() : "il_".$or_short."AccordionContent");
$tpl->setVariable("OR_SHORT", $or_short);
if ($height > 0)
{
$tpl->setVariable("HEIGHT", "height:".$height."px;");
}
if ($height > 0 && $this->getOrientation() == ilAccordionGUI::HORIZONTAL)
{
$tpl->setVariable("HHEIGHT", "height:".$height."px;");
}
$tpl->parseCurrentBlock();
}
$tpl->setVariable("CNT", self::$accordion_cnt);
$tpl->setVariable("CONTAINER_CLASS", $this->getContainerClass()
? $this->getContainerClass() : "il_".$or_short."AccordionContainer");
$tpl->setVariable("ORIENTATION", $this->getOrientation());
$tpl->setVariable("OR2_SHORT", $or_short);
if ($width > 0)
{
$tpl->setVariable("WIDTH", $width);
}
else
{
$tpl->setVariable("WIDTH", "null");
}
if ($width > 0 && $this->getOrientation() == ilAccordionGUI::VERTICAL)
{
$tpl->setVariable("CWIDTH", 'style="width:'.$width.'px;"');
}
return $tpl->get();
}

+ Here is the call graph for this function:

ilAccordionGUI::getItems ( )

Get all items.

Definition at line 186 of file class.ilAccordionGUI.php.

References $items.

Referenced by getHTML().

{
return $this->items;
}

+ Here is the caller graph for this function:

ilAccordionGUI::getOrientation ( )

Get Orientation.

Returns
string Orientation

Definition at line 45 of file class.ilAccordionGUI.php.

Referenced by getHTML().

{
return $this->orientation;
}

+ Here is the caller graph for this function:

ilAccordionGUI::setContainerClass (   $a_containerclass)

Set Container CSS Class.

Parameters
string$a_containerclassContainer CSS Class

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

{
$this->containerclass = $a_containerclass;
}
ilAccordionGUI::setContentClass (   $a_contentclass)

Set Content CSS Class.

Parameters
string$a_contentclassContent CSS Class

Definition at line 95 of file class.ilAccordionGUI.php.

{
$this->contentclass = $a_contentclass;
}
ilAccordionGUI::setContentHeight (   $a_contentheight)

Set ContentHeight.

Parameters
integer$a_contentheightContentHeight

Definition at line 135 of file class.ilAccordionGUI.php.

{
$this->contentheight = $a_contentheight;
}
ilAccordionGUI::setContentWidth (   $a_contentwidth)

Set ContentWidth.

Parameters
integer$a_contentwidthContentWidth

Definition at line 115 of file class.ilAccordionGUI.php.

{
$this->contentwidth = $a_contentwidth;
}
ilAccordionGUI::setHeaderClass (   $a_headerclass)

Set Header CSS Class.

Parameters
string$a_headerclassHeader CSS Class

Definition at line 75 of file class.ilAccordionGUI.php.

{
$this->headerclass = $a_headerclass;
}
ilAccordionGUI::setOrientation (   $a_orientation)

Set Orientation.

Parameters
string$a_orientationOrientation

Definition at line 31 of file class.ilAccordionGUI.php.

References HORIZONTAL, and VERTICAL.

Referenced by __construct().

{
if (in_array($a_orientation,
{
$this->orientation = $a_orientation;
}
}

+ Here is the caller graph for this function:

Field Documentation

ilAccordionGUI::$accordion_cnt = 0
staticprotected

Definition at line 14 of file class.ilAccordionGUI.php.

ilAccordionGUI::$items = array()
protected

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

Referenced by getItems().

const ilAccordionGUI::HORIZONTAL = "horizontal"
const ilAccordionGUI::VERTICAL = "vertical"

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