PHP Classes
Icontem

File: ajax/ajax.back.office.display.list.php


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend! ReTweet ReTweet Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Johan Barbier  >  oLoc  >  ajax/ajax.back.office.display.list.php  
File: ajax/ajax.back.office.display.list.php
Role: Application script
Content type: text/plain
Description: Ajax script
Class: oLoc
Retrieve and edit internationalized texts
 

Contents

Class file image Download
<?php
require_once '../inc/inc.main.php';

try {
    if(!isset(
$_POST['LNG']) || !isset($_POST['MOD']) || !isset($_POST['REF']) || !isset($_POST['WEB'])) {
        
throw new genericExceptions(genericExceptions::_MISSING_PARAMETER_);
    }
    
    function 
returnNull($v) {
        if(
"0" === $v) {
            return 
null;
        }
        return 
$v;
    }
    
    
$_POST array_map('returnNull'$_POST);
    
$oBO = new backoffice($_POST['WEB']);
    if(
is_null($_POST['LNG']) || is_null($_POST['REF'])) {
        
throw new boException(boException::_MISSING_CHOICE_);
    }
    
$aTrans $oBO->getTranslationsList($_POST['MOD'], $_POST['LNG'], $_POST['REF']);
    
$sHtml '';
    
$iCptClass 0;
    foreach(
$aTrans['REF'] as $sRefLng => $aTranslations) {
        foreach(
$aTranslations as $sMod => $aTrRef) {
            foreach(
$aTrRef as $sConst => $sConstTranslation) {
                
$sHtml .= '<tr>';
                
$sClassName = ($iCptClass%=== 0)?'_C0':'_C1';
                
$sHtml .= '<td class="'.$sClassName.'">'.$sConst.'</td>';
                if(!empty(
$sConstTranslation)) {
                    
$sHtml .= '<td class="'.$sClassName.'"><span title="Click to modify" class="transformable">'.$sConstTranslation.'</span><textarea id="'.$sConst.'@'.$sRefLng.'@REF" name="'.$sConst.'@'.$sRefLng.'@REF" style="display: none;" class="magicalInput">'.$sConstTranslation.'</textarea></td>';
                } else {
                    
$sHtml .= '<td class="'.$sClassName.'"><span title="Click to modify" class="transformable">NO TRANSLATION FOUND</span><textarea id="'.$sConst.'@'.$sRefLng.'@REF" name="'.$sConst.'@'.$sRefLng.'@REF" style="display: none;" class="magicalInput">NO TRANSLATION FOUND</textarea></td></td>';
                }
                foreach(
$aTrans['LNG'] as $sLng => $aTr) {
                    if(!empty(
$aTr[$sMod][$sConst])) {
                        
$sHtml .= '<td class="'.$sClassName.'"><span title="Click to modify" class="transformable">'.$aTr[$sMod][$sConst].'</span><textarea id="'.$sConst.'@'.$sLng.'@BASE" name="'.$sConst.'_'.$sLng.'" style="display: none;" class="magicalInput">'.$aTr[$sMod][$sConst].'</textarea></td><td><img src="'.PATH_IMG.'delete16.png" id="delConstantBtn_'.$sConst.'" title="Delete the constant" alt="Delete the constant" class="delConstantBtn" /></td>';
                    } else {
                        
$sHtml .= '<td class="'.$sClassName.'"><span title="Click to modify" class="transformable">NO TRANSLATION FOUND</span><textarea id="'.$sConst.'@'.$sLng.'@BASE" name="'.$sConst.'_'.$sLng.'" style="display: none;" class="magicalInput">NO TRANSLATION FOUND</textarea></td></td><td><img src="'.PATH_IMG.'delete16.png" id="delConstantBtn_'.$sConst.'" title="Delete the constant" alt="Delete the constant" class="delConstantBtn" /></td>';
                    }
                    
                }
                
$sHtml .= '</tr>';
                
$iCptClass ++;
            }
        }
    }
    
$sHtml .= '<tr><td colspan="4"><input title="Add a new constant" type="text" value="" name="addNewConstant" id="addNewConstant" />&nbsp;<img src="'.PATH_IMG.'add16.png" id="addConstantBtn" title="Add a new constant" alt="Add a new constant" class="button" /></td></tr>';
    echo 
$sHtml;
catch(Exception $e) {
    echo 
utf8_encode('ERR_'.$e);
}
?>

 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2009 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products