コード例 #1
0
 public function Categorias()
 {
     $this->Layout = false;
     $this->Attach['action'] = $_REQUEST['action'];
     if ($this->Attach['action'] == 'listar') {
         $this->Attach['Categorias'] = $this->cm->Listar();
         $this->Attach['Relaciones'] = $_REQUEST['entrada_id'] > 0 ? $this->cm->Relaciones($_REQUEST['entrada_id']) : array();
         $this->LoadView();
     }
     if ($this->Attach['action'] == 'ver') {
         $this->Attach['Categoria'] = $this->cm->Obtener($_REQUEST['id']);
         $this->LoadView();
     }
     if ($this->Attach['action'] == 'registrar') {
         echo json_encode($this->cm->Registrar(BaseHelper::ParseRequestParameterToEntity(BaseHelper::GetEntity('categoria'), $_POST)));
     }
     if ($this->Attach['action'] == 'actualizar') {
         echo json_encode($this->cm->Actualizar(BaseHelper::ParseRequestParameterToEntity(BaseHelper::GetEntity('categoria'), $_POST)));
     }
     if ($this->Attach['action'] == 'eliminar') {
         echo json_encode($this->cm->Eliminar($_REQUEST['id']));
     }
 }