function output() { $p = array(); if ($this->get('a1_special_enabled')) { if (strtotime($this->get('a1_special_to')) > strtotime(oseHtml2::getDateTime())) { $a1 = $this->get('a1_special'); $a3 = $this->get('a1'); } else { $a3 = $a1 = $this->get('a1'); } } else { $a3 = $a1 = $this->get('a1'); } $p['first_raw_price'] = $a1; $p['second_raw_price'] = $a3; $p['p1'] = $this->get('p1'); $p['t1'] = $this->get('t1'); $p['p3'] = $this->get('p3'); $p['t3'] = $this->get('t3'); $p['discount'] = array(); if ($this->get('a3_discout_enabled')) { $p['discount']['amount'] = $this->get('a3_discout_amount'); $p['discount']['unit'] = $this->get('a3_discout_unit'); $p['discount']['type'] = 'renew'; $p['discount']['time'] = 2; $p['discount']['title'] = null; } return $p; }
function isAllowed2Join() { $db = oseDB::instance(); $total = $this->getTotal(); $now = oseHtml2::getDateTime(); // before validate the access, we delete the useless data first $query = " DELETE FROM `#__osemsc_member_join_session`" . " WHERE `msc_id`='{$this->id}' AND `start_date` < DATE_SUB('{$now}',INTERVAL 30 MINUTE)"; $db->setQuery($query); oseDB::query(); // detect whether it is full if ($total == $this->restricted_number) { return false; } // default half an hour $query = "SELECT COUNT(*) FROM `#__osemsc_member_join_session`" . " WHERE `msc_id`='{$this->id}' AND `start_date` > DATE_SUB('{$now}',INTERVAL 30 MINUTE)"; $db->setQuery($query); $temporary = $db->loadResult(); $nowTotal = $total + $temporary; if ($nowTotal >= $this->restricted_number) { return false; } else { return true; } }
function generateOrder($msc_id, $msc_option = null) { $vals = array(); $params = array(); $subtotal = 0.0; $order_number = $this->generateOrderNumber($this->user_id); $params['entry_type'] = 'msc_list'; $params['payment_price'] = 0.0; $params['payment_currency'] = 'USD'; $params['order_number'] = $order_number; $params['create_date'] = oseHTML2::getDateTime(); //date("Y-m-d H:i:s"); $params['payment_serial_number'] = substr($order_number, 0, 20); $params['payment_method'] = 'free'; $params['payment_mode'] = 'm'; $entry_type = 'msc'; $db = oseDB::instance(); $query = "SELECT * FROM `#__osemsc_ext`" . " WHERE `type` = 'payment' AND `id` = '{$msc_id}'"; $db->setQuery($query); $planPayment = oseDB::loadItem('obj'); $options = oseJSON::decode($planPayment->params, true); $paymentInfo = oseGetValue($options, $lc->entry_option, array()); $price = 0.0; $pVals = array(); $pVals['recurrence_mode'] = 'period'; $pVals['a3'] = $price; $pVals['p3'] = oseGetValue($paymentInfo, 'p3'); $pVals['t3'] = oseGetValue($paymentInfo, 't3'); $pVals['msc_option'] = $msc_option; $pVals['recurrence_mode'] = 'fixed'; $pVals['start_date'] = oseHtml2::getDateTime(); $pVals['expired_date'] = oseGetValue($this, 'expired_date', oseHtml2::getDateTime()); $pVals['isLicensee'] = 1; // set licensee true $this->set('isLicensee', true); $pVals['eternal'] = oseGetValue($paymentInfo, 'eternal'); $params['params'] = $pVals; $params['params']['total'] = $price; $params['params']['discount'] = $price; $params['params']['subtotal'] = $price; $params['params']['next_subtotal'] = $price; $params['params'] = oseJSON::encode($params['params']); $updated = oseDB::insert('#__osemsc_order', $params); if ($updated) { $order_id = $updated; $this->order_id = $order_id; } else { $result['success'] = false; $result['title'] = $result['status'] = 'Error'; $result['content'] = $result['result'] = JText::_('Error'); return $result; } $itemParams = array(); $itemParams['entry_type'] = $entry_type; $itemParams['payment_price'] = $price; $itemParams['payment_currency'] = 'USD'; $itemParams['create_date'] = oseHTML2::getDateTime(); //date("Y-m-d H:i:s"); $itemParams['payment_mode'] = 'm'; $itemParams['params'] = oseJSON::encode($pVals); $updated = oseDB::insert('#__osemsc_order_item', $itemParams); if ($updated) { $this->order_item_id = $updated; $result['success'] = true; $result['title'] = $result['status'] = JText::_('Done'); $result['content'] = $result['result'] = JText::_('Done'); } else { $result['success'] = false; $result['title'] = $result['status'] = 'Error'; $result['content'] = $result['result'] = JText::_('Order Generate Error'); } return $result; }
* but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * @Copyright Copyright (C) 2010- Open Source Excellence (R) */ defined('_JEXEC') or die("Direct Access Not Allowed"); $postString = array(); $postString['types']=array('Addons','MscIdOption','CountryState','Language'); $postString['option']='com_osemsc'; $postString['task']='generateJs'; $postString['addontype']='member'; oseHtml2::matchScript('index.php?'.http_build_query($postString),'msc'); ?> <script type="text/javascript"> if (!Ext.browser.is.WebKit) { alert("The current browser is unsupported.\n\nSupported browsers:\n" + "Google Chrome\n" + "Apple Safari\n" + "Mobile Safari (iOS)\n" + "Android Browser\n" + "BlackBerry Browser" ); } var getCurrentUrl = function() {