ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilObjExercise.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once "./Services/Object/classes/class.ilObject.php";
5 require_once "./Modules/Exercise/classes/class.ilExerciseMembers.php";
6 
19 class ilObjExercise extends ilObject
20 {
21  var $file_obj;
23  var $files;
24 
26  var $hour;
27  var $minutes;
28  var $day;
29  var $month;
30  var $year;
33 
42  protected $completion_by_submission = false;
43 
50  function ilObjExercise($a_id = 0,$a_call_by_reference = true)
51  {
52  $this->setPassMode("all");
53  $this->type = "exc";
54  $this->ilObject($a_id,$a_call_by_reference);
55  }
56 
57  // SET, GET METHODS
58  function setDate($a_hour,$a_minutes,$a_day,$a_month,$a_year)
59  {
60  $this->hour = (int) $a_hour;
61  $this->minutes = (int) $a_minutes;
62  $this->day = (int) $a_day;
63  $this->month = (int) $a_month;
64  $this->year = (int) $a_year;
65  $this->timestamp = mktime($this->hour,$this->minutes,0,$this->month,$this->day,$this->year);
66  return true;
67  }
68  function getTimestamp()
69  {
70  return $this->timestamp;
71  }
72  function setTimestamp($a_timestamp)
73  {
74  $this->timestamp = $a_timestamp;
75  }
76  function setInstruction($a_instruction)
77  {
78  $this->instruction = $a_instruction;
79  }
80  function getInstruction()
81  {
82  return $this->instruction;
83  }
84 
90  function setPassMode($a_val)
91  {
92  $this->pass_mode = $a_val;
93  }
94 
100  function getPassMode()
101  {
102  return $this->pass_mode;
103  }
104 
110  function setPassNr($a_val)
111  {
112  $this->pass_nr = $a_val;
113  }
114 
120  function getPassNr()
121  {
122  return $this->pass_nr;
123  }
124 
130  function setShowSubmissions($a_val)
131  {
132  $this->show_submissions = $a_val;
133  }
134 
141  {
142  return $this->show_submissions;
143  }
144 
145 
146 /* function getFiles()
147  {
148  return $this->files;
149  }*/
150 
151  function checkDate()
152  {
153  return $this->hour == (int) date("H",$this->timestamp) and
154  $this->minutes == (int) date("i",$this->timestamp) and
155  $this->day == (int) date("d",$this->timestamp) and
156  $this->month == (int) date("m",$this->timestamp) and
157  $this->year == (int) date("Y",$this->timestamp);
158 
159  }
160 
161 
162  function saveData()
163  {
164  global $ilDB;
165 
166  // SAVE ONLY EXERCISE SPECIFIC DATA
167  /*$query = "INSERT INTO exc_data SET ".
168  "obj_id = ".$ilDB->quote($this->getId()).", ".
169  "instruction = ".$ilDB->quote($this->getInstruction()).", ".
170  "time_stamp = ".$ilDB->quote($this->getTimestamp());
171  $this->ilias->db->query($query);*/
172 
173  $ilDB->insert("exc_data", array(
174  "obj_id" => array("integer", $this->getId()),
175  "instruction" => array("clob", $this->getInstruction()),
176  "time_stamp" => array("integer", $this->getTimestamp()),
177  "pass_mode" => array("text", $this->getPassMode()),
178  "pass_nr" => array("text", $this->getPassNr()),
179  "show_submissions" => array("integer", (int) $this->getShowSubmissions()),
180  'compl_by_submission' => array('integer', (int)$this->isCompletionBySubmissionEnabled()),
181  "certificate_visibility" => array("integer", (int)$this->getCertificateVisibility())
182  ));
183  return true;
184  }
185 
193  public function cloneObject($a_target_id,$a_copy_id = 0)
194  {
195  global $ilDB;
196 
197  // Copy settings
198  $new_obj = parent::cloneObject($a_target_id,$a_copy_id);
199  $new_obj->setInstruction($this->getInstruction());
200  $new_obj->setTimestamp($this->getTimestamp());
201  $new_obj->setPassMode($this->getPassMode());
202  $new_obj->saveData();
203  $new_obj->setPassNr($this->getPassNr());
204  $new_obj->setShowSubmissions($this->getShowSubmissions());
205  $new_obj->setCompletionBySubmission($this->isCompletionBySubmissionEnabled());
206  $new_obj->update();
207 
208  // Copy criteria catalogues
209  $crit_cat_map = array();
210  include_once("./Modules/Exercise/classes/class.ilExcCriteriaCatalogue.php");
211  foreach(ilExcCriteriaCatalogue::getInstancesByParentId($this->getId()) as $crit_cat)
212  {
213  $new_id = $crit_cat->cloneObject($new_obj->getId());
214  $crit_cat_map[$crit_cat->getId()] = $new_id;
215  }
216 
217  // Copy assignments
218  include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
219  ilExAssignment::cloneAssignmentsOfExercise($this->getId(), $new_obj->getId(), $crit_cat_map);
220 
221  // Copy learning progress settings
222  include_once('Services/Tracking/classes/class.ilLPObjSettings.php');
223  $obj_settings = new ilLPObjSettings($this->getId());
224  $obj_settings->cloneSettings($new_obj->getId());
225  unset($obj_settings);
226 
227  return $new_obj;
228  }
229 
236  function delete()
237  {
238  global $ilDB, $ilAppEventHandler;
239 
240  // always call parent delete function first!!
241  if (!parent::delete())
242  {
243  return false;
244  }
245  // put here course specific stuff
246  $ilDB->manipulate("DELETE FROM exc_data ".
247  "WHERE obj_id = ".$ilDB->quote($this->getId(), "integer"));
248 
249  //$this->ilias->db->query($query);
250 
251  //$this->file_obj->delete();
252  //$this->members_obj->delete();
253 
254  include_once "Modules/Exercise/classes/class.ilExcCriteriaCatalogue.php";
256 
257  // remove all notifications
258  include_once "./Services/Notification/classes/class.ilNotification.php";
260 
261  $ilAppEventHandler->raise('Modules/Exercise',
262  'delete',
263  array('obj_id'=>$this->getId()));
264 
265  return true;
266  }
267 
278  function notify($a_event,$a_ref_id,$a_node_id,$a_params = 0)
279  {
280  // object specific event handling
281 
282  parent::notify($a_event,$a_ref_id,$a_node_id,$a_params);
283  }
284 
285  function read()
286  {
287  global $ilDB;
288 
289  parent::read();
290 
291  $query = "SELECT * FROM exc_data ".
292  "WHERE obj_id = ".$ilDB->quote($this->getId(), "integer");
293 
294  $res = $ilDB->query($query);
295  while($row = $ilDB->fetchObject($res))
296  {
297  $this->setInstruction($row->instruction);
298  $this->setTimestamp($row->time_stamp);
299  $pm = ($row->pass_mode == "")
300  ? "all"
301  : $row->pass_mode;
302  $this->setPassMode($pm);
303  $this->setShowSubmissions($row->show_submissions);
304  if ($row->pass_mode == "nr")
305  {
306  $this->setPassNr($row->pass_nr);
307  }
308  $this->setCompletionBySubmission($row->compl_by_submission == 1 ? true : false);
309  $this->setCertificateVisibility($row->certificate_visibility);
310  }
311 
312  $this->members_obj = new ilExerciseMembers($this);
313 
314  return true;
315  }
316 
317  function update()
318  {
319  global $ilDB;
320 
321  parent::update();
322 
323  /*$query = "UPDATE exc_data SET ".
324  "instruction = ".$ilDB->quote($this->getInstruction()).", ".
325  "time_stamp = ".$ilDB->quote($this->getTimestamp())." ".
326  "WHERE obj_id = ".$ilDB->quote($this->getId());
327  */
328 
329  if ($this->getPassMode() == "all")
330  {
331  $pass_nr = null;
332  }
333  else
334  {
335  $pass_nr = $this->getPassNr();
336  }
337 
338  $ilDB->update("exc_data", array(
339  "instruction" => array("clob", $this->getInstruction()),
340  "time_stamp" => array("integer", $this->getTimestamp()),
341  "pass_mode" => array("text", $this->getPassMode()),
342  "pass_nr" => array("integer", $this->getPassNr()),
343  "show_submissions" => array("integer", (int) $this->getShowSubmissions()),
344  'compl_by_submission' => array('integer', (int)$this->isCompletionBySubmissionEnabled())
345  ), array(
346  "obj_id" => array("integer", $this->getId())
347  ));
348 
349  $this->updateAllUsersStatus();
350 
351  //$res = $this->ilias->db->query($query);
352 
353  #$this->members_obj->update();
354  return true;
355  }
356 
360  function sendAssignment(ilExAssignment $a_ass, $a_members)
361  {
362  global $lng, $ilUser;
363 
364  $a_members = array_keys($a_members);
365 
366  $lng->loadLanguageModule("exc");
367 
368  // subject
369  $subject = $a_ass->getTitle()
370  ? $this->getTitle().": ".$a_ass->getTitle()
371  : $this->getTitle();
372 
373 
374  // body
375 
376  $body = $a_ass->getInstruction();
377  $body .= "\n\n";
378 
379  $body .= $lng->txt("exc_edit_until").": ";
380  $body .= (!$a_ass->getDeadline())
381  ? $lng->txt("exc_no_deadline_specified")
383  $body .= "\n\n";
384 
385  include_once "Services/Link/classes/class.ilLink.php";
386  $body .= ilLink::_getLink($this->getRefId(), "exc");
387 
388 
389  // files
390  $file_names = array();
391  include_once("./Modules/Exercise/classes/class.ilFSStorageExercise.php");
392  $storage = new ilFSStorageExercise($a_ass->getExerciseId(), $a_ass->getId());
393  $files = $storage->getFiles();
394  if(count($files))
395  {
396  include_once "./Services/Mail/classes/class.ilFileDataMail.php";
397  $mfile_obj = new ilFileDataMail($_SESSION["AccountId"]);
398  foreach($files as $file)
399  {
400  $mfile_obj->copyAttachmentFile($file["fullpath"], $file["name"]);
401  $file_names[] = $file["name"];
402  }
403  }
404 
405  // recipients
406  $recipients = array();
407  foreach($a_members as $member_id)
408  {
409  $tmp_obj = ilObjectFactory::getInstanceByObjId($member_id);
410  $recipients[] = $tmp_obj->getLogin();
411  unset($tmp_obj);
412  }
413  $recipients = implode("," ,$recipients);
414 
415  // send mail
416  include_once "Services/Mail/classes/class.ilMail.php";
417  $tmp_mail_obj = new ilMail($ilUser->getId());
418  $message = $tmp_mail_obj->sendMail(
419  $recipients,
420  "",
421  "",
422  $subject,
423  $body,
424  $file_names,
425  array("normal")
426  );
427  unset($tmp_mail_obj);
428 
429  // remove tmp files
430  if(sizeof($file_names))
431  {
432  $mfile_obj->unlinkFiles($file_names);
433  unset($mfile_obj);
434  }
435 
436  // set recipients mail status
437  foreach($a_members as $member_id)
438  {
439  $member_status = $a_ass->getMemberStatus($member_id);
440  $member_status->setSent(true);
441  $member_status->update();
442  }
443 
444  return true;
445  }
446 
450  function determinStatusOfUser($a_user_id = 0)
451  {
452  global $ilUser;
453 
454  if ($a_user_id == 0)
455  {
456  $a_user_id = $ilUser->getId();
457  }
458 
459  include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
461 
462  $passed_all_mandatory = true;
463  $failed_a_mandatory = false;
464  $cnt_passed = 0;
465  $cnt_notgraded = 0;
466  $passed_at_least_one = false;
467 
468  foreach ($ass as $a)
469  {
470  $stat = $a->getMemberStatus($a_user_id)->getStatus();
471  if ($a->getMandatory() && ($stat == "failed" || $stat == "notgraded"))
472  {
473  $passed_all_mandatory = false;
474  }
475  if ($a->getMandatory() && ($stat == "failed"))
476  {
477  $failed_a_mandatory = true;
478  }
479  if ($stat == "passed")
480  {
481  $cnt_passed++;
482  }
483  if ($stat == "notgraded")
484  {
485  $cnt_notgraded++;
486  }
487  }
488 
489  if (count($ass) == 0)
490  {
491  $passed_all_mandatory = false;
492  }
493 
494  if ($this->getPassMode() != "nr")
495  {
496 //echo "5";
497  $overall_stat = "notgraded";
498  if ($failed_a_mandatory)
499  {
500 //echo "6";
501  $overall_stat = "failed";
502  }
503  else if ($passed_all_mandatory && $cnt_passed > 0)
504  {
505 //echo "7";
506  $overall_stat = "passed";
507  }
508  }
509  else
510  {
511 //echo "8";
512  $min_nr = $this->getPassNr();
513  $overall_stat = "notgraded";
514 //echo "*".$cnt_passed."*".$cnt_notgraded."*".$min_nr."*";
515  if ($failed_a_mandatory || ($cnt_passed + $cnt_notgraded < $min_nr))
516  {
517 //echo "9";
518  $overall_stat = "failed";
519  }
520  else if ($passed_all_mandatory && $cnt_passed >= $min_nr)
521  {
522 //echo "A";
523  $overall_stat = "passed";
524  }
525  }
526 
527  $ret = array(
528  "overall_status" => $overall_stat,
529  "failed_a_mandatory" => $failed_a_mandatory);
530 //echo "<br>p:".$cnt_passed.":ng:".$cnt_notgraded;
531 //var_dump($ret);
532  return $ret;
533  }
534 
538  function updateUserStatus($a_user_id = 0)
539  {
540  global $ilUser;
541 
542  if ($a_user_id == 0)
543  {
544  $a_user_id = $ilUser->getId();
545  }
546 
547  $st = $this->determinStatusOfUser($a_user_id);
548 
549  include_once("./Modules/Exercise/classes/class.ilExerciseMembers.php");
550  ilExerciseMembers::_writeStatus($this->getId(), $a_user_id,
551  $st["overall_status"]);
552  }
553 
558  {
559  if (!is_object($this->members_obj));
560  {
561  $this->members_obj = new ilExerciseMembers($this);
562  }
563 
564  $mems = $this->members_obj->getMembers();
565  foreach ($mems as $mem)
566  {
567  $this->updateUserStatus($mem);
568  }
569  }
570 
574  function exportGradesExcel()
575  {
576  include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
577  $ass_data = ilExAssignment::getInstancesByExercise($this->getId());
578 
579  include_once "./Services/Excel/classes/class.ilExcelWriterAdapter.php";
580  $excelfile = ilUtil::ilTempnam();
581  $adapter = new ilExcelWriterAdapter($excelfile, FALSE);
582  $workbook = $adapter->getWorkbook();
583  $workbook->setVersion(8); // Use Excel97/2000 Format
584  include_once ("./Services/Excel/classes/class.ilExcelUtils.php");
585 
586  //
587  // status
588  //
589  $mainworksheet = $workbook->addWorksheet();
590 
591  // header row
592  $mainworksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("name")));
593  $cnt = 1;
594  foreach ($ass_data as $ass)
595  {
596  $mainworksheet->writeString(0, $cnt, $cnt);
597  $cnt++;
598  }
599  $mainworksheet->writeString(0, $cnt++, ilExcelUtils::_convert_text($this->lng->txt("exc_total_exc")));
600  $mainworksheet->writeString(0, $cnt++, ilExcelUtils::_convert_text($this->lng->txt("exc_mark")));
601  $mainworksheet->writeString(0, $cnt, ilExcelUtils::_convert_text($this->lng->txt("exc_comment_for_learner")));
602 
603  // data rows
604  $this->mem_obj = new ilExerciseMembers($this);
605  $getmems = $this->mem_obj->getMembers();
606  $mems = array();
607  foreach ($getmems as $user_id)
608  {
609  $mems[$user_id] = ilObjUser::_lookupName($user_id);
610  }
611  $mems = ilUtil::sortArray($mems, "lastname", "asc", false, true);
612 
613  include_once 'Services/Tracking/classes/class.ilLPMarks.php';
614 
615  $data = array();
616  $row_cnt = 1;
617  foreach ($mems as $user_id => $d)
618  {
619  $col_cnt = 1;
620 
621  // name
622  $mainworksheet->writeString($row_cnt, 0,
623  ilExcelUtils::_convert_text($d["lastname"].", ".$d["firstname"]." [".$d["login"]."]"));
624 
625  reset($ass_data);
626 
627  foreach ($ass_data as $ass)
628  {
629  $status = $ass->getMemberStatus($user_id)->getStatus();
630  $mainworksheet->writeString($row_cnt, $col_cnt, ilExcelUtils::_convert_text($this->lng->txt("exc_".$status)));
631  $col_cnt++;
632  }
633 
634  // total status
635  $status = ilExerciseMembers::_lookupStatus($this->getId(), $user_id);
636  $mainworksheet->writeString($row_cnt, $col_cnt++, ilExcelUtils::_convert_text($this->lng->txt("exc_".$status)));
637 
638  // #18096
639  $marks_obj = new ilLPMarks($this->getId(), $user_id);
640  $mainworksheet->writeString($row_cnt, $col_cnt++, ilExcelUtils::_convert_text($marks_obj->getMark()));
641  $mainworksheet->writeString($row_cnt, $col_cnt, ilExcelUtils::_convert_text($marks_obj->getComment()));
642 
643  $row_cnt++;
644  }
645 
646  //
647  // mark
648  //
649  $worksheet2 = $workbook->addWorksheet();
650 
651  // header row
652  $worksheet2->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("name")));
653  $cnt = 1;
654  foreach ($ass_data as $ass)
655  {
656  $worksheet2->writeString(0, $cnt, $cnt);
657  $cnt++;
658  }
659  $worksheet2->writeString(0, $cnt, ilExcelUtils::_convert_text($this->lng->txt("exc_total_exc")));
660 
661  // data rows
662  $data = array();
663  $row_cnt = 1;
664  reset($mems);
665  foreach ($mems as $user_id => $d)
666  {
667  $col_cnt = 1;
668  $d = ilObjUser::_lookupName($user_id);
669 
670  // name
671  $worksheet2->writeString($row_cnt, 0,
672  ilExcelUtils::_convert_text($d["lastname"].", ".$d["firstname"]." [".$d["login"]."]"));
673 
674  reset($ass_data);
675 
676  foreach ($ass_data as $ass)
677  {
678  $mark = $ass->getMemberStatus($user_id)->getMark();
679  $worksheet2->writeString($row_cnt, $col_cnt, ilExcelUtils::_convert_text($mark));
680  $col_cnt++;
681  }
682 
683  // total mark
684  include_once 'Services/Tracking/classes/class.ilLPMarks.php';
685  $worksheet2->writeString($row_cnt, $col_cnt,
687 
688  $row_cnt++;
689  }
690 
691 
692  $workbook->close();
693  $exc_name = ilUtil::getASCIIFilename(preg_replace("/\s/", "_", $this->getTitle()));
694  ilUtil::deliverFile($excelfile, $exc_name.".xls", "application/vnd.ms-excel");
695  }
696 
700  function sendFeedbackFileNotification($a_feedback_file, $a_user_id, $a_ass_id, $a_is_text_feedback = false)
701  {
702  $user_ids = $a_user_id;
703  if(!is_array($user_ids))
704  {
705  $user_ids = array($user_ids);
706  }
707 
708  include_once("./Modules/Exercise/classes/class.ilExerciseMailNotification.php");
709 
710  $type = (bool)$a_is_text_feedback
713 
714  $not = new ilExerciseMailNotification();
715  $not->setType($type);
716  $not->setAssignmentId($a_ass_id);
717  $not->setObjId($this->getId());
718  if ($this->getRefId() > 0)
719  {
720  $not->setRefId($this->getRefId());
721  }
722  $not->setRecipients($user_ids);
723  $not->send();
724  }
725 
735  {
737  }
738 
748  public function setCompletionBySubmission($bool)
749  {
750  $this->completion_by_submission = (bool)$bool;
751 
752  return $this;
753  }
754 
755  public function processExerciseStatus(ilExAssignment $a_ass, array $a_user_ids, $a_has_submitted, array $a_valid_submissions = null)
756  {
757  $a_has_submitted = (bool)$a_has_submitted;
758 
759  include_once("./Modules/Exercise/classes/class.ilExerciseMembers.php");
760  foreach($a_user_ids as $user_id)
761  {
762  $member_status = $a_ass->getMemberStatus($user_id);
763  $member_status->setReturned($a_has_submitted);
764  $member_status->update();
765 
766  ilExerciseMembers::_writeReturned($this->getId(), $user_id, $a_has_submitted);
767  }
768 
769  // re-evaluate exercise status
771  {
772  foreach($a_user_ids as $user_id)
773  {
774  $status = 'notgraded';
775  if($a_has_submitted)
776  {
777  if(!is_array($a_valid_submissions) ||
778  $a_valid_submissions[$user_id])
779  {
780  $status = 'passed';
781  }
782  }
783 
784  $member_status = $a_ass->getMemberStatus($user_id);
785  $member_status->setStatus($status);
786  $member_status->update();
787  }
788  }
789  }
790 
797  public static function _lookupFinishedUserExercises($a_user_id)
798  {
799  global $ilDB;
800 
801  $set = $ilDB->query("SELECT obj_id, status FROM exc_members".
802  " WHERE usr_id = ".$ilDB->quote($a_user_id, "integer").
803  " AND (status = ".$ilDB->quote("passed", "text").
804  " OR status = ".$ilDB->quote("failed", "text").")");
805 
806  $all = array();
807  while($row = $ilDB->fetchAssoc($set))
808  {
809  $all[$row["obj_id"]] = ($row["status"] == "passed");
810  }
811  return $all;
812  }
813 
814 
822  {
823  return (strlen($this->certificate_visibility)) ? $this->certificate_visibility : 0;
824  }
825 
832  function setCertificateVisibility($a_value)
833  {
834  $this->certificate_visibility = $a_value;
835  }
836 
843  function saveCertificateVisibility($a_value)
844  {
845  global $ilDB;
846 
847  $affectedRows = $ilDB->manipulateF("UPDATE exc_data SET certificate_visibility = %s WHERE obj_id = %s",
848  array('integer', 'integer'),
849  array($a_value, $this->getId())
850  );
851  }
852 
859  function hasUserCertificate($a_user_id)
860  {
861  // show certificate?
862  include_once "Services/Certificate/classes/class.ilCertificate.php";
864  {
865  $certificate_visible = $this->getCertificateVisibility();
866  // if not never
867  if($certificate_visible != 2)
868  {
869  // if passed only
870  include_once 'Modules/Exercise/classes/class.ilExerciseMembers.php';
871  $status = ilExerciseMembers::_lookupStatus($this->getId(), $a_user_id);
872  if($certificate_visible == 1 && $status == "passed")
873  {
874  return true;
875  }
876  // always (excluding notgraded)
877  else if($certificate_visible == 0 && $status != "notgraded")
878  {
879  return true;
880  }
881  }
882  }
883  return false;
884  }
885 
891  function hasAddToDesktop()
892  {
893  $exc_set = new ilSetting("excs");
894  return (bool)$exc_set->get("add_to_pd", true);
895  }
896 }
897 
898 ?>
static _lookupName($a_user_id)
lookup user name
ILIAS Setting Class.
print $file
setCompletionBySubmission($bool)
Enabled/Disable completion by submission.
getMemberStatus($a_user_id=null)
determinStatusOfUser($a_user_id=0)
Determine status of user.
static removeForObject($type, $id)
Remove all notifications for given object.
Exercise assignment.
getPassMode()
Get pass mode (all | nr)
Class ilExerciseMembers.
$_SESSION["AccountId"]
getCertificateVisibility()
Returns the visibility settings of the certificate.
This class handles all operations on files (attachments) in directory ilias_data/mail.
_lookupMark($a_usr_id, $a_obj_id)
_convert_text($a_text, $a_target="has been removed")
getId()
Get assignment id.
Class ilObject Basic functions for all objects.
getDeadline()
Get deadline (timestamp)
setDate($a_hour, $a_minutes, $a_day, $a_month, $a_year)
const IL_CAL_UNIX
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
cloneObject($a_target_id, $a_copy_id=0)
Clone exercise (no member data)
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
setInstruction($a_instruction)
ilObject($a_id=0, $a_reference=true)
Constructor public.
cloneAssignmentsOfExercise($a_old_exc_id, $a_new_exc_id, array $a_crit_cat_map)
Clone assignments of exercise.
getShowSubmissions()
Get whether submissions of learners should be shown to other learners after deadline.
Class ilExcelWriterAdapter.
setCertificateVisibility($a_value)
Sets the visibility settings of the certificate.
updateAllUsersStatus()
Update status of all users.
getExerciseId()
Get exercise id.
Class ilObjExercise.
$data
setPassMode($a_val)
Set pass mode (all | nr)
getId()
get object id public
setTimestamp($a_timestamp)
Class Mail this class handles base functions for mail handling.
static getInstancesByExercise($a_exc_id)
static formatDate(ilDateTime $date)
Format a date public.
getTitle()
get object title public
getFiles()
Get assignment files.
Date and time handling
_writeReturned($a_obj_id, $a_user_id, $a_status)
Write returned status.
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
ilObjExercise($a_id=0, $a_call_by_reference=true)
Constructor public.
sendMail($a_rcp_to, $a_rcp_cc, $a_rcp_bc, $a_m_subject, $a_m_message, $a_attachment, $a_type, $a_use_placeholders=0)
send external mail using class.ilMimeMail.php
sendFeedbackFileNotification($a_feedback_file, $a_user_id, $a_ass_id, $a_is_text_feedback=false)
Send feedback file notification to user.
hasAddToDesktop()
Add to desktop after hand-in.
isCompletionBySubmissionEnabled()
Checks whether completion by submission is enabled or not.
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.
static _lookupFinishedUserExercises($a_user_id)
Get all exercises for user.
static isObjectActive($a_obj_id)
updateUserStatus($a_user_id=0)
Update exercise status of user.
setShowSubmissions($a_val)
Set whether submissions of learners should be shown to other learners after deadline.
static getInstancesByParentId($a_parent_id)
global $ilUser
Definition: imgupload.php:15
_lookupStatus($a_obj_id, $a_user_id)
Lookup current status (notgraded|passed|failed)
_writeStatus($a_obj_id, $a_user_id, $a_status)
Write user status.
getInstruction()
Get instruction.
sendAssignment(ilExAssignment $a_ass, $a_members)
send exercise per mail to members
saveCertificateVisibility($a_value)
Saves the visibility settings of the certificate.
global $ilDB
getRefId()
get reference id public
exportGradesExcel()
Exports grades as excel.
getPassNr()
Get number of assignments that must be passed to pass the exercise.
hasUserCertificate($a_user_id)
Check if given user has certificate to show/download.
processExerciseStatus(ilExAssignment $a_ass, array $a_user_ids, $a_has_submitted, array $a_valid_submissions=null)
notify($a_event, $a_ref_id, $a_node_id, $a_params=0)
notifys an object about an event occured Based on the event happend, each object may decide how it re...
setPassNr($a_val)
Set number of assignments that must be passed to pass the exercise.