Created
December 13, 2023 21:38
-
-
Save kramer123/d5aaa13f92dda5d9f9c69afe40b90fa5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$ff_id = $_GET['ff_id']; | |
$status = $_GET['status']; | |
if ($ff_id != Null || $status != Null) { | |
require_once($_SERVER["DOCUMENT_ROOT"] . '/wp-content/themes/Divi_Child_Theme/move_to_flyers.php'); | |
} | |
$_posted = Null; | |
require_once($_SERVER["DOCUMENT_ROOT"] . '/wp-content/PDOCrud/script/pdocrud.php'); | |
$pdocrud = new PDOCrud(false, "pure", "pure"); | |
$pdomodel = $pdocrud->getPDOModelObj(); | |
$result = $pdomodel->select("website_request"); | |
foreach($result as $rows) { | |
if ( trim($rows['File']) != '' ) { | |
$ext = strtoupper(pathinfo($rows['File'], PATHINFO_EXTENSION)); | |
$pdomodel->where("ff_id", $rows['ff_id']); | |
$pdomodel->update("website_request", array("extension" => $ext)); | |
} | |
} | |
$pdocrud->colRename("ff_inserted_on", "Requested"); | |
$pdocrud->colRename("request", "Request"); | |
$pdocrud->colRename("description", "Description"); | |
$pdocrud->colRename("e", "File?"); | |
$pdocrud->colRename("extension", "EXT"); | |
$pdocrud->colRename("Posted", "Completed"); | |
$pdocrud->colRename("reply", "Reply"); | |
$pdocrud->colRename("file", "Uploaded File"); | |
$pdocrud->setSettings("recordsPerPageDropdown", true); | |
$pdocrud->setSettings("recordsPerPage", 10); | |
$pdocrud->setSettings("pagination", true); | |
$pdocrud->viewColFormatting("description", "html",array("type" =>"html","str"=>"<div style='white-space: pre-wrap;width: 600px;'>{col-name}</div>")); | |
$pdocrud->viewColFormatting("reply", "html",array("type" =>"html","str"=>"<div style='white-space: pre-wrap;width: 600px;'>{col-name}</div>")); | |
$pdocrud->tableColFormatting("description", "html",array("type" =>"html","str"=>"<div style='white-space: pre-wrap;width: 300px;'>{col-name}</div>")); | |
$pdocrud->tableColFormatting("reply", "html",array("type" =>"html","str"=>"<div style='white-space: pre-wrap;width: 250px;color:green'>{col-name}</div>")); | |
$pdocrud->tableColFormatting("Posted", "html",array("type" =>"html","str"=>"<div style='color:green'>{col-name}</div>")); | |
$pdocrud->tableColFormatting("extension", "html",array("type" =>"html","str"=>"<div style='font-weight:500'>{col-name}</div>")); | |
$pdocrud->tableColFormatting("ff_inserted_on", "date",array("format" =>"Y-m-d")); | |
$pdocrud->viewColFormatting("ff_inserted_on", "date",array("format" =>"Y-m-d")); | |
$pdocrud->crudTableCol(array("ff_inserted_on","request","description","Posted","reply","file","extension")); | |
$pdocrud->tableColFormatting("file", "html",array("type" =>"html","str"=>"<a title='View This File' style='color: #337ab7 !important;' target= '_blank' href='{col-name}' data-attribute='abc-{col-name}'>[View]</a> <a style='color: #337ab7 !important;' title='Convert This File' target= '_blank' href='https://image-conversion.online-convert.com/?external_url={col-name}&width=816&height=1056' data-attribute='abc-{col-name}'>[Convert]</a>")); | |
$pdocrud->setViewColumns(array("request","ff_inserted_on","name","meeting_name","description","file","Posted","reply","extension")); | |
$pdocrud->setSettings("actionbtn", true); | |
$pdocrud->setSettings("viewbtn", true); | |
$pdocrud->dbOrderBy("ff_id desc"); | |
$pdocrud->setSettings("submissionType", "post"); | |
$pdocrud->setSettings("displayErrors", false); | |
$pdocrud->tableHeading("<div class='this_heading' style='font-weight: 400;color: #333333;'>Is Your Website Request Listed Below?</div>"); | |
global $current_user; | |
get_currentuserinfo(); | |
if ( current_user_can('administrator') ) { | |
//$pdocrud->formDisplayInPopup();// call this function to show forms in popup | |
//$pdocrud->setPK("ff_id"); | |
//$action = "/wp-content/convert-jpg/convert-it.php?ff_id={ff_id}";//pk will be replaced by primary key value | |
//$pdocrud->enqueueBtnActions("url1", $action, "url","JPG","CONVERT TO JPG", $attr); | |
$pdocrud->setSettings("delbtn", true); | |
$pdocrud->setSettings("editbtn", true); | |
$pdocrud->setSettings("backButton", true); | |
$pdocrud->buttonHide("cancel"); | |
$pdocrud->setPK("ff_id"); | |
$action = "/website-request/?ff_id={ff_id}";//pk will be replaced by primary key value | |
//$attr = array("onclick"=>'centeredPopup(this.href,"myWindow","800","600","yes");return false'); | |
$attr = array('target'=>'_blank', "title"=>"NEXTGEN GALLERY"); | |
//$attr = array('target'=>'_blank'); | |
//$attr = array("onclick"=>"window.open(this.href); return true;"); | |
$pdocrud->enqueueBtnActions("url1", $action, "url","LIB","NEXTGEN GALLERY", $attr); | |
$pdocrud->fieldTypes("email", "input"); | |
$pdocrud->fieldNotMandatory("Request"); | |
$pdocrud->fieldNotMandatory("reply"); | |
$pdocrud->fieldNotMandatory("Name"); | |
$pdocrud->fieldNotMandatory("Email"); | |
$pdocrud->fieldNotMandatory("meeting_name"); | |
$pdocrud->fieldNotMandatory("Description"); | |
$pdocrud->fieldNotMandatory("File"); | |
$pdocrud->fieldNotMandatory("Posted"); | |
$pdocrud->fieldNotMandatory("ff_id"); | |
$pdocrud->fieldNotMandatory("ff_inserted_on"); | |
$pdocrud->fieldNotMandatory("ff_timestamp"); | |
//$pdocrud->formFieldValue("Posted", "", true); | |
$pdocrud->formFieldValue("Posted", date("Y-m-d"));//set some default value for customer Id | |
$pdocrud->fieldRenameLable("ff_inserted_on", "Requested"); | |
$pdocrud->fieldRenameLable("Posted", "Completed by Webpage"); | |
$pdocrud->fieldRenameLable("reply", "Webpage Reply"); | |
$pdocrud->fieldHideLable("ff_id"); | |
$pdocrud->fieldDataAttr("ff_id", array("style"=>"display:none")); | |
$pdocrud->fieldHideLable("is_file"); | |
$pdocrud->fieldDataAttr("is_file", array("style"=>"display:none")); | |
// $pdocrud->fieldHideLable("ff_inserted_on"); | |
// $pdocrud->fieldDataAttr("ff_inserted_on", array("style"=>"display:none")); | |
$pdocrud->fieldHideLable("ff_timestamp"); | |
$pdocrud->fieldDataAttr("ff_timestamp", array("style"=>"display:none")); | |
$pdocrud->fieldTypes("ff_inserted_on", "date",array("format" =>"Y-m-d"));//change gender to radio button | |
$pdocrud->fieldTypes("reply", "textarea");//change gender to radio button | |
$pdocrud->fieldTypes("Description", "textarea");//change gender to radio button | |
//$general_report = htmlspecialchars_decode(stripslashes($result[0]['general_report'])); | |
$pdocrud->formStaticFields("divider", "html", "<div style='font-weight: 700;font-size: 18px;color: indigo;'>Website Request</div>");//html field | |
$pdocrud->formStaticFields("header", "html", "<div style='font-weight: 700;font-size: 18px;color: indigo;'>Webpage Subcommittee Reply</div>");//html field | |
//$pdocrud->fieldDataAttr("ff_inserted_on", array("disabled"=>"disabled")); | |
$pdocrud->fieldDataAttr("Request", array("disabled"=>"disabled")); | |
$pdocrud->fieldDataAttr("extension", array("disabled"=>"disabled")); | |
$pdocrud->fieldDataAttr("File", array("disabled"=>"disabled")); | |
$pdocrud->fieldDataAttr("ff_inserted_on", array("disabled"=>"disabled")); | |
$pdocrud->fieldDisplayOrder(array("header","ff_inserted_on","Posted","reply","divider","Request","Name","Email","meeting_name","Description","File", )); | |
} | |
echo '<div class="website-list">'; | |
echo $pdocrud->setLangData("back", "Cancel")->dbTable("website_request")->render(); // call render function on database table | |
echo '</div>'; |
Author
kramer123
commented
Dec 13, 2023
get('Version')
);
}
add_action('wp_enqueue_scripts', 'enqueue_scripts', 2000);
function enqueue_scripts() {
if ( is_page(array('flyers','unidos-en-recuperacion')) ) {
wp_enqueue_style( 'floatbox-css', '/wp-content/floatbox/floatbox.css', false, null, false );
wp_enqueue_script('floatbox-js', '/wp-content/floatbox/floatbox.js','',null,false);
}
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
//var_dump($field_data_array);exit;
//error_log( 'Field data: ' . print_r( $entry, true ) );
//error_log( 'Field data: ' . print_r( $form_id, true ) );
//error_log( 'Field data: ' . print_r( $field_data_array, true ) );
//error_log( 'Field data: ' . print_r( $field_data_array[4]['value']['file']['file_url'], true ) );
//$request = $field_data_array[0]['value'];
//$name = $field_data_array[1]['value'];
//$description = $field_data_array[2]['value'];
//$request = $field_data_array[3]['value'];
//$file_path = $field_data_array[4]['value']['file']['file_url'];
//error_log( print_r( $name, true ) );
//error_log( print_r( $email, true ) );
//error_log( print_r( $description, true ) );
//error_log( print_r( $request, true ) );
//error_log( print_r( $file_path, true ) );
function add_action_forminator( $entry, $form_id, $field_data_array ){
if ( $form_id == 10764 ) {
foreach ($field_data_array as $key => $value) {
if ($field_data_array[$key]['name'] == 'radio-1') {
$request = $field_data_array[$key]['value'];
}
if ($field_data_array[$key]['name'] == 'name-1') {
$name = $field_data_array[$key]['value'];
}
if ($field_data_array[$key]['name'] == 'email-1') {
$email = $field_data_array[$key]['value'];
}
if ($field_data_array[$key]['name'] == 'textarea-1') {
$description = $field_data_array[$key]['value'];
}
if ($field_data_array[$key]['name'] == 'text-1') {
$meeting_name = $field_data_array[$key]['value'];
}
if ($field_data_array[$key]['name'] == 'upload-1') {
$file_path = $field_data_array[$key]['value']['file']['file_url'];
}
if ($field_data_array[$key]['name'] == 'upload-2') {
$file_path = $field_data_array[$key]['value']['file']['file_url'];
}
}
require_once($_SERVER["DOCUMENT_ROOT"] . '/wp-content/PDOCrud/script/pdocrud.php');
$pdocrud = new PDOCrud();
$insertData = array("Name" => $name, "email" => $email, "request" => $request, "meeting_name" => $meeting_name, "description" => $description, "File" => $file_path);
$pdocrud->getPDOModelObj()->insert("website_request", $insertData);
}
if ( $form_id == 10769 ) {
foreach ($field_data_array as $key => $value) {
if ($field_data_array[$key]['name'] == 'radio-1') {
$event_type = $field_data_array[$key]['value'];
}
if ($field_data_array[$key]['name'] == 'name-1') {
$name = $field_data_array[$key]['value'];
}
if ($field_data_array[$key]['name'] == 'text-1') {
$position = $field_data_array[$key]['value'];
}
if ($field_data_array[$key]['name'] == 'text-2') {
$home_group = $field_data_array[$key]['value'];
}
if ($field_data_array[$key]['name'] == 'text-3') {
$area = $field_data_array[$key]['value'];
}
if ($field_data_array[$key]['name'] == 'text-4') {
$region = $field_data_array[$key]['value'];
}
if ($field_data_array[$key]['name'] == 'email-1') {
$email = $field_data_array[$key]['value'];
}
if ($field_data_array[$key]['name'] == 'text-5') {
$event_name = $field_data_array[$key]['value'];
}
if ($field_data_array[$key]['name'] == 'date-1') { //start date for new event
$start_date = date("Y-m-d", strtotime($field_data_array[$key]['value']));
}
if ($field_data_array[$key]['name'] == 'date-2') {
$end_date = date("Y-m-d", strtotime($field_data_array[$key]['value']));
}
if ($field_data_array[$key]['name'] == 'time-1') {
if ( $field_data_array[$key]['value']["minutes"] == '0' ) {
$field_data_array[$key]['value']["minutes"] = '00';
} elseif ( strlen(trim($field_data_array[$key]['value']["minutes"]) ) == 1 ) {
$field_data_array[$key]['value']["minutes"] = '0' . $field_data_array[$key]['value']["minutes"];
} elseif ( empty(trim($field_data_array[$key]['value']["minutes"])) ) {
$field_data_array[$key]['value']["minutes"] = '00';
}
$start_time = $field_data_array[$key]['value']["hours"].':'.$field_data_array[$key]['value']["minutes"].''.$field_data_array[$key]['value']["ampm"];
}
if ($field_data_array[$key]['name'] == 'time-2') {
if ( $field_data_array[$key]['value']["minutes"] == '0' ) {
$field_data_array[$key]['value']["minutes"] = '00';
} elseif ( strlen(trim($field_data_array[$key]['value']["minutes"]) ) == 1 ) {
$field_data_array[$key]['value']["minutes"] = '0' . $field_data_array[$key]['value']["minutes"];
} elseif ( empty(trim($field_data_array[$key]['value']["minutes"])) ) {
$field_data_array[$key]['value']["minutes"] = '00';
}
$end_time = $field_data_array[$key]['value']["hours"].':'.$field_data_array[$key]['value']["minutes"].''.$field_data_array[$key]['value']["ampm"];
}
if ($field_data_array[$key]['name'] == 'text-6') {
$street = $field_data_array[$key]['value'];
}
if ($field_data_array[$key]['name'] == 'text-7') {
$city = $field_data_array[$key]['value'];
}
if ($field_data_array[$key]['name'] == 'text-8') {
$state = $field_data_array[$key]['value'];
}
if ($field_data_array[$key]['name'] == 'textarea-1') {
$event_description = $field_data_array[$key]['value'];
}
}
//var_dump($start_time);exit;
$event_type = str_replace("-"," ",$event_type);
$event_type = ucwords($event_type);
require_once($_SERVER["DOCUMENT_ROOT"] . '/wp-content/PDOCrud/script/pdocrud.php');
$pdocrud = new PDOCrud();
$insertData = array("event_type" => $event_type, "name" => $name, "position" => $position, "home_group" => $home_group, "area" => $area, "region" => $region, "email" => $email, "event_name" => $event_name, "start_date" => $start_date, "end_date" => $end_date, "start_time" => $start_time, "end_time" => $end_time, "street" => $street, "city" => $city, "state" => $state, "event_description" => $event_description);
$pdocrud->getPDOModelObj()->insert("calendar_request", $insertData);
}
}
add_action( "forminator_custom_form_submit_before_set_fields", "add_action_forminator", 10, 3 );
?>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment