ILIAS  release_4-4 Revision
class.ilWikiContributor.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2009 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 
34 {
35  const STATUS_NOT_GRADED = 0;
36  const STATUS_PASSED = 1;
37  const STATUS_FAILED = 2;
38 
46  function _lookupStatus($a_obj_id, $a_user_id)
47  {
48  global $ilDB;
49 
50  $set = $ilDB->queryF("SELECT status FROM il_wiki_contributor ".
51  "WHERE wiki_id = %s and user_id = %s",
52  array("integer", "integer"),
53  array($a_obj_id, $a_user_id));
54  if($row = $ilDB->fetchAssoc($set))
55  {
56  return $row["status"];
57  }
58  return false;
59  }
60 
68  function _lookupStatusTime($a_obj_id, $a_user_id)
69  {
70  global $ilDB;
71 
72  $set = $ilDB->queryF("SELECT status_time FROM il_wiki_contributor ".
73  "WHERE wiki_id = %s and user_id = %s",
74  array("integer", "integer"),
75  array($a_obj_id, $a_user_id));
76  if($row = $ilDB->fetchAssoc($set))
77  {
78  return $row["status_time"];
79  }
80  return false;
81  }
82 
92  function _writeStatus($a_obj_id, $a_user_id, $a_status)
93  {
94  global $ilDB;
95 
96  $ilDB->manipulate("DELETE FROM il_wiki_contributor WHERE ".
97  " wiki_id = ".$ilDB->quote($a_obj_id, "integer").
98  " AND user_id = ".$ilDB->quote($a_user_id, "integer"));
99 
100  $ilDB->manipulateF("INSERT INTO il_wiki_contributor (status, wiki_id, user_id, status_time) ".
101  "VALUES (%s,%s,%s,%s)",
102  array("integer", "integer", "integer", "timestamp"),
103  array($a_status, $a_obj_id, $a_user_id, ilUtil::now()));
104  }
105 
106 }
107 ?>
static now()
Return current timestamp in Y-m-d H:i:s format.
_lookupStatusTime($a_obj_id, $a_user_id)
Lookup last change in mark or success status.
Class ilWikiContributor.
_writeStatus($a_obj_id, $a_user_id, $a_status)
Write success status.
_lookupStatus($a_obj_id, $a_user_id)
Lookup current success status (STATUS_NOT_GRADED|STATUS_PASSED|STATUS_FAILED)