ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 24 of file class.ilExcCriteriaText.php.

References $DIC.

25  {
26  global $DIC;
27  parent::__construct();
28 
29  $this->lng = $DIC->language();
30  }
global $DIC
Definition: saml.php:7

Member Function Documentation

◆ addToPeerReviewForm()

ilExcCriteriaText::addToPeerReviewForm (   $a_value = null)

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

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

90  {
91  $lng = $this->lng;
92 
93  $info = array();
94  if ($this->getDescription()) {
95  $info[] = $this->getDescription();
96  }
97  if ($this->getMinChars()) {
98  $info[] = $lng->txt("exc_peer_review_min_chars") . ": " . $this->getMinChars();
99  }
100  $info = implode("<br />", $info);
101 
102  $input = new ilTextAreaInputGUI($this->getTitle(), "prccc_text_" . $this->getId());
103  $input->setRows(10);
104  $input->setInfo($info);
105  $input->setRequired($this->isRequired());
106  $input->setValue($a_value);
107 
108  $this->form->addItem($input);
109  }
Create styles array
The data for the language used.
This class represents a text area property in a property form.
$info
Definition: index.php:5
+ Here is the call graph for this function:

◆ exportCustomForm()

ilExcCriteriaText::exportCustomForm ( ilPropertyFormGUI  $a_form)

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

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

69  {
70  $min = $this->getMinChars();
71  if ($min) {
72  $a_form->getItemByPostVar("peer_char_tgl")->setChecked(true);
73  $a_form->getItemByPostVar("peer_char")->setValue($min);
74  }
75  }
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 144 of file class.ilExcCriteriaText.php.

145  {
146  return nl2br($a_value);
147  }

◆ getMinChars()

ilExcCriteriaText::getMinChars ( )

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

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

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

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

◆ getType()

ilExcCriteriaText::getType ( )

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

33  {
34  return "text";
35  }

◆ hasValue()

ilExcCriteriaText::hasValue (   $a_value)

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

Referenced by validate().

140  {
141  return (bool) strlen($a_value);
142  }
+ Here is the caller graph for this function:

◆ importCustomForm()

ilExcCriteriaText::importCustomForm ( ilPropertyFormGUI  $a_form)

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

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

78  {
79  $this->setDefinition(null);
80 
81  if ($a_form->getInput("peer_char_tgl")) {
82  $this->setMinChars($a_form->getInput("peer_char"));
83  }
84  }
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 111 of file class.ilExcCriteriaText.php.

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

◆ initCustomForm()

ilExcCriteriaText::initCustomForm ( ilPropertyFormGUI  $a_form)

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

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

55  {
56  $lng = $this->lng;
57 
58  $peer_char_tgl = new ilCheckboxInputGUI($lng->txt("exc_peer_review_min_chars_tgl"), "peer_char_tgl");
59  $a_form->addItem($peer_char_tgl);
60 
61  $peer_char = new ilNumberInputGUI($lng->txt("exc_peer_review_min_chars"), "peer_char");
62  $peer_char->setInfo($lng->txt("exc_peer_review_min_chars_info"));
63  $peer_char->setRequired(true);
64  $peer_char->setSize(3);
65  $peer_char_tgl->addSubItem($peer_char);
66  }
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 37 of file class.ilExcCriteriaText.php.

References array, and ilExcCriteria\setDefinition().

Referenced by importCustomForm().

38  {
39  $this->setDefinition(array("chars" => (int) $a_value));
40  }
setDefinition(array $a_value=null)
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ validate()

ilExcCriteriaText::validate (   $a_value)

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

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

117  {
118  $lng = $this->lng;
119 
120  if (!$this->hasValue($a_value) &&
121  !$this->isRequired()) {
122  return true;
123  }
124 
125  $min = $this->getMinChars();
126  if ($min) {
127  include_once "Services/Utilities/classes/class.ilStr.php";
128  if (ilStr::strLen($a_value) < $min) {
129  if ($this->form) {
130  $mess = sprintf($lng->txt("exc_peer_review_chars_invalid"), $min);
131  $this->form->getItemByPostVar("prccc_text_" . $this->getId())->setAlert($mess);
132  }
133  return false;
134  }
135  }
136  return true;
137  }
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 18 of file class.ilExcCriteriaText.php.

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


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