Public Member Functions | Data Fields

ilPaymentShoppingCartGUI Class Reference

Inheritance diagram for ilPaymentShoppingCartGUI:
Collaboration diagram for ilPaymentShoppingCartGUI:

Public Member Functions

 ilPaymentShoppingCartGUI (&$user_obj)
executeCommand ()
 execute command
 showItems ()
 __showItemsTable ($a_result_set)
 deleteItem ()
 __initShoppingCartObject ()

Data Fields

 $ctrl
 $lng
 $user_obj
 $psc_obj = null

Detailed Description

Definition at line 35 of file class.ilPaymentShoppingCartGUI.php.


Member Function Documentation

ilPaymentShoppingCartGUI::__initShoppingCartObject (  ) 

Definition at line 251 of file class.ilPaymentShoppingCartGUI.php.

Referenced by deleteItem(), and showItems().

        {
                $this->psc_obj =& new ilPaymentShoppingCart($this->user_obj);
        }

Here is the caller graph for this function:

ilPaymentShoppingCartGUI::__showItemsTable ( a_result_set  ) 

Definition at line 145 of file class.ilPaymentShoppingCartGUI.php.

References $_GET, $tbl, ilPaymentBaseGUI::$tpl, ilUtil::getImagePath(), and ilPaymentBaseGUI::initTableGUI().

Referenced by showItems().

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

                $genSet = new ilGeneralSettings();

                $tbl =& $this->initTableGUI();
                $tpl =& $tbl->getTemplateObject();

                // SET FORMAACTION
                $tpl->setCurrentBlock("tbl_form_header");

                $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
                $tpl->parseCurrentBlock();

                $tpl->setCurrentBlock("tbl_action_row");
                $tpl->setCurrentBlock("plain_buttons");
                $tpl->parseCurrentBlock();

                $tpl->setVariable("COLUMN_COUNTS",4);
                $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));

                $tpl->setCurrentBlock("tbl_action_button");
                $tpl->setVariable("BTN_NAME","deleteItem");
                $tpl->setVariable("BTN_VALUE",$this->lng->txt("delete"));
                $tpl->parseCurrentBlock();
                $tpl->setCurrentBlock("tbl_action_row");
                $tpl->setVariable("TPLPATH",$this->tpl->tplPath);
                $tpl->parseCurrentBlock();

                $tbl->setTitle($this->lng->txt("paya_shopping_cart"),"icon_pays_b.gif",$this->lng->txt("paya_shopping_cart"));
                $tbl->setHeaderNames(array($this->lng->txt(""),
                                                                   $this->lng->txt("title"),
                                                                   $this->lng->txt("duration"),
                                                                   $this->lng->txt("price_a")));

                $tbl->setHeaderVars(array("",
                                                                  "title",
                                                                  "duration",
                                                                  "price"),
                                                        array("cmd" => "",
                                                                  "cmdClass" => "ilpaymentshoppingcartgui",
                                                                  "cmdNode" => $_GET["cmdNode"]));

                $offset = $_GET["offset"];
                $order = $_GET["sort_by"];
                $direction = $_GET["sort_order"] ? $_GET['sort_order'] : 'desc';

                $tbl->setOrderColumn($order,'title');
                $tbl->setOrderDirection($direction);
                $tbl->setOffset($offset);
                $tbl->setLimit($_GET["limit"]);
                $tbl->setMaxCount(count($a_result_set));
                $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
                $tbl->setData($a_result_set);

                // show total amount of costs
                $sc_obj =& new ilPaymentShoppingCart($this->user_obj);

                $totalAmount =  $sc_obj->getTotalAmount();
                $vat = $sc_obj->getVat($totalAmount);

                $tpl->setCurrentBlock("tbl_footer_linkbar");
                $amount = "<b>" . $this->lng->txt("pay_bmf_total_amount") . ": " . number_format($totalAmount, 2, ',', '.') . " " . $genSet->get("currency_unit") . "</b>";
                if ($vat > 0)
                {
                        $amount .= "<br>\n" . $genSet->get("vat_rate") . "% " . $this->lng->txt("pay_bmf_vat_included") . ": " . number_format($vat, 2, ',', '.') . " " . $genSet->get("currency_unit");
                }

                $tpl->setVariable("LINKBAR", $amount);
                $tpl->parseCurrentBlock("tbl_footer_linkbar");
                $tpl->setCurrentBlock('tbl_footer');
                $tpl->setVariable('COLUMN_COUNT',4);
                $tpl->parseCurrentBlock();



                $tbl->render();

                $this->tpl->setVariable("ITEMS_TABLE",$tbl->tpl->get());

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilPaymentShoppingCartGUI::deleteItem (  ) 

Definition at line 229 of file class.ilPaymentShoppingCartGUI.php.

References $_POST, $id, __initShoppingCartObject(), sendInfo(), and showItems().

        {
                if(!count($_POST['item']))
                {
                        sendInfo($this->lng->txt('pay_select_one_item'));

                        $this->showItems();
                        return true;
                }
                $this->__initShoppingCartObject();

                foreach($_POST['item'] as $id)
                {
                        $this->psc_obj->delete($id);
                }
                sendInfo($this->lng->txt('pay_deleted_items'));
                $this->showItems();

                return true;
        }

Here is the call graph for this function:

& ilPaymentShoppingCartGUI::executeCommand (  ) 

execute command

Definition at line 61 of file class.ilPaymentShoppingCartGUI.php.

References $cmd, and $tree.

        {
                global $tree;

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

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

ilPaymentShoppingCartGUI::ilPaymentShoppingCartGUI ( &$  user_obj  ) 

Definition at line 47 of file class.ilPaymentShoppingCartGUI.php.

References $ilCtrl, $user_obj, and ilPaymentBaseGUI::ilPaymentBaseGUI().

        {
                global $ilCtrl;

                $this->ctrl =& $ilCtrl;

                $this->ilPaymentBaseGUI();

                $this->user_obj =& $user_obj;

        }

Here is the call graph for this function:

ilPaymentShoppingCartGUI::showItems (  ) 

Definition at line 79 of file class.ilPaymentShoppingCartGUI.php.

References $counter, __initShoppingCartObject(), __showItemsTable(), ilPaymentPrices::_countPrices(), ilPaymentPrices::_getPrice(), ilPaymentPrices::_getPriceString(), ilObjectFactory::getInstanceByRefId(), and sendInfo().

Referenced by deleteItem().

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

                $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.pay_shopping_cart.html',true);

                $this->__initShoppingCartObject();
                if(!count($items = $this->psc_obj->getEntries()))
                {
                        sendInfo($this->lng->txt('pay_shopping_cart_empty'));

                        return false;
                }
                else
                {
                        $this->tpl->setCurrentBlock("buy_link");
                        $this->tpl->setVariable("LINK_SCRIPT", './start_bmf.php');
                        $this->tpl->setVariable("TXT_BUY", $this->lng->txt('pay_click_to_buy'));
                        $this->tpl->parseCurrentBlock("buy_link");
                }

                

                $counter = 0;
                foreach($items as $item)
                {
                        $tmp_pobject =& new ilPaymentObject($this->user_obj,$item['pobject_id']);

                        $tmp_obj =& ilObjectFactory::getInstanceByRefId($tmp_pobject->getRefId());

                        $price_arr = ilPaymentPrices::_getPrice($item['price_id']);

                        $f_result[$counter][] = ilUtil::formCheckBox(0,'item[]',$item['psc_id']);
                        $numPrices = ilPaymentPrices::_countPrices($item['pobject_id']);
                        if ($numPrices > 1)
                        {
                                if ($tmp_obj->getType() == "crs")
                                {
                                        $f_result[$counter][] = "<a href=\"" . ILIAS_HTTP_PATH . "/repository.php?ref_id=" . $tmp_pobject->getRefId() . "&cmdClass=ilobjcoursegui&cmdNode=4\">" . $tmp_obj->getTitle() . "</a>";
                                }
                                else if ($tmp_obj->getType() == "lm")
                                {
                                        $f_result[$counter][] = "<a href=\"" . ILIAS_HTTP_PATH . "/content/lm_presentation.php?ref_id=" . $tmp_pobject->getRefId() . "\">" . $tmp_obj->getTitle() . "</a>";
                                }
                                else
                                {
                                        $f_result[$counter][] = $tmp_obj->getTitle();
                                }
                        }
                        else
                        {
                                $f_result[$counter][] = $tmp_obj->getTitle();
                        }
                        $f_result[$counter][] = $price_arr['duration'].' '.$this->lng->txt('paya_months');

                        $f_result[$counter][] = ilPaymentPrices::_getPriceString($item['price_id']);

                        unset($tmp_obj);
                        unset($tmp_pobject);
                        
                        ++$counter;
                }
                        
                return $this->__showItemsTable($f_result);
        }

Here is the call graph for this function:

Here is the caller graph for this function:


Field Documentation

ilPaymentShoppingCartGUI::$ctrl

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

ilPaymentShoppingCartGUI::$lng

Reimplemented from ilPaymentBaseGUI.

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

ilPaymentShoppingCartGUI::$psc_obj = null

Definition at line 45 of file class.ilPaymentShoppingCartGUI.php.

ilPaymentShoppingCartGUI::$user_obj

Reimplemented from ilPaymentBaseGUI.

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

Referenced by ilPaymentShoppingCartGUI().


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