Beispiel #1
0
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once '../../admin-includes/admin.base.inc.php';
require_once '../../admin-includes/admin.security_ajax.inc.php';
$content = new content();
// TO DO - security later - e.g. is this user allowed
$userID = $_SESSION['userID'];
if (isset($_POST['action'])) {
    ////////////////////////////////////////////////////
    // getTemplate Get template from the content BY ID
    ////////////////////////////////////////////////////
    if ($_POST['action'] == 'getTemplate') {
        if (isset($_POST['nodeID']) && is_int((int) $_POST['nodeID']) && isset($_POST['languageID']) && is_int((int) $_POST['languageID'])) {
            $foundRecord = $content->getTemplate((int) $_POST['nodeID'], (int) $_POST['languageID']);
            if ($foundRecord !== true) {
                echo json_encode(array('result' => false, 'msg' => 'No template available in the database'));
                exit;
            } else {
                echo json_encode(array('result' => $foundRecord, 'msg' => 'Template found!', 'results' => $content->template, 'sectionInstances' => $content->sectionInstances, 'tabs' => $content->tabs, 'sections' => $content->sections));
                exit;
            }
        } else {
            echo json_encode(array('result' => false, 'msg' => 'AJAX Validation failed'));
            exit;
        }
    }
    ////////////////////////////////////////////////////
    // loadContent Content BY ID
    ////////////////////////////////////////////////////