Public Member Functions | Data Fields

ilSurveyPhrasesGUI Class Reference
[Modules/Survey]

Survey phrases GUI class. More...

Public Member Functions

 ilSurveyPhrasesGUI ($a_object)
 ilSurveyPhrases constructor
executeCommand ()
 execute command
 getCommand ($cmd)
 Retrieves the ilCtrl command.
 deletePhrase ()
 Creates a confirmation form to delete personal phases from the database.
 phrases ()
 Displays a form to manage the user created phrases.
 cancelDeletePhrase ()
 cancel delete phrases
 confirmDeletePhrase ()
 confirm delete phrases
 deletePhrasesForm ($checked_phrases)
 Creates a confirmation form to delete personal phases from the database.

Data Fields

 $object
 $gui_object
 $lng
 $tpl
 $ctrl
 $ilias
 $tree
 $ref_id

Detailed Description

Survey phrases GUI class.

The ilSurveyPhrases GUI class creates the GUI output for survey phrases (collections of survey categories) of ordinal survey question types.

Author:
Helmut Schottmüller <helmut.schottmueller@mac.com>
Version:
$Id$

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


Member Function Documentation

ilSurveyPhrasesGUI::cancelDeletePhrase (  ) 

cancel delete phrases

Definition at line 204 of file class.ilSurveyPhrasesGUI.php.

        {
                $this->ctrl->redirect($this, "phrases");
        }

ilSurveyPhrasesGUI::confirmDeletePhrase (  ) 

confirm delete phrases

Definition at line 212 of file class.ilSurveyPhrasesGUI.php.

References ilUtil::sendInfo().

        {
                $phrases = array();
                foreach ($_POST as $key => $value)
                {
                        if (preg_match("/phrase_(\d+)/", $key, $matches))
                        {
                                array_push($phrases, $matches[1]);
                        }
                }
                $this->object->deletePhrases($phrases);
                ilUtil::sendInfo($this->lng->txt("qpl_phrases_deleted"), true);
                $this->ctrl->redirect($this, "phrases");
        }

Here is the call graph for this function:

ilSurveyPhrasesGUI::deletePhrase (  ) 

Creates a confirmation form to delete personal phases from the database.

Creates a confirmation form to delete personal phases from the database

public

Definition at line 105 of file class.ilSurveyPhrasesGUI.php.

References deletePhrasesForm(), phrases(), and ilUtil::sendInfo().

        {
                ilUtil::sendInfo();

                $checked_phrases = array();
                foreach ($_POST as $key => $value)
                {
                        if (preg_match("/phrase_(\d+)/", $key, $matches))
                        {
                                array_push($checked_phrases, $matches[1]);
                        }
                }
                if (count($checked_phrases))
                {
                        ilUtil::sendInfo($this->lng->txt("qpl_confirm_delete_phrases"));
                        $this->deletePhrasesForm($checked_phrases);
                        return;
                }
                else
                {
                        ilUtil::sendInfo($this->lng->txt("qpl_delete_phrase_select_none"));
                        $this->phrases();
                        return;
                }
                
                $this->tpl->setCurrentBlock("obligatory");
                $this->tpl->setVariable("TEXT_OBLIGATORY", $this->lng->txt("obligatory"));
                $this->tpl->setVariable("CHECKED_OBLIGATORY", " checked=\"checked\"");
                $this->tpl->parseCurrentBlock();
                $this->tpl->setCurrentBlock("adm_content");
                $this->tpl->setVariable("DEFINE_QUESTIONBLOCK_HEADING", $this->lng->txt("define_questionblock"));
                $this->tpl->setVariable("TEXT_TITLE", $this->lng->txt("title"));
                $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
                $this->tpl->setVariable("SAVE", $this->lng->txt("save"));
                $this->tpl->setVariable("CANCEL", $this->lng->txt("cancel"));
                $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
                $this->tpl->parseCurrentBlock();
        }

Here is the call graph for this function:

ilSurveyPhrasesGUI::deletePhrasesForm ( checked_phrases  ) 

Creates a confirmation form to delete personal phases from the database.

Creates a confirmation form to delete personal phases from the database

Parameters:
array $checked_phrases An array with the id's of the phrases checked for deletion public

Definition at line 235 of file class.ilSurveyPhrasesGUI.php.

References ilUtil::sendInfo().

Referenced by deletePhrase().

        {
                ilUtil::sendInfo();
                $phrases =& $this->object->_getAvailablePhrases(1);
                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_qpl_confirm_delete_phrases.html", "Modules/SurveyQuestionPool");
                $colors = array("tblrow1", "tblrow2");
                $counter = 0;
                foreach ($checked_phrases as $id)
                {
                        $this->tpl->setCurrentBlock("row");
                        $this->tpl->setVariable("COLOR_CLASS", $colors[$counter++ % 2]);
                        $this->tpl->setVariable("PHRASE_TITLE", $phrases[$id]["title"]);
                        $categories =& $this->object->_getCategoriesForPhrase($id);
                        $this->tpl->setVariable("PHRASE_CONTENT", join($categories, ", "));
                        $this->tpl->parseCurrentBlock();
                        $this->tpl->setCurrentBlock("hidden");
                        $this->tpl->setVariable("HIDDEN_NAME", "phrase_$id");
                        $this->tpl->setVariable("HIDDEN_VALUE", "1");
                        $this->tpl->parseCurrentBlock();
                }

                $this->tpl->setCurrentBlock("adm_content");
                $this->tpl->setVariable("TEXT_PHRASE_TITLE", $this->lng->txt("phrase"));
                $this->tpl->setVariable("TEXT_PHRASE_CONTENT", $this->lng->txt("categories"));
                $this->tpl->setVariable("BTN_CONFIRM", $this->lng->txt("confirm"));
                $this->tpl->setVariable("BTN_CANCEL", $this->lng->txt("cancel"));
                $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
                $this->tpl->parseCurrentBlock();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

& ilSurveyPhrasesGUI::executeCommand (  ) 

execute command

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

References $cmd, $ret, and getCommand().

        {
                $cmd = $this->ctrl->getCmd();
                $next_class = $this->ctrl->getNextClass($this);

                $cmd = $this->getCommand($cmd);
                switch($next_class)
                {
                        default:
                                $ret =& $this->$cmd();
                                break;
                }
                return $ret;
        }

Here is the call graph for this function:

ilSurveyPhrasesGUI::getCommand ( cmd  ) 

Retrieves the ilCtrl command.

Retrieves the ilCtrl command

public

Definition at line 93 of file class.ilSurveyPhrasesGUI.php.

References $cmd.

Referenced by executeCommand().

        {
                return $cmd;
        }

Here is the caller graph for this function:

ilSurveyPhrasesGUI::ilSurveyPhrasesGUI ( a_object  ) 

ilSurveyPhrases constructor

The constructor takes possible arguments an creates an instance of the ilSurveyPhrases object.

public

Definition at line 53 of file class.ilSurveyPhrasesGUI.php.

References $ilCtrl, $ilias, $lng, $tpl, and $tree.

  {
                global $lng, $tpl, $ilCtrl, $ilias, $tree;

                include_once "./Modules/SurveyQuestionPool/classes/class.ilSurveyPhrases.php";
    $this->lng =& $lng;
    $this->tpl =& $tpl;
                $this->ctrl =& $ilCtrl;
                $this->ilias =& $ilias;
                $this->gui_object =& $a_object;
                $this->object = new ilSurveyPhrases();
                $this->tree =& $tree;
                $this->ref_id = $a_object->ref_id;
        }

ilSurveyPhrasesGUI::phrases (  ) 

Displays a form to manage the user created phrases.

public

Definition at line 149 of file class.ilSurveyPhrasesGUI.php.

References ilUtil::getImagePath(), and ilUtil::sendInfo().

Referenced by deletePhrase().

        {
                global $rbacsystem;
                
                if ($rbacsystem->checkAccess("write", $this->ref_id))
                {
                        $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_qpl_phrases.html", "Modules/SurveyQuestionPool");
                        $phrases =& $this->object->_getAvailablePhrases(1);
                        if (count($phrases))
                        {
                                include_once "./Services/Utilities/classes/class.ilUtil.php";
                                $colors = array("tblrow1", "tblrow2");
                                $counter = 0;
                                foreach ($phrases as $phrase_id => $phrase_array)
                                {
                                        $this->tpl->setCurrentBlock("phraserow");
                                        $this->tpl->setVariable("PHRASE_ID", $phrase_id);
                                        $this->tpl->setVariable("COLOR_CLASS", $colors[$counter++ % 2]);
                                        $this->tpl->setVariable("PHRASE_TITLE", $phrase_array["title"]);
                                        $categories =& $this->object->_getCategoriesForPhrase($phrase_id);
                                        $this->tpl->setVariable("PHRASE_CONTENT", join($categories, ", "));
                                        $this->tpl->parseCurrentBlock();
                                }
                                $counter++;
                                $this->tpl->setCurrentBlock("selectall");
                                $this->tpl->setVariable("SELECT_ALL", $this->lng->txt("select_all"));
                                $this->tpl->setVariable("COLOR_CLASS", $colors[$counter++ % 2]);
                                $this->tpl->parseCurrentBlock();
                                $this->tpl->setCurrentBlock("Footer");
                                $this->tpl->setVariable("ARROW", "<img src=\"" . ilUtil::getImagePath("arrow_downright.gif") . "\" alt=\"".$this->lng->txt("arrow_downright")."\">");
                                $this->tpl->setVariable("TEXT_DELETE", $this->lng->txt("delete"));
                                $this->tpl->parseCurrentBlock();
                        }
                        else
                        {
                                $this->tpl->setCurrentBlock("Emptytable");
                                $this->tpl->setVariable("TEXT_EMPTYTABLE", $this->lng->txt("no_user_phrases_defined"));
                                $this->tpl->parseCurrentBlock();
                        }
                        $this->tpl->setCurrentBlock("adm_content");
                        $this->tpl->setVariable("INTRODUCTION_MANAGE_PHRASES", $this->lng->txt("introduction_manage_phrases"));
                        $this->tpl->setVariable("TEXT_PHRASE_TITLE", $this->lng->txt("phrase"));
                        $this->tpl->setVariable("TEXT_PHRASE_CONTENT", $this->lng->txt("categories"));
                        $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
                        $this->tpl->parseCurrentBlock();
                }
                else
                {
                        ilUtil::sendInfo($this->lng->txt("cannot_manage_phrases"));
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:


Field Documentation

ilSurveyPhrasesGUI::$ctrl

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

ilSurveyPhrasesGUI::$gui_object

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

ilSurveyPhrasesGUI::$ilias

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

Referenced by ilSurveyPhrasesGUI().

ilSurveyPhrasesGUI::$lng

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

Referenced by ilSurveyPhrasesGUI().

ilSurveyPhrasesGUI::$object

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

ilSurveyPhrasesGUI::$ref_id

Definition at line 44 of file class.ilSurveyPhrasesGUI.php.

ilSurveyPhrasesGUI::$tpl

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

Referenced by ilSurveyPhrasesGUI().

ilSurveyPhrasesGUI::$tree

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

Referenced by ilSurveyPhrasesGUI().


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