2007-07-19 12:40:28 +02:00
|
|
|
<?php
|
|
|
|
|
2007-09-15 23:03:27 +02:00
|
|
|
/**
|
|
|
|
* Allows visibility of a group of fields to be toggled using + and - icons
|
|
|
|
*/
|
2007-07-19 12:40:28 +02:00
|
|
|
class TogglePanel extends CompositeField {
|
|
|
|
protected $closed = false;
|
|
|
|
|
2007-09-14 02:47:00 +02:00
|
|
|
function __construct($title, $children, $startClosed = false) {
|
2007-07-19 12:40:28 +02:00
|
|
|
$this->title = $title;
|
2007-09-14 02:47:00 +02:00
|
|
|
$this->closed = $startClosed;
|
2007-07-19 12:40:28 +02:00
|
|
|
$this->name = ereg_replace('[^A-Za-z0-9]','',$this->title);
|
|
|
|
parent::__construct($children);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function FieldHolder() {
|
|
|
|
Requirements::javascript("jsparty/prototype.js");
|
|
|
|
Requirements::javascript("jsparty/behaviour.js");
|
|
|
|
Requirements::javascript("jsparty/prototype_improvements.js");
|
|
|
|
Requirements::javascript("sapphire/javascript/TogglePanel.js");
|
|
|
|
|
|
|
|
return $this->renderWith("TogglePanel");
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setClosed($closed) {
|
|
|
|
$this->closed = $closed;
|
|
|
|
}
|
|
|
|
public function getClosed() {
|
|
|
|
return $this->closed;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function ClosedClass() {
|
|
|
|
if($this->closed) return " closed";
|
|
|
|
}
|
|
|
|
public function ClosedStyle() {
|
|
|
|
if($this->closed) return "style=\"display: none\"";
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|