public function __call($method, $args) { //Let's work with some magic here, contary to the AddCommentForm... if (substr($method, 0, 3) == "get") { //Only look for method calls starting with "get" $_attr = strtolower(str_replace("get", "", $method)); //Don't forget to lower the case as it's "Title" in the string and not "title" if (array_key_exists($_attr, $this->_elements)) { //So it's one of the items I have in the form, so return the value return $this->getElement($_attr)->getValue(); } else { return null; } } //Call the parent's __call too, in order to provide support for parent's magic too... parent::__call($method, $args); }
public function participanteditAction() { $this->view->title = "Create New/Change"; $_action = $this->getRequest()->getParam("act"); $_pid = $this->getRequest()->getParam("pid"); $_t = new ParticipantsTable(); $_form = new ParticipantInfoUpdateForm(); if ($_action === "del") { $_t->deleteById($_pid); $this->_redirect(APPLICATION_BASEURL_INDEX . "/admin/participant"); } else { if ($_action === "edit") { //TODO: fill the form with actual values... $_participant = $_t->findById($_pid); $_form->loadFromModel($_participant); } else { if ($_action === "create") { } else { if ($_action === "save") { $_participant = null; if ($_pid != "") { $_participant = $_t->findById($_pid); $_form->loadFromModel($_participant); } if ($_form->isValid($_POST)) { if ($_pid == "") { $_participant = $_t->createRow(); $_participant->loadFromForm($_form); $_participant->insert(); } else { $_participant->loadFromForm($_form); $_participant->save(); } //$this->_redirect(APPLICATION_BASEURL_INDEX . "/admin/participant"); } else { $this->view->errorMsg = "Correct the errors below..."; } } } } } $this->view->form = $_form; }