public function executeEiSummary(sfWebRequest $request) { $this->client = ClientPeer::retrieveByPk($request->getParameter('id')); $this->forward404Unless($this->client); if ($request->isMethod('post')) { $emp1 = EmployeePeer::retrieveByPk($request->getParameter('emp1')); $emp2 = EmployeePeer::retrieveByPk($request->getParameter('emp2')); $emp3 = EmployeePeer::retrieveByPk($request->getParameter('emp3')); set_include_path(sfConfig::get('sf_lib_dir') . '/SetaPDF/'); // define Font-Path define('SETAPDF_FORMFILLER_FONT_PATH', sfConfig::get('sf_lib_dir') . '/SetaPDF/FormFiller/font/'); // require API require_once 'FormFiller/SetaPDF_FormFiller.php'; /** * init a new instance of the FormFiller */ $FormFiller =& SetaPDF_FormFiller::factory(sfConfig::get('sf_app_module_dir') . "/client/templates/core_summary.pdf", "", "I"); $FormFiller->setUseUpdate(false); // Get all Form Fields $fields =& $FormFiller->getFields(); // Check for errors if (SetaPDF::isError($fields)) { die($fields->message); } // Fill in Textfields $fields['child_last']->setValue($this->client->getLastName()); $fields['child_first']->setValue($this->client->getFirstName()); $fields['child_middle']->setValue(''); $fields['dob1']->setValue($this->client->getDob('m')); $fields['dob2']->setValue($this->client->getDob('d')); $fields['dob3']->setValue($this->client->getDob('Y')); $fields['ev_name']->setValue("North Country Kids"); $fields['ev_id']->setValue(""); $fields['contact']->setValue("Stephanie Girard"); $fields['phone']->setValue("518-561-3803"); $fields['fax']->setValue("518-561-3805"); $fields['c_name1']->setValue($emp1 ? $emp1->getFullName() : ""); $fields['c_special1']->setValue($emp1 ? $emp1->getJob()->getAltName() : ""); $fields['c_instrument1']->setValue($emp1 ? "DAYC" : ""); $fields['c_name2']->setValue($emp2 ? $emp2->getFullName() : ""); $fields['c_special2']->setValue($emp2 ? $emp2->getJob()->getAltName() : ""); $fields['c_instrument2']->setValue($emp2 ? "DAYC" : ""); $fields['c_name3']->setValue($emp3 ? $emp3->getFullName() : ""); $fields['c_special3']->setValue($emp3 ? $emp3->getJob()->getAltName() : ""); $fields['c_instrument3']->setValue($emp3 ? "DAYC" : ""); // Ouput the new PDF return $FormFiller->fillForms('core_summary.pdf'); } else { $this->form = new TeamForm(); } }
public function executeDeleteChild() { $employee = EmployeePeer::retrieveByPk($this->getRequestParameter('employee_id')); $this->forward404Unless($employee); $empl_child = EmployeeChildsPeer::retrieveByPK($this->getRequestParameter('id')); $this->forward404Unless($empl_child); $empl_child->delete(); return $this->redirect('employee/edit?id=' . $employee->getId()); }
public function executeBatchPrintBadge(sfWebRequest $request) { $ids = $request->getParameter('ids'); // initiate FPDI $pdf = new FPDI('P', 'pt'); // set the sourcefile $pdf->setSourceFile(sfConfig::get('sf_upload_dir') . '/badges/ID_new.pdf'); foreach ($ids as $id) { $this->employee = EmployeePeer::retrieveByPk($id); // import page 1 $tplIdx = $pdf->importPage(1); // add a new page based on size of the badge $s = $pdf->getTemplatesize($tplIdx); $pdf->AddPage('P', array($s['w'], $s['h'])); $pdf->useTemplate($tplIdx); $pdf->setMargins(0, 0, 0, 0); $pdf->SetAutoPageBreak(false); if ($this->employee->getPicture()) { $pdf->Image(sfConfig::get('sf_upload_dir') . '/' . sfConfig::get('app_employee_images_dir') . '/' . $this->employee->getPicture(), 29.5, 25.5, 60.3, 74.3); } else { $pdf->Image(sfConfig::get('sf_upload_dir') . '/badges/picture_missing.jpg', 29.5, 25.5, 60.3, 74.3); } // now write some text above the imported page $pdf->SetFont('freesans', 'B', 12); $pdf->SetTextColor(82, 78, 134); $pdf->SetXY(22, 110); $pdf->Cell(0, 12, $this->employee->getFullName()); $pdf->Ln(); $pdf->SetX(22); $pdf->SetFont('freesans', 'BI', 10); $pdf->Cell(0, 14, $this->employee->getJob()); $pdf->SetDisplayMode('real'); } return $pdf->Output('newpdf.pdf', 'D'); }
public function executeShowEmployee() { $employee = EmployeePeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($employee); $this->subtitle = $employee->toString() . ' - id:' . $employee->getId(); $c = new Criteria(); $c->add(EmployeeDetailPeer::EMPLOYEE_ID, $employee->getId()); $employee_detail = EmployeeDetailPeer::doSelectOne($c); $academic_calendar = AcademicCalendarPeer::retrieveByPk($this->getRequestParameter('accal_id')); $this->forward404Unless($academic_calendar); if ($academic_calendar->getCourseModel() == 'A') { $actions = array(array('name' => 'back', 'url' => 'employee_agenda/list', 'color' => 'black')); } else { $actions = array(array('name' => 'back', 'url' => 'employee_agenda/list2', 'color' => 'black')); } $this->actions = $actions; $this->employee = $employee; $this->employee_detail = $employee_detail; $this->academic_calendar = $academic_calendar; }
echo input_hidden_tag('student_id', $student_id); echo input_hidden_tag('employee_id', $employee_id); ?> <table class="form"> <tr><td class="form"> <table class="form_content" width="100%"> <tbody> <tr> <td class='first' width="20%" style="vertical-align:middle;"><label><?php echo __('Kepada'); ?> </label></td> <td class="first" width="2%" style="text-align:center; vertical-align:middle;">:</td> <td class="first" style="vertical-align:middle;"> <p class="detail"><?php echo $employee_id ? EmployeePeer::retrieveByPk($employee_id)->toString() : '-'; ?> </p> </td> </tr> <tr> <td style="vertical-align:middle;"><label ><?php echo __('Tanggal Kirim'); ?> </label></td> <td width="2%" style="text-align:center; vertical-align:middle;">:</td> <td style="vertical-align:middle;"> <?php echo object_input_date_tag($inbox, 'getCreatedAt', array('rich' => true, 'withtime' => true, 'calendar_button_img' => '/images/calendar.gif')); ?> <?php
public function executeShowEmployeeSched2() { $employee = EmployeePeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($employee); $this->subtitle = $employee->toString() . ' - id:' . $employee->getId(); $c = new Criteria(); $c->add(EmployeeDetailPeer::EMPLOYEE_ID, $employee->getId()); $employee_detail = EmployeeDetailPeer::doSelectOne($c); $actions = array(array('name' => 'back', 'url' => 'student_schedule/listSched2', 'color' => 'black')); $this->setTemplate('showEmployee'); $this->actions = $actions; $this->employee = $employee; $this->employee_detail = $employee_detail; }
public function executeCreate() { $employee = EmployeePeer::retrieveByPk($this->getRequestParameter('employee_id')); $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo'); $c = new Criteria(); $c->add(JobPeer::CODE, $this->getModuleName()); $job = JobPeer::doSelectOne($c); $acl = AclPeer::retrieveByPK($group_id, $job->getId()); if (!$acl) { $this->forward('default', 'error404'); } $this->can_add = $acl->getAddPriv() == 1; $this->can_edit = $acl->getEditPriv() == 1; $this->can_remove = $acl->getRemovePriv() == 1; $this->employee_detail = new EmployeeDetail(); $this->setTemplate('edit'); $this->actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value")), array('name' => 'cancel', 'url' => 'employee_detail/show?employee_id=' . $employee->getId(), 'color' => 'white')); $this->subtitle = $employee->toString(); $this->employee_detail->setEmployee($employee); $this->type = 'add'; }
public function executeEmployeeWorkload(sfWebRequest $request) { $this->form = new ReportWorkloadForm(); if ($request->isMethod('post') || $request->getParameter('employee_id')) { if ($request->isMethod('post')) { $form = $request->getParameter('workload'); $employee_id = $form['employee_id']; } else { $employee_id = $request->getParameter('employee_id'); } $this->employee = EmployeePeer::retrieveByPk($employee_id); $this->forward404Unless($this->employee); $this->current_services_total = 0; $this->future_services_total = 0; $this->current_services = ClientServicePeer::getActiveForEmployee($this->employee->getId()); foreach ($this->current_services as $current_service) { if ($frequency = $current_service->getFrequency()) { $this->current_services_total += $frequency->getWeeklyHours(); } } $this->future_services = ClientServicePeer::getUpcomingForEmployee($this->employee->getId()); foreach ($this->future_services as $future_service) { if ($frequency = $future_service->getFrequency()) { $this->future_services_total += $frequency->getWeeklyHours(); } } $this->setTemplate('employeeWorkloadReport'); } }
public function executeUpdateLector() { $lector = EmployeePeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($lector); $lector->setId($this->getRequestParameter('id')); if ($this->getRequestParameter('password')) { $crypted = sha1(sfConfig::get('app_salt') . $this->getRequestParameter('password')); if ($lector->getPassword() != $crypted && strlen($this->getRequestParameter('password')) > 0) { // password changed $lector->setPassword($crypted); } } $lector->save(); $this->getContext()->getUser()->signInLector($user); #$this->setTemplate('index'); #return; return $this->redirect('default/index'); }
public function executeUpdateEmployee() { $i18n = new sfI18N(); $i18n->initialize($this->getContext()); $i18n->setCulture($this->getUser()->getCulture()); $action_i18n = $i18n->globalMessageFormat->format('save as new'); $action_type = $this->getRequestParameter('action_type'); // add employee if ($action_type == $action_i18n || !$this->getRequestParameter('employee_id')) { $employee = new Employee(); } else { $employee = EmployeePeer::retrieveByPk($this->getRequestParameter('employee_id')); $this->forward404Unless($employee); } $employee->setId($this->getRequestParameter('id')); $employee->setName($this->getRequestParameter('name')); $employee->setDepartmentId($this->getRequestParameter('department_id')); $employee->setStaffTypeId($this->getRequestParameter('staff_type_id')); $employee->setEmpNo($this->getRequestParameter('emp_no')); $employee->setIsCounselor($this->getRequestParameter('is_counselor')); $employee->setIsThesisAdvisor($this->getRequestParameter('is_thesis_advisor')); $employee->setIsComprehensiveReviewer($this->getRequestParameter('is_comprehensive_reviewer')); $employee->setCode($this->getRequestParameter('code')); $employee->save(); if ($this->getRequestParameter('password') != null && strlen($this->getRequestParameter('password')) > 0) { // password set $crypted = sha1(sfConfig::get('app_salt') . $this->getRequestParameter('password')); if ($employee->getPassword() != $crypted && strlen($this->getRequestParameter('password')) > 0) { // password changed $employee->setPassword($crypted); } } elseif ($employee->getPassword() == null || $employee->getPassword() == '') { // create $crypted = sha1(sfConfig::get('app_salt') . $employee->getEmpNo()); $employee->setPassword($crypted); } $employee->save(); // add employee_detail if ($action_type == $action_i18n || !$this->getRequestParameter('employee_detail_id')) { $employee_detail = new EmployeeDetail(); } else { $employee_detail = EmployeeDetailPeer::retrieveByPk($this->getRequestParameter('employee_detail_id')); $this->forward404Unless($employee_detail); } $employee_detail->setId($this->getRequestParameter('id')); $employee_detail->setEmployee($employee); if ($this->getRequestParameter('date_in')) { $employee_detail->setDateIn($this->getRequestParameter('date_in')); } if ($this->getRequestParameter('date_out')) { $employee_detail->setDateOut($this->getRequestParameter('date_out')); } $employee_detail->setNickname($this->getRequestParameter('nickname')); $employee_detail->setSex($this->getRequestParameter('sex')); $employee_detail->setPob($this->getRequestParameter('pob')); if ($this->getRequestParameter('dob')) { $employee_detail->setDob($this->getRequestParameter('dob')); } $employee_detail->setReligionId($this->getRequestParameter('religion_id')); $employee_detail->setNationality($this->getRequestParameter('nationality')); $employee_detail->setStatusInFamily($this->getRequestParameter('status_in_family')); $employee_detail->setMotherLanguage($this->getRequestParameter('mother_language')); $employee_detail->setHobby($this->getRequestParameter('hobby')); $employee_detail->setAddress($this->getRequestParameter('address')); $employee_detail->setPhone($this->getRequestParameter('phone')); $employee_detail->setResidenceStatus($this->getRequestParameter('residence_status')); $employee_detail->setVehicle($this->getRequestParameter('vehicle')); $employee_detail->setWorkplaceDistance($this->getRequestParameter('workplace_distance')); $employee_detail->setLastEducation($this->getRequestParameter('last_education')); $employee_detail->setGraduationYear($this->getRequestParameter('graduation_year')); $employee_detail->setCertificateNumber($this->getRequestParameter('certificate_number')); $employee_detail->setFaculty($this->getRequestParameter('faculty')); $employee_detail->setProgram($this->getRequestParameter('program')); $employee_detail->setMayor($this->getRequestParameter('mayor')); $employee_detail->setTeachingLicense($this->getRequestParameter('teaching_license')); $employee_detail->setMaritalStatus($this->getRequestParameter('marital_status')); $employee_detail->setSpouseName($this->getRequestParameter('spouse_name')); $employee_detail->setBloodType($this->getRequestParameter('blood_type')); $employee_detail->setSpousePob($this->getRequestParameter('spouse_pob')); if ($this->getRequestParameter('spouse_dob')) { $employee_detail->setSpouseDob($this->getRequestParameter('spouse_dob')); } $employee_detail->setSpouseEducation($this->getRequestParameter('spouse_education')); $employee_detail->setSpouseReligionId($this->getRequestParameter('spouse_religion_id')); $employee_detail->setNumberOfChild($this->getRequestParameter('number_of_child')); $employee_detail->setChild1Name($this->getRequestParameter('child1_name')); $employee_detail->setChild2Name($this->getRequestParameter('child2_name')); $employee_detail->setTall($this->getRequestParameter('tall')); $employee_detail->setWeight($this->getRequestParameter('weight')); $employee_detail->setIllness($this->getRequestParameter('illness')); $employee_detail->save(); if ($action_type == $action_i18n || !$this->getRequestParameter('id')) { $member = new Member(); } else { $member = MemberPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($member); } $member->setId($this->getRequestParameter('id')); $member->setEmployeeDetail($employee_detail); $member->setCode($this->getRequestParameter('code')); $member->setNoReg($this->getRequestParameter('no_reg')); $member->setName($this->getRequestParameter('name')); $member->setClassName($this->getRequestParameter('class_name')); $member->setDepartmentId($this->getRequestParameter('department_id')); $member->setStaffTypeId($this->getRequestParameter('staff_type_id')); $member->setEmpNo($this->getRequestParameter('emp_no')); $member->setIsCounselor($this->getRequestParameter('is_counselor')); $member->setIsThesisAdvisor($this->getRequestParameter('is_thesis_advisor')); $member->setIsComprehensiveReviewer($this->getRequestParameter('is_comprehensive_reviewer')); $old_status = $member->getStatus(); $member->setStatus($this->getRequestParameter('status')); $member->setType('2'); // $member->setMemberDetail($member_detail); // fd3cf92194f1a6b8b5fa60a1aba8129c1753d6e2 = admin if ($this->getRequestParameter('password') != null && strlen($this->getRequestParameter('password')) > 0) { // password set $crypted = sha1(sfConfig::get('app_salt') . $this->getRequestParameter('password')); if ($member->getPassword() != $crypted && strlen($this->getRequestParameter('password')) > 0) { // password changed $member->setPassword($crypted); } } elseif ($member->getPassword() == null || $member->getPassword() == '') { // create $crypted = sha1(sfConfig::get('app_salt') . $this->getRequestParameter('code') . $member_detail->getDob('dm')); $member->setPassword($crypted); } #$member->setEmployeeDetail($employee_detail); $member->save(); // save member photo $photo_dir = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'photos' . DIRECTORY_SEPARATOR; if ($this->hasRequestParameter('photoFile') && $this->getRequestParameter('photoFile') != '' && $this->getRequestParameter('photoFile') != null) { // get photo content $photo_file = $photo_dir . 'tmp' . DIRECTORY_SEPARATOR . $this->getRequestParameter('photoFile'); $content = file_get_contents($photo_file); $im = imagecreatefromstring($content); list($w, $h) = getimagesize($photo_file); // generate photo $photo = imagecreatetruecolor(150, 200); imagecopyresized($photo, $im, 0, 0, 0, 0, 150, 200, $w, $h); // generate thumbnail $thumb = imagecreatetruecolor(100, 150); imagecopyresized($thumb, $im, 0, 0, 0, 0, 100, 150, $w, $h); // get photo record $c = new Criteria(); $c->add(MemberPhotoPeer::MEMBER_ID, $member->getId()); $member_photo = MemberPhotoPeer::doSelectOne($c); if ($member_photo == null) { $member_photo = new MemberPhoto(); $member_photo->setMember($member); } // save photo imagepng($photo, $photo_file); $member_photo->setPhoto(base64_encode(file_get_contents($photo_file))); imagepng($thumb, $photo_file); $member_photo->setThumbnail(base64_encode(file_get_contents($photo_file))); $member_photo->save(); unlink($photo_dir . 'tmp' . DIRECTORY_SEPARATOR . $this->getRequestParameter('photoFile')); } // save Employee photo $photo_dir = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'photos' . DIRECTORY_SEPARATOR; if ($this->hasRequestParameter('photoFile') && $this->getRequestParameter('photoFile') != '' && $this->getRequestParameter('photoFile') != null) { // get photo content $photo_file = $photo_dir . 'tmp' . DIRECTORY_SEPARATOR . $this->getRequestParameter('photoFile'); $content = file_get_contents($photo_file); $im = imagecreatefromstring($content); list($w, $h) = getimagesize($photo_file); // generate photo $photo = imagecreatetruecolor(150, 195); imagecopyresized($photo, $im, 0, 0, 0, 0, 150, 195, $w, $h); // generate thumbnail $thumb = imagecreatetruecolor(100, 130); imagecopyresized($thumb, $im, 0, 0, 0, 0, 100, 130, $w, $h); // get photo record $c = new Criteria(); $c->add(EmployeePhotoPeer::EMPLOYEE_ID, $employee_detail->getEmployeeId()); $employee_photo = EmployeePhotoPeer::doSelectOne($c); if ($employee_photo == null) { $employee_photo = new EmployeePhoto(); $employee_photo->setEmployee($employee_detail->getEmployee()); } // save photo imagepng($photo, $photo_file); $employee_photo->setPhoto(base64_encode(file_get_contents($photo_file))); imagepng($thumb, $photo_file); $employee_photo->setThumbnail(base64_encode(file_get_contents($photo_file))); $employee_photo->save(); unlink($photo_dir . 'tmp' . DIRECTORY_SEPARATOR . $this->getRequestParameter('photoFile')); } if ($this->hasRequestParameter('filter_noreg') && $this->getRequestParameter('filter_noreg') != '' && $this->getRequestParameter('filter_noreg') != null) { return $this->redirect('member/listEmployee?filters[NO_REG]=' . $this->getRequestParameter('no_reg')); } elseif ($this->hasRequestParameter('filter_code') && $this->getRequestParameter('filter_code') != '' && $this->getRequestParameter('filter_code') != null) { return $this->redirect('member/listEmployee?filters[CODE]=' . $this->getRequestParameter('filter_code')); } elseif ($this->hasRequestParameter('filter_deptid') && $this->getRequestParameter('filter_deptid') != '' && $this->getRequestParameter('filter_deptid') != null) { return $this->redirect('member/listEmployee?filters[DEPARTMENT_ID]=' . $this->getRequestParameter('filter_deptid')); } elseif ($this->hasRequestParameter('filter_stafftype') && $this->getRequestParameter('filter_stafftype') != '' && $this->getRequestParameter('filter_stafftype') != null) { return $this->redirect('member/listEmployee?filters[STAFF_TYPE_ID]=' . $this->getRequestParameter('filter_stafftype')); } elseif ($this->hasRequestParameter('filter_name') && $this->getRequestParameter('filter_name') != '' && $this->getRequestParameter('filter_name') != null) { return $this->redirect('member/listEmployee?filters[NAME]=' . $this->getRequestParameter('name')); } else { return $this->redirect('member/listEmployee'); } }
public function executeShowEmployee() { $counseling_id = $this->getRequestParameter('counseling_id'); $counseling = CounselingPeer::retrieveByPK($counseling_id); $this->forward404Unless($counseling); $accal_id = $this->getRequestParameter('accal_id'); $academic_calendar = AcademicCalendarPeer::retrieveByPK($accal_id); $this->forward404Unless($academic_calendar); $employee = EmployeePeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($employee); $this->subtitle = $employee->toString() . ' - id:' . $employee->getId(); $c = new Criteria(); $c->add(EmployeeDetailPeer::EMPLOYEE_ID, $employee->getId()); $employee_detail = EmployeeDetailPeer::doSelectOne($c); $student_id = $this->getRequestParameter('student_id'); $student = StudentPeer::retrieveByPK($this->getRequestParameter('student_id')); $this->forward404Unless($student); $actions = array(array('name' => 'back', 'url' => 'counseling_detail/listEkskul?student_id=' . $student->getId() . '&counseling_id=' . $counseling->getId() . '&accal_id=' . $academic_calendar->getId(), 'color' => 'black')); $this->actions = $actions; $this->counseling = $counseling; $this->counseling_id = $counseling_id; $this->student = $student; $this->employee = $employee; $this->employee_detail = $employee_detail; $this->academic_calendar = $academic_calendar; }
public function executeShowEmployee() { $student_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo'); $student = StudentPeer::retrieveByPK($student_id); $this->forward404Unless($student); $employee = EmployeePeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($employee); $academic_calendar = AcademicCalendarPeer::retrieveByPk($this->getRequestParameter('accal_id')); $this->forward404Unless($academic_calendar); $this->subtitle = $employee->toString() . ' - id:' . $employee->getId(); $c = new Criteria(); $c->add(EmployeeDetailPeer::EMPLOYEE_ID, $employee->getId()); $employee_detail = EmployeeDetailPeer::doSelectOne($c); $actions = array(); $this->actions = $actions; if ($academic_calendar->getCourseModel() == 'A') { $actions2 = array(array('name' => '<span>Semester 1 ' . $academic_calendar->getParentName() . '</span>', 'url' => 'student_ekskul/list', 'color' => 'sun')); } else { $actions2 = array(array('name' => '<span>Semester 2 ' . $academic_calendar->getParentName() . '</span>', 'url' => 'student_ekskul/list2', 'color' => 'sun')); } array_push($actions2, array('name' => '<span>Detail Pembina / Pendamping</span>', 'url' => 'student_ekskul/showEmployee?id=' . $employee->getId() . '&accal_id=' . $academic_calendar->getId(), 'color' => 'sun', 'type' => 'direct')); $this->actions2 = $actions2; $this->student = $student; $this->employee = $employee; $this->employee_detail = $employee_detail; }
public function executeListCourse() { $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo'); $c = new Criteria(); $c->add(JobPeer::CODE, 'course_schedule/listCourse'); $job = JobPeer::doSelectOne($c); $acl = AclPeer::retrieveByPK($group_id, $job->getId()); if (!$acl) { $this->forward('default', 'error404'); } $this->can_edit = $acl->getEditPriv() == 1; $this->can_remove = $acl->getRemovePriv() == 1; $c = new Criteria(); $dept = $this->getContext()->getUser()->getAttribute('department', null, 'bo'); $c->add(CurriculumPeer::DEPARTMENT_ID, $dept->getChildRecurs(), Criteria::IN); $c->addJoin(SubjectCurrPeer::CURRICULUM_ID, CurriculumPeer::ID); $c->addJoin(VCoursePeer::SUBJECT_CURR_ID, SubjectCurrPeer::ID); $subject_curr = SubjectCurrPeer::retrieveByPk($this->getRequestParameter('subject_curr_id')); if ($subject_curr) { $c->add(VCoursePeer::SUBJECT_CURR_ID, $subject_curr->getId()); } $class_group = ClassGroupPeer::retrieveByPk($this->getRequestParameter('class_group_id')); if ($class_group) { $c->add(VCoursePeer::CLASS_GROUP_ID, $class_group->getId()); } $this->subtitle = ''; if (sfContext::getInstance()->getUser()->getAttribute('usertype', null, 'bo') == 'lector') { $emp_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo'); $emp = EmployeePeer::retrieveByPk($emp_id); $this->forward404Unless($emp); $c->add(VCoursePeer::EMPLOYEE_ID, $emp_id); $this->subtitle = $emp->toString(); } $this->sort($c); if ($this->getRequest()->hasParameter('filters')) { $filters = $this->getRequestParameter('filters'); if ($filters == 'clear') { $this->filters = null; } else { $defined_filter = false; foreach ($filters as $f) { if (is_array($f)) { if (strlen($f['from']) > 0 || strlen($f['to']) > 0) { $defined_filter = true; break; } } else { if ($f != null && $f != '') { $defined_filter = true; break; } } } if ($defined_filter) { $this->filters = $filters; $this->filter($c, $this->getRequestParameter('filters')); } } } $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'course_schedule')); $this->getUser()->setAttribute('max_per_page', $rpp, 'course_schedule'); $pager = new sfPropelPager('VCourse', $rpp); $pager->setCriteria($c); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'course_schedule')); $this->getUser()->setAttribute('page', $page, 'course_schedule'); $pager->setPage($page); $pager->init(); $this->pager = $pager; $actions2 = array(array('name' => 'filter', 'color' => 'white')); #if ($acl->getAddPriv()) array_unshift($actions, array('name'=>'add','url'=>'student/create', 'color'=>'green')); $this->setTemplate('listCourse'); $this->actions2 = $actions2; }
?> <table class="form"> <tr><td class="form"> <table class="form_content" width="100%"> <tbody> <tr> <td class='first' width="20%" style="vertical-align:middle;"><label><?php echo __('Kepada'); ?> </label></td> <td class="first" width="2%" style="text-align:center; vertical-align:middle;">:</td> <td class="first" style="vertical-align:middle;"> <?php echo object_input_hidden_tag($inbox, 'getEmployeeId'); if (isset($inbox) && $inbox->getId()) { echo input_auto_complete_tag('name', $inbox->getEmployeeId() ? EmployeePeer::retrieveByPk($inbox->getEmployeeId())->toString() : '', '/inbox/getListEmployee', array('size' => 70), array('after_update_element' => 'function(f, s) {$("employee_id").updateFromInformalAutocomplete(f, s);}', 'min_chars' => 1)); } else { echo input_auto_complete_tag('name', null, '/inbox/getListEmployee', array('size' => 70), array('after_update_element' => 'function(f, s) {$("employee_id").updateFromInformalAutocomplete(f, s);}', 'min_chars' => 1)); } ?> <?php echo form_error('employee_id'); ?> </td> </tr> <tr> <td style="vertical-align:middle;"><label ><?php echo __('Tanggal Kirim'); ?> </label></td>
public function executeShowEmployee() { $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo'); $c = new Criteria(); $c->add(JobPeer::CODE, 'sm_book/listEmployee'); $job = JobPeer::doSelectOne($c); $acl = AclPeer::retrieveByPK($group_id, $job->getId()); if (!$acl) { $this->forward('default', 'error404'); } $employee = EmployeePeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($employee); $this->subtitle = $employee->toString() . ' - id:' . $employee->getId(); $c = new Criteria(); $c->add(EmployeeDetailPeer::EMPLOYEE_ID, $employee->getId()); $employee_detail = EmployeeDetailPeer::doSelectOne($c); $actions = array(array('name' => 'back', 'url' => 'sm_book/listEmployee', 'color' => 'black')); $this->actions = $actions; $this->employee = $employee; $this->employee_detail = $employee_detail; }
public function executeShowEmployee() { $employee = EmployeePeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($employee); $this->subtitle = $employee->toString() . ' - id:' . $employee->getId(); $c = new Criteria(); $c->add(EmployeeDetailPeer::EMPLOYEE_ID, $employee->getId()); $employee_detail = EmployeeDetailPeer::doSelectOne($c); $course_schedule = CourseSchedulePeer::retrieveByPk($this->getRequestParameter('course_id')); $this->forward404Unless($course_schedule); $actions2 = array(array('name' => '<span>Detail Guru</span>', 'url' => 'student_agenda/showEmployee?id=' . $employee->getId() . '&course_id=' . $course_schedule->getId(), 'color' => 'sun', 'type' => 'direct')); if ($course_schedule->getAcademicCalendar()->getCourseModel() == 'A') { array_unshift($actions2, array('name' => '<span>' . $course_schedule->getAcademicCalendar()->getName() . '</span>', 'url' => 'student_agenda/list', 'color' => 'sky')); } else { array_unshift($actions2, array('name' => '<span>' . $course_schedule->getAcademicCalendar()->getName() . '</span>', 'url' => 'student_agenda/list2', 'color' => 'sky')); } $this->actions = array(); $this->actions2 = $actions2; $this->employee = $employee; $this->employee_detail = $employee_detail; $this->course_schedule = $course_schedule; }
public function executeSidebarEdit(sfWebRequest $request) { $this->employee = EmployeePeer::retrieveByPk($request->getParameter('id')); }
public static function UpdateEmployeeGrade($employee_id) { $employee = EmployeePeer::retrieveByPk($employee_id); /*$c = new Criteria(); $c->add(EmployeeGradePeer::COMPANY_ID,sfContext::getInstance()->getUser()->getAttribute('COMPANY_ID')); $c->add(EmployeeGradePeer::STATUS,Constant::RECORD_STATUS_ACTIVE); $c->add(EmployeeGradePeer::MIN_VALUE, round ($employee->getRating(),Constant::ROUND_RATING),Criteria::LESS_EQUAL); $c->add(EmployeeGradePeer::MAX_VALUE, round ($employee->getRating(), Constant::ROUND_RATING),Criteria::GREATER_EQUAL); $grade = EmployeeGradePeer::doSelectOne($c); if($grade) $grade_id = $grade->getId(); else $grade_id = NULL;*/ $connection = Propel::getConnection(); $rating = round($employee->getRating(), Constant::ROUND_RATING); $query = 'SELECT * FROM %s where company_id = %s and status = %s and ' . $rating . ' >= %s and ' . $rating . ' <= %s'; $query = sprintf($query, EmployeeGradePeer::TABLE_NAME, $employee->getCompanyId(), Constant::RECORD_STATUS_ACTIVE, EmployeeGradePeer::MIN_VALUE, EmployeeGradePeer::MAX_VALUE); $statement = $connection->prepare($query); $statement->execute(); $grade = $statement->fetch(PDO::FETCH_OBJ); if ($grade) { $grade_id = $grade->id; } else { $grade_id = NULL; } //now save employee object wicth calculated grade and rating $employee->setGradeId($grade_id); $employee->save(); }
public function executeCheckup(sfWebRequest $request) { if ($request->isMethod('POST')) { $visit_id = $this->getRequestParameter('visit_id'); $patient_id = $this->getRequestParameter('patient_id'); $meds = $this->getRequestParameter('med'); $dose = $this->getRequestParameter('dose'); $quantity = $this->getRequestParameter('quantity'); $tests = $this->getRequestParameter('test'); $total_cost = 0; //Saving Medicines for Current Visit foreach ($meds as $i => $med) { $pharma = PharmaPeer::retrieveByPk($med[0]); $med_price = $pharma->getPrice(); $visit_med = new VisitMedicine(); $visit_med->setPatientId($patient_id); $visit_med->setVisitId($visit_id); $visit_med->setPharmaId($med[0]); $visit_med->setDosageId($dose[$i]); $visit_med->setQuantity($quantity[$i]); $visit_med->setPrice($quantity[$i] * $med_price); $visit_med->save(); $total_cost = $quantity[$i] * $med_price + $total_cost; } //Saving Lab Tests for Current Visit foreach ($tests as $j => $test) { $lab_test = LabTestPeer::retrieveByPk($test[0]); $test_price = $lab_test->getPrice(); $visit_test = new LabReport(); $visit_test->setPatientId($patient_id); $visit_test->setVisitId($visit_id); $visit_test->setLabTestId($test[0]); $visit_test->setPrice($test_price); $visit_test->setStatus(Constant::RECORD_STATUS_ACTIVE); $visit_test->save(); $total_cost = $test_price + $total_cost; } //Saving Current Visit $visit = VisitPeer::retrieveByPk($visit_id); $doc_id = $visit->getDoctorId(); $doc = EmployeePeer::retrieveByPk($doc_id); $doc_fee = $doc->getVisitFee(); $total_cost = $total_cost + $doc_fee; $visit->setBp($this->getRequestParameter('bp')); $visit->setPulse($this->getRequestParameter('pulse')); $visit->setTemp($this->getRequestParameter('temp')); $visit->setDiet($this->getRequestParameter('diet')); $visit->setDescription($this->getRequestParameter('description')); $visit->setFee($total_cost); $visit->setFeePaid(Constant::VISIT_FEE_NOT_PAID); $visit->setStatus(Constant::VISIT_DONE); $visit->save(); $this->getUser()->setFlash('SUCCESS_MESSAGE', 'Patient Visit saves Successfully'); $this->redirect('Visit/docList'); } else { $patient_id = Utility::DecryptQueryString($request->getParameter('patient')); $visit_id = Utility::DecryptQueryString($request->getParameter('visit')); $this->patient = PatientPeer::retrieveByPk($patient_id); $this->visit = VisitPeer::retrieveByPk($visit_id); $c = new Criteria(); $c->add(PharmaPeer::STATUS, Constant::RECORD_STATUS_ACTIVE); $c->addAscendingOrderByColumn(PharmaPeer::NAME); $this->medicines = PharmaPeer::doSelect($c); $d = new Criteria(); $d->add(LabTestPeer::STATUS, Constant::RECORD_STATUS_ACTIVE); $d->addAscendingOrderByColumn(LabTestPeer::TITLE); $this->tests = LabTestPeer::doSelect($d); } }
public function executeCreate() { $employee = EmployeePeer::retrieveByPk($this->getRequestParameter('employee_id')); $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo'); $usertype = $this->getContext()->getUser()->getAttribute('usertype', null, 'bo'); $jobtemplate = $this->getContext()->getUser()->getAttribute('job_template_id', null, 'bo'); if ($jobtemplate == 1) { $c = new Criteria(); $c->add(JobPeer::CODE, $this->getModuleName()); $job = JobPeer::doSelectOne($c); $acl = AclPeer::retrieveByPK($group_id, $job->getId()); if (!$acl) { $this->forward('default', 'error404'); } $this->can_add = $acl->getAddPriv() == 1; $this->can_edit = $acl->getEditPriv() == 1; $this->can_remove = $acl->getRemovePriv() == 1; $byEmployee = false; } else { $c = new Criteria(); $c->add(JobPeer::CODE, 'employee_leave_l'); $job = JobPeer::doSelectOne($c); $acl = AclPeer::retrieveByPK($group_id, $job->getId()); if (!$acl) { $this->forward('default', 'error404'); } $this->can_add = $acl->getAddPriv() == 1; $this->can_edit = $acl->getEditPriv() == 1; $this->can_remove = $acl->getRemovePriv() == 1; $byEmployee = true; } $this->employee_leave = new EmployeeLeave(); $this->setTemplate('edit'); $this->actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value")), array('name' => 'cancel', 'url' => 'employee_leave/list?employee_id=' . $employee->getId(), 'color' => 'white')); $this->subtitle = $employee->toString(); $this->employee_leave->setEmployeeId($employee->getId()); $this->type = 'add'; if ($byEmployee == false) { $actions2 = array(array('name' => '<span>Catatan Kepegawaian</span>', 'url' => 'employee_list/list', 'color' => 'sky')); array_push($actions2, array('name' => '<span>Mutasi Jabatan</span>', 'url' => 'employee_job_history/list?employee_id=' . $employee->getId(), 'color' => 'sky')); array_push($actions2, array('name' => '<span>Absensi Pegawai</span>', 'url' => 'employee_absence/list?employee_id=' . $employee->getId(), 'color' => 'sky')); array_push($actions2, array('name' => '<span>Administrasi Cuti</span>', 'url' => 'employee_leave/list?employee_id=' . $employee->getId(), 'color' => 'sun', 'type' => 'direct')); array_push($actions2, array('name' => '<span>Administrasi Izin</span>', 'url' => 'employee_permit/list?employee_id=' . $employee->getId(), 'color' => 'sky')); array_push($actions2, array('name' => '<span>Administrasi Pengobatan</span>', 'url' => 'employee_medical/list?employee_id=' . $employee->getId(), 'color' => 'sky')); array_push($actions2, array('name' => '<span>Gaji Pegawai</span>', 'url' => 'employee_salary/list?employee_id=' . $employee->getId(), 'color' => 'sky')); $this->actions2 = $actions2; } $this->byEmployee = $byEmployee; }
public function executeDeleteByEmployee() { $employee_id = $this->getRequestParameter('employee_id'); $employee = EmployeePeer::retrieveByPk($employee_id); $this->forward404Unless($employee); $outbox = InboxPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($outbox); $outbox->delete(); return $this->redirect('outbox/byEmployee?employee_id=' . $employee->getId()); }
public function quickSave($aData) { if (isset($aData['app_msg_uid'])) { $o = EmployeePeer::retrieveByPk($aData['app_msg_uid']); } if (isset($o) && is_object($o) && get_class($o) == 'AppMessage') { $o->fromArray($aData, BasePeer::TYPE_FIELDNAME); $o->setAppMsgDate(date('Y-m-d H:i:s')); $o->save(); return $o->getAppMsgUid(); } else { $this->fromArray($aData, BasePeer::TYPE_FIELDNAME); $this->setAppMsgDate(date('Y-m-d H:i:s')); $this->save(); return $this->getAppMsgUid(); } }
public function executeGiveCredential(sfWebRequest $request) { if ($request->isMethod('Post')) { $password = md5($this->getRequestParameter('password')); $user = new User(); $user->setEmployeeId($this->getRequestParameter('employee_id')); $user->setUser($this->getRequestParameter('user_name')); $user->setPassword($password); $user->setRoleId($this->getRequestParameter('role_id')); $user->setStatus(Constant::RECORD_STATUS_ACTIVE); $user->save(); $this->getUser()->setFlash('SUCCESS_MESSAGE', 'Credentials Assigned Successfully.'); $this->redirect('Employee/detail?employee=' . Utility::EncryptQueryString($this->getRequestParameter('employee_id'))); } else { $this->employee = EmployeePeer::retrieveByPk(Utility::DecryptQueryString($request->getParameter('employee'))); } }