当前位置: 首页>>代码示例>>PHP>>正文


PHP JDate::toMySQL方法代码示例

本文整理汇总了PHP中JDate::toMySQL方法的典型用法代码示例。如果您正苦于以下问题:PHP JDate::toMySQL方法的具体用法?PHP JDate::toMySQL怎么用?PHP JDate::toMySQL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JDate的用法示例。


在下文中一共展示了JDate::toMySQL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: store

 /**
  *
  */
 public function store($preventUpdate = false)
 {
     // Set date if none exist
     if ($preventUpdate != true) {
         $now = new JDate();
         $this->created = $now->toMySQL();
         $this->updated = $now->toMySQL();
     }
     return parent::store();
 }
开发者ID:ErickLopez76,项目名称:offiria,代码行数:13,代码来源:comment.php

示例2: savePayment

 function savePayment()
 {
     $orderid = JRequest::getVar('orderid');
     $Itemid = JRequest::getVar('Itemid');
     $order = JTable::getInstance('OrdersTable', 'JTheFactory');
     if (!$order->load($orderid)) {
         $app = JFactory::getApplication();
         $app->redirect('index.php?option=' . APP_EXTENSION . '&Itemid=' . $Itemid, JText::_("FACTORY_ORDER_DOES_NOT_EXIST"));
         return;
     }
     $paylog = JTable::getInstance('PaymentLogTable', 'JTheFactory');
     $date = new JDate();
     $paylog->date = $date->toMySQL();
     $paylog->amount = $order->order_total;
     $paylog->currency = $order->order_currency;
     $paylog->refnumber = JRequest::getVar('customer_note');
     $paylog->invoice = $orderid;
     $paylog->ipn_response = print_r($_REQUEST, true);
     $paylog->ipn_ip = $_SERVER['REMOTE_ADDR'];
     $paylog->status = 'manual_check';
     $paylog->userid = $order->userid;
     $paylog->orderid = $order->id;
     $paylog->payment_method = $this->name;
     $paylog->store();
     $order->paylogid = $paylog->id;
     $order->store();
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:27,代码来源:controller.php

示例3: processIPN

 function processIPN()
 {
     $model = JModel::getInstance('Gateways', 'JTheFactoryModel');
     $params = $model->loadGatewayParams($this->name);
     $test_mode = $params->get('test_mode', 0);
     $x_login = $params->get('x_login', '');
     $paylog = JTable::getInstance('PaymentLogTable', 'JTheFactory');
     $date = new JDate();
     $paylog->date = $date->toMySQL();
     $paylog->amount = JRequest::getVar('x_amount');
     $paylog->currency = '';
     //JRequest::getVar('');
     $paylog->refnumber = JRequest::getVar('x_trans_id');
     $paylog->invoice = JRequest::getVar('x_invoice_num');
     $paylog->ipn_response = print_r($_REQUEST, true);
     $paylog->ipn_ip = $_SERVER['REMOTE_ADDR'];
     $paylog->status = 'error';
     $paylog->userid = null;
     $paylog->orderid = JRequest::getVar('x_invoice_num');
     $paylog->payment_method = $this->name;
     $receiver_email = JRequest::getVar('receiver_email');
     $payment_status = JRequest::getVar('x_2checked');
     if ($payment_status == 'Y') {
         $paylog->status = 'ok';
     } else {
         $paylog->status = 'error';
     }
     $paylog->store();
     return $paylog;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:30,代码来源:controller.php

示例4: store

 public function store()
 {
     $now = new JDate();
     // Always update the stream last updated time
     $this->updated = $now->toMySQL();
     return parent::store();
 }
开发者ID:ErickLopez76,项目名称:offiria,代码行数:7,代码来源:hashtag.php

示例5: getList

 function getList(&$params)
 {
     global $mainframe;
     $db =& JFactory::getDBO();
     $user =& JFactory::getUser();
     $userId = (int) $user->get('id');
     $count = (int) $params->get('count', 5);
     $catid = trim($params->get('catid'));
     $secid = trim($params->get('secid'));
     $show_front = $params->get('show_front', 1);
     $aid = $user->get('aid', 0);
     $contentConfig =& JComponentHelper::getParams('com_content');
     $access = !$contentConfig->get('shownoauth');
     $nullDate = $db->getNullDate();
     jimport('joomla.utilities.date');
     $date = new JDate();
     $now = $date->toMySQL();
     $where = 'a.state = 1' . ' AND ( a.publish_up = ' . $db->Quote($nullDate) . ' OR a.publish_up <= ' . $db->Quote($now) . ' )' . ' AND ( a.publish_down = ' . $db->Quote($nullDate) . ' OR a.publish_down >= ' . $db->Quote($now) . ' )';
     // User Filter
     switch ($params->get('user_id')) {
         case 'by_me':
             $where .= ' AND (created_by = ' . (int) $userId . ' OR modified_by = ' . (int) $userId . ')';
             break;
         case 'not_me':
             $where .= ' AND (created_by <> ' . (int) $userId . ' AND modified_by <> ' . (int) $userId . ')';
             break;
     }
     // Ordering
     switch ($params->get('ordering')) {
         case 'm_dsc':
             $ordering = 'a.modified DESC, a.created DESC';
             break;
         case 'c_dsc':
         default:
             $ordering = 'a.created DESC';
             break;
     }
     if ($catid) {
         $ids = explode(',', $catid);
         JArrayHelper::toInteger($ids);
         $catCondition = ' AND (cc.id=' . implode(' OR cc.id=', $ids) . ')';
     }
     if ($secid) {
         $ids = explode(',', $secid);
         JArrayHelper::toInteger($ids);
         $secCondition = ' AND (s.id=' . implode(' OR s.id=', $ids) . ')';
     }
     // Content Items only
     $query = 'SELECT a.*, ' . ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,' . ' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as catslug' . ' FROM #__content AS a' . ($show_front == '0' ? ' LEFT JOIN #__content_frontpage AS f ON f.content_id = a.id' : '') . ' INNER JOIN #__categories AS cc ON cc.id = a.catid' . ' INNER JOIN #__sections AS s ON s.id = a.sectionid' . ' WHERE ' . $where . ' AND s.id > 0' . ($access ? ' AND a.access <= ' . (int) $aid . ' AND cc.access <= ' . (int) $aid . ' AND s.access <= ' . (int) $aid : '') . ($catid ? $catCondition : '') . ($secid ? $secCondition : '') . ($show_front == '0' ? ' AND f.content_id IS NULL ' : '') . ' AND s.published = 1' . ' AND cc.published = 1' . ' ORDER BY ' . $ordering;
     $db->setQuery($query, 0, $count);
     $rows = $db->loadObjectList();
     $i = 0;
     $lists = array();
     foreach ($rows as $row) {
         $lists[$i]->link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid));
         $lists[$i]->text = htmlspecialchars($row->title);
         $i++;
     }
     return $lists;
 }
开发者ID:Fellah,项目名称:govnobaki,代码行数:60,代码来源:helper.php

示例6: apply

 function apply()
 {
     JRequest::checkToken() or jexit('Invalid Token');
     $applicant = JRequest::get('POST');
     jimport('joomla.utilities.date');
     $now = new JDate();
     if ($applicant['job_id'] != 0) {
         $unsol_id = $applicant['id'];
         $applicant['id'] = false;
         $applicant['request_date'] = $now->toMySQL();
         $record =& JTable::getInstance('Applicant', 'Table');
         if (!$record->save($applicant)) {
             // uh oh failed to save
             JError::raiseError('500', JTable::getError());
         }
         $unsol =& JTable::getInstance('Unsolicited', 'Table');
         if (!$unsol->delete($unsol_id)) {
             // uh oh failed to delete
             JError::raiseError('500', JTable::getError());
         }
         $this->extendApply($applicant);
     } else {
         $applicant['last_updated'] = $now->toMySQL();
         $unsol_record =& JTable::getInstance('Unsolicited', 'Table');
         if (!$unsol_record->save($applicant)) {
             // uh oh failed to save
             JError::raiseError('500', JTable::getError());
         }
         $this->extendApply($applicant);
     }
 }
开发者ID:Rayvid,项目名称:joomla-jobboard,代码行数:31,代码来源:unsolicitededit.php

示例7: jimport

 function __construct(&$_db)
 {
     parent::__construct('#__banner', 'bid', $_db);
     jimport('joomla.utilities.date');
     $now = new JDate();
     $this->set('date', $now->toMySQL());
 }
开发者ID:Fellah,项目名称:govnobaki,代码行数:7,代码来源:banner.php

示例8: save

 function save($data)
 {
     $row =& JTable::getInstance('Articles', 'Table');
     $id = $data['id'];
     if (!$id) {
         jimport('joomla.utilities.date');
         $dateNow = new JDate();
         $dateMySql = $dateNow->toMySQL();
         $data['createdate'] = $dateMySql;
         $data['addedby'] = 'server';
         $data['author'] = 'Administrator';
     }
     if (!$row->bind($data)) {
         JError::raiseError(500, $row->getError());
         return false;
     }
     if (!$row->check()) {
         JError::raiseError(500, $row->getError());
     }
     if (!$row->store()) {
         JError::raiseError(500, $row->getError());
         return false;
     }
     return true;
 }
开发者ID:hrishikesh-kumar,项目名称:NBSNIP,代码行数:25,代码来源:articles.php

示例9: save

 function save($data)
 {
     $row =& JTable::getInstance('codefile', 'Table');
     $id = $data['id'];
     if (!$id) {
         jimport('joomla.utilities.date');
         $dateNow = new JDate();
         $dateMySql = $dateNow->toMySQL();
         $data['creationdate'] = $dateMySql;
         $data['addedby'] = 'server';
     }
     if (!$row->bind($data)) {
         JError::raiseError(500, $row->getError());
         return false;
     }
     if (!$row->check()) {
         JError::raiseError(500, $row->getError());
     }
     if (!$row->store()) {
         JError::raiseError(500, $row->getError());
         return false;
     } else {
         if (!$id) {
             $row->load($row->{$id});
         }
         if ($_FILES['cfile']['size']) {
             $this->fileupdload($row->id);
         }
     }
     return true;
 }
开发者ID:hrishikesh-kumar,项目名称:NBSNIP,代码行数:31,代码来源:codefile.php

示例10: stdClass

 function &getData()
 {
     if (empty($this->_data)) {
         $query = ' SELECT * FROM #__fst_comments ' . '  WHERE id = ' . FSTJ3Helper::getEscaped($this->_db, $this->_id);
         $this->_db->setQuery($query);
         $this->_data = $this->_db->loadObject();
     }
     if (!$this->_data) {
         $this->_data = new stdClass();
         $this->_data->id = 0;
         $this->_data->ident = 5;
         //
         $this->_data->itemid = 0;
         $this->_data->body = null;
         $this->_data->email = null;
         $this->_data->name = null;
         $this->_data->website = null;
         $this->_data->published = 1;
         $current_date = new JDate();
         if (FSTJ3Helper::IsJ3()) {
             $mySQL_conform_date = $current_date->toSql();
         } else {
             $mySQL_conform_date = $current_date->toMySQL();
         }
         $this->_data->created = $mySQL_conform_date;
     }
     return $this->_data;
 }
开发者ID:AxelFG,项目名称:ckbran-inf,代码行数:28,代码来源:test.php

示例11: store

 public function store($updateNulls = false)
 {
     $now = new JDate();
     if ($this->created == null) {
         $this->created = $now->toMySQL();
     }
     return parent::store($updateNulls);
 }
开发者ID:ErickLopez76,项目名称:offiria,代码行数:8,代码来源:file.php

示例12: store

 public function store($updateNulls = false)
 {
     $now = new JDate();
     if ($this->created == null) {
         $this->created = $now->toMySQL();
     }
     $this->_generatePreview();
     $this->params = $this->_params->toString();
     return parent::store();
 }
开发者ID:ErickLopez76,项目名称:offiria,代码行数:10,代码来源:file.php

示例13: PurgeExpiredSessions

 private function PurgeExpiredSessions()
 {
     //$app = JFactory::getApplication();
     //global $app;
     //$lifetime = $app->getCfg("lifetime");
     $lifetime = JFactory::$config->get("lifetime");
     $date = new JDate("-" . $lifetime . " minute");
     $sql = "DELETE FROM #__" . $GLOBALS["ext_name"] . "_sessions WHERE birth < '" . $date->toMySQL() . "';";
     $this->db->setQuery($sql);
     $this->db->query();
 }
开发者ID:xenten,项目名称:swift-kanban,代码行数:11,代码来源:fsession.php

示例14: getList

 public function getList($params)
 {
     $db = JFactory::getDBO();
     $user = JFactory::getUser();
     $aid = $user->get('aid', 0);
     $items = (int) $params->get('items', 0);
     $order = $params->get('order', 'o_asc');
     $noauth = !JComponentHelper::getParams('com_content')->get('shownoauth');
     if (!($catid = $params->get('catid', 0))) {
         return array();
     }
     $nullDate = $db->getNullDate();
     jimport('joomla.utilities.date');
     $date = new JDate();
     $now = $date->toMySQL();
     // Ordering
     $direction = null;
     switch ($params->get('order')) {
         case 'random':
             $ordering = 'RAND()';
             break;
         case 'date':
             $ordering = 'a.created';
             break;
         case 'rdate':
             $ordering = 'a.created DESC';
             break;
         case 'alpha':
             $ordering = 'a.title';
             break;
         case 'ralpha':
             $ordering = 'a.title DESC';
             break;
         case 'hits':
             $ordering = 'a.hits';
             break;
         case 'rhits':
             $ordering = 'a.hits DESC';
             break;
         case 'ordering':
         default:
             $ordering = 'a.ordering';
             break;
     }
     $parts = explode(':', $catid);
     $section = array_shift($parts);
     $category = array_shift($parts);
     // Query to determine article count
     $query = 'SELECT a.*,' . ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,' . ' CASE WHEN CHAR_LENGTH(cc.name) THEN CONCAT_WS(":", cc.id, cc.name) ELSE cc.id END as catslug' . ' FROM #__content AS a' . ' INNER JOIN #__categories AS cc ON cc.id = a.catid' . ' INNER JOIN #__sections AS s ON s.id = a.sectionid' . ' WHERE a.state = 1 ' . ($noauth ? ' AND a.access <= ' . (int) $aid . ' AND cc.access <= ' . (int) $aid . ' AND s.access <= ' . (int) $aid : '') . ' AND (a.publish_up = "' . $nullDate . '" OR a.publish_up <= "' . $now . '" ) ' . ' AND (a.publish_down = "' . $nullDate . '" OR a.publish_down >= "' . $now . '" )' . ($category ? ' AND cc.id = ' . (int) $category : '') . ' AND cc.section = ' . (int) $section . ' AND cc.published = 1' . ' AND s.published = 1' . ' ORDER BY ' . $ordering . ' LIMIT 0,' . (int) $items;
     $db->setQuery($query);
     return $db->loadObjectList();
 }
开发者ID:janssit,项目名称:www.marlinfishingcanaria.com,代码行数:52,代码来源:helper.php

示例15: loadChartData

 function loadChartData()
 {
     $db = $this->getDBO();
     $type = JRequest::getCmd('type');
     switch ($type) {
         case 'sales':
             jimport('joomla.utilities.date');
             $date = JFactory::getDate();
             $interval = JRequest::getInt('interval', '14');
             $today = $date->toFormat('%Y-%m-%d');
             $startDate = strtotime('-' . $interval . ' day', strtotime($today));
             $startDate = new JDate($startDate);
             $query = "SELECT COUNT(virtuemart_order_id) AS sales, DATE(created_on) as `date` FROM #__virtuemart_orders WHERE created_on > " . $db->Quote($startDate->toMySQL()) . " GROUP BY `date` ORDER BY `date`";
             $db->setQuery($query);
             $rows = $db->loadObjectList();
             $data = array();
             foreach ($rows as $row) {
                 $data[$row->date] = (int) $row->sales;
             }
             $today = $date->toUnix();
             for ($time = $startDate->toUnix(); $time <= $today; $time += 86400) {
                 $date = date('Y', $time) . '-' . date('m', $time) . '-' . date('d', $time);
                 if (!array_key_exists($date, $data)) {
                     $data[$date] = 0;
                 }
             }
             ksort($data);
             $startYear = $startDate->toFormat('%Y');
             $startMonth = $startDate->toFormat('%m') - 1;
             $startDay = $startDate->toFormat('%d');
             $script = "\r\n                k2martSalesChartOptions.title.text = '" . JText::_('K2MART_TOTAL_SALES', true) . "';\r\n                k2martSalesChartOptions.subtitle.text = '* " . JText::_('K2MART_CLICK_AND_DRAG_IN_THE_PLOT_AREA_TO_ZOOM_IN', true) . "';\r\n                k2martSalesChartOptions.yAxis.title.text = '" . JText::_('K2MART_SALES', true) . "';\r\n                k2martSalesChartOptions.series[0].pointStart=Date.UTC(" . $startYear . ", " . $startMonth . ", " . $startDay . "); \r\n                k2martSalesChartOptions.series[0].data=[" . implode(',', $data) . "];\r\n                ";
             break;
         case 'products':
             $limit = JRequest::getInt('limit', '20');
             $query = "SELECT product.product_sales, productData.product_name FROM #__virtuemart_products AS product \r\n                LEFT JOIN #__virtuemart_products_" . VMLANG . " AS productData ON product.virtuemart_product_id = productData.virtuemart_product_id\r\n                WHERE  product.product_sales > 0 ORDER BY product.product_sales DESC LIMIT 0, {$limit}";
             $db->setQuery($query);
             $rows = $db->loadObjectList();
             $data = array();
             $categories = array();
             foreach ($rows as $row) {
                 $data[] = (int) $row->product_sales;
                 $categories[] = "'" . $row->product_name . "'";
             }
             $script = "\r\n                k2martProductsChartOptions.title.text = '" . JText::_('K2MART_TOP_SELLING_PRODUCTS', true) . "';\r\n                k2martProductsChartOptions.yAxis.title.text = '" . JText::_('K2MART_SALES', true) . "';\r\n                k2martProductsChartOptions.xAxis.categories =[" . implode(',', $categories) . "]; \r\n                k2martProductsChartOptions.series[0].data=[" . implode(',', $data) . "];\r\n                ";
             break;
     }
     $script .= "k2martChartType = '{$type}';";
     echo $script;
 }
开发者ID:Gskflute,项目名称:joomla25,代码行数:49,代码来源:dashboard.php


注:本文中的JDate::toMySQL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。