ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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...
 
 validateCustom (ilPropertyFormGUI $a_form)
 Validate custom values (if not possible with checkInput()) 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 492 of file class.ilShopPurchaseGUI.php.

References ilPageObject\_exists().

Referenced by showDemoVersion().

493  {
494  // page object
495  include_once 'Services/Payment/classes/class.ilShopPage.php';
496  include_once 'Services/Payment/classes/class.ilShopPageGUI.php';
497 
498  // if page does not exist, return nothing
499  if(!ilShopPage::_exists('shop', $a_payment_object_id))
500  {
501  return '';
502  }
503 
504  include_once 'Services/Style/classes/class.ilObjStyleSheet.php';
505  // get page object
506  $page_gui = new ilShopPageGUI($a_payment_object_id);
507 
508  return $page_gui->showPage();
509  }
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 162 of file class.ilShopPurchaseGUI.php.

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

Referenced by showDemoVersion().

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

References $ilUser, and ilPaymentObject\_lookupPobjectId().

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

551  {
552  global $ilUser;
553  $this->pobject = new ilPaymentObject($ilUser ,ilPaymentObject::_lookupPobjectId($this->ref_id));
554  return true;
555  }
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 556 of file class.ilShopPurchaseGUI.php.

Referenced by showDemoVersion(), and showDetails().

557  {
558  include_once './Services/Payment/classes/class.ilPaymentPrices.php';
559  $this->price_obj = new ilPaymentPrices($this->pobject->getPobjectId());
560  return true;
561  }
+ Here is the caller graph for this function:

◆ __initShoppingCartObject()

ilShopPurchaseGUI::__initShoppingCartObject ( )
private

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

References $ilUser.

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

543  {
544  global $ilUser;
545  include_once './Services/Payment/classes/class.ilPaymentShoppingCart.php';
546  $this->sc_obj = new ilPaymentShoppingCart($ilUser);
547  return true;
548  }
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 253 of file class.ilShopPurchaseGUI.php.

References ilObject\_getIcon().

Referenced by __getCourseItemsHTML().

254  {
255  $icon = ilObject::_getIcon($this->object->getId());
256  $title = $this->lng->txt("objs_".$a_type);
257  $header_id = "th_".$a_type;
258 
259  if ($a_show_image)
260  {
261  $a_tpl->setCurrentBlock("container_header_row_image");
262  $a_tpl->setVariable("HEADER_IMG", $icon);
263  $a_tpl->setVariable("HEADER_ALT", $title);
264  }
265  else
266  {
267  $a_tpl->setCurrentBlock("container_header_row");
268  }
269 
270  $a_tpl->setVariable("BLOCK_HEADER_CONTENT", $title);
271  $a_tpl->setVariable("BLOCK_HEADER_ID", $header_id);
272  $a_tpl->parseCurrentBlock();
273  $a_tpl->touchBlock("container_row");
274  }
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
+ 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 283 of file class.ilShopPurchaseGUI.php.

References $ilSetting, $path, ilObject\_getIcon(), and ilContainer\_lookupIconPath().

Referenced by __getCourseItemsHTML().

285  {
286  global $ilSetting;
287 
288  $this->cur_row_type = ($this->cur_row_type == "row_type_1")
289  ? "row_type_2"
290  : "row_type_1";
291  $a_tpl->touchBlock($this->cur_row_type);
292 
293  if ($a_image_type != "")
294  {
295  if (!is_array($a_image_type) && !in_array($a_image_type, array("lm", "dbk", "htlm", "sahs")))
296  {
297  $icon = ilObject::_getIcon($this->object->getId());
298  $title = $this->lng->txt("obj_".$a_image_type);
299  }
300  else
301  {
302  $icon = ilObject::_getIcon($this->object->getId());
303  $title = $this->lng->txt("learning_resource");
304  }
305 
306  // custom icon
307  if ($ilSetting->get("custom_icons") &&
308  in_array($a_image_type, array("cat","grp","crs")))
309  {
310  require_once("./Services/Container/classes/class.ilContainer.php");
311  if (($path = ilContainer::_lookupIconPath($a_item_obj_id, "small")) != "")
312  {
313  $icon = $path;
314  }
315  }
316 
317  $a_tpl->setCurrentBlock("block_row_image");
318  $a_tpl->setVariable("ROW_IMG", $icon);
319  $a_tpl->setVariable("ROW_ALT", $title);
320  $a_tpl->parseCurrentBlock();
321  }
322  else
323  {
324  $a_tpl->setVariable("ROW_NBSP", " ");
325  }
326  $a_tpl->setCurrentBlock("container_standard_row");
327  $a_tpl->setVariable("BLOCK_ROW_CONTENT", $a_html);
328  $rel_headers = ($a_related_header != "")
329  ? "th_selected_items ".$a_related_header
330  : "th_selected_items";
331  $a_tpl->setVariable("BLOCK_ROW_HEADERS", $rel_headers);
332  $a_tpl->parseCurrentBlock();
333  $a_tpl->touchBlock("container_row");
334  }
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
_lookupIconPath($a_id, $a_size="big")
lookup icon path
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 511 of file class.ilShopPurchaseGUI.php.

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

512  {
513  global $ilTabs;
514 
515  $ilTabs->setTabActive('buy');
516 
517  if(!isset($_POST['price_id']))
518  {
519  ilUtil::sendInfo($this->lng->txt('pay_select_price'));
520  $this->showDetails();
521 
522  return true;
523  }
524  else
525  {
526  $this->__initPaymentObject();
527 
528  $this->__initShoppingCartObject();
529 
530  $this->sc_obj->setSessionId(session_id());
531  $this->sc_obj->setPriceId((int) $_POST['price_id']);
532  $this->sc_obj->setPobjectId($this->pobject->getPobjectId());
533  $this->sc_obj->add();
534 
535  ilUtil::redirect('ilias.php?baseClass=ilShopController&cmd=redirect&redirect_class=ilshopshoppingcartgui');
536 
537  return true;
538  }
539  }
$_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 157 of file class.ilShopPurchaseGUI.php.

Referenced by __getCourseItemsHTML().

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

◆ resetRowType()

ilShopPurchaseGUI::resetRowType ( )
private

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

Referenced by __getCourseItemsHTML().

242  {
243  $this->cur_row_type = "";
244  }
+ 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(), ilObject\_getIcon(), ilObjectFactory\getInstanceByRefId(), and ilShopPublicSectionSelector\getOutput().

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  $icon = ilObject::_getIcon($this->object->getId());
109  $this->tpl->setVariable("TYPE_IMG", $icon);
110  $this->tpl->setVariable("ALT_IMG", $this->lng->txt('obj_'.$this->object->getType()));
111  $this->tpl->setVariable("TITLE", $this->object->getTitle());
112  }
113  else
114  {
115  $this->tpl->setVariable("TITLE",$this->lng->txt('object_not_found'));
116  }
117 
118 
119 
120  // abstracts
121  if(($abstract_html = $this->__getAbstractHTML($this->pobject->getPobjectId())) != '')
122  {
123  $this->tpl->setCurrentBlock('abstract_block');
124  $this->tpl->setVariable('TXT_ABSTRACT', $this->lng->txt('pay_abstract'));
125  $this->tpl->setVariable('ABSTRACT_HTML', $abstract_html);
126  $this->tpl->parseCurrentBlock();
127  }
128 
129  // public content ilias lm
130  global $ilObjDataCache;
131  if($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->pobject->getRefId())) == 'lm')
132  {
133  include_once 'Modules/LearningModule/classes/class.ilShopPublicSectionSelector.php';
134  $exp = new ilShopPublicSectionSelector($this->ctrl->getLinkTarget($this, 'layout'),
135  ilObjectFactory::getInstanceByRefId($this->pobject->getRefId()), get_class($this));
136  $exp->setTargetGet('obj_id');
137  $exp->setOutput(0);
138  $output = $exp->getOutput();
139 
140  if(trim($output) != '')
141  {
142 
143  $this->tpl->setCurrentBlock('public_content_block');
144  $this->tpl->setVariable('TXT_CONTENT', $this->lng->txt('content'));
145  $this->tpl->setVariable('PUBLIC_CONTENT_HTML', $output);
146  $this->tpl->parseCurrentBlock();
147  }
148  }
149  else if($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->pobject->getRefId())) == 'crs')
150  {
151  $oCourse = ilObjectFactory::getInstanceByRefId($this->pobject->getRefId());
152  $items = $oCourse->getSubItems();
153  $this->__getCourseItemsHTML($items);
154  }
155  }
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
__getCourseItemsHTML($container_items)
__getAbstractHTML($a_payment_object_id)
+ Here is the call graph for this function:

◆ showDetails()

ilShopPurchaseGUI::showDetails ( )

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

References $ilUser, __initPaymentObject(), __initPricesObject(), __initShoppingCartObject(), ilPaymentPrices\_formatPriceToString(), ilObject\_getIcon(), ilPaymentBookings\_hasAccesstoExtensionPrice(), ilDatePresentation\formatDate(), IL_CAL_DATE, ilUtil\sendFailure(), ilUtil\sendInfo(), ilRadioGroupInputGUI\setValue(), ilNonEditableValueGUI\setValue(), ilPaymentPrices\TYPE_DURATION_DATE, ilPaymentPrices\TYPE_DURATION_MONTH, and ilPaymentPrices\TYPE_UNLIMITED_DURATION.

Referenced by addToShoppingCart().

337  {
338  global $ilMainMenu, $ilTabs, $ilToolbar, $ilUser;
339 
340  $this->__initPaymentObject();
341  $this->__initPricesObject();
342  $this->__initShoppingCartObject();
343 
344  $ilToolbar->addButton($this->lng->txt('payment_back_to_shop'),'ilias.php?baseClass=ilShopController');
345 
346  $this->tpl->getStandardTemplate();
347  $ilTabs->setTabActive('buy');
348  $ilMainMenu->setActive('shop');
349 
350  if($this->pobject->getStatus() == $this->pobject->STATUS_EXPIRES)
351  {
352  ilUtil::sendInfo($this->lng->txt('pay_expires_info'));
353  return false;
354  }
355 
356  $extension_prices = array();
357 
358  if($ilUser->getId() != ANONYMOUS_USER_ID)
359  {
360  include_once './Services/Payment/classes/class.ilPaymentBookings.php';
361  $has_extension_price = ilPaymentBookings::_hasAccesstoExtensionPrice(
362  $ilUser->getId(), $this->pobject->getPobjectId());
363 
364  if($has_extension_price)
365  {
366  $extension_prices = $this->price_obj->getExtensionPrices();
367  }
368  }
369 
370  $org_prices = $this->price_obj->getPrices();
371  $tmp_prices = array_merge($org_prices, $extension_prices );
372 
373  $prices = array();
374  foreach($tmp_prices as $price)
375  {
376  // expired prices must be filtered out
377  if($price['price_type'] == ilPaymentPrices::TYPE_DURATION_DATE && $price['duration_until'] < date('Y-m-d'))
378  {
379  //do nothing
380  }
381  else
382  {
383  $prices[] = $price;
384  }
385  }
386 
387  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
388  $form = new ilPropertyFormGUI();
389  $form->setFormAction($this->ctrl->getFormAction($this));
390 
391  $buyedObject = "";
392  if($this->sc_obj->isInShoppingCart($this->pobject->getPobjectId()))
393  {
394  $buyedObject = $this->sc_obj->getEntry($this->pobject->getPobjectId());
395  if (is_array($prices) &&
396  count($prices) > 1)
397  {
398  ilUtil::sendInfo($this->lng->txt('pay_item_already_in_sc_choose_another'));
399  }
400  else
401  {
402  ilUtil::sendInfo($this->lng->txt('pay_item_already_in_sc'));
403  }
404  }
405 
406  $this->ctrl->setParameter($this, "ref_id", $this->pobject->getRefId());
407  $subtype = '';
408  if($this->object)
409  {
410  if($this->object->getType() == 'exc')
411  {
412  $subtype = ' ('.$this->lng->txt($this->pobject->getSubtype()).')';
413  }
414 
415  $form->setTitle($this->object->getTitle().' '.$subtype);
416  $form->setTitleIcon(ilObject::_getIcon($this->object->getId()));
417  }
418  else
419  {
420  ilUtil::sendFailure($this->lng->txt('object_not_found'));
421  }
422  // payment infos
423  $info = new ilNonEditableValueGUI($this->lng->txt('info'));
424  $info->setValue($this->lng->txt('pay_info'));
425  $form->addItem($info);
426 
427  if (is_array($buyedObject))
428  {
429  if (is_array($prices) && count($prices) > 1)
430  {
431  $button_txt = $this->lng->txt('pay_change_price');
432  }
433  else
434  {
435  $button_txt = $this->lng->txt('pay_add_to_shopping_cart');
436  }
437  }
438  else
439  {
440  $button_txt = $this->lng->txt('pay_add_to_shopping_cart');
441  }
442 
443  $rg_prices = new ilRadioGroupInputGUI($this->lng->txt('prices'), 'price_id');
444 
445  if (is_array($prices))
446  {
447  foreach($prices as $price)
448  {
449  if (is_array($buyedObject) && $buyedObject["price_id"] == $price['price_id'])
450  {
451  $rg_prices->setValue($price['price_id']);
452  }
453  else if (count($prices) == 1)
454  {
455  $rg_prices->setValue($price['price_id']);
456  }
457 
458  switch($price['price_type'])
459  {
461  $txt_price = $price['duration'].' '.$this->lng->txt('paya_months').': ';
462  break;
464  $txt_price = ilDatePresentation::formatDate(new ilDate($price['duration_from'], IL_CAL_DATE))
465  .' - '.ilDatePresentation::formatDate(new ilDate($price['duration_until'], IL_CAL_DATE)).': ';
466  break;
468  $txt_price = $this->lng->txt('unlimited_duration').': ';
469  break;
470  }
471 
472  $tmp_price = $price['price'];
473 
474  $extension_txt = '';
475  if($price['extension'] == 1)
476  {
477  $extension_txt = '(' . $this->lng->txt('extension_price') . ')';
478  }
479 
480  $price_row = new ilRadioOption($txt_price .' '. ilPaymentPrices::_formatPriceToString((float)$tmp_price).' '.$extension_txt, $price['price_id'] );
481  $price_row->setInfo($price['description']);
482 
483  $rg_prices->addOption($price_row);
484  }
485  $form->addItem($rg_prices);
486  }
487 
488  $form->addCommandButton('addToShoppingCart', $button_txt );
489  return $this->tpl->setContent($form->getHTML());
490  }
This class represents an option in a radio group.
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
static _formatPriceToString($a_price)
This class represents a property form user interface.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
This class represents a property in a property form.
Class for single dates.
static formatDate(ilDateTime $date)
Format a date public.
static _hasAccesstoExtensionPrice($a_user_id, $a_pobject_id)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
const IL_CAL_DATE
This class represents a non editable value in a property form.
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: