ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilPaymentTrusteeGUI Class Reference
+ Inheritance diagram for ilPaymentTrusteeGUI:
+ Collaboration diagram for ilPaymentTrusteeGUI:

Public Member Functions

 ilPaymentTrusteeGUI ($user_obj)
 executeCommand ()
 cancelDelete ()
 showTrustees ($a_show_delete=false)
 deleteTrustee ()
 performDeleteTrustee ()
 update ()
 performSearch ()
 addTrustee ()
 addUser ()
 __search ($a_search_string)
 __showSearchUserTable ($a_result_set)
 __showTrusteesTable ($a_result_set)
- Public Member Functions inherited from ilShopBaseGUI
 __construct ()

Data Fields

 $trustee_obj = null
 $user_obj
 $ctrl

Protected Member Functions

 prepareOutput ()
- Protected Member Functions inherited from ilShopBaseGUI
 addPager ($result, $a_session_key)
 buildSubTabs ()
 setSection ($a_section)
 getSection ()
 setSubSection ($a_sub_section)
 getSubSection ()
 showButton ($a_cmd, $a_text, $a_target= '')
 initTableGUI ()
 setTableGUIBasicData ($tbl, $result_set, $a_default_order_column= '')

Additional Inherited Members

- Protected Attributes inherited from ilShopBaseGUI
 $ctrl = null
 $ilias = null
 $lng = null
 $tpl = null
 $oGeneralSettings = null
 $section = 0
 $sub_section = 0

Detailed Description

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

Member Function Documentation

ilPaymentTrusteeGUI::__search (   $a_search_string)

Definition at line 358 of file class.ilPaymentTrusteeGUI.php.

References ilUtil\sendInfo(), ilSearch\setPerformUpdate(), and ilUtil\stripSlashes().

Referenced by performSearch().

{
include_once("./classes/class.ilSearch.php");
$this->lng->loadLanguageModule("content");
$search = new ilSearch($this->user_obj->getId());
$search->setPerformUpdate(false);
$search->setSearchString(ilUtil::stripSlashes($a_search_string));
$search->setCombination("and");
$search->setSearchFor(array(0 => 'usr'));
$search->setSearchType('new');
if($search->validate($message))
{
$search->performSearch();
}
else
{
ilUtil::sendInfo($message,true);
$this->ctrl->redirect($this,"searchUser");
}
return $search->getResultByType('usr');
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPaymentTrusteeGUI::__showSearchUserTable (   $a_result_set)

Definition at line 382 of file class.ilPaymentTrusteeGUI.php.

Referenced by performSearch().

{
$tbl = new ilShopTableGUI($this);
$tbl->setTitle($this->lng->txt("paya_trustee_table"));
$tbl->setId('tbl_search_user_trustee');
$tbl->setRowTemplate("tpl.shop_users_row.html", "Services/Payment");
$tbl->addColumn(' ', 'trustee_id', '1%', true);
$tbl->addColumn($this->lng->txt('login'), 'login', '10%');
$tbl->addColumn($this->lng->txt('firstname'),'firstname','20%');
$tbl->addColumn($this->lng->txt('lastname'), 'lastname', '20%');
$tbl->setSelectAllCheckbox('user');
$tbl->addMultiCommand("addTrustee", $this->lng->txt("add"));
$tbl->addCommandButton('showTrustees',$this->lng->txt('cancel'));
$tbl->fillFooter();
$tbl->setData($a_result_set);
$this->tpl->setVariable('TABLE', $tbl->getHTML());
return true;
}

+ Here is the caller graph for this function:

ilPaymentTrusteeGUI::__showTrusteesTable (   $a_result_set)

Definition at line 406 of file class.ilPaymentTrusteeGUI.php.

Referenced by showTrustees().

{
$tbl = new ilShopTableGUI($this);
$tbl->setTitle($this->lng->txt("paya_trustee_table"));
$tbl->setId('tbl_show_trustee');
$tbl->setRowTemplate("tpl.shop_users_row.html", "Services/Payment");
$tbl->addColumn(' ', 'trustee_id', '1%', true);
$tbl->addColumn($this->lng->txt('login'), 'login', '10%');
$tbl->addColumn($this->lng->txt('firstname'),'firstname','20%');
$tbl->addColumn($this->lng->txt('lastname'), 'lastname', '20%');
$tbl->addColumn($this->lng->txt('paya_perm_stat'), 'perm_stat', '15%');
$tbl->addColumn($this->lng->txt('paya_perm_obj'), 'perm_obj', '15%');
$tbl->addColumn($this->lng->txt('paya_perm_coupons'), 'perm_coupons', '15%');
$tbl->addColumn('', 'options', '5%');
$tbl->setSelectAllCheckbox('trustee_id');
$tbl->addMultiCommand("deleteTrustee", $this->lng->txt("delete"));
$tbl->addCommandButton('update',$this->lng->txt('apply'));
$tbl->setData($a_result_set);
$this->tpl->setVariable('TABLE', $tbl->getHTML());
return true;
}

+ Here is the caller graph for this function:

ilPaymentTrusteeGUI::addTrustee ( )

Definition at line 263 of file class.ilPaymentTrusteeGUI.php.

References $_POST, performSearch(), ilUtil\sendInfo(), and showTrustees().

{
if(!is_array($_POST["user"]))
{
ilUtil::sendInfo($this->lng->txt("crs_no_users_selected"));
$this->performSearch();
return false;
}
if(in_array($this->user_obj->getId(),$_POST['user']))
{
ilUtil::sendInfo($this->lng->txt('paya_not_assign_yourself'));
$this->showTrustees();
return false;
}
// add them
$counter = 0;
foreach($_POST['user'] as $user_id)
{
if($this->trustee_obj->isTrustee($user_id))
{
continue;
}
$this->trustee_obj->setTrusteeId($user_id);
$this->trustee_obj->toggleStatisticPermission(false);
$this->trustee_obj->toggleObjectPermission(true);
$this->trustee_obj->toggleCouponsPermission(true);
$this->trustee_obj->add();
++$counter;
}
if($counter)
{
ilUtil::sendInfo($this->lng->txt('paya_added_trustee'));
$this->showTrustees();
return true;
}
else
{
ilUtil::sendInfo($this->lng->txt('paya_user_already_assigned'));
$this->performSearch();
return false;
}
}

+ Here is the call graph for this function:

ilPaymentTrusteeGUI::addUser ( )

Definition at line 312 of file class.ilPaymentTrusteeGUI.php.

References $_POST, ilObjUser\getUserIdByLogin(), ilUtil\sendInfo(), and showTrustees().

{
if(!$_POST['trustee_login'])
{
ilUtil::sendInfo($this->lng->txt('paya_enter_login'));
$this->showTrustees();
return false;
}
if(!$user_id = ilObjUser::getUserIdByLogin($_POST['trustee_login']))
{
ilUtil::sendInfo($this->lng->txt('paya_no_valid_login'));
$this->showTrustees();
return false;
}
if($this->trustee_obj->isTrustee($user_id))
{
ilUtil::sendInfo($this->lng->txt('paya_user_already_assigned'));
$this->showTrustees();
return false;
}
if($user_id == $this->user_obj->getId())
{
ilUtil::sendInfo($this->lng->txt('paya_not_assign_yourself'));
$this->showTrustees();
return false;
}
// checks passed => add trustee
$this->trustee_obj->setTrusteeId($user_id);
$this->trustee_obj->toggleObjectPermission(true);
$this->trustee_obj->toggleStatisticPermission(true);
$this->trustee_obj->toggleCouponsPermission(true);
$this->trustee_obj->add();
ilUtil::sendInfo($this->lng->txt('paya_added_trustee'));
$this->showTrustees();
return true;
}

+ Here is the call graph for this function:

ilPaymentTrusteeGUI::cancelDelete ( )

Definition at line 64 of file class.ilPaymentTrusteeGUI.php.

References $_SESSION, and showTrustees().

{
unset($_SESSION['paya_delete_trustee']);
$this->showTrustees();
return true;
}

+ Here is the call graph for this function:

ilPaymentTrusteeGUI::deleteTrustee ( )

Definition at line 178 of file class.ilPaymentTrusteeGUI.php.

References $_POST, $_SESSION, ilUtil\sendInfo(), and showTrustees().

{
if(!is_array($_POST['trustee']))
{
ilUtil::sendInfo($this->lng->txt('crs_no_users_selected'));
$this->showTrustees();
return true;
}
$_SESSION['paya_delete_trustee'] = $_POST['trustee'];
$this->showTrustees(true);
return true;
}

+ Here is the call graph for this function:

ilPaymentTrusteeGUI::executeCommand ( )

Definition at line 46 of file class.ilPaymentTrusteeGUI.php.

References $cmd, and prepareOutput().

{
global $tree;
$cmd = $this->ctrl->getCmd();
switch ($this->ctrl->getNextClass($this))
{
default:
if(!$cmd = $this->ctrl->getCmd())
{
$cmd = 'showTrustees';
}
$this->prepareOutput();
$this->$cmd();
break;
}
}

+ Here is the call graph for this function:

ilPaymentTrusteeGUI::ilPaymentTrusteeGUI (   $user_obj)

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

References $user_obj, and ilShopBaseGUI\__construct().

{
$this->user_obj = $user_obj;
$this->trustee_obj = new ilPaymentTrustees($this->user_obj);
$this->lng->loadLanguageModule('crs');
$this->ctrl->saveParameter($this, 'baseClass');
}

+ Here is the call graph for this function:

ilPaymentTrusteeGUI::performDeleteTrustee ( )

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

References $_SESSION, ilUtil\sendInfo(), and showTrustees().

{
if(is_array($_SESSION['paya_delete_trustee']))
{
foreach($_SESSION['paya_delete_trustee'] as $id)
{
$this->trustee_obj->setTrusteeId($id);
$this->trustee_obj->delete();
}
}
unset($_SESSION['paya_delete_trustee']);
ilUtil::sendInfo($this->lng->txt('paya_delete_trustee_msg'));
$this->showTrustees();
return true;
}

+ Here is the call graph for this function:

ilPaymentTrusteeGUI::performSearch ( )

Definition at line 226 of file class.ilPaymentTrusteeGUI.php.

References $_POST, $result, __search(), __showSearchUserTable(), ilUtil\formCheckbox(), ilObjectFactory\getInstanceByObjId(), ilUtil\sendInfo(), showTrustees(), and ilUtil\stripSlashes().

Referenced by addTrustee().

{
if(!$_POST["search_str"])
{
ilUtil::sendInfo($this->lng->txt("crs_search_enter_search_string"));
$this->showTrustees();
return false;
}
if(!count($result = $this->__search(ilUtil::stripSlashes($_POST["search_str"]))))
{
ilUtil::sendInfo($this->lng->txt("crs_no_results_found"));
$this->showTrustees();
return false;
}
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.main_view.html",'Services/Payment');
$counter = 0;
$f_result = array();
foreach($result as $user)
{
if(!$tmp_obj = ilObjectFactory::getInstanceByObjId($user["id"],false))
{
continue;
}
$f_result[$counter]['trustee_id'] = ilUtil::formCheckbox(0,"user[]",$user["id"]);
$f_result[$counter]['login'] = $tmp_obj->getLogin();
$f_result[$counter]['firstname'] = $tmp_obj->getFirstname();
$f_result[$counter]['lastname'] = $tmp_obj->getLastname();
unset($tmp_obj);
++$counter;
}
$this->__showSearchUserTable($f_result);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPaymentTrusteeGUI::prepareOutput ( )
protected

Reimplemented from ilShopBaseGUI.

Definition at line 34 of file class.ilPaymentTrusteeGUI.php.

References ilShopBaseGUI\setSection().

Referenced by executeCommand().

{
global $ilTabs;
$this->setSection(6);
$ilTabs->setTabActive('paya_header');
$ilTabs->setSubTabActive('paya_trustees');
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPaymentTrusteeGUI::showTrustees (   $a_show_delete = false)

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

References $_POST, $_SESSION, __showTrusteesTable(), ilMailFormCall\_getLinkTarget(), ilUtil\formCheckbox(), formSelect(), ilObjectFactory\getInstanceByObjId(), ilUtil\sendInfo(), and ilTextInputGUI\setSize().

Referenced by addTrustee(), addUser(), cancelDelete(), deleteTrustee(), performDeleteTrustee(), performSearch(), and update().

{
global $ilToolbar;
$_SESSION['paya_delete_trustee'] = $_SESSION['paya_delete_trustee'] ? $_SESSION['paya_delete_trustee'] : array();
$actions = array(0 => $this->lng->txt("paya_disabled"),
1 => $this->lng->txt("paya_enabled"));
include_once("./Services/Form/classes/class.ilUserLoginAutoCompleteInputGUI.php");
$ul = new ilUserLoginAutoCompleteInputGUI($this->lng->txt("user"), "search_str", $this, "performSearch");
$ul->setSize(20);
$ilToolbar->addInputItem($ul, true);
$ilToolbar->addFormButton($this->lng->txt("add"), "performSearch");
$ilToolbar->setFormAction($this->ctrl->getFormAction($this));
$this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.main_view.html','Services/Payment');
if($a_show_delete)
{
$oConfirmationGUI = new ilConfirmationGUI();
// set confirm/cancel commands
$oConfirmationGUI->setFormAction($this->ctrl->getFormAction($this,"performDeleteTrustee"));
$oConfirmationGUI->setHeaderText($this->lng->txt("paya_sure_delete_selected_trustees"));
$oConfirmationGUI->setCancel($this->lng->txt("cancel"), "cancelDelete");
$oConfirmationGUI->setConfirm($this->lng->txt("confirm"), "performDeleteTrustee");
foreach($this->trustee_obj->getTrustees() as $trustee)
{
$delete_row = '';
if(in_array($trustee['trustee_id'],$_POST['trustee']))
{
if($tmp_obj = ilObjectFactory::getInstanceByObjId($trustee['trustee_id'],false))
{
$delete_row = $tmp_obj->getLogin().' -> '.$tmp_obj->getFirstname().' '.$tmp_obj->getLastname();
}
}
$oConfirmationGUI->addItem('',$delete_row, $delete_row);
}
$this->tpl->setVariable("CONFIRMATION",$oConfirmationGUI->getHTML());
}
if(!count($this->trustee_obj->getTrustees()))
{
ilUtil::sendInfo($this->lng->txt('paya_no_trustees'));
return true;
}
$counter = 0;
$f_result = array();
$img_mail = "<img src=\"".ilUtil::getImagePath("icon_pencil_b.gif")."\" alt=\"".
$this->lng->txt("crs_mem_send_mail").
"\" title=\"".$this->lng->txt("crs_mem_send_mail")."\" border=\"0\" vspace=\"0\"/>";
require_once 'Services/Mail/classes/class.ilMailFormCall.php';
foreach($this->trustee_obj->getTrustees() as $trustee)
{
// GET USER OBJ
if($tmp_obj = ilObjectFactory::getInstanceByObjId($trustee['trustee_id'],false))
{
$f_result[$counter]['trustee_id'] = ilUtil::formCheckbox(in_array($trustee['trustee_id'],$_SESSION['paya_delete_trustee']) ? 1 : 0,
"trustee[]",
$trustee['trustee_id']);
$f_result[$counter]['login'] = $tmp_obj->getLogin();
$f_result[$counter]['firstname'] = $tmp_obj->getFirstname();
$f_result[$counter]['lastname'] = $tmp_obj->getLastname();
$f_result[$counter]['perm_stat'] = ilUtil::formSelect((int) $trustee['perm_stat'],
'perm_stat['.$trustee['trustee_id'].']',
$actions,
false,
true);
$f_result[$counter]['perm_obj'] = ilUtil::formSelect((int) $trustee['perm_obj'],
'perm_obj['.$trustee['trustee_id'].']',
$actions,
false,
true);
$f_result[$counter]['perm_coupons'] = ilUtil::formSelect((int) $trustee['perm_coupons'],
'perm_coupons['.$trustee['trustee_id'].']',
$actions,
false,
true);
# $link_mail = "<a target=\"_blank\" href=\"./ilias.php?baseClass=ilMailGUI&type=new&rcp_to=".
# $tmp_obj->getLogin()."\"".$img_mail."</a>";
$url_mail = ilMailFormCall::_getLinkTarget($this, '', array(), array('type' => 'new', 'rcp_to' => urlencode($tmp_obj->getLogin())));
$link_mail = "<div class=\"il_ContainerItemCommands\"><a class=\"il_ContainerItemCommand\" href=\"".
$url_mail."\">".$this->lng->txt("mail")."</a></div>";
$f_result[$counter]['options'] = $link_mail;
unset($tmp_obj);
++$counter;
}
}
return $this->__showTrusteesTable($f_result);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPaymentTrusteeGUI::update ( )

Definition at line 210 of file class.ilPaymentTrusteeGUI.php.

References $_POST, ilUtil\sendInfo(), and showTrustees().

{
foreach($this->trustee_obj->getTrustees() as $trustee)
{
$this->trustee_obj->setTrusteeId($trustee['trustee_id']);
$this->trustee_obj->toggleStatisticPermission($_POST['perm_stat']["$trustee[trustee_id]"]);
$this->trustee_obj->toggleObjectPermission($_POST['perm_obj']["$trustee[trustee_id]"]);
$this->trustee_obj->toggleCouponsPermission($_POST['perm_coupons']["$trustee[trustee_id]"]);
$this->trustee_obj->modify();
}
ilUtil::sendInfo($this->lng->txt('paya_updated_trustees'));
$this->showTrustees();
return true;
}

+ Here is the call graph for this function:

Field Documentation

ilPaymentTrusteeGUI::$ctrl

Definition at line 21 of file class.ilPaymentTrusteeGUI.php.

ilPaymentTrusteeGUI::$trustee_obj = null

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

ilPaymentTrusteeGUI::$user_obj

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

Referenced by ilPaymentTrusteeGUI().


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