本文整理汇总了PHP中DateHelper::createFromFormatYmd方法的典型用法代码示例。如果您正苦于以下问题:PHP DateHelper::createFromFormatYmd方法的具体用法?PHP DateHelper::createFromFormatYmd怎么用?PHP DateHelper::createFromFormatYmd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateHelper
的用法示例。
在下文中一共展示了DateHelper::createFromFormatYmd方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exportPDF
function exportPDF()
{
$app = JFactory::getApplication();
$input = $app->input;
AImporter::helper('pdf', 'date');
AImporter::model('transportreports');
$model = new BookproModelTransportReports();
$depart_date = DateHelper::createFromFormatYmd($input->get('filter_depart_date'));
$state = $model->getState();
$state->set('list.limit', NULL);
$state->set('list.start', 0);
$state->set('list.ordering', 'pickup');
$state->set('list.direction', 'ASC');
if ($app->isAdmin()) {
$ticket_view = $this->getView('Transportreports', 'html', 'BookProView');
} else {
$ticket_view = $this->getView('AgentTransportreports', 'html', 'BookProView');
$ticket_view->is_admin = 1;
}
$ticket_view->setModel($model, true);
$ticket_view->setLayout('report');
ob_start();
$ticket_view->display();
$pdf = ob_get_contents();
ob_end_clean();
//get flight name
$order = new JObject();
$order->name = "transport_report" . $input->get('filter_depart_date') . '_' . JHtml::_('date', 'now', 'YmdHis');
$order->fontsize = 9;
PrintPdfHelper::printTicket($pdf, $order, 'P');
return;
}
示例2: populateState
protected function populateState($ordering = null, $direction = null)
{
// Load the filter state.
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $search);
$order_status = $this->getUserStateFromRequest($this->context . '.filter.order_status', 'filter_order_status', null, 'string');
$this->setState('filter.order_status', $order_status);
$from_time = $this->getUserStateFromRequest($this->context . '.filter.from_time', 'filter_from_time', null, 'string');
$this->setState('filter.from_time', $from_time);
$to_time = $this->getUserStateFromRequest($this->context . '.filter.to_time', 'filter_to_time', null, 'string');
$this->setState('filter.to_time', $to_time);
$type = $this->getUserStateFromRequest($this->context . '.filter.type', 'filter_type', null, 'int');
$this->setState('filter.type', $type);
$destfrom = $this->getUserStateFromRequest($this->context . '.filter.destfrom', 'filter_destfrom', null, 'int');
$this->setState('filter.destfrom', $destfrom);
$destto = $this->getUserStateFromRequest($this->context . '.filter.destto', 'filter_destto', null, 'int');
$this->setState('filter.destto', $destto);
$route_id = $this->getUserStateFromRequest($this->context . '.filter.route_id', 'filter_route_id', null, 'int');
$this->setState('filter.route_id', $route_id);
parent::populateState('i.start', 'ASC');
$fromdate = $this->getUserStateFromRequest($this->context . '.filter.from_date', 'filter_from_date', null, 'string');
$fromdate = DateHelper::createFromFormatYmd($fromdate);
$this->setState('filter.from_date', $fromdate);
$todate = $this->getUserStateFromRequest($this->context . '.filter.to_date', 'filter_to_date', null, 'string');
$todate = DateHelper::createFromFormatYmd($todate);
$this->setState('filter.to_date', $todate);
}
示例3: populateState
protected function populateState($ordering = null, $direction = null)
{
AImporter::helper('date');
parent::populateState();
$app = JFactory::getApplication();
$id = JRequest::getVar('id', 0, '', 'int');
$this->setState('passengerlist.id', $id);
// Load the filter state.
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $search);
$order_id = $this->getUserStateFromRequest($this->context . '.filter.order_id', 'filter_order_id', null, 'int');
$this->setState('filter.order_id', $order_id);
$tour_id = $this->getUserStateFromRequest($this->context . '.filter.tour_id', 'filter_tour_id', null, 'int');
$this->setState('filter.tour_id', $tour_id);
$depart_date = $this->getUserStateFromRequest($this->context . '.filter.depart_date', 'filter_depart_date', null);
$depart_date = DateHelper::createFromFormatYmd($depart_date);
$this->setState('filter.depart_date', $depart_date);
$order_status = $this->getUserStateFromRequest($this->context . '.filter.order_status', 'filter_order_status', null, 'string');
$this->setState('filter.order_status', $order_status);
$value = $app->getUserStateFromRequest($this->context . '.ordercol', 'filter_order', $ordering);
$this->setState('list.ordering', $value);
$value = $app->getUserStateFromRequest($this->context . '.orderdirn', 'filter_order_Dir', $direction);
$this->setState('list.direction', $value);
$fromdate = $this->getUserStateFromRequest($this->context . '.filter.from_date', 'filter_from_date', null, 'string');
$fromdate = DateHelper::createFromFormatYmd($fromdate);
$this->setState('filter.from_date', $fromdate);
$todate = $this->getUserStateFromRequest($this->context . '.filter.to_date', 'filter_to_date', null, 'string');
$todate = DateHelper::createFromFormatYmd($todate);
$this->setState('filter.to_date', $todate);
}
示例4: saveOrderInfo
protected function saveOrderInfo()
{
//save order info
AImporter::table('orderinfo');
AImporter::helper('date');
$this->orderinfo['params']['start'] = DateHelper::createFromFormatYmd($this->orderinfo['params']['start']);
$this->orderinfo['params']['end'] = DateHelper::createFromFormatYmd($this->orderinfo['params']['end']);
$orderinfo = $this->orderinfo;
$orderinfo['order_id'] = $this->table->id;
$orderinfo['params'] = json_encode($this->orderinfo['params']);
$orderinfo['start'] = $this->orderinfo['params']['start'];
$TableOrderinfo = new TableOrderInfo($this->_db);
return $TableOrderinfo->save($orderinfo);
}
示例5: postSaveHook
function postSaveHook($model, $validData)
{
//save orderinfo
if ($validData['id']) {
AImporter::helper('date');
AImporter::table('orderinfo');
$orderinfo = $this->input->get('orderinfo', array(), 'array');
$orderinfo['params']['start'] = DateHelper::createFromFormatYmd($orderinfo['params']['start']);
$orderinfo['params']['end'] = DateHelper::createFromFormatYmd($orderinfo['params']['end']);
$orderinfo['start'] = $orderinfo['params']['start'];
$orderinfo['params'] = json_encode($orderinfo['params']);
// debug($orderinfo);die;
$db = JFactory::getDbo();
$table = new TableOrderInfo($db);
$table->load(array('order_id' => $validData['id']));
return $table->save($orderinfo);
}
return true;
}
示例6: search
public function search()
{
AImporter::helper('date');
AImporter::model('tours');
$transport_cart = $this->getCart('TransportCart');
$transport_cart->tour = 1;
$transport_cart->saveToSession();
$app = JFactory::getApplication();
$this->cart = $this->getCart();
$this->cart->filter = array();
$this->cart->filter['adult'] = $app->input->getInt('adult');
$this->cart->filter['child'] = $app->input->getInt('child');
$this->cart->filter['infant'] = $app->input->getInt('infant');
$this->cart->filter['cat_id'] = $app->input->getInt('cat_id');
$this->cart->filter['start'] = DateHelper::createFromFormatYmd($app->input->getString('start'));
$this->cart->saveToSession();
$tours = $this->getTour();
// debug($tours);die;
$view = $this->getView('tours', 'html', 'BookProView');
$view->assign('cart', $this->cart);
$view->assign('tours', $tours);
$view->display();
return;
}
示例7: save
/**
* Save subject.
*
* @param boolean $apply
* true state on edit page, false return to browse list
*/
function save($apply = false)
{
$mainframe = JFactory::getApplication();
$db = JFactory::getDbo();
$input = JFactory::getApplication()->input;
$jform = $input->get('jform', array(), 'array');
$frate = $input->get('frate', array(), 'array');
//quote all value to push db
foreach ($frate as &$rate) {
foreach ($rate as $i => $v) {
$rate[$i] = $db->quote($v);
}
}
$rate = reset($frate);
$key = array_keys($rate);
$weekdays = $input->get('weekday', null, 'array');
$state = $input->getInt('state');
$jform['startdate'] = DateHelper::createFromFormatYmd($jform['startdate']);
$jform['enddate'] = DateHelper::createFromFormatYmd($jform['enddate']);
$startdate = new JDate($jform['startdate']);
$enddate = new JDate($jform['enddate']);
$starttoend = $startdate->diff($enddate)->days;
// delete old record
$tour_id = $jform['tour_id'];
try {
$db->transactionStart();
// Delete all existing rate in this duration and fligh route
$query = $db->getQuery(true);
$query->delete('#__bookpro_tourrate')->where('(tour_id=' . $tour_id . '
AND date BETWEEN ' . $db->quote($startdate) . '
AND ' . $db->quote($enddate) . '
AND DATE_FORMAT(date,"%w") IN (' . implode(',', $weekdays) . '))
OR (date < ' . $db->quote(JFactory::getDate('- 10DAYS')->format('Y-m-d') . ' AND tour_id=' . $tour_id) . ')');
$db->setQuery($query);
$db->execute();
$query = $db->getQuery(true);
$query->insert('#__bookpro_tourrate');
$query->columns('tour_id,date,' . implode(',', $key) . ',state');
$values = array();
for ($i = 0; $i <= $starttoend; $i++) {
$dw = (int) $startdate->format('w');
if (in_array("{$dw}", $weekdays)) {
foreach ($frate as $rate) {
$temp = array($jform['tour_id'], $db->quote($startdate->toSql()));
$temp = array_merge($temp, $rate);
$temp[] = $state;
$values[] = implode(',', $temp);
}
}
$startdate = $startdate->add(new DateInterval('P1D'));
}
// Save rate
$query->values($values);
$db->setQuery($query);
$db->execute();
$this->saveLog($frate, $weekdays, $jform);
$db->transactionCommit();
$mainframe->enqueueMessage('Saved successful');
} catch (Exception $e) {
$db->transactionRollback();
JErrorPage::render($e);
$mainframe->enqueueMessage($e->getMessage());
}
// if($apply)
$this->setRedirect(JRoute::_('index.php?option=com_bookpro&view=tourrate&tour_id=' . $tour_id, false));
// else
// $this->setRedirect ( JRoute::_('index.php?option=com_bookpro&view=tours',false) );
}
示例8: search
function search()
{
AImporter::helper('date', 'transport', 'date');
AImporter::model('transports');
$cart = $this->getCart();
$config = JComponentHelper::getParams('com_bookpro');
$input = JFactory::getApplication()->input;
$cart->filter['destfrom'] = $input->getInt('transport_from');
$cart->filter['pad_from'] = $input->getString('transport_padress_from');
$cart->filter['pad_to'] = $input->getString('transport_padress_to');
$cart->filter['destto'] = $input->getInt('transport_to');
$cart->filter['type'] = $input->getInt('transport_type');
$cart->filter['country'] = $input->getInt('transport_country');
$cart->filter['roundtrip'] = $input->getInt('roundtrip');
$cart->filter['adult'] = $input->getInt('transport_adult');
$cart->filter['child'] = $input->getInt('transport_child');
$cart->filter['infant'] = $input->getInt('transport_infant');
$cart->filter['bag'] = $input->getInt('transport_bag');
$cart->start = DateHelper::createFromFormatYmd($input->getString('transport_start'));
if ($cart->filter['roundtrip']) {
$cart->end = DateHelper::createFromFormatYmd($input->getString('transport_return'));
}
$cart->tour = 0;
$cart->tax = $config->get('tax');
$cart->is_airport_shuttle = 0;
//check if destionation is from airport
$dest_from = TransportHelper::getDest($cart->filter['destfrom']);
$dest_to = TransportHelper::getDest($cart->filter['destto']);
if ($dest_from[0]->value == 'AP') {
$cart->is_airport_shuttle = 1;
} else {
if ($dest_to[0]->value == 'AP') {
$cart->is_airport_shuttle = 2;
}
}
//find trips
$trips = $this->getTrip($cart);
if (empty($trips['depart'])) {
JFactory::getApplication()->enqueueMessage(JText::_('COM_BOOKPRO_DEPART_TRIP_NOT_AVAILABLE_WARN'), 'warning');
}
if ($cart->filter['roundtrip']) {
if (empty($trips['return'])) {
//$cart->filter['roundtrip'] = 0;
JFactory::getApplication()->enqueueMessage(JText::_('COM_BOOKPRO_RETURN_TRIP_NOT_AVAILABLE_WARN'), 'warning');
}
}
// debug($trips);die;
$cart->saveToSession();
$view = $this->getView('transporttime', 'html', 'BookProView');
$view->assign('cart', $cart);
$view->assign('trips', $trips);
$view->display();
}