private function build_view()
 {
     $carHotelData = $this->dataHandler->get_carhotel_data();
     $unsortedBudgetData = $this->dataHandler->get_budget_data();
     $nights = 2;
     $sortedBudgetData = array();
     //the default search is going to start on the current day, and include two nights in the hotel and 3 days of car rental
     foreach ($unsortedBudgetData as $key => $vals) {
         if ($vals['car_0'] == 'x') {
             $carCost = 'unavailable';
         } else {
             $carCost = $vals['car_0'] * $nights;
         }
         $hotelCost = 0;
         //assuming that you're there for three days, you'll probably only need the hotel two nights
         //remember, database is 0 indexed.
         for ($i = 0; $i < $nights; $i++) {
             $currentCol = 'hotel_low_' . $i;
             if ($vals[$currentCol] == "x") {
                 $hotelCost = 'unavailable';
                 break;
             }
             $hotelCost += $vals[$currentCol];
         }
         if ($carCost == 'unavailable' or $hotelCost == 'unavailable') {
             $totalCost = 'unavailable';
         } else {
             $totalCost = $carCost + $hotelCost;
             $totalCost = round($totalCost, 0, PHP_ROUND_HALF_UP);
         }
         $vals['sort_weight'] = $totalCost;
         $sortedBudgetData[$totalCost][] = $vals;
     }
     ksort($sortedBudgetData, SORT_NATURAL);
     //shoe in the dates we're working with
     for ($i = 0; $i <= 9; $i++) {
         $dates['day_abrv_' . $i] = date('D', strtotime('+' . $i . 'days'));
         $dates['day_numeric_' . $i] = date('m/d', strtotime('+' . $i . 'days'));
         $dates['day_long_' . $i] = date('D m/d', strtoTime('+' . $i . 'days'));
     }
     $returnData = array($dates, $sortedBudgetData);
     $returnJSON = json_encode($returnData);
     echo $returnJSON;
 }
Exemple #2
0
<?php

require_once '/var/www/vhosts/theexecutivesguild.org/master_includes.php';
$db = mysqli_connect(HOST, USER, PASSWORD, DBASE);
if (!$db) {
    echo "<p>Error: Unable to connect to MySQL." . PHP_EOL;
    echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
    echo "Debugging error: " . mysqli_connect_error() . PHP_EOL . '</p>';
    exit;
}
var_dump($_POST);
foreach ($_POST as $k => $v) {
    ${$k} = $v;
}
$date = strtoTime($date);
$NetworkingStartTime = date("Y-m-d H:i:s", strtotime(date("Y-m-d", $date) . ' ' . $NetworkingStartTime . ':00'));
$NetworkingEndTime = date("Y-m-d H:i:s", strtotime(date("Y-m-d", $date) . ' ' . $NetworkingEndTime . ':00'));
$MeetingStartTime = date("Y-m-d H:i:s", strtotime(date("Y-m-d", $date) . ' ' . $MeetingStartTime . ':00'));
$MeetingEndTime = date("Y-m-d H:i:s", strtotime(date("Y-m-d", $date) . ' ' . $MeetingEndTime . ':00'));
$date = date("Y-m-d", $date);
$title = $db->real_escape_string($title);
$place = $db->real_escape_string($place);
$address = $db->real_escape_string($address);
$address2 = $db->real_escape_string($address2);
$city = $db->real_escape_string($city);
$state = $db->real_escape_string($state);
$title = $db->real_escape_string($title);
$zip = $db->real_escape_string($zip);
echo '<p>' . $title . '</p>';
echo '<p>date: ' . $date . '</p>';
echo '<p>net start: ' . $NetworkingStartTime . '</p>';
Exemple #3
0
 function problem_analysis($user, $problem)
 {
     $problemTime = $this->getUserProblemTime($user, $problem);
     $sizeTime = sizeof($problemTime);
     $totalGiveUpCount = 0;
     $totalCheckCount = 0;
     $totalTime = 0;
     //$problemLoad = AnalyzeLogs::$problemLoadTime;
     $minActionTime = AnalyzeLogs::$actionTime;
     $minProblemTime = AnalyzeLogs::$minimumTime;
     $ratioGiveUpAllowed = AnalyzeLogs::$goldenRatio;
     for ($i = 0; $i < $sizeTime; $i++) {
         $giveUpCountQuery = "SELECT COUNT(*) from activity_logs where USER_ID = '" . $user . "' AND MESSAGE LIKE '%Giveup%' AND DATED >='" . $problemTime[$i]['startTime'] . "' AND DATED <= '" . $problemTime[$i]['endTime'] . "';";
         $result = $this->getResults($giveUpCountQuery);
         $row = mysqli_fetch_assoc($result);
         $count = $row['COUNT(*)'];
         $totalGiveUpCount = $totalGiveUpCount + $count;
         $checkSolutionQuery = "SELECT COUNT(*) from activity_logs where USER_ID = '" . $user . "' AND MESSAGE LIKE '%Check button%' AND DATED >='" . $problemTime[$i]['startTime'] . "' AND DATED <= '" . $problemTime[$i]['endTime'] . "';";
         $check_result = $this->getResults($checkSolutionQuery);
         $check_row = $check_result->fetch_assoc();
         $check_count = $check_row['COUNT(*)'];
         $totalCheckCount = $totalCheckCount + $check_count;
         $startTimeStamp = strtotime($problemTime[$i]['startTime']);
         $endTimeStamp = strtotime($problemTime[$i]['endTime']);
         $timeDifference = abs($endTimeStamp - $startTimeStamp);
         //these are the minutes for which a session is running
         //time Analysis for the problem time
         //if the session time is greater than 10 minutes then we check for all the actions if the log difference is greater than min action time
         if ($timeDifference > $minProblemTime) {
             $actionString = "SELECT * FROM dev_logs where USER_ID = '" . $user . "' AND DATED >='" . $problemTime[$i]['startTime'] . "' AND DATED <= '" . $problemTime[$i]['endTime'] . "' ORDER BY DATED asc;";
             $actions = $this->getResults($actionString);
             $index = 0;
             while ($actionRow = $actions->fetch_assoc()) {
                 if ($index == 0) {
                     $oldTime = strtotime($actionRow['DATED']);
                     $index++;
                     $newTime = $oldTime;
                     continue;
                 } else {
                     $oldTime = $newTime;
                 }
                 $newTime = strtoTime($actionRow['DATED']);
                 $timeDiff = abs($newTime - $oldTime);
                 //seconds difference between two consecutive action during the session.
                 //checking if the system is idle for more than 5/7 minute. Value kept at the start of the class.
                 if ($timeDiff < $minActionTime) {
                     $totalTime = $totalTime + $timeDiff;
                 }
                 $index++;
             }
         } else {
             $totalTime = $timeDifference + $totalTime;
         }
     }
     $gaming_system = false;
     if ($totalCheckCount + $totalGiveUpCount != 0) {
         $gaming_system = $totalGiveUpCount * 100 / ($totalCheckCount + $totalGiveUpCount);
     } else {
         $gaming_system = 'N/A';
     }
     $userProblemAnalysis = array('user' => $user, 'problem' => $problem, 'totalTime' => $totalTime, 'giveUpCount' => $totalGiveUpCount, 'totalCheckCount' => $totalCheckCount, 'gamingTheSystem' => $gaming_system, 'problemTime' => $problemTime);
     return $userProblemAnalysis;
 }
Exemple #4
0
function lateAssessments($curr)
{
    $selectAmt = QueryFactory::Build("select");
    $selectAmt->Select("value", "enabled")->From("settings")->Where(["name", "=", "ttl_activation"]);
    $time_to_live = DatabaseManager::Query($selectAmt)->Result();
    //	echo"\nactivation time: ". $time_to_live;
    //if need to take next assessment
    if ($time_to_live['enabled'] && strtoTime($time_to_live['value'], $curr["NextAssessment"]) < time() && $curr["NextAssessment"] != 0) {
        return true;
    }
    return false;
}
Exemple #5
0
         $tmpDateTime[] = $keyTime;
     }
 }
 closedir($fg);
 ksort($dateSelect);
 $urlAdd = "";
 if ($step) {
     $endDate = $postEndDate ? PwStrtoTime($postEndDate . '-1') : 0;
     $startDate = $postStartDate ? PwStrtoTime($postStartDate . '-1') : 0;
     if (!$startDate || !$endDate) {
         Showmsg('请选择时间');
     }
     if ($startDate > $endDate) {
         Showmsg('起始时间大于截止时间');
     }
     if ($endDate > strtoTime("1 year", $startDate)) {
         Showmsg('查询时间跨度不能大于一年');
     }
     if (!S::isArray($tmpDateTime)) {
         Showmsg('缓存文件不存在');
     }
     $urlAdd .= "&step=2&postStartDate={$postStartDate}&postEndDate={$postEndDate}";
     if ($adminName) {
         $urlAdd .= "&adminName={$adminName}";
     }
     $tmpDateTime = array_unique($tmpDateTime);
     $dateTime = array();
     foreach ($tmpDateTime as $v) {
         if ($v < $startDate || $v > $endDate) {
             continue;
         }
Exemple #6
0
 public function getFechaAttribute($fecha)
 {
     return date('d-m-Y', strtoTime($fecha));
 }
function add_product_exec()
{
    global $wpdb;
    global $tableName;
    session_start();
    $url = site_url() . '/wp-admin/admin.php?page=';
    $tableName = "fdci_web_crawler";
    if (isset($_POST['fdci_c_p_s'])) {
        if ($_POST['fdci_tkf'] == 'FDC-05-04-2015') {
            $dataFormat = array('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s');
            date_default_timezone_set("Asia/Manila");
            $date = date('d.m.Y');
            $mydate = strtoTime($date);
            $getImage = preg_split("/[\\s,]+/", $_POST['product_image_link']);
            $jsonImage = json_encode($getImage);
            $productData = array('reference_no' => 'FDCI-' . generateRandomString(), 'original_site' => clean($_POST['product_original_site']), 'site_link_id' => 0, 'original_post_link' => clean($_POST['product_post_link']), 'title' => clean($_POST['product_title']), 'description' => clean($_POST['product_description']), 'price' => clean($_POST['product_price']), 'product_image' => $jsonImage, 'furnishing' => clean($_POST['product_furnishing']), 'location' => clean($_POST['product_location']), 'posted_date' => date('F d, Y', $mydate), 'name_of_posted_person' => clean($_POST['product_contact_person']), 'square_area' => clean($_POST['product_square_area']), 'bedrooms' => clean($_POST['product_bedroom']), 'bathrooms' => clean($_POST['product_bathroom']), 'floor' => clean($_POST['product_floor']), 'contact_mobile' => clean($_POST['product_contact_number']), 'contact_email' => clean($_POST['product_person_email']), 'status' => 1);
            $wpdb->insert($tableName, $productData, $dataFormat);
            $_SESSION['product_save_success'] = 'One Product saved in database.';
            header("location:" . $url . 'fdci_add_product');
            exit;
        }
    } else {
    }
}
function datum($str)
{
    return date("H:i d.m.Y", strtoTime($str));
}
Exemple #9
0
function getHealthEntries($mid, $fromdate, $todate)
{
    $fromSqlDate = date("Y-m-d 00:00:00", strtotime($fromdate));
    $toSqlDate = date("Y-m-d 23:59:59", strtotime($todate));
    $query = "SELECT * FROM Diary, MorbidityEntry WHERE EntryDate BETWEEN " . "'{$fromSqlDate}' AND '{$toSqlDate}' AND EntryType = 4 AND " . "Diary.EntryId = MorbidityEntry.EntryId AND mid = {$mid} " . "ORDER BY EntryDate DESC, InputDate DESC";
    $result = mysql_query($query);
    if (!$result) {
        error_log(mysql_error());
        return false;
    }
    $returnvalue = array();
    while ($row = mysql_fetch_assoc($result)) {
        $returnrow = array();
        // $returnrow['id'] = $row['Number']; // not sure what this field is.
        $returnrow['entryTime'] = strtoTime($row['EntryDate']);
        $returnrow['inputTime'] = strtoTime($row['InputDate']);
        $returnrow['id'] = $row['EntryId'];
        $returnrow['type'] = $row['Type'];
        array_push($returnvalue, $returnrow);
    }
    return $returnvalue;
}
 /**
  * Allows a user to create an event.
  *
  */
 public function addEventAction()
 {
     $messages = array();
     $get = Zend_Registry::get('getFilter');
     $event = new Event();
     $values = array();
     if (isset($get->date)) {
         $values['date'] = $get->date;
     }
     $form = $event->form($values);
     if ($this->_request->isPost()) {
         if ($form->isValid($_POST)) {
             $workshopId = $form->getValue('workshop');
             $locationId = $form->getValue('location');
             $startTime = $form->getValue('startTime');
             $endTime = $form->getValue('endTime');
             $date = $form->getValue('date');
             $minSize = $form->getValue('minSize');
             $maxSize = $form->getValue('maxSize');
             $waitlistSize = $form->getValue('waitlistSize');
             $instructors = $form->getValue('instructors');
             $password = $form->getValue('password');
             $evaluationType = $form->getValue('evaluationType');
             $formKey = $form->getValue('formKey');
             $answerKey = $form->getValue('answerKey');
             if (isset($formKey) && $formKey != '') {
                 $regex = '(?<=key\\=)\\w*';
                 $matches = array();
                 preg_match_all("/" . $regex . "/is", $form->getValue('formKey'), $matches);
                 $formKey = $matches[0][0];
             }
             if (isset($answerKey) && $answerKey != '') {
                 $regex = '(?<=key\\=)\\w*';
                 $matches = array();
                 preg_match_all("/" . $regex . "/is", $form->getValue('answerKey'), $matches);
                 $answerKey = $matches[0][0];
             }
             $date = strtotime($date);
             $date = strftime('%Y', $date) . "-" . strftime('%m', $date) . "-" . strftime('%d', $date);
             if (strtolower($startTime['meridian']) == "pm" && $startTime['hour'] < 12) {
                 $startTime['hour'] += 12;
             }
             if (strtolower($startTime['meridian']) == "am" && $startTime['hour'] == 12) {
                 $startTime['hour'] = 0;
             }
             if (strtolower($endTime['meridian']) == "pm" && $endTime['hour'] < 12) {
                 $endTime['hour'] += 12;
             }
             if (strtolower($endTime['meridian']) == "am" && $endTime['hour'] == 12) {
                 $endTime['hour'] = 0;
             }
             $timesOk = true;
             $st = new Zend_Date($date);
             $st->setHour($startTime['hour'])->setMinute($startTime['minute']);
             $et = new Zend_Date($date);
             $et->setHour($endTime['hour'])->setMinute($endTime['minute']);
             if ($st->isLater($et)) {
                 $timesOk = false;
                 $messages[] = "msg-error-eventStartsAfter";
             } else {
                 if ($st->equals($et)) {
                     $timesOk = false;
                     $messages[] = "msg-error-eventTimesEqual";
                 }
             }
             $startTime = $startTime['hour'] . ":" . $startTime['minute'] . ":00";
             $endTime = $endTime['hour'] . ":" . $endTime['minute'] . ":00";
             $where = $event->getAdapter()->quoteInto('date = ?', $date) . " AND " . $event->getAdapter()->quoteInto('locationId = ?', $locationId) . " AND " . $event->getAdapter()->quoteInto('status = ?', 'open');
             $possibleConflicts = $event->fetchAll($where);
             $conflictFound = false;
             if ($possibleConflicts->count() > 0) {
                 $startTs = strtotime($startTime);
                 $endTs = strtoTime($endTime);
                 foreach ($possibleConflicts as $pc) {
                     $pcStart = strtotime($pc->startTime);
                     $pcEnd = strtotime($pc->endTime);
                     if ($startTs == $pcStart) {
                         $conflictFound = true;
                     } else {
                         if ($startTs < $pcStart && $endTs > $pcStart) {
                             $conflictFound = true;
                         } else {
                             if ($startTs >= $pcStart && $endTs <= $pcEnd) {
                                 $conflictFound = true;
                             } else {
                                 if ($startTs < $pcEnd && $endTs >= $pcEnd) {
                                     $conflictFound = true;
                                 } else {
                                     if ($startTs < $pcStart && $endTime > $pcEnd) {
                                         $conflictFound = true;
                                     }
                                 }
                             }
                         }
                     }
                     if ($conflictFound) {
                         $messages[] = "msg-error-eventAlreadyScheduled";
                         break;
                     }
                 }
             }
             $evaluationCheck = true;
             if ($evaluationType == 'google') {
                 $evaluationCheck = isset($formKey) && isset($answerKey);
             } else {
                 $evaluationCheck = $evaluationType == 'default';
             }
             if (!$evaluationCheck) {
                 $messages[] = 'msg-error-eventFormKeyMissing';
             }
             if (!$conflictFound && $timesOk && $evaluationCheck) {
                 $data = array('locationId' => $locationId, 'workshopId' => $workshopId, 'startTime' => $startTime, 'endTime' => $endTime, 'date' => $date, 'minSize' => $minSize, 'maxSize' => $maxSize, 'waitlistSize' => $waitlistSize, 'password' => $password, 'evaluationType' => $evaluationType, 'formKey' => $formKey, 'answerKey' => $answerKey);
                 $eventId = $event->insert($data);
                 $instructor = new Event_Instructor();
                 foreach ($instructors as $i) {
                     $instructor->insert(array('accountId' => $i, 'eventId' => $eventId));
                 }
                 $this->_helper->flashMessenger->addMessage('msg-info-eventAdded');
                 $date = explode('-', $date);
                 $this->_helper->redirector->gotoUrl('/workshop/schedule?startYear=' . $date[0] . '&startMonth=' . (int) $date[1]);
             }
         } else {
             $messages[] = "msg-error-formSubmitProblem";
         }
     }
     $this->view->messages = $messages;
     $this->view->headScript()->appendFile($this->view->baseUrl() . '/scripts/jquery.autocomplete.js');
     $this->view->headScript()->appendFile($this->view->baseUrl() . '/scripts/workshop/schedule/help.js');
     $this->view->headLink()->appendStylesheet($this->view->baseUrl() . '/css/jquery.autocomplete.css');
     $this->view->headLink()->appendStylesheet($this->view->baseUrl() . '/css/workshop/schedule/help.css');
     $this->view->form = $form;
     $this->_helper->pageTitle('workshop-schedule-addEvent:title');
 }
Exemple #11
0
 public function getCreatedAtAttribute($fecha)
 {
     return date('d/m/Y', strtoTime($fecha));
 }