Example #1
0
 function buildQuickForm()
 {
     $this->addDate('start_date', ts('Start Date'), true);
     $this->addDate('end_date', ts('End Date'), true);
     $this->add('checkbox', 'include_morning', ts('Include Morning Blocks?'));
     $this->add('checkbox', 'show_details', ts('Show Detailed breakdown for each student?'));
     $this->add('checkbox', 'not_signed_out', ts('Show ONLY signed In but not signed out?'));
     $this->add('checkbox', 'show_balances', ts('Show Charges and Payments (all other options are ignored)'));
     require_once 'SFS/Utils/Query.php';
     $students = array('' => '- Select Student -') + SFS_Utils_Query::getStudentsByGrade(true, false);
     $this->add('select', "student_id", ts('Student'), $students);
     $this->addButtons(array(array('type' => 'submit', 'name' => ts('Process'), 'spacing' => '         ', 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
 }
Example #2
0
 function buildQuickForm()
 {
     CRM_Utils_System::setTitle('Parent Signout - Extended Care');
     $this->add('text', 'pickup_name', ts('Parent Name'), 'autocomplete="off"', true);
     $this->assign('date', date('l - F d, Y'));
     require_once 'SFS/Utils/Query.php';
     $students = array('' => '- Select Student -') + SFS_Utils_Query::getStudentsByGrade(true, false, true, '');
     for ($i = 1; $i <= 6; $i++) {
         $required = $i == 1 ? true : false;
         $this->add('select', "student_id_{$i}", ts('Student'), $students, $required);
         $this->add('checkbox', "at_school_meeting_{$i}", ts('School Meeting?'));
     }
     $this->addDefaultButtons('Sign Out', 'next', null, true);
 }
Example #3
0
 static function sendMailToParents($childID, $subjectTPL, $messageTPL, $templateVars, $additionalCC = null)
 {
     require_once 'SFS/Utils/Relationship.php';
     $parentInfo = array();
     SFS_Utils_Relationship::getParents($childID, $parentInfo, false);
     // make sure we unset the older parents
     for ($count = 1; $count < 5; $count++) {
         $templateVars["parent_{$count}_Name"] = null;
     }
     $count = 1;
     $toDisplayName = $toEmail = $cc = null;
     foreach ($parentInfo as $parent) {
         $templateVars["parent_{$count}_Name"] = $parent['name'];
         if ($parent['email']) {
             if (!$toEmail) {
                 $toDisplayName = $parent['name'];
                 $toEmail = $parent['email'];
             } else {
                 if (!empty($cc)) {
                     $cc .= ", ";
                 }
                 $cc .= $parent['email'];
             }
         }
         $count++;
     }
     if ($additionalCC) {
         if (!empty($cc)) {
             $cc .= ", ";
         }
         $cc .= $additionalCC;
     }
     // return if we dont have a toEmail
     if (!$toEmail) {
         return;
     }
     require_once 'SFS/Utils/Query.php';
     list($templateVars['childName'], $templateVars['childEmail']) = SFS_Utils_Query::getNameAndEmail($childID);
     $template = CRM_Core_Smarty::singleton();
     $template->assign($templateVars);
     require_once 'CRM/Utils/Mail.php';
     require_once 'CRM/Utils/String.php';
     $params = array('from' => self::SFS_FROM_EMAIL, 'toName' => $toDisplayName, 'toEmail' => $toEmail, 'subject' => $template->fetch($subjectTPL), 'text' => $template->fetch($messageTPL), 'cc' => $cc, 'bcc' => self::SFS_BCC_EMAIL);
     CRM_Utils_Mail::send($params);
 }
Example #4
0
 function buildQuickForm()
 {
     CRM_Utils_System::setTitle('Morning SignIn - Extended Care');
     $this->add('text', 'pickup_name', ts('Parent Name'), 'autocomplete="off"', true);
     $this->_date = CRM_Utils_Request::retrieve('date', 'String', $this, false, date('Y-m-d'));
     $this->_time = CRM_Utils_Request::retrieve('time', 'String', $this, false, null);
     $this->assign('date', $this->_date);
     $this->assign('time', $this->_time);
     $this->assign('displayDate', date('l - F d, Y', strtotime($this->_date)));
     require_once 'SFS/Utils/Query.php';
     $students = array('' => '- Select Student -') + SFS_Utils_Query::getStudentsByGrade(true, false, true, '');
     for ($i = 1; $i <= 6; $i++) {
         $required = $i == 1 ? true : false;
         $this->add('select', "student_id_{$i}", ts('Student'), $students, $required);
         $this->add('checkbox', "at_school_meeting_{$i}", ts('School Meeting?'));
     }
     $this->addDefaultButtons('Morning Extended Care Signup', 'next', null, true);
 }
Example #5
0
 function buildQuickForm()
 {
     CRM_Utils_System::setTitle('Afternoon SignIn - Extended Care');
     require_once 'SFS/Utils/ExtendedCare.php';
     $term = SFS_Utils_ExtendedCare::getTerm($term);
     $sql = "\n( \nSELECT     c.id as contact_id, c.display_name as display_name, s.name as course_name, v.grade as grade,\n           0 as sout_id, 0 as signout_time, e.location as course_location\nFROM       civicrm_contact c\nINNER JOIN civicrm_value_school_information v ON v.entity_id = c.id\nINNER JOIN civicrm_value_extended_care s ON ( s.entity_id = c.id AND s.has_cancelled = 0 AND s.day_of_week = '{$this->_dayOfWeek}' )\nINNER JOIN sfschool_extended_care_source e ON ( s.session = e.session AND s.name = e.name AND s.term = e.term AND s.day_of_week = e.day_of_week ) \nWHERE      v.subtype = 'Student'\nAND        v.grade_sis >= 1\nAND        e.is_active = 1\nAND        s.term = %3\n)\nUNION\n(\nSELECT     c.id as contact_id, c.display_name as display_name, sout.class as course_name, v.grade as grade,\n           sout.id as sout_id, sout.signout_time as signout_time, e.location as course_location\nFROM       civicrm_contact c\nINNER JOIN civicrm_value_school_information v ON v.entity_id = c.id\nINNER JOIN civicrm_value_extended_care_signout sout ON sout.entity_id = c.id\nINNER JOIN sfschool_extended_care_source e ON ( sout.class = e.name )\nWHERE      v.subtype = 'Student'\nAND        v.grade_sis >= 1\nAND        ( sout.is_morning = 0 OR sout.is_morning IS NULL )\nAND        DATE( sout.signin_time ) = %1\nAND        e.is_active = 1\nAND        e.day_of_week = %2\n)\nUNION\n(\nSELECT     c.id as contact_id, c.display_name as display_name, sout.class as course_name, v.grade as grade,\n           -1 as sout_id, 0 as signout_time, e.location as course_location\nFROM       civicrm_contact c\nINNER JOIN civicrm_value_school_information v ON v.entity_id = c.id\nINNER JOIN civicrm_value_extended_care_signout sout ON sout.entity_id = c.id\nINNER JOIN sfschool_extended_care_source e ON ( sout.class = e.name )\nWHERE      v.subtype = 'Student'\nAND        v.grade_sis >= 1\nAND        ( sout.is_morning = 0 OR sout.is_morning IS NULL )\nAND        DAYNAME( sout.signin_time ) = %2\nAND        DATE_ADD( sout.signin_time, INTERVAL 8 DAY ) > '{$this->_date}'\nAND        e.is_active = 1\nAND        e.day_of_week = %2\nGROUP BY   c.id\nORDER BY   id DESC\n)\nORDER BY contact_id, sout_id DESC, course_name, display_name, signout_time\n";
     $params = array(1 => array($this->_date, 'String'), 2 => array($this->_dayOfWeek, 'String'), 3 => array($term, 'String'));
     $dao = CRM_Core_DAO::executeQuery($sql, $params);
     $someSignedIn = false;
     $studentDetails = array();
     while ($dao->fetch()) {
         if (array_key_exists($dao->contact_id, $studentDetails)) {
             continue;
         }
         $courseName = $dao->sout_class ? $dao->sout_class : $dao->course_name;
         if (empty($courseName)) {
             $courseName = $dao->grade <= 5 ? 'Yard Play' : 'Homework';
         }
         $studentDetails[$dao->contact_id] = array('display_name' => $dao->display_name, 'course_name' => $courseName, 'course_location' => $dao->course_location, 'grade' => $dao->grade, 'contact_id' => $dao->contact_id, 'is_marked' => $dao->sout_id > 0 ? 1 : 0, 'signout_block' => self::signoutBlock($dao->signout_time));
         if ($dao->sout_id > 0) {
             $someSignedIn = true;
         }
     }
     $this->assign('studentDetails', $studentDetails);
     $this->assign('someSignedIn', $someSignedIn);
     require_once 'SFS/Utils/Query.php';
     $students = array('' => '- Select Student -') + SFS_Utils_Query::getStudentsByGrade(true, false, true, '');
     $this->add('select', "student_id", ts('Student'), $students);
     $this->add('select', "student_id_top", ts('Student'), $students);
     $classes = array('' => '- Select Class -') + SFS_Utils_Query::getClasses();
     $this->add('select', "course_name", ts('Course'), $classes);
     $this->add('select', "course_name_top", ts('Course'), $classes);
     $timeSlots = array('' => '- Select Time -', 1 => 'Before 3:30 pm', 2 => '3:30 - 4:30 pm', 3 => '4:30 - 5:15 pm', 4 => '5:15 - 6:00 pm', 5 => 'After  6:00 pm');
     $this->add('select', "signout_time", ts('Signout Time'), $timeSlots);
     $this->add('select', "signout_time_top", ts('Signout Time'), $timeSlots);
 }
Example #6
0
 function postProcess($class, &$form, $gid, $term)
 {
     $excare = CRM_Utils_Request::retrieve('excare', 'Integer', $form, false, null, $_REQUEST);
     if ($excare != 1) {
         return;
     }
     $childID = $form->getVar('_id');
     if (empty($childID) || !CRM_Utils_Rule::positiveInteger($childID)) {
         return;
     }
     $params = $form->controller->exportValues($form->getVar('_name'));
     $daysOfWeek =& self::daysOfWeek();
     $sessions =& self::sessions();
     $classSignedUpFor = array();
     $classCancelled = array();
     foreach ($daysOfWeek as $day) {
         foreach ($sessions as $session) {
             $name = "sfschool_activity_{$day}_{$session}";
             if (!empty($params["{$name}_cancel"])) {
                 if (!array_key_exists($day, $classCancelled)) {
                     $classCancelled[$day] = array();
                 }
                 $classCancelled[$day][$session] = $params[$name];
                 continue;
             }
             if (!in_array($name, self::$_registeredElements) && !empty($params[$name])) {
                 if (!array_key_exists($day, $classSignedUpFor)) {
                     $classSignedUpFor[$day] = array();
                 }
                 $classSignedUpFor[$day][$session] = $params[$name];
             }
         }
     }
     if (empty($classSignedUpFor) && empty($classCancelled)) {
         return;
     }
     require_once 'SFS/Utils/Query.php';
     $grade = SFS_Utils_Query::getGrade($childID);
     if (!is_numeric($grade)) {
         return;
     }
     $classInfo = self::getClassCount($grade, false, $term);
     self::getCurrentClasses($childID, $classInfo, $term);
     $activities = self::getActivities($grade, $classInfo, true, $term);
     $templateVars = array('term' => $term, 'classCancelled' => array(), 'classSignedUpFor' => array());
     // first deal with all cancelled classes
     if (!empty($classCancelled)) {
         foreach ($classCancelled as $day => $dayValues) {
             foreach ($dayValues as $session => $classID) {
                 if (array_key_exists($classID, $activities[$day][$session]['details'])) {
                     self::postProcessClass($childID, $activities[$day][$session]['details'][$classID], 'Cancelled');
                     $templateVars['classCancelled'][$classID] = $activities[$day][$session]['details'][$classID];
                 } else {
                     CRM_Core_Error::fatal($classID);
                 }
             }
         }
     }
     if (!empty($classSignedUpFor)) {
         foreach ($classSignedUpFor as $day => $dayValues) {
             foreach ($dayValues as $session => $classID) {
                 if (array_key_exists($classID, $activities[$day][$session]['details'])) {
                     self::postProcessClass($childID, $activities[$day][$session]['details'][$classID], 'Added');
                     $templateVars['classSignedUpFor'][$classID] = $activities[$day][$session]['details'][$classID];
                 } else {
                     CRM_Core_Error::fatal($classID);
                 }
             }
         }
     }
     self::sendExtendedCareEmail($childID, $templateVars);
 }
Example #7
0
 function sendConferenceEmail($activityID, $advisorID, $childID, $dateTime = null)
 {
     require_once 'SFS/Utils/Query.php';
     $templateVars = array();
     list($templateVars['advisorName'], $templateVars['advisorEmail']) = SFS_Utils_Query::getNameAndEmail($advisorID);
     if ($dateTime == null) {
         $dateTime = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $activityID, 'activity_date_time');
     }
     $templateVars['dateTime'] = CRM_Utils_Date::customFormat($dateTime, "%l:%M %P on %b %E%f");
     // now send a message to the parents about what they did
     require_once 'SFS/Utils/Mail.php';
     SFS_Utils_Mail::sendMailToParents($childID, 'SFS/Mail/Conference/Subject.tpl', 'SFS/Mail/Conference/Message.tpl', $templateVars);
 }
Example #8
0
 public function buildQuickForm()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         $buttonLabel = ts('Delete');
     } else {
         require_once 'SFS/Utils/Query.php';
         $buttonLabel = ts('Save');
         $students = SFS_Utils_Query::getStudentsByGrade(true, false, true, '');
         $this->add('select', 'entity_id', ts('Student'), array('' => '--select--') + $students, true);
         if ($this->_action & CRM_Core_Action::UPDATE) {
             $this->freeze('entity_id');
         }
         if ($this->_object == 'fee') {
             $sql = "SELECT cf.column_name as column_name, cf.option_group_id as option_group_id\n                         FROM civicrm_custom_field cf\n                         INNER JOIN  civicrm_custom_group cg ON cf.custom_group_id = cg.id\n                         WHERE cg.table_name = %1";
             $params = array(1 => array($this->_tableName, 'String'));
             $dao = CRM_Core_DAO::executeQuery($sql, $params);
             $options = array();
             while ($dao->fetch()) {
                 if ($dao->option_group_id) {
                     $options[$dao->column_name] = CRM_Core_OptionGroup::valuesByID($dao->option_group_id);
                 }
             }
             $this->add('select', 'fee_type', ts('Fee Type'), array('' => '--select--') + $options['fee_type'], true);
             $this->add('select', 'category', ts('Category'), array('' => '--select--') + $options['category'], true);
             $this->add('text', 'description', ts('Description'), null, true);
             $this->addDate('fee_date', ts('Fee Date'), CRM_Core_SelectValues::date('custom', 1, 1));
             $this->add('text', 'total_blocks', ts('Total Blocks'), null, true);
             $this->addRule('total_blocks', ts('Please enter valid Total Blocks'), 'positiveInteger');
         } else {
             $classes = SFS_Utils_Query::getClasses();
             $this->add('text', 'pickup_person_name', ts('Pickup Person:'));
             $this->addDateTime('signin_time', ts('Signin'), CRM_Core_SelectValues::date('custom', 10, 2));
             $this->addDateTime('signout_time', ts('Signout'), CRM_Core_SelectValues::date('custom', 10, 2));
             $this->add('select', 'class', ts('Class'), array('' => '--select--') + $classes, true);
             $this->add('checkbox', 'is_morning', ts('Is morning?'));
             $this->add('checkbox', 'at_school_meeting', ts('At School Meeting?'));
         }
     }
     $this->addButtons(array(array('type' => 'next', 'name' => $buttonLabel, 'spacing' => '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;', 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
 }