ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilAssQuestionHint Class Reference
+ Collaboration diagram for ilAssQuestionHint:

Public Member Functions

 __construct ()
 Constructor.
 getId ()
 returns the hint id
 setId ($id)
 sets the passed hint id
 getQuestionId ()
 returns the question id the hint currently relates to
 setQuestionId ($questionId)
 sets the passed question id so hint relates to it
 getIndex ()
 returns the ordering index of hint
 setIndex ($index)
 sets the passed hint ordering index
 getPoints ()
 returns the points to ground-off for this hint
 setPoints ($points)
 sets the passed points to ground-off for this hint
 getText ()
 returns the hint text
 setText ($text)
 sets the passed hint text
 load ($id)
 loads the hint dataset with passed id from database and assigns it the to this hint object instance
 save ()
 saves the current hint object state to database.
 delete ()
 deletes the persisted hint object in database by deleting the hint dataset identified by hint id
 getPageObjectType ()

Static Public Member Functions

static assignDbRow (self $questionHint, $hintDbRow)
 assigns the field elements of passed hint db row array to the corresponding hint object properties of passed hint object instance
static deleteById ($hintId)
 deletes the persisted hint object in database by deleting the hint dataset identified by hint id
static getInstanceById ($hintId)
 creates a hint object instance, loads the persisted hint dataset identified by passed hint id from database and assigns it as object state
static getHintIndexLabel (ilLanguage $lng, $hintIndex)

Data Fields

const PAGE_OBJECT_TYPE = 'qht'

Private Member Functions

 update ()
 persists the current object state to database by updating an existing dataset identified by hint id
 insert ()
 persists the current object state to database by inserting a new dataset with a new hint id fetched from primary key sequence

Private Attributes

 $id = null
 $questionId = null
 $index = null
 $points = null
 $text = null

Detailed Description

Definition at line 14 of file class.ilAssQuestionHint.php.

Constructor & Destructor Documentation

ilAssQuestionHint::__construct ( )

Constructor.

public

Definition at line 65 of file class.ilAssQuestionHint.php.

{
}

Member Function Documentation

static ilAssQuestionHint::assignDbRow ( self  $questionHint,
  $hintDbRow 
)
static

assigns the field elements of passed hint db row array to the corresponding hint object properties of passed hint object instance

public

Parameters
self$questionHint
array$hintDbRow

Definition at line 303 of file class.ilAssQuestionHint.php.

Referenced by ilAssQuestionHintList\getListByHintIds(), ilAssQuestionHintList\getListByQuestionId(), and load().

{
foreach($hintDbRow as $field => $value)
{
switch($field)
{
case 'qht_hint_id': $questionHint->setId($value); break;
case 'qht_question_fi': $questionHint->setQuestionId($value); break;
case 'qht_hint_index': $questionHint->setIndex($value); break;
case 'qht_hint_points': $questionHint->setPoints($value); break;
case 'qht_hint_text': $questionHint->setText($value); break;
default: throw new ilTestQuestionPoolException("invalid db field identifier ($field) given!");
}
}
}

+ Here is the caller graph for this function:

ilAssQuestionHint::delete ( )

deletes the persisted hint object in database by deleting the hint dataset identified by hint id

Returns
integer $affectedRows

Definition at line 289 of file class.ilAssQuestionHint.php.

References deleteById(), and getId().

{
return self::deleteById($this->getId());
}

+ Here is the call graph for this function:

static ilAssQuestionHint::deleteById (   $hintId)
static

deletes the persisted hint object in database by deleting the hint dataset identified by hint id

public ilDB $ilDB

Parameters
integer$hintId
Returns
integer $affectedRows

Definition at line 330 of file class.ilAssQuestionHint.php.

References $query.

Referenced by delete().

{
global $ilDB;
$query = "
DELETE FROM qpl_hints
WHERE qht_hint_id = %s
";
return $ilDB->manipulateF(
$query, array('integer'), array($hintId)
);
}

+ Here is the caller graph for this function:

static ilAssQuestionHint::getHintIndexLabel ( ilLanguage  $lng,
  $hintIndex 
)
static

Definition at line 365 of file class.ilAssQuestionHint.php.

References ilLanguage\txt().

Referenced by ilAssQuestionHintPageObjectCommandForwarder\buildRequestPresentationPageObjectGUI(), and ilAssQuestionHintsTableGUI\fillRow().

{
return sprintf($lng->txt('tst_question_hints_index_column_label'), $hintIndex);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAssQuestionHint::getId ( )

returns the hint id

public

Returns
integer $id

Definition at line 76 of file class.ilAssQuestionHint.php.

References $id.

Referenced by delete(), insert(), save(), ilAssQuestionHintTracking\storeRequest(), and update().

{
return $this->id;
}

+ Here is the caller graph for this function:

ilAssQuestionHint::getIndex ( )

returns the ordering index of hint

public

Returns
integer $index

Definition at line 120 of file class.ilAssQuestionHint.php.

References $index.

Referenced by insert(), and update().

{
return $this->index;
}

+ Here is the caller graph for this function:

static ilAssQuestionHint::getInstanceById (   $hintId)
static

creates a hint object instance, loads the persisted hint dataset identified by passed hint id from database and assigns it as object state

public

Parameters
integer$hintId
Returns
self $hintInstance

Definition at line 353 of file class.ilAssQuestionHint.php.

Referenced by ilAssQuestionHintTracking\getNextRequestableHint(), ilAssQuestionHintsGUI\initHintOrderingClipboardNotification(), ilAssQuestionHintsGUI\pasteFromOrderingClipboardAfterCmd(), ilAssQuestionHintsGUI\pasteFromOrderingClipboardBeforeCmd(), and ilAssQuestionHintRequestGUI\showHintCmd().

{
$questionHint = new self();
$questionHint->load($hintId);
return $questionHint;
}

+ Here is the caller graph for this function:

ilAssQuestionHint::getPageObjectType ( )

Definition at line 360 of file class.ilAssQuestionHint.php.

References PAGE_OBJECT_TYPE.

ilAssQuestionHint::getPoints ( )

returns the points to ground-off for this hint

public

Returns
integer $points

Definition at line 142 of file class.ilAssQuestionHint.php.

References $points.

Referenced by insert(), and update().

{
return $this->points;
}

+ Here is the caller graph for this function:

ilAssQuestionHint::getQuestionId ( )

returns the question id the hint currently relates to

public

Returns
integer $questionId

Definition at line 98 of file class.ilAssQuestionHint.php.

References $questionId.

Referenced by insert(), and update().

{
}

+ Here is the caller graph for this function:

ilAssQuestionHint::getText ( )

returns the hint text

public

Returns
string $text

Definition at line 164 of file class.ilAssQuestionHint.php.

References $text.

Referenced by insert(), and update().

{
return $this->text;
}

+ Here is the caller graph for this function:

ilAssQuestionHint::insert ( )
private

persists the current object state to database by inserting a new dataset with a new hint id fetched from primary key sequence

private ilDB $ilDB

Returns
boolean $success

Definition at line 268 of file class.ilAssQuestionHint.php.

References getId(), getIndex(), getPoints(), getQuestionId(), getText(), and setId().

Referenced by save().

{
global $ilDB;
$this->setId($ilDB->nextId('qpl_hints'));
return $ilDB->insert('qpl_hints', array(
'qht_hint_id' => array('integer', $this->getId()),
'qht_question_fi' => array('integer', $this->getQuestionId()),
'qht_hint_index' => array('integer', $this->getIndex()),
'qht_hint_points' => array('float', $this->getPoints()),
'qht_hint_text' => array('clob', $this->getText())
));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAssQuestionHint::load (   $id)

loads the hint dataset with passed id from database and assigns it the to this hint object instance

public ilDB $ilDB

Parameters
integer$id
Returns
boolean $success

Definition at line 189 of file class.ilAssQuestionHint.php.

References $id, $query, $res, $row, and assignDbRow().

{
global $ilDB;
$query = "
SELECT qht_hint_id,
qht_question_fi,
qht_hint_index,
qht_hint_points,
qht_hint_text
FROM qpl_hints
WHERE qht_hint_id = %s
";
$res = $ilDB->queryF(
$query, array('integer'), array((int)$id)
);
while( $row = $ilDB->fetchAssoc($res) )
{
return true;
}
return false;
}

+ Here is the call graph for this function:

ilAssQuestionHint::save ( )

saves the current hint object state to database.

it performs an insert or update, depending on the current initialisation of the hint id property

a valid initialised id leads to an update, a non or invalid initialised id leads to an insert

public

Returns
boolean $success

Definition at line 228 of file class.ilAssQuestionHint.php.

References getId(), insert(), and update().

{
if( $this->getId() ) return $this->update();
else return $this->insert();
}

+ Here is the call graph for this function:

ilAssQuestionHint::setId (   $id)

sets the passed hint id

public

Parameters
integer$id

Definition at line 87 of file class.ilAssQuestionHint.php.

References $id.

Referenced by insert().

{
$this->id = (int)$id;
}

+ Here is the caller graph for this function:

ilAssQuestionHint::setIndex (   $index)

sets the passed hint ordering index

public

Parameters
integer$index

Definition at line 131 of file class.ilAssQuestionHint.php.

References $index.

{
$this->index = (int)$index;
}
ilAssQuestionHint::setPoints (   $points)

sets the passed points to ground-off for this hint

public

Parameters
integer$points

Definition at line 153 of file class.ilAssQuestionHint.php.

References $points.

{
$this->points = (float)$points;
}
ilAssQuestionHint::setQuestionId (   $questionId)

sets the passed question id so hint relates to it

public

Parameters
integer$questionId

Definition at line 109 of file class.ilAssQuestionHint.php.

References $questionId.

{
$this->questionId = (int)$questionId;
}
ilAssQuestionHint::setText (   $text)

sets the passed hint text

public

Parameters
string$text

Definition at line 175 of file class.ilAssQuestionHint.php.

References $text.

{
$this->text = $text;
}
ilAssQuestionHint::update ( )
private

persists the current object state to database by updating an existing dataset identified by hint id

private ilDB $ilDB

Returns
boolean $success

Definition at line 242 of file class.ilAssQuestionHint.php.

References getId(), getIndex(), getPoints(), getQuestionId(), and getText().

Referenced by save().

{
global $ilDB;
return $ilDB->update(
'qpl_hints',
array(
'qht_question_fi' => array('integer', $this->getQuestionId()),
'qht_hint_index' => array('integer', $this->getIndex()),
'qht_hint_points' => array('float', $this->getPoints()),
'qht_hint_text' => array('clob', $this->getText())
),
array(
'qht_hint_id' => array('integer', $this->getId())
)
);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilAssQuestionHint::$id = null
private

Definition at line 24 of file class.ilAssQuestionHint.php.

Referenced by getId(), load(), and setId().

ilAssQuestionHint::$index = null
private

Definition at line 41 of file class.ilAssQuestionHint.php.

Referenced by getIndex(), and setIndex().

ilAssQuestionHint::$points = null
private

Definition at line 50 of file class.ilAssQuestionHint.php.

Referenced by getPoints(), and setPoints().

ilAssQuestionHint::$questionId = null
private

Definition at line 32 of file class.ilAssQuestionHint.php.

Referenced by getQuestionId(), and setQuestionId().

ilAssQuestionHint::$text = null
private

Definition at line 58 of file class.ilAssQuestionHint.php.

Referenced by getText(), and setText().

const ilAssQuestionHint::PAGE_OBJECT_TYPE = 'qht'

Definition at line 16 of file class.ilAssQuestionHint.php.

Referenced by getPageObjectType().


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