From b037354596f218a8bb42920437f8ea358fbabc8a Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Sun, 5 Dec 2010 00:27:57 +0000 Subject: moderators actions list visible - part 2 --- h-source/Application/Include/myFunctions.php | 42 +++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) (limited to 'h-source/Application/Include') 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; +} -- cgit v1.2.3