function MessageGet($idMessage) { global $URL; $q1 = "SELECT * FROM `message` WHERE `idMessage`='{$idMessage}';"; $r1 = QueryExcuteWhile($q1); while ($o1 = mysqli_fetch_object($r1)) { //msg_rep $q2 = "SELECT * FROM `message`, `discussion` WHERE `discussion`.`idMessage`=`message`.`idMessage` AND `message`.`idMessage`='{$idMessage}' ORDER BY `idDiscussion` DESC;"; $r2 = QueryExcuteWhile($q2); while ($o2 = mysqli_fetch_object($r2)) { //envoi $sender2 = UserGetInfo($o2->FromUser); if (isset($sender2->ProfilePhoto)) { $img2 = $sender2->ProfilePhoto; } else { $img2 = ''; } echo ' <div class="msg-time-chat"> <a href="#" class="message-img"><img class="avatar" src="' . $img2 . '" alt=""></a> <div class="message-body msg-in"> <div class="text"> <p class="attribution"><a href="' . $URL . 'ili-users/user_profil?id=' . $sender2->idUser . '">' . $sender2->FamilyName . ' ' . $sender2->FirstName . '</a> '; DateDifference($o2->TimeStamp); echo '</p> <p> ' . $o2->Containt . ' </p> </div> </div> </div> '; } //msg $sender = UserGetInfo($o1->FromUser); if (isset($sender->ProfilePhoto)) { $img = $sender->ProfilePhoto; } else { $img = ''; } echo ' <div class="msg-time-chat"> <a href="#" class="message-img"><img class="avatar" src="' . $img . '" alt=""></a> <div class="message-body msg-in"> <div class="text"> <p class="attribution"><a href="' . $URL . 'ili-users/user_profil?id=' . $sender->idUser . '">' . $sender->FamilyName . ' ' . $sender->FirstName . '</a> '; DateDifference($o1->TimeStamp); echo '</p> <p> ' . $o1->Containt . ' </p> </div> </div> </div> '; } }
function MessageGetAll() { global $URL; $idUser = $_SESSION['user_id']; $q = "SELECT * FROM `message`\n\t\t\tWHERE\n\t\t\t(`FromUser`='{$idUser}' OR `ToUser`='{$idUser}')\n\t\t\tORDER BY `idMessage` DESC limit 5;"; $r = QueryExcuteWhile($q); while ($o = mysqli_fetch_object($r)) { $info_user = UserGetInfo($o->FromUser); $idMessage = $o->idMessage; $q1 = "SELECT * FROM `message`, `discussion`\n\t\t\tWHERE\n\t\t\t`discussion`.`idMessage`=`message`.`idMessage`\n\t\t\tAND\n\t\t\t`message`.`idMessage`='{$idMessage}'\n\t\t\tAND\n\t\t\t`idDiscussion`=(SELECT MAX(`idDiscussion`) FROM `discussion`)\n\t\t\t;"; $o1 = QueryExcute("mysqli_num_rows", $q1); if ($o1 >= '1') { $rx = QueryExcuteWhile($q1); $ox = mysqli_fetch_object($rx); } if ($o1 >= '1') { $idDiscussion = $ox->idDiscussion; } else { $idDiscussion = ''; } echo ' <tr> <td></td> <td> <a href="' . $URL . 'ili-users/user_profil?id=' . $o->FromUser . '">' . $info_user->FamilyName . ' ' . $info_user->FirstName . '</a> </td> <td class="hidden-phone"> <strong> <a href="' . $URL . 'ili-messages/read?id=' . $idMessage . '&id2=' . $idDiscussion . '">' . $o->Subject . '</a> </strong> </td> <td class="hidden-phone">'; if ($o1 >= '1') { MessageStatus($ox->idMessage, $idDiscussion); } else { MessageStatus($o->idMessage, ''); } MessageStatusChekIfLocked($o->idMessage); echo ' </td> <td class="hidden-phone">'; if ($o1 >= '1') { DateDifference($ox->TimeStamp); } else { DateDifference($o->TimeStamp); } echo ' </td> </tr> '; } }
function NotifGetAllNonSeen() { $idUser = $_SESSION['user_id']; $query = "SELECT * FROM `notificationsystem` WHERE `idUser`='{$idUser}' AND `Seen`='0' ORDER BY `idNotification` DESC LIMIT 3 "; $result = QueryExcuteWhile($query); if (mysqli_num_rows($result) > '0') { echo '<ul class="dropdown-menu extended notification">'; } while ($o = mysqli_fetch_object($result)) { echo ' <li> ' . $o->Description . ' <span class="small italic" style="margin-left:4%"><br>'; DateDifference($o->Timestamp); echo ' <br> <form action="" method="post" style="margin-bottom:-3%;margin-top:-10%;"> <input type="submit" value="Vu?" style="text-decoration:none;border:0;background:none;float:right; margin-left:10px;color:#22878E;line-height: 100%;font-size:12px;margin-top:5px;"/> <input type="hidden" name="vu" value="' . $o->idNotification . '"> </form> </span> </a> </li> '; } if (mysqli_num_rows($result) > '0') { echo ' <li> <form action="" method="post"> <input type="hidden" name="vu_tous" value="' . $idUser . '"> <center><input type="submit" value="Marquer tous comme Vus?" style="border:none;background: none;line-height: 100%;color:#22878E;font-size:12px;margin-bottom:0px;margin-top:15px;"></center> </form> </li> '; echo '</ul>'; } }
function MessageGetAllHeader() { global $URL; //get message source $idUser = $_SESSION['user_id']; $q1 = "SELECT * FROM `message` WHERE `ToUser`='{$idUser}' AND `Seen`='0' ORDER BY `idMessage` DESC LIMIT 2 "; $r1 = QueryExcuteWhile($q1); if (mysqli_num_rows($r1) > '0') { while ($o1 = mysqli_fetch_object($r1)) { $s1 = UserGetInfo($o1->FromUser); if (isset($s1->ProfilePhoto)) { $img1 = $s1->ProfilePhoto; } else { $img1 = ''; } echo ' <li> <a href="' . $URL . 'ili-messages/read?id=' . $o1->idMessage . '"> <span class="photo"> <img src="' . $img1 . '" alt="avatar" /> </span> <span class="subject"> <span class="from">' . $s1->FamilyName . ' ' . $s1->FirstName . '</span> </span> <span class="message"> ' . $o1->Subject . ' </span> <span class="small italic">'; DateDifference($o1->TimeStamp); echo '</span> </a> </li> '; } } //get rep messages $q2 = "SELECT * FROM `message`, `discussion`\n\t\t\tWHERE\n\t\t\t(`message`.`ToUser`='{$idUser}' OR `message`.`FromUser`='{$idUser}' )\n AND\n\t\t\t`discussion`.`ToUser`='{$idUser}'\n\t\t\tAND \n\t\t\t`message`.`Seen`='1'\n\t\t\tAND\n\t\t\t`discussion`.`idMessage`=`message`.`idMessage`\n\t\t\tAND\n\t\t\t`discussion`.`ToUser`='{$idUser}'\n\t\t\tAND\n\t\t\t`discussion`.`Seen`='0' LIMIT 2;\n\t\t\t"; $r2 = QueryExcuteWhile($q2); if (mysqli_num_rows($r2) > '0') { while ($o2 = mysqli_fetch_object($r2)) { $s2 = UserGetInfo($o2->FromUser); if (isset($s2->ProfilePhoto)) { $img2 = $s2->ProfilePhoto; } else { $img2 = ''; } echo ' <li> <a href="' . $URL . 'ili-messages/read?id=' . $o2->idMessage . '&id2=' . $o2->idDiscussion . '"> <span class="photo"> <img src="' . $img2 . '" alt="avatar" /> </span> <span class="subject"> <span class="from">' . $s2->FamilyName . ' ' . $s2->FirstName . '</span> </span> <span class="message"> ' . $o2->Subject . ' </span> <span class="small italic">'; DateDifference($o2->TimeStamp); echo '</span> </a> </li> '; } } }
function PatientInfo($rstRow) { global $arrNationality, $nAppId; $strGender = $rstRow["pat_gender"] == 1 ? "Male" : "Female"; echo "<table>"; echo "<td colspan=2><b>Personal Information</b><br/><hr/></td>"; ReadOnlyField("MR Number", "strMrNumber", $rstRow["pat_mr_number"], 16, 16, 0); ReadOnlyField("Patient Name", "strName", $rstRow["pat_name"], 32, 32, 0); ReadOnlyField("Nationality", "strName", $arrNationality[$rstRow["pat_nationality_id"] - 1], 32, 32, 0); ReadOnlyField("Date of birth", "strName", date("d-M-Y", strtotime($rstRow["pat_dob"])), 32, 32, 0); ReadOnlyField("Age", "strName", DateDifference(date("d-M-Y"), $rstRow["pat_dob"]), 32, 32, 0); ReadOnlyField("Gender", "strName", $strGender, 32, 32, 0); echo "<tr><td></td><form action='edit_patient.php'>"; HiddenField("nPatientId", $rstRow["pat_id"]); if (!empty($nAppId)) { HiddenField("nAppId", $nAppId); } echo "<td><input type=submit value='Edit Patient'></td></form></tr>"; echo "</table>"; }
function NotifGetAll() { $idUser = $_SESSION['user_id']; $result = QueryExcuteWhile("SELECT * FROM `notificationsystem` WHERE `idUser`='{$idUser}' ORDER BY idNotification DESC LIMIT 30"); while ($o = mysqli_fetch_object($result)) { echo ' <li> ' . $o->Description . ' <span class="small italic" style="margin-left:4%"><br>'; DateDifference($o->Timestamp); echo ' <br><br> <form action="" method="post" style="margin-bottom: -3%;margin-top: -10%;"> </form> </span> </a> </li> '; } }