Exemplo n.º 1
0
 function getMscInfo($msc_id, $osePaymentCurrency, $option = 0)
 {
     $node = oseMscTree::getNode($msc_id);
     $ext = array();
     $node = self::getExtSpecificPayment($node, $msc_id, 'a', $osePaymentCurrency, $option);
     return $node;
 }
Exemplo n.º 2
0
		function fetchElement($name, $value, &$node, $control_name) {
			require_once(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_ose_cpu' . DS . 'define.php');
			require_once(OSECPU_B_PATH . DS . 'oseregistry' . DS . 'oseregistry.php');
			oseRegistry::register('registry', 'oseregistry');
			oseRegistry::call('registry');
			oseRegistry::register('msc', 'membership');
			oseRegistry::call('msc', 'membership');
			$objs = oseMscTree::getSubTreeDepth(0, 0, 'obj');
			$option = array();
			$option[] = '<option value ="">N/A</option>';
			foreach ($objs as $obj) {
				@$option[] = JHTML::_('select.option', $obj->id, $obj->title);
			}
			$return = JHTML::_('select.genericlist', $option, '' . $control_name . '[' . $name . '][]', ' class="inputbox" style="width:90%;" multiple="multiple" size="15"','value', 'text', $value);
			return $return;
		}
Exemplo n.º 3
0
	protected function getInput() {
		require_once(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_ose_cpu' . DS . 'define.php');
		require_once(OSECPU_B_PATH . DS . 'oseregistry' . DS . 'oseregistry.php');
		oseRegistry::register('registry', 'oseregistry');
		oseRegistry::call('registry');
		oseRegistry::register('msc', 'membership');
		oseRegistry::call('msc', 'membership');
		$objs = oseMscTree::getSubTreeDepth(0, 0, 'obj');
		$option = array();
		foreach ($objs as $obj) {
			if ($obj->published) {
				@$option[] = JHTML::_('select.option', $obj->id, $obj->title);
			}
		}
		$name = "{$this->name}[]";
		return JHTML::_('select.genericlist', $option, $name, ' class="inputbox" style="width:90%;" multiple="multiple" size="15"', 'value', 'text', $this->value);
	}
Exemplo n.º 4
0
	   protected function getInput()
	   {
	   	    $name = 'msc_ids';
	   	    $control_name = "jform[params][msc_ids][]";

			require_once( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_ose_cpu'.DS.'define.php');
			require_once( OSECPU_B_PATH.DS.'oseregistry'.DS.'oseregistry.php');

			oseRegistry::register('registry','oseregistry');
			oseRegistry::call('registry');
			//oseExit($value);
			oseRegistry::register('msc','membership');
			oseRegistry::call('msc','membership');
			$objs = oseMscTree::getSubTreeDepth(0,0,'obj');

			$option = array();
			$return = '<select class="inputbox" style="width:90%;" multiple="multiple" size="15" name = "'.$control_name.'">';
			if (!is_array($this->value))
			{
				$this->value = array($this->value);
			}
			foreach ( $objs as $obj )
			{
				if($obj->published)
				{

					if (in_array($obj->id, $this->value))
					{
						$selected = "selected";
					}
					else
					{
						$selected = "";
					}
					$return .= "<option value ='$obj->id' $selected>".$obj->title ."</option>";
				}
			}
			$return .="</select>";
			return $return;
		}
Exemplo n.º 5
0
    function get_gcoform($orderInfo)
    {
        $parameters =& JComponentHelper::getParams('com_osemsc');
        $google_checkout_id = $parameters->get('google_checkout_id');
        $html = array();
        if (empty($google_checkout_id)) {
            $html['form'] = "";
            return $html;
        }
        /*
        $db = &JFactory::getDBO();
        require_once (JPATH_ADMINISTRATOR . DS . "components" . DS . "com_osemsc" . DS . "warehouse" . DS . "public.php");
        $query = "SELECT name FROM `#__osemsc_acl` WHERE id = '{$msc_id}'";
        $db->setQuery($query);
        $msc_name = $db->loadResult();
        $query = "SELECT * FROM `#__osemsc_ext` WHERE id = '{$msc_id}' AND type='msc'";
        $db->setQuery($query);
        $msc_data = $db->loadObject();
        $msc_data = publicTools::parseParams($msc_data);
        */
        $msc_id = $orderInfo->entry_id;
        $node = oseMscTree::getNode($msc_id, 'obj');
        $msc_name = $node->title;
        $payment = oseMscAddon::getExtInfo($msc_id, 'payment', 'obj');
        $price = $orderInfo->payment_price;
        $currency = $orderInfo->payment_currency;
        $order_id = $orderInfo->order_id;
        $order_number = $orderInfo->order_number;
        //$renewal_discounts = $msc_data->renewal_discounts;
        //$promotion_code = $msc_data->promotion_code;
        //$promotion_discounts = $msc_data->promotion_discounts;
        //if ($user_promotion_code == $promotion_code)
        //{
        //	$amount = $amount * (1-$promotion_discounts/100);
        //}
        // Check if the user is a member of the membership
        //require_once(JPATH_ADMINISTRATOR.DS."components".DS."com_osemsc".DS."warehouse".DS."api.php");
        //$api=new OSEMSCAPI();
        ////if ($api->is_member($msc_id, $user_id)==true)
        //{
        //	if (!empty($renewal_discounts))
        //	{
        //		$amount = $amount * (1-$renewal_discounts/100);
        //		$a1= $a1 * (1-$renewal_discounts/100);
        //	}
        //}
        // Renewal discounts ends
        $vendor_image_url = "";
        $app =& JFactory::getApplication();
        $currentSession = JSession::getInstance('none', array());
        $stores = $currentSession->getStores();
        if ($currency == "GBP") {
            $country_code = "UK";
        } elseif ($currency == "USD") {
            $country_code = "US";
        }
        $url = "https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/" . $google_checkout_id;
        $post_variables = array("item_name_1" => JText::_('Order ID: ') . $order_id, "item_description_1" => JText::_('Payment for Membership Type: ') . $msc_name . "||" . $order_number, "item_merchant_id_1" => $order_id, "item_quantity_1" => "1", "item_price_1" => $price, "item_currency_1" => $currency, "continue_url" => JURI::base() . "index.php?option=com_osemsc&view=member&result=success");
        $html['form'] = '<form action="' . $url . '" method="post" target="_self" id="google" name="google"><input type="hidden" name="phpMyAdmin" value="octl53wDFSC-rSEy-S6gRa-jWtb" />';
        $html['form'] .= '<input id="gco-image" type="image" name="Google Checkout" alt="Fast checkout through Google"
				src="components/com_osemsc/assets/images/checkout.png?merchant_id=' . $google_checkout_id . '&style=white&variant=text&loc=en_US"/>';
        foreach ($post_variables as $name => $value) {
            $html['form'] .= '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value) . '" />';
        }
        $html['form'] .= '</form>';
        return $html;
    }
Exemplo n.º 6
0
 function getItems()
 {
     $items = oseMscTree::getTreeByParentId();
     return $items;
 }
Exemplo n.º 7
0
 function drawTree($msc_id)
 {
     $html = array();
     $tree = oseMscTree::getSubTreeDepth($msc_id, 0, 'obj');
     foreach ($tree as $nKey => $node) {
         if ($node->leaf) {
             $leaf = $this->drawSubLeaf($node);
             $html[] = $this->drawSub($leaf);
         } else {
             $subTitle = $this->drawSubTitle('|__' . oseObject::getValue($node, 'title'));
             $iterate = $this->drawTree(oseObject::getValue($node, 'id'));
             $iterate = implode("\r\n", $iterate);
             $html[] = $this->drawSub($subTitle . "\r\n" . $iterate);
         }
     }
     return $html;
 }
Exemplo n.º 8
0
	private function drawMscListCart($msc_id, $osePaymentCurrency) {
		$buildList = oseRegistry::call('payment')->getInstance('MscList');
		$buildList->set('currency', $osePaymentCurrency);
		$tree = oseMscTree::retrieveTree($msc_id, 'obj');
		$first = $tree[0];
		unset($tree[0]);
		if (count($tree) > 0) {
			$firstNode = $buildList->drawParent($first);
			$firstNode = $buildList->drawFirst($firstNode);
			$subTree = $buildList->drawTree($first->id);
			$subTree = $buildList->drawSecond($subTree);
			$row = $this->drawRow(array($firstNode, $subTree));
		} else {
			$firstNode = $buildList->drawLeaf($first);
			$msc = oseRegistry::call('msc');
			$paymentInfos = $msc->getExtInfo($msc_id, 'payment');
			$options = oseMscPublic::generatePriceOption($first, $paymentInfos, $osePaymentCurrency);
			if (!empty($options)) {
				$option = array();
				foreach ($options as $obj) {
					$oAttr = array();
					$oAttr['option.value'] = 'value';
					$oAttr['option.attr'] = 'attr';
					$attrStr = 'title="%s" trial_price="%s" trial_recurrence="%s" standard_price="%s" standard_recurrence="%s" has_trial="%s"';
					$oAttr['attr'] = sprintf($attrStr, $obj['title'], oseObject::getValue($obj, 'trial_price', 0), oseObject::getValue($obj, 'trial_recurrence', 0),
							$obj['standard_price'], $obj['standard_recurrence'], oseObject::getValue($obj, 'has_trial', 0));
					$o = oseHTML::getInstance('Select')->option(oseObject::getValue($obj, 'id'), oseObject::getValue($obj, 'title'), $oAttr);
					$option[] = $o;
				}
				$basic = $options[0];
				$listAttr = array();
				$listAttr['list.attr'] = ' class="msc_options"  size="1" style="width:200px"';
				$listAttr['list.translate'] = false;
				$listAttr['option.key'] = 'value';
				$listAttr['id'] = 'msc_option_' . oseObject::getValue($first, 'id');
				$listAttr['option.text'] = 'text';
				$listAttr['list.select'] = oseObject::getValue($obj, 'id');
				$listAttr['option.attr'] = 'attr';
				$combo = oseHTML::getInstance('Select')->genericlist($option, 'msc_option', $listAttr);
				$firstNode['price'] = "<div class='msc-price-box'><span>" . JText::_('Options') . ":</span>" . $buildList->drawPrice($combo . '<div></div>') . '</div>';
			}
			$hackback = JText::_('Subscribe');
			$needle = JText::_('Add');
			if (isset($firstNode['button'])) {
				$firstNode['button'] = preg_replace("/{$hackback}/", $needle, $firstNode['button'], 1);
			}
			$firstNode = $buildList->drawFirst($firstNode);
			$row = $buildList->drawRow($firstNode);
		}
		$image = $buildList->getImage($first);
		$image = $buildList->drawImage($image);
		return $buildList->drawCard(array($image, $row));
	}
Exemplo n.º 9
0
 function getParentChildren($msc_id)
 {
     $node = oseMscTree::getNode($msc_id, 'obj');
     $db = oseDB::instance();
     oseDB::lock(' #__osemsc_acl READ;');
     $query = " SELECT *,CONCAT('(',ordering,')',title) AS displayText FROM `#__osemsc_acl`" . " WHERE parent_id = {$node->parent_id} ";
     $db->setQuery($query);
     //oseExit($db->_sql);
     $objs = oseDB::loadList();
     oseDB::unlock();
     return $objs;
 }
Exemplo n.º 10
0
 function generateDesc($order_id)
 {
     $where = array(' order_id = ' . (int) $order_id);
     $orderItems = $this->getOrderItem($where, 'obj');
     $node = oseMscTree::getNode($orderItems->entry_id, 'obj');
     return JText::_('PAYMENT_FOR_ORDER') . $node->title . ' ' . JText::_('ORDER_ID') . ' ' . $order_id;
 }