Ejemplo n.º 1
0
 public static function IsValidDateTime($dateTimeString)
 {
     if (preg_match('/^[0-9]{4}\\-[0-9]{2}\\-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$/', $dateTimeString) == 0) {
         return false;
     }
     $before = date_default_timezone_get();
     date_default_timezone_set('UTC');
     $return = date("Y-m-d H:i:s", StrToTime($dateTimeString)) == $dateTimeString;
     date_default_timezone_set($before);
     return $return;
 }
Ejemplo n.º 2
0
 public function auth(Request $request)
 {
     $device_id = $request->device_id;
     $usernameinput = $request->email;
     $password = $request->pwd;
     $version = $request->version;
     // dd($request);
     $field = $usernameinput ? 'email' : 'username';
     if (\Auth::attempt(array('username' => $usernameinput, 'password' => $password), false)) {
         $user = \Auth::user();
         $device = Device::where('device_id', $device_id)->first();
         if ($request->has('version')) {
             if (!empty($device)) {
                 $device->version = $version;
                 $device->username = $usernameinput;
                 $device->update();
             } else {
                 Device::create(['device_id' => $device_id, 'version' => $version, 'username' => $usernameinput]);
             }
         }
         if ($user->log_status == 0 || $user->device_id == $device_id) {
             $user->log_status = 1;
             $user->device_id = $device_id;
             $user->last_login = date('Y-m-d H:i:s');
             $user->update();
             $hash = UpdateHash::find(1);
             $user->hash = $hash->hash;
             return response()->json($user);
         } else {
             $t1 = StrToTime(date('Y-m-d H:i:s'));
             $t2 = StrToTime($user->last_login);
             $diff = ($t1 - $t2) / (60 * 60);
             if ($diff >= 24) {
                 $user->log_status = 1;
                 $user->device_id = $device_id;
                 $user->last_login = date('Y-m-d H:i:s');
                 $user->update();
                 $hash = UpdateHash::find(1);
                 $user->hash = $hash->hash;
                 return response()->json($user);
             } else {
                 return response()->json(array('msg' => 'User already logged on another device.', 'status' => 0, 'hr' => $diff));
             }
         }
     } else {
         return response()->json(array('msg' => 'user not found', 'status' => 0));
     }
 }
Ejemplo n.º 3
0
 public function Footer()
 {
     $data = $this->data;
     if (date('H', StrToTime($data->updated_at)) < 12) {
         $data->day -= 1;
     }
     $nextDate = date('d/m/Y', StrToTime('+' . $data->day . ' days', StrToTime($data->updated_at)));
     $today = date('H:i d/m-Y', StrToTime($data->updated_at));
     $this->SetY(157);
     $this->SetFont('DejaVuB', '', 11);
     $this->Cell(0, 5, 'Cộng : ' . $this->total . ' khoản', 0, 1, 'L');
     $this->Cell(97, 5, 'Tiền khám: ', 0, 0, 'R');
     $priceFree = $data->is_free == 0 ? Config::get('constants.bill', 50000) : 0;
     $this->SetFont('DejaVu', '', 11);
     $this->Cell(37, 5, number_format($priceFree) . ' VNĐ', 0, 1, 'R');
     $this->SetY(165);
     $this->SetFont('DejaVuB', '', 11);
     $this->Cell(25, 5, 'Tái khám: ', 0, 0);
     $this->SetFont('DejaVu', '', 12);
     $this->Ln(2);
     $this->SetFont('DejaVuI', '', 10);
     $this->Cell(0, 5, str_replace([' ', '/', '-'], [' Ngày ', ' tháng ', ' năm '], $today), 0, 0, 'R');
     $this->SetFont('DejaVuB', '', 10);
     $this->Ln(4);
     $this->Cell(60, 5, $data->is_repres == 0 ? '- ' : '- ' . $nextDate, 0, 0);
     $this->Ln(0);
     $this->SetFont('DejaVuBI', '', 9.5);
     $this->Cell(105, 5, 'Bác sĩ', 0, 1, 'R');
     $this->SetFont('DejaVuB', '', 10);
     $this->Cell(60, 5, '- Sốt cao - Li bì - Co Giật', 0, 1);
     $this->Cell(60, 5, '- Nôn ói tăng - Tiêu chảy tăng', 0, 1);
     $this->Cell(60, 5, '- Run tay - Giật mình', 0, 1);
     $this->Cell(60, 5, '- Chảy máu mũi - răng', 0, 0);
     $this->Ln(2);
     $this->SetFont('DejaVuBI', '', 10);
     $this->Cell(125, 5, 'Ths.BS Phan Thị Kim Chi', 0, 0, 'R');
     $this->SetFont('DejaVuB', '', 10);
     $this->Ln(3);
     $this->Cell(60, 5, '- Chi mát', 0, 0);
     $this->Image('images/sig.png', 95, 173, 45);
     $this->SetFont('DejaVuB', '', 8);
     $this->Ln(4);
     $this->Cell(40, 5, '* Lưu ý ', 0, 0, 'R');
     $this->SetFont('DejaVu', '', 8);
     $this->Cell(80, 5, ': Nhớ mang theo đơn thuốc khi tái khám', 0, 0, 'L');
 }
 public function getByDiscussionEventRange($Offset = false, $Limit = false, $BeginDate = false, $EndDate = false, $Where = array())
 {
     $BeginDate = $BeginDate ? Date('Y-m-d', StrToTime($BeginDate)) : Date('Y-m-d');
     $EndDate = $EndDate ? Date('Y-m-d', StrToTime($EndDate)) : Date('Y-m-d', PHP_INT_MAX);
     $this->SQL->select('d.*')->from('Discussion d')->where('d.DiscussionEventDate >=', $BeginDate)->where('d.DiscussionEventDate <=', $EndDate)->orderBy('d.DiscussionEventDate');
     // Determine category watching
     if ($this->Watching && !isset($Where['d.CategoryID'])) {
         $Watch = CategoryModel::CategoryWatch();
         if ($Watch !== true) {
             $Where['d.CategoryID'] = $Watch;
         }
     }
     $this->SQL->where($Where);
     if ($Offset !== false && $Limit !== false) {
         $this->SQL->limit($Limit, $Offset);
     }
     return $this->SQL->get();
 }
Ejemplo n.º 5
0
 private function statisticsRangeSplit($data, $info)
 {
     $date = '';
     $fill = false;
     $totalPriceDrug = 0;
     $count = 0;
     $temp = 0;
     foreach ($data as $key => $detail) {
         $tempDate = StrToTime($detail->created_at);
         if ($date != date('Y-m-d', $tempDate)) {
             if ($count > 0) {
                 $this->finishPageByDate($totalPriceDrug, $info[$count - 1]->total - $info[$count - 1]->free);
             }
             $count += 1;
             $date = date('Y-m-d', $tempDate);
             $titleDate = str_replace([' ', '/', '-'], [' Ngày ', ' tháng ', ' năm '], date(' d/m-Y', $tempDate));
             $this->initTitlePage($titleDate);
             $fill = false;
             $totalPriceDrug = 0;
             $temp = 0;
         }
         if (intval($this->GetY()) > 180) {
             $this->Cell(array_sum($this->wHeader), 0, '', 'T');
             $titleDate = str_replace([' ', '/', '-'], [' Ngày ', ' tháng ', ' năm '], date(' d/m-Y', $tempDate));
             $this->initTitlePage($titleDate);
         }
         $totalPriceDrug += $detail->total * $detail->price;
         $this->Cell($this->wHeader[0], 6, ++$temp, 'L', 0, 'C', $fill);
         $this->Cell($this->wHeader[1], 6, $detail->name, 'L', 0, 'L', $fill);
         $this->Cell($this->wHeader[2], 6, number_format($detail->price), 'L', 0, 'R', $fill);
         $this->Cell($this->wHeader[3], 6, number_format($detail->total), 'L', 0, 'C', $fill);
         $this->Cell($this->wHeader[4], 6, number_format($detail->total * $detail->price), 'LR', 0, 'R', $fill);
         $this->Ln();
         $fill = !$fill;
     }
     $this->finishPageByDate($totalPriceDrug, $info[$count - 1]->total - $info[$count - 1]->free);
 }
Ejemplo n.º 6
0
 public static function IsValidDate($dateString)
 {
     if (preg_match('/^[0-9]{4}\\-[0-9]{2}\\-[0-9]{2}$/', $dateString) == 0) {
         return false;
     }
     return date("Y-m-d", StrToTime($dateString)) == $dateString;
 }
Ejemplo n.º 7
0
$dir = ".";
$files = array();
if ($dh = opendir($dir)) {
    while (($file = readdir($dh)) !== false) {
        $files[] = $file;
    }
    closedir($dh);
} else {
    echo "Konnte Verzeichnis nicht öffnen.\n\n";
    echo "\n\nBeendet\n\n";
    die;
}
sort($files);
foreach ($files as $file) {
    if (preg_match("/^[0-9]+.*\\.php\$/", $file)) {
        $thisOneDone = isset($done[strToLower($file)]);
        if ($info) {
            echo "{$file} ";
            if ($thisOneDone) {
                echo date("d.m.Y H:i", StrToTime($done[strToLower($file)]['insertTime'])) . " Uhr \n";
            } else {
                echo "noch nicht.\n";
            }
        } elseif (!$thisOneDone) {
            echo "{$file} ";
            require_once $file;
            $db->query('INSERT INTO `_updates` SET `filename` = ?', array($file), false);
            echo "vollständig bearbeitet.\n";
        }
    }
}
Ejemplo n.º 8
0
 public function close12hrsorder()
 {
     $orders = $this->OrderDetail->find('all', array('conditions' => array('is_paid' => '0', 'is_return' => '0')));
     $t1 = StrToTime(date('Y-m-d H:i:s'));
     foreach ($orders as $order) {
         $t2 = StrToTime($order['OrderDetail']['created']);
         $diff = $t1 - $t2;
         $hours = $diff / (60 * 60);
         if ($hours >= 12) {
             $this->OrderDetail->id = $order['OrderDetail']['id'];
             $this->OrderDetail->saveField('is_paid', '2');
             $this->Product->id = $order['Product']['id'];
             $this->Product->saveField('quantity', $order['Product']['quantity'] + $order['OrderDetail']['quantity']);
         }
     }
 }
Ejemplo n.º 9
0
#-------------------------------------------------------------------------------
$Settings = $Config['Interface']['Administrator']['Notes']['Tasks'];
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (!$Settings['ShowUnExecuted']) {
    return $Result;
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Marker = SPrintF('%s/hosts/%s/tmp/TaskLastExecute.txt', SYSTEM_PATH, HOST_ID);
#-------------------------------------------------------------------------------
if (Is_Readable($Marker)) {
    #-------------------------------------------------------------------------------
    $LastExecuted = File_Get_Contents($Marker);
    #-------------------------------------------------------------------------------
    $LastExecuted = StrToTime($LastExecuted);
    #-------------------------------------------------------------------------------
    Debug(SPrintF('[comp/Notes/Administrator/CheckCronRun]: LastExecuted = %s', Date('Y-m-d H:i:s', $LastExecuted)));
    #-------------------------------------------------------------------------------
    if ($LastExecuted < Time() - $Settings['CronDownTime']) {
        $Array = array('Message' => SPrintF('Последнее задание было выполнено <B>%s в %s</B>', Date('Y-m-d', $LastExecuted), Date('H:i:s', $LastExecuted)));
    }
} else {
    #-------------------------------------------------------------------------------
    $Array = array('Message' => SPrintF('Планировщик ни разу не запускался в штатном режиме, или, отсутствует доступ к файлу <BR /><B>%s</B>', $Marker));
    #-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (isset($Array)) {
    #-------------------------------------------------------------------------------
Ejemplo n.º 10
0
if (isset($_POST['Team']) && $currentKing != $_POST['Team']) {
    //all of the actions when the hill is attemped to be captured
    include "includes/kingTakesHill.php";
    $hashedName = md5($newKing);
    $kingToLink = $newKing;
} else {
    $kingToLink = $currentKing;
    $hashedName = md5($currentKing);
}
echo '<a href="userInformation.php?name=' . $kingToLink . '"><canvas width="80" height="80" id="hashCanvas" data-jdenticon-hash="' . $hashedName . '"></canvas></a>';
//shows how long the current king has been on the hill
$sql = 'SELECT name, timeoflastcapture FROM kings ORDER BY timeoflastcapture DESC LIMIT 1';
foreach ($db->query($sql) as $row) {
    echo "<p style='font-size: 40px'><a href='userInformation.php?name=" . $row['name'] . "''>" . $row['name'] . "</a></p>";
    $t1 = StrToTime($row['timeoflastcapture']);
    $t2 = StrToTime(date_create()->format('Y-m-d H:i:s'));
    $difference = $t2 - $t1;
    $ageOfKing = $difference / 60;
}
//display the time of the current king dynamically
echo '<p id="minutesDiv" display="inline" style="font-size: 25px"></p> <script type="text/javascript"> hillTimer(' . $ageOfKing . '); </script>';
?>
				</div>
				<div id="captureBox">
					<form action="index.php" method="POST">
						<input type="text" id="mainInputBox" name="Team" required>
						<input type="submit" id="mainCaptureButton" value="Capture">
					</form>
				</div>
				<div class="theHillImage">
					<img src="images/hills.png">
Ejemplo n.º 11
0
 public function next()
 {
     $this->currentDate = StrToTime("+1 day", $this->currentDate);
     $this->currentDay++;
 }
function getMinutesOfLastCaptureForKing($king)
{
    //shows how long the current king has been on the hill
    $sql = 'SELECT timeoflastcapture FROM kings WHERE name =`' . $king . '`';
    foreach ($db->query($sql) as $row) {
        $t1 = StrToTime($row['timeoflastcapture']);
        $t2 = StrToTime(date_create()->format('Y-m-d H:i:s'));
        $difference = $t2 - $t1;
        $ageOfKing = $difference / 60;
    }
}
Ejemplo n.º 13
0
 /**
  * counts how many days between dates.
  *
  * @access public
  * @param array $date date array
  * @retun integer Result
  */
 public function countDays($date)
 {
     $sec_out = StrToTime($date['date_out']);
     $sec_in = StrToTime($date['date_in']);
     $sum_sec = $sec_out - $sec_in;
     if ($sum_sec < 0) {
         return -1;
     }
     $day = 60 * 60 * 24;
     return floor($sum_sec / $day) + 1;
 }
Ejemplo n.º 14
0
     #-------------------------------------------------------------------------
     switch (ValueOf($Comp)) {
         case 'error':
             return ERROR | @Trigger_Error(500);
         case 'exception':
             return ERROR | @Trigger_Error(400);
         case 'array':
             break;
         default:
             return ERROR | @Trigger_Error(101);
     }
 }
 #-------------------------------------------------------------------------------
 #-------------------------------------------------------------------------------
 # обновляем данные лицензии
 $IsUpdate = DB_Update('ISPswLicenses', array('LicKey' => $License['lickey'], 'pricelist_id' => $License['pricelist_id'], 'period' => $License['period'], 'addon' => $addon, 'IP' => $License['ip'], 'remoteip' => isset($License['remoteip']) ? $License['remoteip'] : '', 'ISPname' => isset($License['licname']) ? $License['licname'] : 'Имя не задано', 'ip_change_date' => StrToTime($License['ip_change_date']), 'lickey_change_date' => StrToTime($License['lickey_change_date']), 'ExpireDate' => $ExpireDate), array('Where' => SPrintF('`elid` = %u', $License['id'])));
 if (Is_Error($IsUpdate)) {
     return ERROR | @Trigger_Error(500);
 }
 #-------------------------------------------------------------------------------
 # проверяем статус в биллинге, если отличается от статуса что получили - меняем статус штатно
 if ($ISPswLic['StatusID'] != $StatusID) {
     #-------------------------------------------------------------------------------
     $Comp = Comp_Load('www/API/StatusSet', array('ModeID' => 'ISPswLicenses', 'IsNotNotify' => TRUE, 'IsNoTrigger' => TRUE, 'StatusID' => $StatusID, 'RowsIDs' => $ISPswLic['ID'], 'Comment' => SPrintF('ISPsystem Status: %s->%s', $ISPswLic['StatusID'], $StatusID)));
     #-------------------------------------------------------------------------
     switch (ValueOf($Comp)) {
         case 'error':
             return ERROR | @Trigger_Error(500);
         case 'exception':
             return ERROR | @Trigger_Error(400);
         case 'array':
Ejemplo n.º 15
0
 public function createDataPrint($pres)
 {
     $pres->detail;
     foreach ($pres->detail as $key => $value) {
         $pres->detail[$key]->getDrug;
         $pres->detail[$key]->get_drug->getUnit;
         $pres->detail[$key]->unit = $pres->detail[$key]->get_drug->get_unit->unit;
         $pres->detail[$key]->unit_s = $pres->detail[$key]->get_drug->get_unit->stands;
     }
     // Patient
     $pres->getPatient;
     $info = number_format($pres->get_patient->age) . 'T';
     $info .= '  /  ' . $pres->get_patient->weight . 'kg';
     $pres->get_patient->age = $info;
     $pres->get_patient->address = $pres->get_patient->add->address;
     // Disease
     $pres->disease = implode(", ", Disease::whereIn('id', explode(',', $pres->disease))->lists('name'));
     $data = "";
     if ($pres->is_repres) {
         if (date('H', StrToTime($pres->updated_at)) < 12) {
             $pres->day -= 1;
         }
         $data = date('d/m/Y', StrToTime('+' . $pres->day . ' days', StrToTime($pres->updated_at)));
     }
     $pres->dayRePres = $data;
     return $pres;
 }
Ejemplo n.º 16
0
        echo ucfirst($info['personal'][0]['nickname']);
        ?>
<font><?php 
        echo ucwords($info['personal'][0]['first_name'] . ' ' . $info['personal'][0]['last_name']);
        ?>
</font></span> 
		  </div>
      </div>
	 
	  <div class="col-sm-2 feed-date">
			<?php 
        $actual_date = date("dS M Y", strtotime($info['propdetails'][0]['created_on']));
        $propdate = $info['propdetails'][0]['created_on'];
        $currentdate = date("Y-m-d H:i:s");
        $t1 = StrToTime($currentdate);
        $t2 = StrToTime($propdate);
        $diff = $t1 - $t2;
        $hours = $diff / (60 * 60);
        $date1 = new DateTime($propdate);
        $date2 = new DateTime($currentdate);
        $diff = $date2->diff($date1);
        ?>
			<?php 
        if ($hours > 24 && $hours < 48) {
            ?>
			  <p><?php 
            echo $diff->format('%a Day ago');
            ?>
</p>
			<?php 
        }
Ejemplo n.º 17
0
}
//if user enters a valid name name
if (isset($_POST['Team']) && ctype_alpha($_POST['Team'])) {
    //that name doesn't already own the hill
    if ($currentKing != $_POST['Team']) {
        include "includes/kingTakesHill.php";
        $hashedName = md5($newKing);
        $kingtoDisplay = $newKing;
    }
}
echo '<a href="userInformation.php?name=' . $kingtoDisplay . '"><canvas width="80" height="80" id="hashCanvas" data-jdenticon-hash="' . $hashedName . '"></canvas></a>';
//shows how long the current king has been on the hill
$sql = 'SELECT name, timeoflastcapture FROM kings ORDER BY timeoflastcapture DESC LIMIT 1';
foreach ($db->query($sql) as $row) {
    echo "<p style='font-size: 40px'><a href='userInformation.php?name=" . $row['name'] . "''>" . $row['name'] . "</a></p>";
    $timeOfCapture = StrToTime($row['timeoflastcapture']);
}
//display the time of the current king dynamically
echo '<p id="minutesDiv" display="inline" style="font-size: 25px"></p> <script type="text/javascript"> hillTimer(' . $timeOfCapture . '); </script>';
?>
				</div>
				<div>
					<form action="index.php" method="POST">
						<input type="text" id="mainInputBox" name="Team" maxlength="15" required>
						<input type="submit" id="mainCaptureButton" value="Capture">
					</form>
				</div>
				<div>
					<img src="images/hills.png">
				</div>
			</div>