Commit 9d30da46 by Ashish Pal

custody icici plugin

parent 04fe577e
<?php defined( 'ABSPATH' ) or die( 'Direct access is not permitted' );?>
<h1 class="wp-heading-inline">Add Forms</h1>
<table class="form-table">
<form method='post' action='' name='myform' enctype='multipart/form-data'>
<tr class="form-field term-name-wrap">
<th scope="row"><label for="name">Type of Form</label></th>
<td>
<select name="type_of_form" id="type_of_form" class="postform required">
<option value="">Select Type of Form</option>
<?php
foreach( $result_1 as $value ) { ?>
<option value="<?php echo $value; ?>"><?php echo $value; ?></option>
<?php
}
?>
<option value="Other">Other</option>
</select>
<div id="type_of_form_div">
<input name="type_of_form_other" id="type_of_form_other" type="text" value="" size="40" placeholder="Please enter other value">
<div>
</td>
</tr>
<tr class="form-field term-name-wrap">
<th scope="row"><label for="name">Type of Account</label></th>
<td>
<select name="type_of_account" id="type_of_account" class="postform required">
<option value="">Select Type of Account</option>
<?php
foreach( $result as $value ) { ?>
<option value="<?php echo $value; ?>"><?php echo $value; ?></option>
<?php
}
?>
<option value="Other">Other</option>
</select>
<div id="type_of_account_div">
<input name="type_of_account_other" id="type_of_account_other" type="text" value="" size="40" placeholder="Please enter other value">
<div>
</td>
</tr>
<tr class="form-field term-slug-wrap">
<th scope="row"><label for="name">Slug (URL Name)</label></th>
<td>
<input name="slug" id="tag-slug" type="text" value="" size="20">
</td>
</tr>
<tr class="form-field term-name-wrap">
<th scope="row"><label for="name">Select File Path</label></th>
<td><input type="text" name="image_url" id="image_url" value=""></a>
</td>
</tr>
<th scope="row"><label for="name">Ordering</label></th>
<td>
<input name="ordering" id="ordering" type="number" max="100" min="0" size="10" value="<?php echo $ordering?>">
</td>
</tr>
<tr class="form-field term-name-wrap">
<td>&nbsp;</td>
<td><input type='submit' class='button button-primary' name='but_submit' value='Submit'></td>
</tr>
</form>
</table>
<?php
/*
Plugin Name: Custody Icici Plugin
Plugin URI: marcellus.in/
description: A simple custom plugin to Manage the Custody Icici forms data
Version: 1.0.0
Author: Ashish Pal
*/
define('PLUGIN_URL', plugins_url()."/");
define('PLUGIN_DIR_URL', plugin_dir_path( __FILE__ ));
function custody_icici_plugin_menu() {
add_menu_page("Form Custody Icici", "Form Custody Icici","manage_options", "custodylist", "manageform",plugins_url('/custody-icici-plugin/images/generic.png'));
add_submenu_page("custodylist","Add New", "Add New","manage_options", "custodylist&action=new", "manageform");
add_submenu_page("custodylist","Type of Form", "Edit Type of Form","manage_options", "custodylist&action=ETOF", "manageform");
add_submenu_page("custodylist","Type of Account", "Edit Type of Account","manage_options", "custodylist&action=ETOA", "manageform");
}
add_action('admin_init','enqueue_form_plugin_styles');
add_action('admin_init','enqueue_form_plugin_scripts');
function enqueue_form_plugin_styles() {
wp_enqueue_style('datatable-css',PLUGIN_URL.'custody-icici-plugin/css/datatable.min.css' , array(), '1.0.0');
}
function enqueue_form_plugin_scripts(){
wp_enqueue_script('script-js', PLUGIN_URL.'custody-icici-plugin/js/script.js', array('jquery'));
wp_enqueue_script('datatable-js', PLUGIN_URL.'custody-icici-plugin/js/datatable.min.js', array('jquery'),'', true);
}
add_action("admin_menu", "custody_icici_plugin_menu");
function manageform(){
include "uploadfile.php";
}
\ No newline at end of file
jQuery(document).ready(function(){
jQuery('#form_list').DataTable({
paging: false
});
});
\ No newline at end of file
<?php
defined( 'ABSPATH' ) or die( 'Direct access is not permitted' );
global $wpdb;
$table_name = $wpdb->prefix."custody_icici_forms";
?>
<div class="wrap">
<a href='admin.php?page=custodylist&action=new' class="page-title-action">Add New Forms</a>
<h2>Forms list</h2>
<form class="search-form wp-clearfix" method="get">
<input type="hidden" name="page" value="list">
<input type="hidden" name="action" value="search">
<p class="search-box">
<label class="screen-reader-text" for="tag-search-input">Search</label>
<input type="search" id="tag-search-input" name="s" value="">
<select name="search_type" id="search_type">
<option value="">Select Search Type </option>
<option value="STOF">Type of Form</option>
<option value="TOA">Type of Account</option>
<option value="URL">User URL</option>
</select>
<input type="submit" id="search-submit" class="button" value="Search">
</p>
</form>
<table class="wp-list-table widefat fixed striped posts" id="form_list">
<thead>
<tr>
<th width="5%">Id</th>
<th width="20%">Type of form</th>
<th width="20%">Type of Account</th>
<th width="20%">User URl</th>
<th width="20%">Url</th>
<th width="5%">Status</th>
<th width="5%">Ordering</th>
<th width="8%">Actions</th>
</tr>
</thead>
<tbody>
<?php
$limit = 25;
$page_num = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 1;
$offset = ( $page_num - 1 ) * $limit;
$query ="SELECT * FROM $table_name where 1 ";
$query_count ="SELECT count(id) FROM $table_name where 1 ";
if(isset($_GET['action']) && $_GET['action']=="search"){
$search = array("STOF"=>"type_of_form","TOA"=>"type_of_account","URL" =>"Slug");
if(!empty($_GET["search_type"])){
$search_query =' and '.$search[$_GET['search_type']]." like '%".$_GET["s"]."%'";
$query = $query.$search_query;
}else{
if(!empty($_GET["s"])){
$search_query = "and like '%".$_GET["s"]."%' ";
$query = $query.$search_query;
}
}
}
$query_count = $query_count.$search_query;
$total = $wpdb->get_var($query_count);
$query = $query."order by id";
$num_of_pages = ceil( $total / $limit );
$query = $query." LIMIT ".$offset.','.$limit;
$result = $wpdb->get_results($query);
if($total>=1){
foreach ($result as $print) {
$status = 'De-Active';
$status_val = 1;
$class= 'View';
if($print->status==1){
$status = 'Active';
$status_val = 0;
$class = 'Delete';
}
?>
<tr>
<td><?php echo $print->id?></td>
<td><?php echo $print->type_of_form?></td>
<td><?php echo $print->type_of_account?></td>
<td><a href="<?php echo $print->slug?>">User Url</a></td>
<td><a href="<?php echo $print->download_file_name?>">Check File</a></td>
<td><?php echo $status?></td>
<td><?php echo $print->ordering?></td>
<td>
<span class="edit"><a href="admin.php?page=custodylist&action=update&upt=<?php echo $print->id?>" aria-label="Edit">Edit</a>|</span> |<span class="view"><a href="admin.php?page=custodylist&action=view&upt=<?php echo $print->id?>" aria-label="view">View</a>|</span> | </span><span class="<?php echo $class?>"><a href="admin.php?page=custodylist&action=status&status=<?php echo $status_val?>&upt=<?php echo $print->id?>" class="delete-tag aria-button-if-js" aria-label="Delete “blog”" role="button"><?php echo $status?></a></td>
</tr>
<?php }
$page_links = paginate_links( array(
'base' => add_query_arg( 'pagenum', '%#%' ),
'format' => '',
'prev_text' => __( '«', 'text-domain' ),
'next_text' => __( '»', 'text-domain' ),
'total' => $num_of_pages,
'current' => $pagenum
));
if ($page_links && $num_of_pages > 1) {
echo '<div class="tablenav"><div class="tablenav-pages" style="margin: 1em 0;">' . $page_links . '</div></div>';
}
}else{?>
<tr>
<td colspan="8">No Record found</td>
</tr>
<?php }
?>
</tbody>
</table>
</div>
\ No newline at end of file
<?php defined( 'ABSPATH' ) or die( 'Direct access is not permitted' );?>
<h1 class="wp-heading-inline">Edit Type of Account</h1>
<h3>Note: Please do the actvity very carefully in this form, it will update update whole records beloging to selected Type of Account.</h3>
<table class="form-table">
<form method='post' action='' name='myform' enctype='multipart/form-data'>
<input type="hidden" name="action" id="action" value="update_toa">
<tr class="form-field term-name-wrap">
<th scope="row"><label for="name">Select Type of Account</label></th>
<td>
<select name="type_of_account" id="type_of_account" required>
<option value="">Select Type of Account</option>
<?php foreach($result_1 as $value ) { ?>
<option value="<?php echo $value; ?>"><?php echo $value; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr class="form-field term-name-wrap">
<th scope="row"><label for="name">Enter the Type of Account Value</label></th>
<td>
<input name="type_of_account_other" type="text" value="" size="40" placeholder="Please enter other value">
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type='submit' class='button button-primary' name='but_submit' value='Update'></td>
</tr>
</form>
</table>
\ No newline at end of file
<?php defined( 'ABSPATH' ) or die( 'Direct access is not permitted' );?>
<h1 class="wp-heading-inline">Edit Type of Form</h1>
<h3>Note: Please do the actvity very carefully in this form, it will update selected the whole records beloging to Type of form.</h3>
<table class="form-table">
<form method='post' action='' name='myform' enctype='multipart/form-data'>
<input type="hidden" name="action" id="action" value="update_tof">
<tr class="form-field term-name-wrap">
<th scope="row"><label for="name">Type of Form</label></th>
<td>
<select name="type_of_form" id="type_of_form" required>
<option value="">Select Type of Form</option>
<?php foreach($result_1 as $value ) { ?>
<option value="<?php echo $value; ?>"><?php echo $value; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr class="form-field term-name-wrap">
<th scope="row"><label for="name">Enter the Type of Form Value</label></th>
<td>
<input name="type_of_form_other" id="type_of_form_other" type="text" value="" size="40" placeholder="Please enter other value">
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type='submit' class='button button-primary' name='but_submit' value='Update'></td>
</tr>
</form>
</table>
\ No newline at end of file
<?php defined( 'ABSPATH' ) or die( 'Direct access is not permitted' );?>
<h1 class="wp-heading-inline">View Forms Details</h1>
<div class="wrap">
<a href='admin.php?page=custodylist' class="page-title-action">Form List</a>
<table class="form-table">
<tr class="form-field term-name-wrap">
<th scope="row"><label for="name">Type of Form</label></th>
<td><?php echo $type_of_form; ?></td>
</tr>
<tr class="form-field term-name-wrap">
<th scope="row"><label for="name">Select Type of Account</label></th>
<td><?php echo $type_of_account; ?></td>
</tr>
<tr class="form-field term-slug-wrap">
<th scope="row"><label for="name">Slug (URL Name)</label></th>
<td><?php echo $slug; ?></td>
</tr>
<tr class="form-field term-name-wrap">
<th scope="row"><label for="name">Select File Path</label></th>
<td><a href="<?php echo $download_file_name; ?>">Download File</a></td>
</tr>
<tr>
<th scope="row"><label for="name">Ordering</label></th>
<td><?php echo $ordering?></td>
</tr>
</table>
</div>
\ No newline at end of file
......@@ -3,7 +3,7 @@
* Template Name: Forms Custody Icici
*/
get_header();
$new_result = $wpdb->get_results("SELECT * FROM mr_download_form WHERE status =1 order by ordering");
$new_result = $wpdb->get_results("SELECT * FROM mr_custody_icici_forms WHERE status =1 order by ordering");
?>
<div id="full-content" class="about-page">
<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment