本文整理汇总了PHP中Course::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Course::delete方法的具体用法?PHP Course::delete怎么用?PHP Course::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Course
的用法示例。
在下文中一共展示了Course::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
function init()
{
$obj = new Course();
$func = array_shift($this->param);
$id = array_shift($this->param);
if ($func != '') {
$_SERVER['REQUEST_METHOD'] = 'POST';
switch ($func) {
case 'delete':
Security::checkEditor($id);
try {
$obj->delete($id);
} catch (Exception $e) {
}
header('Location: /admin_courses');
exit;
break;
case 'activate':
Security::checkEditor($id);
try {
$obj->invert($id);
} catch (Exception $e) {
}
header('Location: /admin_courses');
exit;
break;
}
}
}
示例2: delete
function delete(Course $obj)
{
$output = array('code' => '000', 'message' => 'Something gone wrong. Please try again', 'type' => 'danger');
if ($obj->delete($_REQUEST['id'])) {
$output = array('code' => '200', 'message' => 'Course deleted successfully.', 'type' => 'success');
}
return $output;
}
示例3: deleteIfNotFound
/**
* If no training associations, delete course.
*/
public static function deleteIfNotFound($training_title_option_id, $training_id = 0)
{
$tableObj = new Course();
$select = $tableObj->select()->from('training', array('COUNT(id) AS training_count'))->setIntegrityCheck(false)->where("course_id = {$training_title_option_id} AND id != {$training_id}");
$row = $tableObj->fetchRow($select);
if (!$row->training_count) {
$tableObj = new Course();
$tableObj->delete("training_title_option_id = {$training_title_option_id}");
$tableObj = new ITechTable(array('name' => 'training_title_option'));
$tableObj->delete("id = {$training_title_option_id}");
}
}
示例4: doDelete
function doDelete()
{
@($id = $_POST['selector']);
$key = count($id);
//multi delete using checkbox as a selector
for ($i = 0; $i < $key; $i++) {
$Course = new Course();
$Course->delete($id[$i]);
}
message("Course(s) already Deleted!", "info");
redirect('index.php');
}
示例5: testDelete
function testDelete()
{
//Arrange
$course_name = "Vampires";
$course_number = 1;
$id = 1;
$test_course = new Course($course_name, $course_number, $id);
$test_course->save();
$course_name2 = "Discrete Math";
$course_number2 = 1;
$id2 = 2;
$test_course2 = new Course($course_name2, $course_number2, $id2);
$test_course2->save();
//Act
$test_course->delete();
//Assert
$this->assertEquals([$test_course2], Course::getAll());
}
示例6: testDelete
function testDelete()
{
$name = "John Doe";
$password = "password";
$email = "johndoe@osa.biz";
$signed_in = 0;
$test_user = new User($name, $password, $email, $signed_in);
$test_user->save();
$title = "Literature";
$subject = "English";
$description = "Deconstructing English literature.";
$user_id = $test_user->getId();
$test_course = new Course($title, $subject, $description, $user_id);
$title2 = "Algebra";
$subject2 = "Math";
$description2 = "Introduction to algebraic equations.";
$test_course2 = new Course($title2, $subject2, $description2, $user_id);
$test_course2->save();
$test_course->delete();
$result = Course::getAll();
$this->assertEquals([$test_course2], $result);
}
示例7: testDelete
function testDelete()
{
$name = "History";
$course_number = "HIST100";
$test_course = new Course($name, $course_number);
$test_course->save();
$name = "Bob";
$enrollment_date = "2015-01-01";
$test_student = new Student($name, $enrollment_date);
$test_student->save();
$test_course->addStudent($test_student);
$test_course->delete();
$this->assertEquals([], $test_course->getStudents());
}
示例8: testDelete
function testDelete()
{
//Arrange
$name = "Math";
$date = '0000-00-00';
$id = 1;
$test_course = new Course($name, $id);
$test_course->save();
$student_name = "File reports";
$id2 = 2;
$course_id = $test_course->getId();
$test_student = new Student($student_name, $id2, $date, $course_id);
$test_student->save();
//Act
$test_course->addStudent($test_student);
$test_course->delete();
//Assert
$this->assertEquals([], $test_student->getCourses());
}
示例9: Course
function test_delete()
{
//Arrange
$title = "Intro to Typing: COM-91";
$teacher = "Ancient Raven";
$time = "TH 9PM-11PM";
$semester = "Fall";
$test_course = new Course($title, $teacher, $time, $semester);
$test_course->save();
$title2 = "Intro to Ladders: SHOP-10";
$teacher2 = "Jeff Winger";
$time2 = "MWF 11AM-12PM";
$semester2 = "Spring";
$test_course2 = new Course($title2, $teacher2, $time2, $semester2);
$test_course2->save();
//Act
$test_course->delete();
$result = Course::getAll();
//Assert
$this->assertEquals([$test_course2], $result);
}
示例10: testDelete
function testDelete()
{
//Arrange
$name = "Math";
$course_num = "101";
$id = 1;
$test_course = new Course($name, $course_num, $id);
$test_course->save();
$name = "Rick";
$date = "2015-08-15";
$id = 1;
$test_student = new Student($name, $date, $id);
$test_student->save();
//Act
$test_course->addStudent($test_student);
$test_course->delete();
//Assert
$this->assertEquals([], $test_student->getCourses());
}
示例11: testDeleteCourse
function testDeleteCourse()
{
$name = "Coding 101";
$id = 1;
$test_course = new Course($name);
$test_course->save();
$name2 = "Advanced Coding";
$id2 = 2;
$test_course2 = new Course($name2);
$test_course2->save();
$test_course->delete();
$this->assertEquals([$test_course2], Course::getAll());
}
示例12: testDelete
function testDelete()
{
$course_name = "History";
$course_code = "HIST100";
$test_course = new Course($course_name, $course_code);
$test_course->save();
$course_name2 = "Gym";
$course_code2 = "GYM100";
$test_course2 = new Course($course_name2, $course_code2);
$test_course2->save();
$test_course->delete();
$this->assertEquals([$test_course2], Course::getAll());
}
示例13: header
}
//
header('Location: ' . BASE_URL . 'academia/courses/success');
} else {
throw new Exception("Either you're trying to hack this app or something wrong went. In either case the\n developers were just notified about this");
}
} else {
if (isBtnSavePrsd()) {
$newCourseCode = trim($_POST['course_code']);
$newCourseName = trim($_POST['course_name']);
Course::create($newCourseCode, $newCourseName);
header('Location: ' . BASE_URL . 'academia/courses/success');
exit;
} else {
if (isBtnDeletePrsd()) {
Course::delete($_POST['delCourseIdModal']);
header('Location: ' . BASE_URL . 'academia/courses/success');
exit;
}
}
}
} catch (Exception $e) {
$errors[] = $e->getMessage();
}
/**
* http://stackoverflow.com/a/4128377/2790481
*
* @param $needle
* @param $courses
* @param bool $strict
* @return bool
示例14: delete_task_set_type
public function delete_task_set_type()
{
$this->output->set_content_type('application/json');
$this->load->library('form_validation');
$this->form_validation->set_rules('task_set_type_id', 'task_set_type_id', 'required');
$this->form_validation->set_rules('course_id', 'course_id', 'required');
if ($this->form_validation->run()) {
$course_id = intval($this->input->post('course_id'));
$task_set_type_id = intval($this->input->post('task_set_type_id'));
$course = new Course();
$course->get_by_id($course_id);
$task_set_type = new Task_set_type();
$task_set_type->get_by_id($task_set_type_id);
if ($course->exists() && $task_set_type->exists()) {
$this->_transaction_isolation();
$this->db->trans_begin();
$course->delete($task_set_type);
$task_sets = new Task_set();
$task_sets->where_related_course('id', $course_id)->where_related_task_set_type('id', $task_set_type_id)->get_iterated();
foreach ($task_sets as $task_set) {
$task_set->delete($task_set_type);
}
if ($this->db->trans_status()) {
$this->db->trans_commit();
$this->output->set_output(json_encode(TRUE));
return;
} else {
$this->db->trans_rollback();
}
}
}
$this->output->set_output(json_encode(FALSE));
}
示例15: Department
function test_delete()
{
//Arrange
$test_department = new Department("Biology", "346 Stupid Avenue");
$test_department->save();
$name = "History 0001";
$code = "HS001";
$test_course = new Course($name, $code, $test_department->getId());
$test_course->save();
$name2 = "Dogs 101";
$code2 = "DW101";
$test_course2 = new Course($name2, $code2, $test_department->getId());
$test_course2->save();
//Act
$test_course->delete();
//Assert
$result = Course::getAll();
$this->assertEquals($test_course2, $result[0]);
}