ILIAS  Release_5_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.
 setId ($a_val)
 Set id.
 getId ()
 Get id.
 setOrientation ($a_orientation)
 Set Orientation.
 getOrientation ()
 Get Orientation.
 setContainerClass ($a_containerclass)
 Set Container CSS Class.
 getContainerClass ()
 Get Container CSS Class.
 setInnerContainerClass ($a_containerclass)
 Set inner Container CSS Class.
 getInnerContainerClass ()
 Get inner Container CSS Class.
 setHeaderClass ($a_headerclass)
 Set Header CSS Class.
 getHeaderClass ()
 Get Header CSS Class.
 setActiveHeaderClass ($a_h_class)
 Set active header class.
 getActiveHeaderClass ()
 Get active 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.
 setBehaviour ($a_val)
 Set behaviour "ForceAllOpen" | "FirstOpen" | "AllClosed".
 getBehaviour ()
 Get behaviour.
 setUseSessionStorage ($a_val)
 Set use session storage.
 getUseSessionStorage ()
 Get use session storage.
 setAllowMultiOpened ($a_val)
 Set allow multi opened.
 getAllowMultiOpened ()
 Get allow multi opened.
 setShowAllElement ($a_val)
 Set show all element.
 getShowAllElement ()
 Get show all element.
 setHideAllElement ($a_val)
 Set hide all element.
 getHideAllElement ()
 Get hide all element.
 addItem ($a_header, $a_content, $a_force_open=false)
 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"
const FORCE_ALL_OPEN = "ForceAllOpen"
const FIRST_OPEN = "FirstOpen"
const ALL_CLOSED = "AllClosed"

Protected Attributes

 $items = array()
 $force_open = array()
 $use_session_storage = false
 $allow_multi_opened = false
 $show_all_element = null
 $hide_all_element = null

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 30 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 338 of file class.ilAccordionGUI.php.

References $tpl.

Referenced by ilTableTemplatesTableGUI\__construct(), ilObjStyleSheetGUI\_getTemplatePreview(), getHTML(), ilPCIIMTriggerEditorGUI\getImageMapTableHTML(), 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,
  $a_force_open = false 
)

Add item.

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

References $items.

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

Add javascript files that are necessary to run accordion.

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

References $tpl, ilYuiUtil\initConnection(), and iljQueryUtil\initjQueryUI().

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

{
global $tpl;
include_once("./Services/YUI/classes/class.ilYuiUtil.php");
include_once("./Services/jQuery/classes/class.iljQueryUtil.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::getActiveHeaderClass ( )

Get active Header CSS Class.

Returns
string Active header CSS Class

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

Referenced by getHTML().

{
return $this->active_headerclass;
}

+ Here is the caller graph for this function:

ilAccordionGUI::getAllowMultiOpened ( )

Get allow multi opened.

Returns
bool allow multiple accordions being opened

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

References $allow_multi_opened.

Referenced by getHTML().

+ Here is the caller graph for this function:

ilAccordionGUI::getBehaviour ( )

Get behaviour.

Returns

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

Referenced by getHTML().

{
return $this->behaviour;
}

+ Here is the caller graph for this function:

ilAccordionGUI::getContainerClass ( )

Get Container CSS Class.

Returns
string Container CSS Class

Definition at line 94 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 174 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 214 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 194 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 134 of file class.ilAccordionGUI.php.

Referenced by getHTML().

{
return $this->headerclass;
}

+ Here is the caller graph for this function:

ilAccordionGUI::getHideAllElement ( )

Get hide all element.

Returns
string ID of hide all html element

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

References $hide_all_element.

Referenced by getHTML().

+ Here is the caller graph for this function:

ilAccordionGUI::getHTML ( )

Get accordion html.

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

References $accordion_cnt, $ilUser, $options, $tpl, addCss(), ilJsonUtil\encode(), getActiveHeaderClass(), getAllowMultiOpened(), getBehaviour(), getContainerClass(), getContentClass(), getContentHeight(), getContentWidth(), getHeaderClass(), getHideAllElement(), getId(), getInnerContainerClass(), getItems(), getOrientation(), getShowAllElement(), getUseSessionStorage(), HORIZONTAL, and VERTICAL.

{
global $ilUser;
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");
if ($this->getBehaviour() != self::FORCE_ALL_OPEN)
{
$tpl->setVariable("HIDE_CONTENT_CLASS", "ilAccHideContent");
}
$tpl->setVariable("OR_SHORT", $or_short);
$tpl->setVariable("INNER_CONTAINER_CLASS", $this->getInnerContainerClass()
? $this->getInnerContainerClass() : "il_".$or_short."AccordionInnerContainer");
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("CONTAINER_CLASS", $this->getContainerClass()
? $this->getContainerClass() : "il_".$or_short."AccordionContainer");
$options["orientation"] = $this->getOrientation();
$options["int_id"] = $this->getId();
if ($this->getUseSessionStorage() && $this->getId() != "")
{
include_once("./Services/Accordion/classes/class.ilAccordionPropertiesStorage.php");
$ctab = $stor->getProperty($this->getId(), $ilUser->getId(),
"opened");
$ctab_arr = explode(";", $ctab);
foreach ($this->force_open as $fo)
{
if (!in_array($fo, $ctab_arr))
{
$ctab_arr[] = $fo;
}
}
$ctab = implode(";", $ctab_arr);
if ($ctab == "0") {
$ctab = "";
}
$options["initial_opened"] = $ctab;
$options["save_url"] = "./ilias.php?baseClass=ilaccordionpropertiesstorage&cmd=setOpenedTab".
"&accordion_id=".$this->getId()."&user_id=".$ilUser->getId();
}
$options["behaviour"] = $this->getBehaviour();
{
$options["toggle_class"] = 'il_HAccordionToggleDef';
$options["toggle_act_class"] = 'il_HAccordionToggleActiveDef';
$options["content_class"] = 'il_HAccordionContentDef';
}
else
{
$options["toggle_class"] = 'il_VAccordionToggleDef';
$options["toggle_act_class"] = 'il_VAccordionToggleActiveDef';
$options["content_class"] = 'il_VAccordionContentDef';
}
if ($width > 0)
{
$options["width"] = $width;
}
else
{
$options["width"] = null;
}
if ($width > 0 && $this->getOrientation() == ilAccordionGUI::VERTICAL)
{
$tpl->setVariable("CWIDTH", 'style="width:'.$width.'px;"');
}
if ($this->head_class_set)
{
$options["active_head_class"] = $this->getActiveHeaderClass();
}
else
{
{
$options["active_head_class"] = "il_HAccordionHeadActive";
}
else
{
$options["active_head_class"] = "il_VAccordionHeadActive";
}
}
$options["height"] = null;
$options["id"] = 'accordion_'.$this->getId().'_'.self::$accordion_cnt;
$options["multi"] = (bool) $this->getAllowMultiOpened();
$options["show_all_element"] = $this->getShowAllElement();
$options["hide_all_element"] = $this->getHideAllElement();
include_once("./Services/JSON/classes/class.ilJsonUtil.php");
$tpl->setVariable("OPTIONS", $str = ilJsonUtil::encode($options));
$tpl->setVariable("ACC_ID", $options["id"]);
//echo "<br><br><br><br><br><br>".$str;
return $tpl->get();
}

+ Here is the call graph for this function:

ilAccordionGUI::getId ( )

Get id.

Returns
string id

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

Referenced by getHTML().

{
return $this->id;
}

+ Here is the caller graph for this function:

ilAccordionGUI::getInnerContainerClass ( )

Get inner Container CSS Class.

Returns
string Container CSS Class

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

Referenced by getHTML().

{
return $this->icontainerclass;
}

+ Here is the caller graph for this function:

ilAccordionGUI::getItems ( )

Get all items.

Definition at line 362 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 74 of file class.ilAccordionGUI.php.

Referenced by getHTML().

{
return $this->orientation;
}

+ Here is the caller graph for this function:

ilAccordionGUI::getShowAllElement ( )

Get show all element.

Returns
string ID of show all html element

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

References $show_all_element.

Referenced by getHTML().

+ Here is the caller graph for this function:

ilAccordionGUI::getUseSessionStorage ( )

Get use session storage.

Returns
bool use session storage

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

References $use_session_storage.

Referenced by getHTML().

+ Here is the caller graph for this function:

ilAccordionGUI::setActiveHeaderClass (   $a_h_class)

Set active header class.

Parameters
string$a_h_classActive Header CSS Class

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

{
$this->active_headerclass = $a_h_class;
}
ilAccordionGUI::setAllowMultiOpened (   $a_val)

Set allow multi opened.

Parameters
bool$a_valallow multiple accordions being opened

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

{
$this->allow_multi_opened = $a_val;
}
ilAccordionGUI::setBehaviour (   $a_val)

Set behaviour "ForceAllOpen" | "FirstOpen" | "AllClosed".

Parameters
stringbehaviour

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

{
$this->behaviour = $a_val;
}
ilAccordionGUI::setContainerClass (   $a_containerclass)

Set Container CSS Class.

Parameters
string$a_containerclassContainer CSS Class

Definition at line 84 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 164 of file class.ilAccordionGUI.php.

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

Set ContentHeight.

Parameters
integer$a_contentheightContentHeight

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

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

Set ContentWidth.

Parameters
integer$a_contentwidthContentWidth

Definition at line 184 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 124 of file class.ilAccordionGUI.php.

{
$this->headerclass = $a_headerclass;
}
ilAccordionGUI::setHideAllElement (   $a_val)

Set hide all element.

Parameters
string$a_valID of hide all html element

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

{
$this->hide_all_element = $a_val;
}
ilAccordionGUI::setId (   $a_val)

Set id.

Parameters
stringid

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

{
$this->id = $a_val;
}
ilAccordionGUI::setInnerContainerClass (   $a_containerclass)

Set inner Container CSS Class.

Parameters
string$a_containerclassContainer CSS Class

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

{
$this->icontainerclass = $a_containerclass;
}
ilAccordionGUI::setOrientation (   $a_orientation)

Set Orientation.

Parameters
string$a_orientationOrientation

Definition at line 60 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:

ilAccordionGUI::setShowAllElement (   $a_val)

Set show all element.

Parameters
string$a_valID of show all html element

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

{
$this->show_all_element = $a_val;
}
ilAccordionGUI::setUseSessionStorage (   $a_val)

Set use session storage.

Parameters
bool$a_valuse session storage

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

{
$this->use_session_storage = $a_val;
}

Field Documentation

ilAccordionGUI::$accordion_cnt = 0
staticprotected

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

Referenced by getHTML().

ilAccordionGUI::$allow_multi_opened = false
protected

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

Referenced by getAllowMultiOpened().

ilAccordionGUI::$force_open = array()
protected

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

ilAccordionGUI::$hide_all_element = null
protected

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

Referenced by getHideAllElement().

ilAccordionGUI::$items = array()
protected

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

Referenced by addItem(), and getItems().

ilAccordionGUI::$show_all_element = null
protected

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

Referenced by getShowAllElement().

ilAccordionGUI::$use_session_storage = false
protected

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

Referenced by getUseSessionStorage().

const ilAccordionGUI::ALL_CLOSED = "AllClosed"

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

const ilAccordionGUI::FIRST_OPEN = "FirstOpen"
const ilAccordionGUI::FORCE_ALL_OPEN = "ForceAllOpen"

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

Referenced by ilObjRoleGUI\permObject().

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

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