public function clientAction($index)
 {
     $client = Client::findFirst($index);
     $this->view->setVars(array("model" => "Clients", "client" => $client));
     $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
     $this->view->pick("Accueil/client");
 }
 public function clientsAction($index = null)
 {
     $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
     if (!isset($index) || !is_numeric($index)) {
         $clients = Client::find();
         $this->view->setVars(array("model" => "Clients", "objects" => $clients));
         $this->jquery->getOnClick(".edit", "Accueil/clients/", "#ajax-content");
     } else {
         $client = Client::findFirst($index);
         $this->view->setVars(array("model" => "Clients", "client" => $client));
         $this->view->pick("Accueil/client");
     }
 }
Example #3
0
 public function removeAction($idClient)
 {
     $client = Client::findFirst(array('conditions' => 'idClient = ?1 AND idAccount = ?2', 'bind' => array(1 => $idClient, 2 => $this->user->idAccount)));
     if (!$client) {
         $this->flashSession->error("No se encontró el cliente, por favor valide la información");
         return $this->response->redirect('client');
     }
     try {
         $client->delete();
         $this->flashSession->warning("Se ha eliminado el cliente exitosamente");
         //            return $this->response->redirect('client');
     } catch (Exception $ex) {
         $this->logger->log("Exception: {$ex}");
         $this->flashSession->error("Ocurrió un error al eliminar este registro de cliente, es posible que esté asociado a una visita, por favor contacte al administrador");
         //            return $this->response->redirect('client');
     }
     return $this->response->redirect('client');
 }
 public function jsonAction($index)
 {
     $this->view->disable();
     $client = Client::findFirst($index);
     print_r(json_encode($client->toArray(), JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE));
 }
 public function clientAction($idClient)
 {
     $client = Client::findFirst($idClient);
     echo $client->toString();
     $this->view->disable();
 }