/** * la fonction add<nom-de-classe>($args) ajoute un nouvel * objet de type Wtk_<nom-de-classe> en passant $args au * constructeur. */ public function __call($method, $args) { if (preg_match('`add(.+)`', $method, $match)) { $wid = wtk_new('Wtk_' . $match[1], $args); return $this->addChild($wid); } }
function element($data) { $args = $this->args; $i = $data['instance']; $class = 'Wtk_Form_Control_' . $this->class; if (@class_exists($class)) { $i->label = NULL; array_unshift($args, $i); } else { array_unshift($args, $i->value); $class = 'Wtk_' . $this->class; } if (!@class_exists($class)) { $class = $this->class; } if (!@class_exists($class)) { throw new Exception("Impossible de trouver le widget " . $this->class); } return wtk_new($class, $args); }
function addNewColumn() { $args = func_get_args(); $col = wtk_new('Wtk_Table_Column', $args); $this->addColumn($col); return $col; }
function __call($method, $args) { if (preg_match("/^addConstraint(.*)\$/", $method, $matches)) { $class = "Wtk_Form_Model_Constraint_" . $matches[1]; if (is_string($args[0])) { $args[0] = $this->getInstance($args[0]); } $cons = wtk_new($class, $args); return $this->addConstraint($cons); } else { return call_user_func_array(array($this->instance, $method), $args); } }