public static function add($params)
	{
		$result = array();
		$result['success'] = true;
		
		if(empty($params))
		{
			$result['success'] = false;
			$result['title'] = 'Error';
			$result['content'] = JText::_('Error Register_Order.PAP');
			
			return $result;
		}
		//unset($params['allow_work']);
		
		if(!empty($_COOKIE['PAPVisitorId']))
		{
			$orderParams = oseJson::decode($params['params']);
			
			$orderParams->pap_visitorid = $_COOKIE['PAPVisitorId'];
			$orderParams->first_ip = oseMscPublic::getIP();
			$params['params'] = oseJson::encode($orderParams);
			return $params;
		}
		else
		{
			return $params;
		}
	}
示例#2
0
 function display($tpl = null)
 {
     $tmpl = JRequest::getVar('tmpl');
     if (empty($tmpl)) {
         JRequest::setVar('tmpl', 'component');
     }
     if (JOOMLA16 == false) {
         require_once OSEMSC_B_PATH . DS . 'helpers' . DS . "extLanguage.php";
         oseHTML::script(OSEMSC_F_URL . '/libraries/joomla.core.js', '1.5');
         $strings = oseJson::encode(oseText::jsStrings());
         $document = JFactory::getDocument();
         $document->addScriptDeclaration('(function(){var strings=' . $strings . ';Joomla.JText.load(strings)})()');
     }
     $com = OSECPU_PATH_JS . '/com_ose_cpu/extjs';
     oseHTML::initScript();
     oseHTML::script($com . '/ose/app.msg.js', '1.5');
     oseHTML::script(OSEMSC_F_URL . '/libraries/init.js', '1.5');
     require_once OSEMSC_B_PATH . DS . 'helpers' . DS . "extLanguage.php";
     $OSESoftHelper = new OSESoftHelper();
     $footer = $OSESoftHelper->renderOSETM();
     $this->assignRef('footer', $footer);
     $preview_menus = $OSESoftHelper->getPreviewMenus();
     $this->assignRef('preview_menus', $preview_menus);
     $this->assignRef('OSESoftHelper', $OSESoftHelper);
     $title = JText::_('OSE Membership™ Profile Management');
     $this->assignRef('title', $title);
     parent::display($tpl);
 }
	public static function add($params)
	{
		$result = array();
		$result['success'] = true;
		
		if(empty($params))
		{
			$result['success'] = false;
			$result['title'] = 'Error';
			$result['content'] = JText::_('Error Register_Order.PAP');
			
			return $result;
		}
		//unset($params['allow_work']);
		if(!empty($_COOKIE['oseAffiliate']))
		{
			$orderParams = oseJson::decode($params['params']);
			$oseAffiliate = oseJSON::decode($_COOKIE['oseAffiliate']);
		
			
			$orderParams->oseaffiliateID = $oseAffiliate->oafid;
			$orderParams->osebannerID = $oseAffiliate->obid;
			$orderParams->first_ip = oseMscPublic::getIP();
			//$orderParams->first_ip = oseMscPublic::getIP();
			$params['params'] = oseJson::encode($orderParams);
			return $params;
		}
		else
		{
			return $params;
		}
	}
	public static function getMSCs()
	{
		$my = JFactory::getUser();
		$member_id = $my->id;
		$result = array();
		$db= oseDB :: instance();
		$query= " SELECT acl.id, acl.title FROM `#__osemsc_member_history` AS omh" 
			   ." INNER JOIN `#__osemsc_acl` AS acl" 
			   ." ON omh.`msc_id` = acl.`id`" 
			   ." WHERE omh.`member_id` = '{$member_id}'" 
			   ." GROUP BY acl.`id`";
		$db->setQuery($query);
		$items = oseDB :: loadList();
		if(count($items) < 1)
		{
			$result['total'] = 0;
			$result['results'] = '';
		}else
		{
			$result['total'] = count($items);
			$result['results'] = $items;
		}	
		$result = oseJson :: encode($result);
		oseExit($result);
	}
 public static function renew($params)
 {
     $result = array();
     $result['success'] = true;
     if (empty($params['allow_work'])) {
         $result['success'] = false;
         $result['title'] = 'Error';
         $result['content'] = JText::_("Error");
         return $result;
     }
     unset($params['allow_work']);
     //oseExit($params);
     $db = oseDB::instance();
     $post = JRequest::get('post');
     $msc_id = $params['msc_id'];
     $member_id = $params['member_id'];
     if (empty($msc_id)) {
         $result['success'] = false;
         $result['title'] = 'Error';
         $result['content'] = JText::_("Renew Msc: No Msc ID");
         return $result;
     }
     // get the plan id of msc
     $query = "SELECT * FROM `#__osemsc_ext` WHERE `id` = '{$msc_id}' AND `type` = 'osecredit'";
     $db->setQuery($query);
     $data = $db->loadObject();
     $data = oseJson::decode($data->params);
     if (empty($data->osecredit_id) || empty($data->enable)) {
         $result['success'] = true;
         $result['title'] = JText::_('Done');
         $result['content'] = JText::_("Done");
         return $result;
     }
     $query = "SELECT credit_amount FROM `#__ose_credit_plan` WHERE `id` = '{$data->osecredit_id}'";
     $db->setQuery($query);
     $amount = $db->loadResult();
     $query = "SELECT * FROM `#__ose_credit_member` WHERE `member_id` = '{$member_id}'";
     $db->setQuery($query);
     $obj = $db->loadObject();
     if (empty($obj)) {
         $credit_params = oseJson::encode(array());
         $query = " INSERT INTO `#__ose_credit_member` (`member_id`, `credit_amount`, `params`)" . " VALUES" . " ('{$member_id}', '{$amount}', '{$credit_params}')";
     } else {
         $amount = $amount + $obj->credit_amount;
         $query = "UPDATE `#__ose_credit_member` SET `credit_amount` = '{$amount}' WHERE `id` = '{$obj->id}'";
     }
     $db->setQuery($query);
     if (!$db->query()) {
         $result['success'] = false;
         $result['title'] = 'Error';
         $result['content'] = JText::_('Error');
         return $result;
     }
     $result['success'] = true;
     $result['title'] = JText::_('Done');
     $result['content'] = JText::_("Done");
     return $result;
 }
示例#6
0
function oseCheckToken()
{
    $tokenCheck = JRequest::checkToken();
    if (empty($tokenCheck)) {
        $result['content'] = 'Token is invalid!';
        $result = oseJson::encode($result);
        oseExit($result);
    }
}
示例#7
0
 function add($title)
 {
     $db = oseDB::instance();
     $params = array('range' => 'all');
     $params = $db->Quote(oseJson::encode($params));
     $query = " INSERT INTO `#__osemsc_coupon` (`title`,`params`) VALUES ('{$title}',{$params})";
     $db->setQuery($query);
     return oseDB::query();
 }
 public static function save($params = array())
 {
     $db = oseDB::instance();
     $post = JRequest::get('post');
     $id = JRequest::getCmd('id', null);
     $msc_id = JRequest::getInt('msc_id', 0);
     if (empty($id)) {
         $id = uniqid();
     }
     $extItem = oseRegistry::call('msc')->getExtInfoItem($msc_id, 'acymailing2', 'obj');
     $extItem->params = empty($extItem->params) ? '{}' : $extItem->params;
     $items = oseJson::decode($extItem->params, true);
     $where = array();
     $msc_id = isset($msc_id) ? $msc_id : null;
     if (empty($msc_id)) {
         return false;
         // No membership exists in the addon
     } else {
         unset($post['msc_id']);
         $where[] = 'id = ' . $db->Quote($msc_id);
     }
     $where[] = 'type = ' . $db->Quote('acymailing2');
     $params = array();
     $prefix = 'acymailing2_';
     foreach ($post as $key => $value) {
         if (strstr($key, $prefix)) {
             $newKey = preg_replace("/{$prefix}/", '', $key, 1);
             $params[$newKey] = $value;
         }
     }
     ksort($params);
     $params['id'] = $id;
     $items[$id] = $params;
     $newParams = $db->Quote(oseJson::encode($items));
     $where = oseDB::implodeWhere($where);
     $query = " SELECT * FROM `#__osemsc_ext` " . $where;
     $db->setQuery($query);
     $obj = oseDB::loadItem('obj');
     if (empty($obj)) {
         $query = " INSERT INTO `#__osemsc_ext` " . " (id,type,params)" . " VALUES " . " ({$msc_id}," . $db->Quote('acymailing2') . ",{$newParams}) ";
         $db->setQuery($query);
         //oseExit($db->_sql);
     } else {
         $query = " UPDATE `#__osemsc_ext` " . " SET " . " params = {$newParams} " . " WHERE id = {$obj->id}" . " AND type = " . $db->Quote('acymailing2');
         $db->setQuery($query);
     }
     if (oseDB::query()) {
         $result['success'] = true;
         $result['title'] = JText::_('Finished');
         $result['content'] = JText::_('Save Successfully!');
     } else {
         $result['success'] = false;
         $result['title'] = JText::_('Error');
         $result['content'] = JText::_('Error in Saving License Parameters');
     }
     return $result;
 }
示例#9
0
	function getTerm()
	{
		$id = JRequest::getInt('id',0);

		$terms = oseRegistry::call('member')->getInstance('Email')->getTerm($id);
		$terms = str_replace("../", JURI::root(), $terms);
		$result = empty($terms)?'':$terms;
		$result = oseJson::encode($result);
		oseExit($result);
	}
示例#10
0
 function setParams($item, $params)
 {
     $itemParams = oseGetValue($item, 'params', '{}');
     $itemParams = oseJson::decode($itemParams);
     if (!is_Array($params)) {
         $params = (array) $params;
     }
     foreach ($params as $key => $value) {
         $itemParams = oseSetValue($itemParams, $key, $value);
     }
     $itemParams = oseJson::encode($itemParams);
     $item = oseSetValue($item, 'params', $itemParams);
     return $item;
 }
示例#11
0
 function getOwnMsc()
 {
     $model = $this->getModel('member');
     $items = $model->getOwnMsc();
     $total = count($items);
     if ($total > 0) {
         $result['total'] = $total;
         $result['results'] = $items;
     } else {
         $result['total'] = 0;
         $result['results'] = null;
     }
     $result = oseJson::encode($result);
     oseExit($result);
 }
 public static function add($params)
 {
     $result = array();
     $result['success'] = true;
     if (empty($params)) {
         $result['success'] = false;
         $result['title'] = 'Error';
         $result['content'] = JText::_('Error Register_Order.Idev');
         return $result;
     }
     $orderParams = oseJson::decode($params['params']);
     $orderParams->first_ip = oseMscPublic::getIP();
     $params['params'] = oseJson::encode($orderParams);
     return $params;
 }
示例#13
0
 function getList()
 {
     $model = $this->getModel('levels');
     $results = $model->getList();
     $result = array();
     if (count($results) > 0) {
         $result['total'] = count($results);
         $result['results'] = $results;
     } else {
         $result['total'] = 0;
         $result['results'] = array();
     }
     $result = oseJson::encode($result);
     oseExit($result);
 }
示例#14
0
	function getFaith()
	{
		$id = JRequest::getInt('id',0);
		$db= oseDB::instance();
		
		$query = " SELECT * FROM `#__osemsc_email` "
				." WHERE type = 'faith' AND id = {$id} "
				;
		
		$db->setQuery($query);
		
		$term = oseDB::loadItem();
		
		$result = empty($term)?'':$term;
		
		$result = oseJson::encode($result);
		
		oseExit($result);
	}
示例#15
0
 public function getList()
 {
     $db = oseDB::instance();
     $search = JRequest::getString('search', null);
     $search = JString::strtolower($search);
     $start = JRequest::getInt('start', 0);
     $limit = JRequest::getInt('limit', 20);
     $dir = JRequest::getCmd('dir', 'ASC');
     $sortField = JRequest::getCmd('sort', 'domain');
     $msc_id = JRequest::getInt('msc_id');
     $user_id = JRequest::getInt('user_id');
     $where = array();
     $where[] = "`mscID` = '{$msc_id}'";
     $where[] = "`userID` = '{$user_id}'";
     if (!empty($search)) {
         $searchQuery = $db->Quote('%' . $search . '%');
         $where[] = "`domain` LIKE {$searchQuery}";
     }
     $where = oseDB::implodeWhere($where);
     $query = " SELECT COUNT(*) " . " FROM `#__osetickets_domains` " . $where;
     $db->setQuery($query);
     $total = $db->loadResult();
     $query = " SELECT *" . " FROM `#__osetickets_domains` " . $where . " ORDER BY {$sortField} {$dir}";
     if ($start >= 0 && $limit >= 0) {
         $db->setQuery($query, $start, $limit);
     } else {
         $db->setQuery($query);
     }
     $items = oseDB::loadList('obj');
     $list = array();
     foreach ($items as $key => $item) {
         $list[$key] = $item;
     }
     $resul = array();
     $result['total'] = $total;
     $result['results'] = $list;
     oseExit(oseJson::encode($result));
 }
示例#16
0
 function insert($type = 'joomla', $content_type, $content_id, $entry_type = 'msc', $entry_id, $status = 0, $params = array())
 {
     $db = oseDB::instance();
     $sql = array();
     $sql['content_id'] = $content_id;
     $sql['content_type'] = $content_type;
     $sql['type'] = $type;
     $sql['entry_id'] = $entry_id;
     $sql['entry_type'] = $entry_type;
     $sql['status'] = $status;
     if (!empty($params)) {
         $sql['params'] = oseJson::encode($params);
     }
     $keys = array();
     $values = array();
     foreach ($sql as $key => $value) {
         $keys[] = "`{$key}`";
         $values[] = $db->Quote($value);
     }
     $query = " INSERT INTO `#__osemsc_content`" . " (" . implode(',', $keys) . ")" . " VALUES " . " (" . implode(',', $values) . ")";
     $db->setQuery($query);
     return oseDB::query();
 }
示例#17
0
defined('_JEXEC') or die("Direct Access Not Allowed");
$error_msg = "";
oseHTML::script(oseMscMethods::getJsModPath('reg','reg'),'1.5');
echo $this->initJs();
?>
<style type="text/css">
	.combo-left	{
		text-align: left
	}
</style>

<script type="text/javascript">
Ext.onReady(function(){
	var headerObjs = <?php echo oseJson::encode($this->registerOS_header);?>;
	var bodyObjs = <?php echo oseJson::encode($this->registerOS_body);?>;
	var footerObjs = <?php echo oseJson::encode($this->registerOS_footer);?>;

	var oseViewRegfp = oseMsc.reg.buildForm2c.buildForm(Ext.get('osemsc-reg').getWidth());

	oseMsc.reg.fp = new oseMsc.payment.form(oseViewRegfp);


	oseMsc.reg.n = 0;
	oseMsc.reg.fp.onLoadAddons = function(addons,position,getForm)	{
		Ext.each(addons, function(item,i,all)	{
			var sort = oseMsc.reg.n % 2;
			sort = String(sort); // 1-left,0-right
			if(item.addon_name == 'oseMscAddon.msc_cart' || item.addon_name == 'oseMscAddon.coupon')	{
				var posItem = eval("this.fp."+'left');
			}	else	{
				var posItem = eval("this.fp."+'right');
示例#18
0
 function combo($config)
 {
     $config->width = oseObject::getValue($config, 'width', 100);
     $config->editable = oseObject::getValue($config, 'editable', false);
     $config->forceSelection = oseObject::getValue($config, 'forceSelection', true);
     $config->allowBlank = oseObject::getValue($config, 'allowBlank', false);
     $config->typeAhead = true;
     $config->triggerAction = 'all';
     $config->mode = 'local';
     $c = oseJson::encode($config);
     $html = "new Ext.form.ComboBox({$c})";
     return $html;
 }
示例#19
0
 function save()
 {
     $model = $this->getModel('coupons');
     $id = JRequest::getInt('id', 0);
     $post = JRequest::get('post');
     $result = array();
     $result['success'] = true;
     if (empty($id)) {
         $title = $post['title'];
         if (empty($title)) {
             $result['success'] = false;
             $result['title'] = JText::_('ERROR');
             $result['content'] = JText::_('TITLE_CAN_NOT_BE_EMPTY');
         } else {
             $updated = $model->add($title);
             if ($updated) {
                 $result['success'] = true;
                 $result['title'] = JText::_('DONE');
                 $result['content'] = JText::_('ADDED_SUCCESSFULLY');
             } else {
                 $result['success'] = false;
                 $result['title'] = JText::_('ERROR');
                 $result['content'] = JText::_('FAILING_ADDING');
             }
         }
     } else {
         $params = array();
         $params['amount'] = oseObject::getValue($post, 'amount', 0);
         $params['title'] = $post['title'];
         $params['code'] = $post['code'];
         $params['type'] = oseObject::getValue($post, 'type', null);
         $params['amount_infinity'] = oseObject::getValue($post, 'amount_infinity', 0);
         $params['discount'] = oseObject::getValue($post, 'discount', 0);
         $params['discount_type'] = $post['discount_type'];
         $params['params'] = oseJson::encode(array('range' => $post['range'], 'range2' => oseObject::getValue($post, 'range2', 'first'), 'amount_left' => oseObject::getValue($post, 'amount_left', 0), 'msc_ids' => oseObject::getValue($post, 'msc_ids', 'all'), 'currencies' => oseObject::getValue($post, 'currencies', 'all')));
         $updated = $model->update($id, $params);
         if ($updated) {
             $result['success'] = true;
             $result['title'] = JText::_('DONE');
             $result['content'] = JText::_('ADDED_SUCCESSFULLY');
         } else {
             $result['success'] = false;
             $result['title'] = JText::_('ERROR');
             $result['content'] = JText::_('FAILING_ADDING');
         }
     }
     $result = oseJSON::encode($result);
     oseExit($result);
 }
示例#20
0
 function removeAllCurrency()
 {
     $db = oseDB::instance();
     $query = " SELECT * FROM `#__osemsc_configuration`" . " WHERE `key` = 'primary_currency' AND `type` = 'currency'";
     $db->setQuery($query);
     $item = oseDB::loadItem('obj');
     //$currencyInfos = oseJson::decode($item->default,true);
     //unset($currencyInfos[$currency]);
     $currencyInfos = oseJson::encode(null);
     $query = " UPDATE `#__osemsc_configuration`" . " SET `default` = " . $db->Quote($currencyInfos) . " WHERE `id` = '{$item->id}'";
     $db->setQuery($query);
     return oseDB::query();
 }
 function updateOrderParams($orderInfo, $params)
 {
     $orderInfoParams = oseObject::getValue($orderInfo, 'params');
     $orderInfoParams = oseJson::decode($orderInfoParams);
     if (!is_Array($params)) {
         $params = (array) $params;
     }
     foreach ($params as $key => $value) {
         $orderInfoParams = oseObject::setValue($orderInfoParams, $key, $value);
     }
     $orderInfoParams = oseJson::encode($orderInfoParams);
     $orderInfo = oseObject::setValue($orderInfo, 'params', $orderInfoParams);
     return $orderInfo;
 }
示例#22
0
 function getOptions()
 {
     $model = $this->getModel('profile');
     $list = $model->getOptions();
     $result = array();
     $result['total'] = count($list);
     $result['results'] = $list;
     $result = oseJson::encode($result);
     oseExit($result);
 }
示例#23
0
 function insertSubmit($args, $params = array())
 {
     $db = oseDB::instance();
     $sql = $args;
     $sql['id'] = null;
     $sql['entry_id'] = null;
     $sql['entry_type'] = 'credit_submit';
     $sql['status'] = 1;
     if (!empty($params)) {
         $sql['credit'] = $params['credit_amount'];
         $sql['params'] = oseJson::encode($params);
     }
     $keys = array();
     $values = array();
     $inserted_id = oseDB::insert($this->table, $sql);
     $args = array();
     $args['id'] = $inserted_id;
     $args['content_id'] = $inserted_id;
     $item = $this->getItemSubmit($inserted_id);
     $result = $this->updateSubmit($item, $args, $params = array());
     return $result;
 }
示例#24
0
 public static function getOptions()
 {
     $msc_id = JRequest::getInt('msc_id', 0);
     $msc = oseRegistry::call('msc');
     $node = $msc->getInfo($msc_id, 'obj');
     $paymentInfos = $msc->getExtInfo($msc_id, 'payment');
     $cart = oseMscPublic::getCart();
     $osePaymentCurrency = $cart->get('currency');
     $option = oseMscPublic::generatePriceOption($node, $paymentInfos, $osePaymentCurrency);
     $options = array();
     $options = array_merge($options, $option);
     /*
     		$session =& JFactory::getSession();
         	$osePaymentCurrency = $session->get('osePaymentCurrency',oseRegistry::call('msc')->getConfig('currency','obj')->primary_currency);
         	$oseMscPayment = $session->get('oseMscPayment',array('msc_id'=>0,'msc_option'=>0));
     
     		$option = array();
     
     		if(!empty($oseMscPayment['msc_option']))
     		{
     			$paymentInfo = oseObject::getValue($paymentInfos,$oseMscPayment['msc_option']);
     			$node = oseRegistry::call('payment')->getInstance('View')->getPriceStandard($node,$paymentInfo,$osePaymentCurrency);
     			$optionPrice = oseObject::getValue($node,'standard_price').' for every '.oseObject::getValue($node,'standard_recurrence') ;
     
     			if(oseObject::getValue($paymentInfo,'has_trial'))
     			{
     				$node = oseRegistry::call('payment')->getInstance('View')->getPriceTrial($node,$paymentInfo,$osePaymentCurrency);
     				$optionPrice .= ' ('.oseObject::getValue($node,'trial_price').' in first '.oseObject::getValue($node,'trial_recurrence').')';
     			}
     
     			$option[] = array('id'=>oseObject::getValue($paymentInfo,'id'),'text'=>$optionPrice);
     
     		}
     		else
     		{
     			foreach($paymentInfos as  $paymentInfo)
     			{
     				$node = oseRegistry::call('payment')->getInstance('View')->getPriceStandard($node,$paymentInfo,$osePaymentCurrency);
     				$optionPrice = oseObject::getValue($node,'standard_price').' for every '.oseObject::getValue($node,'standard_recurrence') ;
     
     				if(oseObject::getValue($paymentInfo,'has_trial'))
     				{
     					$node = oseRegistry::call('payment')->getInstance('View')->getPriceTrial($node,$paymentInfo,$osePaymentCurrency);
     					$optionPrice .= ' ('.oseObject::getValue($node,'trial_price').' in first '.oseObject::getValue($node,'trial_recurrence').')';
     				}
     
     				$option[] = array('id'=>oseObject::getValue($paymentInfo,'id'),'text'=>$optionPrice);
     			}
     
     		}
     */
     $combo = array();
     $combo['total'] = count($options);
     $combo['results'] = $options;
     $combo = oseJson::encode($combo);
     oseExit($combo);
 }
示例#25
0
 public static function loadViewJs($type = null)
 {
     oseHTML::initScript($type);
     oseHTML::initCss();
     $com = OSECPU_PATH_JS . '/com_ose_cpu/extjs';
     $jVersion = self::getJoomlaVersion();
     if ($jVersion >= '1.6' == true) {
         oseHTML::script($com . '/ose/app.msg.js', '1.6');
         $lang = JRequest::getCmd('ose_lang', 'en');
         if (JFile::exists(OSECPU_F_PATH . DS . 'locale' . DS . "ext-lang-{$lang}.js")) {
             oseHTML::script($com . "/locale/ext-lang-{$lang}.js", '1.6');
         }
         oseHTML::script($com . '/ose/func.js', '1.6');
     } else {
         oseHTML::script($com . '/ose/app.msg.js');
         $lang = JRequest::getCmd('lang', 'en');
         oseHTML::script($com . '/ose/joomla.core.js', '1.5');
         $strings = oseJson::encode(oseText::jsStrings());
         $document = JFactory::getDocument();
         $document->addScriptDeclaration('(function(){var strings=' . $strings . ';Joomla.JText.load(strings)})()');
         oseHTML::script($com . '/ose/func.js', '1.5');
     }
 }
示例#26
0
 function getAddonTypes()
 {
     $model = $this->getModel('addons');
     $items = $model->getAddonTypes();
     $result = array();
     if (count($items) < 1) {
         $result['success'] = true;
         $result['total'] = 0;
         $result['results'] = null;
     } else {
         //$result['success'] = true;
         $result['total'] = count($items);
         $result['results'] = $items;
     }
     $result = oseJson::encode($result);
     oseExit($result);
 }
示例#27
0
	function getMscList_M()
	{
		$cartItems = oseMscPublic::getCartItems();
		///$item = $items[0];

		$db = oseDB::instance();

		$where = array();

		$where[] = "published = 1";

		$msc_option = 0;

		if(!empty($items[0]))
		{
			$msc_id = oseObject::getValue($items[0],'entry_id');

			if(!empty($msc_id))
			{
				$where[] = "id = {$msc_id}";
			}
			$msc_option = oseObject::getValue($items[0],'msc_option');
		}

		$where = oseDB::implodeWhere($where);

		$query = " SELECT * FROM `#__osemsc_acl`"
				. $where
				." ORDER BY lft ASC"
				;

		$db->setQuery($query);

		$objs = oseDB::loadList('obj');

		//$mscExtend = oseRegistry::call('msc')->getConfig('global','obj')->msc_extend;

		$items = array();

		$session =& JFactory::getSession();
    	$osePaymentCurrency = $session->get('osePaymentCurrency',oseRegistry::call('msc')->getConfig('currency','obj')->primary_currency);

		foreach($objs as  $obj)
		{


			if(empty($msc_option))
			{
				$paymentInfos = oseRegistry::call('msc')->getExtInfo($obj->id,'payment','array');
				//oseExit($paymentInfos);
				foreach($paymentInfos as $key => $paymentInfo)
				{
					$fItem = oseRegistry::call('msc')->getPaymentMscInfo($obj->id,$osePaymentCurrency,$key);
					$fItem = oseObject::setValue($fItem,'msc_option',$key);
					$items[] = $fItem;

				}
			}
			else
			{
				$fItem = oseRegistry::call('msc')->getPaymentMscInfo($obj->id,$osePaymentCurrency,$msc_option);
				$fItem = oseObject::setValue($fItem,'msc_option',$msc_option);
				$items[] = $fItem;
			}

		}

		$total = count($items);

		$result = array();

		if($total > 0)
		{
			$result['total'] = $total;
			$result['results'] = $items;
		}
		$result = oseJson::encode($result);

		oseExit($result);
	}
示例#28
0
 public static function preview()
 {
     $result = array();
     $result['success'] = true;
     $result['uploaded'] = false;
     $result['img_path'] = null;
     $uploadImg = JRequest::getVar('directory_directory_logo', null, 'files', 'array');
     $des = JPATH_COMPONENT_SITE . DS . 'assets' . DS . 'tmpl_image' . DS . $uploadImg['name'];
     if (JFile::exists($uploadImg['tmp_name'])) {
         if (!self::checkImage($uploadImg['type'])) {
             $result['success'] = true;
             $result['uploaded'] = false;
             $result['img_path'] = null;
             $result['title'] = JText::_('Error');
             $result['content'] = JText::_('Only .gif,.png,.jpeg is allowed');
             $result = oseJson::encode($result);
             oseExit($result);
         }
         $result['img_path'] = OSEMSC_F_URL . "/assets/tmpl_image/{$uploadImg['name']}";
         //$uploadImg['tmp_name'].'.png';
         if (JFile::upload($uploadImg['tmp_name'], $des)) {
             $result['uploaded'] = true;
         }
         $result = oseJson::encode($result);
         oseExit($result);
     }
     $result = oseJson::encode($result);
     oseExit($result);
 }
示例#29
0
 public function initJs()
 {
     $result1 = $this->generateCountryStateData();
     $result2 = $this->generateMscIdOption();
     $result = array_merge($result1, $result2);
     $config = oseRegistry::call('msc')->getConfig('locale', 'obj');
     $jsonCountry = oseObject::getValue($config, 'default_country_json', false);
     if (!$jsonCountry) {
         $jsonCountry = oseJson::encode(array('code3' => 'USA', 'code2' => 'US'));
     } else {
         $jsonCountry = oseObject::getValue($config, 'default_country_json');
     }
     $js = oseHTML::getInstance('js');
     $js->append('oseMsc.defaultSelectedCountry=Ext.decode(\'' . $jsonCountry . '\');');
     $js->append('oseMsc.mscList = ' . oseJson::encode($result['mscList']) . ';');
     $js->append('oseMsc.mscOptions = ' . oseJson::encode($result['mscOptions']) . ';');
     $js->append('oseMsc.countryData = ' . oseJson::encode($result['country']) . ';');
     $js->append('oseMsc.stateData = ' . oseJson::encode($result['state']) . ';');
     $js->onReady();
     $js->wrap();
     return $js->toString();
 }
示例#30
0
 function create()
 {
     $vals = $this->toArray();
     unset($vals['id']);
     $vals['params'] = oseJson::encode($this->get('params'));
     return oseDB::insert($this->table, $vals);
 }