本文整理汇总了PHP中getDateTime函数的典型用法代码示例。如果您正苦于以下问题:PHP getDateTime函数的具体用法?PHP getDateTime怎么用?PHP getDateTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getDateTime函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: log
/**
* log a subscription request to the database
* @param string $recipientEmail the email address of the recipient
* @param string $recipientName the name of the recipient
* @param array $fields set of fields (answers) to assign to the user record
* @param string $listId unique identifier for the list
* @param string $clientId unique identifier for the client making the request
* @return null
*/
public function log($recipientEmail, $recipientName, $fields, $listId, $clientId)
{
$logged = $this->repo->store(["list_id" => $listId, "client_id" => $clientId, "recipient_email" => $recipientEmail, "recipient_name" => $recipientName, "fields" => json_encode($fields), "requested" => getDateTime()]);
if (!$logged) {
return apiErrorResponse('badRequest', ['errors' => "There was a problem with the request."]);
}
Event::fire('RequestWasLogged');
return apiSuccessResponse('ok');
}
开发者ID:paulschneider,项目名称:email-platform,代码行数:18,代码来源:MailLogger.php
示例2: match
public function match($data1, $data2)
{
$Kundali = new Library_Kundali();
$fromDate = getDateTime($data1['dob']);
$toDate = getDateTime($data2['dob']);
$returnArrFrom = $Kundali->precalculate($fromDate['month'], $fromDate['day'], $fromDate['year'], $fromDate['hour'], $fromDate['minute'], $data1['zone_h'], $data1['zone_m'], $data1['lon_h'], $data1['lon_m'], $data1['lat_h'], $data1['lat_m'], $data1['dst'], $data1['lon_e'], $data1['lat_s']);
$returnArrTo = $Kundali->precalculate($toDate['month'], $toDate['day'], $toDate['year'], $toDate['hour'], $toDate['minute'], $data2['zone_h'], $data2['zone_m'], $data2['lon_h'], $data2['lon_m'], $data2['lat_h'], $data2['lat_m'], $data2['dst'], $data2['lon_e'], $data2['lat_s']);
$pts = $Kundali->getpoints($returnArrFrom[9], $returnArrTo[9]);
$finalPoints = array('points' => $pts, 'result' => $Kundali->interpret($pts));
return array($returnArrFrom, $returnArrTo, $finalPoints);
}
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:11,代码来源:Horo.class.php
示例3: expense_voucher_detail
function expense_voucher_detail($voucher_id, $voucher_paid_from_account, $expense_type, $expense_detail, $expense_ammount, $expense_attachment)
{
$now = getDateTime(0, 'mySQL');
$insert = DB::Insert(DB_PREFIX . $_SESSION['co_prefix'] . 'voucher_expense_detail', array('voucher_id' => $voucher_id, 'expense_account_id' => $voucher_paid_from_account, 'expense_type' => $expense_type, 'expense_description' => $expense_detail, 'expense_amount' => $expense_ammount, 'has_attachment' => $expense_attachment, 'created_by' => $_SESSION['user_name'], 'created_on' => $now, 'voucher_detail_status' => 'Draft'));
$voucher_detail_id = DB::insertId();
if ($voucher_detail_id) {
return $voucher_detail_id;
return $voucher_id;
} else {
return 0;
}
}
开发者ID:rylsteel,项目名称:phpledger,代码行数:12,代码来源:gl_functions.php
示例4: setAttempt
/**
* set the appropriate attempt count for the row
* @param array $queueItem the database record for the queued item
* @return null
*/
protected function setAttempt($queueItem, $attempt)
{
$data = ["attempt_{$attempt}" => getDateTime()];
# if this was the final attempt
if ($attempt == 3) {
$data['failed_all_attempts'] = true;
$this->notifyAllFailed();
}
# update the database to reflect the attempt
DB::table($this->table)->where('id', $queueItem->id)->update($data);
# and request we re-queue the items
$this->requeue();
}
开发者ID:paulschneider,项目名称:email-platform,代码行数:18,代码来源:QueueRepository.php
示例5: add_coa
function add_coa($account_code, $account_group, $account_desc_short, $account_desc_long, $parent_account_id, $account_type)
{
$consolidate_only = 0;
$activity_account = 0;
$has_parent = 0;
$has_children = 0;
$coa_level = 1;
$code_exists = 0;
$desc_exists = 0;
if ($parent_account_id != 0) {
$has_parent = 1;
}
if ($has_parent == 1) {
$coa_level = get_account_level($parent_account_id) + 1;
}
if ($account_type == "consolidate_only") {
$consolidate_only = 1;
}
if ($account_type == "activity_account") {
$activity_account = 1;
}
if (account_code_exists($account_code)) {
$code_exists = 1;
}
//check if account desc already exists
if (account_desc_exists($account_desc_short)) {
$desc_exists = 1;
}
if ($code_exists != 1 and $desc_exists != 1) {
$insert = DB::Insert(DB_PREFIX . $_SESSION['co_prefix'] . 'coa', array('account_code' => $account_code, 'account_group' => $account_group, 'account_desc_short' => $account_desc_short, 'account_desc_long' => $account_desc_long, 'activity_account' => $activity_account, 'consolidate_only' => $consolidate_only, 'has_parent' => $has_parent, 'coa_level' => $coa_level, 'has_children' => $has_children, 'parent_account_id' => $parent_account_id, 'last_modified_by' => $_SESSION['user_name'], 'last_modified_on' => getDateTime(date('now'), "mySQL"), 'created_by' => $_SESSION['user_name'], 'created_on' => getDateTime(date('now'), "mySQL"), 'account_status' => 'Active'));
$new_coa_id = DB::insertId();
if ($new_coa_id > 0 and $has_parent == 1) {
DB::update(DB_PREFIX . $_SESSION['co_prefix'] . 'coa', array('has_children' => 1), "account_id=%s", $parent_account_id);
}
return $new_coa_id;
} else {
return "0";
}
}
开发者ID:rylsteel,项目名称:phpledger,代码行数:39,代码来源:coa_functions.php
示例6: findCity
//$horo = new Models_Horo();
$city = findCity($_GET['city_id']);
//clearing user sql
$modelGeneral->clearCache($userSql);
//updating the city
if ($uid == $_SESSION['user']['id']) {
$data = array();
$md5Check = md5($userDetails['horo_cities']);
$horo_cities[$city['id']] = $city['name'];
$data['horo_cities'] = json_encode($horo_cities);
$md5Check2 = md5($data['horo_cities']);
if ($md5Check != $md5Check2) {
updateSettings($_SESSION['user']['id'], $data);
}
}
$fromDate = getDateTime($_GET['from_date']);
$date = $fromDate['year'] . '-' . $fromDate['month'] . '-' . $fromDate['day'];
$past = '';
$returnResult = array();
for ($counter = 0; $counter < $_GET['no_days']; $counter++) {
$day = date('d', strtotime("{$date} +{$counter} day"));
$month = date('m', strtotime("{$date} +{$counter} day"));
$year = date('Y', strtotime("{$date} +{$counter} day"));
for ($j = 0; $j < 24; $j = $j + 1) {
$hour = $j;
$dob = $year . '-' . $month . '-' . $day . ' ' . $hour . ':00:00';
$data2 = array_merge($city, array('dob' => $dob));
$result = $horo->match($userDetails, $data2);
if ($past == $result[1][9]) {
continue;
} else {
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:31,代码来源:main.php
示例7: Date
$js_global = '';
$js_global .= '<script type="text/javascript" src="' . DOMAIN_STATIC . '/themes' . $_version . '/pc/js/jquery.min.js?v=' . $cache_version . '"></script>';
$js_global .= '<script type="text/javascript" src="' . DOMAIN_STATIC . '/themes' . $_version . '/pc/js/bootstrap.min.js?v=' . $cache_version . '"></script>';
$js_global .= '<script type="text/javascript" src="' . DOMAIN_STATIC . '/themes' . $_version . '/tuthuoc/js/tuthuoc.js?v=' . $cache_version . '"></script>';
//google analytics
if (!DEBUG_LOCAL) {
$js_global .= '<script>
(function(i,s,o,g,r,a,m){i["GoogleAnalyticsObject"]=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,"script","//www.google-analytics.com/analytics.js","ga");
ga("require","displayfeatures");
ga("create", "UA-55614065-1", "auto");
ga("send", "pageview");
</script>';
$js_global .= '<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/vi_VN/sdk.js#xfbml=1&appId=1561038610796934&version=v2.0";
fjs.parentNode.insertBefore(js, fjs);
}(document, "script", "facebook-jssdk"));</script>';
$js_global .= '<script lang="javascript">
(function() {var _h1= document.getElementsByTagName("title")[0] || false;
var product_name = ""; if(_h1){product_name= _h1.textContent || _h1.innerText;}var ga = document.createElement("script"); ga.type = "text/javascript";
ga.src = "//live.vnpgroup.net/js/web_client_box.php?hash=5fae10239172918a62dab2e4d330c339&data=eyJoYXNoIjoiODY5ZmViOWVhOWYxOGViZDNlNDhhNmZhMDQ3NjdkMWMiLCJzc29faWQiOjExM30-&pname="+product_name;
var s = document.getElementsByTagName("script");s[0].parentNode.insertBefore(ga, s[0]);})();
</script>';
}
$tpl_constants = array('css_global' => $css_global, 'js_global' => $js_global, 'loading_image' => '<span class="fa fa-refresh fa-spin"></span>', 'string_time' => getDateTime(), 'string_wday' => getDateTime(1, 1, 0, 0, ''), 'string_date' => 'Ngày ' . date('d/m'), 'fanpage_link' => 'https://www.facebook.com/suckhoeankhang');
开发者ID:virutmath,项目名称:suckhoe,代码行数:30,代码来源:inc_config.php
示例8: foreach
foreach ($client_comments as $comment) {
?>
<div class="box-comment">
<img class="img-circle img-sm" alt="User Image" src="<?php
echo get_user_avatar_url($comment['created_by'], '50');
?>
" />
<div class="comment-text">
<span class="username">
<?php
echo get_user_full_name($comment['created_by']);
?>
<span class="text-muted pull-right">
<?php
echo getDateTime($comment['created_on'], "dtShort");
?>
</span>
</span>
<?php
echo $comment['comment'];
?>
</div>
</div>
<?php
}
} else {
echo '<div class="box-comment"><div class="comment-text">No Client Notes Added</div></div>';
}
?>
开发者ID:rmak78,项目名称:talentagency,代码行数:30,代码来源:view_client_profile.php
示例9: getPostVars
/**
* Check Post-Vars und Data Validation
*
* @return Boolean
*/
function getPostVars()
{
$todo_foo = new todo_foo();
$event = true;
if (empty($_POST['todotitle'])) {
$this->errors[] = 'err_100';
$event = false;
} else {
$todo_foo->todo_title = clearVars($_POST['todotitle']);
}
if (empty($_POST['todoprio'])) {
$this->errors[] = 'err_101';
$event = false;
} else {
$todo_foo->todo_prio = clearVars($_POST['todoprio']);
}
if (!empty($_POST['todostart'])) {
$todo_foo->todo_start = getDateTime($_POST['todostart']);
$todo_foo->show_start = $_POST['todostart'];
}
if (!empty($_POST['todofinish'])) {
$todo_foo->todo_finish = getDateTime($_POST['todofinish'], true);
$todo_foo->show_finish = $_POST['todofinish'];
}
if (!empty($_SESSION['edit_todo_id'])) {
$todo_foo->todo_id = (int) $_SESSION['edit_todo_id'];
}
if (!empty($_POST['movefield'])) {
$todo_foo->move = $_POST['movefield'];
}
if (!empty($_POST['todoproject'])) {
$todo_foo->todo_pr_id = $_POST['todoproject'];
} else {
$todo_foo->todo_pr_id = '0';
}
$todo_foo->todo_warndiff = isset($_POST['todowarndiff']) ? $_POST['todowarndiff'] : 0;
$todo_foo->todo_privat = isset($_POST['todoprivat']) ? $_POST['todoprivat'] : 0;
if (!empty($_POST['tododof'])) {
$todo_foo->todo_statusbar = $_POST['tododof'];
}
if (isset($_POST['todoagreed'])) {
$todo_foo->todo_status = $_POST['todoagreed'];
}
if (!empty($_POST['todocomment'])) {
$todo_foo->todo_comment = clearVars($_POST['todocomment']);
}
$this->todo_foo = $todo_foo;
return $event;
}
开发者ID:blowfishJ,项目名称:galaxyCode,代码行数:54,代码来源:todo.class.php
示例10: unset
unset($db_detail);
if (!$detail_data) {
error_404_document();
}
//tăng view cho tin
$db_update_view = new db_execute('UPDATE news SET new_view = new_view + 1 WHERE new_id = ' . $iNews);
unset($db_update_view);
//lấy chi tiết tin
$sql_news_content = 'SELECT ndt_content FROM news_detail WHERE ndt_id = ' . $iNews;
$db_content = new db_query($sql_news_content);
$row = mysqli_fetch_assoc($db_content->result);
unset($db_content);
$detail_data['new_detail'] = $row['ndt_content'];
$datetime_facebook = $detail_data['new_date'];
$datetime_detail_timestamp = $detail_data['new_date'];
$detail_data['new_date'] = getDateTime(1, 1, 1, 1, '', $detail_data['new_date']);
$detail_data['link_cat'] = generate_cat_url($detail_data);
$detail_data['new_picture'] = get_picture_path($detail_data['new_picture'], 'large');
$detail_data['facebook_share_link'] = 'http://khang.vn' . generate_news_detail_url($detail_data);
$detail_data['facebook_social'] = array();
$detail_data['facebook_social']['like'] = get_facebook_like_button($detail_data['facebook_share_link']);
$detail_data['facebook_social']['comment'] = get_facebook_comment_frame($detail_data['facebook_share_link']);
$detail_data['facebook_social']['embed'] = get_facebook_embedded_post($detail_data['facebook_share_link']);
$detail_data['new_teaser'] = $detail_data['new_teaser'] ? $detail_data['new_teaser'] : cut_string(removeHTML($detail_data['new_detail']), 200, '...');
$color_cat = get_color_category($detail_data['cat_id']);
$rainTpl->assign('color_cat', $color_cat);
$rainTpl->assign('page_title', $detail_data['new_title']);
$rainTpl->assign('detail_data', $detail_data);
//query ra các tin cùng chuyên mục
$sql_cat_list_news = 'SELECT new_id,
new_picture,
开发者ID:virutmath,项目名称:suckhoe,代码行数:31,代码来源:inc_news_detail.php
示例11: errorLog
function errorLog(string $msg)
{
logError("[err]{$msg};request ip:" . onLineIp() . ";url:" . getUrl() . ";ReferUrl:" . getReferUrl() . ";time:" . getDateTime());
// throw new Exception("[err]$msg;request ip:".onLineIp().";url:".getUrl().";ReferUrl:".getReferUrl().";time:".getDateTime());
}
开发者ID:yemasky,项目名称:my,代码行数:5,代码来源:func.Common.php
示例12: getDateTime
<abbr class="timeago" title="<?php
echo $company['last_modified_on'];
?>
">
</abbr></td>
<td width="65%"><p><strong>Last modified</strong> by User :<b>[ <?php
echo $company['last_modified_by'];
?>
]</b> at <b>[ <?php
echo getDateTime($company['last_modified_on'], 'dtLong');
?>
]</b>. Record was <b>first created</b> by User : <b>[ <?php
echo $company['created_by'];
?>
]</b> at <b>[ <?php
echo getDateTime($company['created_on'], 'dtShort');
?>
]</b>. Company <b>Status</b> is<b> [ <?php
echo $company['company_status'];
?>
] </b>. Click here to view history of changes to company ID: <strong><?php
echo $company['company_id'];
?>
</strong> .
</p>
</td>
</tr>
</tbody>
</table>
开发者ID:rylsteel,项目名称:phpledger,代码行数:29,代码来源:company_info.php
示例13: detail
function detail()
{
# form validation settings
$rules = array(array('field' => 'body', 'label' => 'Comment', 'rules' => 'trim|required|min_length[3]|max_length[1500]|htmlspecialchars|xss_clean'));
$this->form_validation->set_message('required', '%s required');
$this->form_validation->set_message('min_length', '%s too short');
$this->form_validation->set_message('max_length', '%s too long');
$this->form_validation->set_rules($rules);
# valid input
if ($this->form_validation->run() == TRUE) {
# verify humanity and redirect if bot
if ($_POST['human'] != "") {
redirect('shout');
} else {
# remove value from array
unset($_POST['human']);
}
# get IP
$ip = $_SERVER['REMOTE_ADDR'];
# seed array with post data and extend
$data = $_POST;
$data['ip'] = $ip;
$data['date'] = getDateTime();
# format urls and mailtos: auto_link([input string], [url, email, both], [open links in new window?])
$data['body'] = auto_link($data['body'], 'both', TRUE);
$this->db->insert('comments', $data);
$this->db->update('submissions', array('lastpost' => getDateTime()), array('id' => $data['submission_id']));
redirect('shout/detail/' . $data['submission_id']);
}
# get comments
$data['submission_id'] = $this->uri->segment(3);
# verify that shout exists before continuing
$this->db->where('id', $data['submission_id']);
$results = $this->db->count_all_results('submissions');
if ($results < 1) {
redirect('shout');
}
# prep pagination
$config['per_page'] = '10';
$config['uri_segment'] = 5;
$config['base_url'] = base_url() . 'shout/detail/' . $data['submission_id'] . '/more';
$config['first_link'] = '';
$config['last_link'] = '';
$config['prev_link'] = '← Newer';
$config['next_link'] = 'Older →';
$config['full_tag_open'] = "<div id='page_nav_links'>";
$config['full_tag_close'] = "</div>";
$this->db->select('id');
$this->db->where('submission_id', $data['submission_id']);
$config['total_rows'] = $this->db->count_all_results('comments');
$this->pagination->initialize($config);
# get uri data
$data['db_offset'] = $this->uri->segment(5);
# get(table, limit, offset)
$this->db->select('id, body, ip, date');
$this->db->where('submission_id', $data['submission_id']);
$this->db->order_by("date", "desc");
$data['comments'] = $this->db->get('comments', $config['per_page'], $data['db_offset']);
$data['before'] = $config['total_rows'];
$data['after'] = $data['comments']->num_rows;
$data['pageNavLinks'] = $this->pagination->create_links();
# get the shout's content
$this->db->select('id, title, body, ip, date');
$data['shout'] = $this->db->get_where('submissions', array('id' => $data['submission_id']));
# finally...
$this->load->view('detail_view', $data);
}
开发者ID:rsesek,项目名称:bu-shout,代码行数:67,代码来源:shout.php
示例14: sin
case 1:
$tip = "sin(60 is" . sin(6);
break;
case 2:
$tip = "The square root of {$r} is " . sqrt($r);
break;
case 3:
$tip = "987654321 is formatted to " . number_format('987654321', $r, '.', ',');
break;
case 4:
$tip = "Your digital ID is " . uniqid();
break;
case 5:
$tip = "2<sup>{$r}</sup> is " . pow(2, $r);
break;
case 6:
$tip = "{$r} in binary format is " . decbin($r);
break;
default:
$tip = "Natural logarithms, <i>e</i>, to the power of {$r} is " . exp($r);
break;
}
echo $tip;
echo "<hr size='1'>";
function getDateTime()
{
date_default_timezone_set("America/Los_Angeles");
echo date('l jS \\of F Y h:i:s A');
}
getDateTime();
开发者ID:beetanz,项目名称:CIS-PHP,代码行数:30,代码来源:lab7_1.php
示例15: compatibleDateTimes
function compatibleDateTimes($baseArray, $otherArray)
{
$baseDates = getDateTime($baseArray);
$otherDates = getDateTime($baseArray);
$found = true;
for ($i = 1; $i < count($baseDates) && $found; $i++) {
//for each item in base array, search for its counterpart; stop searching if one entry cannot be found
$found = false;
for ($j = 0; $j < count($otherDates) && !$found; $j++) {
//keep searching if the element has not been found
if ($baseDates[$i] == $otherDates[$j]) {
$found = true;
}
}
}
return $found;
}
开发者ID:bjurban,项目名称:Autotune,代码行数:17,代码来源:tune.php
示例16: getDateTime
*
*************** ADD PHOTOS FORM **********************
*
***********************************************************/
/*********************************************************
*
*************** ADD PHOTOS FORM **********************
*
***********************************************************/
case "add_talent_photo":
$talent_id = $_POST['talent_id'];
$photo_caption = $_POST['photo_caption'];
$created_by = $_SESSION['user_id'];
$created_on = getDateTime(NULL, "mySQL");
$last_modified_by = $_SESSION['user_id'];
$last_modified_on = getDateTime(NULL, "mySQL");
if ($talent_id > 0 and $talent_id != "") {
//check if the file is uploaded and process the file if file is uploaded
if (!file_exists($_FILES['talent_photo']['tmp_name']) || !is_uploaded_file($_FILES['talent_photo']['tmp_name'])) {
// do nothing
} else {
//if photo is uploaded process the file with upload class
// process Talent Photos Information edit form
DB::insert('tams_talent_photos', array('talent_id' => $talent_id, 'photo_caption' => $photo_caption, 'created_by' => $created_by, 'created_on' => $created_on, 'last_modified_by' => $last_modified_by, 'last_modified_on' => $last_modified_on));
$photo_id = DB::insertId();
$photo_name .= $talent_id . "_" . $photo_id;
$handle = new upload($_FILES['talent_photo']);
if ($handle->uploaded) {
$handle->file_new_name_body = $photo_name;
$handle->allowed = array('image/*');
// $handle->file_overwrite = true;
开发者ID:rmak78,项目名称:talentagency,代码行数:31,代码来源:process_talent_forms.php
示例17: getDateTime
<p><?php
echo $voucher_desc;
?>
</p>
</div><!-- /.col -->
<div class="col-sm-4 ">
<b>JV ID: </b> <?php
echo $voucher_id;
?>
</b><br/>
<b>Voucher Ref#:</b> <?php
echo $voucher_ref;
?>
<br/>
<b>Voucher Date:</b> <?php
echo getDateTime($voucher_date, "dLong");
?>
<br/>
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.box-body -->
<div class="box-footer">
<small> Explanation text for JV header</small>
</div><!-- /.box-footer-->
</div><!-- /.box -->
</section><!-- /.content -->
开发者ID:rylsteel,项目名称:phpledger,代码行数:30,代码来源:edit_journal_voucher_detail.php
示例18: ob_flush
ob_flush();
}
if (empty($usrcfg->language)) {
$language = DEFAULTLANGUAGE;
} else {
$language = $usrcfg->language;
}
require_once ROOT_PATH . 'includes/lang/' . $language . '.php';
if (isset($_POST['users'])) {
$users = $user->empl_position >= 50 ? $_POST['users'] : array($user->empl_id);
} else {
$users = array($user->empl_id);
}
$taet = new taet();
$expstart = getDateTime($_POST['expstart']);
$expfinish = getDateTime($_POST['expfinish']) + 60 * 60 * 24;
$projectsarr = $_POST['expprojectid'];
$groupby = $_POST['groupby'];
$options1 = isset($_POST['options1']) ? $_POST['options1'] : array();
if (isset($_POST['taetexport'])) {
$options1[] = 'users';
}
$options2 = isset($_POST['options2']) ? $_POST['options2'] : array();
$options3 = isset($_POST['options3']) ? $_POST['options3'] : array();
switch ($groupby) {
case 'userprojects':
$options = $options1;
$zusatz = '';
$xsl_template = 'export.xsl';
break;
case 'projects':
开发者ID:ExeErik,项目名称:Test,代码行数:31,代码来源:export.php
示例19: updatePoints
function updatePoints($id, $id2)
{
if (empty($id) || empty($id2)) {
return false;
}
if ($id == $id2) {
//return false;
}
//$modelGeneral = new Models_General();
global $modelGeneral;
$return = array();
$params = array();
$t = 60 * 60 * 24 * 365 * 5;
$params['where'] = sprintf(" AND ((user1 = %s AND user2 = %s) OR (user1 = %s AND user2 = %s))", $modelGeneral->qstr($id), $modelGeneral->qstr($id2), $modelGeneral->qstr($id2), $modelGeneral->qstr($id), $t);
$check = $modelGeneral->getDetails('user_points', 1, $params);
if (empty($check)) {
$modelGeneral->clearCache($modelGeneral->sql);
}
if (!empty($check)) {
foreach ($check as $k => $v) {
$return[$v['user1']][$v['user2']]['points'] = $v['points'];
$return[$v['user1']][$v['user2']]['results'] = $v['results'];
}
return $return;
}
//getting points from api
$params = array();
$params['where'] = sprintf(" AND (settings.uid = %s OR settings.uid = %s)", $modelGeneral->qstr($id), $modelGeneral->qstr($id2));
$settingsDetail = $modelGeneral->getDetails('settings LEFT JOIN geo_cities ON settings.birth_city_id = geo_cities.cty_id', 1, $params, $t);
if (count($settingsDetail) == 1) {
$settingsDetail[1] = $settingsDetail[0];
}
if (count($settingsDetail) == 2) {
$sql = $modelGeneral->sql;
if (empty($settingsDetail[0]['extraDetails'])) {
$tmp = findCity($settingsDetail[0]['cty_id']);
$settingsDetail[0] = array_merge($settingsDetail[0], $tmp);
}
if (empty($settingsDetail[1]['extraDetails'])) {
$tmp = findCity($settingsDetail[1]['cty_id']);
$settingsDetail[1] = array_merge($settingsDetail[1], $tmp);
}
if (!empty($settingsDetail[0]['dob']) && !empty($settingsDetail[1]['dob']) && !empty($settingsDetail[0]['birth_city_id']) && !empty($settingsDetail[1]['birth_city_id'])) {
$Kundali = new Library_Kundali();
//fetching for first user
$fromDate = getDateTime($settingsDetail[0]['dob']);
$toDate = getDateTime($settingsDetail[1]['dob']);
$returnArrFrom = $Kundali->precalculate($fromDate['month'], $fromDate['day'], $fromDate['year'], $fromDate['hour'], $fromDate['minute'], $settingsDetail[0]['zone_h'], $settingsDetail[0]['zone_m'], $settingsDetail[0]['lon_h'], $settingsDetail[0]['lon_m'], $settingsDetail[0]['lat_h'], $settingsDetail[0]['lat_m'], $settingsDetail[0]['dst'], $settingsDetail[0]['lon_e'], $settingsDetail[0]['lat_s']);
$returnArrTo = $Kundali->precalculate($toDate['month'], $toDate['day'], $toDate['year'], $toDate['hour'], $toDate['minute'], $settingsDetail[0]['zone_h'], $settingsDetail[1]['zone_m'], $settingsDetail[1]['lon_h'], $settingsDetail[1]['lon_m'], $settingsDetail[1]['lat_h'], $settingsDetail[1]['lat_m'], $settingsDetail[1]['dst'], $settingsDetail[1]['lon_e'], $settingsDetail[1]['lat_s']);
$pts = $Kundali->getpoints($returnArrFrom[9], $returnArrTo[9]);
$finalPoints = array('points' => $pts, 'result' => $Kundali->interpret($pts));
$d = array();
$d['user1'] = $settingsDetail[0]['uid'];
$d['user2'] = $settingsDetail[1]['uid'];
$d['points'] = $finalPoints['points'];
$d['results'] = $finalPoints['result'];
$v = array('from' => $returnArrFrom, 'to' => $returnArrTo, 'pts' => $pts, 'result' => $finalPoints);
$d['details'] = json_encode($v);
$modelGeneral->addDetails('user_points', $d);
$return[$d['user1']][$d['user2']]['points'] = $d['points'];
$return[$d['user1']][$d['user2']]['results'] = $d['results'];
//fetching for second user
$fromDate = getDateTime($settingsDetail[1]['dob']);
$toDate = getDateTime($settingsDetail[0]['dob']);
$returnArrFrom = $Kundali->precalculate($fromDate['month'], $fromDate['day'], $fromDate['year'], $fromDate['hour'], $fromDate['minute'], $settingsDetail[1]['zone_h'], $settingsDetail[1]['zone_m'], $settingsDetail[1]['lon_h'], $settingsDetail[1]['lon_m'], $settingsDetail[1]['lat_h'], $settingsDetail[1]['lat_m'], $settingsDetail[1]['dst'], $settingsDetail[1]['lon_e'], $settingsDetail[1]['lat_s']);
$returnArrTo = $Kundali->precalculate($toDate['month'], $toDate['day'], $toDate['year'], $toDate['hour'], $toDate['minute'], $settingsDetail[0]['zone_h'], $settingsDetail[0]['zone_m'], $settingsDetail[0]['lon_h'], $settingsDetail[0]['lon_m'], $settingsDetail[0]['lat_h'], $settingsDetail[0]['lat_m'], $settingsDetail[0]['dst'], $settingsDetail[0]['lon_e'], $settingsDetail[0]['lat_s']);
$pts = $Kundali->getpoints($returnArrFrom[9], $returnArrTo[9]);
$finalPoints = array('points' => $pts, 'result' => $Kundali->interpret($pts));
$d = array();
$d['user1'] = $settingsDetail[1]['uid'];
$d['user2'] = $settingsDetail[0]['uid'];
$d['points'] = $finalPoints['points'];
$d['results'] = $finalPoints['result'];
$v = array('from' => $returnArrFrom, 'to' => $returnArrTo, 'pts' => $pts, 'result' => $finalPoints);
$d['details'] = json_encode($v);
$modelGeneral->addDetails('user_points', $d);
$return[$d['user1']][$d['user2']]['points'] = $d['points'];
$return[$d['user1']][$d['user2']]['results'] = $d['results'];
$modelGeneral->clearCache($sql);
}
}
return $return;
}
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:83,代码来源:functions.php
示例20: updateIt
/**
* 更新
* @param unknown_type $newRecord
*/
public static function updateIt($id, $newRecord)
{
$oldRecord = self::getDetail($id);
if ($oldRecord == null) {
//旧记录不存在
return false;
}
//比较新旧记录
$updateStr = DBQuery::toUpdateStr($oldRecord, $newRecord);
if ($updateStr == "") {
//没有变化,无需更新
return true;
}
$updateStr .= ",ChangeTime='" . getDateTime() . "'";
$sql = "UPDATE fastphp_SampleTable SET {$updateStr} WHERE ID='{$id}'";
DBQuery::instance()->executeUpdate($sql);
return true;
}
开发者ID:laiello,项目名称:fastphp,代码行数:22,代码来源:SampleDao.php
注:本文中的getDateTime函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论