function test_update() { $name = "Chris"; $date = "1111-11-11"; $test_student = new Student($name, $date); $test_student->save(); $new_name = "Chris the Jerk"; $test_student->update($new_name); $this->assertEquals("Chris the Jerk", $test_student->getName()); }
function testGetName() { //Arrange $name = "Student1"; $test_student = new Student($name); //Act $result = $test_student->getName(); //Assert $this->assertEquals($name, $result); }
function test_getName() { //Arrange $name = "Steve Beekman"; $date = "2015-08-23"; $test_student = new Student($name, $date); //Act $result = $test_student->getName(); //Assert $this->assertEquals($name, $result); }
function test_getName() { //Arrange $name = "Joleen"; $enrollment = "8/25/2015"; $test_student = new Student($name, $enrollment); //Act $result = $test_student->getName(); //Assert $this->assertEquals($name, $result); }
function test_getName() { //Arrange $name = "Sandra Maley"; $enrollment_date = "2015-06-21"; $test_student = new Student($name, $enrollment_date); //Act $result = $test_student->getName(); //Assert $this->assertEquals($name, $result); }
public function update(Student $object) { $q = "UPDATE " . self::TABLE . " SET `name`='" . Singleton::create("NullConverter")->fromDOMtoDB($object->getName()) . "' WHERE studentId='" . addslashes($object->getStudentId()) . "'"; $pk = $object->getStudentId(); if ($object->isNew()) { if (empty($pk)) { $q = "INSERT INTO " . self::TABLE . " (`name`) VALUES ('" . Singleton::create("NullConverter")->fromDOMtoDB($object->getName()) . "')"; } else { $q = "INSERT INTO " . self::TABLE . " (`name`) VALUES ('" . Singleton::create("NullConverter")->fromDOMtoDB($object->getStudentId()) . "', '" . Singleton::create("NullConverter")->fromDOMtoDB($object->getName()) . "')"; } } $this->db->updateQuery($q); if (empty($pk)) { $pk = $this->db->selectQuery("SELECT studentId from " . self::TABLE . " ORDER BY studentId DESC limit 1")->getSingleton(); } $result = $this->findByPrimaryKey($pk); parent::$dbCache->resetEntity("Student"); parent::$dbCache->setSingle("Student", $pk, $result); return $result; }
function testUpdate() { //Arrange $name = "Ben"; $enroll_date = "0000-00-00"; $id = 1; $test_student = new Student($name, $enroll_date, $id); $test_student->save(); $new_name = "Jen"; //Act $test_student->update($new_name); //Assert $this->assertEquals($new_name, $test_student->getName()); }
protected function employeemarkview() { $date = $_GET['uid']; global $user; global $objPDO; $student = new Student($objPDO, $user->getuserId()); $headMenu = array("username" => $student->getName()); if ($user->checkAdmin() == true) { include $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/teacher_class.php'; include $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/employee_attendance_class.php'; $emp = new Teacher($objPDO); $att = new EmployeeAttendence($objPDO); $employees = array(); $employees = $emp->getTeacherArray(0); $marked = $att->getByDate($date); require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/view/employee_mark_att.php'; } else { header('Location:http://localhost/cloud'); } }
/** * Send notice to student about assessed damage amount. * * @param Student $student * @param string $term * @param integer $billedAmount */ public static function sendDamageNotification(Student $student, $term, $billedAmount, $coordinatorName, $coordinatorEmail) { $subject = 'University Housing Room Damages Billed'; $template = 'email/roomDamageNotice.tpl'; $tags = array(); $tags['NAME'] = $student->getName(); $tags['AMOUNT'] = $billedAmount; $tags['TERM'] = $term; $tags['COORDINATOR_NAME'] = $coordinatorName; $tags['COORDINATOR_EMAIL'] = $coordinatorEmail; self::sendSwiftmailMessage(self::makeSwiftmailMessage($student, $subject, $tags, $template)); }
<table class="table table-bordered table-striped"> <tbody> <tr> <th>Scholar Number</th> <td><input type='hidden' name='scholar_no' value='<?php echo Input::get('sid'); ?> '><?php echo Input::get('sid'); ?> </td> </tr> <tr> <th>Name</th> <td><?php echo $t->getName(); ?> </td> </tr> <tr> <th>Department</th> <td> <select name="department"> <option value="" selected>Department</option> <?php $dep = new Department(); $departments = $dep->getAllDepartment(); while ($department = $departments->fetch_object()) { ?> <option value="<?php echo $department->dept_id;
echo 'Invalid authentication. Please try again later or re-login.'; echo '</div>'; die; } } } $s->getInfo(Session::get('sn')); ?> <div class="col-md-2"> </div> <div class="col-md-8"> <div class="box box-primary"> <div class="box-header"> <div class="box-title pull-left"> <h3><?php echo $s->getName(); ?> </h3> <h4><?php $d = new Department(); $d->getInfo($s->getDep()); echo $d->getDepName(); unset($d); ?> </h4> <h4><i><?php echo $s->getEmail(); ?> </i></h4> <h4><i><?php $username = explode('@', $s->getEmail())[0];
function testUpdate() { //Arrange $name = "Rick"; $date = "2015-08-15"; $id = 1; $test_student = new Student($name, $date, $id); $test_student->save(); $new_name = "Obama"; $new_date = "2015-10-10"; //Act $test_student->update($new_name, $new_date); //Assert $this->assertEquals("Obama", $test_student->getName()); $this->assertEquals("2015-10-10", $test_student->getDate()); }
function test_update() { //Arrange $name = "Jeff Lebowski"; $enrollment_date = "1973-12-12"; $id = 1; $student = new Student($name, $enrollment_date, $id); $student->save(); $new_name = "The Dude"; //Act $student->update($new_name); //Assert $this->assertEquals("The Dude", $student->getName()); }
protected function employeeview() { global $user; global $objPDO; $student = new student($objPDO, $user->getuserId()); $headMenu = array("username" => $student->getName()); if (($user->checkAdmin() == true || $student->checkTeacher()) && isset($_GET['uid'])) { $role = $student->getacctType(); $type_img = array('1' => 'important.png', '2' => 'announcement.png', '3' => 'reminder.png', '4' => 'others.png'); $id = $_GET['uid']; include $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/employee_notice_class.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/student_class.php'; $notice = new EmployeeNotice($objPDO, $id); $elems = $notice->getAsArray(); $stu = new Student($objPDO, $elems['user_id']); $elems['author_name'] = $stu->getName(); $time = strtotime($elems['date']); $elems['day'] = date('d', $time); $elems['month'] = date('M', $time); include $_SERVER['DOCUMENT_ROOT'] . '/cloud/view/view_notice_employee.php'; } else { header('Location:http://localhost/cloud'); } }
<?php if (isset($_GET['input']) && isset($_GET['delimiter'])) { $lines = array_filter(array_map('trim', explode("\n", $_GET['input']))); $delimiter = $_GET['delimiter']; $students = []; foreach ($lines as $line) { $tokens = array_map('trim', explode($delimiter, $line)); $name = $tokens[0]; $age = $tokens[1]; $grade = floatval($tokens[2]); $student = new Student($name, $age, $grade); $students[] = $student; } foreach ($students as $student) { echo "<ul>"; echo "<li>" . "Name: " . $student->getName() . "</li>"; echo "<li>" . "Age: " . $student->getAge() . "</li>"; echo "<li>" . "Grade: " . $student->getGrade() . "</li>"; echo "</ul>"; } } class Student { private $name; private $age; private $grade; function __construct($name, $age, $grade) { $this->name = $name; $this->age = $age; $this->grade = $grade;
function testUpdate() { //Arrange $name = "Bob"; $enrollment_date = "2015-06-06"; $id = 1; $test_student = new Student($name, $enrollment_date, $id); $test_student->save(); $new_name = "Billy Bob"; //Act $test_student->update($new_name); //Assert $this->assertEquals("Billy Bob", $test_student->getName()); }
</div>'; } break; case "view": if (isset($_REQUEST["target"])) { $target = $_REQUEST["target"]; $student = new Student($target); $pageBody .= ' <table class="pretty"> <tr> <th>school ID</th> <td>' . $student->getSchoolID() . '</td> </tr> <tr> <th>name</th> <td>' . $student->getName() . '</td> </tr> <tr> <th>gender</th> <td>' . $genders[$student->getGender()] . '</td> </tr> <tr> <th>date registered</th> <td>' . $student->getDateOfAdmission() . '</td> </tr> </table>'; } else { $pageBody .= ' <div class="dialog error"> <p>Sorry, but in order to view a students record, you must identify that student first, perhaps from <a href="?section=students&action=list">here</a>?</p> </div>';
function testUpdate() { $name = "Bob"; $enrollment_date = "2015-01-01"; $test_student = new Student($name, $enrollment_date); $test_student->save(); $new_name = "Kevin"; $test_student->update($new_name, $enrollment_date); $this->assertEquals("Kevin", $test_student->getName()); }
function testUpdateName() { //Arrange $name = "bob"; $date_of_enrollment = "2015-09-16"; $test_student = new Student($name, $date_of_enrollment); $test_student->save(); $new_name = "Mark Marvel"; //Act $test_student->updateName($new_name); //Assert $this->assertEquals("Mark Marvel", $test_student->getName()); }
function test_update() { //Arrange $name = "Shmuel Irving-Jones"; $enroll_date = "2015-08-25"; $test_student = new Student($name, $enroll_date); $test_student->save(); $new_name = "Reginald Irving-Jones"; //Act $test_student->update($new_name); //Assert $this->assertEquals($new_name, $test_student->getName()); }
function testUpdate() { //Arrange $name = "Elliot Michaels"; $date = "2015-08-03"; $id = 1; $test_student = new Student($name, $date, $id); $test_student->save(); $new_name = "Drake Michaels"; //Act $test_student->update($new_name); //Assert $this->assertEquals("Drake Michaels", $test_student->getName()); }
$b->setTitle('PHP Book'); $b->save(); Hypersistence::commit(); //LOAD $p = new Person(); $p->setId(1); $p->load(); echo $p->getName() . "\n"; $books = $p->getBooks()->execute(); foreach ($books as $b) { echo $b->getTitle() . "\n"; } $s = new Student(); $s->setId(1); $s->load(); echo $s->getName() . "\n"; $courses = $s->getCourses(); foreach ($courses as $c) { echo $c->getDescription() . "\n"; $course = $c; } $s->deleteCourses($course); Hypersistence::commit(); $s->load(true); $courses = $s->getCourses(); foreach ($courses as $c) { echo $c->getDescription() . "\n"; } $c = new Course(); $c->setId(1); $c->load();
function testUpdate() { $id = null; $name = "Micah"; $enrollment_date = "2015-08-30"; $test_student = new Student($id, $name, $enrollment_date); $test_student->save(); $new_name = "Phil"; //Act $test_student->update($new_name); //Assert $this->assertEquals("Phil", $test_student->getName()); }
<?php require_once 'student_class.php'; require_once 'pdofactory_class.php'; $strDSN = 'mysql:dbname=cloud;host=localhost'; $objPDO = PDOfactory::GetPDO($strDSN, "root", "", array()); $objPDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $objUser = new Student($objPDO); $objUser->setRollNo("admin"); $objUser->setName("admin"); $objUser->setEmail("*****@*****.**"); $objUser->setPassword("827ccb0eea8a706c4c34a16891f84e7b"); $objUser->setPhone("2346"); $objUser->setacctType("admin"); $objUser->save(); echo $objUser->getName(); echo $objUser->getEmail(); echo $objUser->getPassword(); echo $objUser->getPhone(); //$objUser->markForDeletion();