diff options
Diffstat (limited to 'h-source/Application/Include/myFunctions.php')
-rw-r--r-- | h-source/Application/Include/myFunctions.php | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/h-source/Application/Include/myFunctions.php b/h-source/Application/Include/myFunctions.php index cf1708f..e182690 100644 --- a/h-source/Application/Include/myFunctions.php +++ b/h-source/Application/Include/myFunctions.php @@ -307,7 +307,7 @@ function gtext($string) { return Lang::$i18n[Lang::$current][$string]; } - return $string; + return $string; } //rewrite the vendor name @@ -322,3 +322,43 @@ function betterVendor($string) return (array_key_exists($string,$names)) ? $names[$string] : $string; } + +//get the hardware info from the talk id +function getHardwareInfoFromTalkId($id = 0) +{ + $clean['id'] = (int)$id; + $talk = new TalkModel(); + $res = $talk->select('hardware.type,hardware.id_hard')->from('hardware inner join talk')->using('id_hard')->where(array('id_talk'=>$clean['id']))->send(); + return $res[0]['hardware']; +} + +//get the issue info from the message id +function getIssueNumberFromMessageId($id = 0) +{ + $clean['id'] = (int)$id; + $mess = new MessagesModel(); + $res = $mess->select('issues.id_issue')->from('issues inner join messages')->using('id_issue')->where(array('id_mes'=>$clean['id']))->toList('issues.id_issue')->send(); + return $res[0]; +} + +//return the URL to the moderated object page +function goToModeratedItem( $row = array() ) +{ + $url = null; + + switch ($row['type']) + { + case 'message': + $url = 'issues/view/'.Lang::$current.'/'.getIssueNumberFromMessageId($row['id']).'#message-'.$row['id']; + break; + case 'talk': + $hardInfo = getHardwareInfoFromTalkId($row['id']); + $controller = MyStrings::$reverse[$hardInfo['type']]; + $url = $controller.'/talk/'.Lang::$current.'/'.$hardInfo['id_hard'].'#talk-'.$row['id']; + break; + case 'user': + $url = 'meet/user/'.Lang::$current.'/'.getUserName($row['id']); + break; + } + return 'http://'.DOMAIN_NAME.'/'.$url; +} |