public function __construct($title, $content) { $number_of_parameters = func_num_args(); if ($number_of_parameters <= 6) { $date = $number_of_parameters >= 3 ? func_get_arg(2) : ''; $id = $number_of_parameters >= 4 ? func_get_arg(3) : ''; $this->author = $number_of_parameters >= 5 ? func_get_arg(4) : ''; $this->is_event = $number_of_parameters == 6 ? func_get_arg(5) : FALSE; parent::__construct($title, $content, $date, $id); $this->form_add->add_hidden("type", "Page")->add_text("title", "Page title")->add_checkbox("is_event", "TRUE", "Évènement")->add_textarea("content", ""); $this->form_modify->add_hidden("type", "Page")->add_hidden("id", $this->id)->add_text("title", "", $this->title)->add_checkbox("is_event", "TRUE", "Évènement", $this->is_event)->add_textarea("content", "", $this->content); } else { throw new InvalidArgumentException("Too much parameters"); } }
function __construct($id) { $this->id = $id; parent::__construct(); }