• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

payment/classes/class.ilPaymentBaseGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 include_once "./payment/classes/class.ilPaymentVendors.php";
00024 
00025 class ilPaymentBaseGUI
00026 {
00027         var $ilias;
00028         var $lng;
00029         var $db;
00030         var $tpl;
00031         var $rbacsystem;
00032 
00033         var $user_obj;
00034 
00035         var $section;
00036         var $main_section;
00037 
00038         function ilPaymentBaseGUI()
00039         {
00040                 global $ilias,$ilDB,$lng,$tpl,$rbacsystem;
00041 
00042                 $this->ilias =& $ilias;
00043                 $this->db =& $ilDB;
00044                 $this->lng =& $lng;
00045                 $this->tpl =& $tpl;
00046 
00047 
00048                 $this->SECTION_STATISTIC = 1;
00049                 $this->SECTION_OBJECT = 2;
00050                 $this->SECTION_TRUSTEE = 3;
00051                 $this->SECTION_SHOPPING_CART = 4;
00052                 $this->SECTION_BUYED_OBJECTS = 5;
00053 
00054                 $this->ADMIN = 4;
00055                 $this->BASE = 5;
00056 
00057                 $this->lng->loadLanguageModule('payment');
00058         }
00059 
00060         function setSection($a_section)
00061         {
00062                 $this->section = $a_section;
00063         }
00064         function getSection()
00065         {
00066                 return $this->section;
00067         }
00068         function setMainSection($a_main_section)
00069         {
00070                 $this->main_section = $a_main_section;
00071         }
00072         function getMainSection()
00073         {
00074                 return $this->main_section;
00075         }
00076         
00077         function buildHeader()
00078         {
00079                 $this->tpl->addBlockFile("CONTENT", "content", "tpl.payb_content.html");
00080                 
00081                 switch($this->getMainSection())
00082                 {
00083                         case $this->ADMIN:
00084                                 $this->tpl->setVariable("HEADER",$this->lng->txt('paya_header'));
00085                                 break;
00086 
00087                         case $this->BASE:
00088                                 $this->tpl->setVariable("HEADER",$this->lng->txt('pay_header'));
00089                                 break;
00090                 }
00091                 $this->__buildStylesheet();
00092                 $this->__buildStatusline();
00093                 $this->__buildButtons();
00094         }
00095 
00096         function showButton($a_cmd,$a_text,$a_target = '')
00097         {
00098                 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00099                 
00100                 // display button
00101                 $this->tpl->setCurrentBlock("btn_cell");
00102                 $this->tpl->setVariable("BTN_LINK",$this->ctrl->getLinkTarget($this,$a_cmd));
00103                 $this->tpl->setVariable("BTN_TXT",$a_text);
00104                 if($a_target)
00105                 {
00106                         $this->tpl->setVariable("BTN_TARGET",$a_target);
00107                 }
00108 
00109                 $this->tpl->parseCurrentBlock();
00110         }
00111         function &initTableGUI()
00112         {
00113                 include_once "./classes/class.ilTableGUI.php";
00114 
00115                 return new ilTableGUI(0,false);
00116         }
00117         function setTableGUIBasicData(&$tbl,&$result_set,$a_default_order_column = '')
00118         {
00119                 $offset = $_GET["offset"];
00120                 $order = $_GET["sort_by"];
00121                 $direction = $_GET["sort_order"];
00122 
00123                 $tbl->setOrderColumn($order,$a_default_order_column);
00124                 $tbl->setOrderDirection($direction);
00125                 $tbl->setOffset($offset);
00126                 $tbl->setLimit($_GET["limit"]);
00127                 $tbl->setMaxCount(count($result_set));
00128                 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00129                 $tbl->setData($result_set);
00130         }
00131 
00132                 
00133 
00134         // PIRVATE
00135         function  __buildStatusline()
00136         {
00137                 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00138                 $this->__buildLocator();
00139         }       
00140         function __buildLocator()
00141         {
00142                 $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html");
00143                 $this->tpl->setVariable("TXT_LOCATOR",$this->lng->txt("locator"));
00144 
00145                 $this->tpl->setCurrentBlock("locator_item");
00146                 $this->tpl->setVariable("ITEM", $this->lng->txt("personal_desktop"));
00147                 $this->tpl->setVariable("LINK_ITEM", "../usr_personaldesktop.php");
00148                 $this->tpl->parseCurrentBlock();
00149 
00150                 switch($this->getMainSection())
00151                 {
00152                         case $this->ADMIN:
00153                                 $this->tpl->setCurrentBlock("locator_item");
00154                                 $this->tpl->setVariable("PREFIX",'>&nbsp;');
00155                                 $this->tpl->setVariable("ITEM", $this->lng->txt("paya_locator"));
00156                                 $this->tpl->setVariable("LINK_ITEM", "./payment_admin.php");
00157                                 $this->tpl->parseCurrentBlock();
00158                                 break;
00159 
00160                         case $this->BASE:
00161                                 $this->tpl->setCurrentBlock("locator_item");
00162                                 $this->tpl->setVariable("PREFIX",'>&nbsp;');
00163                                 $this->tpl->setVariable("ITEM", $this->lng->txt("pay_locator"));
00164                                 $this->tpl->setVariable("LINK_ITEM", "./payment.php");
00165                                 $this->tpl->parseCurrentBlock();
00166                                 break;
00167                 }
00168 
00169                 // CHECK for new mail and info
00170                 sendInfo();
00171 
00172                 return true;
00173         }
00174         function __buildStylesheet()
00175         {
00176                 $this->tpl->setVariable("LOCATION_STYLESHEET",ilUtil::getStyleSheetLocation());
00177                 $this->tpl->setVariable("LOCATION_JAVASCRIPT",ilUtil::getJSPath('functions.js'));
00178         }
00179 
00180         function __buildButtons()
00181         {
00182                 $this->tpl->addBlockFile("TABS", "tabs", "tpl.tabs.html");
00183 
00184                 if($this->getMainSection() == $this->ADMIN)
00185                 {
00186                         if(ilPaymentVendors::_isVendor($this->user_obj->getId()) or 
00187                            ilPaymentTrustees::_hasStatisticPermission($this->user_obj->getId()))
00188                         {
00189                                 $this->tpl->setCurrentBlock("tab");
00190                                 $this->tpl->setVariable('TAB_TYPE',$this->getSection() == $this->SECTION_STATISTIC ? 'tabactive' : 'tabinactive');
00191                                 $this->tpl->setVariable("TAB_LINK",$this->ctrl->getLinkTargetByClass('ilpaymentstatisticgui'));
00192                                 $this->tpl->setVariable("TAB_TEXT",$this->lng->txt('paya_statistic'));
00193                                 $this->tpl->parseCurrentBlock();
00194                         }
00195                         if(ilPaymentVendors::_isVendor($this->user_obj->getId()) or 
00196                            ilPaymentTrustees::_hasObjectPermission($this->user_obj->getId()))
00197                         {
00198                                 $this->tpl->setCurrentBlock("tab");
00199                                 $this->tpl->setVariable('TAB_TYPE',$this->getSection() == $this->SECTION_OBJECT ? 'tabactive' : 'tabinactive');
00200                                 $this->tpl->setVariable("TAB_LINK",$this->ctrl->getLinkTargetByClass('ilpaymentobjectgui'));
00201                                 $this->tpl->setVariable("TAB_TEXT",$this->lng->txt('paya_object'));
00202                                 $this->tpl->parseCurrentBlock();
00203                         }
00204                         if(ilPaymentVendors::_isVendor($this->user_obj->getId()))
00205                         {
00206                                 $this->tpl->setCurrentBlock("tab");
00207                                 $this->tpl->setVariable('TAB_TYPE',$this->getSection() == $this->SECTION_TRUSTEE ? 'tabactive' : 'tabinactive');
00208                                 $this->tpl->setVariable("TAB_LINK",$this->ctrl->getLinkTargetByClass('ilpaymenttrusteegui'));
00209                                 $this->tpl->setVariable("TAB_TEXT",$this->lng->txt('paya_trustees'));
00210                                 $this->tpl->parseCurrentBlock();
00211                         }
00212                 }
00213                 if($this->getMainSection() == $this->BASE)
00214                 {
00215                         $this->tpl->setCurrentBlock("tab");
00216                         $this->tpl->setVariable('TAB_TYPE',$this->getSection() == $this->SECTION_SHOPPING_CART ? 'tabactive' : 'tabinactive');
00217                         $this->tpl->setVariable("TAB_LINK",$this->ctrl->getLinkTargetByClass('ilpaymentshoppingcartgui'));
00218                         $this->tpl->setVariable("TAB_TEXT",$this->lng->txt('paya_shopping_cart'));
00219                         $this->tpl->parseCurrentBlock();
00220 
00221                         $this->tpl->setCurrentBlock("tab");
00222                         $this->tpl->setVariable('TAB_TYPE',$this->getSection() == $this->SECTION_BUYED_OBJECTS ? 'tabactive' : 'tabinactive');
00223                         $this->tpl->setVariable("TAB_LINK",$this->ctrl->getLinkTargetByClass('ilpaymentbuyedobjectsgui'));
00224                         $this->tpl->setVariable("TAB_TEXT",$this->lng->txt('paya_buyed_objects'));
00225                         $this->tpl->parseCurrentBlock();
00226                 }
00227         }
00228 
00229 
00230 
00231 
00232 }
00233 ?>

Generated on Fri Dec 13 2013 09:06:37 for ILIAS Release_3_4_x_branch .rev 46804 by  doxygen 1.7.1