ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilExcCriteriaFile Class Reference

Class ilExcCriteriaFile. More...

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

Public Member Functions

 __construct ()
 Constructor. More...
 
 getType ()
 
 getFiles ()
 
 resetReview ()
 
 addToPeerReviewForm ($a_value=null)
 
 importFromPeerReviewForm ()
 
 hasValue ($a_value)
 
 validate ($a_value)
 
 getFileByHash ()
 
 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 Member Functions

 initStorage ()
 
- Protected Member Functions inherited from ilExcCriteria
 __construct ()
 
 setId ($a_id)
 
 setDefinition (array $a_value=null)
 
 getDefinition ()
 
 importFromDB (array $a_row)
 
 getDBProperties ()
 
 getLastPosition ()
 

Protected Attributes

 $lng
 
 $ctrl
 
- 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)
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilExcCriteriaFile::__construct ( )

Constructor.

Reimplemented from ilExcCriteria.

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

30 {
31 global $DIC;
32 parent::__construct();
33
34 $this->lng = $DIC->language();
35 $this->ctrl = $DIC->ctrl();
36 }
global $DIC
Definition: saml.php:7

References $DIC.

Member Function Documentation

◆ addToPeerReviewForm()

ilExcCriteriaFile::addToPeerReviewForm (   $a_value = null)

Reimplemented from ilExcCriteria.

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

67 {
68 $existing = array();
69 foreach ($this->getFiles() as $file) {
70 $existing[] = basename($file);
71 }
72
73 $files = new ilFileInputGUI($this->getTitle(), "prccc_file_" . $this->getId());
74 $files->setInfo($this->getDescription());
75 $files->setRequired($this->isRequired());
76 $files->setValue(implode("<br />", $existing));
77 $files->setALlowDeletion(true);
78 $this->form->addItem($files);
79 }
This class represents a file property in a property form.
$files
Definition: metarefresh.php:49

References $files, ilExcCriteria\getDescription(), getFiles(), ilExcCriteria\getId(), ilExcCriteria\getTitle(), and ilExcCriteria\isRequired().

+ Here is the call graph for this function:

◆ getFileByHash()

ilExcCriteriaFile::getFileByHash ( )

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

125 {
126 $hash = trim($_GET["fuf"]);
127 if ($hash) {
128 foreach ($this->getFiles() as $file) {
129 if (md5($file) == $hash) {
130 return $file;
131 }
132 }
133 }
134 }
$_GET["client_id"]

References $_GET, and getFiles().

+ Here is the call graph for this function:

◆ getFiles()

ilExcCriteriaFile::getFiles ( )

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

51 {
52 $path = $this->initStorage();
53 return (array) glob($path . "*.*");
54 }
$path
Definition: aliased.php:25

References $path, and initStorage().

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

137 {
139
140 $crit_id = $this->getId()
141 ? $this->getId()
142 : "file";
143 $ilCtrl->setParameterByClass("ilExPeerReviewGUI", "fu", $this->giver_id . "__" . $this->peer_id . "__" . $crit_id);
144
145 $files = array();
146 foreach ($this->getFiles() as $file) {
147 $ilCtrl->setParameterByClass("ilExPeerReviewGUI", "fuf", md5($file));
148 $dl = $ilCtrl->getLinkTargetByClass("ilExPeerReviewGUI", "downloadPeerReview");
149 $ilCtrl->setParameterByClass("ilExPeerReviewGUI", "fuf", "");
150
151 $files[] = '<a href="' . $dl . '">' . basename($file) . '</a>';
152 }
153
154 $ilCtrl->setParameterByClass("ilExPeerReviewGUI", "fu", "");
155
156 return implode("<br />", $files);
157 }
global $ilCtrl
Definition: ilias.php:18

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

+ Here is the call graph for this function:

◆ getType()

ilExcCriteriaFile::getType ( )

Reimplemented from ilExcCriteria.

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

39 {
40 return "file";
41 }

◆ hasValue()

ilExcCriteriaFile::hasValue (   $a_value)

Reimplemented from ilExcCriteria.

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

104 {
105 return (bool) sizeof($this->getFiles());
106 }

References getFiles().

Referenced by validate().

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

◆ importFromPeerReviewForm()

ilExcCriteriaFile::importFromPeerReviewForm ( )

Reimplemented from ilExcCriteria.

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

82 {
83 $path = $this->initStorage();
84
85 if ($this->form->getItemByPostVar("prccc_file_" . $this->getId())->getDeletionFlag()) {
87 $this->form->getItemByPostVar("prccc_file_" . $this->getId())->setValue(null);
88 }
89
90 $incoming = $_FILES["prccc_file_" . $this->getId()];
91 if ($incoming["tmp_name"]) {
92 $org_name = basename($incoming["name"]);
93
94 ilUtil::moveUploadedFile(
95 $incoming["tmp_name"],
96 $org_name,
97 $path . $org_name,
98 false
99 );
100 }
101 }
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively

References $path, ilUtil\delDir(), ilExcCriteria\getId(), and initStorage().

+ Here is the call graph for this function:

◆ initStorage()

ilExcCriteriaFile::initStorage ( )
protected

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

44 {
45 include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
46 $storage = new ilFSStorageExercise($this->ass->getExerciseId(), $this->ass->getId());
47 return $storage->getPeerReviewUploadPath($this->peer_id, $this->giver_id, $this->getId());
48 }

References ilExcCriteria\getId().

Referenced by getFiles(), and importFromPeerReviewForm().

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

◆ resetReview()

ilExcCriteriaFile::resetReview ( )

Reimplemented from ilExcCriteria.

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

57 {
58 include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
59 $storage = new ilFSStorageExercise($this->ass->getExerciseId(), $this->ass->getId());
60 $storage->deleteDirectory($storage->getPeerReviewUploadPath($this->peer_id, $this->giver_id, $this->getId()));
61 }

◆ validate()

ilExcCriteriaFile::validate (   $a_value)

Reimplemented from ilExcCriteria.

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

109 {
111
112 // because of deletion flag we have to also check ourselves
113 if ($this->isRequired()) {
114 if (!$this->hasValue($a_value)) {
115 if ($this->form) {
116 $this->form->getItemByPostVar("prccc_file_" . $this->getId())->setAlert($lng->txt("msg_input_is_required"));
117 }
118 return false;
119 }
120 }
121 return true;
122 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilExcCriteriaFile::$ctrl
protected

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

Referenced by getHTML().

◆ $lng

ilExcCriteriaFile::$lng
protected

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

Referenced by validate().


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