ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 69 of file class.ilExcCriteriaFile.php.

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

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

131 {
132 $hash = trim($this->requested_file_hash);
133 if ($hash != "") {
134 foreach ($this->getFiles() as $file) {
135 if (md5($file->getTitle()) == $hash) {
136 return $file;
137 }
138 }
139 }
140 return false;
141 }

References getFiles().

+ Here is the call graph for this function:

◆ getFiles()

ilExcCriteriaFile::getFiles ( )
Returns
\ILIAS\Exercise\PeerReview\Criteria\CriteriaFile[]

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

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

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 143 of file class.ilExcCriteriaFile.php.

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

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

+ Here is the call graph for this function:

◆ getType()

ilExcCriteriaFile::getType ( )

Reimplemented from ilExcCriteria.

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

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

◆ hasValue()

ilExcCriteriaFile::hasValue (   $a_value)

Reimplemented from ilExcCriteria.

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

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

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 86 of file class.ilExcCriteriaFile.php.

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

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

+ Here is the call graph for this function:

◆ resetReview()

ilExcCriteriaFile::resetReview ( )

Reimplemented from ilExcCriteria.

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

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

References ilExcCriteria\getId().

+ Here is the call graph for this function:

◆ validate()

ilExcCriteriaFile::validate (   $a_value)

Reimplemented from ilExcCriteria.

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

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

◆ $requested_file_hash

string ilExcCriteriaFile::$requested_file_hash = ""
protected

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


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