ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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
 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 ()
 

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 Attributes inherited from ilExcCriteria
 $id
 
 $parent
 
 $title
 
 $desc
 
 $required
 
 $pos
 
 $def
 
 $form
 
 $ass
 
 $giver_id
 
 $peer_id
 

Detailed Description

Member Function Documentation

◆ addToPeerReviewForm()

ilExcCriteriaFile::addToPeerReviewForm (   $a_value = null)

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

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

44  {
45  $existing = array();
46  foreach($this->getFiles() as $file)
47  {
48  $existing[] = basename($file);
49  }
50 
51  $files = new ilFileInputGUI($this->getTitle(), "prccc_file_".$this->getId());
52  $files->setInfo($this->getDescription());
53  $files->setRequired($this->isRequired());
54  $files->setValue(implode("<br />", $existing));
55  $files->setALlowDeletion(true);
56  $this->form->addItem($files);
57  }
$files
Definition: add-vimline.php:18
This class represents a file property in a property form.
Create styles array
The data for the language used.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the call graph for this function:

◆ getFileByHash()

ilExcCriteriaFile::getFileByHash ( )

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

References $_GET, $file, and getFiles().

106  {
107  $hash = trim($_GET["fuf"]);
108  if($hash)
109  {
110  foreach($this->getFiles() as $file)
111  {
112  if(md5($file) == $hash)
113  {
114  return $file;
115  }
116  }
117  }
118  }
$_GET["client_id"]
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the call graph for this function:

◆ getFiles()

ilExcCriteriaFile::getFiles ( )

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

References $path, array, and initStorage().

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

28  {
29  $path = $this->initStorage();
30  return (array)glob($path."*.*");
31  }
$path
Definition: aliased.php:25
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:

◆ getHTML()

ilExcCriteriaFile::getHTML (   $a_value)

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

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

121  {
122  global $ilCtrl;
123 
124  $crit_id = $this->getId()
125  ? $this->getId()
126  : "file";
127  $ilCtrl->setParameterByClass("ilExPeerReviewGUI", "fu", $this->giver_id."__".$this->peer_id."__".$crit_id);
128 
129  $files = array();
130  foreach($this->getFiles() as $file)
131  {
132  $ilCtrl->setParameterByClass("ilExPeerReviewGUI", "fuf", md5($file));
133  $dl = $ilCtrl->getLinkTargetByClass("ilExPeerReviewGUI", "downloadPeerReview");
134  $ilCtrl->setParameterByClass("ilExPeerReviewGUI", "fuf", "");
135 
136  $files[] = '<a href="'.$dl.'">'.basename($file).'</a>';
137  }
138 
139  $ilCtrl->setParameterByClass("ilExPeerReviewGUI", "fu", "");
140 
141  return implode("<br />", $files);
142  }
$files
Definition: add-vimline.php:18
global $ilCtrl
Definition: ilias.php:18
Create styles array
The data for the language used.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the call graph for this function:

◆ getType()

ilExcCriteriaFile::getType ( )

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

16  {
17  return "file";
18  }

◆ hasValue()

ilExcCriteriaFile::hasValue (   $a_value)

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

References getFiles().

Referenced by validate().

82  {
83  return (bool)sizeof($this->getFiles());
84  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ importFromPeerReviewForm()

ilExcCriteriaFile::importFromPeerReviewForm ( )

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

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

60  {
61  $path = $this->initStorage();
62 
63  if($this->form->getItemByPostVar("prccc_file_".$this->getId())->getDeletionFlag())
64  {
66  $this->form->getItemByPostVar("prccc_file_".$this->getId())->setValue(null);
67  }
68 
69  $incoming = $_FILES["prccc_file_".$this->getId()];
70  if($incoming["tmp_name"])
71  {
72  $org_name = basename($incoming["name"]);
73 
74  ilUtil::moveUploadedFile($incoming["tmp_name"],
75  $org_name,
76  $path.$org_name,
77  false);
78  }
79  }
$path
Definition: aliased.php:25
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
+ Here is the call graph for this function:

◆ initStorage()

ilExcCriteriaFile::initStorage ( )
protected

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

References ilExcCriteria\getId(), and ilFSStorageExercise\getPeerReviewUploadPath().

Referenced by getFiles(), and importFromPeerReviewForm().

21  {
22  include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
23  $storage = new ilFSStorageExercise($this->ass->getExerciseId(), $this->ass->getId());
24  return $storage->getPeerReviewUploadPath($this->peer_id, $this->giver_id, $this->getId());
25  }
getPeerReviewUploadPath($a_peer_id, $a_giver_id, $a_crit_id)
Get pear review upload path (each peer handled in a separate path)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetReview()

ilExcCriteriaFile::resetReview ( )

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

References ilFileSystemStorage\deleteDirectory().

34  {
35  include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
36  $storage = new ilFSStorageExercise($this->ass->getExerciseId(), $this->ass->getId());
37  $storage->deleteDirectory($storage->getPeerReviewUploadPath($this->peer_id, $this->giver_id, $this->getId()));
38  }
deleteDirectory($a_abs_name)
Delete directory.
+ Here is the call graph for this function:

◆ validate()

ilExcCriteriaFile::validate (   $a_value)

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

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

87  {
88  global $lng;
89 
90  // because of deletion flag we have to also check ourselves
91  if($this->isRequired())
92  {
93  if(!$this->hasValue($a_value))
94  {
95  if($this->form)
96  {
97  $this->form->getItemByPostVar("prccc_file_".$this->getId())->setAlert($lng->txt("msg_input_is_required"));
98  }
99  return false;
100  }
101  }
102  return true;
103  }
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

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