* @license http://www.contenido.org/license/LIZENZ.txt
* @link http://www.4fb.de
* @link http://www.contenido.org
* @since file available since contenido release 4.8.12
*
* {@internal
* created 2009-04-08
*
* $Id$:
* }}
*
*/
/**
* Class for outputting some content for Ajax use
*
*/
class Ajax {
/**
* Constructor of class
*
* @access public
*/
function __construct() {
}
/**
* Function for handling requested ajax data
*
* @param string $sAction - name of requested ajax action
* @access public
*/
public function handle($sAction) {
$sString = '';
switch ($sAction) {
//case to get an article select box param name value and idcat were neded (name= name of select box value=selected item)
case 'artsel':
$sName = (string) $_REQUEST['name'];
$iValue = (int) $_REQUEST['value'];
$iIdCat = (int) $_REQUEST['idcat'];
$sString = buildArticleSelect($sName, $iIdCat, $iValue);
break;
case 'dirlist':
global $cfg, $client, $lang, $cfgClient;
$sDirName = (string) $_REQUEST['dir'];
$iFileListId = (int) $_REQUEST['id'];
$iIdArtLang = (int) $_REQUEST['idartlang'];
$oArt = new Article(null, null, null, $iIdArtLang);
$sArtReturn = $oArt->getContent('CMS_FILELIST', $iFileListId);
$oFileList = new Cms_FileList($sArtReturn, $iFileListId, 0, '', $cfg, null, '', $client, $lang, $cfgClient, null);
$sString = $oFileList->getDirectoryList($oFileList->buildDirectoryList($cfgClient[$client]['upl']['path'] . $sDirName));
break;
case 'filelist':
global $cfg, $client, $lang, $cfgClient;
$sDirName = (string) $_REQUEST['dir'];
$iFileListId = (int) $_REQUEST['id'];
$iIdArtLang = (int) $_REQUEST['idartlang'];
$oArt = new Article(null, null, null, $iIdArtLang);
$sArtReturn = $oArt->getContent('CMS_FILELIST', $iFileListId);
$oFileList = new Cms_FileList($sArtReturn, $iFileListId, 0, '', $cfg, null, '', $client, $lang, $cfgClient, null);
$sString = $oFileList->getFileSelect($sDirName);
break;
case 'inused_layout':
//list of used templates for a layout
global $cfg;
$oLayout = new Layout();
if ((int) $_REQUEST['id'] > 0 && $oLayout->layoutInUse((int) $_REQUEST['id'], true)) {
$oTpl = new Template();
$aUsedTpl = $oLayout->getUsedTemplates();
if (count($aUsedTpl) > 0) {
$sResponse = '
';
foreach ($aUsedTpl as $i => $aTpl) {
$oTpl->set('d', 'NAME', $aTpl['tpl_name']);
$oTpl->next();
}
$oTpl->set('s', 'HEAD_NAME', i18n('Template name'));
$sString = '