public function executeChartOffices() { $data = array(); foreach (OfficePeer::doSelect(new Criteria()) as $office) { $c = new Criteria(); $c->add(ClientServicePeer::OFFICE_ID, $office->getId()); $data[$office->getName()] = ClientServicePeer::doCount(ClientServicePeer::addActive($c)); } //Creating a stGraph object $g = new stGraph(); //set background color $g->bg_colour = '#FFFFFF'; //Set the transparency, line colour to separate each slice etc. $g->pie(90, '#78B9EC', '{font-size: 12px; color: #000000;'); //array two arrray one containing data while other contaning labels $g->pie_values($data, array_keys($data)); //Set the colour for each slice. Here we are defining three colours //while we need 7 colours. So, the same colours will be //repeated for the all remaining slices in the same order $g->pie_slice_colours(array('#d01f3c', '#356aa0', '#c79810')); //To display value as tool tip $g->set_tool_tip('#val# Services'); $g->title('Active Client Services At Location', '{font-size:18px;margin-bottom:20px}'); echo $g->render(); return sfView::NONE; }
public function getActiveClientServices(Criteria $c = null) { if (!$c) { $c = new Criteria(); } return $this->getClientServicesJoinClient(ClientServicePeer::addActive($c)); }
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')))); }
public function executeSedcar2(sfWebRequest $request) { $this->form = new ReportSedcarForm(); if ($request->isMethod('post')) { $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName())); if ($this->form->isValid()) { $date = $this->form->getValue('date'); $as_of_date = mktime(0, 0, 0, $date['month'], $date['day'], $date['year']); $mysql_as_of_date = date('Y-m-d H:i:s', $as_of_date); $c = new Criteria(); // limit to preschool $c->add(ClientServicePeer::OBJECT_TYPE, ClientServicePeer::CLASSKEY_PRESCHOOL); // only active services $c = ClientServicePeer::addActive($c, $as_of_date); // only for related services $c->add(ClientServicePeer::SERVICE_ID, sfConfig::get('app_settings_related_service_ids', array('1', '2', '4', '8')), Criteria::IN); // no duplicate children $c->addGroupByColumn(ClientServicePeer::CLIENT_ID); // subselect to remove all children in seit - (seit.CHANGE_DATE>\''. $mysql_as_of_date .'\' OR seit.CHANGE_DATE IS NULL ) AND seit.START_DATE<=\''. $mysql_as_of_date .'\' AND seit.END_DATE>=\''. $mysql_as_of_date .'\' $seit_select = ClientServicePeer::CLIENT_ID . ' NOT IN ( SELECT ' . ClientServicePeer::CLIENT_ID . ' FROM `' . ClientServicePeer::TABLE_NAME . '` WHERE ' . ClientServicePeer::CLIENT_ID . ' IS NOT NULL AND ' . ClientServicePeer::OBJECT_TYPE . ' = \'' . ClientServicePeer::CLASSKEY_SEIT . '\' AND (' . ClientServicePeer::CHANGE_DATE . '>\'' . $mysql_as_of_date . '\' OR ' . ClientServicePeer::CHANGE_DATE . ' IS NULL ) AND ' . ClientServicePeer::START_DATE . '<=\'' . $mysql_as_of_date . '\' AND ' . ClientServicePeer::END_DATE . '>=\'' . $mysql_as_of_date . '\' GROUP BY ' . ClientServicePeer::CLIENT_ID . ' )'; $c->add(ClientServicePeer::CLIENT_ID, $seit_select, Criteria::CUSTOM); // dont include waiting list kids $c->add(ClientServicePeer::WAITING_LIST, false); $results = ClientServicePeer::doSelectJoinAll($c); $this->districts = array(); foreach ($results as $seit) { $d = $seit->getClient()->getDistrict(); if (is_object($d)) { $this->districts[$d->getName()][] = $seit; } } ksort($this->districts); $this->date = $as_of_date; $this->setTemplate('sedcarReport'); } } }