add media to right/wrong text of Character group Quest Stations

This commit is contained in:
oliver 2016-01-24 19:36:05 +01:00
commit efd304833c
8 changed files with 547 additions and 22 deletions

View file

@ -63,7 +63,7 @@
public function getStationById($stationId)
{
$data = $this->db->query(
'SELECT id, charactergroupsquest_id, stationtype_id, title, url, stationpicture_id, prolog, task, latitude, longitude, righttext, wrongtext '.
'SELECT id, charactergroupsquest_id, stationtype_id, title, url, stationpicture_id, prolog, task, latitude, longitude, righttext, wrongtext, rightimage_id, rightav_id, wrongimage_id, wrongav_id '.
'FROM charactergroupsqueststations '.
'WHERE id = ?',
'i',
@ -88,7 +88,7 @@
public function getStationByUrl($groupsquestId, $stationUrl)
{
$data = $this->db->query(
'SELECT id, charactergroupsquest_id, stationtype_id, title, url, stationpicture_id, prolog, task, latitude, longitude, righttext, wrongtext '.
'SELECT id, charactergroupsquest_id, stationtype_id, title, url, stationpicture_id, prolog, task, latitude, longitude, righttext, wrongtext, rightimage_id, rightav_id, wrongimage_id, wrongav_id '.
'FROM charactergroupsqueststations '.
'WHERE charactergroupsquest_id = ? AND url = ?',
'is',
@ -296,7 +296,7 @@
* @param int $stationId ID of Station to upload media for
* @param int $mediaId ID of Station media
*/
public function setPictureForStation($station, $mediaId)
public function setPictureForStation($stationId, $mediaId)
{
$this->db->query(
'UPDATE charactergroupsqueststations '.
@ -304,11 +304,59 @@
'WHERE id = ?',
'ii',
$mediaId,
$station
$stationId
);
}
/**
* Set the image for the right-text.
*
* @param int $stationId ID of Station to set image for
* @param int $mediaId ID of Seminary media to set
*/
public function setRightImageForStation($stationId, $mediaId)
{
$this->setMediaForStation($stationId, $mediaId, 'rightimage_id');
}
/**
* Set the audio/video for the right-text.
*
* @param int $stationId ID of Station to set audio/video for
* @param int $mediaId ID of Seminary media to set
*/
public function setRightAVForStation($stationId, $mediaId)
{
$this->setMediaForStation($stationId, $mediaId, 'rightav_id');
}
/**
* Set the image for the wrong-text.
*
* @param int $stationId ID of Station to set image for
* @param int $mediaId ID of Seminary media to set
*/
public function setWrongImageForStation($stationId, $mediaId)
{
$this->setMediaForStation($stationId, $mediaId, 'wrongimage_id');
}
/**
* Set the audio/video for the wrong-text.
*
* @param int $stationId ID of Station to set audio/video for
* @param int $mediaId ID of Seminary media to set
*/
public function setWrongAvForStation($stationId, $mediaId)
{
$this->setMediaForStation($stationId, $mediaId, 'wrongav_id');
}
/**
* Create a new Character groups Quest Station.
*
@ -437,6 +485,29 @@
);
}
/**
* Add a medium for a Character groups Quest Station.
*
* @param int $stationId ID of Station to upload media for
* @param int $mediaId ID of Seminary media
* @param string $field Field name to set media to
*/
private function setMediaForStation($stationId, $mediaId, $field)
{
$this->db->query(
sprintf(
'UPDATE charactergroupsqueststations '.
'SET %s = ? '.
'WHERE id = ?',
$field
),
'ii',
$mediaId,
$stationId
);
}
}
?>