/** * Constructor * @param {int} $prueba Prueba ID * @throws Exception */ function __construct($prueba) { parent::__construct("clasifications.xlsx"); setcookie('fileDownload', 'true', time() + 30, "/"); // tell browser to hide "downloading" message box $p = new Pruebas("excel_Clasificaciones"); $res = $p->selectByID($prueba); if (!is_array($res)) { $this->errormsg = "excel_Clasificaciones: getPruebaByID({$prueba}) failed"; throw new Exception($this->errormsg); } $this->prueba = $res; $j = new Jornadas("excel_Clasificaciones", $prueba); $res = $j->selectByPrueba(); if (!is_array($res)) { $this->errormsg = "excel_Clasificaciones: getJornadasByPrueba({$prueba}) failed"; throw new Exception($this->errormsg); } $this->jornadas = $res['rows']; // to get mode in trs evaluation $this->federation = Federations::getFederation($this->prueba['RSCE']); $this->jdbObject = new Jueces("excelClasification"); }
case "update": $am->access(PERMS_OPERATOR); $result = $pruebas->update($pruebaID); break; case "delete": $am->access(PERMS_OPERATOR); $result = $pruebas->delete($pruebaID); break; case "select": $result = $pruebas->select(); break; case "enumerate": $result = $pruebas->enumerate($am); break; case "getbyid": $result = $pruebas->selectByID($pruebaID); break; default: throw new Exception("pruebaFunctions:: invalid operation: {$operation} provided"); } if ($result === null) { throw new Exception($pruebas->errormsg); } if ($result === "") { echo json_encode(array('success' => true, 'insert_id' => $pruebas->conn->insert_id, 'affected_rows' => $pruebas->conn->affected_rows)); } else { echo json_encode($result); } } catch (Exception $e) { do_log($e->getMessage()); echo json_encode(array('errorMsg' => $e->getMessage()));