<?php
require_once('../../includes/inc_admin.php');
require_once(EIFR_ROOT . 'libraries/ajax.php');
header('Content-Type:text/html;charset=UTF-8');

if ($template_id == '') exit;
$strsql = '';
if ($type != '')
    $strsql = " and type='$type'";
$layout_arr = array();
$ajax_num = AJAX_ERRORCODE;
$sql = "select * from " . TB_TEMPLATE_LAYOUT . " where status=0 and template_id='$template_id' " . $strsql . " order by ordernum asc ";
$rs = $db -> Execute($sql);
$num = 0;
$ajax_num = 0;
while (!$rs -> EOF) {
    $ajax_num++;
    $layout_arr[$num] = array();
    $layout_arr[$num]['id'] = $rs -> fields['id'];
    $layout_arr[$num]['title'] = EIFRajax::ajaxStringEncode($rs -> fields['title'], SYS_CHARSET);
    $layout_arr[$num]['layout_code'] = EIFRajax::ajaxStringEncode($rs -> fields['layout_code'], SYS_CHARSET);
    $layout_arr[$num]['intro'] = EIFRajax::ajaxStringEncode($rs -> fields['intro'], SYS_CHARSET);
    $layout_arr[$num]['template_id'] = $rs -> fields['template_id'];
    $num++;
    $rs -> MoveNext();
} 
$rs -> Close();
echo EIFRajax::ajaxReturnJavaScript($ajax_num, $layout_arr);

?>