/**
  * Test for setName.
  */
 public function testSetName()
 {
     $subject = new Subject(array('name' => 'Mario', 'surname' => 'Rossi', 'birthDate' => '1985-12-10', 'gender' => 'M', 'belfioreCode' => 'A562'));
     $subject->setName('Fabrizio');
     $actual = $subject->getName();
     $expected = 'Fabrizio';
     $this->assertEquals($expected, $actual);
 }
示例#2
0
 /**
  * @param Subject $subject
  * @return mixed
  */
 public function update(Subject $subject)
 {
     $this->name = $subject->getName();
 }
 protected function gettimetablecreate()
 {
     global $user;
     global $objPDO;
     $student = new student($objPDO, $user->getuserId());
     $headMenu = array("username" => $student->getName());
     if ($user->checkAdmin() == true && isset($_GET['uid'])) {
         include $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/examination_section_subject_class.php';
         include $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/examination_class.php';
         include $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/section_class.php';
         include $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/subject_class.php';
         $exam_id = $_GET['uid'];
         $exam = new Examination($objPDO, $exam_id);
         $slots = $exam->getFnAn();
         if ($slots == 2) {
             $slots = 1;
         } else {
             if ($slots == 3) {
                 $slots = 2;
             } else {
                 $slots = 1;
             }
         }
         $startTime = strtotime($exam->getStartDate());
         $endTime = strtotime($exam->getEndDate());
         $day = 86400;
         $format = 'd-m-Y';
         $numDays = round(($endTime - $startTime) / $day) + 1;
         $days = array();
         for ($i = 0; $i < $numDays; $i++) {
             $days[] = date($format, $startTime + $i * $day);
         }
         $rel = new ExaminationSectionSubject($objPDO);
         $section_array = $rel->getByExamId($exam_id);
         $section_name = array();
         $subject_array = array();
         $section = new Section($objPDO);
         $subject = new Subject($objPDO);
         foreach ($section_array as $key => $value) {
             $section->setID($key);
             $section->load();
             $section_name[$key] = $section->getCode();
             foreach ($value as $k => $v) {
                 $subject->setID($v);
                 $subject->load();
                 $subject_array[$key][$v] = $subject->getName();
             }
             $subject_array[$key][0] = "--None--";
         }
         include $_SERVER['DOCUMENT_ROOT'] . '/cloud/view/exam_timetable_create.php';
     } else {
         header('Location:http://localhost/cloud');
     }
 }
示例#4
0
</div>';
                    }
                    break;
                case "view":
                    if (isset($_REQUEST["target"])) {
                        $target = $_REQUEST["target"];
                        $subject = new Subject($target);
                        $pageBody .= '
<table class="pretty">
<tr>
	<th>code</th>
	<td>' . $subject->getCode() . '</td>
</tr>
<tr>
	<th>name</th>
	<td>' . $subject->getName() . '</td>
</tr>
<tr>
	<th>description</th>
	<td>' . $subject->getDescription() . '</td>
</tr>
<tr>
	<th>start year</th>
	<td>' . $subject->getStartYear() . '</td>
</tr>
<tr>
	<th>stop year</th>
	<td>' . $subject->getStopYear() . '</td>
</tr>
</table>';
                    } else {
    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');
    }
 protected function validate()
 {
     $required = array("section" => "Section");
     global $user;
     if ($user->checkAdmin() == true) {
         if (isset($_POST)) {
             foreach ($required as $key => $value) {
                 if (!isset($_POST[$key]) || $_POST[$key] == '' || $_POST[$key] == 'select') {
                     echo $value . ' is Required<br/>';
                     return;
                 }
             }
             global $objPDO;
             include $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/timetable_settings_class.php';
             $sett = new TimetableSettings($objPDO);
             $slots = $sett->getAllSlots();
             if (!isset($slots)) {
                 $num_slots = 0;
             } else {
                 $num_slots = count($slots);
             }
             require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/timetable_class.php';
             require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/section_teacher_subject_class.php';
             require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/controller/utility_class.php';
             for ($i = 0; $i < count($_POST['time_table']); $i++) {
                 $spl = array();
                 $spl = explode("-", $_POST['time_table'][$i]);
                 if (isset($spl[1])) {
                     $ttab = new Timetable($objPDO);
                     $ttab->setSectionId($_POST['section']);
                     $ttab->setSlot($spl[1]);
                     $ttab->getBySecSlot();
                     if ($spl[0] != '0') {
                         $rel = new SectionTeacherSubjectRelations($objPDO);
                         $tid = $rel->getByClassSubject($_POST['section'], $spl[0]);
                         if ($ttab->checkTeacherSlot($spl[1], $tid, $_POST['section'])) {
                             $ttab->setSubjectId($spl[0]);
                             $ttab->setTeacherId($tid);
                         } else {
                             $ttab->markForDeletion();
                             include_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/subject_class.php';
                             $sub = new Subject($objPDO, $spl[0]);
                             $day = floor($spl[1] / $num_slots);
                             $slot = $spl[1] % $num_slots;
                             echo "Teacher Slot Unavailable for " . $sub->getName() . " at " . Utility::getDay($day + 1) . " " . $slots[$slot] . "<br/>";
                             return;
                             $label = false;
                         }
                     } else {
                         if ($spl[0] == '0') {
                             $ttab->markForDeletion();
                         }
                     }
                     if (!isset($label) || $label != false) {
                     }
                     $ttab->save();
                 }
             }
             echo 'Saving...';
             if (!isset($label) || $label != false) {
                 echo '<meta http-equiv="Refresh" content="0;url=http://localhost/cloud/timetable"/>';
             }
         }
     } else {
         header('Location:http://localhost/cloud');
     }
 }
示例#7
0
 public function testGetName()
 {
     $this->assertSame(self::$name, $this->claim->getName());
 }