Location: PHPKode > projects > QuickTicket > quickticket/quickticket/qti_topics_inc.php
<?php

// QuickTicket 1.9.0.3 build:20081001

$intWhile=0;
$strAlt='1';

while ( $row=$oDB->Getrow() )
{

  // make a topic
  $oTopic = new cTopic($row);
  if ( $bAddRef )
  {
    $strSectionNumfield = 'N'; if ( isset($oSEC) ) $strSectionNumfield = $oSEC->numfield;
    if ( isset($row['numfield']) ) $strSectionNumfield = $row['numfield'];
  }
  if ( $bAddPrefix )
  {
    $strSectionPrefix = 'a'; if ( isset($oSEC) ) $strSectionPrefix = $oSEC->prefix;
    if ( isset($row['prefix']) ) $strSectionPrefix = $row['prefix'];
  }

  // when searching in posts without title, use this to report empty title
  if ( trim($oTopic->title)=='' ) $oTopic->title='('.strtolower($L['Reply']).')';
  if ( empty($oTopic->title) && $oTopic->title!='0' ) $oTopic->title='('.strtolower($L['Reply']).')';

  // you reply
  if ( $oTopic->replies>0 && $oVIP->numpost>0 && $oVIP->id>0 )
  {
    $oDB2->Query('SELECT count(id) as countid FROM '.TABPOST.' WHERE topic='.$oTopic->id.' AND userid='.$oVIP->id);
    $row2 = $oDB2->Getrow();
    if ( $row2['countid']!=0 ) $oTopic->youreply = '<span title="'.$L['You_reply'].'"><b>&reg;</b></span>';
  }

  // status
  if ( isset($_SESSION['qtiTstatus'][$oTopic->status]['color']) )
  {
    $strStatusColor = $_SESSION['qtiTstatus'][$oTopic->status]['color'];
  }
  else
  {
    $strStatusColor = '';
  }

  // icon
  if ( strtolower($oTopic->type)=='a' )
  {
    $strTicon = $_SESSION[QT]['skin_dir'].'/ico_topic_a_0.gif';
    $strTname = $L['Ico_topic_a_0'];
  }
  else
  {
    if ( isset($_SESSION['qtiTstatus'][$oTopic->status]['statusname']) )
    {
    $strTicon = $_SESSION[QT]['skin_dir'].'/'.$_SESSION['qtiTstatus'][$oTopic->status]['icon'];
    $strTname = $_SESSION['qtiTstatus'][$oTopic->status]['statusname'];
    }
    else
    {
    $strTicon = 'admin/ico_status.gif';
    $strTname = 'unknown status';
    }
  }

  // ------
  // DISPLAY
  // ------

  echo '<tr class="tr_t tr_t',$strAlt,'">',N;
  echo '<td class="td_t td_t_ico',$strAlt,'">',AsImg($strTicon,'T',$strTname,'ico ico_t',null,'qti_topic.php?s='.$oTopic->section.'&amp;t='.$oTopic->id),'</td>',N;
  if ( $bAddRef) echo '<td class="td_t td_t_ref',$strAlt,'"',( empty($strStatusColor) ? '' : ' style="background-color:'.$strStatusColor.'"' ),'>',( $strSectionNumfield=='N' ? '&nbsp;' : sprintf($strSectionNumfield,$oTopic->numid) ),'</td>',N;
  if ( $bAddPrefix ) echo '<td class="td_t td_t_smi',$strAlt,'">',($oTopic->smile!='00' ? AsImg($_SESSION[QT]['skin_dir'].'/ico_prefix_'.$strSectionPrefix.'_'.$oTopic->smile.'.gif','[o]',$L['Ico_prefix'][$strSectionPrefix.'_'.$oTopic->smile],'ico ico_prefix') : S),'</td>',N;
  echo '<td class="td_t td_t_tit',$strAlt,'">',($oTopic->type=='A' ? '<span class="small">'.$L['News_stamp'].'</span>' : ''),'<a class="a_topic" href="qti_topic.php?s=',$oTopic->section,'&amp;t=',$oTopic->id,'"',( !empty($oTopic->preview) ? ' title="'.$oTopic->preview.'"' : ''),'>',$oTopic->title,'</a></td>',N;
  echo '<td class="td_t td_t_inf',$strAlt,'">',$oTopic->youreply,'</td>',N;
  if ( $bAddSection )
  {
    if ( isset($_SESSION['qtiGoto'][$oTopic->section]) ) { $str = $_SESSION['qtiGoto'][$oTopic->section]; } else { $str='untitled'; }
    echo '<td class="td_t td_t_inf',$strAlt,'">',ObjectName('sec','s'.$oTopic->section,$str),'</td>',N;
  }
  echo '<td class="td_t td_t_inf',$strAlt,'"><a href="qti_usr.php?id=',$oTopic->firstpostuser,'" title="',$L['Ico_user_p_1'],'" class="small">',$oTopic->firstpostname,'</a><br/>',QTdate($oTopic->firstpostdate,$arrQTdate),'</td>',N;
  echo '<td class="td_t td_t_inf',$strAlt,'">',QTdate($oTopic->lastpostdate,$arrQTdate),' <a href="qti_topic.php?s=',$oTopic->section,'&amp;t=',$oTopic->id,'#p',$oTopic->lastpostid,'" title="',$L['H_Goto_message'],'">',$L['Goto_message'],'</a><br/>',strtolower($L['By']),' <a href="qti_usr.php?id=',$oTopic->lastpostuser,'" title="',$L['Ico_user_p_1'],'" class="small">',$oTopic->lastpostname,'</a></td>',N;
  // extra colomn
  switch ($strExtra)
  {
  case 'wisheddate':  echo '<td class="td_t td_t_sta',$strAlt,'"><span class="small">',( !empty($oTopic->wisheddate) ? QTdate($oTopic->wisheddate,array('n','date',$_SESSION[QT]['formatdate'],null,$L['dateSQL'])) : $L['None']),'</span></td>',N; break;
  case 'status':      echo '<td class="td_t td_t_sta',$strAlt,'" style="background-color:',$_SESSION['qtiTstatus'][$oTopic->status]['color'],'"><span class="small">',$_SESSION['qtiTstatus'][$oTopic->status]['statusname'],'</span></td>',N; break;
  case 'replies':     echo '<td class="td_t td_t_sta',$strAlt,'"><span class="small">',$oTopic->replies,'</span></td>',N; break;
  case 'views':       echo '<td class="td_t td_t_sta',$strAlt,'"><span class="small">',$oTopic->views,'</span></td>',N; break;
  case 'id':          echo '<td class="td_t td_t_sta',$strAlt,'"><span class="small">',$oTopic->id,'</span></td>',N; break;
  case 'actorname':   echo '<td class="td_t td_t_sta',$strAlt,'"><span class="small">',( $oTopic->actorid>0 ? '<a href="qti_usr.php?id='.$oTopic->actorid.'" title="'.$L['Userrole_MA'].'" class="small">'.$oTopic->actorname.'</a>' : $L['None']),'</span></td>',N; break;
  case 'notifiedname':echo '<td class="td_t td_t_sta',$strAlt,'"><span class="small">',( $oTopic->notifiedid>0 ? '<a href="qti_usr.php?id='.$oTopic->notifiedid.'" title="'.$L['Userrole_UN'].'" class="small">'.$oTopic->notifiedname.'</a>' : $L['None']),'</span></td>',N; break;
  // default is: "N" field
  }
  echo '</tr>',N;

  // alternate css style
  if ( $strAlt=='1' ) { $strAlt='2'; } else { $strAlt='1'; }

  // map point registering
  if ( isset($bMap) ) {
  if ( $bMap && !empty($oTopic->y) && !empty($oTopic->x) ) {

    $str = AsImg($strTicon,'T',$strTname,'ico ico_t');
    if ( $bAddRef ) $str .= ' '.( $strSectionNumfield=='N' ? '&nbsp;' : 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).' ('.QTdate($oTopic->firstpostdate,$arrQTdate).')<br/>'.LangS('Reply',$oTopic->replies);
    $str .= '<br/><a class="a_gmap" href="qti_topic.php?s='.$oTopic->section.'&amp;t='.$oTopic->id.'">'.$L['map']['View_ticket'].' &raquo;</a></p>';

    $oMapPoint = new cMapPoint( floatval($row['y']),floatval($row['x']),( $strSectionNumfield=='N' ? '' : sprintf($strSectionNumfield,$oTopic->numid).' ' ).substr($oTopic->title,0,25),$str );
    if ( isset($_SESSION[QT]['m_map'][$oTopic->section]['icon']) )        $oMapPoint->icon        = $_SESSION[QT]['m_map'][$oTopic->section]['icon'];
    if ( isset($_SESSION[QT]['m_map'][$oTopic->section]['shadow']) )      $oMapPoint->shadow      = $_SESSION[QT]['m_map'][$oTopic->section]['shadow'];
    if ( isset($_SESSION[QT]['m_map'][$oTopic->section]['printicon']) )   $oMapPoint->printicon   = $_SESSION[QT]['m_map'][$oTopic->section]['printicon'];
    if ( isset($_SESSION[QT]['m_map'][$oTopic->section]['printshadow']) ) $oMapPoint->printshadow = $_SESSION[QT]['m_map'][$oTopic->section]['printshadow'];
    $arrMapPoints[intval($row['id'])] = $oMapPoint;

  }}

  $intWhile++;
  //odbcbreak
  if ( $intWhile>=$_SESSION[QT]['topics_per_page'] ) break;

}

?>
Return current item: QuickTicket