input; $mode = $input->get->getCmd('mode', 'view'); $type = $input->get->getCmd('type'); $id = (int) $input->get->getInt('id', -1); if($id == -1) $id = null; $parthandler = $this->getPart($type, $id); if($mode === 'view') $this->view($parthandler); else $this->edit($parthandler); jexit(); } /** * @param ClubsHelperParts $parthandler */ private function view($parthandler) { echo $parthandler->getViewPart(); } /** * @param ClubsHelperParts $parthandler */ private function edit($parthandler) { echo $parthandler->getEditPart(); } private function getPart($type, $id) { if(! preg_match('/.*\..*/', $type)) throw new Exception(); list($obj, $fcn) = explode('.', $type, 2); switch($obj) { case 'user': switch($fcn) { case 'name': return new ClubsPartUserName(); case 'username': return new ClubsPartUserUsername(); case 'address': return new ClubsPartUserAddress(); case 'city': return new ClubsPartUserCity(); case 'mail': return new ClubsPartUserMail(); case 'phone': return new ClubsPartUserPhone(); case 'mobile': return new ClubsPartUserMobile(); default: throw new Exception('Internal Error'); } break; case 'club': switch($fcn) { case 'name': return new ClubsPartClubName($id); case 'address': return new ClubsPartClubAddress($id); case 'city': return new ClubsPartClubCity($id); case 'homepage': return new ClubsPartClubHomepage($id); case 'mail': return new ClubsPartClubMail($id); case 'iban': return new ClubsPartClubIban($id); case 'bic': return new ClubsPartClubBic($id); default: throw new Exception('Internal Error'); } break; default: throw new Exception("Internal Error"); } } }