4 require_once
"./classes/class.ilObjectGUI.php";
29 $this->ctrl->saveParameter($this, array(
"ref_id"));
35 $this->lng->loadLanguageModule(
'payment');
39 $this->ref_id = $a_ref_id;
45 $ilTabs->clearTargets();
46 $ilTabs->addTarget(
'buy', $this->ctrl->getLinkTarget($this,
'showDetails').
'&purchasetype=buy');
47 $ilTabs->addTarget(
'payment_demo', $this->ctrl->getLinkTarget($this,
'showDemoVersion').
'&purchasetype=demo');
49 $this->ctrl->setParameter($this,
'purchasetype', (
$_GET[
'purchasetype'] ==
'demo' ?
'demo' :
'buy'));
57 $cmd = $this->ctrl->getCmd();
58 switch($this->ctrl->getCmdClass())
60 case 'ilpageobjectgui':
62 include_once
'Services/Style/classes/class.ilObjStyleSheet.php';
63 include_once
'Services/COPage/classes/class.ilPageObjectGUI.php';
64 $page_gui =
new ilPageObjectGUI(
'shop', $this->pobject->getPobjectId());
65 $this->ctrl->forwardCommand($page_gui);
74 case 'addToShoppingCart':
78 if(!in_array(
$cmd, array(
'showDemoVersion',
'showDetails',
'addToShoppingCart')))
80 $cmd = (
$_GET[
'purchasetype'] ==
'demo' ?
'showDemoVersion' :
'showDetails');
90 global $ilMainMenu, $ilTabs,
$tpl, $ilToolbar;
96 $ilToolbar->addButton($this->lng->txt(
'payment_back_to_shop'),
'ilias.php?baseClass=ilShopController');
98 $ilTabs->setTabActive(
'payment_demo');
99 $ilMainMenu->setActive(
'shop');
100 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.shop_abstract_details.html',
'Services/Payment');
102 $this->tpl->setVariable(
"DETAILS_FORMACTION",$this->ctrl->getFormAction($this));
103 $this->tpl->setVariable(
"TYPE_IMG",
ilUtil::getImagePath(
'icon_'.$this->object->getType().
'_b.gif'));
104 $this->tpl->setVariable(
"ALT_IMG",$this->lng->txt(
'obj_'.$this->object->getType()));
105 $this->tpl->setVariable(
"TITLE",$this->object->getTitle());
108 if(($abstract_html = $this->
__getAbstractHTML($this->pobject->getPobjectId())) !=
'')
110 $this->tpl->setCurrentBlock(
'abstract_block');
111 $this->tpl->setVariable(
'TXT_ABSTRACT', $this->lng->txt(
'pay_abstract'));
112 $this->tpl->setVariable(
'ABSTRACT_HTML', $abstract_html.$output);
113 $this->tpl->parseCurrentBlock();
117 global $ilObjDataCache;
118 if($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->pobject->getRefId())) ==
'lm')
120 include_once
'Modules/LearningModule/classes/class.ilShopPublicSectionSelector.php';
125 $output = $exp->getOutput();
127 if(trim($output) !=
'')
130 $this->tpl->setCurrentBlock(
'public_content_block');
131 $this->tpl->setVariable(
'TXT_CONTENT', $this->lng->txt(
'content'));
132 $this->tpl->setVariable(
'PUBLIC_CONTENT_HTML', $output);
133 $this->tpl->parseCurrentBlock();
136 else if($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->pobject->getRefId())) ==
'crs')
139 $items = $oCourse->getSubItems();
146 return is_array($items[$type_group]) ? $items[$type_group] : array();
155 $tpl_sub_items =
new ilTemplate(
'tpl.pay_purchase_demo_list_block.html',
true,
true,
'Services/Payment');
157 $objtype_groups = $objDefinition->getGroupedRepositoryObjectTypes(
158 array(
'cat',
'crs',
'grp',
'fold')
161 foreach($objtype_groups as $grp => $grpdata)
163 $title = $this->lng->txt(
'objs_'.$grp);
166 $item_html = array();
167 $rel_header =
'th_'.$grp;
169 if(count($items) > 0)
171 foreach($items as $item)
173 if($item[
'title'] !=
'')
175 $item_html[] = array(
176 'html' => $item[
'title'],
177 'item_ref_id' => $item[
'ref_id'],
178 'item_obj_id' => $item[
'obj_id']
184 if(count($item_html) > 0)
189 if($ilSetting->get(
'icon_position_in_lists') ==
'item_rows')
200 foreach($item_html as $item)
202 if($ilSetting->get(
'icon_position_in_lists') ==
'item_rows')
205 $this->
addStandardRow($tpl_sub_items, $item[
'html'], $item[
'item_ref_id'], $item[
'item_obj_id'],
206 $item[
'item_icon_image_type'],
212 $this->
addStandardRow($tpl_sub_items, $item[
'html'], $item[
'item_ref_id'], $item[
'item_obj_id'],
'', $rel_header);
221 $this->tpl->setCurrentBlock(
'public_content_block');
222 $this->tpl->setVariable(
'TXT_CONTENT', $this->lng->txt(
'content'));
223 $this->tpl->setVariable(
'PUBLIC_CONTENT_HTML', $tpl_sub_items->get());
224 $this->tpl->parseCurrentBlock();
230 $this->cur_row_type =
"";
243 $title = $this->lng->txt(
"objs_".$a_type);
244 $header_id =
"th_".$a_type;
248 $a_tpl->setCurrentBlock(
"container_header_row_image");
249 $a_tpl->setVariable(
"HEADER_IMG", $icon);
250 $a_tpl->setVariable(
"HEADER_ALT",
$title);
254 $a_tpl->setCurrentBlock(
"container_header_row");
257 $a_tpl->setVariable(
"BLOCK_HEADER_CONTENT",
$title);
258 $a_tpl->setVariable(
"BLOCK_HEADER_ID", $header_id);
259 $a_tpl->parseCurrentBlock();
260 $a_tpl->touchBlock(
"container_row");
270 private function addStandardRow(&$a_tpl, $a_html, $a_item_ref_id =
"", $a_item_obj_id =
"",
271 $a_image_type =
"", $a_related_header =
"")
275 $this->cur_row_type = ($this->cur_row_type ==
"row_type_1")
278 $a_tpl->touchBlock($this->cur_row_type);
280 if ($a_image_type !=
"")
282 if (!is_array($a_image_type) && !in_array($a_image_type, array(
"lm",
"dbk",
"htlm",
"sahs")))
285 $title = $this->lng->txt(
"obj_".$a_image_type);
290 $title = $this->lng->txt(
"learning_resource");
294 if ($ilSetting->get(
"custom_icons") &&
295 in_array($a_image_type, array(
"cat",
"grp",
"crs")))
297 require_once(
"./Services/Container/classes/class.ilContainer.php");
304 $a_tpl->setCurrentBlock(
"block_row_image");
305 $a_tpl->setVariable(
"ROW_IMG", $icon);
306 $a_tpl->setVariable(
"ROW_ALT",
$title);
307 $a_tpl->parseCurrentBlock();
311 $a_tpl->setVariable(
"ROW_NBSP",
" ");
313 $a_tpl->setCurrentBlock(
"container_standard_row");
314 $a_tpl->setVariable(
"BLOCK_ROW_CONTENT", $a_html);
315 $rel_headers = ($a_related_header !=
"")
316 ?
"th_selected_items ".$a_related_header
317 :
"th_selected_items";
318 $a_tpl->setVariable(
"BLOCK_ROW_HEADERS", $rel_headers);
319 $a_tpl->parseCurrentBlock();
320 $a_tpl->touchBlock(
"container_row");
325 global $ilMainMenu, $ilTabs, $ilToolbar;
327 $ilTabs->setTabActive(
'buy');
329 $ilMainMenu->setActive(
'shop');
335 $ilToolbar->addButton($this->lng->txt(
'payment_back_to_shop'),
'ilias.php?baseClass=ilShopController');
337 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.pay_purchase_details.html',
'Services/Payment');
339 if($this->pobject->getStatus() == $this->pobject->STATUS_EXPIRES)
346 $prices = $this->price_obj->getPrices();
348 if($this->sc_obj->isInShoppingCart($this->pobject->getPobjectId()))
350 $buyedObject = $this->sc_obj->getEntry($this->pobject->getPobjectId());
351 if (is_array($prices) &&
361 $this->tpl->setCurrentBlock(
"shopping_cart");
364 $this->tpl->setVariable(
"LINK_GOTO_SHOPPING_CART",
'ilias.php?baseClass=ilShopController&cmd=redirect&redirect_class=ilShopShoppingCartGUI');
365 $this->tpl->setVariable(
"TXT_GOTO_SHOPPING_CART", $this->lng->txt(
'pay_goto_shopping_cart'));
366 $this->tpl->parseCurrentBlock(
"shopping_cart");
369 $this->ctrl->setParameter($this,
"ref_id", $this->pobject->getRefId());
372 $this->tpl->setVariable(
"DETAILS_FORMACTION",$this->ctrl->getFormAction($this));
373 $this->tpl->setVariable(
"TYPE_IMG",
ilUtil::getImagePath(
'icon_'.$this->object->getType().
'_b.gif'));
374 $this->tpl->setVariable(
"ALT_IMG",$this->lng->txt(
'obj_'.$this->object->getType()));
375 $this->tpl->setVariable(
"TITLE",$this->object->getTitle().
' '.$subtype);
379 $this->tpl->setVariable(
"DETAILS_FORMACTION",$this->ctrl->getFormAction($this));
380 $this->tpl->setVariable(
"TITLE",$this->lng->txt(
'object_not_found'));
383 $this->tpl->setVariable(
"TXT_INFO",$this->lng->txt(
'info'));
385 $this->tpl->setVariable(
"INFO_PAY",$this->lng->txt(
'pay_info'));
386 if (is_array($buyedObject))
388 if (is_array($prices) && count($prices) > 1)
390 $this->tpl->setVariable(
"INPUT_CMD",
'addToShoppingCart');
391 $this->tpl->setVariable(
"INPUT_VALUE",$this->lng->txt(
'pay_change_price'));
396 $this->tpl->setVariable(
"INPUT_CMD",
'addToShoppingCart');
397 $this->tpl->setVariable(
"INPUT_VALUE",$this->lng->txt(
'pay_add_to_shopping_cart'));
400 $this->tpl->setVariable(
"ROWSPAN",count($prices));
401 $this->tpl->setVariable(
"TXT_PRICES",$this->lng->txt(
'prices'));
403 if (is_array($prices))
406 foreach($prices as $price)
410 $placeholderCheckbox =
"CHECKBOX";
411 $placeholderDuration =
"DURATION";
412 $placeholderPrice =
"PRICE";
416 $placeholderCheckbox =
"ROW_CHECKBOX";
417 $placeholderDuration =
"ROW_DURATION";
418 $placeholderPrice =
"ROW_PRICE";
420 $this->tpl->setCurrentBlock(
"price_row");
421 if ($buyedObject[
"price_id"] == $price[
'price_id'])
425 else if (count($prices) == 1)
434 if($price[
'unlimited_duration'] ==
'1')
437 $this->tpl->setVariable($placeholderDuration,
''. $this->lng->txt(
'unlimited_duration').
': ');
440 $this->tpl->setVariable($placeholderDuration,$price[
'duration'].
' '.$this->lng->txt(
'paya_months').
': ');
445 $this->tpl->parseCurrentBlock();
454 include_once
'Services/COPage/classes/class.ilPageObject.php';
455 include_once
'Services/COPage/classes/class.ilPageObjectGUI.php';
463 include_once
'Services/Style/classes/class.ilObjStyleSheet.php';
466 $page_gui->setIntLinkHelpDefault(
'StructureObject', $a_payment_object_id);
467 $page_gui->setLinkXML(
'');
468 $page_gui->setFileDownloadLink($this->ctrl->getLinkTargetByClass(
'ilPageObjectGUI',
'downloadFile'));
469 $page_gui->setFullscreenLink($this->ctrl->getLinkTargetByClass(
'ilPageObjectGUI',
'displayMediaFullscreen'));
470 $page_gui->setSourcecodeDownloadScript($this->ctrl->getLinkTargetByClass(
'ilPageObjectGUI',
'download_paragraph'));
471 $page_gui->setPresentationTitle(
'');
472 $page_gui->setTemplateOutput(
false);
473 $page_gui->setHeader(
'');
474 $page_gui->setEnabledRepositoryObjects(
false);
475 $page_gui->setEnabledFileLists(
false);
476 $page_gui->setEnabledPCTabs(
true);
477 $page_gui->setEnabledMaps(
true);
479 return $page_gui->showPage();
486 $ilTabs->setTabActive(
'buy');
488 if(!isset(
$_POST[
'price_id']))
501 $this->sc_obj->setSessionId(session_id());
502 $this->sc_obj->setPriceId((
int)
$_POST[
'price_id']);
503 $this->sc_obj->setPobjectId($this->pobject->getPobjectId());
504 $this->sc_obj->add();
506 ilUtil::redirect(
'ilias.php?baseClass=ilShopController&cmd=redirect&redirect_class=ilshopshoppingcartgui');
515 include_once
'./Services/Payment/classes/class.ilPaymentShoppingCart.php';
522 include_once
'./Services/Payment/classes/class.ilPaymentObject.php';
528 include_once
'./Services/Payment/classes/class.ilPaymentPrices.php';
529 $this->price_obj =
new ilPaymentPrices($this->pobject->getPobjectId());
535 $this->tpl->addBlockFile(
"CONTENT",
"content",
"tpl.payb_content.html");
536 $this->tpl->setVariable(
"HEADER",$this->object->getTitle());
537 $this->tpl->setVariable(
"DESCRIPTION",$this->object->getDescription());
542 $this->tpl->addBlockFile(
"STATUSLINE",
"statusline",
"tpl.statusline.html");
548 $this->tpl->addBlockFile(
"LOCATOR",
"locator",
"tpl.locator.html",
"Services/Locator");
549 $this->tpl->setVariable(
"TXT_LOCATOR",$this->lng->txt(
"locator"));
551 $this->tpl->setCurrentBlock(
"locator_item");
552 $this->tpl->setVariable(
"ITEM", $this->lng->txt(
"repository"));
553 $this->tpl->setVariable(
"LINK_ITEM",
"../repository.php?getlast=true");
554 $this->tpl->parseCurrentBlock();