$ci->db->insert('outbound_queue', array('tenant' => $tenant_id, 'number' => $subscriber->value, 'type' => $type, 'time' => $time, 'callerId' => $callerId, 'data' => json_encode(array('message' => $_POST['message']))));
        }
    } elseif ('call' == $type) {
        $flow = OpenVBX::getFlows(array('id' => $_POST['flow'], 'tenant_id' => $tenant_id));
        if ($flow && count($subscribers) && $flow[0]->values['data']) {
            foreach ($subscribers as $subscriber) {
                $ci->db->insert('outbound_queue', array('tenant' => $tenant_id, 'number' => $subscriber->value, 'type' => $type, 'time' => $time, 'callerId' => $callerId, 'data' => json_encode(array('id' => $flow[0]->values['id'], 'name' => $flow[0]->values['name']))));
            }
        }
    }
}
$lists = $ci->db->query(sprintf('SELECT id, name FROM subscribers_lists WHERE tenant = %d', $tenant_id))->result();
$flows = OpenVBX::getFlows(array('tenant_id' => $tenant_id));
OpenVBX::addJS('jquery-ui-1.7.3.custom.min.js');
OpenVBX::addJS('schedule.js');
OpenVBX::addCSS('jquery-ui-1.7.3.custom.css');
?>
<style>
	.vbx-schedule form {
		display: none;
		padding: 20px 5%;
		background: #eee;
		border-bottom: 1px solid #ccc;
	}
	.vbx-schedule h3 {
		font-size: 16px;
		font-weight: bold;
		margin-top: 0;
	}
</style>
<div class="vbx-content-main">
                echo file_get_contents('plugin.json', true);
                exit;
            }
        }
    }
}
?>

<link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css'>

<?php 
// Chat UI Design by Julia Smith
// http://www.bypeople.com/web-chat-widget/
// http://codepen.io/drehimself/pen/KdXwxR?utm_source=bypeople
OpenVBX::addCSS('css/style.css');
OpenVBX::addCSS('css/jquery.light.css');
?>


<div class="vbx-content-main">
	<div class="vbx-content-menu vbx-content-menu-top">
		<h2 class="vbx-content-heading">SMS Conversation List</h2>
		<div id="sound-notification" style="float: right; color: white; font-size: 25px;"><a href="javascript:void(0);" style="color: white;"><i class="fa"></i></a>&nbsp;</div>
	</div><!-- .vbx-content-menu -->
	<div class="vbx-content-container">
		<div class="vbx-content-section">
			<div class="smsList" style="float:left; width:45%;">
				<table class="vbx-items-grid" border="0" id="smsList">
					<thead>
						<tr class="items-head recording-head"><th>Date</th><th>From</th><th>To</th><th>Messages</th></tr>
					</thead>