ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilShopPurchaseGUI Class Reference

Class ilShopPurchaseGUI. More...

+ Inheritance diagram for ilShopPurchaseGUI:
+ Collaboration diagram for ilShopPurchaseGUI:

Public Member Functions

 __construct ($a_ref_id)
 
 executeCommand ()
 execute command More...
 
 showDemoVersion ()
 
 showDetails ()
 
 addToShoppingCart ()
 
- Public Member Functions inherited from ilObjectGUI
 ilObjectGUI ($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
 Constructor public. More...
 
executeCommand ()
 execute command More...
 
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode ($a_mode=true)
 if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class! the mode is determined in ilrepositorygui More...
 
 getCreationMode ()
 get creation mode More...
 
 getAdminTabs (&$tabs_gui)
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelDeleteObject ()
 cancel deletion of object More...
 
 cancelObject ($in_rep=false)
 cancel action and go back to previous page public More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 save object More...
 
 editObject ()
 edit object More...
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g. More...
 
 isVisible ($a_ref_id, $a_type)
 
 viewObject ()
 list childs of current object More...
 
 deleteObject ($a_error=false)
 Display deletion confirmation screen. More...
 
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI. More...
 

Data Fields

 $ctrl
 
 $lng
 
 $tpl
 
 $object = null
 
 $pobject = null
 
 $cur_row_type = null
 
 $price_obj = null
 
 $sc_obj = null
 
- Data Fields inherited from ilObjectGUI
const COPY_WIZARD_NEEDS_PAGE = 1
 
 $ilias
 
 $objDefinition
 
 $tpl
 
 $tree
 
 $lng
 
 $data
 
 $object
 
 $ref_id
 
 $obj_id
 
 $maxcount
 
 $formaction
 
 $return_location
 
 $target_frame
 
 $tab_target_script
 
 $actions
 
 $sub_objects
 
 $omit_locator = false
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 

Private Member Functions

 getItemsByObjType ($items, $type_group)
 
 __getCourseItemsHTML ($container_items)
 
 resetRowType ()
 
 addHeaderRow ($a_tpl, $a_type, $a_show_image=true)
 adds a header row to a block template More...
 
 addStandardRow (&$a_tpl, $a_html, $a_item_obj_id="", $a_image_type="", $a_related_header="")
 adds a standard row to a block template More...
 
 __getAbstractHTML ($a_payment_object_id)
 
 __initShoppingCartObject ()
 
 __initPaymentObject ()
 
 __initPricesObject ()
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot ($a_raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode ($a_ref_id, $a_cmd="frameset")
 Goto repository root. More...
 
- Protected Member Functions inherited from ilObjectGUI
 assignObject ()
 
 prepareOutput ()
 prepare output More...
 
 setTitleAndDescription ()
 called by prepare output More...
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction ($a_list_gui)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 showMountWebfolderIcon ()
 
 setTabs ()
 set admin tabs public More...
 
 setAdminTabs ()
 set admin tabs public More...
 
 setLocator ()
 set Locator More...
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator ($a_omit=true)
 
 addAdminLocatorItems ($a_do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms ($a_new_type)
 Init creation froms. More...
 
 getCreationFormsHTML (array $a_forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm ($a_new_type)
 Init object creation form. More...
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 Show didactic template types. More...
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 getDidacticTemplateVar ($a_type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. More...
 
 afterSave (ilObject $a_new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 Init object edit form. More...
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 Get values for edit form. More...
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 updateCustom (ilPropertyFormGUI $a_form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 initImportForm ($a_new_type)
 Init object import form. More...
 
 importFileObject ($parent_id=null)
 Import. More...
 
 afterImport (ilObject $a_new_object)
 Post (successful) object import hook. More...
 
 setFormAction ($a_cmd, $a_formaction)
 set specific form action for command More...
 
 getReturnLocation ($a_cmd, $a_location="")
 get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command More...
 
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame ($a_cmd, $a_target_frame)
 set specific target frame for command More...
 
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu) More...
 
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl. More...
 
 getTitlesByRefId ($a_ref_ids)
 get Titles of objects this method is used for error messages in methods cut/copy/paste More...
 
 getTabs (&$tabs_gui)
 get tabs abstract method. More...
 
 __showButton ($a_cmd, $a_text, $a_target='')
 
 hitsperpageObject ()
 
__initTableGUI ()
 
 __setTableGUIBasicData (&$tbl, &$result_set, $a_from="")
 standard implementation for tables use 'from' variable use different initial setting of table More...
 
 redirectToRefId ($a_ref_id, $a_cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current $_GET["ref_id"] value More...
 
 fillCloneTemplate ($a_tpl_varname, $a_type)
 Fill object clone template This method can be called from any object GUI class that wants to offer object cloning. More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 setColumnSettings ($column_gui)
 May be overwritten in subclasses. More...
 
 checkPermission ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission and redirect on error. More...
 
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission. More...
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 handleAutoRating (ilObject $a_new_obj)
 Activate rating automatically if parent container setting. More...
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilShopPurchaseGUI::__construct (   $a_ref_id)

Definition at line 27 of file class.ilShopPurchaseGUI.php.

References $_GET, $ilCtrl, $ilErr, $lng, $tpl, and ilObjectFactory\getInstanceByRefId().

28  {
29  global $ilCtrl,$lng,$ilErr,$tpl,$ilTabs;
30 
31  $this->ctrl = $ilCtrl;
32  $this->ctrl->saveParameter($this, array("ref_id"));
33 
34  $this->ilErr = $ilErr;
35 
36  $this->lng = $lng;
37  $this->lng->loadLanguageModule('payment');
38 
39  $this->tpl = $tpl;
40 
41  $this->ref_id = $a_ref_id;
42 
43  $this->object = ilObjectFactory::getInstanceByRefId($this->ref_id, false);
44 
45  $this->tpl->getStandardTemplate();
46 
47  $ilTabs->clearTargets();
48  $ilTabs->addTarget('buy', $this->ctrl->getLinkTarget($this, 'showDetails').'&purchasetype=buy');
49  $ilTabs->addTarget('payment_demo', $this->ctrl->getLinkTarget($this, 'showDemoVersion').'&purchasetype=demo');
50 
51  $this->ctrl->setParameter($this, 'purchasetype', ($_GET['purchasetype'] == 'demo' ? 'demo' : 'buy'));
52 
53  }
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

Member Function Documentation

◆ __getAbstractHTML()

ilShopPurchaseGUI::__getAbstractHTML (   $a_payment_object_id)
private

Definition at line 525 of file class.ilShopPurchaseGUI.php.

References ilPageObject\_exists().

Referenced by showDemoVersion().

526  {
527  // page object
528  include_once 'Services/Payment/classes/class.ilShopPage.php';
529  include_once 'Services/Payment/classes/class.ilShopPageGUI.php';
530 
531  // if page does not exist, return nothing
532  if(!ilShopPage::_exists('shop', $a_payment_object_id))
533  {
534  return '';
535  }
536 
537  include_once 'Services/Style/classes/class.ilObjStyleSheet.php';
538  // get page object
539  $page_gui = new ilShopPageGUI($a_payment_object_id);
540 
541  return $page_gui->showPage();
542  }
static _exists($a_parent_type, $a_id, $a_lang="")
Checks whether page exists.
Shop page GUI class.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __getCourseItemsHTML()

ilShopPurchaseGUI::__getCourseItemsHTML (   $container_items)
private

Definition at line 161 of file class.ilShopPurchaseGUI.php.

References $ilSetting, ilObjectGUI\$objDefinition, addHeaderRow(), addStandardRow(), getItemsByObjType(), and resetRowType().

Referenced by showDemoVersion().

162  {
163  global $objDefinition, $ilSetting;
164 
165  $output = false;
166 
167  $tpl_sub_items = new ilTemplate('tpl.pay_purchase_demo_list_block.html', true, true, 'Services/Payment');
168 
169  $objtype_groups = $objDefinition->getGroupedRepositoryObjectTypes(
170  array('cat', 'crs', 'grp', 'fold')
171  );
172 
173  foreach($objtype_groups as $grp => $grpdata)
174  {
175 // $title = $this->lng->txt('objs_'.$grp);
176  $items = $this->getItemsByObjType($container_items, $grp);
177 
178  $item_html = array();
179  $rel_header = 'th_'.$grp;
180 
181  if(count($items) > 0)
182  {
183  foreach($items as $item)
184  {
185  if($item['title'] != '')
186  {
187  $item_html[] = array(
188  'html' => $item['title'],
189  'item_ref_id' => $item['ref_id'],
190  'item_obj_id' => $item['obj_id']
191  );
192  }
193  }
194 
195  // output block for resource type
196  if(count($item_html) > 0)
197  {
198  $output = true;
199 
200  // add a header for each resource type
201  if($ilSetting->get('icon_position_in_lists') == 'item_rows')
202  {
203  $this->addHeaderRow($tpl_sub_items, $grp, false);
204  }
205  else
206  {
207  $this->addHeaderRow($tpl_sub_items, $grp);
208  }
209  $this->resetRowType();
210 
211  // content row
212  foreach($item_html as $item)
213  {
214  if($ilSetting->get('icon_position_in_lists') == 'item_rows')
215  {
216  // BEGIN WebDAV: Use $item_list_gui to determine icon image type
217  $this->addStandardRow($tpl_sub_items, $item['html'], $item['item_obj_id'],
218  $item['item_icon_image_type'],
219  $rel_header);
220  // END WebDAV: Use $item_list_gui to determine icon image type
221  }
222  else
223  {
224  $this->addStandardRow($tpl_sub_items, $item['html'], $item['item_obj_id'], '', $rel_header);
225  }
226  }
227  }
228  }
229  }
230 
231  if($output == true)
232  {
233  $this->tpl->setCurrentBlock('public_content_block');
234  $this->tpl->setVariable('TXT_CONTENT', $this->lng->txt('content'));
235  $this->tpl->setVariable('PUBLIC_CONTENT_HTML', $tpl_sub_items->get());
236  $this->tpl->parseCurrentBlock();
237  }
238  }
addHeaderRow($a_tpl, $a_type, $a_show_image=true)
adds a header row to a block template
getItemsByObjType($items, $type_group)
special template class to simplify handling of ITX/PEAR
global $ilSetting
Definition: privfeed.php:40
addStandardRow(&$a_tpl, $a_html, $a_item_obj_id="", $a_image_type="", $a_related_header="")
adds a standard row to a block template
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __initPaymentObject()

ilShopPurchaseGUI::__initPaymentObject ( )
private

Definition at line 583 of file class.ilShopPurchaseGUI.php.

References $ilUser, and ilPaymentObject\_lookupPobjectId().

Referenced by addToShoppingCart(), executeCommand(), showDemoVersion(), and showDetails().

584  {
585  global $ilUser;
586  $this->pobject = new ilPaymentObject($ilUser ,ilPaymentObject::_lookupPobjectId($this->ref_id));
587  return true;
588  }
static _lookupPobjectId($a_ref_id)
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __initPricesObject()

ilShopPurchaseGUI::__initPricesObject ( )
private

Definition at line 589 of file class.ilShopPurchaseGUI.php.

Referenced by showDemoVersion(), and showDetails().

590  {
591  include_once './Services/Payment/classes/class.ilPaymentPrices.php';
592  $this->price_obj = new ilPaymentPrices($this->pobject->getPobjectId());
593  return true;
594  }
+ Here is the caller graph for this function:

◆ __initShoppingCartObject()

ilShopPurchaseGUI::__initShoppingCartObject ( )
private

Definition at line 575 of file class.ilShopPurchaseGUI.php.

References $ilUser.

Referenced by addToShoppingCart(), showDemoVersion(), and showDetails().

576  {
577  global $ilUser;
578  include_once './Services/Payment/classes/class.ilPaymentShoppingCart.php';
579  $this->sc_obj = new ilPaymentShoppingCart($ilUser);
580  return true;
581  }
global $ilUser
Definition: imgupload.php:15
+ Here is the caller graph for this function:

◆ addHeaderRow()

ilShopPurchaseGUI::addHeaderRow (   $a_tpl,
  $a_type,
  $a_show_image = true 
)
private

adds a header row to a block template

Parameters
object$a_tplblock template
string$a_typeobject type private

Definition at line 252 of file class.ilShopPurchaseGUI.php.

References ilUtil\getImagePath().

Referenced by __getCourseItemsHTML().

253  {
254  $icon = ilUtil::getImagePath("icon_".$a_type.".png");
255  $title = $this->lng->txt("objs_".$a_type);
256  $header_id = "th_".$a_type;
257 
258  if ($a_show_image)
259  {
260  $a_tpl->setCurrentBlock("container_header_row_image");
261  $a_tpl->setVariable("HEADER_IMG", $icon);
262  $a_tpl->setVariable("HEADER_ALT", $title);
263  }
264  else
265  {
266  $a_tpl->setCurrentBlock("container_header_row");
267  }
268 
269  $a_tpl->setVariable("BLOCK_HEADER_CONTENT", $title);
270  $a_tpl->setVariable("BLOCK_HEADER_ID", $header_id);
271  $a_tpl->parseCurrentBlock();
272  $a_tpl->touchBlock("container_row");
273  }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addStandardRow()

ilShopPurchaseGUI::addStandardRow ( $a_tpl,
  $a_html,
  $a_item_obj_id = "",
  $a_image_type = "",
  $a_related_header = "" 
)
private

adds a standard row to a block template

Parameters
object$a_tplblock template
string$a_htmlhtml code private

Definition at line 282 of file class.ilShopPurchaseGUI.php.

References $ilSetting, $path, ilContainer\_lookupIconPath(), and ilUtil\getImagePath().

Referenced by __getCourseItemsHTML().

284  {
285  global $ilSetting;
286 
287  $this->cur_row_type = ($this->cur_row_type == "row_type_1")
288  ? "row_type_2"
289  : "row_type_1";
290  $a_tpl->touchBlock($this->cur_row_type);
291 
292  if ($a_image_type != "")
293  {
294  if (!is_array($a_image_type) && !in_array($a_image_type, array("lm", "dbk", "htlm", "sahs")))
295  {
296  $icon = ilUtil::getImagePath("icon_".$a_image_type.".png");
297  $title = $this->lng->txt("obj_".$a_image_type);
298  }
299  else
300  {
301  $icon = ilUtil::getImagePath("icon_lm.png");
302  $title = $this->lng->txt("learning_resource");
303  }
304 
305  // custom icon
306  if ($ilSetting->get("custom_icons") &&
307  in_array($a_image_type, array("cat","grp","crs")))
308  {
309  require_once("./Services/Container/classes/class.ilContainer.php");
310  if (($path = ilContainer::_lookupIconPath($a_item_obj_id, "small")) != "")
311  {
312  $icon = $path;
313  }
314  }
315 
316  $a_tpl->setCurrentBlock("block_row_image");
317  $a_tpl->setVariable("ROW_IMG", $icon);
318  $a_tpl->setVariable("ROW_ALT", $title);
319  $a_tpl->parseCurrentBlock();
320  }
321  else
322  {
323  $a_tpl->setVariable("ROW_NBSP", " ");
324  }
325  $a_tpl->setCurrentBlock("container_standard_row");
326  $a_tpl->setVariable("BLOCK_ROW_CONTENT", $a_html);
327  $rel_headers = ($a_related_header != "")
328  ? "th_selected_items ".$a_related_header
329  : "th_selected_items";
330  $a_tpl->setVariable("BLOCK_ROW_HEADERS", $rel_headers);
331  $a_tpl->parseCurrentBlock();
332  $a_tpl->touchBlock("container_row");
333  }
_lookupIconPath($a_id, $a_size="big")
lookup icon path
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $ilSetting
Definition: privfeed.php:40
$path
Definition: index.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addToShoppingCart()

ilShopPurchaseGUI::addToShoppingCart ( )

Definition at line 544 of file class.ilShopPurchaseGUI.php.

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

545  {
546  global $ilTabs;
547 
548  $ilTabs->setTabActive('buy');
549 
550  if(!isset($_POST['price_id']))
551  {
552  ilUtil::sendInfo($this->lng->txt('pay_select_price'));
553  $this->showDetails();
554 
555  return true;
556  }
557  else
558  {
559  $this->__initPaymentObject();
560 
561  $this->__initShoppingCartObject();
562 
563  $this->sc_obj->setSessionId(session_id());
564  $this->sc_obj->setPriceId((int) $_POST['price_id']);
565  $this->sc_obj->setPobjectId($this->pobject->getPobjectId());
566  $this->sc_obj->add();
567 
568  ilUtil::redirect('ilias.php?baseClass=ilShopController&cmd=redirect&redirect_class=ilshopshoppingcartgui');
569 
570  return true;
571  }
572  }
$_POST['username']
Definition: cron.php:12
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static redirect($a_script)
http redirect to other script
+ Here is the call graph for this function:

◆ executeCommand()

ilShopPurchaseGUI::executeCommand ( )

execute command

Definition at line 58 of file class.ilShopPurchaseGUI.php.

References $_GET, $cmd, and __initPaymentObject().

59  {
60  $cmd = $this->ctrl->getCmd();
61  switch($this->ctrl->getCmdClass())
62  {
63  case 'ilshoppagegui':
64  $this->__initPaymentObject();
65  include_once 'Services/Style/classes/class.ilObjStyleSheet.php';
66  include_once 'Services/Payment/classes/class.ilShopPageGUI.php';
67  $page_gui = new ilShopPageGUI($this->pobject->getPobjectId());
68  $this->ctrl->forwardCommand($page_gui);
69  return true;
70  break;
71  }
72 
73 
74  switch($cmd)
75  {
76  case 'addToShoppingCart':
77  break;
78 
79  default:
80  if(!in_array($cmd, array('showDemoVersion', 'showDetails', 'addToShoppingCart')))
81  {
82  $cmd = ($_GET['purchasetype'] == 'demo' ? 'showDemoVersion' : 'showDetails');
83  }
84  break;
85  }
86  $this->$cmd();
87  return true;
88  }
$_GET["client_id"]
$cmd
Definition: sahs_server.php:35
Shop page GUI class.
+ Here is the call graph for this function:

◆ getItemsByObjType()

ilShopPurchaseGUI::getItemsByObjType (   $items,
  $type_group 
)
private

Definition at line 156 of file class.ilShopPurchaseGUI.php.

Referenced by __getCourseItemsHTML().

157  {
158  return is_array($items[$type_group]) ? $items[$type_group] : array();
159  }
+ Here is the caller graph for this function:

◆ resetRowType()

ilShopPurchaseGUI::resetRowType ( )
private

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

Referenced by __getCourseItemsHTML().

241  {
242  $this->cur_row_type = "";
243  }
+ Here is the caller graph for this function:

◆ showDemoVersion()

ilShopPurchaseGUI::showDemoVersion ( )

Definition at line 90 of file class.ilShopPurchaseGUI.php.

References __getAbstractHTML(), __getCourseItemsHTML(), __initPaymentObject(), __initPricesObject(), __initShoppingCartObject(), ilUtil\getImagePath(), ilObjectFactory\getInstanceByRefId(), and ilExplorer\setTargetGet().

91  {
92  global $ilMainMenu, $ilTabs, $ilToolbar;
93 
94  $this->__initPaymentObject();
95  $this->__initPricesObject();
96  $this->__initShoppingCartObject();
97 
98  $ilToolbar->addButton($this->lng->txt('payment_back_to_shop'),'ilias.php?baseClass=ilShopController');
99 
100  $ilTabs->setTabActive('payment_demo');
101  $ilMainMenu->setActive('shop');
102  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.shop_abstract_details.html', 'Services/Payment');
103 
104  $this->tpl->setVariable("DETAILS_FORMACTION",$this->ctrl->getFormAction($this));
105 
106  if($this->object)
107  {
108  $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_'.$this->object->getType().'_b.png'));
109  $this->tpl->setVariable("ALT_IMG",$this->lng->txt('obj_'.$this->object->getType()));
110  $this->tpl->setVariable("TITLE",$this->object->getTitle());
111  }
112  else
113  {
114  $this->tpl->setVariable("TITLE",$this->lng->txt('object_not_found'));
115  }
116 
117 
118 
119  // abstracts
120  if(($abstract_html = $this->__getAbstractHTML($this->pobject->getPobjectId())) != '')
121  {
122  $this->tpl->setCurrentBlock('abstract_block');
123  $this->tpl->setVariable('TXT_ABSTRACT', $this->lng->txt('pay_abstract'));
124  $this->tpl->setVariable('ABSTRACT_HTML', $abstract_html);
125  $this->tpl->parseCurrentBlock();
126  }
127 
128  // public content ilias lm
129  global $ilObjDataCache;
130  if($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->pobject->getRefId())) == 'lm')
131  {
132  include_once 'Modules/LearningModule/classes/class.ilShopPublicSectionSelector.php';
133  $exp = new ilShopPublicSectionSelector($this->ctrl->getLinkTarget($this, 'layout'),
134  ilObjectFactory::getInstanceByRefId($this->pobject->getRefId()), get_class($this));
135  $exp->setTargetGet('obj_id');
136  $exp->setOutput(0);
137  $output = $exp->getOutput();
138 
139  if(trim($output) != '')
140  {
141 
142  $this->tpl->setCurrentBlock('public_content_block');
143  $this->tpl->setVariable('TXT_CONTENT', $this->lng->txt('content'));
144  $this->tpl->setVariable('PUBLIC_CONTENT_HTML', $output);
145  $this->tpl->parseCurrentBlock();
146  }
147  }
148  else if($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->pobject->getRefId())) == 'crs')
149  {
150  $oCourse = ilObjectFactory::getInstanceByRefId($this->pobject->getRefId());
151  $items = $oCourse->getSubItems();
152  $this->__getCourseItemsHTML($items);
153  }
154  }
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
setTargetGet($a_target_get)
set the varname in Get-string public
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
__getCourseItemsHTML($container_items)
__getAbstractHTML($a_payment_object_id)
+ Here is the call graph for this function:

◆ showDetails()

ilShopPurchaseGUI::showDetails ( )

Definition at line 335 of file class.ilShopPurchaseGUI.php.

References $ilUser, __initPaymentObject(), __initPricesObject(), __initShoppingCartObject(), ilPaymentPrices\_formatPriceToString(), ilPaymentBookings\_hasAccesstoExtensionPrice(), ilDatePresentation\formatDate(), ilUtil\formRadioButton(), ilUtil\getImagePath(), IL_CAL_DATE, ilUtil\sendInfo(), ilDatePresentation\setUseRelativeDates(), ilPaymentPrices\TYPE_DURATION_DATE, ilPaymentPrices\TYPE_DURATION_MONTH, and ilPaymentPrices\TYPE_UNLIMITED_DURATION.

Referenced by addToShoppingCart().

336  {
337  global $ilMainMenu, $ilTabs, $ilToolbar, $ilUser;
338 
339  $this->__initPaymentObject();
340  $this->__initPricesObject();
341  $this->__initShoppingCartObject();
342 
343  $ilToolbar->addButton($this->lng->txt('payment_back_to_shop'),'ilias.php?baseClass=ilShopController');
344 
345  $this->tpl->getStandardTemplate();
346  $ilTabs->setTabActive('buy');
347  $ilMainMenu->setActive('shop');
348 
349  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.pay_purchase_details.html', 'Services/Payment');
350 
351  if($this->pobject->getStatus() == $this->pobject->STATUS_EXPIRES)
352  {
353  ilUtil::sendInfo($this->lng->txt('pay_expires_info'));
354 
355  return false;
356  }
357 
358  $extension_prices = array();
359 
360  if($ilUser->getId() != ANONYMOUS_USER_ID)
361  {
362  include_once './Services/Payment/classes/class.ilPaymentBookings.php';
363  $has_extension_price = ilPaymentBookings::_hasAccesstoExtensionPrice(
364  $ilUser->getId(), $this->pobject->getPobjectId());
365 
366 
367  if($has_extension_price)
368  {
369  $extension_prices = $this->price_obj->getExtensionPrices();
370  }
371  }
372 
373  $org_prices = $this->price_obj->getPrices();
374  $tmp_prices = array_merge($org_prices, $extension_prices );
375 
376  $prices = array();
377  foreach($tmp_prices as $price)
378  {
379  // expired prices must be filtered out
380  if($price['price_type'] == ilPaymentPrices::TYPE_DURATION_DATE && $price['duration_until'] < date('Y-m-d'))
381  {
382  //do nothing
383  }
384  else
385  {
386  $prices[] = $price;
387  }
388  }
389 
390  $buyedObject = "";
391  if($this->sc_obj->isInShoppingCart($this->pobject->getPobjectId()))
392  {
393  $buyedObject = $this->sc_obj->getEntry($this->pobject->getPobjectId());
394  if (is_array($prices) &&
395  count($prices) > 1)
396  {
397  ilUtil::sendInfo($this->lng->txt('pay_item_already_in_sc_choose_another'));
398  }
399  else
400  {
401  ilUtil::sendInfo($this->lng->txt('pay_item_already_in_sc'));
402  }
403 
404  $this->tpl->setCurrentBlock("shopping_cart_1");
405 
406  $this->tpl->setVariable("LINK_GOTO_SHOPPING_CART",'ilias.php?baseClass=ilShopController&cmd=redirect&redirect_class=ilShopShoppingCartGUI');
407  $this->tpl->setVariable("TXT_GOTO_SHOPPING_CART", $this->lng->txt('pay_goto_shopping_cart'));
408  $this->tpl->parseCurrentBlock("shopping_cart_1");
409 
410  }
411 
412  $this->ctrl->setParameter($this, "ref_id", $this->pobject->getRefId());
413  $subtype = '';
414  if($this->object)
415  {
416  if($this->object->getType() == 'exc')
417  {
418  $subtype = ' ('.$this->lng->txt($this->pobject->getSubtype()).')';
419  }
420 
421  $this->tpl->setVariable("DETAILS_FORMACTION",$this->ctrl->getFormAction($this));
422  $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_'.$this->object->getType().'_b.png'));
423  $this->tpl->setVariable("ALT_IMG",$this->lng->txt('obj_'.$this->object->getType()));
424  $this->tpl->setVariable("TITLE",$this->object->getTitle().' '.$subtype);
425  }
426  else
427  {
428  $this->tpl->setVariable("DETAILS_FORMACTION",$this->ctrl->getFormAction($this));
429  $this->tpl->setVariable("TITLE",$this->lng->txt('object_not_found'));
430  }
431  // payment infos
432  $this->tpl->setVariable("TXT_INFO",$this->lng->txt('info'));
433 
434  $this->tpl->setVariable("INFO_PAY",$this->lng->txt('pay_info'));
435  if (is_array($buyedObject))
436  {
437  if (is_array($prices) && count($prices) > 1)
438  {
439  $this->tpl->setVariable("INPUT_CMD",'addToShoppingCart');
440  $this->tpl->setVariable("INPUT_VALUE",$this->lng->txt('pay_change_price'));
441  }
442  else
443  {
444  $this->tpl->setVariable("INPUT_CMD",'addToShoppingCart');
445  $this->tpl->setVariable("INPUT_VALUE",$this->lng->txt('pay_add_to_shopping_cart'));
446  }
447  }
448  else
449  {
450  $this->tpl->setVariable("INPUT_CMD",'addToShoppingCart');
451  $this->tpl->setVariable("INPUT_VALUE",$this->lng->txt('pay_add_to_shopping_cart'));
452  }
453 
454  $this->tpl->setVariable("ROWSPAN",count($prices));
455  $this->tpl->setVariable("TXT_PRICES",$this->lng->txt('prices'));
456 
457  if (is_array($prices))
458  {
459  $counter = 0;
460  foreach($prices as $price)
461  {
462  if ($counter == 0)
463  {
464  $placeholderCheckbox = "CHECKBOX";
465  $placeholderDuration = "DURATION";
466  $placeholderPrice = "PRICE";
467  $placeholderDescription = "DESCRIPTION";
468  }
469  else
470  {
471  $placeholderCheckbox = "ROW_CHECKBOX";
472  $placeholderDuration = "ROW_DURATION";
473  $placeholderPrice = "ROW_PRICE";
474  $placeholderDescription = "ROW_DESCRIPTION";
475  }
476  $this->tpl->setCurrentBlock("price_row");
477 
478  if(is_array($buyedObject) && $buyedObject["price_id"] == $price['price_id'])
479  {
480  $this->tpl->setVariable($placeholderCheckbox,ilUtil::formRadioButton(1,'price_id',$price['price_id']));
481  }
482  else if (count($prices) == 1)
483  {
484  $this->tpl->setVariable($placeholderCheckbox,ilUtil::formRadioButton(1,'price_id',$price['price_id']));
485  }
486  else
487  {
488  $this->tpl->setVariable($placeholderCheckbox,ilUtil::formRadioButton(0,'price_id',$price['price_id']));
489  }
490 
491  switch($price['price_type'])
492  {
494  $this->tpl->setVariable($placeholderDuration,$price['duration'].' '.$this->lng->txt('paya_months').': ');
495  break;
498  $this->tpl->setVariable($placeholderDuration,
499  ilDatePresentation::formatDate(new ilDate($price['duration_from'], IL_CAL_DATE))
500  .' - '.ilDatePresentation::formatDate(new ilDate($price['duration_until'], IL_CAL_DATE)).' -> ');
501  break;
503  $this->tpl->setVariable($placeholderDuration, $this->lng->txt('unlimited_duration').': ');
504  break;
505  }
506 
507  $tmp_price = $price['price'];
508 
509  if($price['extension'] == 1)
510  $extension_txt = '('.$this->lng->txt('extension_price').')';
511  else $extension_txt = '';
512 
513  $this->tpl->setVariable($placeholderPrice, ilPaymentPrices::_formatPriceToString((float)$tmp_price).' '.$extension_txt );
514  if($price['description'] != NULL)
515  {
516  $this->tpl->setVariable($placeholderDescription, $price['description']);
517  }
518  $this->tpl->parseCurrentBlock();
519  $counter++;
520  }
521  }
522  return true;
523  }
static _formatPriceToString($a_price)
static setUseRelativeDates($a_status)
set use relative dates
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Class for single dates.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static formatDate(ilDateTime $date)
Format a date public.
static _hasAccesstoExtensionPrice($a_user_id, $a_pobject_id)
static formRadioButton($checked, $varname, $value, $onclick=null, $disabled=false)
??? public
const IL_CAL_DATE
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilShopPurchaseGUI::$ctrl

Definition at line 17 of file class.ilShopPurchaseGUI.php.

◆ $cur_row_type

ilShopPurchaseGUI::$cur_row_type = null

Definition at line 23 of file class.ilShopPurchaseGUI.php.

◆ $lng

ilShopPurchaseGUI::$lng

Definition at line 18 of file class.ilShopPurchaseGUI.php.

Referenced by __construct().

◆ $object

ilShopPurchaseGUI::$object = null

Definition at line 21 of file class.ilShopPurchaseGUI.php.

◆ $pobject

ilShopPurchaseGUI::$pobject = null

Definition at line 22 of file class.ilShopPurchaseGUI.php.

◆ $price_obj

ilShopPurchaseGUI::$price_obj = null

Definition at line 24 of file class.ilShopPurchaseGUI.php.

◆ $sc_obj

ilShopPurchaseGUI::$sc_obj = null

Definition at line 25 of file class.ilShopPurchaseGUI.php.

◆ $tpl

ilShopPurchaseGUI::$tpl

Definition at line 19 of file class.ilShopPurchaseGUI.php.

Referenced by __construct().


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