ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ilExcCriteriaFile Class Reference

Class ilExcCriteriaFile. More...

+ Inheritance diagram for ilExcCriteriaFile:
+ Collaboration diagram for ilExcCriteriaFile:

Public Member Functions

 getType ()
 
 getFiles ()
 
 resetReview ()
 
 addToPeerReviewForm ($a_value=null)
 
 importFromPeerReviewForm ()
 
 hasValue ($a_value)
 
 validate ($a_value)
 
 getFileByHash ()
 
 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 ()
 

Protected Attributes

ILIAS Exercise PeerReview DomainService $peer_review
 
string $requested_file_hash = ""
 
- Protected Attributes inherited from ilExcCriteria
ILIAS Exercise InternalGUIService $gui
 
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
 

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 ()
 

Detailed Description

Member Function Documentation

◆ addToPeerReviewForm()

ilExcCriteriaFile::addToPeerReviewForm (   $a_value = null)

Reimplemented from ilExcCriteria.

Definition at line 70 of file class.ilExcCriteriaFile.php.

70 : void
71 {
72 $existing = array();
73 foreach ($this->getFiles() as $file) {
74 $existing[] = $file->getTitle();
75 }
76 $files = new ilFileInputGUI($this->getTitle(), "prccc_file_" . $this->getId());
77 $files->setInfo($this->getDescription());
78 $files->setRequired($this->isRequired());
79 $files->setValue(implode("<br />", $existing));
80 $files->setAllowDeletion(true);
81 $this->form->addItem($files);
82 }
This class represents a file property in a property form.
form(?array $class_path, string $cmd, string $submit_caption="")

References ILIAS\Repository\form(), ilExcCriteria\getDescription(), getFiles(), ilExcCriteria\getId(), ilExcCriteria\getTitle(), and ilExcCriteria\isRequired().

+ Here is the call graph for this function:

◆ getFileByHash()

ilExcCriteriaFile::getFileByHash ( )

Definition at line 128 of file class.ilExcCriteriaFile.php.

128 : ?CriteriaFile
129 {
130 $hash = trim($this->requested_file_hash);
131 if ($hash != "") {
132 foreach ($this->getFiles() as $file) {
133 if (md5($file->getTitle()) == $hash) {
134 return $file;
135 }
136 }
137 }
138 return null;
139 }

References getFiles().

+ Here is the call graph for this function:

◆ getFiles()

ilExcCriteriaFile::getFiles ( )
Returns
CriteriaFile[]

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

53 : array
54 {
55 $file_manager = $this->peer_review->criteriaFile($this->ass->getId());
56 $file = $file_manager->getFile($this->giver_id, $this->peer_id, (int) $this->getId());
57 $files = $file ? [$file]
58 : [];
59 return $files;
60 }

References ilExcCriteria\getId().

Referenced by addToPeerReviewForm(), getFileByHash(), getHTML(), and hasValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHTML()

ilExcCriteriaFile::getHTML (   $a_value)

Reimplemented from ilExcCriteria.

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

141 : string
142 {
143 $ilCtrl = $this->ctrl;
144
145 $crit_id = $this->getId()
146 ?: "file";
147 $ilCtrl->setParameterByClass(
148 "ilExPeerReviewGUI",
149 "fu",
150 $this->giver_id . "__" . $this->peer_id . "__" . $crit_id
151 );
152
153 $files = array();
154 foreach ($this->getFiles() as $file) {
155 $ilCtrl->setParameterByClass("ilExPeerReviewGUI", "fuf", md5($file->getTitle()));
156 $dl = $ilCtrl->getLinkTargetByClass("ilExPeerReviewGUI", "downloadPeerReview");
157 $ilCtrl->setParameterByClass("ilExPeerReviewGUI", "fuf", "");
158
159 $files[] = '<a href="' . $dl . '">' . $file->getTitle() . '</a>';
160 }
161
162 $ilCtrl->setParameterByClass("ilExPeerReviewGUI", "fu", "");
163
164 return implode("<br />", $files);
165 }

References ilExcCriteria\$ctrl, getFiles(), and ilExcCriteria\getId().

+ Here is the call graph for this function:

◆ getType()

ilExcCriteriaFile::getType ( )

Reimplemented from ilExcCriteria.

Definition at line 45 of file class.ilExcCriteriaFile.php.

45 : string
46 {
47 return "file";
48 }

◆ hasValue()

ilExcCriteriaFile::hasValue (   $a_value)

Reimplemented from ilExcCriteria.

Definition at line 107 of file class.ilExcCriteriaFile.php.

107 : bool
108 {
109 return count($this->getFiles()) > 0;
110 }

References getFiles().

Referenced by validate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ importFromPeerReviewForm()

ilExcCriteriaFile::importFromPeerReviewForm ( )
Exceptions
ilException

Reimplemented from ilExcCriteria.

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

87 : void
88 {
89 $file_manager = $this->peer_review->criteriaFile($this->ass->getId());
90 if ($this->form->getItemByPostVar("prccc_file_" . $this->getId())->getDeletionFlag()) {
91 $file_manager->delete($this->giver_id, $this->peer_id, $this->getId());
92 $this->form->getItemByPostVar("prccc_file_" . $this->getId())->setValue("");
93 }
94
95 $incoming = $_FILES["prccc_file_" . $this->getId()];
96 if ($incoming["tmp_name"]) {
97 $org_name = basename($incoming["name"]);
98 $file_manager->addFromLegacyUpload(
99 $incoming,
100 $this->giver_id,
101 $this->peer_id,
102 (int) $this->getId()
103 );
104 }
105 }

References ILIAS\Repository\form(), and ilExcCriteria\getId().

+ Here is the call graph for this function:

◆ resetReview()

ilExcCriteriaFile::resetReview ( )

Reimplemented from ilExcCriteria.

Definition at line 62 of file class.ilExcCriteriaFile.php.

62 : void
63 {
64 $this->peer_review->criteriaFile($this->ass->getId())
65 ->delete($this->giver_id, $this->peer_id, $this->getId());
66 }

References ilExcCriteria\getId().

+ Here is the call graph for this function:

◆ validate()

ilExcCriteriaFile::validate (   $a_value)

Reimplemented from ilExcCriteria.

Definition at line 112 of file class.ilExcCriteriaFile.php.

112 : bool
113 {
115
116 // because of deletion flag we have to also check ourselves
117 if ($this->isRequired()) {
118 if (!$this->hasValue($a_value)) {
119 if ($this->form) {
120 $this->form->getItemByPostVar("prccc_file_" . $this->getId())->setAlert($lng->txt("msg_input_is_required"));
121 }
122 return false;
123 }
124 }
125 return true;
126 }
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...

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

+ Here is the call graph for this function:

Field Documentation

◆ $peer_review

ILIAS Exercise PeerReview DomainService ilExcCriteriaFile::$peer_review
protected

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

◆ $requested_file_hash

string ilExcCriteriaFile::$requested_file_hash = ""
protected

Definition at line 31 of file class.ilExcCriteriaFile.php.


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