本文整理匯總了PHP中NOW函數的典型用法代碼示例。如果您正苦於以下問題:PHP NOW函數的具體用法?PHP NOW怎麽用?PHP NOW使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了NOW函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: isEnded
public function isEnded()
{
if ($this->getHidden() == TRUE || $this->getStartDate() < NOW() || $this->getEndDate() > NOW()) {
return true;
}
return false;
}
示例2: Store
public function Store($pUserId, $pIdentifier, $pTitle, $pBody)
{
$New = false;
if (!$pIdentifier) {
$pIdentifier = $this->CreateUniqueIdentifier();
$this->Set('Created', NOW());
$New = true;
} else {
$this->Retrieve(array('Owner_FK' => $pUserId, 'Identifier' => $pIdentifier));
if ($this->Get('Total') > 0) {
$this->Fetch();
} else {
$this->Set('Created', NOW());
$New = true;
}
}
if (!$pUserId) {
return false;
}
$this->Set('Owner_FK', $pUserId);
$this->Set('Identifier', $pIdentifier);
$this->Set('Title', $pTitle);
$this->Set('Body', $pBody);
$this->Set('Updated', NOW());
$this->Save();
return $this->Get('Identifier');
}
示例3: addstaffajax
public function addstaffajax()
{
$config['upload_path'] = "uploads/staffs/";
$config['allowed_types'] = "gif|jpg|jpeg|png";
$config['max_size'] = "5000";
$config['max_width'] = "1907";
$config['max_height'] = "1280";
//$this->load->library('upload', $config);
$this->upload->initialize($config);
if (!$this->upload->do_upload('photo')) {
echo $this->upload->display_errors();
} else {
$data = $this->upload->data();
$this->records = array('staffid' => $this->input->post('staffid', true), 'staffuserid' => $this->input->post('staffuserid', true), 'firstname' => $this->input->post('firstname', true), 'middlename' => $this->input->post('middlename', true), 'lastname' => $this->input->post('lastname', true), 'sphone' => $this->input->post('sphone', true), 'mailingaddress' => $this->input->post('mailingaddress', true), 'birthdate' => $this->input->post('birthdate', true), 'email' => $this->input->post('email', true), 'joindate' => NOW(), 'photo' => $data['file_name'], 'birthdate' => $this->input->post('birthdate', true), 'enrollmentstatus' => $this->input->post('enrollmentstatus', true), 'isActive' => 1);
$this->urecords = array('username' => $this->input->post('staffuserid', true), 'created_on' => NOW(), 'first_name' => $this->input->post('firstname', true), 'phone' => $this->input->post('sphone', true), 'last_name' => $this->input->post('lastname', true));
$this->ugrpuprecords = array('user_id' => $this->input->post('id', true), 'group_id' => 5);
$this->results = $this->common_model->insertRecords($this->common_model->_staffs, $this->records);
$this->results = $this->common_model->insertRecords($this->common_model->_usersTable, $this->urecords);
$this->results = $this->common_model->insertRecords($this->common_model->_users_groups, $this->ugrpuprecords);
if ($this->results) {
$this->status['status'] = 1;
$this->status['msg'] = "Staff";
} else {
$this->status['status'] = 0;
$this->status['msg'] = "Something went wrong when saving the file, please try again.";
}
echo jsonEncode($this->status);
}
}
示例4: insertRecord
function insertRecord()
{
//print_r($this->input->post()); exit();
$data = array();
$data['first_name'] = $this->input->post('first_name', TRUE);
$data['last_name'] = $this->input->post('last_name', TRUE);
$data['email_addr'] = strtolower($this->input->post('email_addr', TRUE));
$data['tel_number'] = $this->input->post('tel_number', TRUE);
$data['post_code'] = $this->input->post('post_code', TRUE);
$data['enq_reason'] = $this->input->post('enq_reason', TRUE);
$data['receive_update_news'] = $this->input->post('receive_update_news', TRUE);
$data['how_reach'] = $this->input->post('how_reach', TRUE);
$data['enquiry'] = $this->input->post('enquiry', TRUE);
$data['souceSiteUser'] = '2';
$data['enq_creator_id'] = $this->loggId;
$data['next_follow_up'] = date('Y-m-d');
/**
* If any index is has false then empty string assign
*/
foreach ($data as $key => $val) {
if (!$data[$key]) {
$data[$key] = '0';
}
}
$data['insert_time'] = date('Y-m-d', NOW());
$data['next_follow_up'] = $data['insert_time'];
$status = $this->db->insert($this->tbl, $data);
if (!$status) {
return FALSE;
}
$enquiry_id = $this->db->insert_id();
//fetch email details
$email_dtls = $this->Emailsmodel->fetchDetails('enquiry_registration');
//Send Confirmation email
$emailData = array();
$emailData['DATE'] = date("jS F, Y");
$emailData['NAME'] = $data['first_name'] . $data['last_name'];
$emailData['EMAILADDR'] = $data['email_addr'];
$search = array();
$replace = array();
$search[] = '{DATE}';
$replace[] = $emailData['DATE'];
$search[] = '{NAME}';
$replace[] = $emailData['NAME'];
$search[] = '{EMAILADDR}';
$replace[] = $emailData['EMAILADDR'];
$emailBody = str_ireplace($search, $replace, $email_dtls['email_content']);
//print_r($emailBody); exit();
$this->email->initialize($this->config->item('EMAIL_CONFIG'));
$this->email->from(DWS_EMAIL_NOREPLY, DWS_EMAIL_FROM);
$this->email->to($data['email_addr']);
$this->email->subject($email_dtls['email_subject']);
$this->email->message($emailBody);
$status = $this->email->send();
$data['enquiry_id'] = $enquiry_id;
return $data;
}
示例5: a10
function a10(&$db)
{
//project
$close = NOW();
$close->sub(new DateInterval('P1M'));
$sql = "UPDATE " . $db->prefix . "a10_project\n\t\t\tSET close_date='" . $close->format('Y-m-d') . "', accounting_idref=1;";
$db->exec($sql);
return true;
}
示例6: Create
public function Create($pType, $pIdentifier, $pUserId)
{
$this->Protect('Reference_FK', null);
$this->Set('User_FK', $pUserId);
$this->Set('Type', $pType);
$this->Set('Identifier', $pIdentifier);
$this->Set('Stamp', NOW());
$this->Save();
return true;
}
示例7: startCouponSaving
public static function startCouponSaving($coupon, $customerId)
{
$instance = new self();
$instance->couponId = $coupon->getCouponId();
$instance->requiredNumberOfProducts = $coupon->getRequiredNumberOfProducts();
$validUntil = Date('Y:m:d', strtotime($coupon->getValidity()));
$instance->customerId = $customerId;
$instance->creationDate = NOW();
$instance->validUntil = $validUntil;
$instance->state = CouponState::OPEN;
return $instance;
}
示例8: onSalesOrderInvoicePay
public function onSalesOrderInvoicePay($observer)
{
Mage::log(" : onSalesOrderInvoicePay stap 1 ", null, 'custom.log');
try {
$couponDao = new CouponDao();
$invoice = $observer->getEvent()->getInvoice();
$order = $invoice->getOrder();
// Method 1
unset($this->usedDiscountCoupons);
// Unset $array.
$this->usedDiscountCoupons = array();
// Reset $array to an empty array.
foreach ($order->getAllItems() as $item) {
// Do something with $item here...
$name = $item->getName();
$price = $item->getPrice();
$_product = Mage::getModel('catalog/product')->load($item->getProductId());
$manufacturerName = $_product->getAttributeText('manufacturer');
$coupon = $couponDao->loadCouponByBrand($manufacturerName);
if ($coupon != null) {
for ($i = 1; $i <= $item->getQtyOrdered(); $i++) {
$couponSaving = $couponDao->loadInInVoiceCouponSaving($coupon->getCouponId(), $order->getCustomerId());
if ($couponSaving != null) {
$couponDao->setCouponSavingToUsed($couponSaving);
} else {
if ($price >= $coupon->getMinPrice() && !$this->discountCouponUsed($order, $manufacturerName)) {
$couponSaving = $couponDao->loadCouponSaving($coupon->getCouponId(), $order->getCustomerId(), CouponState::OPEN);
if ($couponSaving == null) {
$couponSavingNew = CouponSaving::startCouponSaving($coupon, $order->getCustomerId());
$couponSaving = $couponDao->createCouponSaving($couponSavingNew);
}
$couponSavingId = $couponSaving->getCouponSavingId();
if (NOW() >= $couponSaving->getValidUntil()) {
$couponDao->updateCouponSaving($couponSaving);
$couponSavingNew = CouponSaving::startCouponSaving($coupon, $order->getCustomerId());
$couponSavingNew = $couponDao->createCouponSaving($couponSavingNew);
$couponSavingIdNew = $couponSavingNew->getCouponSavingId();
$couponDao->createStamp($couponSavingIdNew, $name, $price, $order->getIncrementId());
} else {
$couponDao->createStamp($couponSavingId, $name, $price, $order->getIncrementId());
$couponDao->updateCouponSaving($couponSaving);
}
}
}
}
}
}
} catch (Exception $e) {
Mage::log("exception " + $e, null);
}
return $this;
}
示例9: _IsPast
private function _IsPast($pTime, $pDistance)
{
if (!$pTime) {
return false;
}
$now = strtotime(NOW());
$diff = $now - $pTime;
$diffMinutes = $diff / 60;
if ($diffMinutes < $pDistance) {
return false;
}
return true;
}
示例10: Store
public function Store($pContext, $pId, $pBody, $pParent, $pOwner)
{
$this->Protect('Entry_PK');
$this->Set('Body', $pBody);
$this->Set('Parent_ID', $pParent);
$this->Set('Owner', $pOwner);
$this->Set('Created', NOW());
$this->Set('Context', $pContext);
$this->Set('Context_FK', $pId);
$this->Set('Status', 1);
$this->Set('Address', $_SERVER['REMOTE_ADDR']);
$this->Save();
return true;
}
示例11: Index
public function Index($pContext, $pContext_FK, $pKeywords)
{
$this->Retrieve(array('Context' => $pContext, 'Context_FK' => $pContext_FK));
if ($this->Get('Total') > 0) {
$this->Fetch();
} else {
$this->Set('Created', NOW());
}
$this->Set('Context', $pContext);
$this->Set('Context_FK', $pContext_FK);
$this->Set('Keywords', $pKeywords);
$this->Set('Updated', NOW());
$this->Save();
return true;
}
示例12: Send
public function Send($pData = array())
{
if ($this->_Source != 'Component') {
return false;
}
include_once ASD_PATH . 'components/postal/controllers/postal.php';
$Controller = new cPostalPostalController();
$Type = strtolower($pData['Type']);
$SenderFullname = $pData['SenderFullname'];
$SenderAccount = $pData['SenderAccount'];
$RecipientEmail = $pData['RecipientEmail'];
$MailSubject = $pData['MailSubject'];
$Byline = $pData['Byline'];
$Subject = $pData['Subject'];
$Body = str_replace("\n", "<br />", $pData['Body']);
$LinkDescription = $pData['LinkDescription'];
$Link = $pData['Link'];
$Stamp = $this->GetSys('Date')->Format(NOW(), true);
$data = array('account' => $SenderAccount, 'source' => ASD_DOMAIN);
$AccountLink = $this->GetSys('Event')->Trigger('Create', 'User', 'Link', $data);
$View = $Controller->GetView($Type);
list($username, $domain) = explode('@', $SenderAccount);
$IconData = array('username' => $username, 'domain' => $domain, 'width' => 64, 'height' => 64);
$View->Find('.icon', 0)->src = $this->GetSys('Event')->Trigger('On', 'User', 'Icon', $IconData);
$View->Find('.fullname', 0)->innertext = $SenderFullname;
$View->Find('.fullname', 0)->href = $AccountLink;
$View->Find('.account', 0)->innertext = $SenderAccount;
$View->Find('.account', 0)->href = $AccountLink;
$View->Find('.byline-description', 0)->innertext = $Byline;
$View->Find('.subject', 0)->innertext = $Subject;
$View->Find('.body', 0)->innertext = $Body;
$View->Find('.stamp', 0)->innertext = $Stamp;
$View->Find('.link-description', 0)->innertext = $LinkDescription;
$View->Find('.link', 0)->src = $Link;
$View->Find('.link', 0)->innertext = $Link;
$View->Find('.link', 0)->href = $Link;
$from = "no-reply@" . ASD_DOMAIN;
$fromName = "Appleseed";
$to = $RecipientEmail;
$toName = $RecipientEmail;
$subject = $MailSubject;
$body = $View->Buffer();
$Mailer = $this->GetSys("Mailer");
if (!$Mailer->Send($from, $fromName, $to, $toName, $subject, $body)) {
return false;
}
return true;
}
示例13: EndFooterDisplay
public function EndFooterDisplay($pData = null)
{
$Model = new cModel('Janitor');
$Model->Retrieve(array('Task' => 'Janitorial'));
$Model->Fetch();
$lastUpdated = strtotime($Model->Get('Updated'));
$now = strtotime(NOW());
$diff = $now - $lastUpdated;
$diffMinutes = $diff / 60;
// If we've recently updated, don't ping the Janitor.
if ($diffMinutes < 1) {
return true;
}
$this->_Janitorial();
return true;
}
示例14: InviteCode
public function InviteCode($pAddress, $pUserId)
{
$this->Retrieve(array('Account_FK' => $pUserId, 'Active' => 1));
if ($this->Get('Total') == 0) {
return false;
}
$this->Fetch();
$this->Protect('Invite_PK');
$this->Set('Recipient', $pAddress);
$this->Set('Active', 2);
// Pending
$this->Set('Stamp', NOW());
if ($this->Save(array('Invite_PK' => $this->Get('Invite_PK')))) {
return $this->Get('Value');
}
return false;
}
示例15: returnConsignment
public function returnConsignment($shipment_id, $consignment_number, $transfer_id)
{
try {
$shipment = Mage::getModel("sales/order_shipment")->loadByIncrementId($shipment_id);
$consignment = Mage::getModel('dpd/consignment');
$consignment->setTransferId($transfer_id);
if (Mage::getStoreConfig('dpd/misc/emailcustomer') == TRUE) {
$customer = array();
$customer['name'] = $shipment->getOrder()->getCustomerFirstname() . ' ' . $shipment->getOrder()->getCustomerLastname();
$customer['email'] = $shipment->getOrder()->getCustomerEmail();
$consignment->setEmail($customer['email']);
}
$consignment->setConsignment($consignment_number);
$consignment->setReturned(NOW());
$consignment->setStatus(3);
$consignment->save();
if (Mage::getStoreConfig('dpd/advanced/activity') == 1) {
Mage::log('Shipment #' . $shipment_id . '(' . $transfer_id . ') returned (' . $consignment_number . ')', null, 'madcapsule_system.log');
}
} catch (Exception $e) {
Mage::log('Unable to update tracking for shipment #' . $shipment_id . ' (' . $consignment_number . ')', null, 'madcapsule_system.log');
return;
}
$track = Mage::getModel('sales/order_shipment_track')->setShipment($shipment)->setData('title', 'DPD')->setData('number', $consignment_number)->setData('carrier_code', 'custom')->setData('order_id', $shipment->getData('order_id'))->save();
/*
$tracking_add = Mage::getModel('sales/order_shipment_api')->addTrack($shipment_id, 'custom', 'DPD', $consignment_number);
*/
if ($tracking_add && Mage::getStoreConfig('dpd/advanced/activity') == 1) {
Mage::log('Tracking added: ' . $consignment_number . ' for shipment #' . $shipment_id . '', null, 'madcapsule_system.log');
}
if (Mage::getStoreConfig('dpd/misc/emailcustomer') == TRUE) {
$emailTemplate = Mage::getModel('core/email_template')->loadDefault('madcapsule_dpd_tracking_template');
$emailTemplateVariables = array();
$emailTemplateVariables['consignment'] = $consignment_number;
$emailTemplate->setTemplateSubject('Your order has been dispatched');
$storeEmail = Mage::getStoreConfig('trans_email/ident_general/email');
$storeContact = Mage::getStoreConfig('trans_email/ident_general/name');
$emailTemplate->setSenderEmail($storeEmail);
$emailTemplate->setSenderName($storeContact);
$emailTemplate->send($customer['email'], $customer['name'], $emailTemplateVariables);
if (Mage::getStoreConfig('dpd/advanced/activity') == 1) {
Mage::log('DPD tracking email sent to ' . $customer['email'] . '', null, 'madcapsule_system.log');
}
}
}