function save($catalogue = 'messages')
{
$messages = $this->untranslated;
if (count($messages) <= 0) {
return false;
}
$details = $this->getCatalogueDetails($catalogue);
if ($details) {
list($cat_id, $variant, $count) = $details;
} else {
return false;
}
if ($cat_id <= 0) {
return false;
}
$inserted = 0;
$time = time();
$command = $this->getDBConnection()->createCommand('INSERT INTO trans_unit (cat_id,id,source,date_added) VALUES (:catid,:id,:source,:dateadded)');
$command->bindParameter(':catid', $cat_id, PDO::PARAM_INT);
$command->bindParameter(':id', $count, PDO::PARAM_INT);
$command->bindParameter(':source', $message, PDO::PARAM_STR);
$command->bindParameter(':dateadded', $time, PDO::PARAM_INT);
foreach ($messages as $message) {
if (empty($message)) {
continue;
}
$count++;
$inserted++;
$command->execute();
}
if ($inserted > 0) {
$this->updateCatalogueTime($cat_id, $variant);
}
return $inserted > 0;
}