/** Constructor
  * @param {int} $prueba prueba id
  * @param {int} $jornada jornada id
  * @param {array} $mangas datos de la manga
  * @param {array} $results resultados asociados a la manga/categoria pedidas
  * @param {int} $mode manga mode
  * @throws Exception
  */
 function __construct($prueba, $jornada, $mangas, $results, $mode)
 {
     parent::__construct('Landscape', "print_clasificacion_eqBest", $prueba, $jornada);
     $dbobj = new DBObject("print_clasificacionEquipos");
     $this->manga1 = null;
     $this->manga2 = null;
     $this->trs1 = null;
     $this->trs2 = null;
     if ($mangas[0] != 0) {
         $this->manga1 = $dbobj->__getObject("Mangas", $mangas[0]);
         $this->trs1 = $results['trs1'];
     }
     if ($mangas[1] != 0) {
         $this->manga2 = $dbobj->__getObject("Mangas", $mangas[1]);
         $this->trs2 = $results['trs2'];
     }
     $this->categoria = $this->getModeString(intval($mode));
     $this->equipos = $results['equipos'];
     // recuerda que YA viene indexado por puesto
     // insertamos perros dentro de cada equipo.
     // para ello vamos a crear un array indexado por teamID
     $teams = array();
     foreach ($this->equipos as &$equipo) {
         $equipo['Perros'] = array();
         $teams[$equipo['ID']] = $equipo;
     }
     // iteramos los perros insertandolos en el equipo. Recuerda que los perros ya vienen ordenados
     foreach ($results['individual'] as &$perro) {
         array_push($teams[$perro['Equipo']]['Perros'], $perro);
     }
     $this->equipos = $teams;
 }
 /**
  * Constructor
  * @param {integer} $prueba Prueba ID
  * @param {integer} $jornada Jormada ID
  * @param {integer} $manga Manga ID
  * @throws Exception
  */
 function __construct($prueba, $jornada)
 {
     parent::__construct('Portrait', "print_equiposByJornada", $prueba, $jornada);
     if ($prueba <= 0 || $jornada <= 0) {
         $this->errormsg = "print_teamsByJornada: either prueba or jornada data are invalid";
         throw new Exception($this->errormsg);
     }
     // comprobamos que estamos en una jornada por equipos
     $flag = intval($this->jornada->Equipos3) + intval($this->jornada->Equipos4);
     if ($flag == 0) {
         $this->errormsg = "print_teamsByJornada: Jornada {$jornada} has no Team competition declared";
         throw new Exception($this->errormsg);
     }
     // Datos de equipos de la jornada
     $m = new Equipos("print_teamsByJornada", $prueba, $jornada);
     $teams = $m->getTeamsByJornada();
     // reindexamos por ID y anyadimos un campo extra "Perros" con los perros del equipo
     $this->equipos = array();
     foreach ($teams as &$equipo) {
         $equipo['Perros'] = $m->getPerrosByTeam($equipo['ID']);
         $this->equipos[$equipo['ID']] = $equipo;
     }
     // Datos de los participantes (indexados por ID de perro)
     $m = new DBObject("print_teamsByJornada");
     $r = $m->__select("*", "Resultados", "(Jornada={$jornada})", "", "");
     $this->perros = array();
     foreach ($r['rows'] as $item) {
         $this->perros[intval($item['Perro'])] = $item;
     }
     // finalmente internacionalizamos cabeceras
     $this->cellHeader = array(_('Dorsal'), _('Name'), _('Breed'), _('Lic'), _('Category'), _('Handler'), $this->strClub, _('Heat'), _('Comments'));
 }
Exemplo n.º 3
0
 /** Constructor
  * @param {obj} $manga datos de la manga
  * @param {obj} $resultados resultados asociados a la manga/categoria pedidas
  * @throws Exception
  */
 function __construct($prueba, $jornada, $mangas)
 {
     parent::__construct('Portrait', "print_etiquetasPDF", $prueba, $jornada);
     $dbobj = new DBObject("print_etiquetas_pdf");
     $this->manga1 = $dbobj->__getObject("Mangas", $mangas[0]);
     $this->manga2 = $dbobj->__getObject("Mangas", $mangas[1]);
     // add version date and license serial to every label
     $ser = substr($this->regInfo['Serial'], 4, 4);
     $ver = substr($this->config->getEnv("version_date"), 2, 6);
     $this->serialno = "{$ver}-{$ser}";
 }
Exemplo n.º 4
0
function getSettings()
{
    $db = new DBObject('cdc');
    $sql = "SELECT schoolyear, semester FROM settings LIMIT 1";
    if ($res = $db->query($sql)) {
        $settings = mysqli_fetch_assoc($res);
        return array('year' => intval($settings['schoolyear']), 'sem' => intval($settings['semester']));
    } else {
        return false;
    }
}
Exemplo n.º 5
0
 /** Constructor
  * @param {int} $prueba
  * @param {int} $jornada
  * @param {array} $mangas lista de mangaid's
  * @param {array} $results resultados asociados a la manga pedidas
  * @throws Exception
  */
 function __construct($prueba, $jornada, $mangas, $results)
 {
     parent::__construct('Landscape', "print_podium", $prueba, $jornada);
     $dbobj = new DBObject("print_clasificacion");
     $this->manga1 = $dbobj->__getObject("Mangas", $mangas[0]);
     $this->manga2 = null;
     if ($mangas[1] != 0) {
         $this->manga2 = $dbobj->__getObject("Mangas", $mangas[1]);
     }
     $this->resultados = $results;
 }
 static function create($user_id, $payment_hash, $days, $amount)
 {
     $dbInsert = new DBObject("premium_order", array("user_id", "payment_hash", "days", "amount", "order_status", "date_created"));
     $dbInsert->user_id = $user_id;
     $dbInsert->payment_hash = $payment_hash;
     $dbInsert->days = $days;
     $dbInsert->amount = $amount;
     $dbInsert->order_status = 'pending';
     $dbInsert->date_created = date("Y-m-d H:i:s", time());
     if ($dbInsert->insert()) {
         return $dbInsert;
     }
     return false;
 }
Exemplo n.º 7
0
 function save()
 {
     if (empty($this->Creator)) {
         $this->Creator = $_SESSION['User'];
     }
     return parent::save();
 }
Exemplo n.º 8
0
Arquivo: Data.php Projeto: uhtoff/eCRF
 /**
  * Data constructor
  * 
  * @param int $id Optional - if set gets data from PID = $id
  * @param string $class Option - if set then sets className directly
  */
 public function __construct($id = NULL, $class = NULL)
 {
     if ($class) {
         $this->setClassName($class);
     }
     parent::__construct($id);
 }
 /**
  * Safety net: in case the change is not given, let's guarantee that it will
  * be set to the current ongoing change (or create a new one)	
  */
 protected function OnInsert()
 {
     if ($this->Get('change') <= 0) {
         $this->Set('change', CMDBObject::GetCurrentChange());
     }
     parent::OnInsert();
 }
Exemplo n.º 10
0
 protected function _processSearch()
 {
     $class = $this->_getSearchClass();
     $table = DBObject::stGetTableName($class);
     $fieldId = $class::stGetFieldConfigFiltered(array("identifier" => true));
     $select = "SELECT {$this->fields} FROM {$table}";
     $where = "";
     foreach ($this->filters as $field => $filter) {
         $field = DBObject::stObjFieldToDBField($field);
         $op = $filter[0];
         if (is_array($filter[1])) {
             $whereField = "(";
             foreach ($filter[1] as $value) {
                 // TODO soporte para OR ?
                 $whereField = $whereField . "'" . $value . "'" . " AND ";
             }
             $whereField = substr($whereField, 0, -5) . ")";
         } else {
             $whereField = "'" . $filter[1] . "'";
         }
         $where = $where . $field . " " . $op . " " . $whereField . " AND ";
     }
     if ($where != "") {
         $select = $select . " WHERE " . substr($where, 0, -5);
     }
     $offset = ($this->page - 1) * $this->limit;
     $select = $select . " LIMIT {$offset},{$this->limit}";
     $mysqlParams = static::_stGetMySQLParams();
     $search = DBMySQLConnection::stVirtualConstructor($mysqlParams)->query($select);
     // Anotamos los resultados
     $this->count = $search->num_rows;
     // Guardamos la búsqueda
     $this->search = $search;
 }
 public static function MakeObjectURL($sClass, $iId)
 {
     $sPage = DBObject::ComputeStandardUIPage($sClass);
     $sAbsoluteUrl = utils::GetAbsoluteUrlAppRoot();
     $sUrl = "{$sAbsoluteUrl}pages/{$sPage}?operation=details&class={$sClass}&id={$iId}";
     return $sUrl;
 }
Exemplo n.º 12
0
 /**
  * Constructor
  * @param {string} Name for this object
  * @param {integer} $manga Manga ID
  * @throws Exception when
  * - cannot contact database
  * - invalid manga ID
  */
 function __construct($file, $manga)
 {
     parent::__construct($file);
     if ($manga <= 0) {
         $this->errormsg = "Resultados::Construct invalid Manga ID: {$manga}";
         throw new Exception($this->errormsg);
     }
     $this->manga = $this->__getArray("Mangas", $manga);
     if (!is_array($this->manga)) {
         $this->errormsg = "OrdenSalida::construct(): Cannot get info on manga:{$manga}";
         throw new Exception($this->errormsg);
     }
     $this->jornada = $this->__getArray("Jornadas", $this->manga['Jornada']);
     if (!is_array($this->jornada)) {
         $this->errormsg = "OrdenSalida::construct(): Cannot get jornada info on jornada:{$this->manga['Jornada']} manga:{$manga}";
         throw new Exception($this->errormsg);
     }
     $this->prueba = $this->__getArray("Pruebas", $this->jornada['Prueba']);
     if (!is_array($this->prueba)) {
         $this->errormsg = "OrdenSalida::construct(): Cannot get prueba info on prueba:{$this->jornada['Prueba']} jornada:{$this->manga['Jornada']} manga:{$manga}";
         throw new Exception($this->errormsg);
     }
     $this->federation = Federations::getFederation(intval($this->prueba['RSCE']));
     if ($this->federation == null) {
         $this->errormsg = "OrdenSalida::construct(): Cannot get federation info on prueba:{$this->jornada['Prueba']} jornada:{$this->manga['Jornada']} manga:{$manga}";
         throw new Exception($this->errormsg);
     }
 }
Exemplo n.º 13
0
 /**
  * get configuration data for connecting to db
  * @return mixed
  */
 private static function getConf()
 {
     if (!self::$conf) {
         self::$conf = (require 'db.conf.php');
     }
     return self::$conf;
 }
Exemplo n.º 14
0
 public function calculate()
 {
     parent::calculate();
     // load records .. see $this->firstRecord, $this->perPage
     $limitSql = sprintf(' LIMIT %s,%s', $this->firstRecord, $this->perPage);
     $this->records = array_values(DBObject::glob($this->itemClass, $this->pageSql . $limitSql));
 }
Exemplo n.º 15
0
 public function __construct($id = false)
 {
     if (empty($id)) {
         $this->Created = time();
         $this->Modified = time();
     }
     parent::__construct($id);
 }
Exemplo n.º 16
0
 public static function getInstance()
 {
     if (!isset(self::$INSTANCE)) {
         $object = __CLASS__;
         self::$INSTANCE = new $object();
     }
     return self::$INSTANCE;
 }
Exemplo n.º 17
0
 function loadByID($id)
 {
     $res = parent::loadByID($id);
     if ($res) {
         $this->registerByID($this->slug);
     }
     return $res;
 }
Exemplo n.º 18
0
Arquivo: User.php Projeto: uhtoff/eCRF
 public function set($prop, &$value)
 {
     if ($prop == 'password') {
         $this->setPassword($value);
     } else {
         parent::set($prop, $value);
     }
 }
Exemplo n.º 19
0
 public function render($module, $model)
 {
     $rtn = "\n[[[\r\n  \$prepopulate = (\$object->isNew() ? (isset(\$_POST['" . $this->name . "']) ? strip_tags(\$_POST['" . $this->name . "']) : '') : \$object->get" . DBObject::tableNameToClassName($this->name) . "() * 1000);\r\n  \$alt_prepopulate = \$prepopulate;\r\n  if (preg_match('/^\\d+\$/', \$prepopulate)) {\r\n    \$alt_prepopulate = date('Y-m-d', \$prepopulate/1000);\r\n  }\r\n]]]\n";
     $id = get_random_string(5);
     $rtn .= "\n<div id='{$id}' class='form-group'>\r\n  <label class='col-sm-2 control-label' for='{$this->name}'>{$this->name} " . ($this->required ? $this->mandatory_field : '') . "</label>\r\n  <div class='col-sm-10'>\r\n    <div class='input-group'>\r\n      <span class='input-group-addon'><i class='fa fa-calendar'></i></span>\r\n      <input disabled='disabled' value='[[[ echo htmlentities(str_replace('\\'', '\"', \$alt_prepopulate)) ]]]' type='text' class='form-control altFormat' " . ($this->required ? ' required' : '') . " />\r\n      <input value='[[[ echo htmlentities(str_replace('\\'', '\"', \$prepopulate)) ]]]' type='text' id='{$this->name}' name='{$this->name}' class='datepicker form-control' " . ($this->required ? ' required' : '') . "  style='position: absolute; top:0; left: 0; z-index: -1' />\r\n    </div>\r\n  </div>\r\n</div>\r\n<div class='hr-line-dashed'></div>\r\n";
     $rtn .= "\r\n    <script type='text/javascript'>\r\n      \$('#{$id} .datepicker').datepicker({\r\n        " . (isset($this->options['dateFormat']) ? 'dateFormat: ' . "'" . $this->options['dateFormat'] . "'" : '') . "\r\n        " . (isset($this->options['altFormat']) ? ',altField: "#' . $id . ' .altFormat", altFormat: "' . $this->options['altFormat'] . '"' : '') . "\r\n        " . (isset($this->options['changeMonth']) ? ',changeMonth: ' . $this->options['changeMonth'] : '') . "\r\n        " . (isset($this->options['changeYear']) ? ',changeYear: ' . $this->options['changeYear'] : '') . "\r\n        " . (isset($this->options['yearRange']) ? ',yearRange: ' . "'" . $this->options['yearRange'] . "'" : '') . "\r\n      });\r\n      \$('#{$id} .input-group-addon').css('cursor', 'pointer').on('click', function(){\r\n        \$('#{$id} .datepicker').datepicker('show');\r\n      });\r\n    </script>\r\n";
     return $rtn;
 }
Exemplo n.º 20
0
 /** Constructor
  * @param {int} $prueba prueba id
  * @param {int} $jornada jornada id
  * @param {array} $mangas datos de la manga
  * @param {array} $results resultados asociados a la manga/categoria pedidas
  * @param {int} $mode manga mode
  * @throws Exception
  */
 function __construct($prueba, $jornada, $mangas, $results, $mode)
 {
     parent::__construct('Landscape', "print_clasificacion", $prueba, $jornada);
     $dbobj = new DBObject("print_clasificacion");
     $this->manga1 = $dbobj->__getObject("Mangas", $mangas[0]);
     $this->manga2 = null;
     if ($mangas[1] != 0) {
         $this->manga2 = $dbobj->__getObject("Mangas", $mangas[1]);
     }
     $this->resultados = $results['rows'];
     $this->trs1 = $results['trs1'];
     $this->trs2 = null;
     if ($mangas[1] != 0) {
         $this->trs2 = $results['trs2'];
     }
     $this->categoria = $this->getModeString(intval($mode));
 }
Exemplo n.º 21
0
 function insert($force_validation = false)
 {
     if (!$this->report_key) {
         $this->report_key = uniqid();
     }
     // insert feed into database
     parent::insert();
 }
Exemplo n.º 22
0
 public function refresh(DBObject $db, $table = 'userinfo', $fields = ['userid'], $status = 'status')
 {
     $sql = "SELECT * FROM {$table} WHERE {$fields[0]} = {$_SESSION[$fields[0]]}";
     if (($result = $db->query($sql)) && mysqli_num_rows($result) > 0) {
         $row = mysqli_fetch_assoc($result);
         if ($row[$status] == 0) {
             return false;
         }
         foreach ($fields as $field) {
             $_SESSION[$field] = $row[$field];
         }
         return true;
     } else {
         //			echo $db->getError();
         error_log($db->getError());
         return false;
     }
 }
 public function __construct($id = '')
 {
     parent::__construct('tags', array('name'), '');
     $this->select($id, 'name');
     if ($this->id == '') {
         $this->name = $id;
         $this->insert();
     }
 }
Exemplo n.º 24
0
 function validate($data, $action, $options = array())
 {
     $toret = false;
     $data = parent::validate($data, $action, $options);
     if ($data) {
         $toret = true;
     }
     return $toret ? $data : false;
 }
Exemplo n.º 25
0
 function __construct($init = null, $key = 0, $field = null)
 {
     parent::__construct();
     $this->_objType = 'sc_intrusion';
     $this->_objField = 'id';
     $this->_objPath = 'intrusion';
     $this->_objJoin[] = array('join_table' => 'users', 'join_field' => 'uname', 'object_field_name' => 'username', 'compare_field_table' => 'uid', 'compare_field_join' => 'uid');
     $this->_init($init, $key);
 }
Exemplo n.º 26
0
 function getDBColumnType($field)
 {
     $params = array_merge(array_keys($this->objFields), array_keys($this->params));
     $_params = array();
     foreach ($params as $param) {
         $_params[$param] = isset($this->{$param}) ? $this->{$param} : $this->objFields["{$param}"];
     }
     return "`" . DBObject::stObjFieldToDBField($field) . "` " . $this->_getDBColumnType($_params);
 }
Exemplo n.º 27
0
 function validate($data, $action, $options = array())
 {
     $toret = true;
     $data = parent::validate($data, $action, $options);
     if ($data) {
         $data['active'] = array_key_exists('active', $data) ? $data['active'] : 1;
     }
     return $toret ? $data : false;
 }
Exemplo n.º 28
0
 public function __construct($init = null, $key = 0)
 {
     parent::__construct();
     $this->_objType = 'categories_category';
     $this->_objPath = 'category';
     $this->_objPermissionFilter[] = array('component_left' => 'ZikulaCategoriesModule', 'component_middle' => '', 'component_right' => '', 'instance_left' => 'id', 'instance_middle' => 'ipath', 'instance_right' => 'path', 'level' => ACCESS_READ);
     $this->_objValidation['name'] = array('name', true, 'noop', '', __('Error! You did not enter a name.'), '');
     $this->_init($init, $key);
 }
Exemplo n.º 29
0
 /**
  * Constructor
  * @param {string} $file caller for this object
  * @param {integer} $jornada jornada ID
  * @throws Exception if cannot contact database or invalid jornada ID
  */
 function __construct($file, $jornada)
 {
     parent::__construct($file);
     if ($jornada <= 0) {
         $this->errormsg = "Manga::Construct invalid jornada ID";
         throw new Exception($this->errormsg);
     }
     $this->jornada = $jornada;
     $this->pruebaObj = $this->__selectObject("Pruebas.ID,Pruebas.RSCE,Pruebas.Selectiva", "Pruebas,Jornadas", "(Pruebas.ID=Jornadas.Prueba) AND (Jornadas.ID={$jornada})");
 }
 static function create($username, $password, $email, $title, $firstname, $lastname, $accType = 'user')
 {
     $dbInsert = new DBObject("users", array("username", "password", "email", "title", "firstname", "lastname", "datecreated", "createdip", "status", "level", "paymentTracker"));
     $dbInsert->username = $username;
     $dbInsert->password = MD5($password);
     $dbInsert->email = $email;
     $dbInsert->title = $title;
     $dbInsert->firstname = $firstname;
     $dbInsert->lastname = $lastname;
     $dbInsert->datecreated = sqlDateTime();
     $dbInsert->createdip = getUsersIPAddress();
     $dbInsert->status = 'active';
     $dbInsert->level = 'free user';
     $dbInsert->paymentTracker = MD5(time() . $username);
     if ($dbInsert->insert()) {
         return $dbInsert;
     }
     return false;
 }