<?php require_once "config.php"; require_once ROOT_PATH . "system/dbutil/dbconnection.class.php"; require_once ROOT_PATH . "system/model/students.class.php"; require_once ROOT_PATH . "system/repository/studentrepository.class.php"; $studentrepository = new StudentRepository(); if (isset($_GET['id']) && isset($_GET['action']) && ($_GET['action'] = "delete")) { $studentrepository->delete($_GET['id']); header('Location: index.php'); } ?> <?php include_once "header.php"; ?> <?php if (isset($_GET['success']) && $_GET['success'] == true) { ?> <div class="alert alert-success" role="alert">Succesfully Inserted!</div> <?php } ?> <div class="page-header"> <h1> Students Table </h1> </div>
<th>Blood Group</th> <th>Email</th> <th>Contact</th> <th>Program</th> <th>Action</th> </tr> <?php // an object of class 'StudentRepository' is made here // there, it creates objects of 'db' class and 'Student' class // all database function is in 'db' class and is accessed using the object // setter functions of class 'Student' are accessed from the object of 'Student' // they are used to set the values obtained from database to the private variable in 'Student' // then multiple objects of 'Student' is stored in array in 'StudentRepository' // that array is returned here using the object of 'StudentRepository' $student_info = new StudentRepository(); foreach ($student_info->get_all() as $std) { ?> <tr> <td><?php echo $std->get_id(); ?> </td> <td><?php echo $std->get_first_name() . " " . $std->get_last_name(); ?> </td> <td><?php echo $std->get_dob(); ?> </td>
include_once '../config.php'; include_once ROOT_PATH . 'system/models/student.class.php'; include_once ROOT_PATH . 'system/repository/student_repository.class.php'; include_once 'header.php'; if (!isset($_POST['submit'])) { header('location:student.php?error=nopage'); } $student = new Student(); $student->set_first_name($_POST['first_name']); $student->set_last_name($_POST['last_name']); $student->set_dob($_POST['dob']); $student->set_blood_group($_POST['blood_group']); $student->set_email($_POST['email']); $student->set_contact($_POST['contact']); $student->set_program_id($_POST['program_id']); $student_repository = new StudentRepository(); $result_add = 0; $result_edit = 0; if (!isset($_POST['id']) || $_POST['id'] == '') { $result_add = $student_repository->insert($student); } else { $student->set_id($_POST['id']); $result_edit = $student_repository->update($student); } if ($result_add > 0) { header('location:student.php?success=true'); } elseif ($result_edit > 0) { header('location:student.php?update=true'); } elseif ($result_edit == 0) { header('location:student.php?update=false'); } else {
<?php include_once '../config.php'; include_once ROOT_PATH . 'system/models/student.class.php'; include_once ROOT_PATH . 'system/repository/student_repository.class.php'; include_once 'header.php'; $student_info = new StudentRepository(); if (isset($_GET['id']) && isset($_GET['action']) && $_GET['action'] == "delete") { $student_info->delete($_GET['id']); header('location:student.php'); } if (isset($_GET['success']) && $_GET['success'] == "true") { ?> <div class="alert alert-success alert-dismissible fade in" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> <strong>Success!</strong> New record added. </div> <?php } if (isset($_GET['error']) && $_GET['error'] == "true") { ?> <div class="alert alert-danger alert-dismissible fade in" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> <strong>Oh Snap!</strong> Failure in adding record. </div> <?php } if (isset($_GET['error']) && $_GET['error'] == "nopage") { ?> <div class="alert alert-danger alert-dismissible fade in" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<?php include_once '../config.php'; include_once ROOT_PATH . 'system/models/student.class.php'; include_once ROOT_PATH . 'system/repository/student_repository.class.php'; include_once 'header.php'; $student_repository = new StudentRepository(); $e = $student_repository->get_by_id($_GET['id']); if (is_null($e)) { header('location:student.php'); } ?> <h1>Edit Student</h1> <form class="form-horizontal" action="save.php" method="post"> <div class="form-group row"> <div class="col-sm-6"> <input type="text" class="form-control" id="first_name" name="first_name" placeholder="First Name" value="<?php echo $e->get_first_name(); ?> " required> </div> <div class="col-sm-6"> <input type="text" class="form-control" id="last_name" name="last_name" placeholder="Last Name" value="<?php echo $e->get_last_name(); ?> " required> </div> </div> <div class="form-group"> <div class="col-sm-12"> <input type="text" class="form-control" id="dob" name="dob" placeholder="DOB - yyyy-mm-dd" value="<?php
<h1>Students table</small></h1> </div> <table class="table table-bordered table-striped table-hover"> <tr> <th>ID</th> <th>NAME</th> <th>EMAIL</th> <th>CONTACT NO</th> <th>COURSE</th> <th>ACTION</th> </tr> <?php $student = new StudentRepository(); foreach ($student->get_all() as $std) { ?> <tr> <td><?php echo $std->get_id(); ?> </td> <td><?php echo $std->get_first_name(); ?> <?php echo $std->get_last_name(); ?>
<?php require_once "config.php"; require_once ROOT_PATH . "system/dbutil/dbconnection.class.php"; require_once ROOT_PATH . "system/model/students.class.php"; require_once ROOT_PATH . "system/repository/studentrepository.class.php"; ?> <?php include_once "header.php"; ?> <?php $id = $_GET['id']; $studentrepository = new StudentRepository(); $student = $studentrepository->get_by_id($id); ?> <div class="page-header"> <h1>Edit Student Details </h1> </div> <form action="save.php" method="post"> <div class="form-group"> <label for="first_name">First Name</label> <input type="text" class="form-control" id="first_name" name="first_name" placeholder="First Name" value="<?php echo $student->get_first_name(); ?> "> </div> <div class="form-group"> <label for="last_name">Last Name</label> <input type="text" class="form-control" id="first_name" name="last_name" placeholder="First Name" value="<?php
<?php require_once 'models/student.class.php'; require_once 'repository/studentrepository.class.php'; $repository = new StudentRepository(); $student = new Student(); $student->initialize(1, "sujan", "malakar", "*****@*****.**"); $repository->add($student); $student1 = new Student(); $student1->initialize(2, "Pratish", "Shrestha", "*****@*****.**"); $repository->add($student1); $student2 = new Student(); $student2->initialize(3, "Pratasdfadish", "asdf", "*****@*****.**"); $repository->add($student2); $std = $repository->get_by_id($_GET['id']); if (is_null($std)) { header("location:student.php"); exit; } include_once "header.php"; ?> <form action="savestudent.php" method="post"> <div class="form-group"> <label for="first_name">First Name</label> <input type="text" class="form-control" id="first_name" name="first_name" placeholder="First Name" required="required" value="<?php echo $std->get_first_name(); ?> "/>
<?php require_once "models/student.class.php"; require_once "repository/studentrepository.class.php"; $student1 = new Student(); $student1->initiate(1, "Pratish", "Shrestha", "*****@*****.**"); $student2 = new Student(); $student2->initiate(2, "Sujan", "Malakar", "*****@*****.**"); $student3 = new Student(); $student3->initiate(3, "Sujan", "Shrestha", "*****@*****.**"); $student4 = new Student(); $student4->initiate(4, "Ram", "Shah", "*****@*****.**"); $studentrepository = new StudentRepository(); $studentrepository->add($student1); $studentrepository->add($student2); $studentrepository->add($student3); $studentrepository->add($student4); $std = $studentrepository->get_by_id($_GET['id']); if (is_null($std)) { header("Location:student.php"); } ?> <?php include "header.php"; ?> <div class="page-header"> <h1>EDIT<small> Students list</small></h1> </div>
<?php require_once 'models/student.class.php'; require_once 'repository/studentrepository.class.php'; $repository = new StudentRepository(); $student1 = new Student(); $student1->initialize(1, "Sujan", "Shrestha", "2050/03/28", "b+ve", "*****@*****.**", "Teku", 9849209514.0, "BCT"); $repository->add($student1); $student2 = new Student(); $student2->initialize(2, "Pratish", "Bahadur Shrestha", "2050/09/22", "a+ve", "*****@*****.**", "Teku", 9849170867.0, "BCT"); $repository->add($student2); $student3 = new Student(); $student3->initialize(3, "Sujan", "Bir Malakar", "2051/09/14", "b+ve", "*****@*****.**", "Nayabazar", 9843224697.0, "BCT"); $repository->add($student3); include_once 'includes/formvalidation.php'; ?> <?php include_once 'includes/header.php'; ?> <tr> <th colspan="10" class="text-center">Student Info<button class="btn btn-xs btn-primary pull-right" data-toggle="modal" data-target="#add_student"><span class="glyphicon glyphicon-plus"></span></button></th> </tr> <tr> <th><input type="checkbox" id="select_all"/></th> <th>Id</th> <th>Full Name</th> <th>DOB</th> <th>Blood Group</th>
<?php require_once 'models/student.class.php'; require_once "repository/studentrepository.class.php"; $student1 = new Student(); $student2 = new Student(); $student1->initiate(1, "Ram", "Shah", "*****@*****.**"); $student2->initiate(2, "Shyam", "Ram", "*****@*****.**"); $repository = new StudentRepository(); $repository->add($student1); $repository->add($student2); ?> <html> <head> <title> student </title> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="assets/css/bootstrap.min.css"> <!-- Optional theme --> <link rel="stylesheet" href="assets/css/bootstrap-theme.min.css"> <script src="assets/js/jquery.min.js"></script> <!-- Latest compiled and minified JavaScript --> <script src="assets/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <table class="table table-hover table-striped"> <tr>
<?php require_once "models/student.class.php"; require_once "repository/studentrepository.class.php"; $student1 = new Student(); $student2 = new Student(); $student3 = new Student(); $student4 = new Student(); $studentrepository = new StudentRepository(); $student1->initiate(1, "Pratish", "Shrestha", "*****@*****.**"); $student2->initiate(2, "Sujan", "Shrestha", "*****@*****.**"); $student3->initiate(3, "Sujan", "Malakar", "*****@*****.**"); $student4->initiate(4, "Ram", "Shah", "*****@*****.**"); $studentrepository->add_student($student1); $studentrepository->add_student($student2); $studentrepository->add_student($student3); $studentrepository->add_student($student4); ?> <?php include_once "header.php"; ?> <table class="table table-bordered table-striped table-hover"> <tr> <th><input type="checkbox" id="checkall" name="checkall"></th> <th>ID</th> <th>NAME</th> <th>E-MAIL</th>
<?php include_once "config.php"; include_once ROOT_PATH . "students/header.php"; require_once ROOT_PATH . "system/models/students.class.php"; require_once ROOT_PATH . "system/dbutil/dbconnection.class.php"; require_once ROOT_PATH . "system/repository/studentrepository.class.php"; $students = new Students(); $students->set_first_name($_POST['first_name']); $students->set_last_name($_POST['last_name']); $students->set_email($_POST['email']); $students->set_contact_no($_POST['first_name']); $students->set_course($_POST['course']); $studentrepository = new StudentRepository(); $success = false; if (isset($_POST['id']) && $_POST['id'] == '') { $result = $studentrepository->insert($students); } else { $result = $studentrepository->update($students); } if ($result > 0) { header("location:index.php?success=true"); } else { header("location:index.php?error=true"); } exit;
<?php require_once 'models/student.class.php'; require_once 'repository/studentrepository.class.php'; $repository = new StudentRepository(); $student = new Student(); $student->initialize(1, "sujan", "malakar", "*****@*****.**"); $repository->add($student); $student1 = new Student(); $student1->initialize(2, "Pratish", "Shrestha", "*****@*****.**"); $repository->add($student1); $student2 = new Student(); $student2->initialize(3, "Pratasdfadish", "asdf", "*****@*****.**"); $repository->add($student2); include_once "header.php"; ?> <table class="table table-bordered table-hover table-striped"> <tr> <th><input type="checkbox" id="select-all"/></th> <th>Id</th> <th>Name</th> <th>Email</th> <th>Action</th> </tr> <?php $repository->delete(3); foreach ($repository->get_all() as $s) { ?> <tr>