ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\Survey\Sequence\SequenceDBRepository Class Reference
+ Collaboration diagram for ILIAS\Survey\Sequence\SequenceDBRepository:

Public Member Functions

 __construct (InternalDataService $data, \ilDBInterface $db)
 
 insert (int $survey_id, int $svy_question_id)
 

Protected Member Functions

 count (int $survey_id)
 

Protected Attributes

InternalDataService $data
 
ilDBInterface $db
 

Detailed Description

Definition at line 25 of file SequenceDBRepository.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Survey\Sequence\SequenceDBRepository::__construct ( InternalDataService  $data,
\ilDBInterface  $db 
)

Member Function Documentation

◆ count()

ILIAS\Survey\Sequence\SequenceDBRepository::count ( int  $survey_id)
protected

Definition at line 38 of file SequenceDBRepository.php.

Referenced by ILIAS\Survey\Sequence\SequenceDBRepository\insert().

38  : int
39  {
40  $set = $this->db->queryF(
41  "SELECT count(*) cnt FROM svy_svy_qst " .
42  " WHERE survey_fi = %s ",
43  ["integer"],
44  [$survey_id]
45  );
46  if ($rec = $this->db->fetchAssoc($set)) {
47  return (int) $rec["cnt"];
48  }
49  return 0;
50  }
+ Here is the caller graph for this function:

◆ insert()

ILIAS\Survey\Sequence\SequenceDBRepository::insert ( int  $survey_id,
int  $svy_question_id 
)

Definition at line 52 of file SequenceDBRepository.php.

References ILIAS\Survey\Sequence\SequenceDBRepository\count().

52  : int
53  {
54  $order_nr = $this->count($survey_id);
55  $next_id = $this->db->nextId('svy_svy_qst');
56  $this->db->manipulateF(
57  "INSERT INTO svy_svy_qst (survey_question_id, survey_fi," .
58  "question_fi, sequence, tstamp) VALUES (%s, %s, %s, %s, %s)",
59  array('integer', 'integer', 'integer', 'integer', 'integer'),
60  array($next_id, $survey_id, $svy_question_id, $order_nr, time())
61  );
62  return $next_id;
63  }
+ Here is the call graph for this function:

Field Documentation

◆ $data

InternalDataService ILIAS\Survey\Sequence\SequenceDBRepository::$data
protected

◆ $db

ilDBInterface ILIAS\Survey\Sequence\SequenceDBRepository::$db
protected

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