/** * Constructor * @throws Exception */ function __construct($federation) { date_default_timezone_set('Europe/Madrid'); parent::__construct('Portrait', "print_listaPerros", 1, 0); // use default prueba. not really needed $d = new Dogs("print_listaPerros"); $res = $d->select(); if (!is_array($res)) { $this->errormsg = "print_listaPerros: select() failed"; throw new Exception($this->errormsg); } $this->lista = $res['rows']; // rework federation handling as parent got it from senseless prueba ID $this->federation = Federations::getFederation(intval($federation)); $this->strClub = $this->federation->isInternational() ? _('Country') : _('Club'); $this->icon = getIconPath($this->federation->get('Name'), "agilitycontest.png"); $this->icon2 = getIconPath($this->federation->get('Name'), $this->federation->get('Logo')); $this->cols[8] = $this->strClub; // use "country" or "club" according federation if ($this->federation->get('WideLicense') == true) { // on wide license hide loe/rrc $this->pos[3] += $this->pos[4]; $this->pos[4] = 0; $this->pos[3] += 5; // decrease handler name $this->pos[7] -= 5; } }
/** * Constructor * @throws Exception */ function __construct() { parent::__construct("doglist.xlsx"); setcookie('fileDownload', 'true', time() + 30, "/"); // tell browser to hide "downloading" message box $d = new Dogs("excel_listaPerros"); $res = $d->select(); if (!is_array($res)) { $this->errormsg = "print_listaPerros: select() failed"; throw new Exception($this->errormsg); } $this->lista = $res['rows']; }
function videowall_livestream() { /* recupera los datos de un perro y le añade informacion de celo */ $celo = http_request("Celo", "i", 0); $id = http_request("Perro", "i", 0); $pmgr = new Dogs("VideoWall_LiveSTream"); $data = $pmgr->selectByID($id); $data["Celo"] = $celo; return $data; }
either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ require_once __DIR__ . "/../logging.php"; require_once __DIR__ . "/../tools.php"; require_once __DIR__ . "/../auth/AuthManager.php"; require_once __DIR__ . "/classes/Dogs.php"; try { $result = null; $perros = new Dogs("dogFunctions"); $am = new AuthManager("dogFunctions"); $operation = http_request("Operation", "s", null); $idperro = http_request("ID", "i", 0); $idguia = http_request("Guia", "i", 0); $federation = http_request("Federation", "i", -1); if ($operation === null) { throw new Exception("Call to dogFunctions without 'Operation' requested"); } switch ($operation) { case "insert": $am->access(PERMS_OPERATOR); $result = $perros->insert($federation); break; case "update": $am->access(PERMS_OPERATOR);
/** * Funcion de procesado de inscripciones * revisa la inscripcion * ajusta orden de salida * crea entradas en tabla de resultados * @param {integer} $p ID de prueba * @param {integer} $i ID de inscripcion */ function procesaInscripcion($p, $i) { $myConfig = Config::getInstance(); $myLogger = new Logger("procesaInscripcion", $myConfig->getEnv("debug_level")); $am = new AuthManager("procesaInscripcion"); // si la prueba o la inscripcion son nulas genera error try { if ($p <= 0) { throw new Exception("ID de prueba invalida: {$p}"); } if ($i <= 0) { throw new Exception("ID de inscripcion invalida"); } $am->access(PERMS_OPERATOR); // grant access or throw exception // buscamos las jornadas de que consta la Prueba $jobject = new Jornadas("procesaInscripcion", $p); $jp = $jobject->searchByPrueba(); if (!$jp) { throw new Exception("No encuentro jornadas para la prueba: {$p}"); } // buscamos las jornadas en las que esta inscrito $iobject = new Inscripciones("procesaInscripcion", $p); $inscripcion = $iobject->selectByID($i); if (!$inscripcion) { throw new Exception("No encuentro la inscripcion con ID: {$i}"); } $idp = $inscripcion['Perro']; // obtenemos los datos del perro $pobj = new Dogs("procesaInscripcion()"); $perro = $pobj->selectByID($idp); if (!$perro) { throw new Exception("No hay datos para el perro a inscribir con id: {$idp}"); } // TODO: check Dog Federation against Prueba Federation // contrastamos la lista de jornadas de la prueba con la lista de jornadas en las que esta inscrito foreach ($jp['rows'] as $jornada) { $numj = $jornada['Numero'] - 1; // obtenemos el numero de jornada $idj = $jornada['ID']; if ($jornada['Cerrada'] == 1) { $myLogger->info("La jornada {$idj} de la prueba {$p} esta cerrada"); continue; // no tocamos las jornadas cerradas } if (($inscripcion['Jornadas'] & 1 << $numj) != 0) { $myLogger->info("El perro {$idp} esta inscrito en la jornada {$idj} de la prueba {$p}"); inscribePerroEnJornada($inscripcion, $jornada, $perro); } else { $myLogger->info("El perro {$idp} NO esta inscrito en la jornada {$idj} de la prueba {$p}"); borraPerroDeJornada($inscripcion, $jornada, $perro); } } } catch (Exception $e) { do_log($e->getMessage()); echo json_encode(array('errorMsg' => $e->getMessage())); } }
<?php namespace Animals; include "class/animals/animals.class.php"; $lucky = new Dogs(); $lucky->say(); $duck = new Ducks(); $duck->say();