Server IP : 68.65.122.142  /  Your IP : 18.119.213.216
Web Server : LiteSpeed
System : Linux server167.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User : glenirhm ( 1318)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/glenirhm/backup/sis.glenbowcollege.ca/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/glenirhm//backup/sis.glenbowcollege.ca/admin/view_records.php
<?php
// We need to use sessions, so you should always start sessions using the below code.
session_start();
// If the user is not logged in redirect to the login page...
if (!isset($_SESSION['loggedin'])) {
	header('Location: index.html');
	exit;
}


error_reporting(E_ALL);

// speed things up with gzip plus ob_start() is required for csv export
if(!ob_start('ob_gzhandler'))
	ob_start();

header('Content-Type: text/html; charset=utf-8');

include('lazy_mofo.php');

include('../common/header_admin.php');

include('../common/connectPDO.php');

// create LM object, pass in PDO connection, see i18n folder for country + language options 
$lm = new lazy_mofo($dbh, 'en-us');


// table name for updates, inserts and deletes
$lm->table = 'student';

// identity / primary key for table
$lm->identity_name = 'id';

// optional, define output control on the grid 
$lm->grid_output_control['email'] = array('type' => 'email'); // make email clickable
$lm->form_input_control['confirmed'] = array('type' => 'radio', 'sql' => "select 1, 'Yes' union select 0, 'No'");
$lm->grid_output_control['picture_id_name'] = array('type' => 'image');         // make image clickable  

// optional, define editable input controls on the grid
//$lm->grid_input_control['confirmed'] = array('type' => 'checkbox');

// show search box, but _search parameter still needs to be passed to query below 
$lm->grid_show_search_box = true;


// query to define grid view
// IMPORTANT - last column must be the identity/key for [edit] and [delete] links to appear
// include an 'order by' to prevent potential parsing issues
$lm->grid_sql = "
select 
  id
, fname
, lname
, email
, phone
, address_street1
, address_street2
, address_country
, emergency_contact_name
, emergency_contact_phone
, dob
, english_proficiency
, high_school_diploma
, wonderlic
, enrolled_program
, student_id
, student_aid
, self_finance
, orientation_date
, orientation_complete
, signed_agreement
, first_module
, current_module
, enrollment_complete
, picture_id_name
, confirmed
, id 
from student

order by lname desc
";

// bind parameter for grid query
$lm->grid_sql_param[':_search'] = '%' . trim(@$_REQUEST['_search']) . '%';

// optional, define what is displayed on edit form. identity id must be passed in also.  
$lm->form_sql = "
select 
  id
, confirmed
, orientation_complete
, comments
, id 
from student
";

// bind parameter for form query
$lm->form_sql_param[':id'] = @$_REQUEST['id']; 


// optional, validation - regexp, 'email' or a user defined function, all other parameters optional 
//$lm->on_insert_validate['market_name']   = array('regexp' => '/.+/',  'error_msg' => 'Missing Market Name', 'placeholder' => 'this is required', 'optional' => false); 
//$lm->on_insert_validate['contact_email'] = array('regexp' => 'email', 'error_msg' => 'Invalid Email',       'placeholder' => 'this is optional', 'optional' => true);


// copy validation rules, same rules when updating
$lm->on_update_validate = $lm->on_insert_validate;  

// Naci: Trying to get the form data

$lm->on_update_user_function = 'send_email2';

function send_email($lm){/*
	$email = $lm->form_input_control['email'];
	echo $email;
	return '<script>alert(' . $email . ')</script>';*/
}

function send_email2(){/*
	$id = $_POST['id'];
	$sql = "SELECT confirmed FROM student WHERE id=$id";
	$result = $GLOBALS['dbh']->query($sql);
	$confirmed = $result->fetch();


	return '<script>alert(' . $id . ')</script>';*/
}



// run the controller
$lm->run();

echo "</body></html>";