Пример #1
0
 public static function doSelectOrdered()
 {
     $criteria = new Criteria();
     $criteria->addAscendingOrderByColumn(EmployeePeer::EMP_NO);
     $criteria->addAscendingOrderByColumn(EmployeePeer::NAME);
     return EmployeePeer::doSelect($criteria);
 }
Пример #2
0
 public function configure()
 {
     $years = range(date('Y') - 100, date('Y') + 5);
     //Creates array of years between 1920-2000
     $years_list = array_reverse(array_combine($years, $years), true);
     //Creates new array where key and value are both values from $years list
     sfProjectConfiguration::getActive()->loadHelpers('Global');
     unset($this['created_at'], $this['updated_at'], $this['clearance'], $this['keys_returned'], $this['email_removed'], $this['server_removed'], $this['dist_list_removed']);
     $this->widgetSchema['dob'] = new sfWidgetFormJQueryDate(array('years' => $years_list, 'image' => '/images/calendar.png', 'config' => '{changeYear:true, yearRange: \'1920:2009\'}'), array('class' => 'date'));
     $this->widgetSchema['license_expiration'] = new sfWidgetFormJQueryDate(array('years' => $years_list, 'image' => '/images/calendar.png', 'image' => '/images/calendar.png', 'config' => '{}'), array('class' => 'date'));
     $this->widgetSchema['doh'] = new sfWidgetFormJQueryDate(array('years' => $years_list, 'image' => '/images/calendar.png', 'config' => '{}'), array('class' => 'date'));
     $this->widgetSchema['physical_date'] = new sfWidgetFormJQueryDate(array('years' => $years_list, 'image' => '/images/calendar.png', 'config' => '{}'), array('class' => 'date'));
     $this->widgetSchema['tb_date'] = new sfWidgetFormJQueryDate(array('years' => $years_list, 'image' => '/images/calendar.png', 'config' => '{}'), array('class' => 'date'));
     $this->widgetSchema['osha_date'] = new sfWidgetFormJQueryDate(array('years' => $years_list, 'image' => '/images/calendar.png', 'config' => '{}'), array('class' => 'date'));
     $this->widgetSchema['cpr_date'] = new sfWidgetFormJQueryDate(array('years' => $years_list, 'image' => '/images/calendar.png', 'config' => '{}'), array('class' => 'date'));
     $this->widgetSchema['dof'] = new sfWidgetFormJQueryDate(array('years' => $years_list, 'image' => '/images/calendar.png', 'config' => '{}'), array('class' => 'date'));
     $this->widgetSchema['tc_effective'] = new sfWidgetFormJQueryDate(array('years' => $years_list, 'image' => '/images/calendar.png', 'config' => '{}'), array('class' => 'date'));
     $this->widgetSchema['tc_exp'] = new sfWidgetFormJQueryDate(array('years' => $years_list, 'image' => '/images/calendar.png', 'config' => '{}'), array('class' => 'date'));
     $this->widgetSchema['tc_type'] = new sfWidgetFormChoice(array('expanded' => false, 'multiple' => false, 'choices' => EmployeePeer::getTcTypeOptions()));
     $this->validatorSchema['tc_type'] = new sfValidatorChoice(array('required' => false, 'multiple' => false, 'choices' => array_keys(EmployeePeer::getTcTypeOptions())));
     $this->widgetSchema['employee_to_location_list']->setOption('expanded', true);
     $this->widgetSchema['employee_finger_to_location_list']->setOption('expanded', true);
     $this->widgetSchema['tc_type']->setLabel('Teacher Cert. Type');
     $this->widgetSchema['tc_effective']->setLabel('Teacher Cert. Effective');
     $this->widgetSchema['tc_number']->setLabel('Teacher Cert. Number');
     $this->widgetSchema['tc_exp']->setLabel('Cert. Through (expires)');
     $this->widgetSchema['has_dist_list']->setLabel('On distribution list');
     // $this->widgetSchema['clearance']->setLabel('SCR Clearance');
     $this->widgetSchema['first_name']->setLabel('First Name');
     $this->widgetSchema['last_name']->setLabel('Last Name');
     $this->widgetSchema['job_id']->setLabel('Job Title');
     $this->widgetSchema['home_phone']->setLabel('Home Phone');
     $this->widgetSchema['cell_phone']->setLabel('Cell Phone');
     $this->widgetSchema['company_email']->setLabel('Company Email');
     $this->widgetSchema['personal_email']->setLabel('Personal Email');
     $this->widgetSchema['zip']->setLabel('ZIP');
     $this->widgetSchema['ssn']->setLabel('SSN');
     $this->widgetSchema['npi']->setLabel('NPI');
     $this->widgetSchema['doh']->setLabel('Date of Hire');
     $this->widgetSchema['dof']->setLabel('Date of Termination');
     $this->widgetSchema['dob']->setLabel('DOB');
     $this->widgetSchema['license_number']->setLabel('License Number');
     $this->widgetSchema['license_expiration']->setLabel('License Expires');
     $this->widgetSchema['physical_date']->setLabel('Physical Expiration Date');
     $this->widgetSchema['physical_notes']->setLabel('Physical Notes');
     $this->widgetSchema['tb_date']->setLabel('TB Expiration Date');
     $this->widgetSchema['tb_notes']->setLabel('TB Notes');
     $this->widgetSchema['osha_date']->setLabel('OSHA Expiration Date');
     $this->widgetSchema['cpr_date']->setLabel('CPR Expiration Date');
     $this->widgetSchema['suplimental_health']->setLabel('Supplemental health');
     $this->widgetSchema['employee_finger_to_location_list']->setLabel('Fingerprints');
     $this->widgetSchema['finger_print_notes']->setLabel('Fingerprint Notes');
     $this->widgetSchema['employee_to_location_list']->setLabel('SCR Clearance');
     $this->widgetSchema['picture'] = new sfWidgetFormInputFileEditable(array('label' => 'Picture', 'file_src' => '/uploads/' . sfConfig::get('app_employee_images_dir', 'employee') . '/' . $this->getObject()->getPicture(), 'is_image' => false, 'edit_mode' => !$this->isNew(), 'template' => '<div><label>Delete the picture?</label> %delete%<br /><label>New Picture</label> %input%</div>'));
     $this->validatorSchema['picture'] = new sfValidatorFile();
     $this->validatorSchema['picture']->setOption('required', false);
     $this->validatorSchema['picture_delete'] = new sfValidatorBoolean();
 }
Пример #3
0
 public function getSpecial()
 {
     $c = new Criteria();
     $cton1 = $c->getNewCriterion(EmployeePeer::STAFF_TYPE_ID, 13);
     $cton2 = $c->getNewCriterion(EmployeePeer::STAFF_TYPE_ID, 14);
     $cton1->addOr($cton2);
     $c->add($cton1);
     $special = EmployeePeer::doSelectOne($c);
     return $special;
 }
Пример #4
0
 /**
  * Returns the TC type index from a string value
  *
  * @param string $value
  * @return integer $index
  */
 public static function getTcTypeFromValue($value)
 {
     if (!self::$TC_TYPE_VALUES) {
         self::$TC_TYPE_VALUES = array_flip(self::$TC_TYPE_INTEGERS);
     }
     $values = strtolower($value);
     if (!isset(self::$TC_TYPE_VALUES[$value])) {
         throw new PropelException(sprintf('TC type cannot take "%s" as a value', $value));
     }
     return self::$TC_TYPE_VALUES[strtolower($value)];
 }
Пример #5
0
 public static function GetStaff()
 {
     $c = new Criteria();
     $c->add(EmployeePeer::STATUS, Constant::RECORD_STATUS_ACTIVE);
     $c->add(EmployeePeer::EMP_CATEGORY, 'staff');
     $employees = EmployeePeer::doSelect($c);
     if ($employees) {
         return $employees;
     } else {
         return false;
     }
 }
Пример #6
0
 public function configure()
 {
     unset($this['note_entry_id']);
     $this->widgetSchema['delete'] = new sfWidgetFormInputHidden(array('default' => '0'));
     $this->validatorSchema['delete'] = new sfValidatorBoolean();
     $employee = EmployeePeer::retrieveByPK($this->getOption('employee_id'));
     $c = new Criteria();
     $c->add(AreaOfConcernPeer::JOB_ID, $employee->getJobId());
     // if job_id = special instruction (7), they also need to see speech (8)
     if ($employee->getJobId() == 7) {
         $c->addOr(AreaOfConcernPeer::JOB_ID, 8);
     }
     $this->widgetSchema['area_of_concern_id']->setOption('criteria', $c);
     $c = new Criteria();
     $c->add(PromptPeer::ID, 44, Criteria::GREATER_EQUAL);
     $this->widgetSchema['prompt_id']->setOption('criteria', $c);
     $this->widgetSchema['accuracy'] = new sfWidgetFormSelect(array('choices' => EntryConcernPeer::getAccuracyChoices()));
     $this->widgetSchema->setLabels(array('area_of_concern_id' => 'Area of concern', 'objective_id' => 'Objective', 'prompt_id' => 'Prompt', 'level_id' => 'Level', 'accuracy' => 'Accuracy'));
 }
Пример #7
0
 public function executeChartEmployees()
 {
     $data = array();
     foreach (JobPeer::doSelect(new Criteria()) as $job) {
         $c = new Criteria();
         $c->add(EmployeePeer::JOB_ID, $job->getId());
         $data[$job->getName()] = EmployeePeer::doCount($c);
     }
     //To create a bar chart we need to create a stBarOutline Object
     $bar = new stBarOutline(80, '#78B9EC', '#3495FE');
     $bar->key('', 10);
     //Passing the random data to bar chart
     $bar->data = $data;
     //Creating a stGraph object
     $g = new stGraph();
     $g->title('Employee Job Type Break-Down', '{font-size: 20px;}');
     $g->bg_colour = '#FFFFFF';
     $g->set_inner_background('#E3F0FD', '#CBD7E6', 90);
     $g->x_axis_colour('#8499A4', '#E4F5FC');
     $g->y_axis_colour('#8499A4', '#E4F5FC');
     //Pass stBarOutline object i.e. $bar to graph
     $g->data_sets[] = $bar;
     //Setting labels for X-Axis
     $g->set_x_labels(array_keys($data));
     // to set the format of labels on x-axis e.g. font, color, step
     $g->set_x_label_style(10, '#18A6FF', 0, 2);
     // To tick the values on x-axis
     // 2 means tick every 2nd value
     $g->set_x_axis_steps(2);
     //set maximum value for y-axis
     //we can fix the value as 20, 10 etc.
     //but its better to use max of data
     $g->set_y_max(max($data));
     $g->y_label_steps(4);
     $g->set_y_legend('# Employees', 12, '#18A6FF');
     echo $g->render();
     return sfView::NONE;
 }
Пример #8
0
 /**
  * This is a method for emulating ON DELETE CASCADE for DBs that don't support this
  * feature (like MySQL or SQLite).
  *
  * This method is not very speedy because it must perform a query first to get
  * the implicated records and then perform the deletes by calling those Peer classes.
  *
  * This method should be used within a transaction if possible.
  *
  * @param      Criteria $criteria
  * @param      PropelPDO $con
  * @return     int The number of affected rows (if supported by underlying database driver).
  */
 protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con)
 {
     // initialize var to track total num of affected rows
     $affectedRows = 0;
     // first find the objects that are implicated by the $criteria
     $objects = RolePeer::doSelect($criteria, $con);
     foreach ($objects as $obj) {
         // delete related Employee objects
         $c = new Criteria(EmployeePeer::DATABASE_NAME);
         $c->add(EmployeePeer::ROLE_ID, $obj->getId());
         $affectedRows += EmployeePeer::doDelete($c, $con);
         // delete related User objects
         $c = new Criteria(UserPeer::DATABASE_NAME);
         $c->add(UserPeer::ROLE_ID, $obj->getId());
         $affectedRows += UserPeer::doDelete($c, $con);
     }
     return $affectedRows;
 }
Пример #9
0
 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();
     }
 }
Пример #10
0
 public static function doSelectJoinAllExceptEmployeeDivision(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     EmployeeDetailPeer::addSelectColumns($c);
     $startcol2 = EmployeeDetailPeer::NUM_COLUMNS - EmployeeDetailPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     EmployeePeer::addSelectColumns($c);
     $startcol3 = $startcol2 + EmployeePeer::NUM_COLUMNS;
     ReligionPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + ReligionPeer::NUM_COLUMNS;
     ReligionPeer::addSelectColumns($c);
     $startcol5 = $startcol4 + ReligionPeer::NUM_COLUMNS;
     EmployeeLevelPeer::addSelectColumns($c);
     $startcol6 = $startcol5 + EmployeeLevelPeer::NUM_COLUMNS;
     MaritalStatusPeer::addSelectColumns($c);
     $startcol7 = $startcol6 + MaritalStatusPeer::NUM_COLUMNS;
     $c->addJoin(EmployeeDetailPeer::EMPLOYEE_ID, EmployeePeer::ID);
     $c->addJoin(EmployeeDetailPeer::RELIGION_ID, ReligionPeer::ID);
     $c->addJoin(EmployeeDetailPeer::SPOUSE_RELIGION_ID, ReligionPeer::ID);
     $c->addJoin(EmployeeDetailPeer::EMPLOYEE_LEVEL_ID, EmployeeLevelPeer::ID);
     $c->addJoin(EmployeeDetailPeer::MARITAL_STATUS_ID, MaritalStatusPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = EmployeeDetailPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = EmployeePeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj2 = new $cls();
         $obj2->hydrate($rs, $startcol2);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj2 = $temp_obj1->getEmployee();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addEmployeeDetail($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initEmployeeDetails();
             $obj2->addEmployeeDetail($obj1);
         }
         $omClass = ReligionPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj3 = new $cls();
         $obj3->hydrate($rs, $startcol3);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj3 = $temp_obj1->getReligionRelatedByReligionId();
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addEmployeeDetailRelatedByReligionId($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj3->initEmployeeDetailsRelatedByReligionId();
             $obj3->addEmployeeDetailRelatedByReligionId($obj1);
         }
         $omClass = ReligionPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj4 = new $cls();
         $obj4->hydrate($rs, $startcol4);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj4 = $temp_obj1->getReligionRelatedBySpouseReligionId();
             if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj4->addEmployeeDetailRelatedBySpouseReligionId($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj4->initEmployeeDetailsRelatedBySpouseReligionId();
             $obj4->addEmployeeDetailRelatedBySpouseReligionId($obj1);
         }
         $omClass = EmployeeLevelPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj5 = new $cls();
         $obj5->hydrate($rs, $startcol5);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj5 = $temp_obj1->getEmployeeLevel();
             if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj5->addEmployeeDetail($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj5->initEmployeeDetails();
             $obj5->addEmployeeDetail($obj1);
         }
         $omClass = MaritalStatusPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj6 = new $cls();
         $obj6->hydrate($rs, $startcol6);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj6 = $temp_obj1->getMaritalStatus();
             if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj6->addEmployeeDetail($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj6->initEmployeeDetails();
             $obj6->addEmployeeDetail($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
Пример #11
0
 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;
 }
Пример #12
0
 /**
  * Get the associated Employee object
  *
  * @param      PropelPDO Optional Connection object.
  * @return     Employee The associated Employee object.
  * @throws     PropelException
  */
 public function getEmployee(PropelPDO $con = null)
 {
     if ($this->aEmployee === null && $this->employee_id !== null) {
         $c = new Criteria(EmployeePeer::DATABASE_NAME);
         $c->add(EmployeePeer::ID, $this->employee_id);
         $this->aEmployee = EmployeePeer::doSelectOne($c, $con);
         /* The following can be used additionally to
         		   guarantee the related object contains a reference
         		   to this object.  This level of coupling may, however, be
         		   undesirable since it could result in an only partially populated collection
         		   in the referenced object.
         		   $this->aEmployee->addUsers($this);
         		 */
     }
     return $this->aEmployee;
 }
Пример #13
0
 public function filterSched($c, $filters)
 {
     $filters_key = array_keys($filters);
     foreach ($filters_key as $key) {
         $value = $filters[$key];
         if ($value == '' || $value == null) {
             continue;
         }
         if ($key == 'DEPARTMENT_ID') {
             $c->addJoin(DepartmentPeer::ID, AcademicCalendarPeer::DEPARTMENT_ID);
             $c->addJoin(SchedulePeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID);
             $column = DepartmentPeer::getTableMap()->getColumn('ID');
         } elseif ($key == 'CODE_CLASS') {
             $c->addJoin(SchedulePeer::CLASS_GROUP_ID, ClassGroupPeer::ID);
             $column = ClassGroupPeer::getTableMap()->getColumn('NAME');
         } elseif ($key == 'EMPLOYEE_NAME') {
             $c->addJoin(SchedulePeer::EMPLOYEE_ID, EmployeePeer::ID);
             $column = EmployeePeer::getTableMap()->getColumn('NAME');
         } elseif ($key == 'SUBJECT_ID') {
             $c->addJoin(SubjectPeer::ID, SubjectCurrPeer::SUBJECT_ID);
             $c->addJoin(SubjectCurrPeer::ID, SchedulePeer::SUBJECT_CURR_ID);
             $column = SubjectPeer::getTableMap()->getColumn('ID');
         } elseif ($key == 'SUBJECT_NAME') {
             $c->addJoin(SubjectPeer::ID, SubjectCurrPeer::SUBJECT_ID);
             $c->addJoin(SubjectCurrPeer::ID, SchedulePeer::SUBJECT_CURR_ID);
             $column = SubjectPeer::getTableMap()->getColumn('NAME');
         } else {
             $column = SchedulePeer::getTableMap()->getColumn($key);
         }
         $name = $column->getFullyQualifiedName();
         $creoleType = $column->getCreoleType();
         if ($creoleType == CreoleTypes::TIMESTAMP) {
             $from = $value['from'];
             $to = $value['to'];
             if ($from != '' && $from != null) {
                 $c->add($name, $from, Criteria::GREATER_EQUAL);
             }
             if ($to != '' && $to != null) {
                 $c->add($name, $to, Criteria::LESS_EQUAL);
             }
         } else {
             if ($creoleType == CreoleTypes::DATE) {
                 $c->add($name, $value, Criteria::LIKE);
             } else {
                 if ($creoleType == CreoleTypes::INTEGER) {
                     $c->add($name, $value, Criteria::EQUAL);
                 } else {
                     if ($creoleType == CreoleTypes::VARCHAR) {
                         $c->add($name, "%{$value}%", Criteria::LIKE);
                     }
                 }
             }
         }
     }
 }
Пример #14
0
 public function executeSave()
 {
     $counseling_id = $this->getRequestParameter('counseling_id');
     $counseling = CounselingPeer::retrieveByPK($counseling_id);
     $this->forward404Unless($counseling);
     $term = $this->getRequestParameter('term');
     $accal_id = $this->getRequestParameter('academic_calendar_id');
     $academic_calendar = AcademicCalendarPeer::retrieveByPK($accal_id);
     $this->forward404Unless($academic_calendar);
     $employee_id = $this->getRequestParameter('employee_id');
     $employee = EmployeePeer::retrieveByPK($employee_id);
     $this->forward404Unless($employee);
     $descs = $this->getRequestParameter('desc');
     foreach ($descs as $m => $desc) {
         if ($desc != null) {
             if ($desc != '-') {
                 $ced = new Criteria();
                 $ced->add(StudentDescPeer::STUDENT_ACCAL_ID, $m);
                 $ced->add(StudentDescPeer::TERM, $term);
                 $spec = StudentDescPeer::doSelectOne($ced);
                 if ($spec == null) {
                     $spec = new StudentDesc();
                 }
                 $spec->setStudentAccalId($m);
                 $spec->setTerm($term);
                 $spec->setNote($desc);
                 $spec->save();
             } else {
                 $ced = new Criteria();
                 $ced->add(StudentDescPeer::STUDENT_ACCAL_ID, $m);
                 $ced->add(StudentDescPeer::TERM, $term);
                 $spec = StudentDescPeer::doSelectOne($ced);
                 if ($spec != null) {
                     $spec->delete();
                 }
             }
         }
     }
     return $this->redirect('course_tk/listScore?accal_id=' . $academic_calendar->getId() . '&term=' . $term . '&counseling_id=' . $counseling->getId() . '&employee_id=' . $employee_id);
 }
Пример #15
0
 public function executeListElse()
 {
     $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo');
     $group = $this->getContext()->getUser()->getAttribute('group', null, 'bo');
     if ($group == 'lector') {
         $employee_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo');
         $employee = EmployeePeer::retrieveByPK($employee_id);
         if ($employee->getStaffTypeId() == 13 || $employee->getStaffTypeId() == 14) {
             $this->can_add == 0;
             $this->can_edit == 0;
             $this->can_remove == 0;
         }
         $this->employee = $employee;
     } else {
         $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_edit = $acl->getEditPriv() == 1;
         $this->can_remove = $acl->getRemovePriv() == 1;
     }
     $counseling_id = $this->getRequestParameter('counseling_id');
     $counseling = CounselingPeer::retrieveByPK($counseling_id);
     $this->forward404Unless($counseling);
     $c = new Criteria();
     $c->add(VStudentElsePeer::ACADEMIC_CALENDAR_ID, $counseling->getAcademicCalendarId(), Criteria::IN);
     $c->add(VStudentElsePeer::CLASS_GROUP_ID, $counseling->getClassGroupId(), Criteria::IN);
     $c->add(VStudentElsePeer::STATUS, Student::STATUS_GRADUATE, Criteria::NOT_EQUAL);
     $c->add(VStudentElsePeer::STATUS, Student::STATUS_OVERDUE, Criteria::NOT_EQUAL);
     $this->sortElse($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->filterElse($c, $this->getRequestParameter('filters'));
             }
         }
     }
     $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'else'));
     $this->getUser()->setAttribute('max_per_page', $rpp, 'else');
     $pager = new sfPropelPager('VStudentElse', $rpp);
     $pager->setCriteria($c);
     $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'else'));
     $this->getUser()->setAttribute('page', $page, 'else');
     $pager->setPage($page);
     $pager->init();
     $this->pager = $pager;
     $actions = array(array('name' => 'filter', 'color' => 'white'));
     $filter_string = "";
     if ($this->filters) {
         foreach ($this->filters as $key => $val) {
             $filter_string .= "&filters[{$key}]={$val}";
         }
         $filter_string = preg_replace('/^&/', '', $filter_string);
     }
     array_unshift($actions, array('name' => 'back', 'url' => "student_finance/list", 'color' => 'black'));
     array_unshift($actions, array('name' => '_AS_CSV_', 'url' => "student_finance/listElseAsCSV?counseling_id={$counseling_id}&{$filter_string}", 'color' => 'black', 'type' => 'direct'));
     array_unshift($actions, array('name' => '_AS_PDF_', 'url' => "student_finance/listElseAsPDF?counseling_id={$counseling_id}&{$filter_string}", 'color' => 'black', 'type' => 'direct'));
     $this->actions = $actions;
     $this->counseling = $counseling;
     $this->subtitle = $counseling->getAcademicCalendar()->toString() . ' # ' . $counseling->getClassGroup()->toString();
     $actions2 = array(array('name' => '<span>Jurnal Pembayaran Wakaf</span>', 'url' => 'student_finance/listStudent?counseling_id=' . $counseling->getId(), 'color' => 'sky'));
     array_unshift($actions2, array('name' => '<span>Jurnal Keuangan Murid</span>', 'url' => 'student_finance/list', 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Jurnal Pembayaran Infaq</span>', 'url' => 'student_finance/listInfaq?counseling_id=' . $counseling->getId(), 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Jurnal Pembayaran SPP</span>', 'url' => 'student_finance/listSpp?counseling_id=' . $counseling->getId(), 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Jurnal Pembayaran Lain-lain</span>', 'url' => 'student_finance/listElse?counseling_id=' . $counseling->getId(), 'color' => 'sun', 'type' => 'direct'));
     $this->actions2 = $actions2;
 }
Пример #16
0
 public function executeUpdate()
 {
     $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');
     if ($action_type == $action_i18n || !$this->getRequestParameter('id')) {
         $employee_leave = new EmployeeLeave();
     } else {
         $employee_leave = EmployeeLeavePeer::retrieveByPk($this->getRequestParameter('id'));
         $this->forward404Unless($employee_leave);
     }
     $employee_leave->setId($this->getRequestParameter('id'));
     $employee_leave->setEmployeeId($this->getRequestParameter('employee_id'));
     if ($this->getRequestParameter('start')) {
         $employee_leave->setStart($this->getRequestParameter('start'));
     }
     if ($this->getRequestParameter('end')) {
         $employee_leave->setEnd($this->getRequestParameter('end'));
     }
     $employee = EmployeePeer::retrieveByPK($this->getRequestParameter('employee_id'));
     if ($employee) {
         $cd = new Criteria();
         $cd->add(EmployeeDetailPeer::EMPLOYEE_ID, $employee->getId());
         $employee_detail = EmployeeDetailPeer::doSelectOne($cd);
         if ($employee_detail->getEmployeeDivisionId()) {
             $employee_leave->setEmployeeDivisionId($employee_detail->getEmployeeDivisionId());
         }
         if ($employee->getDepartmentId()) {
             $employee_leave->setDepartmentId($employee->getDepartmentId());
         }
     }
     $employee_leave->setCode($this->getRequestParameter('code'));
     $employee_leave->setEmployeeLevelId($this->getRequestParameter('employee_level_id'));
     $employee_leave->setLeaveTypeId($this->getRequestParameter('leave_type_id'));
     $employee_leave->setLeaveLength($this->getRequestParameter('leave_length'));
     $employee_leave->setDetail($this->getRequestParameter('detail'));
     $employee_leave->setAddress($this->getRequestParameter('address'));
     $employee_leave->setStatus($this->getRequestParameter('status'));
     $employee_leave->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
     $employee_leave->save();
     return $this->redirect('employee_leave/list?employee_id=' . $this->getRequestParameter('employee_id'));
 }
Пример #17
0
 public function filterPermit($c, $filters)
 {
     $filters_key = array_keys($filters);
     foreach ($filters_key as $key) {
         $value = $filters[$key];
         if ($value == '' || $value == null) {
             continue;
         }
         if ($key == 'EXTRA_CODE') {
             $c->addJoin(EmployeePeer::ID, EmployeePermitPeer::EMPLOYEE_ID);
             $c->addJoin(EmployeeDetailPeer::EMPLOYEE_ID, EmployeePeer::ID);
             $column = EmployeeDetailPeer::getTableMap()->getColumn('EXTRA_CODE');
         } elseif ($key == 'LEVEL') {
             $c->addJoin(EmployeeLevelPeer::ID, EmployeePermitPeer::EMPLOYEE_LEVEL_ID);
             $column = EmployeeLevelPeer::getTableMap()->getColumn('LEVEL');
         } elseif ($key == 'EMP_NO') {
             $c->addJoin(EmployeePeer::ID, EmployeePermitPeer::EMPLOYEE_ID);
             $column = EmployeePeer::getTableMap()->getColumn('CODE');
         } elseif ($key == 'EMP_NAME') {
             $c->addJoin(EmployeePeer::ID, EmployeePermitPeer::EMPLOYEE_ID);
             $column = EmployeePeer::getTableMap()->getColumn('NAME');
         } else {
             $column = EmployeePermitPeer::getTableMap()->getColumn($key);
         }
         $name = $column->getFullyQualifiedName();
         $creoleType = $column->getCreoleType();
         if ($creoleType == CreoleTypes::TIMESTAMP) {
             $from = $value['from'];
             $to = $value['to'];
             if ($from != '' && $from != null) {
                 $c->add($name, $from, Criteria::GREATER_EQUAL);
             }
             if ($to != '' && $to != null) {
                 $c->add($name, $to, Criteria::LESS_EQUAL);
             }
         } elseif ($creoleType == CreoleTypes::DATE) {
             $from = $value['from'];
             $to = $value['to'];
             if ($from != '' && $from != null) {
                 $c->add($name, $from, Criteria::GREATER_EQUAL);
             }
             if ($to != '' && $to != null) {
                 $c->add($name, $to, Criteria::LESS_EQUAL);
             }
         } else {
             if ($creoleType == CreoleTypes::INTEGER) {
                 $c->add($name, $value, Criteria::EQUAL);
             } else {
                 if ($creoleType == CreoleTypes::VARCHAR || $creoleType == CreoleTypes::CHAR) {
                     $c->add($name, "%{$value}%", Criteria::LIKE);
                 }
             }
         }
     }
 }
Пример #18
0
 /**
  * Selects a collection of User objects pre-filled with all related objects except Role.
  *
  * @param      Criteria  $c
  * @param      PropelPDO $con
  * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  * @return     array Array of User objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAllExceptRole(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     foreach (sfMixer::getCallables('BaseUserPeer:doSelectJoinAllExcept:doSelectJoinAllExcept') as $callable) {
         call_user_func($callable, 'BaseUserPeer', $c, $con);
     }
     $c = clone $c;
     // Set the correct dbName if it has not been overridden
     // $c->getDbName() will return the same object if not set to another value
     // so == check is okay and faster
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     UserPeer::addSelectColumns($c);
     $startcol2 = UserPeer::NUM_COLUMNS - UserPeer::NUM_LAZY_LOAD_COLUMNS;
     EmployeePeer::addSelectColumns($c);
     $startcol3 = $startcol2 + (EmployeePeer::NUM_COLUMNS - EmployeePeer::NUM_LAZY_LOAD_COLUMNS);
     $c->addJoin(array(UserPeer::EMPLOYEE_ID), array(EmployeePeer::ID), $join_behavior);
     $stmt = BasePeer::doSelect($c, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = UserPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = UserPeer::getInstanceFromPool($key1))) {
             // We no longer rehydrate the object, since this can cause data loss.
             // See http://propel.phpdb.org/trac/ticket/509
             // $obj1->hydrate($row, 0, true); // rehydrate
         } else {
             $omClass = UserPeer::getOMClass();
             $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             UserPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined Employee rows
         $key2 = EmployeePeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = EmployeePeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $omClass = EmployeePeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 EmployeePeer::addInstanceToPool($obj2, $key2);
             }
             // if $obj2 already loaded
             // Add the $obj1 (User) to the collection in $obj2 (Employee)
             $obj2->addUser($obj1);
         }
         // if joined row is not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
Пример #19
0
 public static function doSelectJoinAllExceptClassType(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     CounselingPeer::addSelectColumns($c);
     $startcol2 = CounselingPeer::NUM_COLUMNS - CounselingPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     EmployeePeer::addSelectColumns($c);
     $startcol3 = $startcol2 + EmployeePeer::NUM_COLUMNS;
     AcademicCalendarPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + AcademicCalendarPeer::NUM_COLUMNS;
     ClassGroupPeer::addSelectColumns($c);
     $startcol5 = $startcol4 + ClassGroupPeer::NUM_COLUMNS;
     $c->addJoin(CounselingPeer::EMPLOYEE_ID, EmployeePeer::ID);
     $c->addJoin(CounselingPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID);
     $c->addJoin(CounselingPeer::CLASS_GROUP_ID, ClassGroupPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = CounselingPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = EmployeePeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj2 = new $cls();
         $obj2->hydrate($rs, $startcol2);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj2 = $temp_obj1->getEmployee();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addCounseling($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initCounselings();
             $obj2->addCounseling($obj1);
         }
         $omClass = AcademicCalendarPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj3 = new $cls();
         $obj3->hydrate($rs, $startcol3);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj3 = $temp_obj1->getAcademicCalendar();
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addCounseling($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj3->initCounselings();
             $obj3->addCounseling($obj1);
         }
         $omClass = ClassGroupPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj4 = new $cls();
         $obj4->hydrate($rs, $startcol4);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj4 = $temp_obj1->getClassGroup();
             if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj4->addCounseling($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj4->initCounselings();
             $obj4->addCounseling($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
Пример #20
0
 public static function doSelectJoinAllExceptLeaveType(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     EmployeeLeavePeer::addSelectColumns($c);
     $startcol2 = EmployeeLeavePeer::NUM_COLUMNS - EmployeeLeavePeer::NUM_LAZY_LOAD_COLUMNS + 1;
     EmployeePeer::addSelectColumns($c);
     $startcol3 = $startcol2 + EmployeePeer::NUM_COLUMNS;
     DepartmentPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + DepartmentPeer::NUM_COLUMNS;
     AcademicCalendarPeer::addSelectColumns($c);
     $startcol5 = $startcol4 + AcademicCalendarPeer::NUM_COLUMNS;
     EmployeeLevelPeer::addSelectColumns($c);
     $startcol6 = $startcol5 + EmployeeLevelPeer::NUM_COLUMNS;
     EmployeeDivisionPeer::addSelectColumns($c);
     $startcol7 = $startcol6 + EmployeeDivisionPeer::NUM_COLUMNS;
     $c->addJoin(EmployeeLeavePeer::EMPLOYEE_ID, EmployeePeer::ID);
     $c->addJoin(EmployeeLeavePeer::DEPARTMENT_ID, DepartmentPeer::ID);
     $c->addJoin(EmployeeLeavePeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID);
     $c->addJoin(EmployeeLeavePeer::EMPLOYEE_LEVEL_ID, EmployeeLevelPeer::ID);
     $c->addJoin(EmployeeLeavePeer::EMPLOYEE_DIVISION_ID, EmployeeDivisionPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = EmployeeLeavePeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = EmployeePeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj2 = new $cls();
         $obj2->hydrate($rs, $startcol2);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj2 = $temp_obj1->getEmployee();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addEmployeeLeave($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initEmployeeLeaves();
             $obj2->addEmployeeLeave($obj1);
         }
         $omClass = DepartmentPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj3 = new $cls();
         $obj3->hydrate($rs, $startcol3);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj3 = $temp_obj1->getDepartment();
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addEmployeeLeave($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj3->initEmployeeLeaves();
             $obj3->addEmployeeLeave($obj1);
         }
         $omClass = AcademicCalendarPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj4 = new $cls();
         $obj4->hydrate($rs, $startcol4);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj4 = $temp_obj1->getAcademicCalendar();
             if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj4->addEmployeeLeave($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj4->initEmployeeLeaves();
             $obj4->addEmployeeLeave($obj1);
         }
         $omClass = EmployeeLevelPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj5 = new $cls();
         $obj5->hydrate($rs, $startcol5);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj5 = $temp_obj1->getEmployeeLevel();
             if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj5->addEmployeeLeave($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj5->initEmployeeLeaves();
             $obj5->addEmployeeLeave($obj1);
         }
         $omClass = EmployeeDivisionPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj6 = new $cls();
         $obj6->hydrate($rs, $startcol6);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj6 = $temp_obj1->getEmployeeDivision();
             if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj6->addEmployeeLeave($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj6->initEmployeeLeaves();
             $obj6->addEmployeeLeave($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
Пример #21
0
 public static function doSelectJoinAllExceptCourseSchedule(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     CourseScheduleTutorPeer::addSelectColumns($c);
     $startcol2 = CourseScheduleTutorPeer::NUM_COLUMNS - CourseScheduleTutorPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     EmployeePeer::addSelectColumns($c);
     $startcol3 = $startcol2 + EmployeePeer::NUM_COLUMNS;
     $c->addJoin(CourseScheduleTutorPeer::EMPLOYEE_ID, EmployeePeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = CourseScheduleTutorPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = EmployeePeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj2 = new $cls();
         $obj2->hydrate($rs, $startcol2);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj2 = $temp_obj1->getEmployee();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addCourseScheduleTutor($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initCourseScheduleTutors();
             $obj2->addCourseScheduleTutor($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
Пример #22
0
 private function getEmployeeByName($keyword)
 {
     $departmentAvailable = $this->cmsTools->departmentAvailable($this->department->getId());
     $criteria = new Criteria();
     $criteria->add(EmployeePeer::NAME, '%' . $keyword . '%', Criteria::LIKE);
     $criteria->add(EmployeePeer::DEPARTMENT_ID, $departmentAvailable, Criteria::IN);
     $employee = EmployeePeer::doSelect($criteria);
     $employeeId = array();
     foreach ($employee as $e) {
         $employeeId[] = $e->getId();
     }
     return $employeeId;
 }
Пример #23
0
 public function getEmployee($con = null)
 {
     include_once 'lib/model/om/BaseEmployeePeer.php';
     if ($this->aEmployee === null && $this->employee_id !== null) {
         $this->aEmployee = EmployeePeer::retrieveByPK($this->employee_id, $con);
     }
     return $this->aEmployee;
 }
Пример #24
0
 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';
 }
Пример #25
0
 public function executeListSummary()
 {
     $employee_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo');
     $employee = EmployeePeer::retrieveByPK($employee_id);
     $this->forward404Unless($employee);
     $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);
     $c = new Criteria();
     $c->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
     $c->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
     $c->addJoin(StudentPeer::ID, StudentAccalPeer::STUDENT_ID);
     $c->add(StudentPeer::STATUS, Student::STATUS_ACTIVE, Criteria::EQUAL);
     $this->sortStudent($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->filterStudent($c, $this->getRequestParameter('filters'));
             }
         }
     }
     $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'student'));
     $this->getUser()->setAttribute('max_per_page', $rpp, 'student');
     $pager = new sfPropelPager('Student', $rpp);
     $pager->setCriteria($c);
     $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'student'));
     $this->getUser()->setAttribute('page', $page, 'student');
     $pager->setPage($page);
     $pager->init();
     $this->pager = $pager;
     $actions = array();
     $filter_string = "";
     if ($this->filters) {
         foreach ($this->filters as $key => $val) {
             $filter_string .= "&filters[{$key}]={$val}";
         }
         $filter_string = preg_replace('/^&/', '', $filter_string);
     }
     array_unshift($actions, array('name' => 'Print Excel', 'url' => "counseling_sd/listSummaryAsCSVSD?counseling_id=" . $counseling_id . "&accal_id=" . $academic_calendar->getId() . "&{$filter_string}", 'color' => 'black', 'type' => 'direct'));
     array_unshift($actions, array('name' => 'Print PDF', 'url' => "counseling_sd/listSummaryAsPDF?counseling_id=" . $counseling_id . "&accal_id=" . $academic_calendar->getId() . "&{$filter_string}", 'color' => 'black', 'type' => 'direct'));
     $this->actions = $actions;
     $actions2 = array(array('name' => '<span>Wali Kelas (2013)</span>', 'url' => 'counseling_sd/list?academic_calendar_id=' . $academic_calendar->getId(), 'color' => 'sun'));
     array_push($actions2, array('name' => '<span>Ledger Penilaian (Ringkasan Penilaian)</span>', 'url' => 'counseling_sd/listSummary?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId(), 'color' => 'sky', 'type' => 'direct'));
     array_push($actions2, array('name' => '<span>Ledger Penilaian KI.1 (Ringkasan Penilaian)</span>', 'url' => 'counseling_sd/listSummary?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId(), 'color' => 'sun'));
     array_push($actions2, array('name' => '<span>Ledger Penilaian KI.2 (Ringkasan Penilaian)</span>', 'url' => 'counseling_sd/listSummary?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId(), 'color' => 'sun'));
     $this->actions2 = $actions2;
     ## Criterria Score Rule
     $ct = new Criteria();
     $ct->add(ScoreRulePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getDepartmentId());
     $ct->add(ScoreRulePeer::CLASS_TYPE_ID, $counseling->getClassTypeId());
     $ct->add(ScoreRulePeer::CURRICULUM_ID, $academic_calendar->getCurriculumId());
     $ct->add(ScoreRulePeer::TYPE, ScoreRule::TYPE_TWO);
     $score_rule = ScoreRulePeer::doSelectOne($ct);
     $cm = new Criteria();
     $cm->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
     $cm->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
     $course_scheds = VCoursePeer::doSelect($cm);
     $subject_ids = array();
     foreach ($course_scheds as $course_sched) {
         $subject_ids[] = $course_sched->getSubjectCurrId();
     }
     $cc = new Criteria();
     $cc->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $subject_ids, Criteria::IN);
     $cc->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $score_rule->getId());
     ##Sort Option
     $cc->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE);
     $course_schedules = ScoreRuleSubjectPeer::doSelect($cc);
     $course_count = ScoreRuleSubjectPeer::doCount($cc);
     $this->course_count = $course_count;
     $this->course_schedules = $course_schedules;
     $this->score_rule = $score_rule;
     $this->counseling = $counseling;
     $this->subtitle = $academic_calendar->toString() . ' # ' . $counseling->getClassGroup()->toString();
     $this->employee_id = $employee_id;
     $this->academic_calendar = $academic_calendar;
 }
Пример #26
0
 public static function doSelectJoinAllExceptGradeComponent(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     AbsenceEkskulPeer::addSelectColumns($c);
     $startcol2 = AbsenceEkskulPeer::NUM_COLUMNS - AbsenceEkskulPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     StudentPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + StudentPeer::NUM_COLUMNS;
     AcademicCalendarPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + AcademicCalendarPeer::NUM_COLUMNS;
     ClassGroupPeer::addSelectColumns($c);
     $startcol5 = $startcol4 + ClassGroupPeer::NUM_COLUMNS;
     SchedulePeer::addSelectColumns($c);
     $startcol6 = $startcol5 + SchedulePeer::NUM_COLUMNS;
     ScheduleDetailPeer::addSelectColumns($c);
     $startcol7 = $startcol6 + ScheduleDetailPeer::NUM_COLUMNS;
     EmployeePeer::addSelectColumns($c);
     $startcol8 = $startcol7 + EmployeePeer::NUM_COLUMNS;
     $c->addJoin(AbsenceEkskulPeer::STUDENT_ID, StudentPeer::ID);
     $c->addJoin(AbsenceEkskulPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID);
     $c->addJoin(AbsenceEkskulPeer::CLASS_GROUP_ID, ClassGroupPeer::ID);
     $c->addJoin(AbsenceEkskulPeer::SCHEDULE_ID, SchedulePeer::ID);
     $c->addJoin(AbsenceEkskulPeer::SCHEDULE_DETAIL_ID, ScheduleDetailPeer::ID);
     $c->addJoin(AbsenceEkskulPeer::EMPLOYEE_ID, EmployeePeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = AbsenceEkskulPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = StudentPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj2 = new $cls();
         $obj2->hydrate($rs, $startcol2);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj2 = $temp_obj1->getStudent();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addAbsenceEkskul($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initAbsenceEkskuls();
             $obj2->addAbsenceEkskul($obj1);
         }
         $omClass = AcademicCalendarPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj3 = new $cls();
         $obj3->hydrate($rs, $startcol3);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj3 = $temp_obj1->getAcademicCalendar();
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addAbsenceEkskul($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj3->initAbsenceEkskuls();
             $obj3->addAbsenceEkskul($obj1);
         }
         $omClass = ClassGroupPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj4 = new $cls();
         $obj4->hydrate($rs, $startcol4);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj4 = $temp_obj1->getClassGroup();
             if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj4->addAbsenceEkskul($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj4->initAbsenceEkskuls();
             $obj4->addAbsenceEkskul($obj1);
         }
         $omClass = SchedulePeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj5 = new $cls();
         $obj5->hydrate($rs, $startcol5);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj5 = $temp_obj1->getSchedule();
             if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj5->addAbsenceEkskul($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj5->initAbsenceEkskuls();
             $obj5->addAbsenceEkskul($obj1);
         }
         $omClass = ScheduleDetailPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj6 = new $cls();
         $obj6->hydrate($rs, $startcol6);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj6 = $temp_obj1->getScheduleDetail();
             if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj6->addAbsenceEkskul($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj6->initAbsenceEkskuls();
             $obj6->addAbsenceEkskul($obj1);
         }
         $omClass = EmployeePeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj7 = new $cls();
         $obj7->hydrate($rs, $startcol7);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj7 = $temp_obj1->getEmployee();
             if ($temp_obj7->getPrimaryKey() === $obj7->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj7->addAbsenceEkskul($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj7->initAbsenceEkskuls();
             $obj7->addAbsenceEkskul($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
Пример #27
0
                                      <?php 
$tanggal = date('Y-m-d');
echo DateToIndo($tanggal);
?>
<br />Guru Mata Pelajaran
                            </td>
	</tr>
                   <tr><td colspan="25" height="70px"></td></tr>
                   <tr>
                            <td></td>
                            <td style="text-align: left; font-size: 12px; font-weight: bold;">
                                    <?php 
$c = new Criteria();
$c->add(EmployeePeer::DEPARTMENT_ID, $course_schedule->getAcademicCalendar()->getDepartmentId());
$c->add(EmployeePeer::STAFF_TYPE_ID, 14);
$employee = EmployeePeer::doSelectOne($c);
echo $employee->getName() ? $employee->getName() : '-';
?>
                            </td><td colspan="26"></td>
                            <td style="text-align: left; font-size: 12px; font-weight: bold;" colspan="8">
                                     <?php 
$tutors = array();
foreach ($course_schedule->getCourseScheduleTutors() as $cr) {
    $tutors[] = $cr->getEmployee() ? $cr->getEmployee()->getName() : '-';
}
echo join("&nbsp;dan&nbsp;", $tutors);
?>
                            </td>
                   </tr>
        </table>
</center>
Пример #28
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = EmployeePeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setName($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setDepartmentId($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setStaffTypeId($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setEmpNo($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setIsCounselor($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setIsThesisAdvisor($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setIsComprehensiveReviewer($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setPassword($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setCode($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setMemberId($arr[$keys[10]]);
     }
 }
Пример #29
0
 public function executeGetScore()
 {
     $employee_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo');
     $employee = EmployeePeer::retrieveByPK($employee_id);
     $this->forward404Unless($employee);
     $academic_calendar_id = $this->getRequestParameter('academic_calendar_id');
     $academic_calendar = AcademicCalendarPeer::retrieveByPK($academic_calendar_id);
     $this->forward404Unless($academic_calendar);
     $counseling_id = $this->getRequestParameter('counseling_id');
     $counseling = CounselingPeer::retrieveByPK($counseling_id);
     $this->forward404Unless($counseling);
     $student_id = $this->getRequestParameter('student_id');
     $student = StudentPeer::retrieveByPK($student_id);
     $this->forward404Unless($student);
     $c = new Criteria();
     $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'counseling_spec'));
     $this->getUser()->setAttribute('max_per_page', $rpp, 'counseling_spec');
     $pager = new sfPropelPager('CounselingSpec', $rpp);
     $pager->setPeerMethod('doSelectOrdered');
     $pager->setCriteria($c);
     $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'counseling_spec'));
     $this->getUser()->setAttribute('page', $page, 'counseling_spec');
     $pager->setPage($page);
     $pager->init();
     $this->pager = $pager;
     $cem = new Criteria();
     $cem->add(StudentAccalPeer::STUDENT_ID, $student->getId());
     $cem->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
     $cem->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
     $cem->add(StudentAccalPeer::STATUS, 1);
     $stu_acc = StudentAccalPeer::doSelectOne($cem);
     $this->stu_acc = $stu_acc;
     $cr = new Criteria();
     $cr->add(CounselingRaportPeer::STUDENT_ACCAL_ID, $stu_acc->getId());
     $student_couns = CounselingRaportPeer::doSelect($cr);
     $stu_coun = array();
     foreach ($student_couns as $student_coun) {
         $stu_coun[$student_coun->getCounselingSpecId()] = $student_coun->getGrade();
     }
     $this->stu_coun = $stu_coun;
     $actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value")));
     $this->actions = $actions;
     $this->academic_calendar = $academic_calendar;
     $this->employee_id = $employee_id;
     $this->employee = $employee;
     $this->counseling = $counseling;
     $this->student = $student;
 }
Пример #30
0
 public function executeSave()
 {
     $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');
     $employee_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo');
     $employee = EmployeePeer::retrieveByPK($employee_id);
     $this->forward404Unless($employee);
     if ($action_type == $action_i18n || !$this->getRequestParameter('id')) {
         $class_agenda = new ClassAgenda();
     } else {
         $class_agenda = ClassAgendaPeer::retrieveByPk($this->getRequestParameter('id'));
         $this->forward404Unless($class_agenda);
     }
     $class_agenda->setId($this->getRequestParameter('id'));
     $class_agenda->setCourseScheduleId($this->getRequestParameter('course_schedule_id'));
     $class_agenda->setDetail($this->getRequestParameter('detail'));
     if ($this->getRequestParameter('date')) {
         $class_agenda->setDate($this->getRequestParameter('date'));
     }
     $class_agenda->setStatus($this->getRequestParameter('status'));
     $class_agenda->setSubjectGradingId($this->getRequestParameter('subject_grading_id'));
     $class_agenda->setMeetingPoint($this->getRequestParameter('meeting_point'));
     $class_agenda->setActionType($this->getRequestParameter('action_type'));
     $class_agenda->setDay($this->getRequestParameter('day'));
     if ($this->getRequestParameter('class_group_id')) {
         $class_agenda->setClassGroupId($this->getRequestParameter('class_group_id'));
     } else {
         $cs = CourseSchedulePeer::retrieveByPk($this->getRequestParameter('course_schedule_id'));
         $this->forward404Unless($cs);
         $class_agenda->setClassGroupId($cs->getClassGroupId());
     }
     $class_agenda->setDescription($this->getRequestParameter('description'));
     $class_agenda->save();
     #$params = array();
     #foreach (explode('&', $this->getRequestParameter('student_list_ser')) as $p) {
     #	$p = explode('=', $p);
     #	$params[rawurldecode($p[0])][] = rawurldecode($p[1]);
     #}
     #if (array_key_exists('students', $params)) {
     #	foreach ($params['students'] as $su_id) {
     #		$student_absence = new StudentAbsence();
     #
     #		$student_absence->setStudentId($su_id);
     #		$student_absence->setStart($this->getRequestParameter('date'));
     #		$student_absence->setEnd($this->getRequestParameter('date'));
     #		$student_absence->setAcademicCalendarId($class_agenda->getCourseSchedule()->getAcademicCalendarId());
     #		$student_absence->setClassGroupId($this->getRequestParameter('class_group_id'));
     #		$student_absence->save();
     #	}
     #}
     return $this->redirect('agenda/edit?id=' . $class_agenda->getId());
     #return $this->forward('agenda', 'list');
     #return $this->forward('agenda', 'edit?id='.$class_agenda->getId());
 }