<?php

if ($_REQUEST['module'] != "") {
    include "../../common/top.php";
    $modulePost = $_REQUEST['module'];
    $module = $fpdo->from('cms_modules')->where('id', $modulePost)->fetch();
    $table = $module['table_name'];
    $langType = $module['lang_type'];
    $fileds = $fpdo->from('cms_module_fields')->where("table_id='" . $modulePost . "' and is_main='1'")->fetch();
    $fileds['title'];
    $field = "";
    if ($langType == 'Field' && $fileds['is_lang_eff'] == '1') {
        $field = $fileds['title'] . "_{$cmsMlang}";
    } else {
        $field = $fileds['title'];
    }
    if ($_REQUEST['type'] == "Draw") {
        echo "<div class='textextjsModule' data-module='{$modulePost}'>";
        $textjs = new textext_js();
        echo "<style>.text-wrap,.text-wrap textarea{width:100%;}</style>";
        echo $textjs->get_header();
        echo "<textarea id='textJs{$modulePost}' style='width:100%'></textarea>";
        $v1 = $textjs->getForma($table, $field, 'id', $_REQUEST["values"], true);
        echo $textjs->get_script('#textJs' . $modulePost, '../ajax/AsTags.php', $table, 'id', $field, $v1);
        echo "</div>";
    } elseif ($_REQUEST['type'] == 'getData') {
        $textjs = new textext_js();
        echo $textjs->getForma($table, 'id', $field, $_REQUEST['val']);
    }
}