public function index_delete($coleccion, $id) { if (deveritas_archivo(APPPATH . 'libraries/coleccionesApi/delete/' . ucfirst($coleccion) . '.php')) { $info = $this->cargador($coleccion, (int) $id, $this->delete()); if (count($info) > 0) { $this->response($info, REST_Controller::HTTP_OK); } else { $this->response(['error' => 'la coleccion: ' . $coleccion . ' esta vacia o no existe'], REST_Controller::HTTP_NOT_FOUND); } } else { $this->response(['error' => 'Coleccion inexistente'], REST_Controller::HTTP_BAD_REQUEST); } }
public function index_post($coleccion) { if (deveritas_archivo(APPPATH . 'libraries/coleccionesApi/post/' . $coleccion . '.php')) { $id = $this->cargador($coleccion, $this->input->post()); if (count($id) > 0) { $this->response($id, REST_Controller::HTTP_OK); } else { $this->response(['error' => 'ha ocurrido un error'], REST_Controller::HTTP_NOT_FOUND); } } else { $this->response(['error' => 'no existe la coleccion [' . $coleccion . ']'], REST_Controller::HTTP_BAD_REQUEST); } }
public function index_get($coleccion = NULL, $uriString = NULL) { if (deveritas_archivo(APPPATH . 'libraries/coleccionesApi/get/' . ucfirst($coleccion) . '.php')) { if ($campos === '_') { $campos = NULL; } $resultado = $this->cargador($coleccion, $uriString, $this->get()); if (count($resultado) > 0) { $this->response($resultado, REST_Controller::HTTP_OK); } else { $this->response(['error' => 'la coleccion: ' . $coleccion . ' esta vacia o no existe'], REST_Controller::HTTP_NOT_FOUND); } } else { $this->response(['error' => 'no existe la coleccion [' . $coleccion . ']'], REST_Controller::HTTP_BAD_REQUEST); } }
public function render() { //validar que exista la view seleccionada if (deveritas_archivo(VIEWPATH . 'dom/' . $this->Layout . '/' . $this->Layout . '.php')) { $this->ci->load->view('dom/' . $this->Layout . '/' . $this->Layout, ['public' => '/public/', 'title' => $this->title, 'meta' => $this->meta . "\n", 'headLink' => $this->headLink . "\n", 'headScript' => $this->headScript . "\n", 'NoScript' => $this->NoScript . "\n", 'navbar' => $this->navbar . "\n", 'content' => $this->content . "\n", 'modal' => $this->modal . "\n", 'postStylesheet' => $this->postStylesheet . "\n", 'postScript' => $this->postScript . "\n"]); } else { //sino tirar error fatal :/ echo '<h1>ERROR fatal, no se encuentra el layout: ' . $this->Layout . '</h1>'; echo '<h2>reconfigura para que se encuentre en:</h2>'; echo '<h3>VIEWPATH/dom/{nombreLayout}/{nombreLayout}.php</h3>'; die; } }