Public Member Functions | Data Fields

ilPaymentPurchaseGUI Class Reference

Inheritance diagram for ilPaymentPurchaseGUI:
Collaboration diagram for ilPaymentPurchaseGUI:

Public Member Functions

 ilPaymentPurchaseGUI ($a_ref_id)
executeCommand ()
 execute command
 showDetails ()
 addToShoppingCart ()
 __initShoppingCartObject ()
 __initPaymentObject ()
 __initPricesObject ()
 __buildHeader ()
 __buildStatusline ()
 __buildLocator ()
 __buildStylesheet ()
 ilPaymentAdminGUI (&$user_obj)
executeCommand ()
 execute command

Data Fields

 $ctrl
 $ilias
 $lng
 $tpl
 $object = null
 $user_obj

Detailed Description

Definition at line 37 of file class.ilPaymentPurchaseGUI.php.


Member Function Documentation

ilPaymentPurchaseGUI::__buildHeader (  ) 

Definition at line 312 of file class.ilPaymentPurchaseGUI.php.

Referenced by executeCommand().

        {
                $this->tpl->addBlockFile("CONTENT", "content", "tpl.payb_content.html");
                
                $this->tpl->setVariable("HEADER",$this->object->getTitle());
                $this->tpl->setVariable("DESCRIPTION",$this->object->getDescription());

#               $this->__buildStylesheet();
#               $this->__buildStatusline();
        }

Here is the caller graph for this function:

ilPaymentPurchaseGUI::__buildLocator (  ) 

Definition at line 329 of file class.ilPaymentPurchaseGUI.php.

References sendInfo().

Referenced by __buildStatusline().

        {
                $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html");
                $this->tpl->setVariable("TXT_LOCATOR",$this->lng->txt("locator"));

                $this->tpl->setCurrentBlock("locator_item");
                $this->tpl->setVariable("ITEM", $this->lng->txt("repository"));
                $this->tpl->setVariable("LINK_ITEM", "../repository.php?getlast=true");
                $this->tpl->parseCurrentBlock();

                // CHECK for new mail and info
                sendInfo();

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilPaymentPurchaseGUI::__buildStatusline (  ) 

Definition at line 323 of file class.ilPaymentPurchaseGUI.php.

References __buildLocator().

        {
                $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
                $this->__buildLocator();
        }       

Here is the call graph for this function:

ilPaymentPurchaseGUI::__buildStylesheet (  ) 

Definition at line 345 of file class.ilPaymentPurchaseGUI.php.

References ilUtil::getJSPath(), and ilUtil::getStyleSheetLocation().

        {
                $this->tpl->setVariable("LOCATION_STYLESHEET",ilUtil::getStyleSheetLocation());
                $this->tpl->setVariable("LOCATION_JAVASCRIPT",ilUtil::getJSPath('functions.js'));
        }

Here is the call graph for this function:

ilPaymentPurchaseGUI::__initPaymentObject (  ) 

Definition at line 295 of file class.ilPaymentPurchaseGUI.php.

References ilPaymentObject::_lookupPobjectId().

Referenced by addToShoppingCart(), and showDetails().

        {
                include_once './payment/classes/class.ilPaymentObject.php';

                $this->pobject =& new ilPaymentObject($this->ilias->account,ilPaymentObject::_lookupPobjectId($this->ref_id));

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilPaymentPurchaseGUI::__initPricesObject (  ) 

Definition at line 303 of file class.ilPaymentPurchaseGUI.php.

Referenced by showDetails().

        {
                include_once './payment/classes/class.ilPaymentPrices.php';
                
                $this->price_obj =& new ilPaymentPrices($this->pobject->getPobjectId());

                return true;
        }

Here is the caller graph for this function:

ilPaymentPurchaseGUI::__initShoppingCartObject (  ) 

Definition at line 286 of file class.ilPaymentPurchaseGUI.php.

Referenced by addToShoppingCart(), and showDetails().

        {
                include_once './payment/classes/class.ilPaymentShoppingCart.php';

                $this->sc_obj =& new ilPaymentShoppingCart($this->ilias->account);

                return true;
        }

Here is the caller graph for this function:

ilPaymentPurchaseGUI::addToShoppingCart (  ) 

Definition at line 240 of file class.ilPaymentPurchaseGUI.php.

References $_POST, __initPaymentObject(), __initShoppingCartObject(), sendInfo(), and showDetails().

        {
                if(!isset($_POST['price_id']))
                {
                        sendInfo($this->lng->txt('pay_select_price'));
                        $this->showDetails();

                        return true;
                }
                else
                {
                        $this->__initPaymentObject();
                        $this->__initShoppingCartObject();
                        

                        $this->sc_obj->setPriceId((int) $_POST['price_id']);
                        $this->sc_obj->setPobjectId($this->pobject->getPobjectId());
                        $this->sc_obj->add();

#                       $tmp_obj =& ilObjectFactory::getInstanceByRefId($this->pobject->getRefId());

                        $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.pay_purchase_details.html','payment');
                        $this->tpl->setCurrentBlock("shopping_cart");
#                       $this->tpl->setVariable("LINK_GOTO_SHOPPING_CART", "payment/payment.php");
                        $this->tpl->setVariable("LINK_GOTO_SHOPPING_CART", "ilias.php?cmdClass=ilpaymentgui&baseClass=ilPersonalDesktopGUI&cmd=showShoppingCart");
/*                      switch($this->pobject->getPayMethod())
                        {
                                case $this->pobject->PAY_METHOD_BMF:
                                        $this->tpl->setVariable("LINK_BUY", "payment/start_bmf.php");
                                        break;

                                case $this->pobject->PAY_METHOD_PAYPAL:
                                        $this->tpl->setVariable("LINK_BUY", "payment/start_paypal.php");
                                        break;
                        }*/
                        $this->tpl->setVariable("TXT_GOTO_SHOPPING_CART", $this->lng->txt('pay_goto_shopping_cart'));
#                       $this->tpl->setVariable("TXT_BUY", $this->lng->txt('pay_click_to_buy'));
                        $this->tpl->parseCurrentBlock("shopping_cart");

                        sendInfo($this->lng->txt('pay_added_to_shopping_cart'));

                        return true;
                }
        }

Here is the call graph for this function:

& ilPaymentPurchaseGUI::executeCommand (  ) 

execute command

Reimplemented from ilObjectGUI.

Definition at line 69 of file class.ilPaymentPurchaseGUI.php.

References $cmd, and __buildHeader().

        {
                $cmd = $this->ctrl->getCmd();

                if (!$cmd = $this->ctrl->getCmd())
                {
                        $cmd = "showDetails";
                }
                
                // build header if called from start_purchase.php
#               if($this->ctrl->getTargetScript() == 'start_purchase.php')
#               {
                        $this->__buildHeader();
#               }
                $this->$cmd();
        }

Here is the call graph for this function:

& ilPaymentPurchaseGUI::executeCommand (  ) 

execute command

Reimplemented from ilObjectGUI.

Definition at line 51 of file class.ilPurchaseGUI.php.

References $cmd, and ilObjectGUI::$tree.

        {
                global $tree;

                $cmd = $this->ctrl->getCmd();
                switch ($this->ctrl->getNextClass($this))
                {

                        default:
                                if(!$cmd = $this->ctrl->getCmd())
                                {
                                        $cmd = 'showBillData';
                                }
                                $this->$cmd();
                                break;
                }
        }

ilPaymentPurchaseGUI::ilPaymentAdminGUI ( &$  user_obj  ) 

Definition at line 39 of file class.ilPurchaseGUI.php.

References $ilCtrl, and $user_obj.

        {
                global $ilCtrl;

                $this->ctrl =& $ilCtrl;
                
                // Get user object
                $this->user_obj =& $user_obj;
        }

ilPaymentPurchaseGUI::ilPaymentPurchaseGUI ( a_ref_id  ) 

Definition at line 46 of file class.ilPaymentPurchaseGUI.php.

References $ilCtrl, $ilErr, $ilias, $lng, $tpl, ilObjectGUI::$tree, and ilObjectFactory::getInstanceByRefId().

        {
                global $ilCtrl,$lng,$ilErr,$ilias,$tpl,$tree;

                $this->ctrl =& $ilCtrl;
                $this->ctrl->saveParameter($this,array("ref_id"));

                $this->ilErr =& $ilErr;
                $this->ilias =& $ilias;

                $this->lng =& $lng;
                $this->lng->loadLanguageModule('payment');

                $this->tpl =& $tpl;

                $this->ref_id = $a_ref_id;

                $this->object =& ilObjectFactory::getInstanceByRefId($this->ref_id);
        }

Here is the call graph for this function:

ilPaymentPurchaseGUI::showDetails (  ) 

Definition at line 86 of file class.ilPaymentPurchaseGUI.php.

References $counter, __initPaymentObject(), __initPricesObject(), __initShoppingCartObject(), ilPaymentPrices::_getPriceString(), ilUtil::formRadioButton(), ilUtil::getImagePath(), and sendInfo().

Referenced by addToShoppingCart().

        {
                $this->__initPaymentObject();
                $this->__initPricesObject();
                $this->__initShoppingCartObject();

                $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.pay_purchase_details.html','payment');

                if($this->pobject->getStatus() == $this->pobject->STATUS_EXPIRES)
                {
                        sendInfo($this->lng->txt('pay_expires_info'));

                        return false;
                }

                $prices = $this->price_obj->getPrices();
                $buyedObject = "";
                if($this->sc_obj->isInShoppingCart($this->pobject->getPobjectId()))
                {
                        $buyedObject = $this->sc_obj->getEntry($this->pobject->getPobjectId());
                        if (is_array($prices) &&
                                count($prices) > 1)
                        {
                                sendInfo($this->lng->txt('pay_item_already_in_sc_choose_another'));
                        }
                        else
                        {
                                sendInfo($this->lng->txt('pay_item_already_in_sc'));
                        }

                        $this->tpl->setCurrentBlock("shopping_cart");
#                       $this->tpl->setVariable("LINK_GOTO_SHOPPING_CART", "payment/payment.php");
                        $this->tpl->setVariable("LINK_GOTO_SHOPPING_CART", "ilias.php?cmdClass=ilpaymentgui&baseClass=ilPersonalDesktopGUI&cmd=showShoppingCart");
/*                      switch($this->pobject->getPayMethod())
                        {
                                case $this->pobject->PAY_METHOD_BMF:
                                        $this->tpl->setVariable("LINK_BUY", "payment/start_bmf.php");
                                        break;

                                case $this->pobject->PAY_METHOD_PAYPAL:
                                        $this->tpl->setVariable("LINK_BUY", "payment/start_paypal.php");
                                        break;
                        }*/
                        $this->tpl->setVariable("TXT_GOTO_SHOPPING_CART", $this->lng->txt('pay_goto_shopping_cart'));
#                       $this->tpl->setVariable("TXT_BUY", $this->lng->txt('pay_click_to_buy'));
                        $this->tpl->parseCurrentBlock("shopping_cart");
                }

                $this->ctrl->setParameter($this, "ref_id", $this->pobject->getRefId());

#               if (!is_array($buyedObject) ||
#                       (is_array($buyedObject) && is_array($prices) && count($prices) > 1))
#               {
                        $this->tpl->setVariable("DETAILS_FORMACTION",$this->ctrl->getFormAction($this));
                        $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_'.$this->object->getType().'_b.gif'));
                        $this->tpl->setVariable("ALT_IMG",$this->lng->txt('obj_'.$this->object->getType()));
                        $this->tpl->setVariable("TITLE",$this->object->getTitle());

                        // payment infos
                        $this->tpl->setVariable("TXT_INFO",$this->lng->txt('info'));
                        switch($this->pobject->getPayMethod())
                        {
                                case $this->pobject->PAY_METHOD_BILL:
                                        $this->tpl->setVariable("INFO_PAY",$this->lng->txt('pay_bill'));
                                        $this->tpl->setVariable("INPUT_CMD",'getBill');
                                        $this->tpl->setVariable("INPUT_VALUE",$this->lng->txt('pay_get_bill'));
                                        break;

                                case $this->pobject->PAY_METHOD_BMF:
                                        $this->tpl->setVariable("INFO_PAY",$this->lng->txt('pay_info'));
                                        if (is_array($buyedObject))
                                        {
                                                if (is_array($prices) && count($prices) > 1)
                                                {
                                                        $this->tpl->setVariable("INPUT_CMD",'addToShoppingCart');
                                                        $this->tpl->setVariable("INPUT_VALUE",$this->lng->txt('pay_change_price'));
                                                }
                                        }
                                        else
                                        {
                                                $this->tpl->setVariable("INPUT_CMD",'addToShoppingCart');
                                                $this->tpl->setVariable("INPUT_VALUE",$this->lng->txt('pay_add_to_shopping_cart'));
                                        }
                                        break;

                                case $this->pobject->PAY_METHOD_PAYPAL:
                                        $this->tpl->setVariable("INFO_PAY",$this->lng->txt('pay_info'));
                                        if (is_array($buyedObject))
                                        {
                                                if (is_array($prices) && count($prices) > 1)
                                                {
                                                        $this->tpl->setVariable("INPUT_CMD",'addToShoppingCart');
                                                        $this->tpl->setVariable("INPUT_VALUE",$this->lng->txt('pay_change_price'));
                                                }
                                        }
                                        else
                                        {
                                                $this->tpl->setVariable("INPUT_CMD",'addToShoppingCart');
                                                $this->tpl->setVariable("INPUT_VALUE",$this->lng->txt('pay_add_to_shopping_cart'));
                                        }
                                        break;
                        }

                        $this->tpl->setVariable("ROWSPAN",count($prices));
                        $this->tpl->setVariable("TXT_PRICES",$this->lng->txt('prices'));
#               }

                if (is_array($prices))
                {
#                       if (count($prices) > 1)
#                       {
                                $counter = 0;
                                foreach($prices as $price)
                                {
                                        if ($counter == 0)
                                        {
                                                $placeholderCheckbox = "CHECKBOX";
                                                $placeholderDuration = "DURATION";
                                                $placeholderPrice = "PRICE";
                                        }
                                        else
                                        {
                                                $placeholderCheckbox = "ROW_CHECKBOX";
                                                $placeholderDuration = "ROW_DURATION";
                                                $placeholderPrice = "ROW_PRICE";
                                        }
                                        $this->tpl->setCurrentBlock("price_row");
                                        if ($buyedObject["price_id"] == $price['price_id'])
                                        {
                                                $this->tpl->setVariable($placeholderCheckbox,ilUtil::formRadioButton(1,'price_id',$price['price_id']));
                                        }
                                        else
                                        {
                                                $this->tpl->setVariable($placeholderCheckbox,ilUtil::formRadioButton(0,'price_id',$price['price_id']));
                                        }
                                        $this->tpl->setVariable($placeholderDuration,$price['duration'].' '.$this->lng->txt('paya_months'));
                                        $this->tpl->setVariable($placeholderPrice,ilPaymentPrices::_getPriceString($price['price_id']));
                                        $this->tpl->parseCurrentBlock();
                                        $counter++;
                                }
#                       }
#                       else if (!is_array($buyedObject))
#                       {
#                               foreach($prices as $price)
#                               {
#                                       $this->tpl->setVariable("CHECKBOX",ilUtil::formRadioButton(0,'price_id',$price['price_id']));
#                                       $this->tpl->setVariable("DURATION",$price['duration'].' '.$this->lng->txt('paya_months'));
#                                       $this->tpl->setVariable("PRICE",ilPaymentPrices::_getPriceString($price['price_id']));
#                               }
#                       }
                }

        }

Here is the call graph for this function:

Here is the caller graph for this function:


Field Documentation

ilPaymentPurchaseGUI::$ctrl

Definition at line 39 of file class.ilPaymentPurchaseGUI.php.

ilPaymentPurchaseGUI::$ilias

Reimplemented from ilObjectGUI.

Definition at line 40 of file class.ilPaymentPurchaseGUI.php.

Referenced by ilPaymentPurchaseGUI().

ilPaymentPurchaseGUI::$lng

Reimplemented from ilObjectGUI.

Definition at line 41 of file class.ilPaymentPurchaseGUI.php.

Referenced by ilPaymentPurchaseGUI().

ilPaymentPurchaseGUI::$object = null

Reimplemented from ilObjectGUI.

Definition at line 44 of file class.ilPaymentPurchaseGUI.php.

ilPaymentPurchaseGUI::$tpl

Reimplemented from ilObjectGUI.

Definition at line 42 of file class.ilPaymentPurchaseGUI.php.

Referenced by ilPaymentPurchaseGUI().

ilPaymentPurchaseGUI::$user_obj

Definition at line 37 of file class.ilPurchaseGUI.php.

Referenced by ilPaymentAdminGUI().


The documentation for this class was generated from the following files: