4 require_once
"./Services/Object/classes/class.ilObject.php";
5 require_once
"./Modules/Exercise/classes/class.ilExerciseMembers.php";
54 $this->
ilObject($a_id,$a_call_by_reference);
58 function setDate($a_hour,$a_minutes,$a_day,$a_month,$a_year)
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);
74 $this->timestamp = $a_timestamp;
78 $this->instruction = $a_instruction;
92 $this->pass_mode = $a_val;
102 return $this->pass_mode;
112 $this->pass_nr = $a_val;
122 return $this->pass_nr;
132 $this->show_submissions = $a_val;
142 return $this->show_submissions;
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);
173 $ilDB->insert(
"exc_data", array(
174 "obj_id" => array(
"integer", $this->
getId()),
176 "time_stamp" => array(
"integer", $this->
getTimestamp()),
177 "pass_mode" => array(
"text", $this->
getPassMode()),
178 "pass_nr" => array(
"text", $this->
getPassNr()),
198 $new_obj = parent::cloneObject($a_target_id,$a_copy_id);
202 $new_obj->saveData();
209 $crit_cat_map = array();
210 include_once(
"./Modules/Exercise/classes/class.ilExcCriteriaCatalogue.php");
213 $new_id = $crit_cat->cloneObject($new_obj->getId());
214 $crit_cat_map[$crit_cat->getId()] = $new_id;
218 include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
222 include_once(
'Services/Tracking/classes/class.ilLPObjSettings.php');
224 $obj_settings->cloneSettings($new_obj->getId());
225 unset($obj_settings);
238 global
$ilDB, $ilAppEventHandler;
241 if (!parent::delete())
246 $ilDB->manipulate(
"DELETE FROM exc_data ".
247 "WHERE obj_id = ".$ilDB->quote($this->getId(),
"integer"));
254 include_once
"Modules/Exercise/classes/class.ilExcCriteriaCatalogue.php";
258 include_once
"./Services/Notification/classes/class.ilNotification.php";
261 $ilAppEventHandler->raise(
'Modules/Exercise',
263 array(
'obj_id'=>$this->
getId()));
278 function notify($a_event,$a_ref_id,$a_node_id,$a_params = 0)
282 parent::notify($a_event,$a_ref_id,$a_node_id,$a_params);
291 $query =
"SELECT * FROM exc_data ".
292 "WHERE obj_id = ".$ilDB->quote($this->
getId(),
"integer");
295 while(
$row = $ilDB->fetchObject(
$res))
299 $pm = (
$row->pass_mode ==
"")
302 $this->setPassMode($pm);
304 if (
$row->pass_mode ==
"nr")
338 $ilDB->update(
"exc_data", array(
340 "time_stamp" => array(
"integer", $this->
getTimestamp()),
341 "pass_mode" => array(
"text", $this->
getPassMode()),
342 "pass_nr" => array(
"integer", $this->
getPassNr()),
346 "obj_id" => array(
"integer", $this->
getId())
353 #$this->members_obj->update(); 364 $a_members = array_keys($a_members);
366 $lng->loadLanguageModule(
"exc");
379 $body .= $lng->txt(
"exc_edit_until").
": ";
381 ? $lng->txt(
"exc_no_deadline_specified")
385 include_once
"Services/Link/classes/class.ilLink.php";
390 $file_names = array();
391 include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
396 include_once
"./Services/Mail/classes/class.ilFileDataMail.php";
398 foreach($files as
$file)
400 $mfile_obj->copyAttachmentFile($file[
"fullpath"], $file[
"name"]);
401 $file_names[] = $file[
"name"];
406 $recipients = array();
407 foreach($a_members as $member_id)
410 $recipients[] = $tmp_obj->getLogin();
413 $recipients = implode(
"," ,$recipients);
416 include_once
"Services/Mail/classes/class.ilMail.php";
417 $tmp_mail_obj =
new ilMail($ilUser->getId());
427 unset($tmp_mail_obj);
430 if(
sizeof($file_names))
432 $mfile_obj->unlinkFiles($file_names);
437 foreach($a_members as $member_id)
440 $member_status->setSent(
true);
441 $member_status->update();
456 $a_user_id = $ilUser->getId();
459 include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
462 $passed_all_mandatory =
true;
463 $failed_a_mandatory =
false;
466 $passed_at_least_one =
false;
470 $stat = $a->getMemberStatus($a_user_id)->getStatus();
471 if ($a->getMandatory() && ($stat ==
"failed" || $stat ==
"notgraded"))
473 $passed_all_mandatory =
false;
475 if ($a->getMandatory() && ($stat ==
"failed"))
477 $failed_a_mandatory =
true;
479 if ($stat ==
"passed")
483 if ($stat ==
"notgraded")
489 if (count($ass) == 0)
491 $passed_all_mandatory =
false;
497 $overall_stat =
"notgraded";
498 if ($failed_a_mandatory)
501 $overall_stat =
"failed";
503 else if ($passed_all_mandatory && $cnt_passed > 0)
506 $overall_stat =
"passed";
513 $overall_stat =
"notgraded";
515 if ($failed_a_mandatory || ($cnt_passed + $cnt_notgraded < $min_nr))
518 $overall_stat =
"failed";
520 else if ($passed_all_mandatory && $cnt_passed >= $min_nr)
523 $overall_stat =
"passed";
528 "overall_status" => $overall_stat,
529 "failed_a_mandatory" => $failed_a_mandatory);
544 $a_user_id = $ilUser->getId();
549 include_once(
"./Modules/Exercise/classes/class.ilExerciseMembers.php");
551 $st[
"overall_status"]);
559 if (!is_object($this->members_obj));
564 $mems = $this->members_obj->getMembers();
565 foreach ($mems as $mem)
576 include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
579 include_once
"./Services/Excel/classes/class.ilExcelWriterAdapter.php";
582 $workbook = $adapter->getWorkbook();
583 $workbook->setVersion(8);
584 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
589 $mainworksheet = $workbook->addWorksheet();
594 foreach ($ass_data as $ass)
596 $mainworksheet->writeString(0, $cnt, $cnt);
605 $getmems = $this->mem_obj->getMembers();
607 foreach ($getmems as $user_id)
613 include_once
'Services/Tracking/classes/class.ilLPMarks.php';
617 foreach ($mems as $user_id =>
$d)
622 $mainworksheet->writeString($row_cnt, 0,
627 foreach ($ass_data as $ass)
629 $status = $ass->getMemberStatus($user_id)->getStatus();
649 $worksheet2 = $workbook->addWorksheet();
654 foreach ($ass_data as $ass)
656 $worksheet2->writeString(0, $cnt, $cnt);
665 foreach ($mems as $user_id =>
$d)
671 $worksheet2->writeString($row_cnt, 0,
676 foreach ($ass_data as $ass)
678 $mark = $ass->getMemberStatus($user_id)->getMark();
684 include_once
'Services/Tracking/classes/class.ilLPMarks.php';
685 $worksheet2->writeString($row_cnt, $col_cnt,
702 $user_ids = $a_user_id;
703 if(!is_array($user_ids))
705 $user_ids = array($user_ids);
708 include_once(
"./Modules/Exercise/classes/class.ilExerciseMailNotification.php");
710 $type = (bool)$a_is_text_feedback
715 $not->setType(
$type);
716 $not->setAssignmentId($a_ass_id);
717 $not->setObjId($this->
getId());
722 $not->setRecipients($user_ids);
750 $this->completion_by_submission = (bool)$bool;
757 $a_has_submitted = (bool)$a_has_submitted;
759 include_once(
"./Modules/Exercise/classes/class.ilExerciseMembers.php");
760 foreach($a_user_ids as $user_id)
763 $member_status->setReturned($a_has_submitted);
764 $member_status->update();
772 foreach($a_user_ids as $user_id)
774 $status =
'notgraded';
777 if(!is_array($a_valid_submissions) ||
778 $a_valid_submissions[$user_id])
785 $member_status->setStatus($status);
786 $member_status->update();
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").
")");
807 while(
$row = $ilDB->fetchAssoc($set))
809 $all[
$row[
"obj_id"]] = ($row[
"status"] ==
"passed");
823 return (strlen($this->certificate_visibility)) ? $this->certificate_visibility : 0;
834 $this->certificate_visibility = $a_value;
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())
862 include_once
"Services/Certificate/classes/class.ilCertificate.php";
867 if($certificate_visible != 2)
870 include_once
'Modules/Exercise/classes/class.ilExerciseMembers.php';
872 if($certificate_visible == 1 && $status ==
"passed")
877 else if($certificate_visible == 0 && $status !=
"notgraded")
894 return (
bool)$exc_set->get(
"add_to_pd",
true);
static _lookupName($a_user_id)
lookup user name
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.
getPassMode()
Get pass mode (all | nr)
static deleteByParent($a_parent_id)
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 TYPE_FEEDBACK_TEXT_ADDED
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.
const TYPE_FEEDBACK_FILE_ADDED
Class ilExcelWriterAdapter.
setCertificateVisibility($a_value)
Sets the visibility settings of the certificate.
updateAllUsersStatus()
Update status of all users.
getExerciseId()
Get exercise id.
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.
_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.
const TYPE_EXERCISE_SUBMISSION
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
$completion_by_submission
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)
_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.
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)
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
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.