示例#1
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;
 }
示例#2
0
 public function countEmployees($criteria = null, $distinct = false, $con = null)
 {
     include_once 'lib/model/om/BaseEmployeePeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     $criteria->add(EmployeePeer::DEPARTMENT_ID, $this->getId());
     return EmployeePeer::doCount($criteria, $distinct, $con);
 }
示例#3
0
 /**
  * Returns the number of related Employee objects.
  *
  * @param      Criteria $criteria
  * @param      boolean $distinct
  * @param      PropelPDO $con
  * @return     int Count of related Employee objects.
  * @throws     PropelException
  */
 public function countEmployees(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(RolePeer::DATABASE_NAME);
     } else {
         $criteria = clone $criteria;
     }
     if ($distinct) {
         $criteria->setDistinct();
     }
     $count = null;
     if ($this->collEmployees === null) {
         if ($this->isNew()) {
             $count = 0;
         } else {
             $criteria->add(EmployeePeer::ROLE_ID, $this->id);
             $count = EmployeePeer::doCount($criteria, $con);
         }
     } else {
         // criteria has no effect for a new object
         if (!$this->isNew()) {
             // the following code is to determine if a new query is
             // called for.  If the criteria is the same as the last
             // one, just return count of the collection.
             $criteria->add(EmployeePeer::ROLE_ID, $this->id);
             if (!isset($this->lastEmployeeCriteria) || !$this->lastEmployeeCriteria->equals($criteria)) {
                 $count = EmployeePeer::doCount($criteria, $con);
             } else {
                 $count = count($this->collEmployees);
             }
         } else {
             $count = count($this->collEmployees);
         }
     }
     return $count;
 }
示例#4
0
 public function executePrintAbsence()
 {
     $academic_calendar_id = $this->getRequestParameter('academic_calendar_id');
     $academic_calendar = AcademicCalendarPeer::retrieveByPK($academic_calendar_id);
     $this->forward404Unless($academic_calendar);
     $department_id = $this->getRequestParameter('department_id');
     $department = DepartmentPeer::retrieveByPK($department_id);
     $this->forward404Unless($department);
     $month_id1 = $this->getRequestParameter('month_id1');
     $month1 = MonthPeer::retrieveByPK($month_id1);
     $this->forward404Unless($month1);
     $month_id2 = $this->getRequestParameter('month_id2');
     $month2 = MonthPeer::retrieveByPK($month_id2);
     $this->forward404Unless($month2);
     $thn1 = $this->getRequestParameter('thn1');
     $thn2 = $this->getRequestParameter('thn2');
     $tgl_absen1 = $this->getRequestParameter('tgl_absen1');
     $tgl_absen2 = $this->getRequestParameter('tgl_absen2');
     $time = $this->getRequestParameter('time');
     $time2 = $this->getRequestParameter('time2');
     $tgl_cetak = $this->getRequestParameter('tgl_cetak');
     $cr = new Criteria();
     $cr->add(TempTablePeer::COUNSELING_ID, $academic_calendar->getId());
     $cr->add(TempTablePeer::STUDENT_ID, $department->getId());
     $cr->add(TempTablePeer::TIME, $time);
     $cr->addJoin(EmployeePeer::ID, TempTablePeer::EMPLOYEE_ID);
     $cr->addAscendingOrderByColumn(EmployeePeer::ID);
     $employees = EmployeePeer::doSelect($cr);
     $employ_count = EmployeePeer::doCount($cr);
     $cli = new Criteria();
     $cli->add(EmployeeRegulationPeer::REGULATION_TYPE, EmployeeRegulation::ABSENCE);
     $employ_regulations = EmployeeRegulationPeer::doSelect($cli);
     $groups = array();
     $types = array();
     $alls = array();
     foreach ($employ_regulations as $emp_reg) {
         $groups[$emp_reg->getAcademicCalendarId() . '#' . $emp_reg->getGroups()] = $emp_reg->getId();
         $types[$emp_reg->getAcademicCalendarId() . '#' . $emp_reg->getStaffTypeId()] = $emp_reg->getId();
         $alls[$emp_reg->getAcademicCalendarId() . '#' . $emp_reg->getStaffTypeId() . '#' . $emp_reg->getGroups()] = $emp_reg->getId();
     }
     $this->employ_regulations = $employ_regulations;
     $this->alls = $alls;
     $this->groups = $groups;
     $this->types = $types;
     $this->academic_calendar = $academic_calendar;
     $this->department = $department;
     $this->time = $time;
     $this->time2 = $time2;
     $this->tgl_cetak = $tgl_cetak;
     $this->tgl_absen1 = $tgl_absen1;
     $this->tgl_absen2 = $tgl_absen2;
     $this->employees = $employees;
     $this->employ_count = $employ_count;
     $this->month1 = $month1;
     $this->month2 = $month2;
     $this->thn1 = $thn1;
     $this->thn2 = $thn2;
     $this->papersize = 'a4';
     $this->orientation = 'potrait';
     $this->setViewClass('sfDomPDF');
 }