ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ILIAS\Test\TestManScoringDoneHelper Class Reference
+ Collaboration diagram for ILIAS\Test\TestManScoringDoneHelper:

Public Member Functions

 __construct (?ilDBInterface $db=null)
 
 isDone (int $activeId)
 
 exists (int $activeId)
 
 setDone (int $activeId, bool $done)
 

Private Attributes

ilDBInterface $db
 
const TABLE_NAME = "manscoring_done"
 

Detailed Description

Definition at line 30 of file TestManScoringDoneHelper.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Test\TestManScoringDoneHelper::__construct ( ?ilDBInterface  $db = null)

Definition at line 35 of file TestManScoringDoneHelper.php.

References ILIAS\Test\TestManScoringDoneHelper\$db, and $DIC.

36  {
37  if (!$db) {
38  global $DIC;
39  $db = $DIC->database();
40  }
41  $this->db = $db;
42  }
global $DIC
Definition: feed.php:28

Member Function Documentation

◆ exists()

ILIAS\Test\TestManScoringDoneHelper::exists ( int  $activeId)

Definition at line 55 of file TestManScoringDoneHelper.php.

Referenced by ILIAS\Test\TestManScoringDoneHelper\setDone().

55  : bool
56  {
57  $result = $this->db->queryF(
58  "SELECT active_id FROM " . self::TABLE_NAME . " WHERE active_id = %s",
59  ["integer"],
60  [$activeId]
61  );
62 
63  return $result->numRows() === 1;
64  }
+ Here is the caller graph for this function:

◆ isDone()

ILIAS\Test\TestManScoringDoneHelper::isDone ( int  $activeId)

Definition at line 44 of file TestManScoringDoneHelper.php.

44  : bool
45  {
46  $result = $this->db->queryF(
47  "SELECT done FROM " . self::TABLE_NAME . " WHERE active_id = %s AND done = 1",
48  ["integer"],
49  [$activeId]
50  );
51 
52  return $result->numRows() === 1;
53  }

◆ setDone()

ILIAS\Test\TestManScoringDoneHelper::setDone ( int  $activeId,
bool  $done 
)

Definition at line 66 of file TestManScoringDoneHelper.php.

References ILIAS\Test\TestManScoringDoneHelper\exists().

66  : void
67  {
68  if ($this->exists($activeId)) {
69  $this->db->manipulateF(
70  "UPDATE " . self::TABLE_NAME . " SET done = %s WHERE active_id = %s",
71  ["integer", "integer"],
72  [$done, $activeId]
73  );
74  return;
75  }
76 
77  $this->db->manipulateF(
78  "INSERT INTO " . self::TABLE_NAME . " (active_id, done) VALUES (%s, %s)",
79  ["integer", "integer"],
80  [$activeId, $done]
81  );
82  }
+ Here is the call graph for this function:

Field Documentation

◆ $db

ilDBInterface ILIAS\Test\TestManScoringDoneHelper::$db
private

◆ TABLE_NAME

const ILIAS\Test\TestManScoringDoneHelper::TABLE_NAME = "manscoring_done"
private

Definition at line 33 of file TestManScoringDoneHelper.php.


The documentation for this class was generated from the following file: