<?php

$deletedItems = "";
$formSubmitted = $_POST['formSubmitted'];
if ($formSubmitted != null) {
    $deletedItems = $_POST['deletedItems'];
    $gwpmFieldLabels = $_POST['gwpm_dyna_field_label'];
    $gwpmFieldTypes = $_POST['gwpm_dyna_field_type'];
    $gwpmFieldValue = $_POST['gwpm_dyna_field_value'];
    $earlierCount = $_POST['earlierCount'];
    if (isset($gwpmFieldLabels) && $gwpmFieldLabels != null) {
        appendLog(print_r($gwpmFieldLabels, true));
        appendLog(print_r($gwpmFieldTypes, true));
        appendLog(print_r($gwpmFieldValue, true));
        $adminModel = new GwpmAdminModel();
        $adminModel->saveDynamicFields($gwpmFieldLabels, $gwpmFieldTypes, $gwpmFieldValue, $earlierCount);
    }
}
$existingRecords = get_option(GWPM_DYNA_FIELD_COUNT);
if (!isset($existingRecords) || $existingRecords == null || $existingRecords == false) {
    $existingRecords = 0;
}
?>
<br />
<div id="gwpm_resultBox" class="gwpm_message_box" ></div>
<form method="post" >
	<div id="oldDynamicFieldHolder">
		<?php 
$totalFields = $existingRecords;
$displayText = "";
$alternateClass = "";
<?php

global $genieWPMatrimonyController;
$gwpmAdminModel = new GwpmAdminModel();
$resultObj = null;
if ($user_type == 'matrimony') {
    $resultObj = $gwpmAdminModel->getAllMatrimonyUsers();
} else {
    $resultObj = $gwpmAdminModel->getSubscribedUsers();
}
$resultCount = sizeof($resultObj);
?>
<table class='widefat gwpm-search-result'>
<?php 
if ($resultCount > 0) {
    $page_id = $genieWPMatrimonyController->getGWPMPageId();
    $counter = 1;
    ?>
	<thead>
		<tr>
			<th class="gwpm_fifrst_cell column-name" valign="top">S.No.</th>
			<th class="column-name" valign="top">Display Pic</th>
			<th class="column-name" valign="top">User Id</th>
			<th class="column-name" valign="top">Name</th>
			<th class="column-name" valign="top">Email Id</th>
			<th class="column-name" valign="top">Action</th>
		</tr>
	</thead>
	<?php 
    foreach ($resultObj as $userObj) {
        ?>
 function dynafield_delete($controlObj)
 {
     $adminModel = new GwpmAdminModel();
     $adminModel->deleteDynamicField($controlObj["val"]);
 }