public function ajaxGenerateEventColumnDataAction() { calcTS(); $columnIndex = $this->_getParam('columnIndex'); trigger_error("before generate column: " . calcTS(), E_USER_NOTICE); $data = $this->generateEventColumnData($columnIndex); trigger_error("after generate column: " . calcTS(), E_USER_NOTICE); $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $json->direct($data); }
protected function _generateDefaultTemplateXML() { $aclMemKey = PermissionTemplate::ACL_MEMKEY . '_default'; $items = $this->_memcache->get($aclMemKey); // get returns FALSE if error or key not found if ($items === false) { trigger_error("before generating list: " . calcTS(), E_USER_NOTICE); $xml = WebVista_Acl::getInstance()->getDefaultList(); $items = $xml->asXML(); $this->_memcache->set($aclMemKey, $items); trigger_error("after generating list: " . calcTS(), E_USER_NOTICE); } if (!isset($xml)) { $xml = new SimpleXMLElement($items); } return $xml; }
public function listItemsAction() { $rows = array(); $items = $this->_memcache->get($this->_aclMemKey); // get returns FALSE if error or key not found if ($items === false) { calcTS(); trigger_error("before generating list: " . calcTS(), E_USER_NOTICE); $items = WebVista_Acl::getInstance()->getLists(); $this->_memcache->set($this->_aclMemKey, $items); trigger_error("after generating list: " . calcTS(), E_USER_NOTICE); } foreach ($items as $moduleName => $data) { foreach ($data as $id => $resources) { $resourceName = $resources['name']; $tmp = array(); $tmp['id'] = $id; // Resource $tmp['data'][] = $resources['prettyName']; // Read $tmp['data'][] = implode("<br />\n", $this->_generateCheckboxInputs($this->_chkLabelRead, $resources['read'], $resourceName)); // Write $tmp['data'][] = implode("<br />\n", $this->_generateCheckboxInputs($this->_chkLabelWrite, $resources['write'], $resourceName)); // Delete $tmp['data'][] = implode("<br />\n", $this->_generateCheckboxInputs($this->_chkLabelDelete, $resources['delete'], $resourceName)); // Other $tmp['data'][] = implode("<br />\n", $this->_generateCheckboxInputs($this->_chkLabelOther, $resources['other'], $resourceName)); $rows[] = $tmp; } } $data = array(); $data['rows'] = $rows; $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $json->direct($data); }
public function lookupTimeSearchAction() { calcTS(); trigger_error('before free time search: ' . calcTS(), E_USER_NOTICE); $dateStart = date('Y-m-d H:i:s', strtotime($this->_getParam('dateStart'))); $dateEnd = date('Y-m-d H:i:s', strtotime($this->_getParam('dateEnd'))); $providerId = (int) $this->_getParam('providerId'); $roomId = (int) $this->_getParam('roomId'); $scheduleEvent = new ScheduleEvent(); $scheduleEvent->start = $dateStart; $scheduleEvent->end = $dateEnd; $scheduleEvent->providerId = $providerId; $scheduleEvent->roomId = $roomId; //file_put_contents('/tmp/schedule.txt',''); $data = $scheduleEvent->bookingAppointmentDetails(); $ret = array(); foreach ($data as $date => $value) { $x = explode('-', $date); if (!isset($x[2])) { $ret[$date] = $value; continue; } $x[1] -= 1; // month - 1 $year = (int) $x[0]; $month = (int) $x[1]; $day = (int) $x[2]; $ymd = $year . $month . $day; $ret[$ymd] = array('month' => $year . $month, 'value' => $value); } trigger_error('after free time search: ' . calcTS(), E_USER_NOTICE); $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $json->direct($ret); }
{ list($usec, $sec) = explode(" ", microtime()); $ts = (double) $usec + (double) $sec; if (!isset($GLOBALS['gts'])) { $GLOBALS['gts'] = $ts; } return $ts - $GLOBALS['gts']; } if (!function_exists('lcfirst')) { function lcfirst($str) { $str[0] = strtolower($str[0]); return (string) $str; } } function __($key) { //$translate = Zend_Registry::get('translate'); //$rtext = $translate->_($key); //if ($key == $rtext) { // trigger_error("untranslated: '$key' => '',", E_USER_NOTICE); //} //if (strlen($rtext) == 0) { return $key; //} //return $rtext; } calcTS(); define('APPLICATION_ENVIRONMENT', 'production'); require_once './application/library/WebVista/App.php'; WebVista::getInstance()->run();
protected function _generateAppointments() { $patients = array(); $patient = new Patient(); $patientIterator = $patient->getIterator(); foreach ($patientIterator as $row) { $patients[] = $row->personId; } $patientLen = count($patients) - 1; $startingDate = strtotime(date('Y-m-d')); $endingDate = strtotime('+1 month', $startingDate); $titles = array('Sick', 'Followup', 'Cough', 'Runny Nose', 'Lab Only', 'Annual'); $titleLen = count($titles) - 1; $dates = $this->_generateDays(); $providerIterator = new ProviderIterator(); foreach ($providerIterator as $provider) { $providerId = $provider->personId; foreach ($dates as $date) { $timeSlots = array(); echo 'current:' . $date . ' time:' . calcTS() . ' memory:' . memory_get_usage() / 1024 / 1024 . '<br/>'; $hour = 8; while ($hour < 18) { if (rand(0, 1) == 1) { continue; } $plus = rand(0, 2) * 0.25; $length = rand(1, 4) * 0.25; if ($hour >= 12 && $hour < 13) { // lunch time $hour = 13; } $start = $date . ' ' . formatTime($hour); $hour += $length; if ($hour >= 12 && $hour < 13) { // lunch time $hour = 12; } $end = $date . ' ' . formatTime($hour); $timeSlots[] = array('start' => $start, 'end' => $end); } $rows = array(); $timeSlotLen = count($timeSlots) - 1; if ($timeSlotLen > $patientLen) { // patients are less than time slots $slots = $timeSlots; foreach ($patients as $patientId) { $row = array(); shuffle($slots); $slot = array_shift($slots); $row['start'] = $slot['start']; $row['end'] = $slot['end']; $row['patientId'] = $patientId; $rows[] = $row; } } else { // patients are greater than time slots $patientIds = $patients; foreach ($timeSlots as $slot) { $row = array(); $row['start'] = $slot['start']; $row['end'] = $slot['end']; shuffle($patientIds); $patientId = array_shift($patientIds); $row['patientId'] = $patientId; $rows[] = $row; } } foreach ($rows as $row) { $app = new Appointment(); // disable cascadePersist, we only generate appointments $this->_setORMPersistMode($app); $app->patientId = $row['patientId']; $app->start = $row['start']; $app->end = $row['end']; $title = $titles[rand(0, $titleLen)]; $app->title = $title; $app->providerId = $providerId; $app->createdDate = date('Y-m-d H:i:s'); $app->persist(); } } } }
public static function loadPharmacy($filename) { trigger_error('before loading pharmacies: ' . calcTS(), E_USER_NOTICE); set_time_limit(300); // 5 minutes $filename = sys_get_temp_dir() . DIRECTORY_SEPARATOR . preg_replace('/.*(\\/|\\ee)/', '', $filename); $pharmDataTmp = fopen($filename, 'r'); $db = Zend_Registry::get('dbAdapter'); $sqlSelect = $db->select()->from('pharmacies', array('pharmacyId', 'NCPDPID', 'preferred')); $pharmacies = array(); if ($rows = $db->fetchAll($sqlSelect)) { foreach ($rows as $row) { $pharmacies[$row['NCPDPID']] = array('pharmacyId' => $row['pharmacyId'], 'preferred' => $row['preferred']); } } fseek($pharmDataTmp, 0); $counter = 0; while ($line = fgets($pharmDataTmp)) { $pharmacy = array(); $pharmacy['NCPDPID'] = substr($line, 0, 7); $pharmacy['StoreNumber'] = substr($line, 7, 35); $pharmacy['ReferenceNumberAlt1'] = substr($line, 42, 35); $pharmacy['ReferenceNumberAlt1Qualifier'] = substr($line, 77, 3); $pharmacy['StoreName'] = substr($line, 80, 35); $pharmacy['AddressLine1'] = substr($line, 115, 35); $pharmacy['AddressLine2'] = substr($line, 150, 35); $pharmacy['City'] = substr($line, 185, 35); $pharmacy['State'] = substr($line, 220, 2); $pharmacy['Zip'] = substr($line, 222, 11); $pharmacy['PhonePrimary'] = substr($line, 233, 25); $pharmacy['Fax'] = substr($line, 258, 25); $pharmacy['Email'] = substr($line, 283, 80); $pharmacy['PhoneAlt1'] = substr($line, 363, 25); $pharmacy['PhoneAlt1Qualifier'] = substr($line, 388, 3); $pharmacy['PhoneAlt2'] = substr($line, 391, 25); $pharmacy['PhoneAlt2Qualifier'] = substr($line, 416, 3); $pharmacy['PhoneAlt3'] = substr($line, 419, 25); $pharmacy['PhoneAlt3Qualifier'] = substr($line, 444, 3); $pharmacy['PhoneAlt4'] = substr($line, 447, 25); $pharmacy['PhoneAlt4Qualifier'] = substr($line, 472, 3); $pharmacy['PhoneAlt5'] = substr($line, 475, 25); $pharmacy['PhoneAlt5Qualifier'] = substr($line, 500, 3); $pharmacy['ActiveStartTime'] = substr($line, 503, 22); $pharmacy['ActiveEndTime'] = substr($line, 525, 22); $pharmacy['ServiceLevel'] = substr($line, 547, 5); $pharmacy['PartnerAccount'] = substr($line, 552, 35); $pharmacy['LastModifiedDate'] = substr($line, 587, 22); $pharmacy['TwentyFourHourFlag'] = substr($line, 609, 1); $pharmacy['Available CrossStreet'] = substr($line, 610, 35); $pharmacy['RecordChange'] = substr($line, 645, 1); $pharmacy['OldServiceLevel'] = substr($line, 646, 5); $pharmacy['TextServiceLevel'] = substr($line, 651, 100); $pharmacy['TextServiceLevelChange'] = substr($line, 751, 100); $pharmacy['Version'] = substr($line, 851, 5); $pharmacy['NPI'] = substr($line, 856, 10); $data = array(); foreach ($pharmacy as $key => $value) { $data[$key] = trim($value); } $p = new Pharmacy(); $p->_shouldAudit = false; $p->populateWithArray($data); if (isset($pharmacies[$p->NCPDPID])) { $p->pharmacyId = $pharmacies[$p->NCPDPID]['pharmacyId']; $p->preferred = $pharmacies[$p->NCPDPID]['preferred']; } //$p->populatePharmacyIdWithNCPDPID(); $p->persist(); $counter++; } fclose($pharmDataTmp); unlink($filename); trigger_error('Number of rows updated: ' . $counter, E_USER_NOTICE); trigger_error('after loading pharmacies: ' . calcTS(), E_USER_NOTICE); return $counter; }