merge branch ?charactergroupsqueststations?

This commit is contained in:
oliver 2016-02-02 10:38:52 +01:00
commit 76ba31c04e
18 changed files with 351 additions and 84 deletions

View file

@ -157,9 +157,16 @@
*/
private function isMatching($regex, $answer)
{
// Check regex
if(empty($regex)) {
return false;
}
// Execute regex
$score = preg_match($regex, trim($answer));
// Return result
return ($score !== false && $score > 0);
}

View file

@ -23,6 +23,30 @@
/**
* Copy a Station.
*
* @param int $userId ID of creating user
* @param int $sourceStationId ID of Station to copy from
* @param int $targetStationId ID of Station to copy to
* @param int $seminaryMediaIds Mapping of SeminaryMedia-IDs from source Seminary to targetSeminary
*/
public function copyStation($userId, $sourceStationId, $targetStationId, $seminaryMediaIds)
{
// Copy keyword
$this->db->query(
'INSERT INTO stationtypes_keyword '.
'(station_id, created_user_id, keyword_regex) '.
'SELECT ?, ?, keyword_regex '.
'FROM stationtypes_keyword '.
'WHERE station_id = ?',
'iii',
$targetStationId, $userId,
$sourceStationId
);
}
/**
* Get the task of a keyword Station
*
@ -89,7 +113,6 @@
'iiss',
$stationId, $charactergroupId, $answer, $answer
);
var_dump("saved");
}
}

View file

@ -23,6 +23,30 @@
/**
* Copy a Station.
*
* @param int $userId ID of creating user
* @param int $sourceStationId ID of Station to copy from
* @param int $targetStationId ID of Station to copy to
* @param int $seminaryMediaIds Mapping of SeminaryMedia-IDs from source Seminary to targetSeminary
*/
public function copyStation($userId, $sourceStationId, $targetStationId, $seminaryMediaIds)
{
// Copy answers
$this->db->query(
'INSERT INTO stationtypes_multiplechoice '.
'(created_user_id, station_id, pos, answer, tick) '.
'SELECT ?, ?, pos, answer, tick '.
'FROM stationtypes_multiplechoice '.
'WHERE station_id = ?',
'iii',
$userId, $targetStationId,
$sourceStationId
);
}
/**
* Get all answers for a Station
*