Xataface Translation Memory Module 0.1
Translation Memory for Xataface Applications
/Applications/XAMPP/xamppfiles/htdocs/recipedb/modules/tm/tables/xf_tm_record_strings/xf_tm_record_strings.php
Go to the documentation of this file.
00001 <?php
00002 /*
00003  * Xataface Translation Memory Module
00004  * Copyright (C) 2011  Steve Hannah <steve@weblite.ca>
00005  * 
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  * 
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  * 
00016  * You should have received a copy of the GNU Library General Public
00017  * License along with this library; if not, write to the
00018  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
00019  * Boston, MA  02110-1301, USA.
00020  *
00021  */
00022 class tables_xf_tm_record_strings {
00023         const TRANSLATION_STATUS_APPROVED=1;
00024         function __sql__(){
00025         
00026                 $lang = substr(Dataface_Application::getInstance()->_conf['lang'], 0, 2);
00027                 $query = Dataface_Application::getInstance()->getQuery();
00028                 if ( @$query['-tm_language'] ) $lang = substr($query['-tm_language'], 0, 2);
00029         
00030                 return "select
00031                         rs.*,
00032                         s.string_value,
00033                         (
00034                                 select 
00035                                         translation_value
00036                                 from 
00037                                         xf_tm_translations tt
00038                                         inner join xf_tm_translations_log ttl on tt.translation_id=ttl.translation_id
00039                                 where 
00040                                         tt.string_id=rs.string_id
00041                                         and tt.language='".addslashes($lang)."'
00042                                         and ttl.translation_status_id=".self::TRANSLATION_STATUS_APPROVED."
00043                                         and ttl.translation_memory_id=r.translation_memory_id
00044                                 order by 
00045                                         ttl.date_created desc
00046                                 limit 1
00047                         ) as translation_value
00048                         
00049                         from 
00050                                 xf_tm_record_strings rs
00051                                 left join xf_tm_records r on r.record_id=rs.record_id
00052                         ";
00053                                         
00054                                 
00055         }
00056 }
 All Data Structures Files Functions Variables