本文整理汇总了PHP中now函数的典型用法代码示例。如果您正苦于以下问题:PHP now函数的具体用法?PHP now怎么用?PHP now使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了now函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
public function store()
{
$vals = array('sales_username' => trim($this->input->post('sales_username')), 'sales_pwd' => md5($this->input->post('sales_pwd')), 'sales_email' => $this->input->post('sales_email'), 'sales_fname' => trim($this->input->post('sales_fname')), 'sales_lname' => trim($this->input->post('sales_lname')), 'sales_phone' => trim($this->input->post('sales_phone')), 'sales_gender' => $this->input->post('sales_gender'), 'sales_address' => trim($this->input->post('sales_address')), 'sales_city' => trim($this->input->post('sales_city')), 'sales_reg' => $this->input->post('sales_reg'), 'sales_about' => trim($this->input->post('sales_about')), 'visibility' => 1, 'created_at' => now(true));
$this->sales->create($vals);
$this->session->set_flashdata('message', '<div class="alert alert-success">A new sales successfully added.</div>');
redirect('sales');
}
示例2: getNow
public function getNow()
{
if (!$this->_now) {
return now();
}
return $this->_now;
}
示例3: _initSelect
public function _initSelect()
{
//die("<PRE>".$this->getSelect()->__toString(). "</PRE>");
parent::_initSelect();
$this->getSelect()->distinct(true)->joinInner(array('product_table' => $this->getTable('catalogrule/rule_product')), 'main_table.rule_id = product_table.rule_id', array())->where('from_time=0 or from_time<=? or to_time=0 or to_time>=?', now())->group('main_table.rule_id');
//die("<PRE>".$this->getSelect()->__toString()."</PRE>");
}
示例4: ajax_update
public function ajax_update()
{
$this->_validate();
$data = array('title' => $this->input->post('title'), 'edited_on' => date('Y-m-d H:i:s', now()), 'edited_by' => GetUserID());
$this->empl_status_model->update(array('id' => $this->input->post('id')), $data);
echo json_encode(array("status" => TRUE));
}
示例5: index
public function index()
{
// $this->user_manager->authenticate();
$this->load->model('contact_model', 'contact');
$contact = $this->contact->getContactPages(3);
$dataContact = array('content' => $contact['content'], 'title' => $contact['title']);
$posts = $this->input->post();
if ($posts) {
$this->load->library('setting_manager');
$this->load->helper('date');
$this->load->model('contact_model', 'contact');
$this->load->library('mail');
$this->config->load('email', TRUE);
$data = $posts;
$validate = $this->setting_manager->contactValidate($data);
if (empty($validate)) {
$reply = 0;
$to_add = array("name" => $data['name'], "email" => $data['email'], "phone" => $data['phone'], "message" => $data['content'], "date_add" => date('Y-m-d H:i:s', now()), "reply" => $reply);
$insert = $this->contact->insert($to_add);
$mailTo['name'] = $data['name'];
$mailTo['email'] = $this->config->item('email_contact_from', 'email');
$dataEmail['email'] = $data['email'];
$dataEmail['name'] = $data['name'];
$dataEmail['phone'] = $data['phone'];
$dataEmail['content'] = $data['content'];
sentMailTemp($mailTo, 'contact', $dataEmail);
$this->data['success'] = 'Your Mail has been sent successfully';
redirect('contact/index');
} else {
$this->data['data_error'] = $validate;
}
}
$this->data['contact'] = $dataContact;
$this->load('front_layout', 'contact');
}
示例6: saveUser
public function saveUser($user)
{
$exist = $this->exist($user->screen_name);
if (!$exist) {
$this->helper("time");
$date = now(4);
$imageProfile = str_replace("normal", "bigger", $user->profile_image_url);
if (!$user->url) {
$website = "http://twitter.com/" . $user->screen_name;
} else {
$website = $user->url;
}
$fields = "Username, Website, Avatar, Rank, Start_Date, Type";
$values = "'{$user->screen_name}', '{$website}', '{$imageProfile}', 'Beginner', '{$date}', 'Twitter'";
$this->Db->table("users", $fields);
$this->Db->values($values);
$insertID = $this->Db->save();
$fields = "ID_User, Name, Twitter";
$values = "'{$insertID}', '{$user->name}', '{$user->screen_name}'";
$this->Db->table("users_information", $fields);
$this->Db->values($values);
$this->Db->save();
$this->Twitter_Api->welcome();
return $this->exist($user->screen_name);
} else {
return $exist;
}
}
示例7: saveAnswerAction
public function saveAnswerAction()
{
if (!Mage::getSingleton('customer/session')->authenticate($this)) {
Mage::getSingleton('core/session')->addError(Mage::helper('askit')->__('Sorry, only logined customer can add self answer.'));
$this->_redirectReferer();
return;
}
$customerName = (string) $this->getRequest()->getParam('askitCustomer');
$email = (string) $this->getRequest()->getParam('askitEmail');
if (!$customerName || !$email || !Mage::getStoreConfig('askit/general/allowedCustomerAnswer')) {
$this->_redirectReferer();
return;
}
$answer = (string) $this->getRequest()->getParam('askitAnswer');
$questionId = (string) $this->getRequest()->getParam('question');
$productId = (int) $this->getRequest()->getParam('product');
$customerId = (int) Mage::getSingleton('customer/session')->getCustomerId();
$model = Mage::getModel('askit/askIt');
$storeId = Mage::getModel('askit/askIt')->load($questionId)->getStoreId();
$defaultAnswerStatus = Mage::getStoreConfig('askit/general/defaultAnswerStatus');
//pending
$model->setText(strip_tags($answer))->setStoreId($storeId)->setProductId($productId)->setCustomerId($customerId)->setHint(0)->setParentId($questionId)->setCustomerName($customerName)->setEmail($email)->setCreatedTime(now())->setUpdateTime(now())->setStatus($defaultAnswerStatus)->save();
Mage::getSingleton('core/session')->addSuccess(Mage::helper('askit')->__('Your answer has been accepted'));
$this->_redirectReferer();
}
示例8: saveAction
public function saveAction()
{
if ($data = $this->getRequest()->getPost()) {
$model = Mage::getModel('testimonials/testimonials');
$model->setData($data)->setId($this->getRequest()->getParam('id'));
try {
if (!$model->getId()) {
$model->setCreatedTime(now());
}
$model->setUpdateTime(now());
$url = $data['url'];
$model->save();
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('testimonials')->__('Testimonial was successfully saved'));
Mage::getSingleton('adminhtml/session')->setFormData(false);
if ($this->getRequest()->getParam('back')) {
$this->_redirect('*/*/edit', array('id' => $model->getId()));
return;
}
$this->_redirect('*/*/');
return;
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
Mage::getSingleton('adminhtml/session')->setFormData($data);
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
return;
}
}
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('testimonials')->__('Unable to find item to save'));
$this->_redirect('*/*/');
}
示例9: apontar_componente
public function apontar_componente()
{
$of = trim($this->input->post('of'));
$produto = trim($this->input->post('produto'));
$componente = trim($this->input->post('componente'));
$quantidade = (int) trim($this->input->post('quantidade'));
$motivo = trim($this->input->post('motivo'));
//se o motivo for igual a "D" (desabastecer), altera o valor para negativo
if ($motivo == "D") {
$quantidade = (int) $quantidade * -1;
}
if ((int) $quantidade != 0) {
$session_data = $this->session->userdata('logged_in');
$dados = array('cd_of' => $of, 'cd_produto' => $produto, 'cd_componente' => $componente, 'qt_apontada' => $quantidade, 'dt_apontamento' => date('YmdHis', now()), 'username' => $session_data['username'], 'cd_motivo' => $motivo);
if ($this->apontamento_model->do_insert($dados) == TRUE) {
echo '<div class="alert alert-success">' . ' Arquivo apontado com sucesso.</div>';
} else {
echo '<div class="alert alert-danger" role="alert">
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
<span class="sr-only">Error:</span>FAvor verificar dados inseridos</div>';
}
}
$dados = array('dados_of' => $this->ordem_producao_model->get_dados_of($of, $produto)->row(), 'cd_componente' => $componente, 'tela' => 'apontar', 'pasta' => 'apontamento', 'status' => $this->apontamento_model->get_hist_apon($of, $produto, $componente)->result());
$this->load->view('conteudo', $dados);
}
示例10: saveAction
public function saveAction()
{
if ($data = $this->getRequest()->getPost()) {
if (isset($_FILES['content_bg_img']['name']) && $_FILES['content_bg_img']['name'] != null) {
$result['file'] = '';
try {
/* Starting upload */
$uploader = new Varien_File_Uploader('content_bg_img');
// Any extention would work
$uploader->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'));
$uploader->setAllowRenameFiles(true);
// Set the file upload mode
// false -> get the file directly in the specified folder
// true -> get the file in the product like folders
// (file.jpg will go in something like /media/f/i/file.jpg)
$uploader->setFilesDispersion(false);
// We set media as the upload dir
$path = Mage::getBaseDir('media') . DS . 'queldorei/shopper' . DS;
$result = $uploader->save($path, $_FILES['content_bg_img']['name']);
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage() . ' ' . $path);
Mage::getSingleton('adminhtml/session')->setFormData($data);
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
return;
}
$data['content_bg_img'] = 'queldorei/shopper/' . $result['file'];
} else {
if (isset($data['content_bg_img']['delete']) && $data['content_bg_img']['delete'] == 1) {
$data['content_bg_img'] = '';
} else {
unset($data['content_bg_img']);
}
}
$model = Mage::getModel('shoppercategories/shoppercategories');
$model->setData($data)->setId($this->getRequest()->getParam('id'));
try {
if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
$model->setCreatedTime(now())->setUpdateTime(now());
} else {
$model->setUpdateTime(now());
}
$model->save();
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('shoppercategories')->__('Color Scheme was successfully saved'));
Mage::getSingleton('adminhtml/session')->setFormData(false);
if ($this->getRequest()->getParam('back')) {
$this->_redirect('*/*/edit', array('id' => $model->getId()));
return;
}
$this->_redirect('*/*/');
return;
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
Mage::getSingleton('adminhtml/session')->setFormData($data);
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
return;
}
}
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('shoppercategories')->__('Unable to find item to save'));
$this->_redirect('*/*/');
}
示例11: _sendEmail
protected function _sendEmail()
{
$data = $this->getRequest()->getParams();
$senderInfo = $data['sender'];
$recipients = $data['recipients'];
$recipientEmail = $recipients['email'];
$recipientName = $recipients['name'];
$offer = Mage::getModel('customerreward/offer')->load($this->getRequest()->getParam('offer_id'));
$offer->setCurrentDate(Mage::helper('core')->formatDate(now(), 'long'));
$description = Mage::getBlockSingleton('customerreward/offer_view')->setOffer($offer)->getTitleDescriptionHtml();
$offer->setTitleHtml($description['title']);
$offer->setDescription($description['description']);
$offer->setImageUrl(Mage::getBaseUrl('media') . $offer->getImage());
if (Mage::helper('customerreward')->getReferConfig('coupon')) {
$offer->setCoupon($data['coupon']);
}
//send email
$translate = Mage::getSingleton('core/translate');
$translate->setTranslateInline(false);
$mailTemplate = Mage::getModel('core/email_template');
$message = nl2br(htmlspecialchars($senderInfo['message']));
$sender = array('name' => Mage::helper('customerreward')->htmlEscape($senderInfo['name']), 'email' => Mage::helper('customerreward')->htmlEscape($senderInfo['email']));
$mailTemplate->setDesignConfig(array('area' => 'frontend', 'store' => Mage::app()->getStore()->getId()));
$template = Mage::helper('customerreward')->getEmailConfig('sendfriend');
foreach ($recipientEmail as $k => $email) {
$name = $recipientName[$k];
$mailTemplate->sendTransactional($template, 'sales', $email, $name, array('store' => Mage::app()->getStore(), 'name' => $name, 'email' => $email, 'message' => $message, 'sender_name' => $sender['name'], 'sender_email' => $sender['email'], 'title' => $data['title'], 'url' => $data['url'], 'offer' => $offer));
}
$translate->setTranslateInline(true);
return $this;
}
示例12: saveAction
public function saveAction()
{
$model = Mage::getModel('contest/participant');
if ($data = $this->getRequest()->getPost()) {
$model->setData($data)->setId($this->getRequest()->getParam('id'));
try {
if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
$model->setCreatedTime(now())->setUpdateTime(now());
} else {
$model->setUpdateTime(now());
}
$model->save();
if (!empty($data["contest_participant_send_mail"]) && $data["contest_participant_send_mail"] == 1) {
// SEND EMAIL TO PARTICPANT
$this->_sendEmailToParticipant($this->getRequest()->getParam('id'));
}
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('contest')->__('Participant was successfully saved'));
Mage::getSingleton('adminhtml/session')->setFormData(false);
if ($this->getRequest()->getParam('back')) {
$this->_redirect('*/*/edit', array('id' => $model->getId()));
return;
}
$this->_redirect('*/*/');
return;
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
Mage::getSingleton('adminhtml/session')->setFormData($data);
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
return;
}
}
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('contest')->__('Unable to find item to save'));
$this->_redirect('*/*/');
}
示例13: validate
public function validate()
{
$hlp = Mage::helper('umicrosite');
$dhlp = Mage::helper('udropship');
extract($this->getData());
$hasPasswordField = false;
foreach ($this->getRegFields() as $rf) {
$rfName = str_replace('[]', '', $rf['name']);
if (!empty($rf['required']) && !$this->getData($rfName) && !in_array($rf['type'], array('image', 'file')) && !in_array($rfName, array('payout_paypal_email'))) {
Mage::throwException($hlp->__('Incomplete form data'));
}
$hasPasswordField = $hasPasswordField || in_array($rfName, array('password_confirm', 'password'));
if ($rfName == 'password_confirm' && $this->getData('password') != $this->getData('password_confirm')) {
Mage::throwException($hlp->__('Passwords do not match'));
}
}
$this->setStreet(@$street1 . "\n" . @$street2);
$this->initPassword(@$password);
$this->initUrlKey(@$url_key);
$this->setRemoteIp($_SERVER['REMOTE_ADDR']);
$this->setRegisteredAt(now());
$this->setStoreId(Mage::app()->getStore()->getId());
$dhlp->processCustomVars($this);
$this->attachLabelVars();
return $this;
}
示例14: saveAction
public function saveAction()
{
$session = Mage::getSingleton('adminhtml/session');
if ($data = $this->getRequest()->getPost()) {
$model = Mage::getModel('prodfaqs/prodfaqs');
$model->setData($data)->setId($this->getRequest()->getParam('id'));
try {
if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
$model->setCreatedTime(now())->setUpdateTime(now());
} else {
$model->setUpdateTime(now());
}
$model->save();
if ($data['customer_email'] != '' && $data['send_mail_to'] == 1) {
Mage::helper('prodfaqs')->sendEmailToClient($data);
}
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('prodfaqs')->__('Faq was successfully saved'));
Mage::getSingleton('adminhtml/session')->setFormData(false);
if ($this->getRequest()->getParam('back')) {
$this->_redirect('*/*/edit', array('id' => $model->getId()));
return;
}
$this->_redirect('*/*/');
return;
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
Mage::getSingleton('adminhtml/session')->setFormData($data);
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
return;
}
}
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('prodfaqs')->__('Unable to find Faq to save'));
$this->_redirect('*/*/');
}
示例15: saveAction
public function saveAction()
{
//$accomplish_want = $this->getRequest()->getParam('accomplish_want');
//$recommend = $this->getRequest()->getParam('recommend');
//$about_concern = $this->getRequest()->getParam('about_concern');
$name = $this->getRequest()->getParam('name');
$email = $this->getRequest()->getParam('email');
$phone = $this->getRequest()->getParam('phone');
$help = $this->getRequest()->getParam('help');
$comment = $this->getRequest()->getParam('comment');
//$best_time = $this->getRequest()->getParam('best_time');
// $concern_number = $this->getRequest()->getParam('concern_number');
/* Mail Function */
$to = "care@msupply.com";
$subject = 'Customer Feedback';
$msg = '<html><head>';
$msg .= '<title>Feedback Details</title>';
$msg .= '</head>';
$msg .= '<table border="1" cellspacing="1">';
$msg .= "<tr><td>Name</td><td>" . $name . "</td></tr>";
$msg .= "<tr><td>Email Address</td><td>" . $email . "</td></tr>";
$msg .= "<tr><td>Mobile Number</td><td>" . $phone . "</td></tr>";
$msg .= "<tr><td>Category</td><td>" . $help . "</td></tr>";
$msg .= "<tr><td>Tell us more about your feedback or inquiry</td><td>" . $comment . "</td></tr>";
$msg .= "</table>";
$msg .= "</html>";
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($to, $subject, $msg, $headers);
/* End Mail function */
$model = Mage::getModel('feedback/feedback');
$model->setData($data)->setId($this->getRequest()->getParam('id'));
$model->setHelp($help);
$model->setComment($comment);
$model->setPhone($phone);
$model->setName($name);
$model->setEmail($email);
try {
if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
$model->setCreatedTime(now())->setUpdateTime(now());
} else {
$model->setUpdateTime(now());
}
$model->save();
Mage::getSingleton('core/session')->addSuccess(Mage::helper('feedback')->__('Thank you for your feedback. Your opinion is important to us.'));
Mage::getSingleton('core/session')->setFormData(false);
if ($this->getRequest()->getParam('back')) {
$this->_redirect('*/*/edit', array('id' => $model->getId()));
return;
}
$this->_redirect('*/*/');
return;
} catch (Exception $e) {
Mage::getSingleton('core/session')->addError($e->getMessage());
Mage::getSingleton('core/session')->setFormData($data);
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
return;
}
}