ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilShopResultPresentationGUI Class Reference

Class ilShopResultPresentationGUI. More...

+ Inheritance diagram for ilShopResultPresentationGUI:
+ Collaboration diagram for ilShopResultPresentationGUI:

Public Member Functions

 ilShopResultPresentationGUI ($result)
 showResults ()
 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, $a_ref_id)
 adds a standard row to a block template
- Public Member Functions inherited from ilSearchResultPresentationGUI
 ilSearchResultPresentationGUI (&$result)
renderItemList (&$results)
 addHeaderRow (&$a_tpl, $a_type)
 adds a header row to a block template
 resetRowType ()
newBlockTemplate ()
 returns a new list block template
 addSeparatorRow (&$a_tpl)
 __appendChildLinks ($html, $item, &$item_list_gui)

Private Member Functions

 renderItems ($oContainerTpl, $results, $topic)

Private Attributes

 $sort_field = ''
 $sort_direction = ''

Additional Inherited Members

- Data Fields inherited from ilSearchResultPresentationGUI
 $tpl
 $lng
 $result = 0
- Protected Attributes inherited from ilSearchResultPresentationGUI
 $search_cache = null

Detailed Description

Class ilShopResultPresentationGUI.

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

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

Member Function Documentation

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

adds a standard row to a block template

Parameters
object$a_tplblock template
string$a_htmlhtml code private

Reimplemented from ilSearchResultPresentationGUI.

Definition at line 281 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);
// add checkbox for saving results
#$a_tpl->setVariable("BLOCK_ROW_CHECK",ilUtil::formCheckbox(0,'result[]',$a_ref_id));
#$a_tpl->setVariable("ITEM_ID",$a_ref_id);
$a_tpl->parseCurrentBlock();
$a_tpl->touchBlock("container_row");
}

+ Here is the caller graph for this function:

ilShopResultPresentationGUI::getSortDirection ( )

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

References $sort_direction.

{
}
ilShopResultPresentationGUI::getSortField ( )

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

References $sort_field.

{
}
ilShopResultPresentationGUI::getTypeOrdering ( )

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

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

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

References ilSearchResultPresentationGUI\$result.

{
parent::__construct($result);
}
ilShopResultPresentationGUI::renderItemList (   $results)

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

References $results, and renderItems().

Referenced by showResults().

{
global $ilUser;
$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:

+ Here is the caller graph for this function:

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

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

References $ref_id, $results, ilSearchResultPresentationGUI\$tpl, ilSearchResultPresentationGUI\__appendChildLinks(), ilPaymentPrices\_formatPriceToFloat(), ilPaymentPrices\_formatPriceToString(), ilObjectListGUIFactory\_getListGUIByType(), ilPaymentObject\_hasAccess(), ilPaymentObject\_lookupPobjectId(), ilSearchResultPresentationGUI\addHeaderRow(), ilSearchResultPresentationGUI\addSeparatorRow(), addStandardRow(), ilPaymentPrices\getLowestPrice(), ilSearchResultPresentationGUI\newBlockTemplate(), ilSearchResultPresentationGUI\resetRowType(), and sortResult().

Referenced by renderItemList().

{
global $ilUser;
$items_counter = 0;
$cur_obj_type = '';
$tpl = $this->newBlockTemplate();
$first = true;
foreach($this->type_ordering as $act_type)
{
$item_html = array();
if(count($results[$topic['id']][$act_type]))
{
foreach($results[$topic['id']][$act_type] as $key => $item)
{
$oPaymentObject =
new ilPaymentObject($ilUser, ilPaymentObject::_lookupPobjectId($item['ref_id']));
$oPrice = new ilPaymentPrices($oPaymentObject->getPobjectId());
$lowest_price = $oPrice->getLowestPrice();
$results[$topic['id']][$act_type][$key]['price'] =
ilPaymentPrices::_formatPriceToFloat($lowest_price['unit_value'],
$lowest_price['sub_unit_value']);
$results[$topic['id']][$act_type][$key]['price_string'] =
($oPrice->getNumberOfPrices() > 1 ? $this->lng->txt('price_from').' ' : '').
ilPaymentPrices::_formatPriceToString($lowest_price['unit_value'], $lowest_price['sub_unit_value']);
// 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
if ($cur_obj_type != $item['type'])
{
include_once 'classes/class.ilObjectListGUIFactory.php';
$item_list_gui = ilObjectListGUIFactory::_getListGUIByType($item['type']);
}
$item_list_gui->enableDelete(false);
$item_list_gui->enableCut(false);
$item_list_gui->enableLink(false);
$item_list_gui->enableSubscribe(false);
$item_list_gui->enablePayment(true);
$item_list_gui->enableCommands(false);
$item_list_gui->enablePath(false);
$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);
}
$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', $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']
);
if($html)
{
$html = $this->__appendChildLinks($html, $item, $item_list_gui);
$item_html[$item['ref_id']] = $html;
}
}
// output block for resource type
if(count($item_html) > 0)
{
// separator row
if (!$first)
{
}
$first = false;
// add a header for each resource type
$this->addHeaderRow($tpl, $act_type);
$this->resetRowType();
// content row
foreach($item_html as $ref_id => $html)
{
$this->addStandardRow($tpl, $html, $ref_id);
}
++$items_counter;
}
}
}
if($items_counter > 0)
{
$oContainerTpl->setCurrentBlock('loop');
$oContainerTpl->setVariable('TOPIC_TITLE', $topic['title']);
$oContainerTpl->setVariable('COTAINER_LIST_BLOCK', $tpl->get());
$oContainerTpl->parseCurrentBlock();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilShopResultPresentationGUI::setSortDirection (   $a_sort_direction)

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

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

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

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

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

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

Reimplemented from ilSearchResultPresentationGUI.

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

References $results, and renderItemList().

{
// Get results
$results = $this->result->getResultsForPresentation();
return $html = $this->renderItemList($results);
}

+ Here is the call graph for this function:

ilShopResultPresentationGUI::sortResult (   $result)

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

References ilSearchResultPresentationGUI\$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::$sort_direction = ''
private

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

Referenced by getSortDirection().

ilShopResultPresentationGUI::$sort_field = ''
private

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

Referenced by getSortField().


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