N°1386 - Advanced Search: Navigation in list - Browse this list

This commit is contained in:
acognet
2023-05-10 10:06:03 +02:00
parent 4695511b46
commit d4e64bc479
19 changed files with 394 additions and 109 deletions

View File

@@ -1315,14 +1315,15 @@ abstract class DBObject implements iDisplay
* @throws \CoreException
* @throws \DictExceptionMissingString
*/
public static function MakeHyperLink($sObjClass, $sObjKey, $sHtmlLabel = '', $sUrlMakerClass = null, $bWithNavigationContext = true, $bArchived = false, $bObsolete = false, $bIgnorePreview = false)
public static function MakeHyperLink($sObjClass, $sObjKey, $sHtmlLabel = '', $sUrlMakerClass = null, $bWithNavigationContext = true, $bArchived = false, $bObsolete = false, $bIgnorePreview = false, $sFilter = null)
{
if ($sObjKey <= 0) return '<em>'.Dict::S('UI:UndefinedObject').'</em>'; // Objects built in memory have negative IDs
if ($sObjKey <= 0) {
return '<em>'.Dict::S('UI:UndefinedObject').'</em>';
} // Objects built in memory have negative IDs
// Safety net
//
if (empty($sHtmlLabel))
{
if (empty($sHtmlLabel)) {
// If the object if not issued from a query but constructed programmatically
// the label may be empty. In this case run a query to get the object's friendly name
$sObjOql = 'SELECT '.$sObjClass.' WHERE id='.$sObjKey;
@@ -1367,9 +1368,7 @@ abstract class DBObject implements iDisplay
if ($sFA == '')
{
$sIcon = '';
}
else
{
} else {
if ($bClickable) {
$sIcon = "<span class=\"object-ref-icon text_decoration\"><span class=\"fas $sFA fa-1x fa-fw\"></span></span>";
} else {
@@ -1377,19 +1376,20 @@ abstract class DBObject implements iDisplay
}
}
if ($bClickable && (strlen($sUrl) > 0))
{
if ($bClickable && (strlen($sUrl) > 0)) {
if ($sFilter != null) {
$sUrl = $sUrl.'&filter='.$sFilter;
}
$sHLink = "<a class=\"object-ref-link\" href=\"$sUrl\">$sIcon$sHtmlLabel</a>";
}
else
{
} else {
$sHLink = $sIcon.$sHtmlLabel;
}
$sPreview = '';
if(SummaryCardService::IsAllowedForClass($sObjClass) && $bIgnorePreview === false){
$sPreview = SummaryCardService::GetHyperlinkMarkup($sObjClass, $sObjKey);
if (SummaryCardService::IsAllowedForClass($sObjClass) && $bIgnorePreview === false) {
$sPreview = SummaryCardService::GetHyperlinkMarkup($sObjClass, $sObjKey);
}
$sRet = "<span class=\"object-ref $sSpanClass\" $sPreview title=\"$sHint\">$sHLink</span>";
return $sRet;
}
@@ -1408,15 +1408,15 @@ abstract class DBObject implements iDisplay
* @throws CoreException
* @throws DictExceptionMissingString
*/
public function GetHyperlink($sUrlMakerClass = null, $bWithNavigationContext = true, $sLabel = null, $bIgnorePreview = false)
public function GetHyperlink($sUrlMakerClass = null, $bWithNavigationContext = true, $sLabel = null, $bIgnorePreview = false, $sFilter = null)
{
if($sLabel === null)
{
$sLabel = $this->GetName();
}
if ($sLabel === null) {
$sLabel = $this->GetName();
}
$bArchived = $this->IsArchived();
$bObsolete = $this->IsObsolete();
return self::MakeHyperLink(get_class($this), $this->GetKey(), $sLabel, $sUrlMakerClass, $bWithNavigationContext, $bArchived, $bObsolete, $bIgnorePreview);
return self::MakeHyperLink(get_class($this), $this->GetKey(), $sLabel, $sUrlMakerClass, $bWithNavigationContext, $bArchived, $bObsolete, $bIgnorePreview, $sFilter);
}
/**