本文整理汇总了PHP中DBObject类的典型用法代码示例。如果您正苦于以下问题:PHP DBObject类的具体用法?PHP DBObject怎么用?PHP DBObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DBObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/** 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;
}
示例2: __construct
/**
* 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'));
}
示例3: __construct
/** 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}";
}
示例4: getSettings
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;
}
}
示例5: __construct
/** 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;
}
示例6: create
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;
}
示例7: OnInsert
/**
* 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();
}
示例8: _processSearch
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;
}
示例9: MakeObjectURL
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;
}
示例10: calculate
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));
}
示例11: render
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;
}
示例12: __construct
/** 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));
}
示例13: save
function save()
{
if (empty($this->Creator)) {
$this->Creator = $_SESSION['User'];
}
return parent::save();
}
示例14: __construct
/**
* 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);
}
示例15: Exception
/**
* 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);
}
}