本文整理汇总了PHP中AImporter::table方法的典型用法代码示例。如果您正苦于以下问题:PHP AImporter::table方法的具体用法?PHP AImporter::table怎么用?PHP AImporter::table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AImporter
的用法示例。
在下文中一共展示了AImporter::table方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
/**
* Save subject.
*
* @param boolean $apply true state on edit page, false return to browse list
*/
function save($apply = false)
{
$task = $this->getTask();
JRequest::checkToken() or jexit('Invalid Token');
$mainframe = JFactory::getApplication();
$input = $mainframe->input;
$post = JRequest::get('post');
$post['desc'] = JRequest::getVar('desc', '', 'post', 'string', JREQUEST_ALLOWRAW);
$post['jform']['meal'] = implode(';', $post['jform']['meal']);
//debug($post['jform']); die;
$db = JFactory::getDbo();
AImporter::table('itinerary');
$Table = new TableItinerary($db);
$Table->bind($post['jform']);
$Table->store();
$id = $Table->id;
if ($id !== false) {
$mainframe->enqueueMessage(JText::_('Successfully saved'), 'message');
} else {
$mainframe->enqueueMessage(JText::_('Save failed'), 'error');
}
if ($task != 'save') {
$mainframe->redirect('index.php?option=com_bookpro&view=itinerary&layout=edit&id=' . $id);
} else {
$mainframe->redirect('index.php?option=com_bookpro&view=itineraries');
}
}
示例2: __construct
function __construct()
{
parent::__construct();
if (!class_exists('TablePackagerate')) {
AImporter::table('packagerate');
}
$this->_table = $this->getTable('packagerate');
}
示例3: 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);
}
示例4: 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;
}
示例5: applycoupon
function applycoupon()
{
$input = JFactory::getApplication()->input;
$code = $input->getString('coupon');
$order_id = $input->getInt('order_id');
AImporter::table('orders', 'coupon');
$coupon = JTable::getInstance('Coupon', 'table');
$coupon->load(array('code' => $code));
$check = true;
if ($coupon) {
if ((int) $coupon->total == 0) {
$check = false;
$msg = JText::_('COM_BOOKPRO_COUPON_INVALID');
} else {
$order = JTable::getInstance('Orders', 'table');
$order->load($order_id);
if ($order->discount > 0) {
$check = false;
$msg = JText::_('COM_BOOKPRO_COUPON_APPLY_ERROR');
} else {
if ($coupon->subtract_type == 1) {
$discount = $order->total * $coupon->amount / 100;
$order->total = $order->total - $discount;
$order->discount = $discount;
} else {
$order->total = $order->total - $coupon->amount;
$order->discount = $coupon->amount;
}
$order->coupon_id = $coupon->id;
$coupon->total = $coupon->total - 1;
$coupon->store();
$order->store();
$msg = JText::_('COM_BOOKPRO_COUPON_VALID');
}
}
} else {
$check = false;
$msg = JText::_('COM_BOOKPRO_COUPON_INVALID');
}
$this->setRedirect(JURI::base() . 'index.php?option=com_bookpro&view=formpayment&order_id=' . $order_id . '&' . JSession::getFormToken() . '=1', $msg);
return;
}
示例6: delete
public function delete()
{
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
$cid = JFactory::getApplication()->input->getInt('cid');
if (!$cid) {
$this->setMessage('Delete failed!');
} else {
AImporter::table('vehicletype');
$db = JFactory::getDbo();
$table = new TableVehicleType($db);
$table->load($cid);
$result = $table->delete();
}
if ($result) {
$this->setMessage('Delete successfull!');
} else {
$this->setMessage('Delete failed!');
}
$this->directView();
}
示例7: save
function save($apply = true)
{
AImporter::table('transportdayoff');
$db = JFactory::getDbo();
//delete old dayoff
$query = $db->getQuery(true);
$query->delete('#__bookpro_transport_dayoff')->where('date < ' . JHtml::date('now', 'Y-m-d'));
$db->setQuery($query);
$db->execute();
$data = $this->input->get('params', array(), 'array');
$params = array();
foreach ($data as $rate_id => $param) {
foreach ($param as $key => $array) {
foreach ($array as $i => $val) {
if ($val) {
$params[$rate_id][$i][$key] = $val;
} else {
if (isset($params[$rate_id][$i])) {
unset($params[$rate_id][$i]);
}
}
}
}
}
$data = array('id' => $this->input->getInt('id'), 'date' => $this->input->getString('date'), 'params' => json_encode($params));
$table = new TableTransportdayoff($db);
if ($table->save($data)) {
JFactory::getApplication()->enqueueMessage('Update successful');
} else {
JFactory::getApplication()->enqueueMessage('Update failed');
}
if ($apply) {
$this->setRedirect(JRoute::_('index.php?option=com_bookpro&view=transportdayoff&layout=edit&date=' . $this->input->getString('date') . '&id=' . $table->id, false));
} else {
$this->setRedirect(JRoute::_('index.php?option=com_bookpro&view=transportdayoffs'));
}
return;
}
示例8: defined
<?php
/**
* @package Bookpro
* @author Ngo Van Quan
* @link http://joombooking.com
* @copyright Copyright (C) 2011 - 2012 Ngo Van Quan
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
**/
defined('_JEXEC') or die('Restricted access');
AImporter::table('customer');
class BookproCustomer extends JObject
{
public $id;
public $table;
private $_db;
public function __construct($id = null)
{
$this->_db = JFactory::getDbo();
$this->table = new TableCustomer($this->_db);
if ($id) {
$this->table->load($id);
$this->id = $this->table->id;
}
}
public function load($array)
{
$this->table->load($array);
if ($this->table->id) {
$this->id = $this->table->id;
}
示例9: saveAddon
protected function saveAddon()
{
AImporter::table('ordersaddon');
if ($this->addons) {
foreach ($this->addons as $addon) {
$addon_array = array('order_id' => $this->table->id, 'addon_id' => $ad, 'return' => 0, 'params' => json_encode($addon));
$addon_table = new TableOrdersAddon($this->_db);
$addon_table->save($addon_array);
}
}
return true;
}
示例10: saveAddon
protected function saveAddon()
{
AImporter::table('ordersaddon');
if ($this->addons['depart']) {
foreach ($this->addons['depart'] as $addon) {
$addon_array = array('order_id' => $this->table->id, 'addon_id' => $addon->id, 'return' => 0, 'params' => json_encode($addon));
$addon_table = new TableOrdersAddon($this->_db);
if (!$addon_table->save($addon_array)) {
die('save depart addon error');
}
}
}
if ($this->addons['return']) {
foreach ($this->addons['return'] as $addon) {
$addon_array = array('order_id' => $this->table->id, 'addon_id' => $addon->id, 'return' => 1, 'params' => json_encode($addon));
$addon_table = new TableOrdersAddon($this->_db);
if (!$addon_table->save($addon_array)) {
die('save return addon error');
}
}
}
return true;
}
示例11: save
public function save($data)
{
$check = false;
try {
$this->_db->transactionStart();
AImporter::table('transport_stop');
$type = BookProHelper::get('transport_type', 'array');
$app = JFactory::getApplication();
$table = $this->getTable();
//private price
if ($data['type'] == $type['private']) {
$data['rate'] = json_encode($this->getPrivateGroup($app));
}
$params = new JObject();
$params->assistance = $data['assistance'];
$data['params'] = json_encode($params);
$vehicle = $app->input->get('vehicle', array(), 'array');
$data['vehicle'] = implode($vehicle, ';');
if ($table->save($data)) {
$route_id = $table->id;
//save stops
$stops = $this->getStops($app, $data['type'], $route_id);
if (count($stops) < 2) {
debug('stops must greater 2 destination');
die;
}
//save stop points
//get id of remove stop
$stop_remove = array();
foreach ($stops as $stop) {
$stop_table = new TableTransport_stop($this->_db);
$check = $stop_table->save((array) $stop);
$stop_remove[] = $stop_table->id;
}
$this->deleteEmptyStop($stop_remove, $route_id);
}
$this->_db->transactionCommit();
} catch (Exception $e) {
debug($e->getMessage());
die;
}
return $check;
}
示例12: resetPrice
function resetPrice()
{
$data[type] = 'BASE';
AImporter::table('price');
$db = JFactory::getDbo();
$table = new TablePrice($db);
$table->load(array('type' => $data[type]));
$save = $table->save($data);
if ($save) {
JFactory::getApplication()->enqueueMessage(JText::_('JLIB_APPLICATION_SAVE_SUCCESS'), 'message');
} else {
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
}
$this->setRedirect(JRoute::_('index.php?option=com_bookpro&view=prices', false));
}
示例13: test
public function test()
{
AImporter::table('transport');
$db = JFactory::getDbo();
$query = 'select * from `#__bookpro_transport`';
$db->setQuery($query);
$data = $db->loadObjectlist();
foreach ($data as $d) {
$pram = json_decode($d->params);
unset($pram->parking);
$table = new TableTransport($db);
$table->load($d->id);
$table->params = json_encode($pram);
$table->store();
}
}
示例14: saveLog
private function saveLog($frate, $week, $jform)
{
$content = new JObject();
$content->week = $week;
$content->price = array();
foreach ($frate as $rate) {
$type = $rate['pricetype'];
unset($rate['pricetype']);
$content->price[$type] = $rate;
unset($content->price[$rate['pricetype']]->pricetype);
}
$data = array();
$data['startdate'] = $jform['startdate'];
$data['enddate'] = $jform['enddate'];
$data['tour_id'] = $jform['tour_id'];
$data['content'] = json_encode($content);
AImporter::table('tourratelog');
$db = JFactory::getDbo();
$table = new TableTourRateLog($db);
$table->save($data);
return true;
}
示例15: defined
<?php
/**
* @package Bookpro
* @author Ngo Van Quan
* @link http://joombooking.com
* @copyright Copyright (C) 2011 - 2012 Ngo Van Quan
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
* @version $Id$
**/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
AImporter::table('orders');
AImporter::model('order');
class BookProViewPostPayment extends JViewLegacy
{
function display($tpl = null)
{
$input = JFactory::getApplication()->input;
$order_number = $input->getString('order');
$db = JFactory::getDbo();
$this->order = new TableOrders($db);
$this->order->load(array('order_number' => $order_number));
$model = new BookProModelOrder();
$this->orderComplex = $model->getComplexItem($this->order->id);
if ($this->orderComplex->customer->email != $input->getString('email')) {
JFactory::getApplication()->enqueueMessage('COM_BOOKPRO_WRONG_ORDER_NUMBER_OR_EMAIL_WARN');
return;
}
parent::display($tpl);
}