ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

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

References $DIC, and ILIAS\GlobalScreen\Provider\__construct().

28  {
29  global $DIC;
31 
32  $this->lng = $DIC->language();
33  $this->ctrl = $DIC->ctrl();
34  }
__construct(Container $dic, ilPlugin $plugin)
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

Member Function Documentation

◆ addToPeerReviewForm()

ilExcCriteriaFile::addToPeerReviewForm (   $a_value = null)

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

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

63  {
64  $existing = array();
65  foreach ($this->getFiles() as $file) {
66  $existing[] = basename($file);
67  }
68 
69  $files = new ilFileInputGUI($this->getTitle(), "prccc_file_" . $this->getId());
70  $files->setInfo($this->getDescription());
71  $files->setRequired($this->isRequired());
72  $files->setValue(implode("<br />", $existing));
73  $files->setALlowDeletion(true);
74  $this->form->addItem($files);
75  }
This class represents a file property in a property form.
+ Here is the call graph for this function:

◆ getFileByHash()

ilExcCriteriaFile::getFileByHash ( )

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

References $_GET, and getFiles().

121  {
122  $hash = trim($_GET["fuf"]);
123  if ($hash) {
124  foreach ($this->getFiles() as $file) {
125  if (md5($file) == $hash) {
126  return $file;
127  }
128  }
129  }
130  }
$_GET["client_id"]
+ Here is the call graph for this function:

◆ getFiles()

ilExcCriteriaFile::getFiles ( )

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

References initStorage().

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

48  {
49  $path = $this->initStorage();
50  return (array) glob($path . "*.*");
51  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHTML()

ilExcCriteriaFile::getHTML (   $a_value)

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

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

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

◆ getType()

ilExcCriteriaFile::getType ( )

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

37  {
38  return "file";
39  }

◆ hasValue()

ilExcCriteriaFile::hasValue (   $a_value)

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

References getFiles().

Referenced by validate().

100  {
101  return (bool) sizeof($this->getFiles());
102  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ importFromPeerReviewForm()

ilExcCriteriaFile::importFromPeerReviewForm ( )

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

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

78  {
79  $path = $this->initStorage();
80 
81  if ($this->form->getItemByPostVar("prccc_file_" . $this->getId())->getDeletionFlag()) {
82  ilUtil::delDir($path);
83  $this->form->getItemByPostVar("prccc_file_" . $this->getId())->setValue(null);
84  }
85 
86  $incoming = $_FILES["prccc_file_" . $this->getId()];
87  if ($incoming["tmp_name"]) {
88  $org_name = basename($incoming["name"]);
89 
91  $incoming["tmp_name"],
92  $org_name,
93  $path . $org_name,
94  false
95  );
96  }
97  }
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 41 of file class.ilExcCriteriaFile.php.

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

Referenced by getFiles(), and importFromPeerReviewForm().

42  {
43  $storage = new ilFSStorageExercise($this->ass->getExerciseId(), $this->ass->getId());
44  return $storage->getPeerReviewUploadPath($this->peer_id, $this->giver_id, $this->getId());
45  }
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 53 of file class.ilExcCriteriaFile.php.

References ilFileSystemStorage\deleteDirectory().

54  {
55  $storage = new ilFSStorageExercise($this->ass->getExerciseId(), $this->ass->getId());
56  $storage->deleteDirectory($storage->getPeerReviewUploadPath($this->peer_id, $this->giver_id, $this->getId()));
57  }
deleteDirectory($a_abs_name)
Delete directory.
+ Here is the call graph for this function:

◆ validate()

ilExcCriteriaFile::validate (   $a_value)

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

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

105  {
106  $lng = $this->lng;
107 
108  // because of deletion flag we have to also check ourselves
109  if ($this->isRequired()) {
110  if (!$this->hasValue($a_value)) {
111  if ($this->form) {
112  $this->form->getItemByPostVar("prccc_file_" . $this->getId())->setAlert($lng->txt("msg_input_is_required"));
113  }
114  return false;
115  }
116  }
117  return true;
118  }
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilExcCriteriaFile::$ctrl
protected

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

Referenced by getHTML().

◆ $lng

ilExcCriteriaFile::$lng
protected

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

Referenced by validate().


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