68        $this->rbacsystem = 
$DIC->rbac()->system();
 
   69        $this->toolbar = 
$DIC->toolbar();
 
   70        $this->db = 
$DIC->database();
 
   79        $this->gui_object = $a_object;
 
   82        $this->ref_id = $a_object->ref_id;
 
   83        $this->ctrl->saveParameter($this, 
"p_id");
 
   91        $cmd = $this->ctrl->getCmd();
 
   92        $next_class = $this->ctrl->getNextClass($this);
 
   95        switch ($next_class) {
 
   97                $ret = &$this->$cmd();
 
  118        $checked_phrases = 
$_POST[
'phrase'];
 
  119        if (count($checked_phrases)) {
 
  140        $this->ctrl->setParameter($this, 
"p_id", 
"");
 
  142        if (
$rbacsystem->checkAccess(
"write", $this->ref_id)) {
 
  144            $button->setCaption(
"phrase_new");
 
  145            $button->setUrl($this->ctrl->getLinkTarget($this, 
"newPhrase"));
 
  146            $ilToolbar->addButtonInstance($button);
 
  151            foreach ($phrases as $phrase_id => $phrase_array) {
 
  153                array_push(
$data, array(
'phrase_id' => $phrase_id, 
'phrase' => $phrase_array[
"title"], 
'answers' => join(
", ", $categories)));
 
  155            $table_gui->setData(
$data);
 
  156            $this->tpl->setContent($table_gui->getHTML());
 
  167        $this->ctrl->redirect($this, 
"phrases");
 
  175        $phrases = 
$_POST[
'phrase'];
 
  176        $this->
object->deletePhrases($phrases);
 
  177        ilUtil::sendSuccess($this->lng->txt(
"qpl_phrases_deleted"), 
true);
 
  178        $this->ctrl->redirect($this, 
"phrases");
 
  187            "SELECT svy_category.title, svy_category.neutral, svy_phrase_cat.sequence FROM svy_phrase_cat, svy_category WHERE svy_phrase_cat.phrase_fi = %s AND svy_phrase_cat.category_fi = svy_category.category_id ORDER BY svy_phrase_cat.sequence ASC",
 
  193                $categories->addCategory(
$data[
"title"], 0, 
$data[
"neutral"], 
null, 
$data[
'sequence']);
 
  204            "SELECT svy_phrase.title FROM svy_phrase WHERE svy_phrase.phrase_id = %s",
 
  210            return $row[
'title'];
 
  225        foreach ($checked_phrases as $phrase_id) {
 
  226            $phrase_array = $phrases[$phrase_id];
 
  228            array_push(
$data, array(
'phrase_id' => $phrase_id, 
'phrase' => $phrase_array[
"title"], 
'answers' => join(
", ", $categories)));
 
  230        $table_gui->setData(
$data);
 
  231        $this->tpl->setVariable(
'ADM_CONTENT', $table_gui->getHTML());
 
  236        $this->ctrl->redirect($this, 
'phrases');
 
  244                $this->
object->updatePhrase(
$_GET[
'p_id']);
 
  245                ilUtil::sendSuccess($this->lng->txt(
'phrase_saved'), 
true);
 
  247                $this->
object->savePhrase();
 
  248                ilUtil::sendSuccess($this->lng->txt(
'phrase_added'), 
true);
 
  250            $this->ctrl->redirect($this, 
'phrases');
 
  263        $hasErrors = (!$always) ? $this->
phraseEditor(
true) : 
false;
 
  265            $this->
object->title = 
$_POST[
"title"];
 
  267            foreach (
$_POST[
'answers'][
'answer'] as $key => $value) {
 
  268                if (strlen($value)) {
 
  269                    $categories->addCategory($value, 
$_POST[
'answers'][
'other'][$key], 0, 
null, 
$_POST[
'answers'][
'scale'][$key]);
 
  272            if (strlen(
$_POST[
'answers'][
'neutral'])) {
 
  273                $categories->addCategory(
$_POST[
'answers'][
'neutral'], 0, 1, 
null, 
$_POST[
'answers_neutral_scale']);
 
  275            $this->
object->categories = $categories;
 
  284        $this->ctrl->redirect($this, 
'phraseEditor');
 
  289        if (!array_key_exists(
'phrase', 
$_POST)) {
 
  291            $this->ctrl->redirect($this, 
'phrases');
 
  293        if ((array_key_exists(
'phrase', 
$_POST)) && count(
$_POST[
'phrase']) > 1) {
 
  295            $this->ctrl->redirect($this, 
'phrases');
 
  297        $phrase_id = (array_key_exists(
'phrase', 
$_POST)) ? 
$_POST[
'phrase'][key(
$_POST[
'phrase'])] : 
null;
 
  299            $this->ctrl->setParameter($this, 
'p_id', $phrase_id);
 
  301        $this->ctrl->redirect($this, 
'phraseEditor');
 
  306        $save = (strcmp($this->ctrl->getCmd(), 
"saveEditPhrase") == 0) ? 
true : 
false;
 
  309        $form->setFormAction($this->ctrl->getFormAction($this, 
'phraseEditor'));
 
  310        $form->setTitle($this->lng->txt(
'edit_phrase'));
 
  311        $form->setMultipart(
false);
 
  312        $form->setTableWidth(
"100%");
 
  313        $form->setId(
"phraseeditor");
 
  315        $phrase_id = 
$_GET[
'p_id'];
 
  320        $title->setRequired(
true);
 
  321        $form->addItem($title);
 
  325        $answers->setRequired(
true);
 
  326        $answers->setAllowMove(
true);
 
  327        $answers->setShowWizard(
false);
 
  328        $answers->setShowSavePhrase(
false);
 
  329        $answers->setUseOtherAnswer(
false);
 
  330        $answers->setShowNeutralCategory(
true);
 
  331        $answers->setNeutralCategoryTitle($this->lng->txt(
'matrix_neutral_answer'));
 
  333        if (!$categories->getCategoryCount()) {
 
  334            $categories->addCategory(
"");
 
  336        $answers->setValues($categories);
 
  337        $answers->setDisabledScale(
true);
 
  338        $form->addItem($answers);
 
  340        $form->addCommandButton(
"saveEditPhrase", $this->lng->txt(
"save"));
 
  341        $form->addCommandButton(
"cancelEditPhrase", $this->lng->txt(
"cancel"));
 
  346            $form->setValuesByPost();
 
  347            $errors = !$form->checkInput();
 
  348            $form->setValuesByPost(); 
 
  355            $this->tpl->setVariable(
"ADM_CONTENT", $form->getHTML());
 
An exception for terminatinating execution or to throw for unit testing.
Survey phrases GUI class.
getCommand($cmd)
Retrieves the ilCtrl command.
phrases()
Displays a form to manage the user created phrases.
__construct($a_object)
ilSurveyPhrasesGUI constructor
deletePhrasesForm($checked_phrases)
Creates a confirmation form to delete personal phases from the database.
cancelDeletePhrase()
cancel delete phrases
getCategoriesForPhrase($phrase_id)
executeCommand()
execute command
deletePhrase()
Creates a confirmation form to delete personal phases from the database.
phraseEditor($checkonly=false)
writePostData($always=false)
Evaluates a posted edit form and writes the form data in the question object.
confirmDeletePhrase()
confirm delete phrases
getPhraseTitle($phrase_id)
static _getAvailablePhrases($useronly=0)
Gets the available phrases from the database.
static _getCategoriesForPhrase($phrase_id)
Gets the available categories for a given phrase.
This class represents a text property in a property form.
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.