Exemplo n.º 1
0
 public function configure()
 {
     unset($this['client_id'], $this['created_at'], $this['updated_at'], $this['employee_id'], $this['time_in'], $this['time_out']);
     $this->setOption('employee_id', $this->getObject()->getEmployeeId());
     //Embedding at least a form
     $entry_concerns = $this->getObject()->getEntryConcerns();
     //An empty form will act as a container for all the contacts
     $entry_concerns_form = new SfForm();
     $count = 0;
     foreach ($entry_concerns as $entry_concern) {
         $entry_concern_form = new EntryConcernForm($entry_concern, array('employee_id' => $this->getOption('employee_id')));
         //Embedding each form in the container
         $entry_concerns_form->embedForm($count, $entry_concern_form);
         $count++;
     }
     //Embedding the container in the main form
     $this->embedForm('entry_concerns', $entry_concerns_form);
     // this makes it so client service list only shows active services for this employee
     $c = new Criteria();
     ClientServicePeer::addActive($c);
     $c->add(ClientServicePeer::EMPLOYEE_ID, $this->getOption('employee_id'));
     // only classroom services
     $c->add(ClientServicePeer::OBJECT_TYPE, array(ClientServicePeer::CLASSKEY_CLASSROOM, ClientServicePeer::CLASSKEY_SEIT, ClientServicePeer::CLASSKEY_PRESCHOOL, ClientServicePeer::CLASSKEY_EI), Criteria::IN);
     $c->addJoin(ClientPeer::ID, ClientServicePeer::CLIENT_ID);
     $c->addAscendingOrderByColumn(ClientPeer::FIRST_NAME);
     $this->widgetSchema['client_service_id'] = new sfWidgetFormPropelChoiceGrouped(array('model' => 'ClientService', 'add_empty' => true, 'group_by_method' => 'getObjectType'));
     $this->widgetSchema['client_service_id']->setOption('criteria', $c);
     // this makes it so the group list only shows other kids this person is activley servicing
     $this->widgetSchema['note_entry_kids_list'] = new sfWidgetFormPropelChoiceGrouped(array('model' => 'ClientService', 'add_empty' => false, 'group_by_method' => 'getObjectType'));
     $this->widgetSchema['note_entry_kids_list']->setOption('criteria', $c);
     $this->widgetSchema['note_entry_kids_list']->setOption('expanded', true);
     $this->widgetSchema['note_entry_kids_list']->setOption('multiple', true);
     $this->widgetSchema['note_entry_kids_list']->setOption('key_method', 'getClientId');
     $this->widgetSchema['note_entry_kids_list']->setOption('method', 'getClient');
     $this->widgetSchema['note_entry_kids_list']->setOption('renderer_options', array('template' => '<div class="groupType"><strong>%group%</strong> %options%<br style="clear:both" /></div>'));
     $this->widgetSchema->setLabels(array('client_service_id' => 'Client Service', 'office_id' => 'Service Location', 'frequency_id' => 'IEP Frequency', 'note_entry_kids_list' => 'Group'));
     $this->widgetSchema['service_date'] = new sfWidgetFormInput();
     $this->widgetSchema['time_in'] = new sfWidgetFormInput();
     $this->widgetSchema['time_out'] = new sfWidgetFormInput();
     $this->widgetSchema['units'] = new sfWidgetFormChoice(array('choices' => NoteEntryPeer::getUnitChoices()));
     $this->validatorSchema['units'] = new sfValidatorChoice(array('choices' => NoteEntryPeer::getUnitChoices(true)));
     $this->widgetSchema['absent'] = new sfWidgetFormChoice(array('choices' => NoteEntryPeer::getAbsentChoices()));
     $this->validatorSchema['absent'] = new sfValidatorChoice(array('choices' => NoteEntryPeer::getAbsentChoices(true)));
     $this->validatorSchema['time_in'] = new sfValidatorPass();
     $this->validatorSchema['time_out'] = new sfValidatorPass();
     /*
      * add a post validator for dates and times
      * needs to convert 12-hour to 24-hour time, anything less than 7 is afternoon
      * needs to use service date to set the times
      */
     $this->validatorSchema->setPostValidator(new sfValidatorCallback(array('callback' => array($this, 'validateDates'))));
 }
Exemplo n.º 2
0
 public function getOverlaps()
 {
     $c = new Criteria();
     // start date is after this start, and start date is before this one
     $cton1 = $c->getNewCriterion(NoteEntryPeer::TIME_IN, $this->getTimeIn(), Criteria::GREATER_THAN);
     $cton2 = $c->getNewCriterion(NoteEntryPeer::TIME_IN, $this->getTimeOut(), Criteria::LESS_THAN);
     $cton1->addAnd($cton2);
     // end date is after start date, and end date is before this end date
     $cton3 = $c->getNewCriterion(NoteEntryPeer::TIME_OUT, $this->getTimeIn(), Criteria::GREATER_THAN);
     $cton4 = $c->getNewCriterion(NoteEntryPeer::TIME_OUT, $this->getTimeOut(), Criteria::LESS_THAN);
     $cton3->addAnd($cton4);
     $cton1->addOr($cton3);
     $c->add($cton1);
     $c->add(NoteEntryPeer::CLIENT_ID, $this->getClientId());
     $c->add(NoteEntryPeer::ID, $this->getId(), Criteria::NOT_EQUAL);
     return NoteEntryPeer::doSelect($c);
 }
Exemplo n.º 3
0
 public function executeAddConcernForm(sfWebRequest $request)
 {
     $this->forward404unless($request->isXmlHttpRequest());
     $number = intval($request->getParameter("num"));
     if ($note_entry = NoteEntryPeer::retrieveByPk($request->getParameter('id'))) {
         $form = new NoteEntryForm($note_entry);
     } else {
         $entry = new NoteEntry();
         $entry->setEmployee($this->getUser()->getProfile()->getEmployee());
         $form = new NoteEntryForm($entry);
     }
     $form->addConcern($number);
     return $this->renderPartial('AddConcern', array('form' => $form, 'num' => $number));
 }
Exemplo n.º 4
0
 public function executeDailyLog(sfWebRequest $request)
 {
     $this->form = new ReportDailyLogForm();
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName()));
         if ($this->form->isValid()) {
             $month = $this->form->getValue('date_month');
             $this->year = $year = $this->form->getValue('date_year');
             $first_day = mktime(0, 0, 0, $month, 1, $year);
             $last_day = strtotime('+1 month -1 second', $first_day);
             $c = new Criteria();
             // only in this date range (the month selected)
             $c->add(NoteEntryPeer::SERVICE_DATE, $first_day, Criteria::GREATER_EQUAL);
             $c->addAnd(NoteEntryPeer::SERVICE_DATE, $last_day, Criteria::LESS_EQUAL);
             // include absent? lets go with no
             $c->add(NoteEntryPeer::ABSENT, 0);
             // sort by kids name
             $c->addAscendingOrderByColumn(ClientPeer::LAST_NAME);
             $c->addAscendingOrderByColumn(NoteEntryPeer::SERVICE_DATE);
             $c->addAscendingOrderByColumn(NoteEntryPeer::TIME_IN);
             // only the selected type
             if ($this->form->getValue('service_type')) {
                 $c->add(ClientServicePeer::OBJECT_TYPE, $this->form->getValue('service_type'));
             }
             $entries = NoteEntryPeer::doSelectJoinAll($c);
             // build array of all entries in the selected time period indexed by ID
             $this->all_entries = array();
             foreach ($entries as $entry) {
                 $this->all_entries[$entry->getId()] = $entry;
             }
             // build an array of overlaps of client
             $this->overlaps = array();
             $client_entry_times = array();
             $provider_entry_times = array();
             foreach ($this->all_entries as $anEntry) {
                 // skip grouped kids, for now
                 if (!$anEntry->inGroup()) {
                     if (!array_key_exists($anEntry->getEmployeeId(), $provider_entry_times)) {
                         $provider_entry_times[$anEntry->getEmployeeId()] = array();
                     }
                     $provider_entry_times[$anEntry->getEmployeeId()][$anEntry->getId()] = array($anEntry->getTimeIn('U'), $anEntry->getTimeOut('U'));
                 }
                 if (!array_key_exists($anEntry->getClientId(), $client_entry_times)) {
                     $client_entry_times[$anEntry->getClientId()] = array();
                 }
                 $client_entry_times[$anEntry->getClientId()][$anEntry->getId()] = array($anEntry->getTimeIn('U'), $anEntry->getTimeOut('U'));
             }
             // find clients with overlapping times
             foreach ($client_entry_times as $client_id => $client_entries) {
                 $entry_times[$client_id] = sort2d($client_entries, 0);
                 $previous = array(0, 0, 0);
                 foreach ($entry_times[$client_id] as $entry_id => $times) {
                     // this in time happened before previous out time.. we have a overlap
                     if ($times[0] < $previous[1] && $entry_id != $previous[2]) {
                         $this->overlaps[$entry_id] = $previous[2];
                         $this->overlaps[$previous[2]] = $entry_id;
                     }
                     $previous = array($times[0], $times[1], $entry_id);
                 }
             }
             // find providers with overlapping times
             foreach ($provider_entry_times as $client_id => $client_entries) {
                 $entry_times[$client_id] = sort2d($client_entries, 0);
                 $previous = array(0, 0, 0);
                 foreach ($entry_times[$client_id] as $entry_id => $times) {
                     // this in time happened before previous out time.. we have a overlap
                     if ($times[0] < $previous[1] && $entry_id != $previous[2]) {
                         $this->overlaps[$entry_id] = $previous[2];
                         $this->overlaps[$previous[2]] = $entry_id;
                     }
                     $previous = array($times[0], $times[1], $entry_id);
                 }
             }
             // initialize
             $this->classrooms = array();
             //        foreach($this->overlaps as $key => $blah) { echo $key .' => '. $blah->getId() .'<br />'; }
             //        die();
             foreach ($this->all_entries as $entry) {
                 // only kids that have been serviced by this employee
                 if (!$this->form->getValue('employee_id') || $this->form->getValue('employee_id') == $entry->getEmployeeId()) {
                     $office = $entry->getOffice();
                     $client = $entry->getClient();
                     $week = $entry->getServiceDate('W');
                     if (!is_object($office)) {
                         $office = new Office();
                         $office->setName('N/A');
                     }
                     // let's see if we have entered any for this classroom yet
                     if (!array_key_exists($office->getName(), $this->classrooms)) {
                         $this->classrooms[$office->getName()] = array_fill_keys(range(date('W', $first_day), date('W', $last_day)), array());
                     }
                     // initialize the row for this kid
                     if (!array_key_exists($week, $this->classrooms[$office->getName()]) || !array_key_exists($client->getFullName(), $this->classrooms[$office->getName()][$week])) {
                         $days = array();
                         for ($day = 1; $day <= 5; $day++) {
                             $days[date('m/d/Y', strtotime($entry->getServiceDate('Y') . "W" . $week . $day))] = array();
                         }
                         $this->classrooms[$office->getName()][$week][$client->getFullName()] = $days;
                     }
                     // save the entry to the appropriate cell in the table
                     $this->classrooms[$office->getName()][$week][$client->getFullName()][$entry->getServiceDate('m/d/Y')][] = $entry;
                 }
             }
             //        $weeks = array(
             //            'week_num' => array(
             //                'client_name' => array(
             //                    'date' => array(
             //                        'service_type' => 'cell data, time, absent, etc.'
             //                    )
             //                )
             //            )
             //        );
             return 'Report';
         }
     }
 }
Exemplo n.º 5
0
        echo $entry->getCptCode();
        ?>
</td>
                        <th>Units:</th>
                        <td><?php 
        echo $entry->getUnits();
        ?>
</td>
                      </tr>
                      <tr>
                        <th colspan="2">
                          <?php 
        if ($entry->getAbsent()) {
            ?>
                            <?php 
            echo NoteEntryPeer::getAbsentName($entry->getAbsent());
            ?>
 TA-UNBILLED
                          <?php 
        } else {
            ?>
                            <?php 
            if ($entry->countNoteEntryKidss()) {
                ?>
Group:<?php 
            } else {
                ?>
Individual<?php 
            }
            ?>
 BILLED