private function addActivityScheduleEvent() { /* Bail out if we don't have a valid candidate ID. */ if (!$this->isRequiredIDValid('contactID', $_GET)) { CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid contact ID.'); } $contactID = $_GET['contactID']; $contacts = new Contacts($this->_siteID); $contactData = $contacts->get($contactID); $regardingRS = $contacts->getJobOrdersArray($contactID); $calendar = new Calendar($this->_siteID); $calendarEventTypes = $calendar->getAllEventTypes(); /* Are we in "Only Schedule Event" mode? */ $onlyScheduleEvent = $this->isChecked('onlyScheduleEvent', $_GET); if (!eval(Hooks::get('CONTACTS_ADD_ACTIVITY_SCHEDULE_EVENT'))) { return; } if (SystemUtility::isSchedulerEnabled() && !$_SESSION['CATS']->isDemo()) { $allowEventReminders = true; } else { $allowEventReminders = false; } $this->_template->assign('contactID', $contactID); $this->_template->assign('regardingRS', $regardingRS); $this->_template->assign('allowEventReminders', $allowEventReminders); $this->_template->assign('userEmail', $_SESSION['CATS']->getEmail()); $this->_template->assign('onlyScheduleEvent', $onlyScheduleEvent); $this->_template->assign('calendarEventTypes', $calendarEventTypes); $this->_template->assign('isFinishedMode', false); $this->_template->display('./modules/contacts/AddActivityScheduleEventModal.tpl'); }
private function addActivityChangeStatus() { /* Bail out if we don't have a valid candidate ID. */ if (!$this->isRequiredIDValid('candidateID', $_GET)) { CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid candidate ID.'); } /* Bail out if we don't have a valid job order ID. */ if (!$this->isRequiredIDValid('jobOrderID', $_GET)) { CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid job order ID.'); } $candidateID = $_GET['candidateID']; $jobOrderID = $_GET['jobOrderID']; $candidates = new Candidates($this->_siteID); $candidateData = $candidates->get($candidateID); /* Bail out if we got an empty result set. */ if (empty($candidateData)) { CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'The specified candidate ID could not be found.'); } $pipelines = new Pipelines($this->_siteID); $pipelineData = $pipelines->get($candidateID, $jobOrderID); /* Bail out if we got an empty result set. */ if (empty($pipelineData)) { CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'The specified pipeline entry could not be found.'); } $statusRS = $pipelines->getStatusesForPicking(); $selectedStatusID = $pipelineData['statusID']; /* Override default send email behavior with site specific send email behavior. */ $mailerSettings = new MailerSettings($this->_siteID); $mailerSettingsRS = $mailerSettings->getAll(); $candidateJoborderStatusSendsMessage = unserialize($mailerSettingsRS['candidateJoborderStatusSendsMessage']); foreach ($statusRS as $index => $status) { $statusRS[$index]['triggersEmail'] = $candidateJoborderStatusSendsMessage[$status['statusID']]; } /* Get the change status email template. */ $emailTemplates = new EmailTemplates($this->_siteID); $statusChangeTemplateRS = $emailTemplates->getByTag('EMAIL_TEMPLATE_STATUSCHANGE'); if (empty($statusChangeTemplateRS) || empty($statusChangeTemplateRS['textReplaced'])) { $statusChangeTemplate = ''; $emailDisabled = $statusChangeTemplateRS['disabled']; } else { $statusChangeTemplate = $statusChangeTemplateRS['textReplaced']; $emailDisabled = $statusChangeTemplateRS['disabled']; } /* Replace e-mail template variables. '%CANDSTATUS%', '%JBODTITLE%', * '%JBODCLIENT%' are replaced by JavaScript. */ $stringsToFind = array('%CANDOWNER%', '%CANDFIRSTNAME%', '%CANDFULLNAME%'); $replacementStrings = array($candidateData['ownerFullName'], $candidateData['firstName'], $candidateData['firstName'] . ' ' . $candidateData['lastName']); $statusChangeTemplate = str_replace($stringsToFind, $replacementStrings, $statusChangeTemplate); $calendar = new Calendar($this->_siteID); $calendarEventTypes = $calendar->getAllEventTypes(); if (SystemUtility::isSchedulerEnabled() && !$_SESSION['CATS']->isDemo()) { $allowEventReminders = true; } else { $allowEventReminders = false; } $this->_template->assign('candidateID', $candidateID); $this->_template->assign('pipelineData', $pipelineData); $this->_template->assign('statusRS', $statusRS); $this->_template->assign('selectedJobOrderID', $jobOrderID); $this->_template->assign('selectedStatusID', $selectedStatusID); $this->_template->assign('calendarEventTypes', $calendarEventTypes); $this->_template->assign('allowEventReminders', $allowEventReminders); $this->_template->assign('userEmail', $_SESSION['CATS']->getEmail()); $this->_template->assign('onlyScheduleEvent', false); $this->_template->assign('statusChangeTemplate', $statusChangeTemplate); $this->_template->assign('emailDisabled', $emailDisabled); $this->_template->assign('isFinishedMode', false); $this->_template->assign('isJobOrdersMode', true); if (!eval(Hooks::get('JO_ADD_ACTIVITY_CHANGE_STATUS'))) { return; } $this->_template->display('./modules/candidates/AddActivityChangeStatusModal.tpl'); }
public function showCalendar() { $currentHour = DateUtility::getAdjustedDate('H'); $currentDay = DateUtility::getAdjustedDate('j'); $currentMonth = DateUtility::getAdjustedDate('n'); $currentYear = DateUtility::getAdjustedDate('Y'); $currentUnixTime = DateUtility::getAdjustedDate(); $currentDateMDY = DateUtility::getAdjustedDate('m-d-y'); $currentWeek = DateUtility::getWeekNumber($currentUnixTime) - DateUtility::getWeekNumber( mktime(0, 0, 0, $currentMonth, 1, $currentYear) ); /* Do we have a valid date argument? If a month was specified and * isn't valid, fatal() out. If none was specified, use the current * month. */ if ($this->isRequiredIDValid('month', $_GET) && $this->isRequiredIDValid('year', $_GET)) { $month = $_GET['month']; $year = $_GET['year']; if (!checkdate($month, 1, $year)) { CommonErrors::fatal(COMMONERROR_BADFIELDS, $this, 'Invalid date.'); } if ($month == $currentMonth && $year == $currentYear) { $isCurrentMonth = true; } else { $isCurrentMonth = false; } } else { $month = $currentMonth; $year = $currentYear; $isCurrentMonth = true; } if (isset($_GET['view'])) { $view = $_GET['view']; } else { $view = 'DEFAULT_VIEW'; } if (isset($_GET['week'])) { $week = $_GET['week']; } else { $week = $currentWeek+1; } if (isset($_GET['day'])) { $day = $_GET['day']; } else { $day = $currentDay; } if (isset($_GET['showEvent'])) { $showEvent = $_GET['showEvent']; } else { $showEvent = null; } $userIsSuperUser = ($this->_accessLevel < ACCESS_LEVEL_SA ? 0 : 1); if ($userIsSuperUser && isset($_GET['superuser']) && $_GET['superuser'] == 1) { $superUserActive = true; } else { $superUserActive = false; } $startingWeekday = DateUtility::getStartingWeekday($month, $year); $daysInMonth = DateUtility::getDaysInMonth($month, $year); $calendar = new Calendar($this->_siteID); $monthBefore = $month - 1; $monthAfter = $month + 1; $yearBefore = $year; $yearAfter = $year; if ($monthAfter > 12) { $monthAfter = 1; $yearAfter = $year + 1; } if ($monthBefore < 1) { $monthBefore = 12; $yearBefore = $year - 1; } $eventsStringNow = $calendar->makeEventString( $calendar->getEventArray($month, $year), $month, $year ); $eventsStringBefore = $calendar->makeEventString( $calendar->getEventArray($monthBefore, $yearBefore), $monthBefore, $yearBefore ); $eventsStringAfter = $calendar->makeEventString( $calendar->getEventArray($monthAfter, $yearAfter), $monthAfter, $yearAfter ); $eventsString = implode( '@', array($eventsStringNow, $eventsStringBefore, $eventsStringAfter, $userIsSuperUser) ); /* Textual representation of the month and year. */ $dateString = date( 'F Y', mktime($_SESSION['CATS']->getTimeZoneOffset(), 0, 0, $month, 1, $year) ); /* The offset is the number of days after the first Sunday on a given * calendar page on which the 1st of the month falls. We subtract 1 * because Sunday has a value of 1. */ $startingOffset = $startingWeekday - 1; $userEmail = $_SESSION['CATS']->getEmail(); $calendarEventTypes = $calendar->getAllEventTypes(); $calendarSettings = new CalendarSettings($this->_siteID); $calendarSettingsRS = $calendarSettings->getAll(); if ($view == 'DEFAULT_VIEW') { $view = $calendarSettingsRS['calendarView']; } $summaryHTML = $calendar->getUpcomingEventsHTML(12, UPCOMING_FOR_CALENDAR); if (!eval(Hooks::get('CALENDAR_SHOW'))) return; if (SystemUtility::isSchedulerEnabled() && !$_SESSION['CATS']->isDemo()) { $allowEventReminders = true; } else { $allowEventReminders = false; } /* FIXME: Configurable */ $this->_template->assign('dayHourStart', $calendarSettingsRS['dayStart']); $this->_template->assign('dayHourEnd', $calendarSettingsRS['dayStop']); $this->_template->assign('firstDayMonday', $calendarSettingsRS['firstDayMonday']); $this->_template->assign('allowAjax', ($calendarSettingsRS['noAjax'] == 0 ? true : false)); $this->_template->assign('defaultPublic', ($calendarSettingsRS['defaultPublic'] == 0 ? 'false' : 'true')); $this->_template->assign('militaryTime', false); $this->_template->assign('active', $this); $this->_template->assign('currentDateMDY', $currentDateMDY); $this->_template->assign('startingWeekday', $startingWeekday); $this->_template->assign('daysInMonth', $daysInMonth); $this->_template->assign('currentHour', $currentHour); $this->_template->assign('currentDay', $currentDay); $this->_template->assign('currentMonth', $currentMonth); $this->_template->assign('currentYear', $currentYear); $this->_template->assign('startingOffset', $startingOffset); $this->_template->assign('userEmail', $userEmail); $this->_template->assign('userID', $this->_userID); $this->_template->assign('userEmail', $_SESSION['CATS']->getEmail()); $this->_template->assign('summaryHTML', $summaryHTML); $this->_template->assign('userIsSuperUser', $userIsSuperUser); $this->_template->assign('superUserActive', $superUserActive); $this->_template->assign('calendarEventTypes', $calendarEventTypes); $this->_template->assign('view', $view); $this->_template->assign('day', $day); $this->_template->assign('week', $week); $this->_template->assign('month', $month); $this->_template->assign('year', $year); $this->_template->assign('showEvent', $showEvent); $this->_template->assign('dateString', $dateString); $this->_template->assign('isCurrentMonth', $isCurrentMonth); $this->_template->assign('eventsString', $eventsString); $this->_template->assign('allowEventReminders', $allowEventReminders); $this->_template->display('./modules/calendar/Calendar.php'); }
private function addActivityChangeStatus() { /* Bail out if we don't have a valid candidate ID. */ if (!$this->isRequiredIDValid('candidateID', $_GET)) { CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid candidate ID.'); } /* Bail out if we don't have a valid job order ID. */ if (!$this->isOptionalIDValid('jobOrderID', $_GET)) { CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid job order ID.'); } $selectedJobOrderID = $_GET['jobOrderID']; $candidateID = $_GET['candidateID']; $candidates = new Candidates($this->_siteID); $candidateData = $candidates->get($candidateID); /* Bail out if we got an empty result set. */ if (empty($candidateData)) { CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this); return; /*$this->fatalModal( 'The specified candidate ID could not be found.' );*/ } $pipelines = new Pipelines($this->_siteID); $pipelineRS = $pipelines->getCandidatePipeline($candidateID); $statusRS = $pipelines->getStatusesForPicking(); if ($selectedJobOrderID != -1) { $selectedStatusID = ResultSetUtility::getColumnValueByIDValue($pipelineRS, 'jobOrderID', $selectedJobOrderID, 'statusID'); } else { $selectedStatusID = -1; } /* Get the change status email template. */ $emailTemplates = new EmailTemplates($this->_siteID); $statusChangeTemplateRS = $emailTemplates->getByTag('EMAIL_TEMPLATE_STATUSCHANGE'); if (empty($statusChangeTemplateRS) || empty($statusChangeTemplateRS['textReplaced'])) { $statusChangeTemplate = ''; $emailDisabled = '1'; } else { $statusChangeTemplate = $statusChangeTemplateRS['textReplaced']; $emailDisabled = $statusChangeTemplateRS['disabled']; } /* Replace e-mail template variables. '%CANDSTATUS%', '%JBODTITLE%', * '%JBODCLIENT%' are replaced by JavaScript. */ $stringsToFind = array('%CANDOWNER%', '%CANDFIRSTNAME%', '%CANDFULLNAME%'); $replacementStrings = array($candidateData['ownerFullName'], $candidateData['firstName'], $candidateData['firstName'] . ' ' . $candidateData['lastName'], $candidateData['firstName'], $candidateData['firstName']); $statusChangeTemplate = str_replace($stringsToFind, $replacementStrings, $statusChangeTemplate); /* Are we in "Only Schedule Event" mode? */ $onlyScheduleEvent = $this->isChecked('onlyScheduleEvent', $_GET); $calendar = new Calendar($this->_siteID); $calendarEventTypes = $calendar->getAllEventTypes(); if (!eval(Hooks::get('CANDIDATE_ADD_ACTIVITY_CHANGE_STATUS'))) { return; } if (SystemUtility::isSchedulerEnabled() && !$_SESSION['CATS']->isDemo()) { $allowEventReminders = true; } else { $allowEventReminders = false; } $this->_template->assign('candidateID', $candidateID); $this->_template->assign('pipelineRS', $pipelineRS); $this->_template->assign('statusRS', $statusRS); $this->_template->assign('selectedJobOrderID', $selectedJobOrderID); $this->_template->assign('selectedStatusID', $selectedStatusID); $this->_template->assign('allowEventReminders', $allowEventReminders); $this->_template->assign('userEmail', $_SESSION['CATS']->getEmail()); $this->_template->assign('calendarEventTypes', $calendarEventTypes); $this->_template->assign('statusChangeTemplate', $statusChangeTemplate); $this->_template->assign('onlyScheduleEvent', $onlyScheduleEvent); $this->_template->assign('emailDisabled', $emailDisabled); $this->_template->assign('isFinishedMode', false); $this->_template->assign('isJobOrdersMode', false); $this->_template->display('./modules/candidates/AddActivityChangeStatusModal.tpl'); }