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
00035 require_once "class.ilForum.php";
00036 require_once "./classes/class.ilObject.php";
00037 require_once "./classes/class.ilFileDataForum.php";
00038
00039 class ilObjForum extends ilObject
00040 {
00046 var $default_view = 1;
00047
00052 var $anonymized = false;
00053
00059 var $Forum;
00060
00061
00066 var $statisticsEnabled;
00067
00074 function ilObjForum($a_id = 0,$a_call_by_reference = true)
00075 {
00076 global $ilias;
00077
00078
00079
00080
00081
00082
00083
00084 $new_deadline = time() - 60 * 60 * 24 * 7 * ($ilias->getSetting('frm_store_new') ?
00085 $ilias->getSetting('frm_store_new') :
00086 8);
00087 define('NEW_DEADLINE',$new_deadline);
00088
00089 $this->type = "frm";
00090 $this->ilObject($a_id,$a_call_by_reference);
00091
00092
00093 $this->Forum =& new ilForum();
00094
00095 if($a_id)
00096 {
00097 $this->__read();
00098 }
00099 }
00100
00101 function read($a_force_db = false)
00102 {
00103 parent::read($a_force_db);
00104
00105 $this->__read();
00106 }
00107
00108
00109 function getDefaultView()
00110 {
00111 return $this->default_view;
00112 }
00113 function setDefaultView($a_default_view)
00114 {
00115 return $this->default_view = (int) $a_default_view;
00116 }
00117
00118 function isAnonymized()
00119 {
00120 return $this->anonymized ? true : false;
00121 }
00122 function setAnonymized($a_status)
00123 {
00124 $this->anonymized = $a_status ? true : false;
00125 }
00126
00127 function _lookupThreadSubject($a_thread_id)
00128 {
00129 global $ilDB;
00130
00131 $query = "SELECT thr_subject FROM frm_threads ".
00132 "WHERE thr_pk = '".$a_thread_id."'";
00133 $res = $ilDB->query($query);
00134 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00135 {
00136 return $row->thr_subject;
00137 }
00138 return '';
00139 }
00140
00141
00142 function getCountUnread($a_usr_id,$a_thread_id = 0)
00143 {
00144 return $this->_getCountUnread($this->getId(),$a_usr_id,$a_thread_id);
00145 }
00146
00147 function _getCountUnread($a_frm_id, $a_usr_id,$a_thread_id = 0)
00148 {
00149 global $ilBench, $ilDB;
00150
00151 $ilBench->start("Forum",'getCountRead');
00152 if(!$a_thread_id)
00153 {
00154
00155 $query = "SELECT top_pk FROM frm_data ".
00156 "WHERE top_frm_fk = '".$a_frm_id."'";
00157
00158 $res = $ilDB->query($query);
00159 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00160 {
00161 $topic_id = $row->top_pk;
00162 }
00163
00164
00165 $query = "SELECT COUNT(pos_pk) as num_posts FROM frm_posts ".
00166 "WHERE pos_top_fk = '".$topic_id."'";
00167
00168 $res = $ilDB->query($query);
00169 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00170 {
00171 $num_posts = $row->num_posts;
00172 }
00173
00174 $query = "SELECT COUNT(post_id) count_read FROM frm_user_read ".
00175 "WHERE obj_id = '".$a_frm_id."' ".
00176 "AND usr_id = '".$a_usr_id."'";
00177
00178 $res = $ilDB->query($query);
00179 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00180 {
00181 $count_read = $row->count_read;
00182 }
00183 $unread = $num_posts - $count_read;
00184
00185 $ilBench->stop("Forum",'getCountRead');
00186 return $unread > 0 ? $unread : 0;
00187 }
00188 else
00189 {
00190 $query = "SELECT COUNT(pos_pk) as num_posts FROM frm_posts ".
00191 "WHERE pos_thr_fk = '".$a_thread_id."'";
00192
00193 $res = $ilDB->query($query);
00194 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00195 {
00196 $num_posts = $row->num_posts;
00197 }
00198
00199
00200 $query = "SELECT COUNT(post_id) as count_read FROM frm_user_read ".
00201 "WHERE obj_id = '".$a_frm_id."' ".
00202 "AND usr_id = '".$a_usr_id."' ".
00203 "AND thread_id = '".$a_thread_id."'";
00204
00205 $res = $ilDB->query($query);
00206 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00207 {
00208 $count_read = $row->count_read;
00209 }
00210 $unread = $num_posts - $count_read;
00211
00212 $ilBench->stop("Forum",'getCountRead');
00213 return $unread > 0 ? $unread : 0;
00214 }
00215 $ilBench->stop("Forum",'getCountRead');
00216 return false;
00217 }
00218
00219
00220 function markThreadRead($a_usr_id,$a_thread_id)
00221 {
00222
00223 $query = "SELECT * FROM frm_posts ".
00224 "WHERE pos_thr_fk = '".$a_thread_id."'";
00225
00226 $res = $this->ilias->db->query($query);
00227 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00228 {
00229 $this->markPostRead($a_usr_id,$a_thread_id,$row->pos_pk);
00230 }
00231 return true;
00232 }
00233
00234 function markAllThreadsRead($a_usr_id)
00235 {
00236 $query = "SELECT * FROM frm_data, frm_threads ".
00237 "WHERE top_frm_fk = '".$this->getId()."' ".
00238 "AND top_pk = thr_top_fk ";
00239
00240 $res = $this->ilias->db->query($query);
00241 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00242 {
00243 $this->markThreadRead($a_usr_id,$row->thr_pk);
00244 }
00245
00246 return true;
00247 }
00248
00249
00250 function markPostRead($a_usr_id,$a_thread_id,$a_post_id)
00251 {
00252
00253 $query = "SELECT * FROM frm_user_read ".
00254 "WHERE usr_id = '".$a_usr_id."' ".
00255 "AND obj_id = '".$this->getId()."' ".
00256 "AND thread_id = '".$a_thread_id."' ".
00257 "AND post_id = '".$a_post_id."'";
00258
00259 $res = $this->ilias->db->query($query);
00260 if($res->numRows())
00261 {
00262 return true;
00263 }
00264
00265
00266 $query = "INSERT INTO frm_user_read ".
00267 "SET usr_id = '".$a_usr_id."', ".
00268 "obj_id = '".$this->getId()."', ".
00269 "thread_id = '".$a_thread_id."', ".
00270 "post_id = '".$a_post_id."'";
00271
00272 $this->ilias->db->query($query);
00273
00274 return true;
00275 }
00276
00277 function isRead($a_usr_id,$a_post_id)
00278 {
00279 $query = "SELECT * FROM frm_user_read ".
00280 "WHERE usr_id = '".$a_usr_id."' ".
00281 "AND post_id = '".$a_post_id."'";
00282
00283 $res = $this->ilias->db->query($query);
00284
00285 return $res->numRows() ? true : false;
00286 }
00287
00288
00289
00290 function getCountNew($a_usr_id,$a_thread_id = 0)
00291 {
00292 global $ilBench;
00293
00294 $ilBench->start('Forum','getCountNew');
00295 if($a_thread_id)
00296 {
00297 $num = $this->__getCountNew($a_usr_id,$a_thread_id);
00298 $ilBench->stop('Forum','getCountNew');
00299
00300 return $num;
00301 }
00302 else
00303 {
00304 $counter = 0;
00305
00306
00307 $query = "SELECT DISTINCT(pos_thr_fk) FROM frm_posts,frm_data ".
00308 "WHERE top_pk = pos_top_fk ".
00309 "AND top_frm_fk = '".$this->getId()."' ";
00310
00311 $res = $this->ilias->db->query($query);
00312
00313 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00314 {
00315 $counter += $this->__getCountNew($a_usr_id,$row->pos_thr_fk);
00316 }
00317 $ilBench->stop('Forum','getCountNew');
00318 return $counter;
00319 }
00320 return 0;
00321 }
00322
00323
00324 function __getCountNew($a_usr_id,$a_thread_id = 0)
00325 {
00326 $counter = 0;
00327
00328 $timest = $this->__getLastThreadAccess($a_usr_id,$a_thread_id);
00329
00330
00331 $query = "SELECT pos_pk FROM frm_posts ".
00332 "WHERE pos_thr_fk = '".$a_thread_id."' ".
00333 "AND ( pos_date > '".date('Y-m-d H:i:s',$timest)."' ".
00334 "OR pos_update > '".date('Y-m-d H:i:s',$timest)."') ".
00335 "AND pos_usr_id != '".$a_usr_id."'";
00336
00337 $res = $this->ilias->db->query($query);
00338 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00339 {
00340 if(!$this->isRead($a_usr_id,$row->pos_pk))
00341 {
00342 ++$counter;
00343 }
00344 }
00345 return $counter;
00346 }
00347
00348 function isNew($a_usr_id,$a_thread_id,$a_post_id)
00349 {
00350 if($this->isRead($a_usr_id,$a_post_id))
00351 {
00352 return false;
00353 }
00354 $timest = $this->__getLastThreadAccess($a_usr_id,$a_thread_id);
00355
00356 $query = "SELECT * FROM frm_posts ".
00357 "WHERE pos_pk = '".$a_post_id."' ".
00358 "AND (pos_date > '".date('Y-m-d H:i:s',$timest)."' ".
00359 "OR pos_update > '".date('Y-m-d H:i:s',$timest)."') ".
00360 "AND pos_usr_id != '".$a_usr_id."'";
00361
00362 $res = $this->ilias->db->query($query);
00363
00364 return $res->numRows() ? true : false;
00365 }
00366
00367 function updateLastAccess($a_usr_id,$a_thread_id)
00368 {
00369 $query = "SELECT * FROM frm_thread_access ".
00370 "WHERE usr_id = '".$a_usr_id."' ".
00371 "AND obj_id = '".$this->getId()."' ".
00372 "AND thread_id = '".$a_thread_id."'";
00373
00374 $res = $this->ilias->db->query($query);
00375 if($res->numRows())
00376 {
00377 $query = "UPDATE frm_thread_access ".
00378 "SET access_last = '".time()."' ".
00379 "WHERE usr_id = '".$a_usr_id."' ".
00380 "AND obj_id = '".$this->getId()."' ".
00381 "AND thread_id = '".$a_thread_id."'";
00382
00383 $this->ilias->db->query($query);
00384 }
00385 else
00386 {
00387 $query = "INSERT INTO frm_thread_access ".
00388 "SET access_last = '".time()."', ".
00389 "access_old = '0', ".
00390 "usr_id = '".$a_usr_id."', ".
00391 "obj_id = '".$this->getId()."', ".
00392 "thread_id = '".$a_thread_id."'";
00393
00394 $this->ilias->db->query($query);
00395 }
00396
00397 return true;
00398 }
00399
00400
00401 function _updateOldAccess($a_usr_id)
00402 {
00403 global $ilDB,$ilias;
00404
00405 $query = "UPDATE frm_thread_access ".
00406 "SET access_old = access_last ".
00407 "WHERE usr_id = '".$a_usr_id."'";
00408
00409 $ilDB->query($query);
00410
00411
00412
00413 $new_deadline = time() - 60 * 60 * 24 * 7 * ($ilias->getSetting('frm_store_new') ?
00414 $ilias->getSetting('frm_store_new') :
00415 8);
00416
00417 $query = "DELETE FROM frm_thread_access ".
00418 "WHERE access_last < '".$new_deadline."'";
00419
00420 $ilDB->query($query);
00421
00422 return true;
00423 }
00424
00425 function _deleteUser($a_usr_id)
00426 {
00427 global $ilDB;
00428
00429 $query = "DELETE FROM frm_user_read ".
00430 "WHERE usr_id = '".$a_usr_id."'";
00431
00432 $ilDB->query($query);
00433
00434 $query = "DELETE FROM frm_thread_access ".
00435 "WHERE usr_id = '".$a_usr_id."'";
00436
00437 $ilDB->query($query);
00438
00439 return true;
00440 }
00441
00442
00443 function _deleteReadEntries($a_post_id)
00444 {
00445 global $ilDB;
00446
00447 $query = "DELETE FROM frm_user_read ".
00448 "WHERE post_id = '".$a_post_id."'";
00449
00450 $ilDB->query($query);
00451
00452 return true;
00453 }
00454
00455 function _deleteAccessEntries($a_thread_id)
00456 {
00457 global $ilDB;
00458
00459 $query = "DELETE FROM frm_thread_access ".
00460 "WHERE thread_id = '".$a_thread_id."'";
00461
00462 $ilDB->query($query);
00463
00464 return true;
00465 }
00466
00472 function update()
00473 {
00474 if (parent::update())
00475 {
00476 $query = "UPDATE frm_data ".
00477 "SET ".
00478 "top_name = '".ilUtil::prepareDBString($this->getTitle())."',".
00479 "top_description = '".ilUtil::prepareDBString($this->getDescription())."',".
00480 "top_update = '".date("Y-m-d H:i:s")."',".
00481 "update_user = '".(int) $_SESSION["AccountId"]."' ".
00482 "WHERE top_frm_fk = '".(int) $this->getId()."'";
00483 $res = $this->ilias->db->query($query);
00484
00485 $query = "REPLACE INTO frm_settings ".
00486 "SET obj_id = '".$this->getId()."', ".
00487 "default_view = '".$this->getDefaultView()."', ".
00488 "anonymized = '".($this->isAnonymized() ? 1 : 0)."', ".
00489 "statistics_enabled= '".($this->isStatisticsEnabled() ? 1 : 0)."'";
00490
00491 $this->ilias->db->query($query);
00492
00493 return true;
00494 }
00495
00496 return false;
00497 }
00498
00508 function ilClone($a_parent_ref,$a_with_content = true)
00509 {
00510 global $rbacadmin;
00511
00512
00513 $new_ref_id = parent::ilClone($a_parent_ref);
00514
00515
00516 $forumObj =& $this->ilias->obj_factory->getInstanceByRefId($new_ref_id);
00517
00518
00519 $query = "INSERT INTO frm_settings ".
00520 "SET obj_id = '".$forumObj->getId()."', ".
00521 "default_view = '".$this->getDefaultView()."', ".
00522 "anonymized = '".($this->isAnonymized() ? 1 : 0)."'";
00523 $this->ilias->db->query($query);
00524
00525
00526
00527 $tmp_file_obj =& new ilFileDataForum($this->getId());
00528
00529
00530 $roles = $forumObj->initDefaultRoles();
00531
00532
00533 $rbacadmin->assignUser($roles[0], $forumObj->getOwner(), "n");
00534 ilObjUser::updateActiveRoles($forumObj->getOwner());
00535
00536
00537 if(!$a_with_content)
00538 {
00539 $this->Forum->setWhereCondition("top_frm_fk = ".$this->getId());
00540 $topData = $this->Forum->getOneTopic();
00541
00542 $query = "INSERT INTO frm_data ".
00543 "VALUES('0','".$forumObj->getId()."','".ilUtil::prepareDBString($topData['top_name'])."','".
00544 ilUtil::prepareDBString($topData['top_description'])."','0','0','','".$roles[0]."',NOW(),'0',NOW(),'0','".
00545 $this->ilias->account->getId()."')";
00546
00547 $this->ilias->db->query($query);
00548
00549 return $new_ref_id;
00550 }
00551
00552
00553
00554 $this->Forum->setWhereCondition("top_frm_fk = ".$this->getId());
00555 $topData = $this->Forum->getOneTopic();
00556
00557
00558 $q = "INSERT INTO frm_data ";
00559 $q .= "(top_frm_fk,top_name,top_description,top_num_posts,top_num_threads,top_last_post,top_mods,top_date,".
00560 "top_usr_id,visits,top_update,update_user) ";
00561 $q .= "VALUES ";
00562 $q .= "('".$forumObj->getId()."','".addslashes($topData["top_name"])."','".addslashes($topData["top_description"])."','".
00563 $topData["top_num_posts"]."','".$topData["top_num_threads"]."','".$topData["top_last_post"]."','".$roles[0]."','".
00564 $topData["top_date"]."','".$topData["top_usr_id"]."','".$topData["visits"]."','".$topData["top_update"]."','".
00565 $topData["update_user"]."')";
00566 $this->ilias->db->query($q);
00567
00568
00569 $new_top_pk = $this->ilias->db->getLastInsertId();
00570
00571
00572 $resThreads = $this->Forum->getThreadList($topData["top_pk"]);
00573
00574 while ($thrData = $resThreads->fetchRow(DB_FETCHMODE_ASSOC))
00575 {
00576 $q = "INSERT INTO frm_threads ";
00577 $q .= "(thr_top_fk,thr_usr_id,thr_subject,thr_date,thr_update,thr_num_posts,thr_last_post,visits) ";
00578 $q .= "VALUES ";
00579 $q .= "('".$new_top_pk."','".$thrData["thr_usr_id"]."','".addslashes($thrData["thr_subject"])."','".
00580 $thrData["thr_date"]."','".$thrData["thr_update"]."','".$thrData["thr_num_posts"]."','".
00581 $thrData["thr_last_post"]."','".$thrData["visits"]."')";
00582 $this->ilias->db->query($q);
00583
00584
00585 $new_thr_pk = $this->ilias->db->getLastInsertId();
00586
00587
00588 $resPosts = $this->Forum->getPostList($topData["top_pk"], $thrData["thr_pk"]);
00589
00590 while ($posData = $resPosts->fetchRow(DB_FETCHMODE_ASSOC))
00591 {
00592 $q2 = "INSERT INTO frm_posts ";
00593 $q2 .= "(pos_top_fk,pos_thr_fk,pos_usr_id,pos_message,pos_date,pos_update) ";
00594 $q2 .= "VALUES ";
00595 $q2 .= "('".$new_top_pk."','".$new_thr_pk."','".$posData["pos_usr_id"]."','".
00596 addslashes($posData["pos_message"])."','".$posData["pos_date"]."','".$posData["pos_update"]."')";
00597 $this->ilias->db->query($q2);
00598
00599
00600 $new_pos_pk = $this->ilias->db->getLastInsertId();
00601
00602
00603 $tmp_file_obj->setPosId($posData["pos_pk"]);
00604 $tmp_file_obj->ilClone($forumObj->getId(),$new_pos_pk);
00605
00606
00607 $q3 = "SELECT * FROM frm_posts_tree ";
00608 $q3 .= "WHERE pos_fk = '".$posData["pos_pk"]."' ";
00609 $q3 .= "AND thr_fk = '".$thrData["thr_pk"]."'";
00610 $treeData = $this->ilias->db->getRow($q3, DB_FETCHMODE_ASSOC);
00611
00612 $q4 = "INSERT INTO frm_posts_tree (thr_fk,pos_fk,parent_pos,lft,rgt,depth,date) ";
00613 $q4 .= "VALUES ";
00614 $q4 .= "('".$new_thr_pk."','".$new_pos_pk."','".$treeData["parent_pos"]."','".
00615 $treeData["lft"]."','".$treeData["rgt"]."','".$treeData["depth"]."','".$treeData["date"]."')";
00616 $this->ilias->db->query($q4);
00617 }
00618 }
00619
00620
00621 unset($forumObj);
00622
00623
00624 return $new_ref_id;
00625 }
00626
00633 function delete()
00634 {
00635
00636 if (!parent::delete())
00637 {
00638 return false;
00639 }
00640
00641 $tmp_file_obj =& new ilFileDataForum($this->getId());
00642 $tmp_file_obj->delete();
00643 unset($tmp_file_obj);
00644
00645 $this->Forum->setWhereCondition("top_frm_fk = ".$this->getId());
00646 $topData = $this->Forum->getOneTopic();
00647
00648 $resThreads = $this->Forum->getThreadList($topData["top_pk"]);
00649
00650 while ($thrData = $resThreads->fetchRow(DB_FETCHMODE_ASSOC))
00651 {
00652
00653 $query = "DELETE FROM frm_posts_tree WHERE thr_fk = '".$thrData["thr_pk"]."'";
00654 $this->ilias->db->query($query);
00655
00656
00657 $query = "DELETE FROM frm_posts WHERE pos_thr_fk = '".$thrData["thr_pk"]."'";
00658 $this->ilias->db->query($query);
00659
00660
00661 $query = "DELETE FROM frm_threads WHERE thr_pk = '".$thrData["thr_pk"]."'";
00662 $this->ilias->db->query($query);
00663 }
00664
00665 $query = "DELETE FROM frm_data WHERE top_frm_fk = '".$this->getId()."'";
00666 $this->ilias->db->query($query);
00667
00668
00669 $query = "DELETE FROM frm_settings WHERE obj_id = '".$this->getId()."'";
00670 $this->ilias->db->query($query);
00671
00672
00673 $query = "DELETE FROM frm_user_read WHERE obj_id = '".$this->getId()."'";
00674 $this->ilias->db->query($query);
00675
00676
00677 $query = "DELETE FROM frm_thread_access WHERE obj_id = '".$this->getId()."'";
00678 $this->ilias->db->query($query);
00679
00680 return true;
00681 }
00682
00688 function initDefaultRoles()
00689 {
00690 global $rbacadmin;
00691
00692
00693 $rfoldObj = $this->createRoleFolder();
00694
00695
00696 $roleObj = $rfoldObj->createRole("il_frm_moderator_".$this->getRefId(),"Moderator of forum obj_no.".$this->getId());
00697 $roles[] = $roleObj->getId();
00698
00699
00700 $permissions = array(1,2,3,4,6,9,10);
00701 $rbacadmin->grantPermission($roles[0],$permissions,$this->getRefId());
00702
00703 unset($rfoldObj);
00704 unset($roleObj);
00705
00706 return $roles ? $roles : array();
00707 }
00708
00719 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
00720 {
00721 global $tree;
00722
00723 switch ($a_event)
00724 {
00725 case "link":
00726
00727
00728
00729
00730
00731 break;
00732
00733 case "cut":
00734
00735
00736
00737
00738 break;
00739
00740 case "copy":
00741
00742
00743
00744
00745
00746 break;
00747
00748 case "paste":
00749
00750
00751
00752
00753 break;
00754
00755 case "new":
00756
00757
00758
00759
00760 break;
00761 }
00762
00763
00764
00765 if ($a_node_id==$_GET["ref_id"])
00766 {
00767 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
00768 $parent_type = $parent_obj->getType();
00769 if($parent_type == $this->getType())
00770 {
00771 $a_node_id = (int) $tree->getParentId($a_node_id);
00772 }
00773 }
00774
00775 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
00776
00777 }
00778
00779 function createSettings()
00780 {
00781 $query = "INSERT INTO frm_settings ".
00782 "SET obj_id = '".$this->getId()."', ".
00783 "default_view = '".$this->getDefaultView()."', ".
00784 "anonymized = '".($this->isAnonymized() ? 1 : 0) ."', ".
00785 "statistics_enabled= '".($this->isStatisticsEnabled() ? 1 : 0)."'";
00786 $this->ilias->db->query($query);
00787
00788 return true;
00789 }
00790
00791
00792
00793 function __read()
00794 {
00795 $query = "SELECT * FROM frm_settings WHERE ".
00796 "obj_id = '".$this->getId()."'";
00797
00798 $res = $this->ilias->db->query($query);
00799 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00800 {
00801 $this->default_view = $row->default_view;
00802 $this->anonymized = $row->anonymized ? true : false;
00803 $this->statisticsEnabled = $row->statistics_enabled ? true : false;
00804 }
00805 return true;
00806 }
00807
00808 function __getLastThreadAccess($a_usr_id,$a_thread_id)
00809 {
00810 $query = "SELECT * FROM frm_thread_access ".
00811 "WHERE thread_id = '".$a_thread_id."' ".
00812 "AND usr_id = '".$a_usr_id."'";
00813
00814 $res = $this->ilias->db->query($query);
00815 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00816 {
00817 $last_access = $row->access_old;
00818 }
00819 if(!$last_access)
00820 {
00821
00822 $last_access = NEW_DEADLINE;
00823 }
00824 return $last_access;
00825 }
00826
00827
00835 function isNotificationEnabled($user_id, $thread_id)
00836 {
00837 $q = "SELECT COUNT(*) FROM frm_notification WHERE ";
00838 $q .= "user_id = '" . $user_id . "' AND ";
00839 $q .= "thread_id = '". $thread_id . "'";
00840 return $this->ilias->db->getOne($q);
00841 }
00842
00846 function isStatisticsEnabled ()
00847 {
00848 return $this->statisticsEnabled? true: false;
00849 }
00850
00854 function setStatisticsEnabled ($enabled)
00855 {
00856 $this->statisticsEnabled = $enabled?true: false;
00857 }
00858 }
00859 ?>