Public Member Functions | Data Fields

ilPaymentTrusteeGUI Class Reference

Inheritance diagram for ilPaymentTrusteeGUI:
Collaboration diagram for ilPaymentTrusteeGUI:

Public Member Functions

 ilPaymentTrusteeGUI (&$user_obj)
executeCommand ()
 execute command
 cancelDelete ()
 showTrustees ($a_show_delete=false)
 deleteTrustee ()
 performDeleteTrustee ()
 update ()
 searchUser ()
 newSearch ()
 performSearch ()
 addTrustee ()
 addUser ()
 __search ($a_search_string)
 __showSearchUserTable ($a_result_set)
 __showTrusteesTable ($a_result_set)

Data Fields

 $trustee_obj = null
 $user_obj
 $ctrl

Detailed Description

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


Member Function Documentation

ilPaymentTrusteeGUI::__search ( a_search_string  ) 

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

References sendInfo(), 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
                {
                        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 393 of file class.ilPaymentTrusteeGUI.php.

References $_GET, $tbl, ilPaymentBaseGUI::$tpl, ilUtil::getImagePath(), ilPaymentBaseGUI::initTableGUI(), and ilPaymentBaseGUI::setTableGUIBasicData().

Referenced by performSearch().

        {
                $tbl =& $this->initTableGUI();
                $tpl =& $tbl->getTemplateObject();


                // SET FORMACTION
                $tpl->setCurrentBlock("tbl_form_header");
                $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
                $tpl->parseCurrentBlock();

                $tpl->setCurrentBlock("tbl_action_btn");
                $tpl->setVariable("BTN_NAME","addTrustee");
                $tpl->setVariable("BTN_VALUE",$this->lng->txt("add"));
                $tpl->parseCurrentBlock();

                $tpl->setCurrentBlock("tbl_action_btn");
                $tpl->setVariable("BTN_NAME","showTrustees");
                $tpl->setVariable("BTN_VALUE",$this->lng->txt("cancel"));
                $tpl->parseCurrentBlock();

                $tpl->setCurrentBlock("tbl_action_row");
                $tpl->setVariable("COLUMN_COUNTS",5);
                $tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
                $tpl->parseCurrentBlock();

                $tbl->setTitle($this->lng->txt("paya_trustee_table"),"icon_usr.gif",$this->lng->txt("crs_header_edit_members"));
                $tbl->setHeaderNames(array("",
                                                                   $this->lng->txt("login"),
                                                                   $this->lng->txt("firstname"),
                                                                   $this->lng->txt("lastname")));
                $tbl->setHeaderVars(array("",
                                                                  "login",
                                                                  "firstname",
                                                                  "lastname"),
                                                        array("cmd" => 'performSearch',
                                                                  "cmdClass" => "ilpaymenttrusteegui",
                                                                  "cmdNode" => $_GET["cmdNode"]));

                $tbl->setColumnWidth(array("3%","32%","32%","32%"));

                $this->setTableGUIBasicData($tbl,$a_result_set);
                $tbl->render();
                
                $this->tpl->setVariable("SEARCH_RESULT_TABLE",$tbl->tpl->get());

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilPaymentTrusteeGUI::__showTrusteesTable ( a_result_set  ) 

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

References $_GET, $_SESSION, $tbl, ilPaymentBaseGUI::$tpl, ilUtil::getImagePath(), ilPaymentBaseGUI::initTableGUI(), and ilPaymentBaseGUI::setTableGUIBasicData().

Referenced by showTrustees().

        {
                $tbl =& $this->initTableGUI();
                $tpl =& $tbl->getTemplateObject();

                // SET FORMAACTION
                $tpl->setCurrentBlock("tbl_form_header");

                $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
                $tpl->parseCurrentBlock();

                $tpl->setCurrentBlock("tbl_action_row");

/*              $tpl->setCurrentBlock("input_text");
                $tpl->setVariable("PB_TXT_NAME",'trustee_login');
                $tpl->parseCurrentBlock();

                $tpl->setCurrentBlock("plain_button");
                $tpl->setVariable("PBTN_NAME","addUser");
                $tpl->setVariable("PBTN_VALUE",$this->lng->txt("crs_add_member"));
                $tpl->parseCurrentBlock();*/

                $tpl->setCurrentBlock("input_text");
                $tpl->setVariable("PB_TXT_NAME",'search_str');
                $tpl->setVariable("PB_TXT_VALUE",$_SESSION["paya_search_str"]);
                $tpl->parseCurrentBlock();

                $tpl->setCurrentBlock("plain_button");
                $tpl->setVariable("PBTN_NAME","newSearch");
                $tpl->setVariable("PBTN_VALUE",$this->lng->txt("crs_add_member"));
                $tpl->parseCurrentBlock();

                $tpl->setCurrentBlock("plain_button");
                $tpl->setVariable("PBTN_NAME","update");
                $tpl->setVariable("PBTN_VALUE",$this->lng->txt("apply"));
                $tpl->parseCurrentBlock();

                $tpl->setCurrentBlock("plain_buttons");
                $tpl->parseCurrentBlock();

                $tpl->setVariable("COLUMN_COUNTS",7);
                $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));

                $tpl->setCurrentBlock("tbl_action_button");
                $tpl->setVariable("BTN_NAME","deleteTrustee");
                $tpl->setVariable("BTN_VALUE",$this->lng->txt("delete"));
                $tpl->parseCurrentBlock();
                $tpl->setCurrentBlock("tbl_action_row");
                $tpl->setVariable("TPLPATH",$this->tpl->tplPath);
                $tpl->parseCurrentBlock();

                $tbl->setTitle($this->lng->txt("paya_trustee_table"),"icon_usr.gif",$this->lng->txt("paya_trustee_table"));
                $tbl->setHeaderNames(array('',
                                                                   $this->lng->txt("login"),
                                                                   $this->lng->txt("firstname"),
                                                                   $this->lng->txt("lastname"),
                                                                   $this->lng->txt("paya_perm_stat"),
                                                                   $this->lng->txt("paya_perm_obj"),
                                                                   ''));
                $tbl->setHeaderVars(array("",
                                                                  "login",
                                                                  "firstname",
                                                                  "lastname",
                                                                  "perm_stat",
                                                                  "perm_obj",
                                                                  "options"),
                                                        array("cmd" => "showTrustees",
                                                                  "cmdClass" => "ilpaymenttrusteegui",
                                                                  "cmdNode" => $_GET["cmdNode"]));
                $tbl->setColumnWidth(array("4%","15%","15%","15%","20%","20%","15%"));


                $this->setTableGUIBasicData($tbl,$a_result_set);
                $tbl->render();

                $this->tpl->setVariable("TRUSTEE_TABLE",$tbl->tpl->get());

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilPaymentTrusteeGUI::addTrustee (  ) 

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

References $_POST, $counter, $user_id, performSearch(), sendInfo(), and showTrustees().

        {
                if(!is_array($_POST["user"]))
                {
                        sendInfo($this->lng->txt("crs_no_users_selected"));
                        $this->performSearch();
#                       $this->showTrustees();

                        return false;
                }
                if(in_array($this->user_obj->getId(),$_POST['user']))
                {
                        sendInfo($this->lng->txt('paya_not_assign_yourself'));
#                       $this->performSearch();
                        $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->add();
                        ++$counter;
                }

                if($counter)
                {
                        sendInfo($this->lng->txt('paya_added_trustee'));
                        $this->showTrustees();

                        return true;
                }
                else
                {
                        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 324 of file class.ilPaymentTrusteeGUI.php.

References $_POST, $user_id, ilObjUser::getUserIdByLogin(), sendInfo(), and showTrustees().

        {
                if(!$_POST['trustee_login'])
                {
                        sendInfo($this->lng->txt('paya_enter_login'));
                        $this->showTrustees();
                        
                        return false;
                }
                if(!$user_id = ilObjUser::getUserIdByLogin($_POST['trustee_login']))
                {
                        sendInfo($this->lng->txt('paya_no_valid_login'));
                        $this->showTrustees();
                        
                        return false;
                }
                if($this->trustee_obj->isTrustee($user_id))
                {
                        sendInfo($this->lng->txt('paya_user_already_assigned'));
                        $this->showTrustees();
                        
                        return false;
                }
                if($user_id == $this->user_obj->getId())
                {
                        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(false);
                $this->trustee_obj->toggleStatisticPermission(true);
                $this->trustee_obj->add();

                sendInfo($this->lng->txt('paya_added_trustee'));
                $this->showTrustees();

                return true;
        }

Here is the call graph for this function:

ilPaymentTrusteeGUI::cancelDelete (  ) 

Definition at line 72 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 156 of file class.ilPaymentTrusteeGUI.php.

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

        {
                if(!is_array($_POST['trustee']))
                {
                        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 (  ) 

execute command

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

References $cmd, and $tree.

        {
                global $tree;

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

ilPaymentTrusteeGUI::ilPaymentTrusteeGUI ( &$  user_obj  ) 

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

References $ilCtrl, $user_obj, and ilPaymentBaseGUI::ilPaymentBaseGUI().

        {
                global $ilCtrl;

                $this->ctrl =& $ilCtrl;

                $this->ilPaymentBaseGUI();

                $this->user_obj =& $user_obj;
                $this->trustee_obj =& new ilPaymentTrustees($this->user_obj);

                $this->lng->loadLanguageModule('crs');
        }

Here is the call graph for this function:

ilPaymentTrusteeGUI::newSearch (  ) 

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

References $_POST, $_SESSION, and performSearch().

        {
                $_SESSION["paya_search_str"] = $_POST["search_str"];
                $this->performSearch();
        }

Here is the call graph for this function:

ilPaymentTrusteeGUI::performDeleteTrustee (  ) 

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

References $_SESSION, $id, 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']);
                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 228 of file class.ilPaymentTrusteeGUI.php.

References $_POST, $_SESSION, $counter, $result, $user, __search(), __showSearchUserTable(), ilUtil::formCheckbox(), ilObjectFactory::getInstanceByObjId(), sendInfo(), ilPaymentBaseGUI::showButton(), showTrustees(), and ilUtil::stripSlashes().

Referenced by addTrustee(), and newSearch().

        {
                // SAVE it to allow sort in tables
                $_SESSION["pays_search_str_trustee"] = $_POST["search_str"] = $_POST["search_str"] ? $_POST["search_str"] : $_SESSION["pays_search_str_trustee"];


                if(!$_POST["search_str"])
                {
                        sendInfo($this->lng->txt("crs_search_enter_search_string"));
#                       $this->searchUser();
                        $this->showTrustees();

                        return false;
                }
                if(!count($result = $this->__search(ilUtil::stripSlashes($_POST["search_str"]))))
                {
                        sendInfo($this->lng->txt("crs_no_results_found"));
#                       $this->searchUser();
                        $this->showTrustees();

                        return false;
                }

                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.paya_usr_selection.html",'payment');
                $this->showButton("searchUser",$this->lng->txt("back"));
                
                $counter = 0;
                $f_result = array();
                foreach($result as $user)
                {
                        if(!$tmp_obj = ilObjectFactory::getInstanceByObjId($user["id"],false))
                        {
                                continue;
                        }
                        $f_result[$counter][] = ilUtil::formCheckbox(0,"user[]",$user["id"]);
                        $f_result[$counter][] = $tmp_obj->getLogin();
                        $f_result[$counter][] = $tmp_obj->getFirstname();
                        $f_result[$counter][] = $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::searchUser (  ) 

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

References $_SESSION, and ilPaymentBaseGUI::showButton().

        {
                $this->tpl->addBlockFile("ADM_CONTENT","adm_content","tpl.paya_user_search.html",'payment');
                $this->showButton('showTrustees',$this->lng->txt('back'));

                $this->lng->loadLanguageModule('search');

                $this->tpl->setVariable("F_ACTION",$this->ctrl->getFormAction($this));
                $this->tpl->setVariable("SEARCH_ASSIGN_USR",$this->lng->txt("crs_search_members"));
                $this->tpl->setVariable("SEARCH_SEARCH_TERM",$this->lng->txt("search_search_term"));
                $this->tpl->setVariable("SEARCH_VALUE",$_SESSION["pays_search_str_trustee"] ? $_SESSION["pays_search_str_trustee"] : "");
                $this->tpl->setVariable("BTN2_VALUE",$this->lng->txt("cancel"));
                $this->tpl->setVariable("BTN1_VALUE",$this->lng->txt("search"));
                $this->tpl->setVariable("SEARCH","performSearch");
                $this->tpl->setVariable("CANCEL","showTrustees");

                return true;
        }

Here is the call graph for this function:

ilPaymentTrusteeGUI::showTrustees ( a_show_delete = false  ) 

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

References $_SESSION, $actions, $counter, __showTrusteesTable(), ilUtil::formCheckbox(), formSelect(), ilObjectFactory::getInstanceByObjId(), sendInfo(), and ilPaymentBaseGUI::showButton().

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

        {
                $_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"));


                $this->showButton('searchUser',$this->lng->txt('search_user'));

                $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.paya_trustees.html','payment');

                if($a_show_delete)
                {
                        sendInfo($this->lng->txt('paya_sure_delete_selected_trustees'));
                        $this->tpl->setCurrentBlock("confirm_delete");
                        $this->tpl->setVariable("CONFIRM_FORMACTION",$this->ctrl->getFormAction($this));
                        $this->tpl->setVariable("TXT_CANCEL",$this->lng->txt('cancel'));
                        $this->tpl->setVariable("TXT_CONFIRM",$this->lng->txt('delete'));
                        $this->tpl->parseCurrentBlock();
                }

                if(!count($this->trustee_obj->getTrustees()))
                {
                        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\"/>";
                
                
                foreach($this->trustee_obj->getTrustees() as $trustee)
                {
                        // GET USER OBJ
                        if($tmp_obj = ilObjectFactory::getInstanceByObjId($trustee['trustee_id'],false))
                        {
                                $f_result[$counter][]   = ilUtil::formCheckbox(in_array($trustee['trustee_id'],$_SESSION['paya_delete_trustee']) ? 1 : 0,
                                                                                                                           "trustee[]",
                                                                                                                           $trustee['trustee_id']);
                                $f_result[$counter][]   = $tmp_obj->getLogin();
                                $f_result[$counter][]   = $tmp_obj->getFirstname();
                                $f_result[$counter][]   = $tmp_obj->getLastname();

                                $f_result[$counter][]   = ilUtil::formSelect((int) $trustee['perm_stat'],
                                                                                                                         'perm_stat['.$trustee['trustee_id'].']',
                                                                                                                         $actions,
                                                                                                                         false,
                                                                                                                         true);
                                
                                $f_result[$counter][]   = ilUtil::formSelect((int) $trustee['perm_obj'],
                                                                                                                         'perm_obj['.$trustee['trustee_id'].']',
                                                                                                                         $actions,
                                                                                                                         false,
                                                                                                                         true);

#                               $link_mail = "<a target=\"_blank\" href=\"./mail_new.php?type=new&rcp_to=".
#                                       $tmp_obj->getLogin()."\"".$img_mail."</a>";
                                $link_mail = "<div class=\"il_ContainerItemCommands\"><a class=\"il_ContainerItemCommand\" href=\"./mail_new.php?type=new&rcp_to=".
                                        $tmp_obj->getLogin()."\">".$this->lng->txt("mail")."</a></div>";
                                
                                $f_result[$counter][]   = $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 188 of file class.ilPaymentTrusteeGUI.php.

References $_POST, 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->modify();
                }
                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 37 of file class.ilPaymentTrusteeGUI.php.

ilPaymentTrusteeGUI::$trustee_obj = null

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

ilPaymentTrusteeGUI::$user_obj

Reimplemented from ilPaymentBaseGUI.

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

Referenced by ilPaymentTrusteeGUI().


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