4 require_once
"./Services/Object/classes/class.ilObjectGUI.php";
32 $this->ctrl->saveParameter($this, array(
"ref_id"));
37 $this->lng->loadLanguageModule(
'payment');
41 $this->ref_id = $a_ref_id;
45 $this->tpl->getStandardTemplate();
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');
51 $this->ctrl->setParameter($this,
'purchasetype', (
$_GET[
'purchasetype'] ==
'demo' ?
'demo' :
'buy'));
60 $cmd = $this->ctrl->getCmd();
61 switch($this->ctrl->getCmdClass())
63 case 'ilpageobjectgui':
65 include_once
'Services/Style/classes/class.ilObjStyleSheet.php';
66 include_once
'Services/COPage/classes/class.ilPageObjectGUI.php';
67 $page_gui =
new ilPageObjectGUI(
'shop', $this->pobject->getPobjectId());
68 $this->ctrl->forwardCommand($page_gui);
76 case 'addToShoppingCart':
80 if(!in_array(
$cmd, array(
'showDemoVersion',
'showDetails',
'addToShoppingCart')))
82 $cmd = (
$_GET[
'purchasetype'] ==
'demo' ?
'showDemoVersion' :
'showDetails');
92 global $ilMainMenu, $ilTabs, $ilToolbar;
98 $ilToolbar->addButton($this->lng->txt(
'payment_back_to_shop'),
'ilias.php?baseClass=ilShopController');
100 $ilTabs->setTabActive(
'payment_demo');
101 $ilMainMenu->setActive(
'shop');
102 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.shop_abstract_details.html',
'Services/Payment');
104 $this->tpl->setVariable(
"DETAILS_FORMACTION",$this->ctrl->getFormAction($this));
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());
114 $this->tpl->setVariable(
"TITLE",$this->lng->txt(
'object_not_found'));
120 if(($abstract_html = $this->
__getAbstractHTML($this->pobject->getPobjectId())) !=
'')
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();
129 global $ilObjDataCache;
130 if($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->pobject->getRefId())) ==
'lm')
132 include_once
'Modules/LearningModule/classes/class.ilShopPublicSectionSelector.php';
137 $output = $exp->getOutput();
139 if(trim($output) !=
'')
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();
148 else if($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->pobject->getRefId())) ==
'crs')
151 $items = $oCourse->getSubItems();
158 return is_array($items[$type_group]) ? $items[$type_group] : array();
167 $tpl_sub_items =
new ilTemplate(
'tpl.pay_purchase_demo_list_block.html',
true,
true,
'Services/Payment');
169 $objtype_groups = $objDefinition->getGroupedRepositoryObjectTypes(
170 array(
'cat',
'crs',
'grp',
'fold')
173 foreach($objtype_groups as $grp => $grpdata)
178 $item_html = array();
179 $rel_header =
'th_'.$grp;
181 if(count($items) > 0)
183 foreach($items as $item)
185 if($item[
'title'] !=
'')
187 $item_html[] = array(
188 'html' => $item[
'title'],
189 'item_ref_id' => $item[
'ref_id'],
190 'item_obj_id' => $item[
'obj_id']
196 if(count($item_html) > 0)
201 if($ilSetting->get(
'icon_position_in_lists') ==
'item_rows')
212 foreach($item_html as $item)
214 if($ilSetting->get(
'icon_position_in_lists') ==
'item_rows')
217 $this->
addStandardRow($tpl_sub_items, $item[
'html'], $item[
'item_obj_id'],
218 $item[
'item_icon_image_type'],
224 $this->
addStandardRow($tpl_sub_items, $item[
'html'], $item[
'item_obj_id'],
'', $rel_header);
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();
242 $this->cur_row_type =
"";
255 $title = $this->lng->txt(
"objs_".$a_type);
256 $header_id =
"th_".$a_type;
260 $a_tpl->setCurrentBlock(
"container_header_row_image");
261 $a_tpl->setVariable(
"HEADER_IMG", $icon);
262 $a_tpl->setVariable(
"HEADER_ALT",
$title);
266 $a_tpl->setCurrentBlock(
"container_header_row");
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");
283 $a_image_type =
"", $a_related_header =
"")
287 $this->cur_row_type = ($this->cur_row_type ==
"row_type_1")
290 $a_tpl->touchBlock($this->cur_row_type);
292 if ($a_image_type !=
"")
294 if (!is_array($a_image_type) && !in_array($a_image_type, array(
"lm",
"dbk",
"htlm",
"sahs")))
297 $title = $this->lng->txt(
"obj_".$a_image_type);
302 $title = $this->lng->txt(
"learning_resource");
306 if ($ilSetting->get(
"custom_icons") &&
307 in_array($a_image_type, array(
"cat",
"grp",
"crs")))
309 require_once(
"./Services/Container/classes/class.ilContainer.php");
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();
323 $a_tpl->setVariable(
"ROW_NBSP",
" ");
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");
337 global $ilMainMenu, $ilTabs, $ilToolbar,
$ilUser;
343 $ilToolbar->addButton($this->lng->txt(
'payment_back_to_shop'),
'ilias.php?baseClass=ilShopController');
345 $this->tpl->getStandardTemplate();
346 $ilTabs->setTabActive(
'buy');
347 $ilMainMenu->setActive(
'shop');
349 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.pay_purchase_details.html',
'Services/Payment');
351 if($this->pobject->getStatus() == $this->pobject->STATUS_EXPIRES)
358 $extension_prices = array();
360 if($ilUser->getId() != ANONYMOUS_USER_ID)
362 include_once
'./Services/Payment/classes/class.ilPaymentBookings.php';
364 $ilUser->getId(), $this->pobject->getPobjectId());
367 if($has_extension_price)
369 $extension_prices = $this->price_obj->getExtensionPrices();
373 $org_prices = $this->price_obj->getPrices();
374 $tmp_prices = array_merge($org_prices, $extension_prices );
377 foreach($tmp_prices as $price)
391 if($this->sc_obj->isInShoppingCart($this->pobject->getPobjectId()))
393 $buyedObject = $this->sc_obj->getEntry($this->pobject->getPobjectId());
394 if (is_array($prices) &&
404 $this->tpl->setCurrentBlock(
"shopping_cart_1");
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");
412 $this->ctrl->setParameter($this,
"ref_id", $this->pobject->getRefId());
416 if($this->object->getType() ==
'exc')
418 $subtype =
' ('.$this->lng->txt($this->pobject->getSubtype()).
')';
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);
428 $this->tpl->setVariable(
"DETAILS_FORMACTION",$this->ctrl->getFormAction($this));
429 $this->tpl->setVariable(
"TITLE",$this->lng->txt(
'object_not_found'));
432 $this->tpl->setVariable(
"TXT_INFO",$this->lng->txt(
'info'));
434 $this->tpl->setVariable(
"INFO_PAY",$this->lng->txt(
'pay_info'));
435 if (is_array($buyedObject))
437 if (is_array($prices) && count($prices) > 1)
439 $this->tpl->setVariable(
"INPUT_CMD",
'addToShoppingCart');
440 $this->tpl->setVariable(
"INPUT_VALUE",$this->lng->txt(
'pay_change_price'));
444 $this->tpl->setVariable(
"INPUT_CMD",
'addToShoppingCart');
445 $this->tpl->setVariable(
"INPUT_VALUE",$this->lng->txt(
'pay_add_to_shopping_cart'));
450 $this->tpl->setVariable(
"INPUT_CMD",
'addToShoppingCart');
451 $this->tpl->setVariable(
"INPUT_VALUE",$this->lng->txt(
'pay_add_to_shopping_cart'));
454 $this->tpl->setVariable(
"ROWSPAN",count($prices));
455 $this->tpl->setVariable(
"TXT_PRICES",$this->lng->txt(
'prices'));
457 if (is_array($prices))
460 foreach($prices as $price)
464 $placeholderCheckbox =
"CHECKBOX";
465 $placeholderDuration =
"DURATION";
466 $placeholderPrice =
"PRICE";
467 $placeholderDescription =
"DESCRIPTION";
471 $placeholderCheckbox =
"ROW_CHECKBOX";
472 $placeholderDuration =
"ROW_DURATION";
473 $placeholderPrice =
"ROW_PRICE";
474 $placeholderDescription =
"ROW_DESCRIPTION";
476 $this->tpl->setCurrentBlock(
"price_row");
477 if ($buyedObject[
"price_id"] == $price[
'price_id'])
481 else if (count($prices) == 1)
490 switch($price[
'price_type'])
493 $this->tpl->setVariable($placeholderDuration,$price[
'duration'].
' '.$this->lng->txt(
'paya_months').
': ');
497 $this->tpl->setVariable($placeholderDuration,
502 $this->tpl->setVariable($placeholderDuration, $this->lng->txt(
'unlimited_duration').
': ');
506 $tmp_price = $price[
'price'];
508 if($price[
'extension'] == 1)
509 $extension_txt =
'('.$this->lng->txt(
'extension_price').
')';
510 else $extension_txt =
'';
513 if($price[
'description'] != NULL)
515 $this->tpl->setVariable($placeholderDescription, $price[
'description']);
517 $this->tpl->parseCurrentBlock();
527 include_once
'Services/COPage/classes/class.ilPageObject.php';
528 include_once
'Services/COPage/classes/class.ilPageObjectGUI.php';
536 include_once
'Services/Style/classes/class.ilObjStyleSheet.php';
539 $page_gui->setIntLinkHelpDefault(
'StructureObject', $a_payment_object_id);
540 $page_gui->setLinkXML(
'');
541 $page_gui->setFileDownloadLink($this->ctrl->getLinkTargetByClass(
'ilPageObjectGUI',
'downloadFile'));
542 $page_gui->setFullscreenLink($this->ctrl->getLinkTargetByClass(
'ilPageObjectGUI',
'displayMediaFullscreen'));
543 $page_gui->setSourcecodeDownloadScript($this->ctrl->getLinkTargetByClass(
'ilPageObjectGUI',
'download_paragraph'));
544 $page_gui->setPresentationTitle(
'');
545 $page_gui->setTemplateOutput(
false);
546 $page_gui->setHeader(
'');
547 $page_gui->setEnabledRepositoryObjects(
false);
548 $page_gui->setEnabledFileLists(
false);
549 $page_gui->setEnabledPCTabs(
true);
550 $page_gui->setEnabledMaps(
true);
552 return $page_gui->showPage();
559 $ilTabs->setTabActive(
'buy');
561 if(!isset(
$_POST[
'price_id']))
574 $this->sc_obj->setSessionId(session_id());
575 $this->sc_obj->setPriceId((
int)
$_POST[
'price_id']);
576 $this->sc_obj->setPobjectId($this->pobject->getPobjectId());
577 $this->sc_obj->add();
579 ilUtil::redirect(
'ilias.php?baseClass=ilShopController&cmd=redirect&redirect_class=ilshopshoppingcartgui');
589 include_once
'./Services/Payment/classes/class.ilPaymentShoppingCart.php';
602 include_once
'./Services/Payment/classes/class.ilPaymentPrices.php';
603 $this->price_obj =
new ilPaymentPrices($this->pobject->getPobjectId());