本文整理汇总了PHP中Now函数的典型用法代码示例。如果您正苦于以下问题:PHP Now函数的具体用法?PHP Now怎么用?PHP Now使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Now函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreate
public function actionCreate()
{
// return;
$model = new MtPinjamKendaraan();
if (!Yii::app()->request->isAjaxRequest) {
return;
}
if (isset($_POST) && !empty($_POST)) {
$status = false;
$msg = 'Peminjaman kendaraan berhasil disimpan.';
$transaction = app()->db->beginTransaction();
$id = -1;
try {
$ref = new MtReferenceCom();
$docref = $ref->get_next_reference(PINJAM_KENDARAAN);
$user = app()->user->getId();
foreach ($_POST as $k => $v) {
if ($k == 'ongkos_sewa' || $k == 'ongkos_driver' || $k == 'ongkos_bbm' || $k == 'total_ongkos' || $k == 'dp' || $k == 'sisa_tagihan' || $k == 'disc' || $k == 'total') {
$v = get_number($v);
}
$_POST['MtPinjamKendaraan'][$k] = $v;
}
$_POST['MtPinjamKendaraan']['entry_time'] = Now();
$_POST['MtPinjamKendaraan']['id_driver'] = is_integer($_POST['MtPinjamKendaraan']['id_driver']) ? $_POST['MtPinjamKendaraan']['id_driver'] : NULL;
$_POST['MtPinjamKendaraan']['users_id'] = $user;
$_POST['MtPinjamKendaraan']['doc_ref'] = $docref;
$model->attributes = $_POST['MtPinjamKendaraan'];
$msg = "Data gagal disimpan";
if ($model->save()) {
$status = true;
$msg = "Data berhasil di simpan dengan id " . $model->id_pinjam;
} else {
$status = false;
}
$id = $docref;
$date = $model->trans_date;
$ref->save(PINJAM_KENDARAAN, $model->id_pinjam, $docref);
if ($model->dp > 0) {
$bank_account = '0';
if ($model->trans_via == "Tunai") {
$bank_account = Mt::get_act_code_from_bank_act(Mt::get_prefs('akun_kas_ditangan'));
} else {
$bank_account = Mt::get_act_code_from_bank_act(Mt::get_prefs('akun_kas_dibank'));
}
// debet kas - kredit pendapatan
Mt::add_gl(PINJAM_KENDARAAN, $model->id_pinjam, $date, $docref, $bank_account, '-', $model->dp, $user, $model->id_mobil);
Mt::add_gl(PINJAM_KENDARAAN, $model->id_pinjam, $date, $docref, Mt::get_prefs('akun_uang_muka'), '-', -$model->dp, $user, $model->id_mobil);
}
$transaction->commit();
} catch (Exception $ex) {
$transaction->rollback();
$status = false;
$msg = $ex;
}
echo CJSON::encode(array('success' => $status, 'msg' => $msg, 'id' => $id));
Yii::app()->end();
}
}
示例2: menu_footer
function menu_footer($no_menu, $is_index)
{
global $version, $allow_demo_mode, $app_title, $power_url, $power_by, $path_to_root, $Pagehelp, $Ajax;
include_once $path_to_root . "/includes/date_functions.inc";
$context = array('isIndex' => $is_index, 'date' => Today(), 'time' => Now());
if ($no_menu == false) {
$footer = ThemeBootstrap::get()->renderBlock('page.twig.html', 'footer', $context);
echo $footer;
}
}
示例3: Base_AfterBody_Handler
public function Base_AfterBody_Handler($Sender)
{
$Session = Gdn::Session();
if (!Debug() && !$Session->CheckPermission('Plugins.Debugger.View')) {
return;
}
if (!$Sender->Head) {
$Sender->Head = new HeadModule($Sender);
}
$Sender->Head->AddCss('/plugins/Debugger/style.css');
//$Session = Gdn::Session();
//if ($Session->CheckPermission('Plugins.Debugger.View')) {
$String = '<div id="Sql" class="DebugInfo">';
$String .= '<h2>' . T('Debug Information') . '</h2>';
// Add the canonical Url.
if (method_exists($Sender, 'CanonicalUrl')) {
$CanonicalUrl = htmlspecialchars($Sender->CanonicalUrl(), ENT_COMPAT, 'UTF-8');
$String .= '<div class="CanonicalUrl"><b>' . T('Canonical Url') . "</b>: <a href=\"{$CanonicalUrl}\">{$CanonicalUrl}</a></div>";
}
$Database = Gdn::Database();
$SQL = $Database->SQL();
if (!is_null($Database)) {
$Queries = $Database->Queries();
$QueryTimes = $Database->QueryTimes();
$String .= '<h3>' . count($Queries) . ' queries in ' . $Database->ExecutionTime() . 's</h3>';
foreach ($Queries as $Key => $QueryInfo) {
$Query = $QueryInfo['Sql'];
// this is a bit of a kludge. I found that the regex below would mess up when there were incremented named parameters. Ie. it would replace :Param before :Param0, which ended up with some values like "'4'0".
if (isset($QueryInfo['Parameters']) && is_array($QueryInfo['Parameters'])) {
$tmp = $QueryInfo['Parameters'];
$Query = $SQL->ApplyParameters($Query, $tmp);
}
$String .= $QueryInfo['Method'] . '<small>' . @number_format($QueryTimes[$Key], 6) . 's</small>' . (isset($QueryInfo['Cache']) ? '<div><b>Cache:</b> ' . var_export($QueryInfo['Cache'], TRUE) . '</div>' : '') . '<pre>' . htmlspecialchars($Query) . ';</pre>';
}
}
$String .= '<h3>Controller Data</h3><pre>';
$String .= self::FormatData($Sender->Data);
$String .= '</pre>';
global $Start;
$String .= '<h3>Page completed in ' . round(Now() - $_SERVER['REQUEST_TIME'], 4) . 's</h3>';
/*
<div>
<strong>Application:</strong> ' . $Sender->ApplicationFolder . ';
<strong>Controller:</strong> ' . $Sender->ClassName . ';
<strong>Method:</strong> ' . $Sender->RequestMethod . ';
</div>
</div>';
*/
$String .= '</div>';
echo $String;
//}
}
示例4: actionCreate
public function actionCreate()
{
if (!Yii::app()->request->isAjaxRequest) {
return;
}
if (isset($_POST) && !empty($_POST)) {
$gl = new GlPah();
$status = false;
$msg = 'Kas masuk berhasil disimpan.';
$user = Yii::app()->user->getId();
$id = -1;
//require_once(Yii::app()->basePath . '/vendors/frontaccounting/ui.inc');
app()->db->autoCommit = false;
$transaction = app()->db->beginTransaction();
try {
$ref = new PahReferenceCom();
$docref = $ref->get_next_reference(KAS_MASUK);
$kas_masuk = new PahKasMasuk();
foreach ($_POST as $k => $v) {
if ($k == 'amount') {
$v = get_number($v);
}
$_POST['PahKasMasuk'][$k] = $v;
}
$date = $_POST['PahKasMasuk']['trans_date'];
$_POST['PahKasMasuk']['entry_time'] = Now();
$_POST['PahKasMasuk']['users_id'] = $user;
$_POST['PahKasMasuk']['doc_ref'] = $docref;
$kas_masuk->attributes = $_POST['PahKasMasuk'];
if (!$kas_masuk->save()) {
throw new Exception("Gagal menyimpan kas masuk.");
}
$id = $docref;
$ref->save(KAS_MASUK, $kas_masuk->kas_masuk_id, $docref);
$bank_account = Pah::get_act_code_from_bank_act($kas_masuk->pah_bank_accounts_id);
$act_donatur = $kas_masuk->pahDonatur->pah_chart_master_account_code;
//debet kode kas/bank - kredit pendapatan
$gl->add_gl(KAS_MASUK, $kas_masuk->kas_masuk_id, $date, $docref, $bank_account, '-', $kas_masuk->amount, $user);
$gl->add_gl(KAS_MASUK, $kas_masuk->kas_masuk_id, $date, $docref, $act_donatur, $kas_masuk->note, -$kas_masuk->amount, $user);
$gl->validate();
$transaction->commit();
$status = true;
} catch (Exception $ex) {
$transaction->rollback();
$status = false;
$msg = $ex;
}
}
echo CJSON::encode(array('success' => $status, 'id' => $id, 'msg' => $msg));
Yii::app()->end();
}
示例5: actionCreate
public function actionCreate()
{
if (!Yii::app()->request->isAjaxRequest) {
return;
}
if (isset($_POST) && !empty($_POST)) {
$gl = new GlPah();
$status = false;
$msg = 'Anggaran berhasil disimpan.';
$user = Yii::app()->user->getId();
$id = -1;
//require_once(Yii::app()->basePath . '/vendors/frontaccounting/ui.inc');
app()->db->autoCommit = false;
$transaction = app()->db->beginTransaction();
try {
$ref = new PahReferenceCom();
$docref = $ref->get_next_reference(AKTIVITAS);
$aktivitas = new PahAktivitas();
foreach ($_POST as $k => $v) {
if ($k == 'amount') {
$v = get_number($v);
}
$_POST['PahAktivitas'][$k] = $v;
}
$date = $_POST['PahAktivitas']['trans_date'];
$_POST['PahAktivitas']['entry_time'] = Now();
$_POST['PahAktivitas']['users_id'] = $user;
$_POST['PahAktivitas']['doc_ref'] = $docref;
$aktivitas->attributes = $_POST['PahAktivitas'];
if (!$aktivitas->save()) {
throw new Exception("Gagal menyimpan aktivitas.");
}
$id = $docref;
$ref->save(AKTIVITAS, $aktivitas->aktivitas_id, $docref);
$bank_account = Pah::get_act_code_from_bank_act($aktivitas->pah_bank_accounts_id);
$act_sub = $aktivitas->pahSubAktivitas->account_code;
//debet kode beban - kredit kas bank
$gl->add_gl(AKTIVITAS, $aktivitas->aktivitas_id, $date, $docref, $act_sub, $aktivitas->note, $aktivitas->amount, $user);
$gl->add_gl(AKTIVITAS, $aktivitas->aktivitas_id, $date, $docref, $bank_account, '-', -$aktivitas->amount, $user);
$gl->validate();
$transaction->commit();
$status = true;
} catch (Exception $ex) {
$transaction->rollback();
$status = false;
$msg = $ex;
}
echo CJSON::encode(array('success' => $status, 'id' => $id, 'msg' => $msg));
Yii::app()->end();
}
}
示例6: actionCreate
public function actionCreate()
{
if (!Yii::app()->request->isAjaxRequest) {
return;
}
if (isset($_POST) && !empty($_POST)) {
$status = false;
$msg = 'Kas keluar berhasil disimpan.';
$user = Yii::app()->user->getId();
$id = -1;
//require_once(Yii::app()->basePath . '/vendors/frontaccounting/ui.inc');
app()->db->autoCommit = false;
$transaction = app()->db->beginTransaction();
try {
$ref = new PeReferenceCom();
$docref = $ref->get_next_reference(KAS_KELUAR);
$kas_keluar = new PeKasKeluar();
foreach ($_POST as $k => $v) {
if ($k == 'amount') {
$v = get_number($v);
}
$_POST['PeKasKeluar'][$k] = $v;
}
$date = $_POST['PeKasKeluar']['trans_date'];
$_POST['PeKasKeluar']['entry_time'] = Now();
$_POST['PeKasKeluar']['users_id'] = $user;
$_POST['PeKasKeluar']['doc_ref'] = $docref;
$kas_keluar->attributes = $_POST['PeKasKeluar'];
if (!$kas_keluar->save()) {
throw new Exception("Gagal menyimpan kas_keluar.");
}
$id = $docref;
$ref->save(KAS_KELUAR, $kas_keluar->kas_keluar_id, $docref);
$bank_account = Pe::get_act_code_from_bank_act($kas_keluar->pe_bank_accounts_id);
//debet kode beban - kredit kas/bank
Pe::add_gl(KAS_KELUAR, $kas_keluar->kas_keluar_id, $date, $docref, $kas_keluar->pe_account_code, $kas_keluar->note, $kas_keluar->amount, $user);
Pe::add_gl(KAS_KELUAR, $kas_keluar->kas_keluar_id, $date, $docref, $bank_account, '-', -$kas_keluar->amount, $user);
$transaction->commit();
$status = true;
} catch (Exception $ex) {
$transaction->rollback();
$status = false;
$msg = $ex;
}
}
echo CJSON::encode(array('success' => $status, 'id' => $id, 'msg' => $msg));
Yii::app()->end();
}
示例7: menu_footer
function menu_footer($no_menu, $is_index)
{
global $path_to_root, $power_url, $power_by;
include_once $path_to_root . "/includes/date_functions.inc";
if ($no_menu == false) {
echo "<div id='footer'>\n";
if (isset($_SESSION['wa_current_user'])) {
echo "<span class='power'><a target='_blank' href='{$power_url}'>{$power_by}</a></span\n";
echo "<span class='date'>" . Today() . " | " . Now() . "</span>\n";
echo "<span class='date'>" . show_users_online() . "</span>\n";
}
echo "</div>\n";
}
echo "</div>\n";
echo "</div>\n";
}
示例8: Base_Render_Before
public function Base_Render_Before($Sender)
{
$Session = Gdn::Session();
if (!$Session->CheckPermission('Garden.Settings.Manage')) {
return;
}
if (!$Sender->Head) {
$Sender->Head = new HeadModule($Sender);
}
$Sender->Head->AddCss('/plugins/Debugger/style.css');
//$Session = Gdn::Session();
//if ($Session->CheckPermission('Plugins.Debugger.View')) {
$String = '<div id="Sql">';
$Database = Gdn::Database();
if (!is_null($Database)) {
$Queries = $Database->Queries();
$QueryTimes = $Database->QueryTimes();
$String .= '<h3>' . count($Queries) . ' queries in ' . $Database->ExecutionTime() . 's</h3>';
foreach ($Queries as $Key => $QueryInfo) {
$Query = $QueryInfo['Sql'];
// this is a bit of a kludge. I found that the regex below would mess up when there were incremented named parameters. Ie. it would replace :Param before :Param0, which ended up with some values like "'4'0".
if (isset($QueryInfo['Parameters']) && is_array($QueryInfo['Parameters'])) {
$tmp = $QueryInfo['Parameters'];
arsort($tmp);
foreach ($tmp as $Name => $Parameter) {
$Pattern = '/(.+)(' . $Name . ')([\\W\\s]*)(.*)/';
$Replacement = "\$1'" . htmlentities($Parameter, ENT_COMPAT, 'UTF-8') . "'\$3\$4";
$Query = preg_replace($Pattern, $Replacement, $Query);
}
}
$String .= '<div>' . $QueryInfo['Method'] . '</div><pre>' . $Query . ';</pre><small>' . number_format($QueryTimes[$Key], 6) . 's</small>';
}
}
global $Start;
$String .= '<h3>Page completed in ' . round(Now() - $_SERVER['REQUEST_TIME'], 4) . 's</h3>';
/*
<div>
<strong>Application:</strong> ' . $Sender->ApplicationFolder . ';
<strong>Controller:</strong> ' . $Sender->ClassName . ';
<strong>Method:</strong> ' . $Sender->RequestMethod . ';
</div>
</div>';
*/
$String .= '</div>';
$Sender->AddAsset('Foot', $String);
//}
}
示例9: druckstatusR
function druckstatusR(&$r)
{
$tname = $r->RecordSource;
if (IsNull($tname)) {
$tname = 'Keine Tabelle';
}
if (Left($tname, 7) == 'SELECT ') {
$tname = 'SQL direkt';
}
if (!is_a($r, 'AmberObject')) {
$Rname = 'Falscher Parameter!!!';
} else {
$Rname = $r->Name;
}
$d = ' am ' . Format(Now(), 'ddd dd.mmm.yyyy') . ' um ' . Format(Now(), 'hh.nn');
$s = $_SERVER['SERVER_NAME'];
return 'Bericht: [' . $Rname . '] Tabelle/Abfrage: (' . $tname . ')' . $d . ' Server: [' . $s . ']';
}
示例10: Base_AfterBody_Handler
public function Base_AfterBody_Handler($Sender)
{
$Session = Gdn::Session();
if (!$Session->CheckPermission('Garden.Settings.Manage')) {
return;
}
if (!$Sender->Head) {
$Sender->Head = new HeadModule($Sender);
}
$Sender->Head->AddCss('/plugins/Debugger/style.css');
//$Session = Gdn::Session();
//if ($Session->CheckPermission('Plugins.Debugger.View')) {
$String = '<div id="Sql">';
$Database = Gdn::Database();
$SQL = $Database->SQL();
if (!is_null($Database)) {
$Queries = $Database->Queries();
$QueryTimes = $Database->QueryTimes();
$String .= '<h3>' . count($Queries) . ' queries in ' . $Database->ExecutionTime() . 's</h3>';
foreach ($Queries as $Key => $QueryInfo) {
$Query = $QueryInfo['Sql'];
// this is a bit of a kludge. I found that the regex below would mess up when there were incremented named parameters. Ie. it would replace :Param before :Param0, which ended up with some values like "'4'0".
if (isset($QueryInfo['Parameters']) && is_array($QueryInfo['Parameters'])) {
$tmp = $QueryInfo['Parameters'];
$Query = $SQL->ApplyParameters($Query, $tmp);
}
$String .= $QueryInfo['Method'] . '<small>' . @number_format($QueryTimes[$Key], 6) . 's</small>' . '<pre>' . $Query . ';</pre>';
}
}
global $Start;
$String .= '<h3>Page completed in ' . round(Now() - $_SERVER['REQUEST_TIME'], 4) . 's</h3>';
/*
<div>
<strong>Application:</strong> ' . $Sender->ApplicationFolder . ';
<strong>Controller:</strong> ' . $Sender->ClassName . ';
<strong>Method:</strong> ' . $Sender->RequestMethod . ';
</div>
</div>';
*/
$String .= '</div>';
echo $String;
//}
}
示例11: Process
function Process()
{
if (_GET('filename') == '') {
$this->Haxor();
return;
}
$img = new Image();
if (!$img->Find(array('filename' => _GET('filename')))) {
$this->Error('Requested file not found');
return;
}
if (!InSESSION('view:' . _GET('filename'))) {
$_SESSION['view:' . _GET('filename')] = true;
$img->views++;
}
$img->lastshow = Now();
$img->Save();
$this->img = $img;
$this->Render();
}
示例12: actionCreate
public function actionCreate()
{
$model = new PahLampiran();
if (!Yii::app()->request->isAjaxRequest) {
return;
}
if (isset($_POST) && !empty($_POST)) {
foreach ($_POST as $k => $v) {
$_POST['PahLampiran'][$k] = $v;
}
$_POST['PahLampiran']['entry_time'] = Now();
$model->attributes = $_POST['PahLampiran'];
$msg = "Data gagal disimpan";
if ($model->save()) {
$status = true;
$msg = "Data berhasil di simpan dengan id " . $model->id_lampiran;
} else {
$msg .= " " . CHtml::errorSummary($model);
$status = false;
}
echo CJSON::encode(array('success' => $status, 'msg' => $msg));
Yii::app()->end();
}
}
示例13: system
system('java -jar yuicompressor/yuicompressor-2.4.8.jar -o ' . $dest . substr($file, strlen($src)) . ' ' . $file);
++$totalYui;
} else {
copy($file, $dest . substr($file, strlen($src)));
}
}
++$totalFiles;
}
}
}
function ReplaceVersionName($fileName)
{
global $versionName;
echo "Version name: {$versionName}\n";
$str = file_get_contents($fileName);
$oldValue = "define('PACKAGE_STRING', 'lite_development');";
$newValue = "define('PACKAGE_STRING', '{$versionName}');";
$str = str_replace($oldValue, $newValue, $str);
file_put_contents($fileName, $str);
}
$t0 = Now();
if (!EndsWith($src, '/')) {
$src .= '/';
}
if (!EndsWith($dest, '/')) {
$dest .= '/';
}
ProcessDir($src);
ReplaceVersionName($dest . 'version.php');
$t = (Now() - $t0) / 1000;
echo "Total: {$totalFiles} files ({$totalYui} minified) within {$totalDirs} directories in {$t} seconds.\n";
示例14: menu_footer
function menu_footer($no_menu, $is_index)
{
global $version, $allow_demo_mode, $app_title, $power_url, $power_by, $path_to_root, $Pagehelp, $Ajax;
include_once $path_to_root . "/includes/date_functions.inc";
echo "</td></tr></table>\n";
// 'main_page'
if ($no_menu == false) {
if ($is_index) {
echo "<table class='bottomBar'>\n";
} else {
echo "<table class='bottomBar2'>\n";
}
echo "<tr>";
if (isset($_SESSION['wa_current_user'])) {
$phelp = implode('; ', $Pagehelp);
echo "<td class='bottomBarCell'>" . Today() . " | " . Now() . "</td>\n";
$Ajax->addUpdate(true, 'hotkeyshelp', $phelp);
echo "<td id='hotkeyshelp'>" . $phelp . "</td>";
}
echo "</tr></table>\n";
}
echo "</td></tr> </table>\n";
// 'callout_main'
if ($no_menu == false) {
echo "<table align='center' id='footer'>\n";
echo "<tr>\n";
echo "<td align='center' class='footer'><a target='_blank' href='{$power_url}' tabindex='-1'><font color='#ffffff'>{$app_title} {$version} - " . _("Theme:") . " " . user_theme() . " - " . show_users_online() . "</font></a></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='center' class='footer'><a target='_blank' href='{$power_url}' tabindex='-1'><font color='#ffff00'>{$power_by}</font></a></td>\n";
echo "</tr>\n";
if ($allow_demo_mode == true) {
echo "<tr>\n";
//echo "<td><br><div align='center'><a href='http://sourceforge.net'><img src='http://sourceforge.net/sflogo.php?group_id=89967&type=5' alt='SourceForge.net Logo' width='210' height='62' border='0' align='center' /></a></div></td>\n";
echo "</tr>\n";
}
echo "</table><br><br>\n";
}
}
示例15: count
$Database = Gdn::database();
$SQL = $Database->sql();
if (!is_null($Database)) {
$String = '';
$Queries = $Database->Queries();
$String .= '<h3>' . count($Queries) . ' queries in ' . $Database->ExecutionTime() . 's</h3>';
foreach ($Queries as $Key => $QueryInfo) {
$Query = $QueryInfo['Sql'];
// this is a bit of a kludge. I found that the regex below would mess up when there were incremented named parameters. Ie. it would replace :Param before :Param0, which ended up with some values like "'4'0".
if (isset($QueryInfo['Parameters']) && is_array($QueryInfo['Parameters'])) {
$tmp = $QueryInfo['Parameters'];
$Query = $SQL->ApplyParameters($Query, $tmp);
}
$String .= $QueryInfo['Method'] . ' <small>' . $QueryInfo['connection'] . '</small>' . ' <small>' . @number_format($QueryInfo['Time'], 6) . 's</small> ' . (isset($QueryInfo['Cache']) ? '<div><b>Cache:</b> ' . var_export($QueryInfo['Cache'], true) . '</div>' : '') . '<pre>' . htmlspecialchars($Query) . ';</pre>';
}
echo $String;
}
global $Start;
echo '<h3>Page completed in ' . round(Now() - $_SERVER['REQUEST_TIME'], 4) . 's</h3>';
?>
<h3>Controller Data</h3>
<pre>
<?php
echo DebuggerPlugin::FormatData(Gdn::controller()->Data);
?>
</pre>
</div>