add link to tables in error messages

This commit is contained in:
2014-09-06 00:12:03 +02:00
parent ecc3471ebc
commit 3f63181ec3
4 changed files with 32 additions and 30 deletions

View File

@@ -950,11 +950,10 @@ class Databap extends PhpObject
//New table info
$sTitle = mb_strtolower($bCreation?trim($sTitle):$asPrevTableInfo['title']);
$sDescription = mb_strtolower(trim($sDescription));
$sRightTableLink = '<a href="'.$this->getInternalLink('table', $sTitle).'" target="_blank">table '.self::getTableFormat($sTitle).'</a>';
//Check for existing table with the same name
if($bCreation && $this->checkValue(self::TABL_TABLE, array('title'=>$sTitle))) $sDesc = 'Une documentation existe déjà pour la '.$sRightTableLink;
elseif(!$bCreation && $iPrevTableId!=$this->getUpToDateId(self::TABL_TABLE, $sTitle)) $sDesc = 'Une version plus récente de cette documentation existe : '.$sRightTableLink;
if($bCreation && $this->checkValue(self::TABL_TABLE, array('title'=>$sTitle))) $sDesc = ToolBox::findReplaceLinks('Une documentation existe déjà pour la table '.self::getTableFormat($sTitle));
elseif(!$bCreation && $iPrevTableId!=$this->getUpToDateId(self::TABL_TABLE, $sTitle)) $sDesc = ToolBox::findReplaceLinks('Une version plus récente de la table '.self::getTableFormat($sTitle).' existe');
elseif(!$bSimul)
{
//Load table into database
@@ -999,8 +998,8 @@ class Databap extends PhpObject
$asTable['company'] = $asUser['company'];
//Out of date warning
$sRightTableLink = '<a href="'.$this->getInternalLink('table', $asTable['title']).'" target="_blank">table '.self::getTableFormat($asTable['title']).'</a>';
$asTable['warning'] = ($bReadById && $iTableId!=$this->getUpToDateId(self::TABL_TABLE, $iTableId))?'Il existe une documentation plus à jour pour la '.$sRightTableLink:'';
$sRightTableLink = ToolBox::findReplaceLinks('Il existe une documentation plus à jour pour la table '.self::getTableFormat($asTable['title']));
$asTable['warning'] = ($bReadById && $iTableId!=$this->getUpToDateId(self::TABL_TABLE, $iTableId))?$sRightTableLink:'';
}
else $sDesc = self::NOT_FOUND;
@@ -1151,14 +1150,17 @@ class Databap extends PhpObject
private function getTableInfo($iTableId, $bFormatting=true)
{
$asTable = $this->oMySql->selectRow(self::TABL_TABLE, $iTableId);
$asTable['timestamp'] = strtotime($asTable['led']);
if($bFormatting)
if(!empty($asTable))
{
$asTable['system'] = self::getTableFormat($asTable['system']);
$asTable['title'] = self::getTableFormat($asTable['title']);
$asTable['description'] = self::getDescriptionFormat($asTable['description']);
$asTable['led'] = self::getDateFormat($asTable['led']);
$asTable['formatted_keywords'] = str_replace("\n", '<br />', ToolBox::findReplaceLinks($asTable['keywords']));
$asTable['timestamp'] = strtotime($asTable['led']);
if($bFormatting)
{
$asTable['system'] = self::getTableFormat($asTable['system']);
$asTable['title'] = self::getTableFormat($asTable['title']);
$asTable['description'] = self::getDescriptionFormat($asTable['description']);
$asTable['led'] = self::getDateFormat($asTable['led']);
$asTable['formatted_keywords'] = str_replace("\n", '<br />', ToolBox::findReplaceLinks($asTable['keywords']));
}
}
return $asTable;
}