ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilExcCriteriaText Class Reference

Class ilExcCriteriaText. More...

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

Public Member Functions

 __construct ()
 Constructor. More...
 
 getType ()
 
 setMinChars ($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
 getTranslatedType ()
 
 getId ()
 
 getType ()
 
 setParent ($a_value)
 
 getParent ()
 
 setTitle ($a_value)
 
 getTitle ()
 
 setDescription ($a_value)
 
 getDescription ()
 
 setRequired ($a_value)
 
 isRequired ()
 
 setPosition ($a_value)
 
 getPosition ()
 
 importDefinition ($a_def, $a_def_json)
 
 save ()
 
 update ()
 
 delete ()
 
 cloneObject ($a_target_parent_id)
 
 initCustomForm (ilPropertyFormGUI $a_form)
 
 exportCustomForm (ilPropertyFormGUI $a_form)
 
 importCustomForm (ilPropertyFormGUI $a_form)
 
 setPeerReviewContext (ilExAssignment $a_ass, $a_giver_id, $a_peer_id, ilPropertyFormGUI $a_form=null)
 
 addToPeerReviewForm ($a_value=null)
 
 importFromPeerReviewForm ()
 
 updateFromAjax ()
 
 validate ($a_value)
 
 hasValue ($a_value)
 
 getHTML ($a_value)
 
 resetReview ()
 

Protected Attributes

 $lng
 
- Protected Attributes inherited from ilExcCriteria
 $db
 
 $id
 
 $parent
 
 $title
 
 $desc
 
 $required
 
 $pos
 
 $def
 
 $form
 
 $ass
 
 $giver_id
 
 $peer_id
 

Additional Inherited Members

- Static Public Member Functions inherited from ilExcCriteria
static getInstanceById ($a_id)
 
static getInstancesByParentId ($a_parent_id)
 
static getTypesMap ()
 
static getInstanceByType ($a_type)
 
static deleteByParent ($a_parent_id)
 
- Protected Member Functions inherited from ilExcCriteria
 __construct ()
 
 setId ($a_id)
 
 setDefinition (array $a_value=null)
 
 getDefinition ()
 
 importFromDB (array $a_row)
 
 getDBProperties ()
 
 getLastPosition ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilExcCriteriaText::__construct ( )

Constructor.

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

References $DIC, and ILIAS\GlobalScreen\Provider\__construct().

23  {
24  global $DIC;
26 
27  $this->lng = $DIC->language();
28  }
__construct(Container $dic, ilPlugin $plugin)
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

Member Function Documentation

◆ addToPeerReviewForm()

ilExcCriteriaText::addToPeerReviewForm (   $a_value = null)

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

References $lng, ilExcCriteria\getDescription(), ilExcCriteria\getId(), getMinChars(), ilExcCriteria\getTitle(), and ilExcCriteria\isRequired().

88  {
89  $lng = $this->lng;
90 
91  $info = array();
92  if ($this->getDescription()) {
93  $info[] = $this->getDescription();
94  }
95  if ($this->getMinChars()) {
96  $info[] = $lng->txt("exc_peer_review_min_chars") . ": " . $this->getMinChars();
97  }
98  $info = implode("<br />", $info);
99 
100  $input = new ilTextAreaInputGUI($this->getTitle(), "prccc_text_" . $this->getId());
101  $input->setRows(10);
102  $input->setInfo($info);
103  $input->setRequired($this->isRequired());
104  $input->setValue($a_value);
105 
106  $this->form->addItem($input);
107  }
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 66 of file class.ilExcCriteriaText.php.

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

67  {
68  $min = $this->getMinChars();
69  if ($min) {
70  $a_form->getItemByPostVar("peer_char_tgl")->setChecked(true);
71  $a_form->getItemByPostVar("peer_char")->setValue($min);
72  }
73  }
getItemByPostVar($a_post_var)
Get Item by POST variable.
+ Here is the call graph for this function:

◆ getHTML()

ilExcCriteriaText::getHTML (   $a_value)

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

142  {
143  return nl2br($a_value);
144  }

◆ getMinChars()

ilExcCriteriaText::getMinChars ( )

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

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

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

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

◆ getType()

ilExcCriteriaText::getType ( )

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

31  {
32  return "text";
33  }

◆ hasValue()

ilExcCriteriaText::hasValue (   $a_value)

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

Referenced by validate().

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

◆ importCustomForm()

ilExcCriteriaText::importCustomForm ( ilPropertyFormGUI  $a_form)

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

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

76  {
77  $this->setDefinition(null);
78 
79  if ($a_form->getInput("peer_char_tgl")) {
80  $this->setMinChars($a_form->getInput("peer_char"));
81  }
82  }
setDefinition(array $a_value=null)
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
+ Here is the call graph for this function:

◆ importFromPeerReviewForm()

ilExcCriteriaText::importFromPeerReviewForm ( )

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

110  {
111  return trim($this->form->getInput("prccc_text_" . $this->getId()));
112  }

◆ initCustomForm()

ilExcCriteriaText::initCustomForm ( ilPropertyFormGUI  $a_form)

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

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

53  {
54  $lng = $this->lng;
55 
56  $peer_char_tgl = new ilCheckboxInputGUI($lng->txt("exc_peer_review_min_chars_tgl"), "peer_char_tgl");
57  $a_form->addItem($peer_char_tgl);
58 
59  $peer_char = new ilNumberInputGUI($lng->txt("exc_peer_review_min_chars"), "peer_char");
60  $peer_char->setInfo($lng->txt("exc_peer_review_min_chars_info"));
61  $peer_char->setRequired(true);
62  $peer_char->setSize(3);
63  $peer_char_tgl->addSubItem($peer_char);
64  }
This class represents a checkbox property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
setInfo($a_info)
Set Information Text.
This class represents a number property in a property form.
+ Here is the call graph for this function:

◆ setMinChars()

ilExcCriteriaText::setMinChars (   $a_value)

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

References ilExcCriteria\setDefinition().

Referenced by importCustomForm().

36  {
37  $this->setDefinition(array("chars" => (int) $a_value));
38  }
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 114 of file class.ilExcCriteriaText.php.

References $lng, ilExcCriteria\getId(), getMinChars(), hasValue(), ilExcCriteria\isRequired(), and ilStr\strLen().

115  {
116  $lng = $this->lng;
117 
118  if (!$this->hasValue($a_value) &&
119  !$this->isRequired()) {
120  return true;
121  }
122 
123  $min = $this->getMinChars();
124  if ($min) {
125  if (ilStr::strLen($a_value) < $min) {
126  if ($this->form) {
127  $mess = sprintf($lng->txt("exc_peer_review_chars_invalid"), $min);
128  $this->form->getItemByPostVar("prccc_text_" . $this->getId())->setAlert($mess);
129  }
130  return false;
131  }
132  }
133  return true;
134  }
static strLen($a_string)
Definition: class.ilStr.php:78
+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilExcCriteriaText::$lng
protected

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

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


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