|
|
@@ -4,6 +4,7 @@
|
|
|
Lib::loadClass('RouteBase');
|
|
|
Lib::loadClass('Przypomnij');
|
|
|
Lib::loadClass('Request');
|
|
|
+Lib::loadClass('TypespecialVariable');
|
|
|
Lib::loadClass('Route_UserMsgs');
|
|
|
|
|
|
/*
|
|
|
@@ -65,7 +66,8 @@ class Route_Notify extends RouteBase {
|
|
|
}
|
|
|
$previewLink = implode('', $urlParts);
|
|
|
|
|
|
- $lastSentDate = 'brak';
|
|
|
+ $lastSentDate = 'brak';// TODO: getLastSendData($usrLogin);
|
|
|
+ $typeSpecialUserLogin = TypespecialVariable::getInstance(-1, '__USER_LOGIN');
|
|
|
?>
|
|
|
<div class="jumbotron">
|
|
|
<div class="container">
|
|
|
@@ -73,7 +75,19 @@ class Route_Notify extends RouteBase {
|
|
|
<div class="form-group">
|
|
|
<label class="col-sm-2 control-label">User</label>
|
|
|
<div class="col-sm-10">
|
|
|
- <input class="form-control" type="text" name="usrLogin" value="<?php echo $usrLogin; ?>">
|
|
|
+ <?php if ($typeSpecialUserLogin) : ?>
|
|
|
+ <?php
|
|
|
+ $fldName = 'usrLogin';
|
|
|
+ $fldParams = array();
|
|
|
+ $fldParams['allowCreate'] = false;
|
|
|
+ $fldParams['ajaxDataUrlBase'] = "index.php?_route=Notify&_task=typeSpecialUserLogin";
|
|
|
+ $fldParams['placeholder'] = 'Szukaj...';
|
|
|
+ //$fldParams['ajaxDataUrlBase'] .= "&DBG_TS=3";
|
|
|
+ echo $typeSpecialUserLogin->showFormItem($tblID = -1, $fldName, $usrLogin, $fldParams);
|
|
|
+ ?>
|
|
|
+ <?php else : ?>
|
|
|
+ <input class="form-control" type="text" name="usrLogin" value="<?php echo $usrLogin; ?>">
|
|
|
+ <?php endif; ?>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
@@ -134,6 +148,33 @@ function refreshPreview() {
|
|
|
SE_Layout::dol();
|
|
|
}
|
|
|
|
|
|
+ public function typeSpecialUserLoginAction() {
|
|
|
+ header("Content-type: application/json");
|
|
|
+ $typeSpecialUserId = TypespecialVariable::getInstance(-1, '__USER_LOGIN');
|
|
|
+ if (!$typeSpecialUserId) {
|
|
|
+ $jsonData = new stdClass();
|
|
|
+ $jsonData->message = "TypeSpecial '__USER_LOGIN' not exists";
|
|
|
+ echo json_encode($jsonData);
|
|
|
+ exit;
|
|
|
+ }
|
|
|
+
|
|
|
+ $query = V::get('q', '', $_REQUEST);
|
|
|
+ $rawRows = null;
|
|
|
+ $jsonData = array();
|
|
|
+ $queryParams = array();
|
|
|
+ $rows = $typeSpecialUserId->getValuesWithExports($query, $queryParams);
|
|
|
+ foreach ($rows as $kID => $vItem) {
|
|
|
+ $itemJson = new stdClass();
|
|
|
+ $itemJson->id = $vItem->id;
|
|
|
+ $itemJson->name = $vItem->param_out;
|
|
|
+ if (!empty($vItem->exports)) {
|
|
|
+ $itemJson->exports = $vItem->exports;
|
|
|
+ }
|
|
|
+ $jsonData[] = $itemJson;
|
|
|
+ }
|
|
|
+ echo json_encode($jsonData);
|
|
|
+ }
|
|
|
+
|
|
|
public function send($usrLogin, $reminders) {
|
|
|
DBG::_(true, true, "usrLogin", $usrLogin, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
DBG::_(true, true, "reminders", $reminders, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
@@ -162,12 +203,12 @@ function refreshPreview() {
|
|
|
$subject = "Powiadomienie - {$_SERVER['SERVER_NAME']}";
|
|
|
ob_start();
|
|
|
$this->generateUserReminders($usrLogin, $reminders);
|
|
|
+ echo '<br><br>' . "\n";
|
|
|
+ echo "Wiadomość została wygenerowana autoamtycznie.";
|
|
|
+ echo "<br>\n------------------ TEST --------------------";// TODO: TEST
|
|
|
$message = ob_get_clean();
|
|
|
|
|
|
if (!mail($to, $subject, $message, $headers)) throw new Exception("Nie udało się wysłać powiadomienia");
|
|
|
- echo 'Your message has been sent.';
|
|
|
- throw new Exception(".EOF TODO");
|
|
|
- DBG::_(true, true, "user", $user, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
}
|
|
|
|
|
|
public function generateUserRemindersAction() {
|