<?php
// QuickTicket 2.5 build:20110101
function Gotolist($intSelected=-1,$intReject=-1)
{
global $oVIP;
$str = '';
if ( isset($oVIP->sections) ) {
if ( count($oVIP->sections)>0 ) {
$arr = $oVIP->sections;
if ( $intReject>=0 ) { if ( isset($arr[$intReject]) ) unset($arr[$intReject]); }
$str = QTasTag($arr,($intSelected<0 ? '' : $intSelected));
// in case of several domains
if ( count($arr)>3 )
{
$arrDomains = GetDomains($oVIP->role);
if ( count($arrDomains>1) )
{
$str = '';
foreach ($arrDomains as $intDom=>$strDom)
{
$str .= '<optgroup label="'.$strDom.'">';// $arr[-$intDom] = $strDom;
$arrSections = QTarrget(GetSections($oVIP->role,$intDom,(isset($intReject) ? $intReject : -1)),'title');
foreach($arrSections as $intSection=>$strSection) $str .= '<option value="'.$intSection.'"'.($intSection==$intSelected ? QSEL : '').'>'.$strSection.'</option>';
$str .= '</optgroup>';
}
}
}
}}
return $str;
}
// --------
function HtmlPageCtrl($intType=0,$strWidth='')
{
if ( empty($strWidth) ) $strWidth=$_SESSION[QT]['site_width'];
switch ($intType)
{
case 0: echo '
<!-- PAGE CONTROL -->
<div class="qti">
<div class="page" style="width:',$strWidth,(substr($strWidth,-1)=='%' ? '' : 'px'),'">
<!-- PAGE CONTROL -->
';
break;
case 1: echo '
<!-- END PAGE CONTROL -->
</div>
</div>
<!-- END PAGE CONTROL -->
';
break;
}
}
// --------
function HtmlBanner($intType=0,$strSkin='',$strLogo='',$strLangMenu='')
{
if ( empty($strSkin) ) $strSkin=$_SESSION[QT]['skin_dir'];
if ( empty($strLogo) ) $strLogo='qti_logo.gif';
switch ($intType)
{
case 0: echo '
<!-- banner -->
<div class="banner">
<div class="bannerleft"><img class="banner_logo" src="',$strSkin,'/',$strLogo,'" alt="',$_SESSION[QT]['site_name'],'" title="',$_SESSION[QT]['site_name'],'" /></div>
<div class="bannerright">',$strLangMenu,'</div>
</div>
';
break;
case 1: echo '
<!-- banner -->
<div class="nobanner">
<div class="nobannerleft"> </div>
<div class="nobannerright"> ',$strLangMenu,'</div>
</div>
';
break;
case 2: echo '
<!-- banner -->
<div class="banner">
<div class="bannerleft"><img src="',$strSkin,'/',$strLogo,'" width="150" height="50" style="border-width:0" alt="QuickTicket" title="QuickTicket" /></div>
</div>
';
break;
}
}
// --------
function HtmlLettres($strGroup='all',$strAll='All',$strClass='lettres')
{
// $strGroup is the current group, $strAll is the label of the 'all' group
$strGroups = '<td class="'.$strClass.($strGroup=='all' ? ' active' : '').'" style="width:35px;">'.($strGroup=='all' ? $strAll : '<a class="'.$strClass.'" href="'.Href().'?group=all">'.$strAll.'</a>' ).'</td>';
for ($g='A';$g!='AA';$g++) $strGroups .= '<td class="'.$strClass.($strGroup==$g ? ' active' : '').'" style="width:18px;">'.($strGroup==$g ? $g : '<a class="'.$strClass.'" href="'.Href().'?group='.$g.'">'.$g.'</a>' ).'</td>';
$strGroups .= '<td class="'.$strClass.($strGroup=='0' ? ' active' : '').'" style="width:18px;">'.($strGroup=='0' ? '#' : '<a class="'.$strClass.'" href="'.Href().'?group=0">#</a>' ).'</td>';
return $strGroups.'<td class="hidden"> </td>'.N;
}
// --------
function HtmlPage($e=0)
{
global $oVIP,$oHtml,$L;
include('qti_p_header.php');
if ( $e==99 )
{
$strFile = Translate('sys_offline.txt'); if ( file_exists($strFile) ) { include($strFile); } else { echo Error(10); }
}
else
{
$oHtml->Msgbox('!'); echo Error($e); $oHtml->Msgbox();
}
include('qti_p_footer.php');
exit;
}
// --------
function HtmlScore($strLevel='3',$strSep='<br />',$i=-1)
{
if ( is_string($i) ) $i=trim(substr($i,0,4));
if ( !is_numeric($i) ) $i=-1;
$i = floatval($i);
switch($strLevel)
{
case '3':
return '
<input type="radio" name="title" id="i00" value="0" /><label for="i00">'.ValueScalebar(1,3).' '.ValueName(1,3).'</label><br />
<input type="radio" name="title" id="i50" value="50"'.(QTisbetween($i,33.33,66.66) ? QCHE : '').'/><label for="i50">'.ValueScalebar(50,3).' '.ValueName(50,3).'</label><br />
<input type="radio" name="title" id="i99" value="99"'.(QTisbetween($i,66.66) ? QCHE : '').'/><label for="i99">'.ValueScalebar(99,3).' '.ValueName(99,3).'</label><br />
<input type="radio" name="title" id="inull" value="null"'.($i<0 ? QCHE : '').'/><label for="inull">'.L('Unknown').'</label><br />
';
break;
case '5':
return '
<input type="radio" name="title" id="i00" value="0" /><label for="i00">'.ValueScalebar(1,5).' '.ValueName(1,5).'</label><br />
<input type="radio" name="title" id="i20" value="20"'.(QTisbetween($i,20,39.99) ? QCHE : '').'/><label for="i20">'.ValueScalebar(25,5).' '.ValueName(25,5).'</label><br />
<input type="radio" name="title" id="i40" value="40"'.(QTisbetween($i,40,59.99) ? QCHE : '').'/><label for="i40">'.ValueScalebar(50,5).' '.ValueName(50,5).'</label><br />
<input type="radio" name="title" id="i60" value="60"'.(QTisbetween($i,60,79.99) ? QCHE : '').'/><label for="i60">'.ValueScalebar(75,5).' '.ValueName(75,5).'</label><br />
<input type="radio" name="title" id="i99" value="99"'.(QTisbetween($i,80) ? QCHE : '').'/><label for="i99">'.ValueScalebar(99,5).' '.ValueName(99,5).'</label><br />
<input type="radio" name="title" id="inull" value="null"'.($i<0 ? QCHE : '').'/><label for="inull">'.L('Unknown').'</label><br />
';
break;
case '100':
return '
<input type="radio" name="title" id="i00" value="0"'.($i>=0 ? QCHE : '').'/><input type="text" name="titlevalue" id="titlevalue" value="'.($i<0 ? '0' : $i).'" size="3" maxlength="3" onfocus="document.getElementById(\'i00\').checked=true;" /><label for="i00">%</label><br />
<input type="radio" name="title" id="inull" value="null"'.($i<0 ? QCHE : '').'/><label for="inull">'.L('Unknown').'</label><br />
';
break;
case '2':
return '
<input type="radio" name="title" id="i00" value="0"'.(QTisbetween($i,0,49.99) ? QCHE : '').'/><label for="i00">'.ValueScalebar(1,2).' '.ValueName(1,2).'</label><br />
<input type="radio" name="title" id="i99" value="99"'.(QTisbetween($i,50) ? QCHE : '').'/><label for="i99">'.ValueScalebar(99,2).' '.ValueName(99,2).'</label><br />
<input type="radio" name="title" id="inull" value="null"'.($i<0 ? QCHE : '').'/><label for="inull">'.L('Unknown').'</label><br />
';
break;
}
}
// --------
function HtmlTabs($arrTabs=array(0=>'Empty'),$strUrl='', $strCurrent='',$intMax=6,$bFirst=true,$bLast=true,$strWarning='Data not yet saved. Quit without saving?')
{
// tabx means the last tab (can be special due to popup)
// if defined, the class/style tab_on replaces the class/style tab (but you can cumulate the classes in the definition)
// if defined, the class/style tabx_on replaces the class/style tabx (but you can cumulate the styles in the definition)
// When strCurrent is defined, this tab will not be clickable
// $arrTabs can be an array of: strings, arrays, cTab
$iCurrent=1;
foreach(array_keys($arrTabs) as $strKey)
{
if ($strKey==$strCurrent) break;
$iCurrent++;
}
// check
if ( !is_array($arrTabs) ) die('HtmlTabs: Argument #1 must be an array');
if ( !empty($strUrl) ) { if ( !strstr($strUrl,'?') ) $strUrl .= '?'; }
// display
echo'
<!-- tab header begin -->
<table cellspacing="0" class="tab">
';
$strOuts=''; $strOut=''; $intRow=0; $intCol=0;
foreach($arrTabs as $strKey=>$oTab)
{
if ( $intCol==0 )
{
$strOut = '<tr class="tab">'."\n";
if ( $bFirst ) $strOut .= '<td class="tab '.($intRow==0 ? 'tab_begin' : 'tab_hidden').'"> </td>'."\n";
$intCol++;
}
if ( $intCol>0 )
{
$strTab = '';
$strTabDesc = '';
// extract name and description from the object in arrTabs: can be a string, an array or a cTab
if ( is_string($oTab) )
{
$strTab = $oTab;
}
elseif ( is_array($oTab) )
{
if ( isset($oTab['tabdesc']) )
{
if ( !empty($oTab['tabdesc']) ) $strTabDesc = $oTab['tabdesc'];
}
if ( isset($oTab['tabname']) )
{
if ( !empty($oTab['tabname']) ) { $strTab=$oTab['tabname']; } else { $strTab=ObjTrans('tab',$strKey); }
}
else
{
$strTab=ObjTrans('tab',$strKey);
}
}
elseif ( strtolower(get_class($oTab))=='ctab' )
{
$strTabDesc = $oTab->tabdesc;
$strTab = $oTab->tabname; if ( empty($strTab) ) $strTab = $oTab->tabid;
}
else
{
die('HtmlTabs: Arg #1 must be an array of strings, arrays or cTab');
}
$strOut .= '<td class="tab tab_'.($strCurrent==$strKey ? 'on' : 'off').'_l"> </td>';
$strOut .= '<td class="tab tab_'.($strCurrent==$strKey ? 'on' : 'off').'_c">';
if ( empty($strUrl) || $strCurrent==$strKey )
{
$strOut .= $strTab;
}
else
{
$strOut .= '<a class="tab" href="'.$strUrl.'&tt='.$strKey.'"'.(empty($strTabDesc) ? '' : ' title="'.$strTabDesc.'"').' onclick="return qtEdited(bEdited,\''.$strWarning.'\');">'.$strTab.'</a>';
}
$strOut .= '</td>';
$strOut .= '<td class="tab tab_'.($strCurrent==$strKey ? 'on' : 'off').'_r"> </td>'."\n";
$intCol++;
}
if ( $intCol>$intMax || $intCol>count($arrTabs) )
{
if ( $bLast ) $strOut .= '<td class="'.($intRow==0 ? 'tab tab_end' : 'hidden').'"> </td>'."\n";
$strOut .= '</tr>'."\n";
$intCol=0;
$strOuts = $strOut.$strOuts;
$intRow++;
}
}
if ( $intCol>0 )
{
while($intCol<=$intMax) { $strOut .= '<td class="tab tab_a"> </td>'; $intCol++; }
if ( $bLast ) $strOut .= '<td class="tab'.($intRow==0 ? ' tab_end' : ' tab_hidden').'"> </td>'."\n";
$strOut .= '</tr>';
$strOuts = $strOut.$strOuts;
}
echo $strOuts;
echo '
</table>
<!-- tab header end -->
';
}
// --------
function TableEmpty($strMsg='...')
{
$arrFLD = array( new cFLD('0',' ','colhd colhdfirst','width:10px','colct colfirst'), new cFLD('1',' ','colhd','','colct'), new cFLD('2',' ','colhd colhdlast','width:10px','colct collast'));
echo '<table class="data_t" cellspacing="0" summary="empty table"><tr class="data_t">',N;
TableHeader($arrFLD,0);
echo '</tr>',N;
echo '<tr class="data_t">',N;
echo '<td class="colct r1"> </td>',N;
echo '<td class="colct r1"><p>',$strMsg,'</p></td>',N;
echo '<td class="colct r1"> </td>',N;
echo '</tr>';
echo '<tr class="data_t">',N;
echo '<td class="colft colftfirst"></td>',N;
for($i=1;$i<count($arrFLD)-1;$i++) echo '<td class="colft"></td>',N;
echo '<td class="colft colftlast"></td>',N;
echo '</tr></table>',N;
echo '<br />';
}
// --------
function TableHeader($arrFLD,$intCount=0,$strUrl='',$strOrder='lastpostdate',$strDir='DESC')
{
$img['ASC'] = ' <img class="ico i_sort" src="'.$_SESSION[QT]['skin_dir'].'/sort_asc.gif" alt="+" />';
$img['DESC']= ' <img class="ico i_sort" src="'.$_SESSION[QT]['skin_dir'].'/sort_desc.gif" alt="-" />';
foreach($arrFLD as $strKey=>$oFLD)
{
// change the text to hyperlink+image when necessary
if ( $oFLD->sort && $intCount>2 && !empty($strUrl) )
{
if ( $strKey==$strOrder )
{
$str = '<a href="'.Href($strUrl).'&order='.$oFLD->uid.'&dir='.($strDir=='ASC' ? 'DESC' : '').($strDir=='DESC' ? 'ASC' : '').'"'.(!empty($oFLD->class_th) ? ' class="'.$oFLD->class_th.'"' : '').'>'.$oFLD->name.'</a>'.$img[$strDir];
}
else
{
$str = '<a href="'.Href($strUrl).'&order='.$oFLD->uid.'&dir='.$oFLD->sort.'"'.(!empty($oFLD->class_th) ? ' class="'.$oFLD->class_th.'"' : '').'>'.$oFLD->name.'</a>';
}
}
else
{
$str = $oFLD->name;
}
echo '<td',(isset($oFLD->class_th) ? ' class="'.$oFLD->class_th.'"' : ''),(!empty($oFLD->style_th) ? ' style="'.$oFLD->style_th.'"' : ''),'>',$str,'</td>',N;
}
}
// ----------------
function TableRowShow($arrFLD,$arr,$strRowClass='table_o r1',$arrSrc=array())
{
global $oVIP;
echo '<tr class="',$strRowClass,'">',N;
foreach($arrFLD as $strKey=>$oFLD)
{
$strFullClass = $oFLD->class_td.($oFLD->class_dynamic ? $oFLD->AddClassDynamic($arrSrc) : ''); // in case of dynamic class
$strFullStyle = $oFLD->style_td.($oFLD->style_dynamic ? $oFLD->AddStyleDynamic($arrSrc) : ''); // in case of dynamic style
$strClass = ''; if ( !empty($strFullClass) ) $strClass = ' class="'.$strFullClass.'"';
$strStyle = ''; if ( !empty($strFullStyle) ) $strStyle = ' style="'.$strFullStyle.'"';
// show column (empty value is replaced by )
if ( !isset($arr[$strKey]) ) $arr[$strKey]=' ';
if ( $arr[$strKey]==='' ) $arr[$strKey]=' ';
echo '<td',$strClass,$strStyle,'>',$arr[$strKey],'</td>'.N;
}
echo '</tr>',N;
}
// --------
function TableRowFormat($arrFLD,$row,$bTopic=false,$oSEC,$bMap=false,$bCsv=false)
{
$arr = array();
global $oVIP,$L,$arrExtData;
if ( $bTopic )
{
$oTopic = new cTopic($row);
$strTopicUrl = 'qti_topic.php?t='.$oTopic->id;
}
// PRE-PROCESS
if ( isset($arrFLD['numid']) ) { $strSectionNumfield='N'; if ( isset($oSEC) ) $strSectionNumfield=$oSEC->numfield; if ( isset($row['numfield']) ) $strSectionNumfield=$row['numfield']; }
if ( isset($arrFLD['smile']) ) { $strSectionPrefix=''; if ( isset($oSEC) ) $strSectionPrefix=$oSEC->prefix; if ( isset($row['prefix']) ) $strSectionPrefix=$row['prefix']; }
if ( isset($arrFLD['you']) && $oTopic->items>0 )
{
global $arrMe;
if ( !empty($arrMe) ) {
if ( array_key_exists($oTopic->id,$arrMe) ) {
$oTopic->youreply = '<span title="'.$L['You_reply'].(empty($arrMe[$oTopic->id]) ? '' : ', '.QTdatestr($arrMe[$oTopic->id],'d M','H:i',true,true)).'"><b>®</b></span>';
}}
}
if ( isset($arrFLD['sectiontitle']) ) { if ( isset($_SESSION[QT]['sys_sections'][$oTopic->parentid]) ) { $strSectiontitle = $_SESSION[QT]['sys_sections'][$oTopic->parentid]; } else { $strSectiontitle='[section '.$oTopic->parentid.']'; } }
if ( isset($arrFLD['tags']) )
{
$strTags = '';
$strAbbr = '';
if ( empty($oTopic->tags) ) { $arrTags=array(); } else { $arrTags=explode(';',$oTopic->tags); }
if ( count($arrTags)>1 )
{
for ($i=0;$i<count($arrTags);$i++)
{
if ( $i<3 ) $strTags .= $arrTags[$i].';';
if ( $i>=3 ) $strAbbr .= $arrTags[$i].';';
if ( $i>13 ) break;
}
}
else
{
$strTags = $oTopic->tags;
}
$strTags = str_replace(';',' ',$strTags.(empty($strAbbr) ? '' : '<abbr title="'.$strAbbr.'">...</abbr>'));
}
// when searching in posts without title, use this to report empty title
if ( isset($arrFLD['title']) )
{
if ( trim($oTopic->title)=='' ) $oTopic->title='('.strtolower($L['Reply']).')';
if ( empty($oTopic->title) && $oTopic->title!='0' ) $oTopic->title='('.strtolower($L['Reply']).')';
}
// mail
if ( isset($arrFLD['mail']) || isset($arrFLD['location']) )
{
$strMail = '<img class="ico i_user" src="'.$_SESSION[QT]['skin_dir'].'/ico_user_e_0.gif" alt="mail" title="no e-mail" />';
if ( !empty($row['mail']) )
{
if ( $row['privacy']=='2' ) $strMail = AsEmails($row['mail'],$row['id'],'0','img'.(QTI_JAVA_MAIL ? 'java' : ''),false,$_SESSION[QT]['skin_dir'],'Java protected email',' ');
if ( $row['privacy']=='1' && $oVIP->role!='V' ) $strMail = AsEmails($row['mail'],$row['id'],'0','img'.(QTI_JAVA_MAIL ? 'java' : ''),false,$_SESSION[QT]['skin_dir'],'Java protected email',' ');
if ( $oVIP->id==$row['id'] || $oVIP->IsStaff() ) $strMail = AsEmails($row['mail'],$row['id'],'0','img'.(QTI_JAVA_MAIL ? 'java' : ''),false,$_SESSION[QT]['skin_dir'],'Java protected email',' ');
}
}
// www
if ( isset($arrFLD['www']) || isset($arrFLD['location']) )
{
if ($row['www']=='')
{
$strWww = '<img class="ico i_user" src="'.$_SESSION[QT]['skin_dir'].'/ico_user_w_0.gif" alt="email" title="no web site" />';
}
else
{
$strWww = '<a href="'.$row['www'].'"><img class="ico i_user" src="'.$_SESSION[QT]['skin_dir'].'/ico_user_w_1.gif" alt="www" title="web site" /></a>';
}
}
// coord, map points
$strCoord='';
$strLatLon='';
if ( $bMap )
{
global $bMapGoogle;
if ( isset($row['y']) && isset($row['x']) )
{
$y = floatval($row['y']);
$x = floatval($row['x']);
if ( !empty($y) && !empty($x) )
{
$strCoord = '<a href="javascript:void(0)"'.($bMapGoogle && !$_SESSION[QT]['m_map_hidelist'] ? ' onclick="map.setCenter(new GLatLng('.$y.','.$x.')); return false;"' : '').' title="'.$L['Coord'].': '.round($y,8).','.round($x,8).'"><img class="ico" src="'.$_SESSION[QT]['skin_dir'].'/ico_user_m_1.gif" alt="G" title="'.$L['Coord_latlon'].' '.QTdd2dms($y).','.QTdd2dms($x).'" /></a>';
}
}
if ( !empty($oTopic->y) && !empty($oTopic->x) )
{
$y = floatval($oTopic->y);
$x = floatval($oTopic->x);
$strCoord = '<a href="javascript:void(0)"'.($bMapGoogle && !$_SESSION[QT]['m_map_hidelist'] ? ' onclick="map.setCenter(new GLatLng('.$y.','.$x.')); return false;"' : '').' title="'.$L['Coord'].': '.round($y,8).','.round($x,8).'"><img class="ico" src="'.$_SESSION[QT]['skin_dir'].'/ico_user_m_1.gif" alt="G" title="'.$L['Coord_latlon'].' '.QTdd2dms($y).','.QTdd2dms($x).'" /></a>';
$strLatLon = QTdd2dms($y).'<br />'.QTdd2dms($x);
$str = $oTopic->GetIcon($_SESSION[QT]['skin_dir']).' '.( $strSectionNumfield=='N' ? '' : sprintf($strSectionNumfield,$oTopic->numid) );
$str .= '<p class="small">'.QTconv(substr($oTopic->title,0,50),'3',QTI_CONVERT_AMP);
$str .= '<br />'.$L['By'].' '.QTconv($oTopic->firstpostname).' ('.QTdatestr($oTopic->firstpostdate,'$','$',true,true).')<br />'.LangS('Reply',$oTopic->items);
$str .= '<br /><a class="gmap" href="'.Href($strTopicUrl).'">'.$L['map']['View_ticket'].' »</a></p>';
$oMapPoint = new cMapPoint( $y,$x,( $strSectionNumfield=='N' ? '' : sprintf($strSectionNumfield,$oTopic->numid).' ' ).substr($oTopic->title,0,25),$str );
if ( isset($_SESSION[QT]['m_map'][$oTopic->parentid]['icon']) ) $oMapPoint->icon = $_SESSION[QT]['m_map'][$oTopic->parentid]['icon'];
if ( isset($_SESSION[QT]['m_map'][$oTopic->parentid]['shadow']) ) $oMapPoint->shadow = $_SESSION[QT]['m_map'][$oTopic->parentid]['shadow'];
if ( isset($_SESSION[QT]['m_map'][$oTopic->parentid]['printicon']) ) $oMapPoint->printicon = $_SESSION[QT]['m_map'][$oTopic->parentid]['printicon'];
if ( isset($_SESSION[QT]['m_map'][$oTopic->parentid]['printshadow']) ) $oMapPoint->printshadow = $_SESSION[QT]['m_map'][$oTopic->parentid]['printshadow'];
$arrExtData[$oTopic->id] = $oMapPoint;
}
}
//privacy
$strPriv = '';
if ( isset($row['privacy']) && isset($row['id']) )
{
if ( $row['privacy']!=2 && ($oVIP->IsStaff() || $oVIP->id==$row['id']) ) $strPriv=' <img class="ico" src="admin/private'.$row['privacy'].'.gif" title="'.$L['Privacy_visible'][$row['privacy']].'" />';
}
// FORMAT
// ::::::::::
foreach($arrFLD as $strKey=>$oFLD) {
// ::::::::::
if ( $bCsv )
{
$str='';
switch($strKey)
{
case 'csvdate': $str = substr($oTopic->firstpostdate,0,8); break;
case 'csvtime': $str = (strlen($oTopic->firstpostdate)>9 ? substr($oTopic->firstpostdate,9,2).':'.substr($oTopic->firstpostdate,11,2).':'.substr($oTopic->firstpostdate,13,2) : ''); break;
case 'numid': $str = sprintf($strSectionNumfield,$oTopic->numid); break;
case 'status': $str = $oVIP->statuses[$oTopic->status]['statusname']; break;
case 'smile': $str = ($oTopic->smile=='00' ? '' : $L['Ico_prefix'][$strSectionPrefix.'_'.$oTopic->smile]); break;
case 'title': $str = ($oTopic->type=='A' ? $L['News_stamp'] : '').$oTopic->title; break;
case 'text': $str = $oTopic->preview; break;
case 'sectiontitle': $str = ObjTrans('sec','s'.$oTopic->parentid,$strSectiontitle); break;
case 'firstpostname':$str = $oTopic->firstpostname.', '.QTdatestr($oTopic->firstpostdate); break;
case 'lastpostdate': $str = QTdatestr($oTopic->lastpostdate).' '.strtolower($L['By']).' '.$oTopic->lastpostname; break;
case 'replies': $str = $oTopic->items; if ( $oTopic->type=='I' && !empty($oTopic->options) ) $str .= ' '.ValueName($oTopic->z,$oTopic->ReadOptions('Ilevel'),30); break;
case 'uid': $str = $oTopic->id; break;
case 'modifdate': $str = QTdatestr($oTopic->modifdate,'$',''); break;
case 'wisheddate': $str = QTdatestr($oTopic->wisheddate,'$',''); break; //QTdatestr returns '' on empty date
case 'coord': $str = str_replace('°','°',$strLatLon); break;
default: if ( isset($oTopic->$strKey) ) $str = $oTopic->$strKey; break;
}
$arr[$strKey] = ToCsv($str);
}
else
{
switch ($strKey)
{
case 'icon': $arr[$strKey] = $oTopic->GetIcon($_SESSION[QT]['skin_dir'],$strTopicUrl); break;
case 'numid': $arr[$strKey] = ( $strSectionNumfield=='N' ? ' ' : '<span class="span_ref">'.sprintf($strSectionNumfield,$oTopic->numid).'</span>' ); break;
case 'smile': $arr[$strKey] = ( $oTopic->smile=='00' ? ' ' : AsImg($_SESSION[QT]['skin_dir'].'/ico_prefix_'.$strSectionPrefix.'_'.$oTopic->smile.'.gif','[o]',$L['Ico_prefix'][$strSectionPrefix.'_'.$oTopic->smile],'ico ico_prefix') ); break;
case 'title': $arr[$strKey] = ( $oTopic->type=='A' ? '<span class="small">'.$L['News_stamp'].'</span>' : '' ).'<a class="topic" href="'.Href('qti_topic.php').'?t='.$oTopic->id.'"'.(!empty($oTopic->preview) ? ' title="'.$oTopic->preview.'"' : '').'>'.$oTopic->title.'</a>'.( empty($strCoord) ? '' : ' '.$strCoord ); break;
case 'you': $arr[$strKey] = $oTopic->youreply; break;
case 'replies': $arr[$strKey] = $oTopic->items; break;
case 'sectiontitle': $arr[$strKey] = ObjTrans('sec','s'.$oTopic->parentid,$strSectiontitle); break;
case 'firstpostname': $arr[$strKey] = '<a href="qti_user.php?id='.$oTopic->firstpostuser.'" title="'.$L['Ico_user_p'].'" class="small">'.$oTopic->firstpostname.'</a><br />'.QTdatestr($oTopic->firstpostdate,'$','$',true,true,true); break;
case 'lastpostdate': $arr[$strKey] = QTdatestr($oTopic->lastpostdate,'$','$',true,true,true).' <a href="'.Href('qti_topic.php').'?t='.$oTopic->id.'#p'.$oTopic->lastpostid.'" title="'.$L['H_Goto_message'].'">'.$L['Goto_message'].'</a><br />'.strtolower($L['By']).' <a href="qti_user.php?id='.$oTopic->lastpostuser.'" title="'.$L['Ico_user_p'].'" class="small">'.$oTopic->lastpostname.'</a>'; break;
case 'status': $arr[$strKey] = '<span title="'.(empty($oTopic->statusdate) ? '' : QTdatestr($oTopic->statusdate,'d M','H:i',true,true)).'">'.$oVIP->statuses[$oTopic->status]['statusname'].'</span>'; break;
case 'tags': $arr[$strKey] = '<span class="tag">'.$strTags.'</span>'; break;
case 'photo': $arr[$strKey] = ( empty($row['photo']) ? S : AsImg(QTI_DIR_PIC.$row['photo'],'',$row['name'],'imagelist','','qti_user.php?id='.$row['id']) ); break;
case 'name': $arr[$strKey] = '<a href="'.Href('qti_user.php').'?id='.$row['id'].'">'.$row['name'].'</a>'; break;
case 'role': $arr[$strKey] = $L['Userrole'][$row['role']]; break;
case 'contact': $arr[$strKey] = ( empty($strMail) ? '<img class="ico" src="'.$_SESSION[QT]['skin_dir'].'/ico_user_e_0.gif" alt="mail" title="no e-mail" />' : $strMail ).' '.( empty($strWww) ? '<img class="ico" src="'.$_SESSION[QT]['skin_dir'].'/ico_user_w_0.gif" alt="email" title="no web site" />' : $strWww ).( empty($strCoord) ? '' : ' '.$strCoord ).( empty($strPriv) ? '' : $strPriv); break;
case 'location': $arr[$strKey] = $row['location']; break;
case 'firstdate': $arr[$strKey] = QTdatestr($row['firstdate'],'$','',true,false,true); break;
case 'modifdate': $arr[$strKey] = ( !empty($oTopic->modifdate) ? QTdatestr($oTopic->modifdate,'$','',true,false,true) : $L['None']); break;
case 'wisheddate': $arr[$strKey] = '<span class="small">'.( !empty($oTopic->wisheddate) ? QTdatestr($oTopic->wisheddate,'$','',true,false,true) : $L['None']).'</span>'; break;
case 'notifiedname': $arr[$strKey] = '<span class="small">'.( $oTopic->notifiedid>0 ? '<a href="'.Href('qti_user.php').'?id='.$oTopic->notifiedid.'" title="'.$L['Userrole_UN'].'" class="small">'.$oTopic->notifiedname.'</a>' : $L['None']).'</span>'; break;
case 'actorname': $arr[$strKey] = '<span class="small">'.( $oTopic->actorid>0 ? '<a href="'.Href('qti_user.php').'?id='.$oTopic->actorid.'" title="'.$L['Userrole_MA'].'" class="small">'.$oTopic->actorname.'</a>' : $L['None']).'</span>'; break;
case 'coord': $arr[$strKey] = $strLatLon; break;
default:
if ( $bTopic )
{
if ( isset($oTopic->$strKey) ) $arr[$strKey] = $oTopic->$strKey;
}
elseif ( isset($row[$strKey]) )
{
$arr[$strKey] = $row[$strKey];
}
else
{
$arr[$strKey] = '';
}
if ( $arr[$strKey]!=='' ) $arr[$strKey] = '<span class="small">'.$arr[$strKey].'</span>';
break;
}
}
// ::::::::::
}
// ::::::::::
return $arr;
}
// --------
function ValueName($i=0,$strLevel='3')
{
if ( $i<0 ) return '';
// strLevel can be empty when ticket param is empty (and '' is returned)
switch($strLevel)
{
case '2':
if ( QTisbetween($i,50) ) return L('I_r_yes');
return L('I_r_no');
break;
case '3':
if ( QTisbetween($i,66.67) ) return L('I_r_good');
if ( QTisbetween($i,33.33,66.66) ) return L('I_r_medium');
return L('I_r_bad');
break;
case '5':
if ( QTisbetween($i,80) ) return L('I_r_veryhigh');
if ( QTisbetween($i,60,79.99) ) return L('I_r_high');
if ( QTisbetween($i,40,59.99) ) return L('I_r_medium');
if ( QTisbetween($i,20,39.99) ) return L('I_r_low');
return L('I_r_verylow');
break;
case '100':
return strval(round($i)).'%';
break;
}
return '';
}
// --------
function ValueScalebar($i=0,$strLevel='3',$intWidth=50,$bTitle=true)
{
if ( $i<0 ) return '';
// strLevel can be empty when ticket param is empty (and null image is returned)
$str = '00';
switch($strLevel)
{
case '2':
if ( QTisbetween($i,50) ) $str='99';
break;
case '3':
if ( QTisbetween($i,66.67) ) $str='99';
elseif ( QTisbetween($i,33.33,66.66) ) $str='50';
break;
case '5':
if ( QTisbetween($i,80) ) $str='99';
elseif ( QTisbetween($i,60,79.99) ) $str='70';
elseif ( QTisbetween($i,40,59.99) ) $str='50';
elseif ( QTisbetween($i,20,39.99) ) $str='30';
break;
case '100':
if ( QTisbetween($i,96) ) $str='99';
elseif ( QTisbetween($i,85,96) ) $str='90';
elseif ( QTisbetween($i,75,85) ) $str='80';
elseif ( QTisbetween($i,65,75) ) $str='70';
elseif ( QTisbetween($i,55,65) ) $str='60';
elseif ( QTisbetween($i,45,55) ) $str='50';
elseif ( QTisbetween($i,35,45) ) $str='40';
elseif ( QTisbetween($i,25,35) ) $str='30';
elseif ( QTisbetween($i,15,25) ) $str='20';
elseif ( QTisbetween($i,4,15) ) $str='10';
break;
}
return '<img src="admin/scalebar'.$str.'.gif" style="height:15px; width:'.$intWidth.'px; vertical-align:middle"'.($bTitle ? ' title="'.ValueName($i,$strLevel).'"': '').' alt="--" />';
}