show time elapsed as tooltip, which could be handy, started making the show_reply.tpl

This commit is contained in:
Quitta 2013-07-13 18:04:40 +02:00
parent 3f5eaae687
commit 15237002aa
5 changed files with 61 additions and 57 deletions

View file

@ -29,31 +29,8 @@ class Helpers{
$smarty -> assign( $key, $value ); $smarty -> assign( $key, $value );
} }
global $DEFAULT_LANGUAGE;
//if language get param is given = set cookie $variables = Helpers::handle_language();
//else if no get param is given and a cookie is set, use that language, else use default.
if ( isset( $_GET['language'] ) ) {
//check if the language is supported
if ( file_exists( $AMS_TRANS . '/' . $_GET['language'] . '.ini' ) ){
//if it's supported, set cookie!
setcookie( 'language',$_GET['language'], time() + 60*60*24*30 );
$language = $_GET['language'];
}else{
//the language is not supported, use the default.
$language = $DEFAULT_LANGUAGE;
}
}else{
//if no get param is given, check if a cookie value for language is set
if ( isset( $_COOKIE['language'] ) ) {
$language = $_COOKIE['language'];
}
//else use the default
else{
$language = $DEFAULT_LANGUAGE;
}
}
$variables = parse_ini_file( $AMS_TRANS . '/' . $language . '.ini', true );
foreach ( $variables[$template] as $key => $value ){ foreach ( $variables[$template] as $key => $value ){
$smarty -> assign( $key, $value ); $smarty -> assign( $key, $value );
} }
@ -91,11 +68,42 @@ class Helpers{
static public function check_if_game_client() static public function check_if_game_client()
{ {
// if HTTP_USER_AGENT is not set then its ryzom core // if HTTP_USER_AGENT is not set then its ryzom core
if ( !isset( $_SERVER['HTTP_USER_AGENT'] ) ){ if ( !isset( $_SERVER['HTTP_USER_AGENT'] ) ){
return true; return true;
}else{ }else{
return false; return false;
} }
}
} }
static public function handle_language(){
global $DEFAULT_LANGUAGE;
global $AMS_TRANS;
//if language get param is given = set cookie
//else if no get param is given and a cookie is set, use that language, else use default.
if ( isset( $_GET['language'] ) ) {
//check if the language is supported
if ( file_exists( $AMS_TRANS . '/' . $_GET['language'] . '.ini' ) ){
//if it's supported, set cookie!
setcookie( 'language',$_GET['language'], time() + 60*60*24*30 );
$language = $_GET['language'];
}else{
//the language is not supported, use the default.
$language = $DEFAULT_LANGUAGE;
}
}else{
//if no get param is given, check if a cookie value for language is set
if ( isset( $_COOKIE['language'] ) ) {
$language = $_COOKIE['language'];
}
//else use the default
else{
$language = $DEFAULT_LANGUAGE;
}
}
return parse_ini_file( $AMS_TRANS . '/' . $language . '.ini', true );
}
}

View file

@ -143,32 +143,7 @@ class Ticket_Log{
} }
public function getActionTextArray(){ public function getActionTextArray(){
global $DEFAULT_LANGUAGE; $variables = Helpers::handle_language();
global $AMS_TRANS;
//if language get param is given = set cookie
//else if no get param is given and a cookie is set, use that language, else use default.
if ( isset( $_GET['language'] ) ) {
//check if the language is supported
if ( file_exists( $AMS_TRANS . '/' . $_GET['language'] . '.ini' ) ){
//if it's supported, set cookie!
setcookie( 'language',$_GET['language'], time() + 60*60*24*30 );
$language = $_GET['language'];
}else{
//the language is not supported, use the default.
$language = $DEFAULT_LANGUAGE;
}
}else{
//if no get param is given, check if a cookie value for language is set
if ( isset( $_COOKIE['language'] ) ) {
$language = $_COOKIE['language'];
}
//else use the default
else{
$language = $DEFAULT_LANGUAGE;
}
}
$variables = parse_ini_file( $AMS_TRANS . '/' . $language . '.ini', true );
$result = array(); $result = array();
foreach ( $variables['ticket_log'] as $key => $value ){ foreach ( $variables['ticket_log'] as $key => $value ){
$result[$key] = $value; $result[$key] = $value;

View file

@ -23,7 +23,7 @@ function show_ticket_log(){
if($log['action'] == 2){ if($log['action'] == 2){
$query_backpart = WebUsers::getUsername($log['argument']); $query_backpart = WebUsers::getUsername($log['argument']);
}else if($log['action'] == 4){ }else if($log['action'] == 4){
$query_backpart = "<a href='index.php?page=show_reply&id=" . $log['argument'] . "'>" . $log['argument'] . "</a>"; $query_backpart = "<a href='index.php?page=show_reply&id=" . $log['argument'] . "'>ID#" . $log['argument'] . "</a>";
}else if($log['action'] == 5){ }else if($log['action'] == 5){
$statusArray = Ticket::getStatusArray(); $statusArray = Ticket::getStatusArray();
$query_backpart = $statusArray[$log['argument'] ]; $query_backpart = $statusArray[$log['argument'] ];
@ -32,6 +32,7 @@ function show_ticket_log(){
$query_backpart = $priorityArray[$log['argument'] ]; $query_backpart = $priorityArray[$log['argument'] ];
} }
$result['ticket_logs'][$i]['query'] = $author . " " . $log_action_array[$log['action']] . " " . $query_backpart; $result['ticket_logs'][$i]['query'] = $author . " " . $log_action_array[$log['action']] . " " . $query_backpart;
$result['ticket_logs'][$i]['timestamp_elapsed'] = Gui_Elements::time_elapsed_string($log['timestamp']);
$i++; $i++;
} }
if(WebUsers::isAdmin()){ if(WebUsers::isAdmin()){

View file

@ -0,0 +1,20 @@
{block name=content}
<div class="row-fluid sortable ui-sortable">
<div class="box span12">
<div class="box-header well" data-original-title="">
<h2><i class="icon-user"></i> Reply ID# of Ticket #</h2>
<div class="box-icon">
<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
</div>
</div>
<div class="box-content">
<div class="row-fluid">
<legend>Info</legend>
</div>
</div>
</div><!--/span-->
</div><!--/row-->
{/block}

View file

@ -23,7 +23,7 @@
{foreach from=$ticket_logs item=log} {foreach from=$ticket_logs item=log}
<tr> <tr>
<td>{$log.tLogId}</td> <td>{$log.tLogId}</td>
<td>{$log.timestamp}</td> <td><a href="#" title="{$log.timestamp_elapsed}" data-rel="tooltip" data-placement="right">{$log.timestamp}</td>
<td>{$log.query}</td> <td>{$log.query}</td>
</tr> </tr>
{/foreach} {/foreach}