public function update(Teacher $object) { $q = "UPDATE " . self::TABLE . " SET `name`='" . Singleton::create("NullConverter")->fromDOMtoDB($object->getName()) . "' WHERE teacherId='" . addslashes($object->getTeacherId()) . "'"; $pk = $object->getTeacherId(); 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->getTeacherId()) . "', '" . Singleton::create("NullConverter")->fromDOMtoDB($object->getName()) . "')"; } } $this->db->updateQuery($q); if (empty($pk)) { $pk = $this->db->selectQuery("SELECT teacherId from " . self::TABLE . " ORDER BY teacherId DESC limit 1")->getSingleton(); } $result = $this->findByPrimaryKey($pk); parent::$dbCache->resetEntity("Teacher"); parent::$dbCache->setSingle("Teacher", $pk, $result); return $result; }
protected function teasubrel() { $class = $_GET['uid']; global $objPDO; $subject = array(); include_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/subject_relations_class.php'; $sec = new SubjectRelations($objPDO); include_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/subject_class.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/subject_class.php'; $subject_array = array(); $teacher_id = array(); $teacher = array(); $subject = $sec->getByClassId($class); for ($i = 0; $i < count($subject); $i++) { $subject_array[$subject[$i]] = Subject::getSubjectName($subject[$i]); if ($val = $this->getteasubrel($class, $subject[$i])) { $teacher_id[$subject[$i]] = $val; $teacher_profile = new Teacher($objPDO, $teacher_id[$subject[$i]]); $teacher[$teacher_id[$subject[$i]]] = $teacher_profile->getName($teacher_id[$subject[$i]]); } } include $_SERVER['DOCUMENT_ROOT'] . '/cloud/view/teacher_relation_template.php'; }
</td> <td><?php $d = new Department(); $d->getInfo($course->course_dep); echo $d->getDepName(); unset($d); ?> </td> <td><?php echo $course->course_sem; ?> </td> <td><?php $t = new Teacher(); $t->getInfo($course->teacher_id); echo $t->getName(); unset($t); ?> </td> <td><button class="btn btn-default" onClick="edit_assigned_feild(<?php echo $course->id . ',\'' . $course->course_code . '\',' . $course->course_dep . ',' . $course->course_sem; ?> );" > Edit </button> <button class="btn btn-danger" onClick="delete_assigned(<?php echo $course->id . ',\'' . $course->course_code . '\',' . $course->course_dep . ',' . $course->course_sem; ?> );" >Remove</button> </td> </tr> <?php }
public function makepdf() { global $user; // Get required files. require_once 'others/fpdf/fpdf.php'; // Set some document variables $author = "eduCloud"; $x = 35; $text = <<<EOT Hello EOT; // Create fpdf object $pdf = new FPDF('P', 'pt', 'Letter'); // Set base font to start $pdf->SetFont('Arial', 'B', 16); // Add a new page to the document $pdf->addPage(); $pdf->setLeftMargin($x); //page border $pdf->Line(35, 30, 35, 750); $pdf->Line(35, 30, 575, 30); $pdf->Line(575, 30, 575, 750); $pdf->Line(575, 750, 35, 750); //end of page border // Set the x,y coordinates of the cursor $pdf->SetXY($x + 20, 40); // Write 'Simple PDF' with a line height of 1 at the current position $pdf->Write(25, 'Employee Details'); $pdf->Image($_SERVER['DOCUMENT_ROOT'] . '/cloud/images/school_logo.jpg', 500, 35, 50, 50, 'JPG'); // Reset the font // Reset font, color, and coordinates $pdf->SetFont('Arial', '', 12); $pdf->SetTextColor(0, 0, 0); $pdf->SetLeftMargin($x + 50); $pdf->setXY($x + 50, 90); global $objPDO; require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/teacher_class.php'; $record = new Teacher($objPDO); if ($user->checkAdmin()) { $eid = $_GET['uid']; } else { $student = new Student($objPDO, $user->getuserId()); $eid = $student->getID(); } $record->loadByUserId($eid); // Write out a long text blurb. //$array=$record->getAsArray(); //$x=0; /* TEMPLATE 1 DESIGN*/ $pdf->SetFont('Arial', '', 8); $pdf->setFillColor(255, 255, 255); $pdf->cell(200, 20, 'Employee Id (reference) : ' . $record->getTeacherId(), 0, 1, 'L', true); $pdf->SetFont('Arial', '', 12); $pdf->setFillColor(50, 50, 50); $pdf->setTextColor(255, 255, 255); $pdf->cell(450, 20, 'Employee Details', 0, 1, 'C', true); $pdf->setTextColor(0, 0, 0); $pdf->setFillColor(221, 221, 221); $pdf->cell(200, 20, 'Employee Name', 0, 0, 'C', true); $pdf->cell(250, 20, $record->getName(), 0, 1, 'C', true); $pdf->setFillColor(255, 255, 255); $pdf->cell(200, 20, 'Qualification', 0, 0, 'C', true); $pdf->cell(250, 20, $record->getQualification(), 0, 1, 'C', true); require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/subject_class.php'; $subject_id = new Subject($objPDO); $subject_id->setID($record->getSubjectId()); $pdf->setFillColor(221, 221, 221); $pdf->cell(200, 20, 'Subject', 0, 0, 'C', true); $pdf->cell(250, 20, $subject_id->getName(), 0, 1, 'C', true); $pdf->setFillColor(255, 255, 255); $pdf->cell(200, 20, 'Date Of Birth', 0, 0, 'C', true); $pdf->cell(250, 20, $record->getDateOfBirth(), 0, 1, 'C', true); $pdf->setFillColor(221, 221, 221); $pdf->cell(200, 20, 'Gender', 0, 0, 'C', true); $pdf->cell(250, 20, ucfirst($record->getGender()), 0, 1, 'C', true); $pdf->setFillColor(255, 255, 255); $pdf->cell(200, 20, 'Blood Group', 0, 0, 'C', true); $pdf->cell(250, 20, $record->getBloodGroup(), 0, 1, 'C', true); $pdf->setFillColor(255, 255, 255); $pdf->cell(200, 20, '', 0, 0, 'C', true); $pdf->cell(250, 20, '', 0, 1, 'C', true); $pdf->setFillColor(50, 50, 50); $pdf->setTextColor(255, 255, 255); $pdf->cell(450, 20, 'Contact Details', 0, 1, 'C', true); $pdf->setTextColor(0, 0, 0); $pdf->setFillColor(221, 221, 221); $pdf->cell(200, 20, 'Correspondence Address', 0, 0, 'C', true); $pdf->cell(250, 20, $record->getCorrespondenceAddressLine1(), 0, 1, 'C', true); $pdf->cell(200, 20, '', 0, 0, 'C', true); $pdf->cell(250, 20, $record->getCorrespondenceAddressLine2(), 0, 1, 'C', true); $pdf->setFillColor(255, 255, 255); $pdf->cell(200, 20, 'City', 0, 0, 'C', true); $pdf->cell(250, 20, $record->getCorrespondenceCity(), 0, 1, 'C', true); $pdf->setFillColor(221, 221, 221); $pdf->cell(200, 20, 'State', 0, 0, 'C', true); $pdf->cell(250, 20, $record->getCorrespondenceState(), 0, 1, 'C', true); $pdf->setFillColor(255, 255, 255); $pdf->cell(200, 20, 'Pincode', 0, 0, 'C', true); $pdf->cell(250, 20, $record->getCorrespondencePincode(), 0, 1, 'C', true); $pdf->setFillColor(221, 221, 221); $pdf->cell(200, 20, 'Phone', 0, 0, 'C', true); $pdf->cell(250, 20, $record->getPhone(), 0, 1, 'C', true); $pdf->setFillColor(255, 255, 255); $pdf->cell(200, 20, 'Mobile', 0, 0, 'C', true); $pdf->cell(250, 20, $record->getMobile(), 0, 1, 'C', true); $pdf->setFillColor(221, 221, 221); $pdf->cell(200, 20, 'Email', 0, 0, 'C', true); $pdf->cell(250, 20, $record->getEmail(), 0, 1, 'C', true); $pdf->setFillColor(255, 255, 255); $pdf->cell(450, 20, '', 0, 1, 'C', true); $pdf->setFillColor(50, 50, 50); $pdf->setTextColor(255, 255, 255); $pdf->cell(450, 20, 'Login Details', 0, 1, 'C', true); $pdf->setTextColor(0, 0, 0); $pdf->setFillColor(221, 221, 221); $pdf->cell(200, 20, 'Employee Id *', 0, 0, 'C', true); $pdf->cell(250, 20, $record->getTeacherId(), 0, 1, 'C', true); $pdf->setFillColor(255, 255, 255); $pdf->cell(200, 20, 'Temporary Password **', 0, 0, 'C', true); $pdf->cell(250, 20, $record->getTempPass(), 0, 1, 'C', true); /* TEMPLATE 1 DESIGN END*/ $pdf->SetFont('Arial', '', 10); $pdf->SetXY($x + 100, 620); $pdf->write(15, 'Employee\'s Signature'); $pdf->SetXY($x + 350, 620); $pdf->write(15, 'Admin\'s Signature'); $pdf->SetFont('Arial', '', 8); $pdf->SetXY($x + 20, 710); $pdf->write(15, '* Employee Id may be Temporary , ** Please Change the Password for Security Reasons'); $pdf->SetXY($x + 20, 720); $pdf->write(15, 'This is a Computer Generated Form. If any Discrepancy Contact Admin : eduCloud Reference Number ' . $user->getuserId()); // Close the document and save to the filesystem with the name simple.pdf $pdf->Output('generated_files/enroll' . $record->getUserId() . '.pdf', 'F'); header('Location:http://localhost/cloud/generated_files/enroll' . $record->getUserId() . '.pdf'); }
public function reject($tid, $cid, $did, $reject_msg) { if (!loggedIn()) { return 0; } $this->_connect(); $this->_teacher_id = $this->_db->real_escape_string($tid); $tid = $this->_db->real_escape_string($tid); $this->_course_code = $this->_db->real_escape_string($cid); $this->_course_dep = $this->_db->real_escape_string($did); if ($this->approved($cid, $did)) { if ($this->_status_level == '-1') { die('This result is already rejected.'); } if ($this->_status_level < 5) { $approved_by = explode(',', $this->_approved_by); $t = new Teacher(); $t->getInfo(Session::get('teacher_id')); $reject_msg = 'By ' . $t->getName() . '. ' . $reject_msg; $this->_reject_msg = $this->_db->real_escape_string($reject_msg); if (Session::get('privilege') === 'teacher') { $i = 0; while (isset($approved_by[$i])) { if ($approved_by[$i] == $tid) { return 2; break; } else { $i++; } } } else { if (Session::get('privilege') === 'dupc' || Session::get('privilege') === 'dppc') { $i = 1; if ($this->_status_level >= 3) { die("You cannot reject because all DUPC or DPPC members have approved!"); } if ($t->getDep() != $this->_course_dep) { die("Sorry! You cannot reject this result!"); } while (isset($approved_by[$i])) { if ($approved_by[$i] == $tid) { return 2; break; } else { $i++; } } } else { if (Session::get('privilege') === 'hod' && $this->_status_level == 3) { if ($t->getDep() != $this->_course_dep) { die("Sorry! You cannot reject this result!"); } } else { if (Session::get('privilege') === 'hod' && $this->_status_level < 3) { die("You cannot approve/reject this result being HOD because DUPC or DPPC members have not approved/rejected this result yet."); } else { if (Session::get('privilege') === 'hod' && $this->_status_level > 3) { die("You have already approved this result being HOD. So you cannot reject."); } else { if (Session::get('privilege') === 'dean' && $this->_status_level < 4) { die("You cannot approve/reject this result being DEAN because HOD or DUPC or DPPC members have not approved/rejected this result yet."); } } } } } } $approved_by = ''; $status_level = '-1'; $query = "UPDATE approval SET reject_msg='" . $this->_reject_msg . "',status_level='" . $status_level . "', approved_by='" . $approved_by . "' WHERE teacher_id='" . $this->_teacher_id . "' AND course_code='" . $this->_course_code . "' AND course_dep='" . $this->_course_dep . "' AND timestamp>='" . Session::get('semester_timestamp') . "'"; } else { die("Cannot Reject!"); } } else { die("Reject Error"); } $result = $this->_db->query($query); if ($this->_db->affected_rows) { if ($this->_db->error == '') { return 1; } else { die($this->_db->error); } } else { return 2; } }