ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 28 of file TestManScoringDoneHelper.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 33 of file TestManScoringDoneHelper.php.

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

34  {
35  if (!$db) {
36  global $DIC;
37  $db = $DIC->database();
38  }
39  $this->db = $db;
40  }
global $DIC
Definition: shib_login.php:22

Member Function Documentation

◆ exists()

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

Definition at line 53 of file TestManScoringDoneHelper.php.

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

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

◆ isDone()

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

Definition at line 42 of file TestManScoringDoneHelper.php.

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

◆ setDone()

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

Definition at line 64 of file TestManScoringDoneHelper.php.

References ILIAS\Test\TestManScoringDoneHelper\exists().

64  : void
65  {
66  if ($this->exists($activeId)) {
67  $this->db->manipulateF(
68  "UPDATE " . self::TABLE_NAME . " SET done = %s WHERE active_id = %s",
69  ["integer", "integer"],
70  [$done, $activeId]
71  );
72  return;
73  }
74 
75  $this->db->manipulateF(
76  "INSERT INTO " . self::TABLE_NAME . " (active_id, done) VALUES (%s, %s)",
77  ["integer", "integer"],
78  [$activeId, $done]
79  );
80  }
+ 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 31 of file TestManScoringDoneHelper.php.


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