本文整理汇总了PHP中rdb函数的典型用法代码示例。如果您正苦于以下问题:PHP rdb函数的具体用法?PHP rdb怎么用?PHP rdb使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rdb函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: search
public function search($word, $coords, $distance = 5, $limit = 25, $offset = 0)
{
$collection = $tmp = $idEtabs = [];
$nb = $incr = 0;
$services = rdb('geo', 'service')->select('id')->where(['family', 'LIKE', '%' . $word . '%'])->where(['code', 'LIKE', '%' . $word . '%'], 'OR')->where(['label', 'LIKE', '%' . $word . '%'], 'OR')->exec(true);
foreach ($services as $service) {
$sEtabs = $service->pivots(rdb('geo', 'etablissement')->model())->exec();
foreach ($sEtabs as $sEtab) {
$idEtabs[] = $sEtab['etablissement_id'];
}
}
$idEtabs = array_unique($idEtabs);
$db = Model::Location();
$odm = $db->getOdm();
$coll = $odm->selectCollection($db->collection);
$coll->ensureIndex(['value' => '2d', 'object_motor' => 1, 'object_database' => 1, 'object_table' => 1]);
$filter = ["value" => ['$within' => ['$center' => [[floatval($coords['lng']), floatval($coords['lat'])], floatval($distance / 111.12)]]], 'object_motor' => 'dbredis', 'object_database' => 'geo', 'object_table' => 'etablissement'];
$results = $coll->find($filter);
foreach ($results as $result) {
if (Arrays::in($result['object_id'], $idEtabs)) {
$etab = rdb('geo', 'etablissement')->find($result['object_id']);
$distances = distanceKmMiles($coords['lng'], $coords['lat'], $etab->lng, $etab->lat);
$distance = $distances['km'];
$item = $etab->assoc();
$item['distance'] = $distance;
$collection[] = $item;
}
}
$collection = $this->orderBy($collection, 'distance');
if ($limit == 0) {
return $collection;
} else {
return array_slice($collection, $offset, $limit);
}
}
示例2: __construct
public function __construct()
{
$this->locale = session('web')->getLanguage();
$this->db = rdb('lang', 'dictionary');
$defaultLng = Config::get('application.language', DEFAULT_LANGUAGE);
$this->mustTranslate = $defaultLng != $this->locale;
}
示例3: checkedBanned
private function checkedBanned($ip)
{
$row = rdb('core', 'flood')->inCache(false)->where(['ip', '=', (int) str_replace('.', '', $ip)])->first(true);
if (!$row) {
rdb('core', 'flood')->create(['ip' => (int) str_replace('.', '', $ip), 'num' => 1])->save();
} else {
$num = (int) $row->num;
$num++;
$row->setNum($num)->save();
if ($num >= Config::get('application.flood.max.time', 3)) {
rdb('core', 'banned')->create(['ip' => (int) str_replace('.', '', $ip)])->save();
}
}
}
示例4: can
public static function can($auth, $resource, $action)
{
if (empty($auth)) {
self::unauthorized();
}
if (2 == (int) $auth->is_admin) {
$rigth = rdb('api', 'right')->where(['resource', '=', $resource])->where(['action', '=', $action])->where(['user_id', '=', $auth->user_id])->first(true);
if (empty($right)) {
self::unauthorized();
}
$can = (int) $right->can;
if (2 == $can) {
self::unauthorized();
}
}
}
示例5: lap_perpanjang
function lap_perpanjang()
{
$n = 0;
$data = array();
$datax = array();
$no_spb = $_POST['no_spb'];
$data['ae'] = $this->Admin_model->is_oto('lelang/list_lelang', 'e');
$data = $this->Admin_model->show_list('perpanjang_spb', "where pp_stat='N' group by no_spb order by no_spb", 'distinct(no_spb) as no_spb,pp_ke,sum(pp_bayar) as ppbayar');
if ($data->num_rows > 0) {
foreach ($data->result() as $row) {
$n++;
$pp_ke = $this->Admin_model->show_single_field("lelang", "pp_stat", "where no_spb='" . $row->no_spb . "'");
$pp_ke == '' ? $gb = 'checkout.gif' : ($gb = '44.png');
$pp_ke == '' ? $grb = 'D' : ($grb = '');
echo "\n<tr class='xx' id='" . $row->no_spb . "' align='center'>\r\n\t\t\t\t <td class='kotak' align='left'>" . rdb('spb', 'id_barang', 'id_barang', "where no_spb='" . $row->no_spb . "'") . "</td>\t\r\n\t\t\t\t <td class='kotak' align='center'>" . substr($row->no_spb, 0, 5) . "</td>\t\r\n\t\t\t\t <td class='kotak' align='left'>" . ShortTgl(rdb('spb', 'tgl_spb', 'tgl_spb', "where no_spb='" . $row->no_spb . "'"), true) . "</td>\t\r\n\t\t\t\t <td class='kotak' align='left'>" . rdb('spb', 'nama_spb', 'nama_spb', "where no_spb='" . $row->no_spb . "'") . "</td>\t\r\n\t\t\t\t <td class='kotak' align='right'>" . number_format(rdb('spb', 'taksir_spb', 'taksir_spb', "where no_spb='" . $row->no_spb . "'"), 2) . "</td>\t\r\n\t\t\t\t <td class='kotak' align='right'>" . number_format(rdb('spb', 'nilai_spb', 'nilai_spb', "where no_spb='" . $row->no_spb . "'"), 2) . "</td>\t\r\n\t\t\t\t <td class='kotak'>" . $row->pp_ke . " x</td>\t\r\n\t\t\t\t <td class='kotak'>" . TglfromSql(getNextDays(rdb('spb', 'tgl_spb', 'tgl_spb', "where no_spb='" . $row->no_spb . "'"), $row->pp_ke * 30)) . "</td>\r\n\t\t\t\t <td id='c-1-{$n}' class='kotak'><img src='" . base_url() . "asset/images/{$gb}' id='ck-{$n}' class='pros' onclick=\"upd_lelang('" . $row->no_spb . "','{$grb}');\"></td>";
echo " </tr>\n";
}
} else {
echo "Tidak ada barang yang akan di lelang";
}
}
示例6: run
public function run($name, $when, $event, $args = [])
{
Timer::start();
Cli::show("Start of execution", 'SUCCESS');
$db = rdb('cron', 'task');
$dbCron = $db->firstOrCreate(['name' => $name]);
$nextDb = $dbCron->next;
$cron = CronExpression::factory($when);
$next = $cron->getNextRunDate()->format('Y-m-d-H-i-s');
list($y, $m, $d, $h, $i, $s) = explode('-', $next, 6);
$timestamp = mktime($h, $i, $s, $m, $d, $y);
if ($nextDb) {
if ($nextDb < $timestamp) {
Cli::show("Execution {$name}", 'COMMENT');
call_user_func_array($event, $args);
$dbCron->setNext($timestamp)->save();
}
} else {
$dbCron->setNext($timestamp)->save();
}
Cli::show('Elapsed time: ' . Timer::get() . ' s.', 'INFO');
Cli::show("End of execution", 'SUCCESS');
}
示例7: link_js
<?php
link_js('zetro_number.js,list_nasabah.js', 'asset/js,application/views/sdm/js');
$user_aktiv = $this->session->userdata("userid");
panel_begin('Black List', '');
$zb = new zetro_listBuilder('asset/bin/zetro_form.cfg');
$zb->ListHeader('nasabah', '70%', 'listTable');
$no = 0;
echo "<tbody>";
//($page+1);
foreach ($list->result_array() as $lst) {
$no++;
echo "<tr class='xx' id='" . $lst['ktp_spb'] . "' align='left'>\n\r\n\t\t <td class='kotak' align='center'>{$no}</td>\r\n\t\t <td class='kotak'>" . $lst['nama_spb'] . "{$ae}</td>\r\n\t\t <td class='kotak'>" . $lst['ktp_spb'] . "</td>\r\n\t\t <td class='kotak'>" . $lst['almnasabah'] . "</td>\r\n\t\t <td class='kotak' width='8%' align='center'>";
$bls = rdb('blacklist', 'ktp_spb', 'ktp_spb', "where ktp_spb='" . $lst['ktp_spb'] . "'");
if ($ae == 'Y' || $user_aktiv == 'Superuser') {
$zb->event($lst['ktp_spb']);
}
echo "</td></tr>\n";
}
echo "</tbody></table>";
panel_end();
popup_start('Edit Data Nasabah', 500, 300, 'frm2');
$zb = new zetro_frmBuilder('asset/bin/zetro_form.cfg');
$zb->AddBarisKosong(true);
$zb->BuildForm('nasabah', true, '80%');
popup_end('');
?>
<input type='text' id='prs' value='bcl'>
<script language='javascript'>
$(document).ready(function(e) {
$('img.edit').hide();
示例8: penomoran
function penomoran($table, $fieldnomor)
{
$nom = rdb($table, $fieldnomor, $fieldnomor, "order by {$fieldnomor} desc limit 1");
if ($nom == "") {
$nomor = date('Ymd') . "-0001";
} else {
$noms = explode("-", $nom);
if (strlen((int) $noms[1]) == 1) {
$nomor = date('Ymd') . "-000" . ($noms[1] + 1);
} else {
if (strlen((int) $noms[1]) == 2) {
$nomor = date('Ymd') . "-00" . ($noms[1] + 1);
} else {
if (strlen((int) $noms[1]) == 3) {
$nomor = date('Ymd') . "-0" . ($noms[1] + 1);
} else {
if (strlen((int) $noms[1]) == 4) {
$nomor = date('Ymd') . "-" . ($noms[1] + 1);
}
}
}
}
}
return $nomor;
}
示例9: BuildListData
function BuildListData($pk = '', $nuberInFirstColumn = true)
{
$n = 0;
$flds = array();
//echo $this->sql;
$rs = mysql_query($this->sql) or die(mysql_error());
if (mysql_num_rows($rs)) {
$fldx = "";
while ($rw = mysql_fetch_array($rs)) {
$n++;
if ($this->statu == true) {
foreach ($this->fields as $fld) {
empty($flds[$fld]) ? $flds[$fld] = $rw[$fld] : ($flds[$fld] = $flds[$fld] + $rw[$fld]);
}
}
$pk == '' ? $id = $rw['id'] : ($id = $rw[$pk]);
echo "<tr class='xx' id='nm-" . str_replace(' ', '_', $id) . "'>\n";
echo $nuberInFirstColumn == true ? "<td class='kotak' align='center'>{$n}</td>\n" : "";
for ($i = 0; $i < count($this->data); $i++) {
$jenis = explode('.', $this->data[$i]);
$this->nom(str_replace(' ', '_', $id));
if ($jenis[1] == 't') {
echo "<td class='kotak' align='center'>" . tglfromSql($rw[$jenis[0]]) . "</td>\n";
} else {
if ($jenis[1] == 'd') {
echo "<td class='kotak' align='right'>" . number_format($rw[$jenis[0]], 2, '.', ',') . "</td>\n";
} else {
if ($jenis[1] == 'dn') {
echo $this->edit == 'y' ? "<td class='kotak' align='left' nowrap>" . $this->field_inline($i + 1, number_format($rw[$jenis[0]], 2)) . "</td>\n" : "<td class='kotak' align='right'>" . number_format($rw[$jenis[0]], 2, '.', ',') . "</td>\n";
} else {
echo !empty($this->kolom) && $this->kolom == $jenis[0] ? "<td class='kotak' align='left'>" . rdb($this->tabel, $this->field, '', "where " . $this->kolom . "='" . $rw[$jenis[0]] . "'") . "</td>\n" : "<td class='kotak' align='left'>" . $rw[$jenis[0]] . "</td>\n";
}
}
}
}
//add icon action eq; edit icon, delete icon, process icon
echo $this->aksi == true ? "<td class='kotak' align='center' >" . $this->event($this->section . '-' . str_replace(' ', '_', $id), '', $this->jenis) . "</td></tr>\n" : "</tr>\n";
}
} else {
//if data not found in database
echo "<tr class='xx'><td class='kotak' align='center'><img src='" . base_url() . "asset/images/16/warning_16.png'></td>\r\n\t\t\t\t<td class='kotak' colspan='" . (count($this->data) + 1) . "'>\r\n\t\t\t\tData not found in database...(0)</td></tr>";
}
//add sub total
if ($this->statu == true) {
$clm = explode(",", $this->kol);
echo "<tr class='xx j_info' align='right'>\r\n\t\t\t\t <td colspan='" . ($clm[0] - 1) . "' class='kotak'><b>TOTAL</b></td>";
// for ($z=0;$z<count($clm);$z++){
foreach ($flds as $z) {
echo !empty($flds) ? "<td class='kotak'>" . number_format($z, 2) . "</td>" : "<td class='kotak'>" . $z . "</td>";
}
$jmlkolom = $clm[0] + count($clm) - 1;
$totalkolom = count($this->data) + 1;
if ($totalkolom - $jmlkolom > 0) {
for ($n = 1; $n <= $totalkolom - $jmlkolom; $n++) {
echo "<td class='kotak'> </td>";
}
}
echo "</tr>";
}
}
示例10: list_vendor
function list_vendor()
{
$data = array();
$n = 0;
$nama = empty($_POST['nama']) ? $where = "where ID_Jenis='2'" : ($where = "where Nama like '%" . $_POST['nama'] . "%' and ID_Jenis='2'");
$data = $this->Admin_model->show_list('mst_anggota', $where . ' order by Nama');
foreach ($data as $row) {
$n++;
//tr('xx\' onClick="_show_detail(\''.$row->ID.'\');" attr=\'ax').
$cek = rdb('inv_pembelian', 'ID_Pemasok', 'ID_Pemasok', "where ID_Pemasok='" . $row->ID . "'");
echo tr() . td($n, 'center') . td($row->No_Agt, 'center') . td($row->Nama, 'xx\' onClick="_show_detail(\'' . $row->ID . '\',\'' . $row->Nama . '\');" attr=\'ax') . td($row->Alamat) . td($row->Kota) . td($row->Propinsi) . td($row->Telepon) . td($row->Faksimili) . td($cek == '' ? img_aksi($row->ID, true, 'del') : '', 'center') . _tr();
}
}
示例11: print_label
function print_label()
{
$data = array();
$datax = array();
$kolom = 2;
$n = 0;
$nn = 0;
$datax['list'] = $this->Admin_model->show_list('labeling', "where pp_stat='Y' order by no_spb");
$data = $this->Admin_model->show_list('labeling', "where pp_stat='Y' order by no_spb");
//print_r($data->result_array());
foreach ($data->result_array() as $row) {
$nama_spb = '';
$no_spb = '';
$jw = '';
$jt_tmpo = '';
$nilai_spb = '';
$barang = '';
$nama_spb = substr(rdb('spb', 'nama_spb', 'nama_spb', "where no_spb='" . $row['no_spb'] . "'"), 0, 10);
$no_spb = substr($row['no_spb'], 0, 5);
$jw = $row['jw_spb'];
$jt_tmpo = tglfromSql($row['jt_spb']);
$nilai_spb = number_format($row['nilai_spb'], 0);
$barang = $row['id_barang'];
$datane = array($nama_spb, $no_spb, $jw, $jt_tmpo, $nilai_spb, $barang);
$this->print_slip($n, $datane);
$n++;
$this->Admin_model->upd_data("labeling", "set pp_stat='P'", "where no_spb='" . $row['no_spb'] . "'");
}
$n > 1 ? $z = $n % ($n / 2) : ($z = '');
$z == 1 || ($z = '') ? $zz = 1 : ($zz = 0);
$this->print_slip($n + $zz, '');
$this->print_slip($n + $zz + 1, '');
$this->load->view('master/print_label', $datax);
}
示例12: foreach
//echo $a->getColWidth();
// set lebar tiap kolom tabel transaksi
$a->SetWidths(array(10, 70, 60, 15, 30));
// set align tiap kolom tabel transaksi
$a->SetAligns(array("C", "L", "L", "C", "R"));
$a->SetFont('Arial', 'B', 10);
$a->SetFont('Arial', '', 9);
//$rec = $temp_rec->result();
$n = 0;
$harga = 0;
$hgb = 0;
$hargaj = 0;
$jml = 0;
foreach ($temp_rec as $r) {
$n++;
$a->Row(array($n, $r->Nama, rdb('mst_departemen', 'Departemen', 'Departemen', "where ID='" . $r->ID_Dept . "'"), $r->Cicilan, number_format($r->Total, 2)));
//sub tlot
$harga = $harga + $r->Total;
}
$a->SetFont('Arial', 'B', 10);
$a->SetFillColor(225, 225, 225);
$a->Cell(155, 8, "TOTAL", 1, 0, 'R', true);
$a->Cell(30, 8, number_format($harga, 2), 1, 0, 'R', true);
$a->Output('application/logs/' . $this->session->userdata('userid') . '_rekap_penjualan.pdf', 'F');
//show pdf output in frame
$path = 'application/views/laporan';
$img = " <img src='" . base_url() . "asset/images/back.png' onclick='js:window.history.back();' style='cursor:pointer' title='click for select other filter data'>";
link_js('auto_sugest.js,lap_beli.js,jquery.fixedheader.js', 'asset/js,' . $path . '/js,asset/js');
panel_begin('Print Preview', '', 'Back' . $img);
?>
<iframe src="<?php
示例13: detail_kreditur
function detail_kreditur()
{
$data = array();
$n = 0;
$ID = $_POST['ID'];
$ID_Agt = $_POST['ID_Agt'];
$data['Agt'] = rdb('mst_anggota', 'Nama', 'Nama', "where ID='" . $_POST['ID_Agt'] . "'");
$data['Dept'] = rdb('mst_departemen', 'Departemen', 'Departemen', "where ID='" . rdb('mst_anggota', 'ID_Dept', 'ID_Dept', "where ID='" . $_POST['ID_Agt'] . "'") . "'");
$data['ID_Agt'] = $ID_Agt;
$this->load->view('member/member_pinjaman_barang_detail', $data);
}
示例14: get_nm_material
function get_nm_material($str, $limit, $fld, $dest = '')
{
$data = array();
$where = $dest == '' ? '' : $dest;
$sql = "select * from inv_barang where {$fld} like '" . $str . "%' {$where} order by kode,nama_barang limit {$limit}";
//echo $sql;
$dest == '' ? $dest = 'Nama_Barang' : ($dest = $dest);
$rw = mysql_query($sql) or die(mysql_error());
while ($row = mysql_fetch_object($rw)) {
$data[] = array('data' => $row->{$fld}, 'description' => $row->{$dest}, 'jenis' => $row->ID_Jenis, 'kategori' => $row->ID_Kategori, 'satuan' => $row->ID_Satuan, 'nm_satuan' => rdb('inv_barang_satuan', 'Satuan', 'Satuan', "where ID='" . $row->ID_Satuan . "'"), 'nm_jenis' => rdb('inv_barang_jenis', 'JenisBarang', 'JenisBarang', "where ID='" . $row->ID_Jenis . "'"), 'status' => $row->Status, 'kode' => $row->Kode, 'pemasok' => $row->ID_Pemasok . "-" . rdb('inv_pemasok', 'Pemasok', 'Pemasok', "where ID='" . $row->ID_Pemasok . "'"), 'hargabeli' => $row->Harga_Beli, 'id_pemasok' => $row->ID_Pemasok, 'hargajual' => $row->Harga_Jual, 'id_barang' => $row->ID, 'nm_kategori' => rdb('inv_barang_kategori', 'Kategori', 'Kategori', "where ID='" . $row->ID_Kategori . "'"));
}
return $data;
}
示例15: makeModel
public function makeModel($key)
{
list($db, $table) = explode('_', $key, 2);
return rdb($db, $table)->model();
}