<?php
header('Content-Type: text/html; charset=utf-8');
defined('BASEPATH') or exit('No direct script access allowed');

class MergingDoc extends AdminController
{
    public function __construct()
    {
        parent::__construct();
        $this->load->model('leads_model');
        $this->load->helper('email_config_helper');
        $this->load->helper('staff_helper');
        $this->load->helper('leads_helper');
        $this->load->library('form_validation');
        $this->load->library('Slack');
        $this->load->library('sms/Sms_twilio');
        $this->load->model('Token_model');
        $this->load->model('Outbox_model');
        $this->load->model('MergingDoc_model');
    }
   public function CreateDoc($lead_id)
    {
        $htmlContent = $this->input->post('EditorContent');

        $filename = 'Lead_' . $lead_id . '_Content_' . date('Ymd_His') . '.doc';

        $html = '
        <!DOCTYPE html>
        <html>
        <head>
            <meta charset="utf-8">
            <title>Document</title>
        </head>
        <body>
            ' . $htmlContent . '
        </body>
        </html>';

        header("Content-type: application/vnd.ms-word");
        header("Content-Disposition: attachment; filename=\"$filename\"");
        echo $html;
        exit;
    }



}