ILIAS  Release_5_0_x_branch Revision 61816
 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 ()
 showTopicsSettings ()
 saveTopicsSettings ()
 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 15 of file class.ilShopTopicsGUI.php.

Constructor & Destructor Documentation

ilShopTopicsGUI::__construct (   $a_gui_object)

Definition at line 23 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;
$this->gui_object = $a_gui_object;
$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 194 of file class.ilShopTopicsGUI.php.

References $_POST, 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 39 of file class.ilShopTopicsGUI.php.

References $cmd.

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

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

References $_POST, 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 210 of file class.ilShopTopicsGUI.php.

References $_POST, ilUtil\sendSuccess(), 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::sendSuccess($this->lng->txt('saved_successfully'));
$this->showTopicsList();
return true;
}

+ Here is the call graph for this function:

ilShopTopicsGUI::saveTopic ( )

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

References $_POST, ilUtil\sendFailure(), ilUtil\sendSuccess(), 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::sendFailure($this->lng->txt('fill_out_all_required_fields'));
$this->showTopicForm();
}
else
{
$mode = $this->objCurrentTopic->getId() ? 'edit' : 'create';
if($this->objCurrentTopic->save())
{
ilUtil::sendSuccess($this->lng->txt($mode == 'create' ? 'topic_saved' : 'topic_edited'));
}
$this->showTopicsList();
}
return true;
}

+ Here is the call graph for this function:

ilShopTopicsGUI::saveTopicsSettings ( )

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

References $_POST, ilPaymentSettings\_getInstance(), ilUtil\sendSuccess(), and showTopicsSettings().

{
$genSet->set('enable_topics', $_POST['enable_topics'], 'gui');
$genSet->set('topics_allow_custom_sorting', $_POST['topics_allow_custom_sorting'], 'gui');
$genSet->set('topics_sorting_type', $_POST['topics_sorting_type'], 'gui');
$genSet->set('topics_sorting_direction', $_POST['topics_sorting_direction'], 'gui');
$genSet->set('show_topics_filter', $_POST['show_topics_filter'], 'gui');
ilUtil::sendSuccess($this->lng->txt('pays_updated_general_settings'));
return true;
}

+ Here is the call graph for this function:

ilShopTopicsGUI::showTopicForm ( )

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

References ilTextInputGUI\setValue().

Referenced by saveTopic().

{
$this->tpl->addBlockFile('ADM_CONTENT','adm_content', 'tpl.main_view.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('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 253 of file class.ilShopTopicsGUI.php.

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

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

{
$this->tpl->addBlockFile('ADM_CONTENT','adm_content', 'tpl.main_view.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('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('TABLE', $table_gui->getHTML());
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilShopTopicsGUI::showTopicsSettings ( )

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

References $options, ilPaymentSettings\_getInstance(), ilCheckboxInputGUI\setChecked(), and ilSelectInputGUI\setValue().

Referenced by saveTopicsSettings().

{
$this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html','Services/Payment');
$genSetData = $genSet->getAll();
$form = new ilPropertyFormGUI();
$form->setFormAction($this->ctrl->getFormAction($this, 'saveTopicsSettings'));
$form->setTitle($this->lng->txt('pays_general_settings'));
$form->addCommandButton('saveTopicsSettings',$this->lng->txt('save'));
// use topics
$formItem = new ilCheckboxInputGUI($this->lng->txt('enable_topics'), 'enable_topics');
$formItem->setChecked((int)$genSetData['enable_topics']);
$formItem->setInfo($this->lng->txt('enable_topics_info'));
$form->addItem($formItem);
// default sorting type
$formItem = new ilSelectInputGUI($this->lng->txt('pay_topics_default_sorting_type'), 'topics_sorting_type');
$formItem->setValue($genSetData['topics_sorting_type']);
$options = array(
1 => $this->lng->txt('pay_topics_sort_by_title'),
2 => $this->lng->txt('pay_topics_sort_by_date'),
3 => $this->lng->txt('pay_topics_sort_manually')
);
$formItem->setOptions($options);
$form->addItem($formItem);
// default sorting direction
$formItem = new ilSelectInputGUI($this->lng->txt('pay_topics_default_sorting_direction'), 'topics_sorting_direction');
$formItem->setValue($genSetData['topics_sorting_direction']);
$options = array(
'asc' => $this->lng->txt('sort_asc'),
'desc' => $this->lng->txt('sort_desc'),
);
$formItem->setOptions($options);
$form->addItem($formItem);
// topics custom sorting
$formItem = new ilCheckboxInputGUI($this->lng->txt('pay_topics_allow_custom_sorting'), 'topics_allow_custom_sorting');
$formItem->setChecked((int)$genSetData['topics_allow_custom_sorting']);
$formItem->setInfo($this->lng->txt('pay_topics_allow_custom_sorting_info'));
$form->addItem($formItem);
// show topics filter
$formItem = new ilCheckboxInputGUI($this->lng->txt('show_topics_filter'), 'show_topics_filter');
$formItem->setChecked((int)$genSetData['show_topics_filter']);
$formItem->setInfo($this->lng->txt('show_topics_filter_info'));
$form->addItem($formItem);
$this->tpl->setVariable('FORM',$form->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 21 of file class.ilShopTopicsGUI.php.

ilShopTopicsGUI::$ctrl = null
private

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

ilShopTopicsGUI::$lng = null
private

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

Referenced by __construct().

ilShopTopicsGUI::$objCurrentTopic = null
private

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

ilShopTopicsGUI::$tpl = null
private

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

Referenced by __construct().


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