00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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 var $tabs_gui;
00033
00034 var $user_obj;
00035
00036 var $section;
00037 var $main_section;
00038
00039 function ilPaymentBaseGUI()
00040 {
00041
00042 global $ilias,$ilDB,$lng,$tpl,$rbacsystem,$ilTabs;
00043
00044 $this->ilias =& $ilias;
00045 $this->db =& $ilDB;
00046 $this->lng =& $lng;
00047 $this->tpl =& $tpl;
00048
00049 $this->tabs_gui =& $ilTabs;
00050
00051 $this->SECTION_STATISTIC = 1;
00052 $this->SECTION_OBJECT = 2;
00053 $this->SECTION_TRUSTEE = 3;
00054 $this->SECTION_SHOPPING_CART = 4;
00055 $this->SECTION_BUYED_OBJECTS = 5;
00056 $this->SECTION_COUPONS = 6;
00057
00058 $this->ADMIN = 4;
00059 $this->BASE = 5;
00060
00061 $this->lng->loadLanguageModule('payment');
00062 }
00063
00064 function setSection($a_section)
00065 {
00066 $this->section = $a_section;
00067 }
00068 function getSection()
00069 {
00070 return $this->section;
00071 }
00072 function setMainSection($a_main_section)
00073 {
00074 $this->main_section = $a_main_section;
00075 }
00076 function getMainSection()
00077 {
00078 return $this->main_section;
00079 }
00080
00081 function buildHeader()
00082 {
00083 $this->tpl->addBlockFile("CONTENT", "content", "tpl.payb_content.html");
00084
00085 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.gif"),
00086 $this->lng->txt("personal_desktop"));
00087 $this->tpl->setTitle($this->lng->txt("personal_desktop"));
00088
00089 # switch($this->getMainSection())
00090 # {
00091 # case $this->ADMIN:
00092 # $this->tpl->setVariable("HEADER",$this->lng->txt('paya_header'));
00093 # break;
00094
00095 # case $this->BASE:
00096 # $this->tpl->setVariable("HEADER",$this->lng->txt('pay_header'));
00097 # break;
00098 # }
00099
00100 # $this->__buildStylesheet();
00101 # $this->__buildStatusline();
00102 $this->__buildButtons();
00103 }
00104
00105 function showButton($a_cmd,$a_text,$a_target = '')
00106 {
00107 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00108
00109
00110 $this->tpl->setCurrentBlock("btn_cell");
00111 $this->tpl->setVariable("BTN_LINK",$this->ctrl->getLinkTarget($this,$a_cmd));
00112 $this->tpl->setVariable("BTN_TXT",$a_text);
00113 if($a_target)
00114 {
00115 $this->tpl->setVariable("BTN_TARGET",$a_target);
00116 }
00117
00118 $this->tpl->parseCurrentBlock();
00119 }
00120 function &initTableGUI()
00121 {
00122 include_once "./Services/Table/classes/class.ilTableGUI.php";
00123
00124 return new ilTableGUI(0,false);
00125 }
00126 function setTableGUIBasicData(&$tbl,&$result_set,$a_default_order_column = '')
00127 {
00128 $offset = $_GET["offset"];
00129 $order = $_GET["sort_by"];
00130 $direction = $_GET["sort_order"];
00131
00132 $tbl->setOrderColumn($order,$a_default_order_column);
00133 $tbl->setOrderDirection($direction);
00134 $tbl->setOffset($offset);
00135 $tbl->setLimit($_GET["limit"]);
00136 $tbl->setMaxCount(count($result_set));
00137 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00138 $tbl->setData($result_set);
00139 }
00140
00141
00142
00143
00144 function __buildStatusline()
00145 {
00146 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00147 $this->__buildLocator();
00148 }
00149 function __buildLocator()
00150 {
00151 $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html");
00152 $this->tpl->setVariable("TXT_LOCATOR",$this->lng->txt("locator"));
00153
00154 $this->tpl->setCurrentBlock("locator_item");
00155 $this->tpl->setVariable("ITEM", $this->lng->txt("personal_desktop"));
00156 $this->tpl->setVariable("LINK_ITEM","../ilias.php?baseClass=ilPersonalDesktopGUI");
00157 #$this->tpl->setVariable("LINK_ITEM", "../usr_personaldesktop.php");
00158 $this->tpl->parseCurrentBlock();
00159
00160 switch($this->getMainSection())
00161 {
00162 case $this->ADMIN:
00163 $this->tpl->setCurrentBlock("locator_item");
00164 $this->tpl->setVariable("PREFIX",'> ');
00165 $this->tpl->setVariable("ITEM", $this->lng->txt("paya_locator"));
00166 $this->tpl->setVariable("LINK_ITEM", "./payment.php?view=payment_admin");
00167 $this->tpl->parseCurrentBlock();
00168 break;
00169
00170 case $this->BASE:
00171 $this->tpl->setCurrentBlock("locator_item");
00172 $this->tpl->setVariable("PREFIX",'> ');
00173 $this->tpl->setVariable("ITEM", $this->lng->txt("pay_locator"));
00174 $this->tpl->setVariable("LINK_ITEM", "./payment.php");
00175 $this->tpl->parseCurrentBlock();
00176 break;
00177 }
00178
00179
00180 ilUtil::sendInfo();
00181
00182 return true;
00183 }
00184 function __buildStylesheet()
00185 {
00186 $this->tpl->setVariable("LOCATION_STYLESHEET",ilUtil::getStyleSheetLocation());
00187 }
00188
00189 function __buildButtons()
00190 {
00191 $this->tpl->addBlockFile("TABS", "tabs", "tpl.tabs.html");
00192
00193 if($this->getMainSection() == $this->ADMIN)
00194 {
00195 if(ilPaymentVendors::_isVendor($this->user_obj->getId()) or
00196 ilPaymentTrustees::_hasStatisticPermission($this->user_obj->getId()))
00197 {
00198 $this->tabs_gui->addSubTabTarget('paya_statistic',
00199 $this->ctrl->getLinkTargetByClass('ilpaymentstatisticgui'),
00200 '',
00201 '',
00202 '',
00203 $this->getSection() == $this->SECTION_STATISTIC ? true : false);
00204
00205
00206
00207
00208
00209 }
00210 if(ilPaymentVendors::_isVendor($this->user_obj->getId()) or
00211 ilPaymentTrustees::_hasObjectPermission($this->user_obj->getId()))
00212 {
00213 $this->tabs_gui->addSubTabTarget('paya_object',
00214 $this->ctrl->getLinkTargetByClass('ilpaymentobjectgui'),
00215 '',
00216 '',
00217 '',
00218 $this->getSection() == $this->SECTION_OBJECT ? true : false);
00219
00220
00221
00222
00223
00224 }
00225 if(ilPaymentVendors::_isVendor($this->user_obj->getId()))
00226 {
00227 $this->tabs_gui->addSubTabTarget('paya_trustees',
00228 $this->ctrl->getLinkTargetByClass('ilpaymenttrusteegui'),
00229 '',
00230 '',
00231 '',
00232 $this->getSection() == $this->SECTION_TRUSTEE ? true : false);
00233
00234
00235
00236
00237
00238 }
00239 if(ilPaymentVendors::_isVendor($this->user_obj->getId()) or
00240 ilPaymentTrustees::_hasCouponsPermission($this->user_obj->getId()))
00241 {
00242 $this->tabs_gui->addSubTabTarget('paya_coupons_coupons',
00243 $this->ctrl->getLinkTargetByClass('ilpaymentcoupongui'),
00244 '',
00245 '',
00246 '',
00247 $this->getSection() == $this->SECTION_COUPONS ? true : false);
00248
00249
00250
00251
00252
00253 }
00254 }
00255 if($this->getMainSection() == $this->BASE)
00256 {
00257 $this->tabs_gui->addSubTabTarget('paya_shopping_cart',
00258 $this->ctrl->getLinkTargetByClass('ilpaymentshoppingcartgui'),
00259 '',
00260 '',
00261 '',
00262 $this->getSection() == $this->SECTION_SHOPPING_CART ? true : false);
00263
00264
00265
00266
00267
00268
00269 $this->tabs_gui->addSubTabTarget('paya_buyed_objects',
00270 $this->ctrl->getLinkTargetByClass('ilpaymentbuyedobjectsgui'),
00271 '',
00272 '',
00273 '',
00274 $this->getSection() == $this->SECTION_BUYED_OBJECTS ? true : false);
00275
00276
00277
00278
00279
00280 }
00281 }
00282
00283 }
00284 ?>