<?php

/** 
 * Copyright: dtbaker 2012
 * Licence: Please check CodeCanyon.net for licence details. 
 * More licence clarification available here:  http://codecanyon.net/wiki/support/legal-terms/licensing-terms/ 
 * Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4
 * Envato: 4ffca17e-861e-4921-86c3-8931978c40ca
 * Package Date: 2015-11-25 02:55:20 
 * IP Address: 67.79.165.254
 */
if (!module_data::can_i('edit', _MODULE_DATA_NAME)) {
    die("access denied");
}
$data_types = $module->get_data_types();
$menu_locations = module_data::get_menu_locations();
$header_buttons = array();
if (module_data::can_i('create', _MODULE_DATA_NAME)) {
    $header_buttons[] = array('url' => module_data::link_open_data_type('new'), 'title' => "Create New " . _MODULE_DATA_NAME);
}
print_heading(array('main' => true, 'type' => 'h2', 'title' => _MODULE_DATA_NAME, 'button' => $header_buttons));
?>


<table class="tableclass tableclass_rows tableclass_full">
	<thead>
	<tr class="title">
    	<th><?php 
echo _l('Data Type');
?>
</th>
<input type="hidden" name="_redirect" value="<?php 
echo $module->link("", array("saved" => true, "data_type_id" => (int) $data_type_id ? $data_type_id : ''));
?>
" />
<input type="hidden" name="data_type_id" value="<?php 
echo $data_type_id;
?>
" />

    <?php 
$templates = array();
foreach (module_template::get_templates() as $template) {
    $templates[$template['template_key']] = $template['template_key'] . ' (' . $template['description'] . ')';
}
$header_buttons = array();
$fieldset_data = array('heading' => array('main' => true, 'type' => 'h2', 'title' => 'Data Settings', 'button' => $header_buttons), 'class' => 'tableclass tableclass_form tableclass_full', 'elements' => array('name' => array('title' => _l('Name'), 'field' => array('type' => 'text', 'name' => 'data_type_name', 'value' => isset($data_type['data_type_name']) ? htmlspecialchars($data_type['data_type_name']) : '')), 'hook' => array('title' => _l('Display Location'), 'field' => array('type' => 'select', 'name' => 'data_type_menu', 'options' => module_data::get_menu_locations(), 'blank' => false, 'value' => isset($data_type['data_type_menu']) ? htmlspecialchars($data_type['data_type_menu']) : '', 'help' => 'This is where your custom data type will display within the system. Main will put it in the main menu. Customer will put it underneath a customer menu. None will hide this from the menu system all together')), 'icon' => array('title' => _l('Icon'), 'field' => array('type' => 'text', 'name' => 'data_type_icon', 'value' => isset($data_type['data_type_icon']) ? htmlspecialchars($data_type['data_type_icon']) : '', 'help' => 'Type the icon name from http://fontawesome.io/icons/ (eg: bell). Compatible with the Metis theme.')), 'max_entries' => array('title' => _l('Single or Multiple'), 'field' => array('type' => 'select', 'name' => 'max_entries', 'value' => isset($data_type['max_entries']) ? (int) $data_type['max_entries'] : 0, 'blank' => false, 'options' => array(0 => _l('Multiple Entries (default)'), 1 => _l('Single Entry Only')), 'help' => 'Here you can allow a single form entry or multiple entries. A single form entry can be used to record some information against a customer, the single entry will be displayed straight away instead of the list of multiple entries.')), 'print_pdf_template' => array('title' => _l('Allow PDF'), 'field' => array('type' => 'select', 'name' => 'print_pdf_template', 'value' => isset($data_type['print_pdf_template']) ? $data_type['print_pdf_template'] : '', 'options' => $templates, 'blank' => _l(' - disable Print to PDF - '), 'help' => 'These are all the available templates in the system. Create your own ( Settings > Templates ) and select it here. A Print PDF button will be available for each data record.')), 'email_template' => array('title' => _l('Allow Email'), 'field' => array('type' => 'select', 'name' => 'email_template', 'value' => isset($data_type['email_template']) ? $data_type['email_template'] : '', 'options' => $templates, 'blank' => _l(' - disable Email - '), 'help' => 'These are all the available templates in the system. Create your own ( Settings > Templates ) and select it here. An email button will be available for each data record.'))));
echo module_form::generate_fieldset($fieldset_data);
unset($fieldset_data);
$form_actions = array('class' => 'action_bar action_bar_center action_bar_single', 'elements' => array(array('type' => 'save_button', 'name' => 'butt_save', 'value' => _l('Save Settings')), array('type' => 'delete_button', 'name' => 'butt_del', 'value' => _l('Delete'), 'onclick' => "return confirm('Really delete?');"), array('type' => 'button', 'name' => 'cancel', 'value' => _l('Cancel'), 'class' => 'submit_button', 'onclick' => "window.location.href='" . $module->link() . "';")));
echo module_form::generate_form_actions($form_actions);
?>


<p>&nbsp;</p>
<?php 
if ($data_type_id && $data_type_id != 'new') {
    $data_field_groups = $module->get_data_field_groups($data_type_id);
    ob_start();
    ?>
	
	<table width="100%" border="0" cellspacing="0" cellpadding="2" class="tableclass tableclass_rows">