$expressionType = new ExpressionType();
         $expressionType->expressionTypeID = '';
     }
     $expressionType->shortName = $_POST['shortName'];
     $expressionType->noteType = $_POST['noteType'];
     try {
         $expressionType->save();
     } catch (Exception $e) {
         echo $e->POSTMessage();
     }
     break;
 case 'submitCalendarSettings':
     if (isset($_POST['calendarSettingsID']) && $_POST['calendarSettingsID'] != '') {
         $calendarSettings = new CalendarSettings(new NamedArguments(array('primaryKey' => $_POST['calendarSettingsID'])));
     } else {
         $calendarSettings = new CalendarSettings();
         $calendarSettings->calendarSettingsID = '';
     }
     if (is_array($_POST['value'])) {
         $calendarSettings->value = implode(',', $_POST['value']);
     } else {
         $calendarSettings->value = $_POST['value'];
     }
     try {
         $calendarSettings->save();
     } catch (Exception $e) {
         echo $e->POSTMessage();
     }
     break;
 case 'submitQualifier':
     if (isset($_POST['qualifierID']) && $_POST['qualifierID'] != '') {
예제 #2
0
 private function onCustomizeCalendar()
 {
     if ($this->_realAccessLevel < ACCESS_LEVEL_SA) {
         CommonErrors::fatal(COMMONERROR_PERMISSION, $this);
         return;
         //$this->fatal(ERROR_NO_PERMISSION);
     }
     $calendarSettings = new CalendarSettings($this->_siteID);
     $calendarSettingsRS = $calendarSettings->getAll();
     foreach ($calendarSettingsRS as $setting => $value) {
         if ($setting == 'noAjax' || $setting == 'defaultPublic' || $setting == 'firstDayMonday') {
             if ($this->isChecked($setting, $_POST)) {
                 $calendarSettings->set($setting, '1');
             } else {
                 $calendarSettings->set($setting, '0');
             }
         } else {
             if (isset($_POST[$setting])) {
                 $calendarSettings->set($setting, $_POST[$setting]);
             }
         }
     }
     $this->_template->assign('active', $this);
     CATSUtility::transferRelativeURI('m=settings&a=administration');
 }
예제 #3
0
                echo "<td style='width:30px'><a href='ajax_forms.php?action=getExpressionTypeForm&expressionTypeID=" . $instance['expressionTypeID'] . "&height=158&width=265&modal=true' class='thickbox'>update</a></td>";
                echo "<td style='width:50px'><a href='javascript:deleteExpressionType(\"" . $instance['expressionTypeID'] . "\")'>remove</a></td>";
                echo "</tr>";
            }
            ?>
			</table>
			<?php 
        } else {
            echo "(none found)";
        }
        break;
        //display expression type list for admin screen - needs its own display because of note type
    //display expression type list for admin screen - needs its own display because of note type
    case 'getCalendarSettingsList':
        $instanceArray = array();
        $calendarSettings = new CalendarSettings();
        $tempArray = array();
        foreach ($calendarSettings->allAsArray() as $tempArray) {
            array_push($instanceArray, $tempArray);
        }
        if (count($instanceArray) > 0) {
            ?>
			<table class='dataTable' style='width:400px'>
				<tr>
				<th>Setting</th>
				<th>Value</th>
				<th>&nbsp;</th>

				<?php 
            foreach ($instanceArray as $instance) {
                echo "<tr>";
예제 #4
0
 /**
  * Returns an associative array with 4 rows of either the last 4 weeks or 4 months 
  * statistics on submitted, interviewing, and placed candidates.
  *
  * @param integer pipeline view indentifier
  * @return array pipeline graph data
  */
 public function getPipelineData($view)
 {
     $oneUnixDay = 86400;
     $calendarSettings = new CalendarSettings($this->_siteID);
     $calendarSettingsRS = $calendarSettings->getAll();
     if ($calendarSettingsRS['firstDayMonday'] == 1) {
         $firstDayMonday = true;
         $firstDayModifierPlus = ' + 1';
         $dateNowForWeeks = 'DATE_SUB(NOW(), INTERVAL 1 DAY)';
         $dateEventForWeeks = 'DATE_SUB(candidate_joborder_status_history.date, INTERVAL 1 DAY)';
     } else {
         $firstDayMonday = false;
         $firstDayModifierPlus = '';
         $firstDayModifierMinus = '';
         $dateNowForWeeks = 'NOW()';
         $dateEventForWeeks = 'candidate_joborder_status_history.date';
     }
     switch ($view) {
         case DASHBOARD_GRAPH_YEARLY:
             $select = 'YEAR(candidate_joborder_status_history.date) as unixdate';
             break;
         case DASHBOARD_GRAPH_MONTHLY:
             $select = 'UNIX_TIMESTAMP(FROM_DAYS(TO_DAYS(candidate_joborder_status_history.date) - DAYOFMONTH(candidate_joborder_status_history.date) + 1)) as unixdate';
             break;
         case DASHBOARD_GRAPH_WEEKLY:
         default:
             $select = 'UNIX_TIMESTAMP(FROM_DAYS(TO_DAYS(' . $dateEventForWeeks . ') - DAYOFWEEK(' . $dateEventForWeeks . ') + 1 ' . $firstDayModifierPlus . ')) as unixdate';
             break;
     }
     /* This SQL query either returns 1 row per week or 1 row per month for the total 
      * count of sub, int, and pla status changes in the system.
      */
     /* Limit 20 because if time was skewed, there may be events in the future that
      * the PHP function will throw out, but future events will prevent past events
      * from loading properly.  We don't need a limit at all, but limiting 20 results 
      * back should guarantee we will always at least get the relavant rows we want.
      */
     $sql = sprintf("SELECT\n                %s,\n                SUM(IF(candidate_joborder_status_history.status_to = %s, 1, 0)) AS submitted,\n                SUM(IF(candidate_joborder_status_history.status_to = %s, 1, 0)) AS interviewing,\n                SUM(IF(candidate_joborder_status_history.status_to = %s, 1, 0)) AS placed\n            FROM\n                candidate_joborder_status_history\n            WHERE\n                candidate_joborder_status_history.site_id = %s\n            GROUP BY unixdate\n            ORDER BY unixdate DESC\n            LIMIT 20\n            ", $select, PIPELINE_STATUS_SUBMITTED, PIPELINE_STATUS_INTERVIEWING, PIPELINE_STATUS_PLACED, $this->_siteID);
     $rs = $this->_db->getAllAssoc($sql);
     /* Gets some numbers as to what week and month MySQL thinks it is. */
     $sql = sprintf("SELECT \n                YEAR(NOW()) as currentYearNumber,\n                UNIX_TIMESTAMP(FROM_DAYS(TO_DAYS(%s) - DAYOFWEEK(%s) + 1 %s)) as currentWeekNumber,\n                UNIX_TIMESTAMP(FROM_DAYS(TO_DAYS(DATE_SUB(%s, INTERVAL 7 DAY)) - DAYOFWEEK(DATE_SUB(%s, INTERVAL 7 DAY)) + 1 %s)) as oneWeekAgoNumber,\n                UNIX_TIMESTAMP(FROM_DAYS(TO_DAYS(DATE_SUB(%s, INTERVAL 14 DAY)) - DAYOFWEEK(DATE_SUB(%s, INTERVAL 14 DAY)) + 1 %s)) as twoWeekAgoNumber,\n                UNIX_TIMESTAMP(FROM_DAYS(TO_DAYS(DATE_SUB(%s, INTERVAL 21 DAY)) - DAYOFWEEK(DATE_SUB(%s, INTERVAL 21 DAY)) + 1 %s)) as threeWeekAgoNumber,\n                UNIX_TIMESTAMP(FROM_DAYS(TO_DAYS(NOW()) - DAYOFMONTH(NOW()) + 1)) as currentMonthNumber,\n                UNIX_TIMESTAMP(FROM_DAYS(TO_DAYS(DATE_SUB(NOW(), INTERVAL 1 MONTH)) - DAYOFMONTH(DATE_SUB(NOW(), INTERVAL 1 MONTH)) + 1)) as oneMonthAgoNumber,\n                UNIX_TIMESTAMP(FROM_DAYS(TO_DAYS(DATE_SUB(NOW(), INTERVAL 2 MONTH)) - DAYOFMONTH(DATE_SUB(NOW(), INTERVAL 2 MONTH)) + 1)) as twoMonthAgoNumber,\n                UNIX_TIMESTAMP(FROM_DAYS(TO_DAYS(DATE_SUB(NOW(), INTERVAL 3 MONTH)) - DAYOFMONTH(DATE_SUB(NOW(), INTERVAL 3 MONTH)) + 1)) as threeMonthAgoNumber,\n                MONTHNAME(NOW()) as currentMonthName,\n                MONTHNAME(DATE_SUB(NOW(), INTERVAL 1 MONTH)) as oneMonthAgoName,\n                MONTHNAME(DATE_SUB(NOW(), INTERVAL 2 MONTH)) as twoMonthAgoName,\n                MONTHNAME(DATE_SUB(NOW(), INTERVAL 3 MONTH)) as threeMonthAgoName\n            ", $dateNowForWeeks, $dateNowForWeeks, $firstDayModifierPlus, $dateNowForWeeks, $dateNowForWeeks, $firstDayModifierPlus, $dateNowForWeeks, $dateNowForWeeks, $firstDayModifierPlus, $dateNowForWeeks, $dateNowForWeeks, $firstDayModifierPlus);
     $rsCurrentTime = $this->_db->getAssoc($sql);
     $data = array();
     switch ($view) {
         case DASHBOARD_GRAPH_YEARLY:
             $data[$rsCurrentTime['currentYearNumber']] = array('label' => $rsCurrentTime['currentYearNumber']);
             $data[$rsCurrentTime['currentYearNumber'] - 1] = array('label' => $rsCurrentTime['currentYearNumber'] - 1);
             $data[$rsCurrentTime['currentYearNumber'] - 2] = array('label' => $rsCurrentTime['currentYearNumber'] - 2);
             $data[$rsCurrentTime['currentYearNumber'] - 3] = array('label' => $rsCurrentTime['currentYearNumber'] - 3);
             break;
         case DASHBOARD_GRAPH_MONTHLY:
             $data[$rsCurrentTime['currentMonthNumber']] = array('label' => $rsCurrentTime['currentMonthName']);
             $data[$rsCurrentTime['oneMonthAgoNumber']] = array('label' => $rsCurrentTime['oneMonthAgoName']);
             $data[$rsCurrentTime['twoMonthAgoNumber']] = array('label' => $rsCurrentTime['twoMonthAgoName']);
             $data[$rsCurrentTime['threeMonthAgoNumber']] = array('label' => $rsCurrentTime['threeMonthAgoName']);
             break;
         case DASHBOARD_GRAPH_WEEKLY:
         default:
             // TODO:   Localization d/m, week starts on monday
             if ($_SESSION['CATS']->isDateDMY()) {
                 $pattern = "d/m";
             } else {
                 $pattern = "m/d";
             }
             /* * 6 at the end gives us the last day in the week (first day in week plus 6 days) */
             $data[$rsCurrentTime['currentWeekNumber']] = array('label' => date($pattern, $rsCurrentTime['currentWeekNumber']) . ' - ' . date($pattern, $rsCurrentTime['currentWeekNumber'] + $oneUnixDay * 6));
             $data[$rsCurrentTime['oneWeekAgoNumber']] = array('label' => date($pattern, $rsCurrentTime['oneWeekAgoNumber']) . ' - ' . date($pattern, $rsCurrentTime['oneWeekAgoNumber'] + $oneUnixDay * 6));
             $data[$rsCurrentTime['twoWeekAgoNumber']] = array('label' => date($pattern, $rsCurrentTime['twoWeekAgoNumber']) . ' - ' . date($pattern, $rsCurrentTime['twoWeekAgoNumber'] + $oneUnixDay * 6));
             $data[$rsCurrentTime['threeWeekAgoNumber']] = array('label' => date($pattern, $rsCurrentTime['threeWeekAgoNumber']) . ' - ' . date($pattern, $rsCurrentTime['threeWeekAgoNumber'] + $oneUnixDay * 6));
             break;
     }
     /* Fill the array with data. */
     foreach ($data as $indexData => $rowData) {
         $data[$indexData]['submitted'] = 0;
         $data[$indexData]['interviewing'] = 0;
         $data[$indexData]['placed'] = 0;
         foreach ($rs as $indexRS => $rowRS) {
             if ($rowRS['unixdate'] == $indexData) {
                 $data[$indexData]['submitted'] = $rowRS['submitted'];
                 $data[$indexData]['interviewing'] = $rowRS['interviewing'];
                 $data[$indexData]['placed'] = $rowRS['placed'];
             }
         }
     }
     ksort($data, SORT_NUMERIC);
     return $data;
 }
예제 #5
0
    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');
    }
예제 #6
0
}
$_SESSION['ref_script'] = $currentPage;
//below includes search options in left pane only - the results are refreshed through ajax and placed in div searchResults
//print header
$pageTitle = _('Calendar');
$config = new Configuration();
$host = $config->database->host;
$username = $config->database->username;
$password = $config->database->password;
$license_databaseName = $config->database->name;
$resource_databaseName = $config->settings->resourcesDatabaseName;
$link = mysqli_connect($host, $username, $password) or die(_("Could not connect to host."));
mysqli_select_db($link, $license_databaseName) or die(_("Could not find License database."));
mysqli_select_db($link, $resource_databaseName) or die(_("Could not find Resource database."));
$display = array();
$calendarSettings = new CalendarSettings();
try {
    $calendarSettingsArray = $calendarSettings->allAsArray();
} catch (Exception $e) {
    echo "<span style='color:red'>" . _("There was an error with the CalendarSettings Table please verify the table has been created.") . "</span>";
    exit;
}
// Check for earlier version of Resource Module.  With update of 1.3 the table definition changed.
$query = "Select subscriptionStartDate from `{$resource_databaseName}`.`Resource`";
$result = mysqli_query($link, $query);
if ($result) {
    // Previous tabel definition before Resources version 1.3
    $startDateName = "subscriptionStartDate";
    $endDateName = "subscriptionEndDate";
} else {
    $startDateName = "currentStartDate";