4require_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())
 
   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);                         
 
   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));
 
  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());
 
  115                                $this->tpl->setVariable(
"TITLE",$this->lng->txt(
'object_not_found'));
 
  121                if(($abstract_html = $this->
__getAbstractHTML($this->pobject->getPobjectId())) != 
'')
 
  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();
 
  130                global $ilObjDataCache;
 
  131                if($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->pobject->getRefId())) == 
'lm')
 
  133                        include_once  
'Modules/LearningModule/classes/class.ilShopPublicSectionSelector.php';
 
  136                        $exp->setTargetGet(
'obj_id');
 
  138                        $output = $exp->getOutput();
 
  140                        if(trim($output) != 
'')
 
  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();
 
  149                else if($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->pobject->getRefId())) == 
'crs')
 
  152                        $items = $oCourse->getSubItems();
 
  159                return is_array($items[$type_group]) ? $items[$type_group] : array();
 
  168                $tpl_sub_items = 
new ilTemplate(
'tpl.pay_purchase_demo_list_block.html', 
true, 
true, 
'Services/Payment');
 
  170                $objtype_groups = 
$objDefinition->getGroupedRepositoryObjectTypes(
 
  171                        array(
'cat', 
'crs', 
'grp', 
'fold')
 
  174                foreach($objtype_groups as $grp => $grpdata)
 
  179                        $item_html = array();
 
  180                        $rel_header = 
'th_'.$grp;
 
  182                        if(count($items) > 0)
 
  184                                foreach($items as $item)
 
  186                                        if($item[
'title'] != 
'')
 
  188                                                $item_html[] = array(
 
  189                                                        'html' => $item[
'title'], 
 
  190                                                        'item_ref_id' => $item[
'ref_id'],
 
  191                                                        'item_obj_id' => $item[
'obj_id']
 
  197                                if(count($item_html) > 0)
 
  202                                        if(
$ilSetting->get(
'icon_position_in_lists') == 
'item_rows')
 
  213                                        foreach($item_html as $item)
 
  215                                                if(
$ilSetting->get(
'icon_position_in_lists') == 
'item_rows')
 
  218                                                        $this->
addStandardRow($tpl_sub_items, $item[
'html'], $item[
'item_obj_id'], 
 
  219                                                                $item[
'item_icon_image_type'], 
 
  225                                                        $this->
addStandardRow($tpl_sub_items, $item[
'html'], $item[
'item_obj_id'], 
'', $rel_header);
 
  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();
 
  243                $this->cur_row_type = 
"";
 
  256                $title = $this->lng->txt(
"objs_".$a_type);
 
  257                $header_id = 
"th_".$a_type;
 
  261                        $a_tpl->setCurrentBlock(
"container_header_row_image");
 
  262                        $a_tpl->setVariable(
"HEADER_IMG", $icon);
 
  263                        $a_tpl->setVariable(
"HEADER_ALT", $title);
 
  267                        $a_tpl->setCurrentBlock(
"container_header_row");
 
  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");
 
  284        $a_image_type = 
"", $a_related_header = 
"")
 
  288                $this->cur_row_type = ($this->cur_row_type == 
"row_type_1")
 
  291                $a_tpl->touchBlock($this->cur_row_type);
 
  293                if ($a_image_type != 
"")
 
  295                        if (!is_array($a_image_type) && !in_array($a_image_type, array(
"lm", 
"dbk", 
"htlm", 
"sahs")))
 
  298                                $title = $this->lng->txt(
"obj_".$a_image_type);
 
  303                                $title = $this->lng->txt(
"learning_resource");
 
  308                        in_array($a_image_type, array(
"cat",
"grp",
"crs")))
 
  310                                require_once(
"./Services/Container/classes/class.ilContainer.php");
 
  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();
 
  324                        $a_tpl->setVariable(
"ROW_NBSP", 
" ");
 
  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");
 
  338                global $ilMainMenu, $ilTabs, $ilToolbar, 
$ilUser;
 
  344                $ilToolbar->addButton($this->lng->txt(
'payment_back_to_shop'),
'ilias.php?baseClass=ilShopController');
 
  346                $this->tpl->getStandardTemplate();
 
  347                $ilTabs->setTabActive(
'buy');
 
  348                $ilMainMenu->setActive(
'shop');
 
  350                if($this->pobject->getStatus() == $this->pobject->STATUS_EXPIRES)
 
  356                $extension_prices = array();
 
  358                if(
$ilUser->getId() != ANONYMOUS_USER_ID)
 
  360                        include_once 
'./Services/Payment/classes/class.ilPaymentBookings.php';
 
  362                                                $ilUser->getId(), $this->pobject->getPobjectId());
 
  364                        if($has_extension_price)
 
  366                                $extension_prices = $this->price_obj->getExtensionPrices();
 
  370                $org_prices = $this->price_obj->getPrices();
 
  371                $tmp_prices = array_merge($org_prices, $extension_prices );
 
  374                foreach($tmp_prices as $price)
 
  387                include_once 
'./Services/Form/classes/class.ilPropertyFormGUI.php';
 
  389                $form->setFormAction($this->ctrl->getFormAction($this));
 
  392                if($this->sc_obj->isInShoppingCart($this->pobject->getPobjectId()))
 
  394                        $buyedObject = $this->sc_obj->getEntry($this->pobject->getPobjectId());
 
  395                        if (is_array($prices) &&
 
  406                $this->ctrl->setParameter($this, 
"ref_id", $this->pobject->getRefId());
 
  410                        if($this->object->getType() == 
'exc')
 
  412                                $subtype = 
' ('.$this->lng->txt($this->pobject->getSubtype()).
')';
 
  415                        $form->setTitle($this->object->getTitle().
' '.$subtype);
 
  424                $info->setValue($this->lng->txt(
'pay_info'));
 
  425                $form->addItem($info);
 
  427                if (is_array($buyedObject))
 
  429                        if (is_array($prices) && count($prices) > 1)
 
  431                                $button_txt = $this->lng->txt(
'pay_change_price');
 
  435                                $button_txt = $this->lng->txt(
'pay_add_to_shopping_cart');
 
  440                        $button_txt = $this->lng->txt(
'pay_add_to_shopping_cart');
 
  445                if (is_array($prices))
 
  447                        foreach($prices as $price)
 
  449                                if (is_array($buyedObject) && $buyedObject[
"price_id"] == $price[
'price_id'])
 
  451                                        $rg_prices->setValue($price[
'price_id']);
 
  453                                else if (count($prices) == 1)
 
  455                                        $rg_prices->setValue($price[
'price_id']);
 
  458                                switch($price[
'price_type'])
 
  461                                                $txt_price = $price[
'duration'].
' '.$this->lng->txt(
'paya_months').
': ';
 
  468                                                $txt_price = $this->lng->txt(
'unlimited_duration').
': ';
 
  472                                $tmp_price = $price[
'price'];
 
  475                                if($price[
'extension'] == 1)
 
  477                                        $extension_txt = 
'(' . $this->lng->txt(
'extension_price') . 
')';
 
  481                                $price_row->setInfo($price[
'description']);
 
  483                                $rg_prices->addOption($price_row);
 
  485                        $form->addItem($rg_prices);
 
  488                $form->addCommandButton(
'addToShoppingCart', $button_txt );
 
  489                return $this->tpl->setContent($form->getHTML());
 
  495                include_once 
'Services/Payment/classes/class.ilShopPage.php';
 
  496                include_once 
'Services/Payment/classes/class.ilShopPageGUI.php';
 
  504                include_once 
'Services/Style/classes/class.ilObjStyleSheet.php';
 
  508                return $page_gui->showPage();
 
  515                $ilTabs->setTabActive(
'buy');           
 
  517                if(!isset(
$_POST[
'price_id']))
 
  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();
 
  535                        ilUtil::redirect(
'ilias.php?baseClass=ilShopController&cmd=redirect&redirect_class=ilshopshoppingcartgui');
 
  545                include_once 
'./Services/Payment/classes/class.ilPaymentShoppingCart.php';
 
  558                include_once 
'./Services/Payment/classes/class.ilPaymentPrices.php';
 
  559                $this->price_obj = 
new ilPaymentPrices($this->pobject->getPobjectId());
 
_lookupIconPath($a_id, $a_size="big")
lookup icon path
static formatDate(ilDateTime $date)
Format a date @access public.
This class represents a non editable value in a property form.
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
Class ilObjectGUI Basic methods of all Output classes.
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
static _exists($a_parent_type, $a_id, $a_lang="")
Checks whether page exists.
static _hasAccesstoExtensionPrice($a_user_id, $a_pobject_id)
static _lookupPobjectId($a_ref_id)
static _formatPriceToString($a_price)
const TYPE_UNLIMITED_DURATION
const TYPE_DURATION_MONTH
This class represents an option in a radio group.
addStandardRow(&$a_tpl, $a_html, $a_item_obj_id="", $a_image_type="", $a_related_header="")
adds a standard row to a block template
__getCourseItemsHTML($container_items)
__initShoppingCartObject()
addHeaderRow($a_tpl, $a_type, $a_show_image=true)
adds a header row to a block template
executeCommand()
execute command
__getAbstractHTML($a_payment_object_id)
getItemsByObjType($items, $type_group)
special template class to simplify handling of ITX/PEAR
static redirect($a_script)
http redirect to other script
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.