4require_once 
"./Services/Object/classes/class.ilObject.php";
 
    5require_once 
"./Modules/Exercise/classes/class.ilExerciseMembers.php";
 
   60                parent::__construct($a_id,$a_call_by_reference);
 
   64        function setDate($a_hour,$a_minutes,$a_day,$a_month,$a_year)
 
   66                $this->hour = (int) $a_hour;
 
   67                $this->minutes = (int) $a_minutes;
 
   68                $this->day = (int) $a_day;
 
   69                $this->month = (int) $a_month;
 
   70                $this->year = (int) $a_year;
 
   71                $this->timestamp = mktime($this->hour,$this->minutes,0,$this->month,$this->day,$this->year);
 
   80                $this->timestamp = $a_timestamp;
 
   84                $this->instruction = $a_instruction;
 
   98                $this->pass_mode = $a_val;
 
  108                return $this->pass_mode;
 
  118                $this->pass_nr = $a_val;
 
  128                return $this->pass_nr;
 
  138                $this->show_submissions = $a_val;
 
  148                return $this->show_submissions;
 
  159                return  $this->hour == (int) 
date(
"H",$this->timestamp) and
 
  160                        $this->minutes == (int) 
date(
"i",$this->timestamp) and
 
  161                        $this->day == (int) 
date(
"d",$this->timestamp) and
 
  162                        $this->month == (int) 
date(
"m",$this->timestamp) and
 
  163                        $this->year == (int) 
date(
"Y",$this->timestamp);
 
  189                $this->tutor_feedback = $a_value;
 
  196                $ilDB->insert(
"exc_data", array(
 
  197                        "obj_id" => array(
"integer", $this->
getId()),
 
  199                        "time_stamp" => array(
"integer", $this->
getTimestamp()),
 
  200                        "pass_mode" => array(
"text", $this->
getPassMode()),
 
  201                        "pass_nr" => array(
"text", $this->
getPassNr()),
 
  217        public function cloneObject($a_target_id,$a_copy_id = 0, $a_omit_tree = 
false)
 
  222                $new_obj = parent::cloneObject($a_target_id,$a_copy_id, $a_omit_tree);
 
  226                $new_obj->saveData();
 
  234                $crit_cat_map = array();
 
  235                include_once(
"./Modules/Exercise/classes/class.ilExcCriteriaCatalogue.php");
 
  238                        $new_id = $crit_cat->cloneObject($new_obj->getId());
 
  239                        $crit_cat_map[$crit_cat->getId()] = $new_id;                    
 
  243                include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
 
  247                include_once(
'Services/Tracking/classes/class.ilLPObjSettings.php');
 
  249                $obj_settings->cloneSettings($new_obj->getId());
 
  250                unset($obj_settings);
 
  253                include_once 
"./Services/Certificate/classes/class.ilCertificate.php";
 
  254                include_once 
"./Modules/Exercise/classes/class.ilExerciseCertificateAdapter.php";
 
  257                $cert->cloneCertificate($newcert);
 
  270                global 
$ilDB, $ilAppEventHandler;
 
  273                if (!parent::delete())
 
  278                $ilDB->manipulate(
"DELETE FROM exc_data ".
 
  279                        "WHERE obj_id = ".
$ilDB->quote($this->getId(), 
"integer"));
 
  281                include_once 
"Modules/Exercise/classes/class.ilExcCriteriaCatalogue.php";
 
  285                include_once 
"./Services/Notification/classes/class.ilNotification.php";
 
  288                $ilAppEventHandler->raise(
'Modules/Exercise',
 
  290                        array(
'obj_id'=>$this->
getId()));               
 
  301                $query = 
"SELECT * FROM exc_data ".
 
  302                        "WHERE obj_id = ".$ilDB->quote($this->
getId(), 
"integer");
 
  309                        $pm = (
$row->pass_mode == 
"")
 
  312                        $this->setPassMode($pm);
 
  314                        if (
$row->pass_mode == 
"nr")
 
  343                $ilDB->update(
"exc_data", array(
 
  345                        "time_stamp" => array(
"integer", $this->
getTimestamp()),
 
  346                        "pass_mode" => array(
"text", $this->
getPassMode()),
 
  347                        "pass_nr" => array(
"integer", $this->
getPassNr()),
 
  352                        "obj_id" => array(
"integer", $this->
getId())
 
  367                $lng->loadLanguageModule(
"exc");
 
  380                $body .= 
$lng->txt(
"exc_edit_until").
": ";
 
  382                  ? 
$lng->txt(
"exc_no_deadline_specified")
 
  386                include_once 
"Services/Link/classes/class.ilLink.php";
 
  391                $file_names = array();
 
  392                include_once(
"./Modules/Exercise/classes/class.ilFSStorageExercise.php");
 
  394                $files = $storage->getFiles();
 
  397                        include_once 
"./Services/Mail/classes/class.ilFileDataMail.php";
 
  401                                $mfile_obj->copyAttachmentFile(
$file[
"fullpath"], 
$file[
"name"]);
 
  402                                $file_names[] = 
$file[
"name"];
 
  407                $recipients = array();
 
  408                foreach($a_members as $member_id)
 
  411                        $recipients[] = $tmp_obj->getLogin();
 
  414                $recipients = implode(
"," ,$recipients);
 
  417                include_once 
"Services/Mail/classes/class.ilMail.php";
 
  419                $message = $tmp_mail_obj->sendMail(
 
  428                unset($tmp_mail_obj);
 
  431                if(
sizeof($file_names))
 
  433                        $mfile_obj->unlinkFiles($file_names);
 
  438                foreach($a_members as $member_id)
 
  441                        $member_status->setSent(
true);
 
  442                        $member_status->update();                       
 
  460                include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
 
  463                $passed_all_mandatory = 
true;
 
  464                $failed_a_mandatory = 
false;
 
  467                $passed_at_least_one = 
false;
 
  471                        $stat = $a->getMemberStatus($a_user_id)->getStatus();
 
  472                        if ($a->getMandatory() && ($stat == 
"failed" || $stat == 
"notgraded"))
 
  474                                $passed_all_mandatory = 
false;
 
  476                        if ($a->getMandatory() && ($stat == 
"failed"))
 
  478                                $failed_a_mandatory = 
true;
 
  480                        if ($stat == 
"passed")
 
  484                        if ($stat == 
"notgraded")
 
  490                if (count($ass) == 0)
 
  492                        $passed_all_mandatory = 
false;
 
  498                        $overall_stat = 
"notgraded";
 
  499                        if ($failed_a_mandatory)
 
  502                                $overall_stat = 
"failed";
 
  504                        else if ($passed_all_mandatory && $cnt_passed > 0)
 
  507                                $overall_stat = 
"passed";
 
  514                        $overall_stat = 
"notgraded";
 
  516                        if ($failed_a_mandatory || ($cnt_passed + $cnt_notgraded < $min_nr))
 
  519                                $overall_stat = 
"failed";
 
  521                        else if ($passed_all_mandatory && $cnt_passed >= $min_nr)
 
  524                                $overall_stat = 
"passed";
 
  529                        "overall_status" => $overall_stat,
 
  530                        "failed_a_mandatory" => $failed_a_mandatory);
 
  550                include_once(
"./Modules/Exercise/classes/class.ilExerciseMembers.php");
 
  552                        $st[
"overall_status"]);
 
  560                if (!is_object($this->members_obj))
 
  565                $mems = $this->members_obj->getMembers();
 
  566                foreach ($mems as $mem)
 
  577                include_once(
"./Modules/Exercise/classes/class.ilExAssignment.php");
 
  580                include_once 
"./Services/Excel/classes/class.ilExcel.php";
 
  582                $excel->addSheet($this->lng->txt(
"exc_status"));
 
  591                $excel->setCell(
$row, 0, $this->lng->txt(
"name"));              
 
  592                foreach ($ass_data as $ass)
 
  594                        $excel->setCell(
$row, $cnt++, $cnt-1);          
 
  596                $excel->setCell(
$row, $cnt++, $this->lng->txt(
"exc_total_exc"));
 
  597                $excel->setCell(
$row, $cnt++, $this->lng->txt(
"exc_mark"));
 
  598                $excel->setCell(
$row++, $cnt, $this->lng->txt(
"exc_comment_for_learner"));
 
  599                $excel->setBold(
"A1:".$excel->getColumnCoord($cnt).
"1");
 
  604                foreach($mem_obj->getMembers() as $user_id)
 
  610                include_once 
'Services/Tracking/classes/class.ilLPMarks.php';
 
  611                foreach ($mems as $user_id => 
$d)
 
  616                        $excel->setCell(
$row, $col++, 
$d[
"lastname"].
", ".
$d[
"firstname"].
" [".
$d[
"login"].
"]");
 
  619                        foreach ($ass_data as $ass)
 
  621                                $status = $ass->getMemberStatus($user_id)->getStatus();
 
  622                                $excel->setCell(
$row, $col++, $this->lng->txt(
"exc_".$status));         
 
  627                        $excel->setCell(
$row, $col++, $this->lng->txt(
"exc_".$status));
 
  631                        $excel->setCell(
$row, $col++, $marks_obj->getMark());
 
  632                        $excel->setCell(
$row++, $col, $marks_obj->getComment());                                                
 
  640                $excel->addSheet($this->lng->txt(
"exc_mark"));
 
  644                $excel->setCell(
$row, 0, $this->lng->txt(
"name"));              
 
  645                foreach ($ass_data as $ass)
 
  647                        $excel->setCell(
$row, $cnt++, $cnt-1);          
 
  649                $excel->setCell(
$row++, $cnt++, $this->lng->txt(
"exc_total_exc"));
 
  650                $excel->setBold(
"A1:".$excel->getColumnCoord($cnt).
"1");
 
  654                foreach ($mems as $user_id => 
$d)
 
  660                        $excel->setCell(
$row, $col++, 
$d[
"lastname"].
", ".
$d[
"firstname"].
" [".
$d[
"login"].
"]");
 
  663                        foreach ($ass_data as $ass)
 
  665                                $excel->setCell(
$row, $col++, $ass->getMemberStatus($user_id)->getMark());
 
  673                $excel->sendToClient($exc_name);
 
  681                $user_ids = $a_user_id;
 
  682                if(!is_array($user_ids))
 
  684                        $user_ids = array($user_ids);
 
  687                include_once(
"./Modules/Exercise/classes/class.ilExerciseMailNotification.php");
 
  689                $type = (bool)$a_is_text_feedback
 
  694                $not->setType(
$type);
 
  695                $not->setAssignmentId($a_ass_id);
 
  696                $not->setObjId($this->
getId());
 
  701                $not->setRecipients($user_ids);
 
  729                $this->completion_by_submission = (bool)$bool;
 
  736                $a_has_submitted = (bool)$a_has_submitted;                      
 
  738                include_once(
"./Modules/Exercise/classes/class.ilExerciseMembers.php");
 
  739                foreach($a_user_ids as $user_id)
 
  742                        $member_status->setReturned($a_has_submitted);  
 
  743                        $member_status->update();       
 
  751                        foreach($a_user_ids as $user_id)
 
  753                                $status = 
'notgraded';
 
  756                                        if(!is_array($a_valid_submissions) ||
 
  757                                                $a_valid_submissions[$user_id])
 
  764                                $member_status->setStatus($status);             
 
  765                                $member_status->update();                               
 
  780                $set = 
$ilDB->query(
"SELECT obj_id, status FROM exc_members".
 
  781                        " WHERE usr_id = ".
$ilDB->quote($a_user_id, 
"integer").
 
  782                        " AND (status = ".$ilDB->quote(
"passed", 
"text").
 
  783                        " OR status = ".$ilDB->quote(
"failed", 
"text").
")");
 
  788                        $all[
$row[
"obj_id"]] = (
$row[
"status"] == 
"passed");
 
  802                return (strlen($this->certificate_visibility)) ? $this->certificate_visibility : 0;
 
  813                $this->certificate_visibility = $a_value;
 
  826                $affectedRows = 
$ilDB->manipulateF(
"UPDATE exc_data SET certificate_visibility = %s WHERE obj_id = %s",
 
  827                        array(
'integer', 
'integer'),
 
  828                        array($a_value, $this->
getId())
 
  841                include_once 
"Services/Certificate/classes/class.ilCertificate.php";
 
  846                        if($certificate_visible != 2)
 
  849                                include_once 
'Modules/Exercise/classes/class.ilExerciseMembers.php';
 
  851                                if($certificate_visible == 1 && $status == 
"passed")
 
  856                                else if($certificate_visible == 0 && $status != 
"notgraded")
 
  873                return (
bool)$exc_set->get(
"add_to_pd", 
true);
 
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
for($col=0; $col< 50; $col++) $d
An exception for terminatinating execution or to throw for unit testing.
static isObjectActive($a_obj_id)
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
getExerciseId()
Get exercise id.
getId()
Get assignment id.
getInstruction()
Get instruction.
static getInstancesByExercise($a_exc_id)
static cloneAssignmentsOfExercise($a_old_exc_id, $a_new_exc_id, array $a_crit_cat_map)
Clone assignments of exercise.
getMemberStatus($a_user_id=null)
getDeadline()
Get deadline (timestamp)
static getInstancesByParentId($a_parent_id)
static deleteByParent($a_parent_id)
Exercise certificate adapter.
const TYPE_FEEDBACK_FILE_ADDED
const TYPE_FEEDBACK_TEXT_ADDED
static _writeReturned($a_obj_id, $a_user_id, $a_status)
Write returned status.
static _lookupStatus($a_obj_id, $a_user_id)
Lookup current status (notgraded|passed|failed)
static _writeStatus($a_obj_id, $a_user_id, $a_status)
Write user status.
This class handles all operations on files (attachments) in directory ilias_data/mail.
static _lookupMark($a_usr_id, $a_obj_id)
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
This class handles base functions for mail handling.
static removeForObject($type, $id)
Remove all notifications for given object.
const TYPE_EXERCISE_SUBMISSION
static _lookupFinishedUserExercises($a_user_id)
Get all exercises for user.
const TUTOR_FEEDBACK_TEXT
hasAddToDesktop()
Add to desktop after hand-in.
sendFeedbackFileNotification($a_feedback_file, $a_user_id, $a_ass_id, $a_is_text_feedback=false)
Send feedback file notification to user.
setTimestamp($a_timestamp)
determinStatusOfUser($a_user_id=0)
Determine status of user.
updateAllUsersStatus()
Update status of all users.
setPassNr($a_val)
Set number of assignments that must be passed to pass the exercise.
const TUTOR_FEEDBACK_MAIL
getShowSubmissions()
Get whether submissions of learners should be shown to other learners after deadline.
setShowSubmissions($a_val)
Set whether submissions of learners should be shown to other learners after deadline.
__construct($a_id=0, $a_call_by_reference=true)
Constructor @access public.
const TUTOR_FEEDBACK_FILE
processExerciseStatus(ilExAssignment $a_ass, array $a_user_ids, $a_has_submitted, array $a_valid_submissions=null)
update()
update object in db
saveCertificateVisibility($a_value)
Saves the visibility settings of the certificate.
setTutorFeedback($a_value)
updateUserStatus($a_user_id=0)
Update exercise status of user.
setCertificateVisibility($a_value)
Sets the visibility settings of the certificate.
exportGradesExcel()
Exports grades as excel.
setPassMode($a_val)
Set pass mode (all | nr)
setInstruction($a_instruction)
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.
$completion_by_submission
setDate($a_hour, $a_minutes, $a_day, $a_month, $a_year)
getCertificateVisibility()
Returns the visibility settings of the certificate.
read()
read object data from db into object
sendAssignment(ilExAssignment $a_ass, $a_members)
send exercise per mail to members
cloneObject($a_target_id, $a_copy_id=0, $a_omit_tree=false)
Clone exercise (no member data)
setCompletionBySubmission($bool)
Enabled/Disable completion by submission.
isCompletionBySubmissionEnabled()
Checks whether completion by submission is enabled or not.
getPassMode()
Get pass mode (all | nr)
static _lookupName($a_user_id)
lookup user name
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Class ilObject Basic functions for all objects.
getRefId()
get reference id @access public
getId()
get object id @access public
getTitle()
get object title @access public
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file