00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00033 class ilExerciseMembers
00034 {
00035 var $ilias;
00036
00037 var $ref_id;
00038 var $obj_id;
00039 var $members;
00040 var $status;
00041 var $status_feedback;
00042 var $status_sent;
00043 var $status_returned;
00044 var $notice;
00045
00046 function ilExerciseMembers($a_obj_id,$a_ref_id)
00047 {
00048 global $ilias;
00049
00050 $this->ilias =& $ilias;
00051 $this->obj_id = $a_obj_id;
00052 $this->ref_id = $a_ref_id;
00053 }
00054
00055
00056 function getRefId()
00057 {
00058 return $this->ref_id;
00059 }
00060 function getObjId()
00061 {
00062 return $this->obj_id;
00063 }
00064 function setObjId($a_obj_id)
00065 {
00066 $this->obj_id = $a_obj_id;
00067 }
00068 function getMembers()
00069 {
00070 return $this->members ? $this->members : array();
00071 }
00072 function setMembers($a_members)
00073 {
00074 $this->members = $a_members;
00075 }
00076
00082 function assignMember($a_usr_id)
00083 {
00084 global $ilDB;
00085
00086 $tmp_user = ilObjectFactory::getInstanceByObjId($a_usr_id);
00087 $tmp_user->addDesktopItem($this->getRefId(),"exc");
00088
00089
00090 $query = "REPLACE INTO exc_members ".
00091 "SET obj_id = ".$ilDB->quote($this->getObjId()).", ".
00092 "usr_id = ".$ilDB->quote($a_usr_id).", ".
00093 "status = 'notgraded', sent = '0', feedback='0'";
00094
00095 $res = $this->ilias->db->query($query);
00096 $this->read();
00097
00098 return true;
00099 }
00100 function isAssigned($a_id)
00101 {
00102 return in_array($a_id,$this->getMembers());
00103 }
00104
00105 function assignMembers($a_members)
00106 {
00107 $assigned = 0;
00108 if(is_array($a_members))
00109 {
00110 foreach($a_members as $member)
00111 {
00112 if(!$this->isAssigned($member))
00113 {
00114 $this->assignMember($member);
00115 }
00116 else
00117 {
00118 ++$assigned;
00119 }
00120 }
00121 }
00122 if($assigned == count($a_members))
00123 {
00124 return false;
00125 }
00126 else
00127 {
00128 return true;
00129 }
00130 }
00131
00137 function deassignMember($a_usr_id)
00138 {
00139 global $ilDB;
00140
00141 $tmp_user = ilObjectFactory::getInstanceByObjId($a_usr_id);
00142 $tmp_user->dropDesktopItem($this->getRefId(),"exc");
00143
00144 $query = "DELETE FROM exc_members ".
00145 "WHERE obj_id = ".$ilDB->quote($this->getObjId())." ".
00146 "AND usr_id = ".$ilDB->quote($a_usr_id)." ";
00147
00148 $this->ilias->db->query($query);
00149 $this->read();
00150
00151 $delivered_files =& $this->getDeliveredFiles($a_usr_id);
00152 $files_to_delete = array();
00153 $userfile = "";
00154 foreach ($delivered_files as $key => $value)
00155 {
00156 array_push($files_to_delete, $value["returned_id"]);
00157 $userfile = $value["filename"];
00158 }
00159 $this->deleteDeliveredFiles($files_to_delete, $a_usr_id);
00160
00161 if ($userfile)
00162 {
00163 $pathinfo = pathinfo($userfile);
00164 $dir = $pathinfo["dirname"];
00165 }
00166 if (is_dir($dir))
00167 {
00168 rmdir($dir);
00169 }
00170 return false;
00171 }
00172
00173 function deassignMembers($a_members)
00174 {
00175 if(is_array($a_members))
00176 {
00177 foreach($a_members as $member)
00178 {
00179 $this->deassignMember($member);
00180 }
00181 }
00182 else
00183 {
00184 return false;
00185 }
00186 }
00187 function setStatus($a_status)
00188 {
00189 if(is_array($a_status))
00190 {
00191 $this->status = $a_status;
00192 return true;
00193 }
00194 }
00195 function getStatus()
00196 {
00197 return $this->status ? $this->status : array();
00198 }
00199 function getStatusByMember($a_member_id)
00200 {
00201 if(isset($this->status[$a_member_id]))
00202 {
00203 return $this->status[$a_member_id];
00204 }
00205 return false;
00206 }
00207
00214 function setStatusForMember($a_member_id,$a_status)
00215 {
00216 global $ilDB;
00217
00218 $query = "UPDATE exc_members ".
00219 "SET status = ".$ilDB->quote($a_status).", ".
00220 "status_time= ".$ilDB->quote(date("Y-m-d H:i:s"))." ".
00221 " WHERE obj_id = ".$ilDB->quote($this->getObjId())." ".
00222 "AND usr_id = ".$ilDB->quote($a_member_id)." ".
00223 " AND status <> ".$ilDB->quote($a_status);
00224
00225 $this->ilias->db->query($query);
00226 $this->read();
00227
00228 return true;
00229 }
00230
00236 function updateStatusTimeForMember($a_member_id)
00237 {
00238 global $ilDB;
00239
00240 $query = "UPDATE exc_members ".
00241 "SET status_time= ".$ilDB->quote(date("Y-m-d H:i:s"))." ".
00242 " WHERE obj_id = ".$ilDB->quote($this->getObjId())." ".
00243 "AND usr_id = ".$ilDB->quote($a_member_id)." ";
00244
00245 $this->ilias->db->query($query);
00246 $this->read();
00247
00248 return true;
00249 }
00250
00251
00252 function setStatusSent($a_status)
00253 {
00254 if(is_array($a_status))
00255 {
00256 $this->status_sent = $a_status;
00257 return true;
00258 }
00259 }
00260 function getStatusSent()
00261 {
00262 return $this->status_sent ? $this->status_sent : array(0 => 0);
00263 }
00264 function getStatusSentByMember($a_member_id)
00265 {
00266 if(isset($this->status_sent[$a_member_id]))
00267 {
00268 return $this->status_sent[$a_member_id];
00269 }
00270 return false;
00271 }
00272 function setStatusSentForMember($a_member_id,$a_status)
00273 {
00274 global $ilDB;
00275
00276 $query = "UPDATE exc_members ".
00277 "SET sent = ".$ilDB->quote(($a_status ? 1 : 0))." , ".
00278 "sent_time=".$ilDB->quote(($a_status ? (date("Y-m-d H:i:s")) : ("0000-00-00 00:00:00"))).
00279 " WHERE obj_id = ".$ilDB->quote($this->getObjId())." ".
00280 "AND usr_id = ".$ilDB->quote($a_member_id)." ";
00281
00282 $this->ilias->db->query($query);
00283 $this->read();
00284
00285 return true;
00286 }
00287
00288 function getStatusReturned()
00289 {
00290 return $this->status_returned ? $this->status_returned : array(0 => 0);
00291 }
00292 function setStatusReturned($a_status)
00293 {
00294 if(is_array($a_status))
00295 {
00296 $this->status_returned = $a_status;
00297 return true;
00298 }
00299 return false;
00300 }
00301
00302 function getStatusReturnedByMember($a_member_id)
00303 {
00304 if(isset($this->status_returned[$a_member_id]))
00305 {
00306 return $this->status_returned[$a_member_id];
00307 }
00308 return false;
00309 }
00310 function setStatusReturnedForMember($a_member_id,$a_status)
00311 {
00312 global $ilDB;
00313
00314 $query = "UPDATE exc_members ".
00315 "SET returned = ".$ilDB->quote(($a_status ? 1 : 0))." ".
00316 "WHERE obj_id = ".$ilDB->quote($this->getObjId())." ".
00317 "AND usr_id = ".$ilDB->quote($a_member_id)." ";
00318
00319 $this->ilias->db->query($query);
00320 $this->read();
00321
00322 return true;
00323 }
00324
00325
00326 function setStatusFeedback($a_status)
00327 {
00328 if(is_array($a_status))
00329 {
00330 $this->status_feedback = $a_status;
00331 return true;
00332 }
00333 }
00334 function getStatusFeedback()
00335 {
00336 return $this->status_feedback ? $this->status_feedback : array(0 => 0);
00337 }
00338 function getStatusFeedbackByMember($a_member_id)
00339 {
00340 if(isset($this->status_feedback[$a_member_id]))
00341 {
00342 return $this->status_feedback[$a_member_id];
00343 }
00344 return false;
00345 }
00346
00347 function setStatusFeedbackForMember($a_member_id,$a_status)
00348 {
00349 global $ilDB;
00350
00351 $query = "UPDATE exc_members ".
00352 "SET feedback = ".$ilDB->quote(($a_status ? 1 : 0)).", ".
00353 "feedback_time=".$ilDB->quote(($a_status ? (date("Y-m-d H:i:s")) : ("0000-00-00 00:00:00"))).
00354 " WHERE obj_id = ".$ilDB->quote($this->getObjId())." ".
00355 "AND usr_id = ".$ilDB->quote($a_member_id);
00356
00357 $this->ilias->db->query($query);
00358 $this->read();
00359
00360 return true;
00361 }
00362
00363 function getNotice()
00364 {
00365 return $this->notice ? $this->notice : array(0 => 0);
00366 }
00367
00368 function setNotice($a_notice)
00369 {
00370 if(is_array($a_notice))
00371 {
00372 $this->notice = $a_notice;
00373 return true;
00374 }
00375 return false;
00376 }
00377
00378 function getNoticeByMember($a_member_id)
00379 {
00380 if(isset($this->notice[$a_member_id]))
00381 {
00382 return $this->notice[$a_member_id];
00383 }
00384 else
00385 {
00386 return "";
00387 }
00388 }
00389
00390 function hasReturned($a_member_id)
00391 {
00392 global $ilDB;
00393
00394 $query = sprintf("SELECT returned_id FROM exc_returned WHERE obj_id = %s AND user_id = %s",
00395 $this->ilias->db->quote($this->getObjId() . ""),
00396 $this->ilias->db->quote($a_member_id . "")
00397 );
00398 $result = $this->ilias->db->query($query);
00399 return $result->numRows();
00400 }
00401
00402 function getAllDeliveredFiles()
00403 {
00404 global $ilDB;
00405
00406 $query = "SELECT * FROM exc_returned WHERE obj_id = ".
00407 $ilDB->quote($this->getObjId());
00408
00409 $res = $this->ilias->db->query($query);
00410 while($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
00411 {
00412 $delivered[] = $row;
00413 }
00414 return $delivered ? $delivered : array();
00415 }
00416
00424 function &getDeliveredFiles($a_member_id)
00425 {
00426 $query = sprintf("SELECT *, TIMESTAMP + 0 AS TIMESTAMP14 FROM exc_returned WHERE obj_id = %s AND user_id = %s ORDER BY TIMESTAMP14",
00427 $this->ilias->db->quote($this->getObjId() . ""),
00428 $this->ilias->db->quote($a_member_id . "")
00429 );
00430 $result = $this->ilias->db->query($query);
00431 $delivered_files = array();
00432 if ($result->numRows())
00433 {
00434 while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
00435 {
00436 array_push($delivered_files, $row);
00437 }
00438 }
00439 return $delivered_files;
00440 }
00441
00448 function deleteDeliveredFiles($file_id_array, $a_member_id)
00449 {
00450 global $ilDB;
00451
00452 if (count($file_id_array))
00453 {
00454 $query = sprintf("SELECT * FROM exc_returned WHERE user_id = %s AND returned_id IN (".
00455 implode(ilUtil::quoteArray($file_id_array) ,",").")",
00456 $this->ilias->db->quote($a_member_id . "")
00457 );
00458 $result = $this->ilias->db->query($query);
00459 if ($result->numRows())
00460 {
00461 $result_array = array();
00462 while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
00463 {
00464 array_push($result_array, $row);
00465 }
00466
00467 $query = sprintf("DELETE FROM exc_returned WHERE user_id = %s AND returned_id IN ("
00468 .implode(ilUtil::quoteArray($file_id_array) ,",").")",
00469 $this->ilias->db->quote($a_member_id . "")
00470 );
00471 $result = $this->ilias->db->query($query);
00472
00473 foreach ($result_array as $key => $value)
00474 {
00475 unlink($value["filename"]);
00476 }
00477 }
00478 }
00479 }
00480
00486 function deliverReturnedFiles($a_member_id, $a_only_new = false)
00487 {
00488 global $ilUser, $ilDB;
00489
00490
00491 $and_str = "";
00492 if ($a_only_new)
00493 {
00494 $q = "SELECT download_time FROM exc_usr_tutor WHERE ".
00495 " obj_id = ".$ilDB->quote($this->getObjId())." AND ".
00496 " usr_id = ".$ilDB->quote($a_member_id)." AND ".
00497 " tutor_id = ".$ilDB->quote($ilUser->getId());
00498 $lu_set = $ilDB->query($q);
00499 if ($lu_rec = $lu_set->fetchRow(DB_FETCHMODE_ASSOC))
00500 {
00501 if ($lu_rec["download_time"] > 0)
00502 {
00503 $and_str = " AND timestamp > ".$ilDB->quote($lu_rec["download_time"]);
00504 }
00505 }
00506 }
00507
00508 $this->updateTutorDownloadTime($a_member_id);
00509
00510 $query = sprintf("SELECT * FROM exc_returned WHERE obj_id = %s AND user_id = %s".
00511 $and_str,
00512 $this->ilias->db->quote($this->getObjId() . ""),
00513 $this->ilias->db->quote($a_member_id . "")
00514 );
00515 $result = $this->ilias->db->query($query);
00516 $count = $result->numRows();
00517 if ($count == 1)
00518 {
00519 $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
00520 $this->downloadSingleFile($row["filename"], $row["filetitle"]);
00521 }
00522 else if ($count > 0)
00523 {
00524 $array_files = array();
00525 $filename = "";
00526 while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
00527 {
00528 $filename = $row["filename"];
00529 $pathinfo = pathinfo($filename);
00530 $dir = $pathinfo["dirname"];
00531 $file = $pathinfo["basename"];
00532 array_push($array_files, $file);
00533 }
00534 $pathinfo = pathinfo($filename);
00535 $dir = $pathinfo["dirname"];
00536 $this->downloadMultipleFiles($array_files, $dir, $a_member_id);
00537 }
00538 else
00539 {
00540 return false;
00541 }
00542
00543 return true;
00544 }
00545
00552 function updateTutorDownloadTime($a_member_id)
00553 {
00554 global $ilUser, $ilDB;
00555
00556
00557 $q = "REPLACE INTO exc_usr_tutor (obj_id, usr_id, tutor_id, download_time) VALUES ".
00558 "(".$ilDB->quote($this->getObjId()).",".$ilDB->quote($a_member_id).
00559 ",".$ilDB->quote($ilUser->getId()).",now())";
00560 $ilDB->query($q);
00561 }
00562
00563 function downloadSelectedFiles($array_file_id,$a_user_id)
00564 {
00565 global $ilDB;
00566
00567 if (count($array_file_id))
00568 {
00569 $query = "SELECT * FROM exc_returned ".
00570 "WHERE user_id = ".$ilDB->quote($a_user_id)." ".
00571 "AND returned_id IN (".
00572 implode(ilUtil::quoteArray($array_file_id) ,",").")";
00573 $result = $this->ilias->db->query($query);
00574 if ($result->numRows())
00575 {
00576 $array_found = array();
00577 while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
00578 {
00579 array_push($array_found, $row);
00580 }
00581 if (count($array_found) == 1)
00582 {
00583 $this->downloadSingleFile($array_found[0]["filename"], $array_found[0]["filetitle"]);
00584 }
00585 else
00586 {
00587 $filenames = array();
00588 $dir = "";
00589 $file = "";
00590 foreach ($array_found as $key => $value)
00591 {
00592 $pathinfo = pathinfo($value["filename"]);
00593 $dir = $pathinfo["dirname"];
00594 $file = $pathinfo["basename"];
00595 array_push($filenames, $file);
00596 }
00597 $this->downloadMultipleFiles($filenames, $dir);
00598 }
00599 }
00600 }
00601 }
00602
00603 function downloadSingleFile($filename, $filetitle)
00604 {
00605 require_once "./Services/Utilities/classes/class.ilUtil.php";
00606 ilUtil::deliverFile($filename, $filetitle);
00607 }
00608
00609 function downloadMultipleFiles($array_filenames, $pathname, $a_member_id = 0)
00610 {
00611 global $lng, $ilObjDataCache;
00612 require_once "./Services/Utilities/classes/class.ilUtil.php";
00613 $cdir = getcwd();
00614
00615 $zip = PATH_TO_ZIP;
00616 $tmpdir = ilUtil::ilTempnam();
00617 $tmpfile = ilUtil::ilTempnam();
00618 $tmpzipfile = $tmpfile . ".zip";
00619
00620 ilUtil::makeDir($tmpdir);
00621 chdir($tmpdir);
00622
00623
00624 foreach ($array_filenames as $key => $filename)
00625 {
00626
00627 $newFilename = trim(basename($array_filenames[$key]));
00628 $pos = strpos($newFilename , "_");
00629 if ($pos === false)
00630 {
00631 } else
00632 {
00633 $newFilename= substr($newFilename, $pos + 1);
00634 }
00635 $newFilename = $tmpdir.DIRECTORY_SEPARATOR.$newFilename;
00636
00637 $oldFilename = $pathname.DIRECTORY_SEPARATOR.$array_filenames[$key];
00638 if (!copy ($oldFilename, $newFilename))
00639 {
00640 echo 'Could not copy '.$oldFilename.' to '.$newFilename;
00641 }
00642 touch($newFilename, filectime($oldFilename));
00643 $array_filenames[$key] = ilUtil::escapeShellArg(basename($newFilename));
00644 }
00645 $zipcmd = $zip." ".ilUtil::escapeShellArg($tmpzipfile)." ".join($array_filenames, " ");
00646 exec($zipcmd);
00647 ilUtil::delDir($tmpdir);
00648 $exerciseTitle = $ilObjDataCache->lookupTitle($this->getObjId());
00649 $deliverFilename = $exerciseTitle;
00650 if ($a_member_id > 0)
00651 {
00652 $userName = ilObjUser::_lookupName($a_member_id);
00653 $deliverFilename .= "_".$userName["lastname"]."_".$userName["firstname"];
00654 } else
00655 {
00656 $deliverFilename .= "_files";
00657 }
00658 $deliverFilename .= ".zip";
00659 ilUtil::deliverFile($tmpzipfile, $deliverFilename);
00660 chdir($cdir);
00661 unlink($tmpzipfile);
00662 }
00663
00664 function setNoticeForMember($a_member_id,$a_notice)
00665 {
00666 global $ilDB;
00667
00668 $query = "UPDATE exc_members ".
00669 "SET notice = ".$ilDB->quote($a_notice)." ".
00670 "WHERE obj_id = ".$ilDB->quote($this->getObjId())." ".
00671 "AND usr_id = ".$ilDB->quote($a_member_id);
00672
00673 $this->ilias->db->query($query);
00674 $this->read();
00675
00676 return true;
00677 }
00678
00679
00680
00681
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726 function read()
00727 {
00728 global $ilDB;
00729
00730 $tmp_arr_members = array();
00731 $tmp_arr_status = array();
00732 $tmp_arr_sent = array();
00733 $tmp_arr_notice = array();
00734 $tmp_arr_returned = array();
00735 $tmp_arr_feedback = array();
00736
00737 $query = "SELECT * FROM exc_members ".
00738 "WHERE obj_id = ".$ilDB->quote($this->getObjId());
00739
00740 $res = $this->ilias->db->query($query);
00741 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00742 {
00743 $tmp_arr_members[] = $row->usr_id;
00744 $tmp_arr_notice[$row->usr_id] = $row->notice;
00745 $tmp_arr_returned[$row->usr_id] = $row->returned;
00746 $tmp_arr_status[$row->usr_id] = $row->status;
00747 $tmp_arr_sent[$row->usr_id] = $row->sent;
00748 $tmp_arr_feedback[$row->usr_id] = $row->feedback;
00749 }
00750 $this->setMembers($tmp_arr_members);
00751 $this->setNotice($tmp_arr_notice);
00752 $this->setStatus($tmp_arr_status);
00753 $this->setStatusSent($tmp_arr_sent);
00754 $this->setStatusReturned($tmp_arr_returned);
00755 $this->setStatusFeedback($tmp_arr_feedback);
00756
00757 return true;
00758 }
00759
00760
00761 function ilClone($a_new_id)
00762 {
00763 global $ilDB;
00764
00765 $data = array();
00766
00767 $query = "SELECT * FROM exc_members ".
00768 "WHERE obj_id = ".$ilDB->quote($this->getObjId());
00769
00770 $res = $this->ilias->db->query($query);
00771 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00772 {
00773 $data[] = array("usr_id" => $row->usr_id,
00774 "notice" => $row->notice,
00775 "returned" => $row->returned,
00776 "status" => $row->status,
00777 "sent" => $row->sent,
00778 "feedback" => $row->feedback
00779 );
00780 }
00781 foreach($data as $row)
00782 {
00783 $query = "INSERT INTO exc_members ".
00784 "SET obj_id = ".$ilDB->quote($a_new_id).", ".
00785 "usr_id = ".$ilDB->quote($row["usr_id"]).", ".
00786 "notice = ".$ilDB->quote($row["notice"]).", ".
00787 "returned = ".$ilDB->quote($row["returned"]).", ".
00788 "status = ".$ilDB->quote($row["status"]).", ".
00789 "feedback = ".$ilDB->quote($row["feedback"]).", ".
00790 "sent = ".$ilDB->quote($row["sent"]);
00791
00792 $res = $this->ilias->db->query($query);
00793 }
00794 return true;
00795 }
00796
00797 function delete()
00798 {
00799 global $ilDB;
00800
00801 $query = "DELETE FROM exc_members WHERE obj_id = ".$ilDB->quote($this->getObjId());
00802 $this->ilias->db->query($query);
00803
00804 return true;
00805 }
00806
00807 function _getMembers($a_obj_id)
00808 {
00809 global $ilDB;
00810
00811 $query = "SELECT DISTINCT(usr_id) as ud FROM exc_members ".
00812 "WHERE obj_id = ".$ilDB->quote($a_obj_id);
00813
00814 $res = $ilDB->query($query);
00815 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00816 {
00817 $usr_ids[] = $row->ud;
00818 }
00819
00820 return $usr_ids ? $usr_ids : array();
00821 }
00822
00823 function _getReturned($a_obj_id)
00824 {
00825 global $ilDB;
00826
00827 $query = "SELECT DISTINCT(usr_id) as ud FROM exc_members ".
00828 "WHERE obj_id = ".$ilDB->quote($a_obj_id)." ".
00829 "AND returned = 1";
00830
00831 $res = $ilDB->query($query);
00832 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00833 {
00834 $usr_ids[] = $row->ud;
00835 }
00836
00837 return $usr_ids ? $usr_ids : array();
00838 }
00839
00840
00841
00842
00843
00844 function _getPassedUsers($a_obj_id)
00845 {
00846 global $ilDB;
00847
00848 $query = "SELECT DISTINCT(usr_id) FROM exc_members ".
00849 "WHERE obj_id = ".$ilDB->quote($a_obj_id)." ".
00850 "AND status = 'passed'";
00851 $res = $ilDB->query($query);
00852 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00853 {
00854 $usr_ids[] = $row->usr_id;
00855 }
00856 return $usr_ids ? $usr_ids : array();
00857 }
00858
00859 function _getFailedUsers($a_obj_id)
00860 {
00861 global $ilDB;
00862
00863 $query = "SELECT DISTINCT(usr_id) FROM exc_members ".
00864 "WHERE obj_id = ".$ilDB->quote($a_obj_id)." ".
00865 "AND status = 'failed'";
00866 $res = $ilDB->query($query);
00867 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00868 {
00869 $usr_ids[] = $row->usr_id;
00870 }
00871 return $usr_ids ? $usr_ids : array();
00872 }
00873
00880 function _lookupStatus($a_obj_id, $a_user_id)
00881 {
00882 global $ilDB;
00883
00884 $query = "SELECT status FROM exc_members ".
00885 "WHERE obj_id = ".$ilDB->quote($a_obj_id).
00886 "AND usr_id = ".$ilDB->quote($a_user_id);
00887
00888 $res = $ilDB->query($query);
00889 if($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
00890 {
00891 return $row["status"];
00892 }
00893
00894 return false;
00895 }
00896
00897 }
00898 ?>