本文整理汇总了PHP中Student::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Student::delete方法的具体用法?PHP Student::delete怎么用?PHP Student::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Student
的用法示例。
在下文中一共展示了Student::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Student
function test_delete()
{
//Arrange
$name = "Shmuel Irving-Jones";
$enroll_date = "2015-08-25";
$test_student = new Student($name, $enroll_date);
$test_student->save();
$name2 = "Billy Bartle-Barnaby";
$enroll_date2 = "2015-07-09";
$test_student2 = new Student($name2, $enroll_date2);
$test_student2->save();
//Act
$test_student->delete();
//Assert
$result = Student::getAll();
$this->assertEquals($test_student2, $result[0]);
}
示例2: Database
<!doctype html>
<html>
<?php
include 'config/database.php';
include 'object/student.php';
//make a database object:
$database = new Database();
//make it connect:
$conn = $database->getConnection();
// instantiate a new student object
$student = new Student($conn);
if (isset($_GET['deleteid'])) {
//if there is a delete id, it sets the Student ID to it
$student->stud_id = $_GET['deleteid'];
//Then runs function delete
$stmt = $student->delete();
}
?>
<head>
<meta charset="utf-8">
<title>Community Service</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700' rel='stylesheet' type='text/css'>
<!-- <link rel="stylesheet" type="text/css" href="css/app.css"> -->
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="icon" type="image/ico" href="images/favicon.ico">
</head>
<body class="clearfix">
<div class="content_div">
<div class="msg-container">
示例3: testDelete
function testDelete()
{
$name = "Bob";
$enrollment_date = "2015-01-01";
$test_student = new Student($name, $enrollment_date);
$test_student->save();
$name = "History";
$course_number = "HIST100";
$test_course = new Course($name, $course_number);
$test_course->save();
//act
$test_student->addCourse($test_course);
$test_student->delete();
$this->assertEquals([], $test_student->getCourses());
}
示例4:
<?php
require_once 'classes/Entity/Student.php';
require_once 'classes/View.php';
require_once 'classes/Data.php';
if (isset($_GET['del_id'])) {
Student::delete($_GET['del_id']);
}
$students = Student::findAll();
Data::setData('students', $students);
View::render('students');
示例5: showStudent
function showStudent()
{
global $connector;
global $result;
$student = new Student();
$course = new Course();
$plan = new Plan();
$student->setConnector($connector);
$course->setConnector($connector);
$plan->setConnector($connector);
if (isset($_POST['operation'])) {
list($operation, $params) = explode("#", $_POST['operation']);
switch ($operation) {
case 'delete':
$error_msg = $student->delete($params);
break;
case 'edit':
$stud = $student->getById($params);
$result['edit'] = $stud;
$result['edit']->student = $stud;
$exam = new Exam();
$exam->setConnector($connector);
$result['edit']->exam = $exam->getList($result['edit']->student);
break;
case 'editChanges':
$student->storeFormValues($_POST);
$error_msg = $student->update();
break;
case 'saveChanges':
$student->storeFormValues($_POST);
$error_msg = $student->insert();
if ($error_msg) {
$result['edit'] = $student;
}
break;
case 'nextPage':
$student->storeFormValues($_POST);
$result['edit'] = $student;
break;
case 'createPassword':
$stud = $student->getById($params);
$stud->setConnector($connector);
$error_msg = $stud->generatePassword();
$result['edit'] = $stud;
break;
default:
$error_msg = "Operazione non valida";
}
if ($error_msg != "") {
$result["errorMessage"] = $error_msg;
} elseif ($operation != 'edit' && $operation != "nextPage") {
$result["statusMessage"] = "Operazione completata!";
}
}
if (isset($_POST['search'])) {
$result["students"] = $student->search($_POST['search']);
} else {
$result["students"] = $student->getList();
}
$result["plans"] = $plan->getList("id_piano");
$result["courses"] = $course->getList("nome");
$page = "student.php";
include_once BASE_PATH . "template.php";
}
示例6: delete
public static function delete($id)
{
session_start();
$headers = apache_request_headers();
$token = $headers['X-Auth-Token'];
if (!$headers['X-Auth-Token']) {
header('Invalid CSRF Token', true, 401);
return print json_encode(array('success' => false, 'status' => 400, '1msg' => 'Invalid CSRF Token / Bad Request / Unauthorized ... Please Login again'), JSON_PRETTY_PRINT);
die;
} else {
if ($token != $_SESSION['form_token']) {
header('Invalid CSRF Token', true, 401);
return print json_encode(array('success' => false, 'status' => 400, 'msg' => 'Invalid CSRF Token / Bad Request / Unauthorized ... Please Login again'), JSON_PRETTY_PRINT);
die;
} else {
Student::delete($id);
}
}
}
示例7: Department
function test_delete()
{
//Arrange
$test_department = new Department("Biology", "346 Stupid Avenue");
$test_department->save();
$name = "Ashlin Aronin";
$enrollment_date = "2015-08-24";
$test_student = new Student($name, $enrollment_date, $test_department->getId());
$test_student->save();
$name2 = "John Nolastname";
$enrollment_date2 = "2015-07-20";
$test_student2 = new Student($name, $enrollment_date, $test_department->getId());
$test_student2->save();
//Act
$test_student->delete();
//Assert
$result = Student::getAll();
$this->assertEquals([$test_student2], $result);
}
示例8: testDeleteStudent
function testDeleteStudent()
{
//Arrange
$id = null;
$name = "Micah";
$enrollment_date = "2015-08-28";
$test_student = new Student($id, $name, $enrollment_date);
$test_student->save();
$name2 = "Intro to History";
$number = "HIST100";
$test_course = new Course($id, $name2, $number);
$test_course->save();
//Act
$test_student->addCourse($test_course);
$test_student->delete();
//Act
$this->assertEquals([], $test_course->getStudents());
}
示例9: Student
<?php
require_once "../init.php";
$student = new Student(new PDOdb("mysql:host=localhost;dbname=usjr", "root", ""));
$studid = $_POST['stid'];
$studfname = $_POST['stfname'];
$studmname = $_POST['stmname'];
$studlname = $_POST['stlname'];
$studcourse = $_POST['stcourse'];
$studyear = $_POST['styear'];
$result = $student->delete(array('studid'), array($studid));
// if($result > 0)
// echo "Data added";
// else
// echo "Data was not added";
header("Location:studentDeleteList.php");
示例10: delete
public function delete()
{
$this->output->set_content_type('application/json');
$this->usermanager->teacher_login_protected_redirect();
$url = $this->uri->ruri_to_assoc(3);
$student_id = isset($url['student_id']) ? intval($url['student_id']) : 0;
if ($student_id != 0) {
$this->_transaction_isolation();
$this->db->trans_begin();
$student = new Student();
$student->get_by_id($student_id);
$student->delete();
if ($this->db->trans_status()) {
$this->db->trans_commit();
$this->output->set_output(json_encode(TRUE));
} else {
$this->db->trans_rollback();
$this->output->set_output(json_encode(FALSE));
}
} else {
$this->output->set_output(json_encode(FALSE));
}
}
示例11: doDelete
function doDelete()
{
@($id = $_POST['selector']);
$key = count($id);
//multi delete using checkbox as a selector
for ($i = 0; $i < $key; $i++) {
$student = new Student();
$student->delete($id[$i]);
$details = new Student_details();
$details->delete($id[$i]);
$sy = new Schoolyr();
$sy->delete($id[$i]);
$req = new Requirements();
$req->delete($id[$i]);
}
message("Student has successfully deleted!", "info");
redirect('index.php');
}
示例12: testDelete
function testDelete()
{
$student_name = "John Doe";
$enrollment_date = "2015-09-01";
$test_student = new Student($student_name, $enrollment_date);
$test_student->save();
$student_name2 = "Jane Smith";
$enrollment_date2 = "2013-09-01";
$test_student2 = new Student($student_name, $enrollment_date);
$test_student2->save();
$test_student->delete();
$this->assertEquals([$test_student2], Student::getAll());
}
示例13: testDelete
function testDelete()
{
//Arrange
$name = "Rick";
$date = "2015-08-15";
$id = 1;
$test_student = new Student($name, $date, $id);
$test_student->save();
//Act
$test_student->delete();
$result = Student::getAll();
//Assert
$this->assertEquals([], $result);
}
示例14: Student
function test_delete()
{
//Arange
$name = "Steve Beekman";
$date = "2015-08-23";
$test_student = new Student($name, $date);
$test_student->save();
$name2 = "Fred Flintstone";
$date2 = "0001-01-01";
$test_student2 = new Student($name2, $date2);
$test_student2->save();
//Act
$test_student->delete();
$result = Student::getAll();
//Assert
$this->assertEquals([$test_student2], $result);
}
示例15: Student
function test_deleteStudent()
{
//Arrange
$student_name = "Joker";
$enrollment_date = "6000-12-14";
$id = 1;
$student = new Student($student_name, $enrollment_date, $id);
$student->save();
$student_name2 = "Riddler";
$enrollment_date2 = "7000-08-09";
$id2 = 2;
$student2 = new Student($student_name2, $enrollment_date2, $id2);
$student2->save();
//Act
$student->delete();
//Assert
$this->assertEquals([$student2], Student::getAll());
}