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

Class ilShopTopicsGUI. More...

+ Collaboration diagram for ilShopTopicsGUI:

Public Member Functions

 __construct ($a_gui_object)
 executeCommand ()
 saveTopic ()
 showTopicForm ()
 confirmDeleteTopic ()
 saveSorting ()
 performDeleteTopic ()
 showTopicsList ()

Private Attributes

 $objCurrentTopic = null
 $ctrl = null
 $tpl = null
 $lng = null
 $ask_for_deletion = false

Detailed Description

Class ilShopTopicsGUI.

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

Definition at line 35 of file class.ilShopTopicsGUI.php.

Constructor & Destructor Documentation

ilShopTopicsGUI::__construct (   $a_gui_object)

Definition at line 43 of file class.ilShopTopicsGUI.php.

References $_GET, $ilCtrl, $lng, $tpl, and ilUtil\stripSlashes().

{
global $tpl, $ilCtrl, $lng;
$this->ctrl = $ilCtrl;
$this->lng = $lng;
$this->tpl = $tpl;
$a_gui_object->tabs_gui->setTabActive('topics');
$this->objCurrentTopic = new ilShopTopic(ilUtil::stripSlashes($_GET['topic_id']));
}

+ Here is the call graph for this function:

Member Function Documentation

ilShopTopicsGUI::confirmDeleteTopic ( )

Definition at line 134 of file class.ilShopTopicsGUI.php.

References ilUtil\sendInfo(), and showTopicsList().

{
if(!count($_POST['topic_id']))
{
ilUtil::sendInfo($this->lng->txt('select_one_topic'));
}
else
{
$this->ask_for_deletion = true;
}
$this->showTopicsList();
return true;
}

+ Here is the call graph for this function:

ilShopTopicsGUI::executeCommand ( )

Definition at line 56 of file class.ilShopTopicsGUI.php.

References $cmd.

{
$cmd = $this->ctrl->getCmd();
switch($this->ctrl->getNextClass($this))
{
default:
if(!$cmd = $this->ctrl->getCmd())
{
$cmd = 'showTopicsList';
}
$this->$cmd();
break;
}
return true;
}
ilShopTopicsGUI::performDeleteTopic ( )

Definition at line 170 of file class.ilShopTopicsGUI.php.

References ilUtil\sendInfo(), and showTopicsList().

{
if(!count($_POST['topic_id']))
{
ilUtil::sendInfo($this->lng->txt('select_one_topic'));
}
else
{
foreach($_POST['topic_id'] as $topic_id)
{
$oTopic = new ilShopTopic($topic_id);
$oTopic->delete();
unset($oTopic);
}
ilUtil::sendInfo($this->lng->txt('topics_deleted'));
}
$this->showTopicsList();
return true;
}

+ Here is the call graph for this function:

ilShopTopicsGUI::saveSorting ( )

Definition at line 150 of file class.ilShopTopicsGUI.php.

References ilUtil\sendInfo(), and showTopicsList().

{
if(count($_POST['sorting']))
{
foreach($_POST['sorting'] as $topic_id => $sorting_value)
{
$oTopic = new ilShopTopic($topic_id);
$oTopic->setSorting($sorting_value);
$oTopic->save();
unset($oTopic);
}
}
ilUtil::sendInfo($this->lng->txt('saved_successfully'));
$this->showTopicsList();
return true;
}

+ Here is the call graph for this function:

ilShopTopicsGUI::saveTopic ( )

Definition at line 73 of file class.ilShopTopicsGUI.php.

References ilUtil\sendInfo(), showTopicForm(), showTopicsList(), and ilUtil\stripSlashes().

{
$this->objCurrentTopic->setTitle(ilUtil::stripSlashes(trim($_POST['title'])));
$this->objCurrentTopic->setSorting((int)ilUtil::stripSlashes(trim($_POST['sorting'])));
if($_POST['title'] == '')
{
ilUtil::sendInfo($this->lng->txt('fill_out_all_required_fields'));
$this->showTopicForm();
}
else
{
$mode = $this->objCurrentTopic->getId() ? 'edit' : 'create';
if($this->objCurrentTopic->save())
{
ilUtil::sendInfo($this->lng->txt($mode == 'create' ? 'topic_saved' : 'topic_edited'));
}
$this->showTopicsList();
}
return true;
}

+ Here is the call graph for this function:

ilShopTopicsGUI::showTopicForm ( )

Definition at line 99 of file class.ilShopTopicsGUI.php.

References $title, and ilTextInputGUI\setValue().

Referenced by saveTopic().

{
$this->tpl->addBlockFile('ADM_CONTENT','adm_content', 'tpl.shop_topics_form.html', 'Services/Payment');
include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
$form = new ilPropertyFormGUI();
if($this->objCurrentTopic->getId())
{
$this->ctrl->setParameter($this, 'topic_id', $this->objCurrentTopic->getId());
}
$form->setFormAction($this->ctrl->getFormAction($this, 'saveTopic'));
$form->setTitle($this->lng->txt($this->objCurrentTopic->getId() ? 'edit_topic' : 'new_topic'));
$title = new ilTextInputGUI($this->lng->txt('title'), 'title');
$title->setValue($this->objCurrentTopic->getTitle());
$title->setRequired(true);
$form->addItem($title);
$sorting = new ilTextInputGUI($this->lng->txt('pay_sorting_value'), 'sorting');
$sorting->setValue($this->objCurrentTopic->getSorting());
$sorting->setMaxLength(11);
$sorting->setSize(11);
$form->addItem($sorting);
$form->addCommandButton('saveTopic', $this->lng->txt('save'));
$form->addCommandButton('showTopicsList', $this->lng->txt('cancel'));
$this->tpl->setVariable('TOPICS_FORM', $form->getHTML());
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilShopTopicsGUI::showTopicsList ( )

Definition at line 193 of file class.ilShopTopicsGUI.php.

References ilShopTopics\_getInstance(), ilShopTopic\_lookupTitle(), and ilShopTopics\TOPICS_SORT_MANUALLY.

Referenced by confirmDeleteTopic(), performDeleteTopic(), saveSorting(), and saveTopic().

{
$this->tpl->addBlockFile('ADM_CONTENT','adm_content', 'tpl.shop_topics_list.html', 'Services/Payment');
if($this->ask_for_deletion)
{
include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
$c_gui = new ilConfirmationGUI();
$c_gui->setFormAction($this->ctrl->getFormAction($this, 'performDeleteTopic'));
$c_gui->setHeaderText($this->lng->txt('sure_delete_topics'));
$c_gui->setCancel($this->lng->txt('cancel'), 'showTopicsList');
$c_gui->setConfirm($this->lng->txt('confirm'), 'performDeleteTopic');
foreach($_POST['topic_id'] as $topic_id)
{
$c_gui->addItem('topic_id[]', $topic_id, ilShopTopic::_lookupTitle($topic_id));
}
$this->tpl->setVariable('DELETE_CONFIRMATION', $c_gui->getHTML());
return true;
}
include_once 'Services/Payment/classes/class.ilShopTopicsTableGUI.php';
$table_gui = new ilShopTopicsTableGUI($this, 'showTopicsList');
$table_gui->setTitle($this->lng->txt('topics'));
ilShopTopics::_getInstance()->setSortingDirection('ASC');
$table_gui->parseRecords(ilShopTopics::_getInstance()->getTopics());
$table_gui->addCommandButton('showTopicForm', $this->lng->txt('add'));
$table_gui->addCommandButton('saveSorting', $this->lng->txt('pay_save_sorting'));
$this->tpl->setVariable('TOPICS_TABLE', $table_gui->getHTML());
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilShopTopicsGUI::$ask_for_deletion = false
private

Definition at line 41 of file class.ilShopTopicsGUI.php.

ilShopTopicsGUI::$ctrl = null
private

Definition at line 38 of file class.ilShopTopicsGUI.php.

ilShopTopicsGUI::$lng = null
private

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

Referenced by __construct().

ilShopTopicsGUI::$objCurrentTopic = null
private

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

ilShopTopicsGUI::$tpl = null
private

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

Referenced by __construct().


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