ILIAS  release_8 Revision v8.23
ilExcCriteriaText Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilExcCriteriaText:
+ Collaboration diagram for ilExcCriteriaText:

Public Member Functions

 getType ()
 
 setMinChars (int $a_value)
 
 getMinChars ()
 
 initCustomForm (ilPropertyFormGUI $a_form)
 
 exportCustomForm (ilPropertyFormGUI $a_form)
 
 importCustomForm (ilPropertyFormGUI $a_form)
 
 addToPeerReviewForm ($a_value=null)
 
 importFromPeerReviewForm ()
 
 validate ($a_value)
 
 hasValue ($a_value)
 
 getHTML ($a_value)
 
- Public Member Functions inherited from ilExcCriteria
 __construct ()
 
 getTranslatedType ()
 
 getId ()
 
 getType ()
 
 setParent (?int $a_value)
 
 getParent ()
 
 setTitle (?string $a_value)
 
 getTitle ()
 
 setDescription (?string $a_value)
 
 getDescription ()
 
 setRequired (bool $a_value)
 
 isRequired ()
 
 setPosition (int $a_value)
 
 getPosition ()
 
 importDefinition (string $a_def, string $a_def_json)
 
 save ()
 
 update ()
 
 delete ()
 
 cloneObject (int $a_target_parent_id)
 
 initCustomForm (ilPropertyFormGUI $a_form)
 
 exportCustomForm (ilPropertyFormGUI $a_form)
 
 importCustomForm (ilPropertyFormGUI $a_form)
 
 setPeerReviewContext (ilExAssignment $a_ass, int $a_giver_id, int $a_peer_id, ilPropertyFormGUI $a_form=null)
 
 addToPeerReviewForm ($a_value=null)
 
 importFromPeerReviewForm ()
 
 updateFromAjax ()
 
 validate ($a_value)
 
 hasValue ($a_value)
 
 getHTML ($a_value)
 
 resetReview ()
 

Additional Inherited Members

- Static Public Member Functions inherited from ilExcCriteria
static getInstanceById (int $a_id)
 
static getInstancesByParentId (int $a_parent_id)
 
static getTypesMap ()
 
static getInstanceByType (string $a_type)
 
static deleteByParent (int $a_parent_id)
 
- Protected Member Functions inherited from ilExcCriteria
 setId (?int $a_id)
 
 setDefinition (?array $a_value=null)
 
 getDefinition ()
 
 importFromDB (array $a_row)
 
 getDBProperties ()
 
 getLastPosition ()
 
- Protected Attributes inherited from ilExcCriteria
ilLanguage $lng
 
ilCtrl $ctrl
 
ilDBInterface $db
 
int $id = null
 
int $parent = null
 
string $title = ""
 
string $desc = ""
 
bool $required = false
 
int $pos = 0
 
array $def = null
 
ilPropertyFormGUI $form = null
 
ilExAssignment $ass
 
int $giver_id = 0
 
int $peer_id = 0
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilExcCriteriaText

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 25 of file class.ilExcCriteriaText.php.

Member Function Documentation

◆ addToPeerReviewForm()

ilExcCriteriaText::addToPeerReviewForm (   $a_value = null)

Definition at line 86 of file class.ilExcCriteriaText.php.

References ilExcCriteria\$lng, ILIAS\Repository\form(), ilExcCriteria\getDescription(), ilExcCriteria\getId(), getMinChars(), ilExcCriteria\getTitle(), ilExcCriteria\isRequired(), and ilLanguage\txt().

86  : void
87  {
88  $lng = $this->lng;
89 
90  $info = array();
91  if ($this->getDescription()) {
92  $info[] = $this->getDescription();
93  }
94  if ($this->getMinChars()) {
95  $info[] = $lng->txt("exc_peer_review_min_chars") . ": " . $this->getMinChars();
96  }
97  $info = implode("<br />", $info);
98 
99  $input = new ilTextAreaInputGUI($this->getTitle(), "prccc_text_" . $this->getId());
100  $input->setRows(10);
101  $input->setInfo($info);
102  $input->setRequired($this->isRequired());
103  $input->setValue((string) $a_value);
104 
105  $this->form->addItem($input);
106  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
form( $class_path, string $cmd)
This class represents a text area property in a property form.
+ Here is the call graph for this function:

◆ exportCustomForm()

ilExcCriteriaText::exportCustomForm ( ilPropertyFormGUI  $a_form)

Definition at line 65 of file class.ilExcCriteriaText.php.

References ilPropertyFormGUI\getItemByPostVar(), and getMinChars().

65  : void
66  {
67  $min = $this->getMinChars();
68  if ($min) {
69  $a_form->getItemByPostVar("peer_char_tgl")->setChecked(true);
70  $a_form->getItemByPostVar("peer_char")->setValue($min);
71  }
72  }
getItemByPostVar(string $a_post_var)
+ Here is the call graph for this function:

◆ getHTML()

ilExcCriteriaText::getHTML (   $a_value)

Definition at line 140 of file class.ilExcCriteriaText.php.

140  : string
141  {
142  return nl2br($a_value);
143  }

◆ getMinChars()

ilExcCriteriaText::getMinChars ( )

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

References ilExcCriteria\$def, and ilExcCriteria\getDefinition().

Referenced by addToPeerReviewForm(), exportCustomForm(), and validate().

37  : int
38  {
39  $def = $this->getDefinition();
40  if (is_array($def)) {
41  return (int) $def["chars"];
42  }
43 
44  return 0;
45  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getType()

ilExcCriteriaText::getType ( )

Definition at line 27 of file class.ilExcCriteriaText.php.

27  : string
28  {
29  return "text";
30  }

◆ hasValue()

ilExcCriteriaText::hasValue (   $a_value)

Definition at line 135 of file class.ilExcCriteriaText.php.

Referenced by validate().

135  : bool
136  {
137  return (bool) strlen($a_value);
138  }
+ Here is the caller graph for this function:

◆ importCustomForm()

ilExcCriteriaText::importCustomForm ( ilPropertyFormGUI  $a_form)

Definition at line 74 of file class.ilExcCriteriaText.php.

References ilPropertyFormGUI\getInput(), ilExcCriteria\setDefinition(), and setMinChars().

74  : void
75  {
76  $this->setDefinition(null);
77 
78  if ($a_form->getInput("peer_char_tgl")) {
79  $this->setMinChars($a_form->getInput("peer_char"));
80  }
81  }
setDefinition(?array $a_value=null)
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
+ Here is the call graph for this function:

◆ importFromPeerReviewForm()

ilExcCriteriaText::importFromPeerReviewForm ( )

Definition at line 108 of file class.ilExcCriteriaText.php.

References ILIAS\Repository\form().

108  : string
109  {
110  return trim($this->form->getInput("prccc_text_" . $this->getId()));
111  }
form( $class_path, string $cmd)
+ Here is the call graph for this function:

◆ initCustomForm()

ilExcCriteriaText::initCustomForm ( ilPropertyFormGUI  $a_form)

Definition at line 51 of file class.ilExcCriteriaText.php.

References ilExcCriteria\$lng, ilPropertyFormGUI\addItem(), ilFormPropertyGUI\setInfo(), and ilLanguage\txt().

51  : void
52  {
53  $lng = $this->lng;
54 
55  $peer_char_tgl = new ilCheckboxInputGUI($lng->txt("exc_peer_review_min_chars_tgl"), "peer_char_tgl");
56  $a_form->addItem($peer_char_tgl);
57 
58  $peer_char = new ilNumberInputGUI($lng->txt("exc_peer_review_min_chars"), "peer_char");
59  $peer_char->setInfo($lng->txt("exc_peer_review_min_chars_info"));
60  $peer_char->setRequired(true);
61  $peer_char->setSize(3);
62  $peer_char_tgl->addSubItem($peer_char);
63  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This class represents a checkbox property in a property form.
This class represents a number property in a property form.
+ Here is the call graph for this function:

◆ setMinChars()

ilExcCriteriaText::setMinChars ( int  $a_value)

Definition at line 32 of file class.ilExcCriteriaText.php.

References ilExcCriteria\setDefinition().

Referenced by importCustomForm().

32  : void
33  {
34  $this->setDefinition(array("chars" => $a_value));
35  }
setDefinition(?array $a_value=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ validate()

ilExcCriteriaText::validate (   $a_value)

Definition at line 113 of file class.ilExcCriteriaText.php.

References ilExcCriteria\$lng, ILIAS\Repository\form(), ilExcCriteria\getId(), getMinChars(), hasValue(), ilExcCriteria\isRequired(), ilStr\strLen(), and ilLanguage\txt().

113  : bool
114  {
115  $lng = $this->lng;
116 
117  if (!$this->hasValue($a_value) &&
118  !$this->isRequired()) {
119  return true;
120  }
121 
122  $min = $this->getMinChars();
123  if ($min) {
124  if (ilStr::strLen((string) $a_value) < $min) {
125  if ($this->form) {
126  $mess = sprintf($lng->txt("exc_peer_review_chars_invalid"), $min);
127  $this->form->getItemByPostVar("prccc_text_" . $this->getId())->setAlert($mess);
128  }
129  return false;
130  }
131  }
132  return true;
133  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static strLen(string $a_string)
Definition: class.ilStr.php:63
form( $class_path, string $cmd)
+ Here is the call graph for this function:

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