Skip to content

Instantly share code, notes, and snippets.

@zjbennett

zjbennett/PDOCRUD.php

Last active Jun 22, 2018
Embed
What would you like to do?
<?php
global $current_user;
get_currentuserinfo();
$userid = get_userdata($current_user->ID);
//adds Bootstrap Styling
$pdocrud = new PDOCrud(false, "pure", "pure");
//renames columns and displays specific columns
$pdocrud->colRename("booking_id", "Booking ID");
$pdocrud->colRename("booking_profname", "Professional Name");
$pdocrud->colRename("booking_language", "Language");
$pdocrud->colRename("booking_date", "Date Required");
$pdocrud->colRename("booking_time", "Time Required");
$pdocrud->colRename("booking_duration", "Duration");
$pdocrud->colRename("booking_interviewname", "Interviewee Name");
$pdocrud->colRename("booking_status", "Status");
$pdocrud->colRename("booking_type", "Type");
$pdocrud->crudTableCol(array("booking_id","booking_profname","booking_language","booking_date","booking_time","booking_duration","booking_interviewname","booking_status","booking_type"));
//display view form in pop out
$pdocrud->formDisplayInPopup();
//change Data format to m-d-Y
$pdocrud->TableColFormatting("booking_date", "date", array("format" => "m-d-Y"));
$pdocrud->tableHeading("Available Bookings Table");
//dynamically show current users languages and Gender Specific
$pdocrud-> where("booking_language", "$userid->lang_1");
$pdocrud-> where("booking_gender", "$userid->int_gender");
$pdocrud->setSettings("csvBtn", true);
$pdocrud->setSettings("delbtn", false);
$pdocrud->setSettings("editbtn", false);
//Accept Session Button
$action = array("Pending" => "Accepted");
$text = array("Pending" => '<i class="fa fa-check-square" aria-hidden="true"></i>',"Accepted"=>'<i class="fa fa-arrow-up" aria-hidden="true"></i>');
$attr = array("title"=> "Accepted Session");
$pdocrud->enqueueBtnActions("btnswitch", $action, "switch",$text,"booking_status", $attr);
echo $pdocrud->dbTable("wp_booking")->render();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.