} break; case "delete": break; } break; case "agents": $pageBody = '<h1>agents</h1>'; $action = "list"; if (isset($_REQUEST["action"])) { $action = $_REQUEST["action"]; } switch ($action) { case "list": default: $agents = Agent::getAgents(); if (count($agents) > 0) { $pageBody = ' <table> <thead> <tr> <th>#</th> <th>name</th> <th>since</th> <th>deliveries</th> <th>rating</th> <th>actions</th> </tr> </thead> <tbody>'; foreach ($agents as $agentID) {
public function getagentsAction() { $auth = Zend_Auth::getInstance(); $lic = $_REQUEST['lic']; if ($lic != $_SESSION['OPENZISKEYHOLE']) { $this->view->msg = 'Not Ajax Request'; $this->_forward('error', 'error'); } else { if ($auth->hasIdentity()) { if (!$this->getRequest()->isXmlHttpRequest()) { $this->view->msg = 'Not Ajax Request'; $this->_forward('error', 'error'); } else { $agents = Agent::getAgents(); if (count($agents) > 0) { $json = Zend_Json::encode($agents); $this->view->json = $json; } $this->render('ajaxsuccessjson'); } } else { if (!$this->getRequest()->isXmlHttpRequest()) { $this->view->msg = 'Not Ajax Request'; $this->_forward('error', 'error'); } else { $this->view->msg = 'Invalid User'; $this->_forward('error', 'error'); } } } }