2007-07-19 12:40:28 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2008-01-09 05:18:36 +01:00
|
|
|
* Implements a single tab in a {@link TabSet}.
|
|
|
|
* @package forms
|
|
|
|
* @subpackage fields-structural
|
2007-07-19 12:40:28 +02:00
|
|
|
*/
|
|
|
|
class Tab extends CompositeField {
|
|
|
|
protected $tabSet;
|
|
|
|
|
2008-08-09 07:57:44 +02:00
|
|
|
public function __construct($name) {
|
2007-07-19 12:40:28 +02:00
|
|
|
$args = func_get_args();
|
2008-08-09 07:57:44 +02:00
|
|
|
$name = array_shift($args);
|
|
|
|
|
|
|
|
$this->id = preg_replace('/[^0-9A-Za-z]+/', '', $name);
|
|
|
|
$this->title = preg_replace('/([a-z0-9])([A-Z])/', '\\1 \\2', $name);
|
|
|
|
$this->name = $name;
|
2007-07-19 12:40:28 +02:00
|
|
|
|
|
|
|
parent::__construct($args);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function id() {
|
|
|
|
return $this->tabSet->id() . '_' . $this->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function Fields() {
|
|
|
|
return $this->children;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setTabSet($val) {
|
|
|
|
$this->tabSet = $val;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the named field
|
|
|
|
*/
|
|
|
|
public function fieldByName($name) {
|
|
|
|
foreach($this->children as $child) {
|
2008-06-13 03:56:29 +02:00
|
|
|
if($name == $child->Name()) return $child;
|
2007-07-19 12:40:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
?>
|