<?php

//defined('_VALID') or die(RESTRICTED_ACCESS);
include_once('class.appointment.php');
$appointmentObj = new appointment($configObj);
$action = $_REQUEST['action'];
$configObj->glTplObj->change_path($configObj->currentModulePath . 'html/templates/');
$configObj->glTplObj->set('configObj', $configObj);
$configObj->glTplObj->set('appointmentObj', $appointmentObj);
$configObj->glTplObj->set('contactusTab', true);
$paramMain = $configObj->AllmoduleAccess[$configObj->ModuleName];
$configObj->glTplObj->set('paramMain', $paramMain);

switch ($action) {
    case 'delete':
        if ($configObj->isAjaxSet) {
            $appointmentObj->is_appointmentused(101);
        }
        $appointmentObj->loadCount('CountRowsnews');
        break;

    case 'updatereaddata':

        $sql = "UPDATE " . DB_PREFIX . "appointmentleads SET chr_read='Y' where int_glcode=" . $_REQUEST['id'];
        $appointmentObj->configObj->glDbObj->query($sql);
        echo $_REQUEST['id'];
        exit;
        break;

        case 'export':
      
        $tablename = "appointmentleads";
        $configObj->glLibraryObj->xlsSQL = $appointmentObj->gettabledataData($tablename);
        $configObj->glLibraryObj->fileheader = "<center>Book an Appointment Leads\n</center>";
        $configObj->glLibraryObj->filename = "" . SITE_NAME . "_Book_an_Appointment_Leads_" . date("Y-m-d H:m" ) . ".xls";
        $configObj->glLibraryObj->dataArray = $allrecordsset;
        $configObj->glLibraryObj->generateXLSfile();
        break;

    

    default:
        if ($_REQUEST['msg']) {
            if ($_REQUEST['msg'] == 'send') {
                $messagebox = $configObj->glLibraryObj->message("Congrats! The Email has been sent successfully.");
                $configObj->glTplObj->set('messagebox', $messagebox);
            }
        }
        $appointmentObj->load_appointmentleads();
        break;
}
?>
