Skip to content

Commit

Permalink
iswa names update
Browse files Browse the repository at this point in the history
  • Loading branch information
Slevinski committed May 17, 2012
1 parent 17bd52d commit 627bcd0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions SWISTest.php
Expand Up @@ -995,5 +995,10 @@ public function test_id2key(){
public function test_key2id(){ public function test_key2id(){
$this->assertEquals('01-01-001-01-01-01',key2id('S10000',1)); $this->assertEquals('01-01-001-01-01-01',key2id('S10000',1));
} }

//! @ingroup spl
public function test_iswaName(){
$this->assertEquals('Hands',iswaName("01","en"));
}
} }
?> ?>
7 changes: 7 additions & 0 deletions database.php
Expand Up @@ -112,6 +112,13 @@ function key2id($key,$force){
return sprintf("%02d-%02d-%03d-%02d-%02d-%02d",$row[0],$row[1],$row[2],$row[3],$ifill, $irot); return sprintf("%02d-%02d-%03d-%02d-%02d-%02d",$row[0],$row[1],$row[2],$row[3],$ifill, $irot);
} }


function iswaName($id,$lang="en"){
global $iswa_db;
$query = 'select name from iswa_name where key = "' . $id . '" and lang = "' . $lang . '"';
$row = $iswa_db->query($query)->fetch();
return $row[0];
}

function image_png($key,$ver){ function image_png($key,$ver){
global $iswa_db; global $iswa_db;
$code = key2code($key); $code = key2code($key);
Expand Down
12 changes: 12 additions & 0 deletions filesystem.php
Expand Up @@ -136,6 +136,18 @@ function key2id($key,$force){
return $sym . '-0' . $ifill . '-' . $srot; return $sym . '-0' . $ifill . '-' . $srot;
} }


$messages = array();
function load_iswaNames(){
global $messages;
include('iswa/data/iswa.i18n.php');
}

function iswaName($id, $lang='en'){
global $messages;
if (count($messages)==0) load_iswaNames();
return $messages[$lang]['iswa_' . $id];
}

function image_png($key,$ver){ function image_png($key,$ver){
$base = substr($key,0,3); $base = substr($key,0,3);
$file = 'iswa/png' . $ver . '/' . $base . '/' . $key . '.png'; $file = 'iswa/png' . $ver . '/' . $base . '/' . $key . '.png';
Expand Down

0 comments on commit 627bcd0

Please sign in to comment.