ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilShopResultPresentationGUI Class Reference

Class ilShopResultPresentationGUI. More...

+ Collaboration diagram for ilShopResultPresentationGUI:

Public Member Functions

 ilShopResultPresentationGUI ($result)
 showResults ()
 showSpecials ()
 showTopics ()
 setTypeOrdering ($a_type_ordering_array)
 getTypeOrdering ()
 setSortField ($a_sort_field)
 getSortField ()
 setSortDirection ($a_sort_direction)
 getSortDirection ()
 sortResult ($result)
 renderItemList ($results)
 addStandardRow ($a_tpl, $a_html)
 newBlockTemplate ()
 returns a new list block template
 resetRowType ()
 showAdvancedSearchResults ()

Data Fields

 $tpl
 $lng
 $result = 0

Protected Attributes

 $search_cache = null

Private Member Functions

 renderItems ($oContainerTpl, $results, $topic)
 getObjectListItem ($cur_obj_type, $item)

Private Attributes

 $sort_field = ''
 $sort_direction = ''

Detailed Description

Member Function Documentation

ilShopResultPresentationGUI::addStandardRow (   $a_tpl,
  $a_html 
)
Parameters
$a_tpl
$a_html
$a_ref_id

Definition at line 291 of file class.ilShopResultPresentationGUI.php.

Referenced by renderItems().

{
$this->cur_row_type = ($this->cur_row_type == "row_type_1")
? "row_type_2"
: "row_type_1";
$a_tpl->touchBlock($this->cur_row_type);
$a_tpl->setCurrentBlock("container_standard_row");
$a_tpl->setVariable("BLOCK_ROW_CONTENT", $a_html);
$a_tpl->parseCurrentBlock();
$a_tpl->touchBlock("container_row");
}

+ Here is the caller graph for this function:

ilShopResultPresentationGUI::getObjectListItem (   $cur_obj_type,
  $item 
)
private
Parameters
$cur_obj_type
$item
Returns
array

Definition at line 449 of file class.ilShopResultPresentationGUI.php.

References ilObjectListGUIFactory\_getListGUIByType(), ilPaymentObject\_hasAccess(), ilPaymentObject\_lookupPobjectId(), and ilObjectListGUI\CONTEXT_SHOP.

Referenced by renderItems().

{
if($cur_obj_type != $item['type'])
{
include_once 'Services/Object/classes/class.ilObjectListGUIFactory.php';
$item_list_gui = ilObjectListGUIFactory::_getListGUIByType($item['type']);
}
$item_list_gui->initItem($item['ref_id'], $item['obj_id'], $item['title'], $item['description'], ilObjectListGUI::CONTEXT_SHOP);
$item_list_gui->enableDelete(false);
$item_list_gui->enableCut(false);
$item_list_gui->enableCopy(false);
$item_list_gui->enableLink(false);
$item_list_gui->enableSubscribe(false);
$item_list_gui->enablePayment(true);
$item_list_gui->enableCommands(true);
$item_list_gui->enablePath(false);
$item_list_gui->insertCommands();
$item_list_gui->enableInfoScreen(false);
$item_list_gui->enableSubstitutions(false);
$item_list_gui->enableNoticeProperties(false);
$item_list_gui->enablePreconditions(false);
$item_list_gui->enableProperties(false);
$item_list_gui->setBoldTitle(true);
if(ilPaymentObject::_hasAccess($item['ref_id']))
{
$item_list_gui->enableInfoScreen(true);
$item_list_gui->enableCommands(true);
}
// else
// {
switch($item['type'])
{
case 'sahs':
$demo_link = 'ilias.php?baseClass=ilSAHSPresentationGUI&ref_id=' . $item['ref_id'] . '&purchasetype=demo';
break;
case 'lm':
$demo_link = 'ilias.php?baseClass=ilLMPresentationGUI&ref_id=' . $item['ref_id'] . '&purchasetype=demo';
break;
case 'exc':
$demo_link = $this->ctrl->getLinkTargetByClass('ilshoppurchasegui', 'showDemoVersion') . '&purchasetype=demo&ref_id=' . $item["ref_id"];
break;
default:
$demo_link = $this->ctrl->getLinkTargetByClass('ilshoppurchasegui', 'showDemoVersion') . '&purchasetype=demo&ref_id=' . $item["ref_id"];
break;
}
$item['title'] = '<a href="' . $demo_link . '">' . $item["title"] . '</a>';
// }
$tpl_pinfo = new ilTemplate ('tpl.shop_item_info.html', true, true, 'Services/Payment');
if($item['price_string'] != '')
{
$tpl_pinfo->setCurrentBlock('ploop');
$tpl_pinfo->setVariable('PROPERTY', $this->lng->txt('price_a'));
$tpl_pinfo->setVariable('VALUE', $item['price_string']);
$tpl_pinfo->parseCurrentBlock();
}
if($item['author'] != '')
{
$tpl_pinfo->setCurrentBlock('ploop');
$tpl_pinfo->setVariable('PROPERTY', $this->lng->txt('author'));
$tpl_pinfo->setVariable('VALUE', $item['author']);
$tpl_pinfo->parseCurrentBlock();
}
$oFile = new ilFileDataShop(ilPaymentObject::_lookupPobjectId($item['ref_id']));
if(($webpath_file = $oFile->getCurrentImageWebPath()) !== false)
{
$tpl_pinfo->setCurrentBlock('image');
$tpl_pinfo->setVariable('SRC', $webpath_file);
$tpl_pinfo->setVariable('ALT', strip_tags($item['title']));
$tpl_pinfo->parseCurrentBlock();
}
$item_list_gui->addSubItemHTML($tpl_pinfo->get());
$html = $item_list_gui->getListItemHTML($item['ref_id'], $item['obj_id'], $item['title'], $item['description'], false, false, "", ilObjectListGUI::CONTEXT_SHOP);
return array($item, $html);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilShopResultPresentationGUI::getSortDirection ( )

Definition at line 131 of file class.ilShopResultPresentationGUI.php.

References $sort_direction.

{
}
ilShopResultPresentationGUI::getSortField ( )

Definition at line 123 of file class.ilShopResultPresentationGUI.php.

References $sort_field.

{
}
ilShopResultPresentationGUI::getTypeOrdering ( )

Definition at line 115 of file class.ilShopResultPresentationGUI.php.

{
return $this->type_ordering;
}
ilShopResultPresentationGUI::ilShopResultPresentationGUI (   $result)

Definition at line 31 of file class.ilShopResultPresentationGUI.php.

References $ilCtrl, $ilUser, $lng, $result, and ilUserSearchCache\_getInstance().

{
global $lng, $ilCtrl, $ilUser;
$this->lng = $lng;
$this->result = $result;
$this->type_ordering = array(
"cat", "crs", "grp", "chat", "frm", "wiki", "lres",
"glo", "webr", "lm", "sahs", "htlm", "file",'mcst', "exc",
"tst", "svy", "sess","mep", "qpl", "spl");
$this->ctrl = $ilCtrl;
include_once('Services/Search/classes/class.ilUserSearchCache.php');
$this->search_cache = ilUserSearchCache::_getInstance($ilUser->getId());
}

+ Here is the call graph for this function:

ilShopResultPresentationGUI::newBlockTemplate ( )

returns a new list block template

private

Returns
object block template

Definition at line 311 of file class.ilShopResultPresentationGUI.php.

References $tpl.

Referenced by renderItems().

{
$tpl = new ilTemplate ("tpl.container_list_block.html",true, true, "Services/Container");
$this->cur_row_type = "row_type_1";
return $tpl;
}

+ Here is the caller graph for this function:

ilShopResultPresentationGUI::renderItemList (   $results)

Definition at line 273 of file class.ilShopResultPresentationGUI.php.

References $results, and renderItems().

{
$oContainerTpl = new ilTemplate ('tpl.shop_container.html', true, true, 'Services/Payment');
foreach($this->result->getTopics() as $oTopic)
{
$this->renderItems($oContainerTpl, $results, array('id' => $oTopic->getId(), 'title' => $oTopic->getTitle()));
}
$this->renderItems($oContainerTpl, $results, array('id' => 0, 'title' => $this->lng->txt('payment_no_topic')));
return $oContainerTpl->get();
}

+ Here is the call graph for this function:

ilShopResultPresentationGUI::renderItems (   $oContainerTpl,
  $results,
  $topic 
)
private

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

References $ilUser, $ref_id, $results, $tpl, ilShopUtils\_addToShoppingCartSymbol(), ilPaymentPrices\_formatPriceToString(), ilObject\_getIcon(), ilShopUtils\_getPaymethodSymbol(), ilShopUtils\_getSpecialObjectSymbol(), ilPaymentObject\_lookupPobjectId(), addStandardRow(), ilPaymentPrices\getLowestPrice(), getObjectListItem(), newBlockTemplate(), resetRowType(), and sortResult().

Referenced by renderItemList(), showSpecials(), and showTopics().

{
// main shop_content
global $ilUser;
$items_counter = 0;
$cur_obj_type = '';
$tpl = $this->newBlockTemplate();
foreach($this->type_ordering as $act_type)
{
$item_html = array();
if(count($results[(int)$topic['id']][$act_type]))
{
foreach($results[$topic['id']][$act_type] as $key => $item)
{
// price presentation
$oPaymentObject = new ilPaymentObject($ilUser, ilPaymentObject::_lookupPobjectId($item['ref_id']));
$oPrice = new ilPaymentPrices((int)$oPaymentObject->getPobjectId());
$lowest_price = $oPrice->getLowestPrice();
$special_icon = ' ';
if($oPaymentObject->getSpecial() == '1')
{
}
$results[$topic['id']][$act_type][$key]['title'] = $item['title'].' '.
$results[$topic['id']][$act_type][$key]['special_icon'] = $special_icon;
$results[$topic['id']][$act_type][$key]['price'] = $lowest_price['price'];
$paymethod_icon = ilShopUtils::_getPaymethodSymbol($oPaymentObject->getPayMethod());
$shoppingcart_icon = ilShopUtils::_addToShoppingCartSymbol($item['ref_id']);
$results[$topic['id']][$act_type][$key]['price_string'] =
($oPrice->getNumberOfPrices() > 1 ? $this->lng->txt('price_from').' ' : '').
ilPaymentPrices::_formatPriceToString($lowest_price['price']).' '.
//shoppingcart icon
$results[$topic['id']][$act_type][$key]['shoppingcart_icon'] = $shoppingcart_icon.' '.
// paymethod icon
$results[$topic['id']][$act_type][$key]['paymethod_icon'] = $paymethod_icon;
// authors
include_once 'Services/MetaData/classes/class.ilMD.php';
$md_obj = new ilMD($item['obj_id'], 0, $item['type']);
if(is_object($md_section = $md_obj->getLifecycle()))
{
$sep = $ent_str = "";
foreach(($ids = $md_section->getContributeIds()) as $con_id)
{
$md_con = $md_section->getContribute($con_id);
if ($md_con->getRole() == "Author")
{
foreach($ent_ids = $md_con->getEntityIds() as $ent_id)
{
$md_ent = $md_con->getEntity($ent_id);
$ent_str = $ent_str.$sep.$md_ent->getEntity();
$sep = ", ";
}
}
}
$results[$topic['id']][$act_type][$key]['author'] = $ent_str;
}
}
$results[$topic['id']][$act_type] = $this->sortResult($results[$topic['id']][$act_type]);
foreach($results[$topic['id']][$act_type] as $key => $item)
{
// get list gui class for each object type
list($item, $html) = $this->getObjectListItem($cur_obj_type, $item);
if($html)
{
$item_html[$item['ref_id']] = $html;
}
}
// output block for resource type
if(count($item_html) > 0)
{
// add a header for each resource type
$tpl->setCurrentBlock("container_header_row_image");
$tpl->setVariable("HEADER_IMG", ilObject::_getIcon('','', $act_type));
$tpl->setVariable("HEADER_ALT", $this->lng->txt("objs_".$act_type));
$tpl->setVariable("BLOCK_HEADER_CONTENT", $this->lng->txt("objs_".$act_type));
$this->resetRowType();
// content row
foreach($item_html as $ref_id => $html)
{
$this->addStandardRow($tpl, $html);
}
++$items_counter;
}
}
}
if($items_counter > 0)
{
$oContainerTpl->setCurrentBlock('loop_item');
$oContainerTpl->setCurrentBlock('topic_title');
$oContainerTpl->setVariable('TOPIC_TITLE', $topic['title']);
$oContainerTpl->parseCurrentBlock('topic_title');
$oContainerTpl->setVariable('CONTAINER_LIST_BLOCK', $html);
$oContainerTpl->parseCurrentBlock('loop_item');
$tpl->setContent($oContainerTpl->get());
$container_html = $tpl->get();
return $container_html;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilShopResultPresentationGUI::resetRowType ( )

Definition at line 439 of file class.ilShopResultPresentationGUI.php.

Referenced by renderItems().

{
$this->cur_row_type = "";
}

+ Here is the caller graph for this function:

ilShopResultPresentationGUI::setSortDirection (   $a_sort_direction)

Definition at line 127 of file class.ilShopResultPresentationGUI.php.

{
$this->sort_direction = $a_sort_direction;
}
ilShopResultPresentationGUI::setSortField (   $a_sort_field)

Definition at line 119 of file class.ilShopResultPresentationGUI.php.

{
$this->sort_field = $a_sort_field;
}
ilShopResultPresentationGUI::setTypeOrdering (   $a_type_ordering_array)

Definition at line 111 of file class.ilShopResultPresentationGUI.php.

{
$this->type_ordering = $a_type_ordering_array;
}
ilShopResultPresentationGUI::showAdvancedSearchResults ( )

Definition at line 534 of file class.ilShopResultPresentationGUI.php.

References showSpecials().

{
$this->result = $this->result->getResultsForPresentation();
return $this->showSpecials();
}

+ Here is the call graph for this function:

ilShopResultPresentationGUI::showResults ( )

Definition at line 49 of file class.ilShopResultPresentationGUI.php.

References showTopics().

{
// Get results
$this->showTopics();
}

+ Here is the call graph for this function:

ilShopResultPresentationGUI::showSpecials ( )

Definition at line 55 of file class.ilShopResultPresentationGUI.php.

References $result, $results, ilShopTopics\_getInstance(), and renderItems().

Referenced by showAdvancedSearchResults().

{
// Get specials
$oContainerTpl = new ilTemplate ('tpl.shop_container.html', true, true, 'Services/Payment');
include_once './Services/Payment/classes/class.ilShopTopic.php';
include_once './Services/Payment/classes/class.ilShopTopics.php';
ilShopTopics::_getInstance()->setIdFilter(false);
$html = '';
if(count($topics = ilShopTopics::_getInstance()->getTopics()))
{
foreach($topics as $oTopic)
{
$html .= $this->renderItems($oContainerTpl, $results, array('id' => $oTopic->getId(), 'title' => $oTopic->getTitle()));
}
$html .= $this->renderItems($oContainerTpl, $results, array('id' => 0, 'title' => $this->lng->txt('payment_no_topic')));
}
else
{
$html .= $this->renderItems($oContainerTpl, $results, array('id' => 0, 'title' => $this->lng->txt('payment_no_topic')));
}
return $html;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilShopResultPresentationGUI::showTopics ( )

Definition at line 84 of file class.ilShopResultPresentationGUI.php.

References $result, $results, ilShopTopics\_getInstance(), and renderItems().

Referenced by showResults().

{
$oContainerTpl = new ilTemplate ('tpl.shop_container.html', true, true, 'Services/Payment');
include_once './Services/Payment/classes/class.ilShopTopic.php';
include_once './Services/Payment/classes/class.ilShopTopics.php';
ilShopTopics::_getInstance()->setIdFilter(false);
$html = '';
if(count($topics = ilShopTopics::_getInstance()->getTopics()))
{
foreach($topics as $oTopic)
{
$html .= $this->renderItems($oContainerTpl, $results, array('id' => $oTopic->getId(), 'title' => $oTopic->getTitle()));
}
$html .= $this->renderItems($oContainerTpl, $results, array('id' => 0, 'title' => $this->lng->txt('payment_no_topic')));
}
else
{
$html .= $this->renderItems($oContainerTpl, $results, array('id' => 0, 'title' => $this->lng->txt('payment_no_topic')));
}
return $html;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilShopResultPresentationGUI::sortResult (   $result)

Definition at line 136 of file class.ilShopResultPresentationGUI.php.

References $result, and ilUtil\sortArray().

Referenced by renderItems().

{
if ($this->sort_direction != '' && $this->sort_field != '')
{
switch ($this->sort_field)
{
case 'price':
$numeric_sort = true;
break;
default:
$numeric_sort = false;
break;
}
$result = ilUtil::sortArray($result, $this->sort_field, $this->sort_direction, $numeric_sort);
}
return $result;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilShopResultPresentationGUI::$lng

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

Referenced by ilShopResultPresentationGUI().

ilShopResultPresentationGUI::$result = 0
ilShopResultPresentationGUI::$search_cache = null
protected

Definition at line 20 of file class.ilShopResultPresentationGUI.php.

ilShopResultPresentationGUI::$sort_direction = ''
private

Definition at line 29 of file class.ilShopResultPresentationGUI.php.

Referenced by getSortDirection().

ilShopResultPresentationGUI::$sort_field = ''
private

Definition at line 28 of file class.ilShopResultPresentationGUI.php.

Referenced by getSortField().

ilShopResultPresentationGUI::$tpl

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

Referenced by newBlockTemplate(), and renderItems().


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