Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kiosk Checkin / Out #2333

Merged
merged 87 commits into from
May 27, 2017
Merged
Show file tree
Hide file tree
Changes from 86 commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
87e29e0
begin student classroom utils
crossan007 Nov 12, 2016
2b68317
begin schema changes
crossan007 Nov 12, 2016
81056fc
Merge branch 'develop' into 2.4.0-sundayschool-classroom-utilities
crossan007 Nov 16, 2016
a7db514
tweaks
crossan007 Nov 16, 2016
409ecbd
Merge branch 'develop' into 2.4.0-sundayschool-classroom-utilities
crossan007 Nov 17, 2016
7721a9f
buttons and pictures!
crossan007 Nov 18, 2016
7a36b34
fight with joins for role names
crossan007 Nov 18, 2016
9bbd358
update from master
crossan007 Apr 20, 2017
5ee67db
update to develop
crossan007 Apr 20, 2017
7b09d92
Merge branch 'develop' into 2.4.0-sundayschool-classroom-utilities
crossan007 Apr 20, 2017
233caf6
underp merge
crossan007 Apr 20, 2017
ff33aab
update with new photo and schema. still messy query.
crossan007 Apr 20, 2017
ebaa966
working kiddos page
crossan007 Apr 21, 2017
673e713
cleanup
crossan007 Apr 21, 2017
0f53ec3
underp merge
crossan007 Apr 21, 2017
680885c
ss kiosk docs
crossan007 Apr 22, 2017
caa5eab
tweak
crossan007 Apr 22, 2017
b968a79
tweaks
crossan007 Apr 22, 2017
0ade297
remove old
crossan007 Apr 22, 2017
12a8b85
move file
crossan007 Apr 22, 2017
e8aa5f2
alerts
crossan007 Apr 22, 2017
92738b1
tweaks
crossan007 Apr 22, 2017
4ce13d4
Merge branch 'develop' into 2.4.0-sundayschool-classroom-utilities
crossan007 May 13, 2017
5f562a6
start adding event endpoints
crossan007 May 13, 2017
9bc836a
db tweaks
crossan007 May 14, 2017
2a44c4b
ORM
crossan007 May 14, 2017
6c80300
ORM
crossan007 May 14, 2017
0a586d8
More better
crossan007 May 15, 2017
da3c7ef
More better
crossan007 May 16, 2017
9941928
fix status logic
crossan007 May 16, 2017
06049cd
emergency emails
crossan007 May 16, 2017
ba6730d
emergency emails
crossan007 May 16, 2017
0adb368
working emergency notifs
crossan007 May 16, 2017
26a30b3
working emergency notifs
crossan007 May 16, 2017
e9c82ec
working emergency notifs
crossan007 May 16, 2017
ce62701
add nexmo
crossan007 May 16, 2017
0f935cb
add nexmo
crossan007 May 16, 2017
2846938
add nexmo
crossan007 May 16, 2017
61a8be7
more config
crossan007 May 16, 2017
e2e87ac
add open LP notifications
crossan007 May 16, 2017
886f9d5
Apply fixes from StyleCI
DawoudIO May 16, 2017
421d2c5
Merge pull request #2510 from ChurchCRM/analysis-q1lrr3
crossan007 May 17, 2017
75e42dd
move to /kiosk
crossan007 May 17, 2017
91999f2
cleanup move to /kiosk
crossan007 May 17, 2017
8d19487
begin kiosk manager
crossan007 May 17, 2017
514fd2d
kiosk manager
crossan007 May 17, 2017
5e06efb
kiosk remote commands
crossan007 May 17, 2017
4713040
fullscreen
crossan007 May 17, 2017
9d8052f
add event kiosk editor
crossan007 May 17, 2017
4a71a4e
Apply fixes from StyleCI
DawoudIO May 17, 2017
15eeae7
Merge pull request #2513 from ChurchCRM/analysis-qByrbr
crossan007 May 17, 2017
e700a5a
API visiblilty counter
crossan007 May 17, 2017
d70cc14
windowed kiosk registration
crossan007 May 17, 2017
814d0b6
guid
crossan007 May 17, 2017
12b958a
Merge branch '2.4.0-sundayschool-classroom-utilities' of https://gith…
crossan007 May 17, 2017
f17e59a
fix kiosk point
crossan007 May 17, 2017
ba298a5
fix kiosk point
crossan007 May 17, 2017
1b0b1bf
kiosk assignments, and correct location for checkin/out
crossan007 May 18, 2017
8b6ed1d
fix notification
crossan007 May 18, 2017
d5f64a0
unlink kiosk/events
crossan007 May 18, 2017
cb87669
cleanup
crossan007 May 18, 2017
e9e223a
cleanup
crossan007 May 18, 2017
34909de
fix menu add
crossan007 May 18, 2017
1c1ea8f
kiosk random initial names and other cleanup
crossan007 May 18, 2017
d648d5f
start working on assignment handler and events api
crossan007 May 18, 2017
b691c97
assignment menus
crossan007 May 19, 2017
3055336
add kiosk ID button
crossan007 May 19, 2017
b9319fe
misc
crossan007 May 19, 2017
4e4bd8f
Apply fixes from StyleCI (#2520)
DawoudIO May 20, 2017
e53823f
fix installer
crossan007 May 20, 2017
5293a64
underp install
crossan007 May 20, 2017
e9fc72b
Merge branch 'develop' into 2.4.0-sundayschool-classroom-utilities
crossan007 May 20, 2017
f5f2568
cleanup docs - moved to wiki
crossan007 May 20, 2017
9835bb3
remove emergency wording
crossan007 May 20, 2017
694cf61
cleanup
crossan007 May 20, 2017
b5a7bc5
fix email notifications
crossan007 May 20, 2017
970e7ce
email and sms works
crossan007 May 20, 2017
5c811b0
proejctor working.
crossan007 May 20, 2017
050424f
allow auth'd openLP messages.
crossan007 May 21, 2017
5e420e0
cleanup returns
crossan007 May 21, 2017
2223630
linux is case sensitive.
crossan007 May 21, 2017
f31b996
fix duplicate PK on kiosk config
crossan007 May 21, 2017
ca7b4dd
Merge branch 'develop' into 2.4.0-sundayschool-classroom-utilities
crossan007 May 21, 2017
2062ef2
allow self signed ssl
crossan007 May 21, 2017
13f6a12
Merge branch '2.4.0-sundayschool-classroom-utilities' of https://gith…
crossan007 May 21, 2017
ad93a57
fix bad merge
crossan007 May 21, 2017
42426b8
start address comments
crossan007 May 26, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions propel/schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@
</foreign-key>
<foreign-key foreignTable="group_grp">
<reference local="p2g2r_grp_ID" foreign="grp_ID"/>
</foreign-key>
<foreign-key foreignTable="list_lst">
<reference local="p2g2r_rle_ID" foreign="lst_OptionID"/>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is used on line 23 in GroupQuery.php

</foreign-key>
<vendor type="mysql">
<parameter name="Engine" value="MyISAM"/>
Expand Down Expand Up @@ -465,6 +468,9 @@
<foreign-key foreignTable="events_event">
<reference local="event_id" foreign="event_id"/>
</foreign-key>
<foreign-key foreignTable="person_per">
<reference local="person_id" foreign="per_ID"/>
</foreign-key>
<unique name="event_id">
<unique-column name="event_id"/>
<unique-column name="person_id"/>
Expand All @@ -485,6 +491,10 @@
<column name="type_defrecurDOM" phpName="DefRecurDOM" type="CHAR" size="2" required="true" defaultValue="0"/>
<column name="type_defrecurDOY" phpName="DefRecurDOY" type="DATE" required="true" defaultValue="2016-01-01"/>
<column name="type_active" phpName="Active" type="INTEGER" size="1" required="true" defaultValue="1"/>
<column name="type_grpid" phpName="GroupId" type="INTEGER" required="false" defaultValue="0"/>
<foreign-key foreignTable="group_grp">
<reference local="type_grpid" foreign="grp_ID"/>
</foreign-key>
<vendor type="mysql">
<parameter name="Engine" value="MyISAM"/>
</vendor>
Expand Down Expand Up @@ -527,6 +537,10 @@
<column name="event_end" phpName="End" type="TIMESTAMP" required="true"/>
<column name="inactive" phpName="InActive" type="INTEGER" size="1" required="true" defaultValue="0"/>
<column name="event_typename" phpName="TypeName" type="VARCHAR" size="40" required="true" defaultValue=""/>
<column name="event_grpid" phpName="GroupId" type="INTEGER" required="false" defaultValue="0"/>
<foreign-key foreignTable="group_grp">
<reference local="event_grpid" foreign="grp_ID"/>
</foreign-key>
<index name="event_txt">
<index-column name="event_text"/>
</index>
Expand Down Expand Up @@ -711,6 +725,40 @@
<parameter name="Engine" value="MyISAM"/>
</vendor>
</table>

<table name="kioskdevice_kdev" idMethod="native" phpName="KioskDevice">
<column name="kdev_ID" phpName="Id" type="INTEGER" size="9" sqlType="mediumint(9) unsigned" primaryKey="true" autoIncrement="true" required="true"/>
<column name="kdev_GUIDHash" phpName="GUIDHash" type="VARCHAR" size="36"/>
<column name="kdev_Name" phpName="Name" type="VARCHAR" size="50"/>
<column name="kdev_deviceType" phpName="DeviceType" type="LONGVARCHAR"/>
<column name="kdev_lastHeartbeat" phpName="LastHeartbeat" type="LONGVARCHAR" />
<column name="kdev_Accepted" phpName="Accepted" type="BOOLEAN"/>
<column name="kdev_PendingCommands" phpName="PendingCommands" type="LONGVARCHAR" />
<index name="kdev_ID">
<index-column name="kdev_ID"/>
</index>
</table>


<table name="kioskassginment_kasm" idMethod="native" phpName="KioskAssignment">
<column name="kasm_ID" phpName="Id" type="INTEGER" size="9" sqlType="mediumint(9) unsigned" primaryKey="true" autoIncrement="true" required="true"/>
<column name="kasm_kdevId" phpName="KioskId" type="INTEGER" size="9"/>
<column name="kasm_AssignmentType" phpName="AssignmentType" type="INTEGER" size="9"/>
<column name="kasm_EventId" phpName="EventId" type="INTEGER" size="9"/>
<index name="kasm_ID">
<index-column name="kasm_ID"/>
</index>

<foreign-key foreignTable="kioskdevice_kdev">
<reference local="kasm_kdevId" foreign="kdev_ID"/>
</foreign-key>

<foreign-key foreignTable="events_event">
<reference local="kasm_EventId" foreign="event_id"/>
</foreign-key>
</table>



<table name="tokens" idMethod="native" phpName="Token">
<column name="token" phpName="Token" type="VARCHAR" primaryKey="true" required="true"/>
Expand Down
33 changes: 33 additions & 0 deletions src/ChurchCRM/Emails/notifications/NotificationEmail.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace ChurchCRM\Emails;

use ChurchCRM\dto\SystemConfig;

class NotificationEmail extends BaseEmail
{
private $notificationSource;

public function __construct($toAddresses,$notificationSource)
{
$this->notificationSource = $notificationSource;
parent::__construct($toAddresses);
$this->mail->Subject = SystemConfig::getValue("sChurchName") . ": " . $this->getSubSubject();
$this->mail->isHTML(true);
$this->mail->msgHTML($this->buildMessage());
}

protected function getSubSubject()
{
return gettext("Notification");
}

public function getTokens()
{
$myTokens = [
"toName" => "Guardian(s) of ". $this->notificationSource,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get this text

"body" => gettext("A notification was triggered by the classroom teacher at " . date('Y-m-d H:i:s') ." Please go to this location")
];
return array_merge($this->getCommonTokens(), $myTokens);
}
}
13 changes: 13 additions & 0 deletions src/ChurchCRM/dto/KioskAssignmentTypes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace ChurchCRM\dto;

abstract class KioskAssignmentTypes
{
const EVENTATTENDANCEKIOSK = 1;
const SELFREGISTRATIONKIOSK = 2;
const SELFCHECKINKIOSK = 3;
const GENERALATTENDANCEKIOSK = 4;
}

?>
133 changes: 133 additions & 0 deletions src/ChurchCRM/dto/Notification.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<?php

namespace ChurchCRM\dto;

use ChurchCRM\Person;
use ChurchCRM\dto\SystemConfig;
use ChurchCRM\Emails\NotificationEmail;
use Nexmo\Client;
use Nexmo\Client\Credentials\Basic as NexmoBasicCred;
use ChurchCRM\dto\OpenLPNotification;

class Notification
{

protected $projectorText;
protected $recipients;
protected $person;

public function __construct()
{

}

public function setRecipients($recipients)
{
$this->recipients = $recipients;

}

public function setSMSText($text)
{

}

public function setEmailText($text)
{

}

public function setPerson(\ChurchCRM\Person $Person)
{
$this->person = $Person;
}

public function setProjectorText($text)
{
$this->projectorText=$text;
}

private function sendEmail()
{
$emailaddresses = [];
Foreach ($this->recipients as $recipient)
{
array_push($emailaddresses,$recipient->getEmail());
}
try
{
$email = new NotificationEmail($emailaddresses,$this->person->getFullName());
$emailStatus=$email->send();
return $emailStatus;
} catch (Exception $ex) {
return false;
}

}

private function sendSMS()
{
try
{

$client = new Client(New NexmoBasicCred(SystemConfig::getValue("sNexmoAPIKey"),SystemConfig::getValue("sNexmoAPISecret")));

Foreach ($this->recipients as $recipient)
{
$message = $client->message()->send([
'to' => $recipient->getNumericCellPhone(),
'from' => SystemConfig::getValue("sNexmoFromNumber"),
'text' => 'Notification for ' . $this->person->getFullName()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gettext

]);
}
return $message;
} catch (Exception $ex) {
return false;
}

}

private function sendProjector()
{
try
{
$OLPAlert = new OpenLPNotification(SystemConfig::getValue("sOLPURL"),
SystemConfig::getValue("sOLPUserName"),
SystemConfig::getValue("sOLPPassword"));
$OLPAlert->setAlertText($this->projectorText);
return $OLPAlert->send();
} catch (Exception $ex) {
return false;
}

}

public function send()
{

$methods = [];
if(SystemConfig::hasValidMailServerSettings())
{
$send = $this->sendEmail();
array_push($methods,"email: ".$send);
}
if (SystemConfig::hasValidSMSServerSettings())
{
$send = (boolean)$this->sendSMS();
array_push($methods,"sms: ".$send);
}
if(SystemConfig::hasValidOpenLPSerrings())
{
$send = (boolean)($this->sendProjector());
array_push($methods,"projector: ".$send);
}
$sendStatus = [
"status"=>"",
"methods"=>$methods
];

return json_encode($sendStatus);

}

}
57 changes: 57 additions & 0 deletions src/ChurchCRM/dto/OpenLPNotification.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php

namespace ChurchCRM\dto;


class OpenLPNotification
{
protected $OLPAddress;
protected $OLPUsername;
protected $OLPPassword;
protected $AlertText;

public function __construct($OLPAddress,$OLPUsername,$OLPPassword)
{
$this->OLPAddress=$OLPAddress;
$this->OLPUsername=$OLPUsername;
$this->OLPPassword=$OLPPassword;
}

public function setAlertText($text)
{
$this->AlertText = (string)$text;
}

private function getAuthorizationHeader()
{
return base64_encode(SystemConfig::getValue("sOLPUserName").":".SystemConfig::getValue("sOLPPassword"));
}

public function send()
{
$headers = array (
'http'=>array(
'method' =>"GET",
'timeout' => 5
),
"ssl" => array(
"verify_peer" => false,
"allow_self_signed" => false,
)
);
if(SystemConfig::getValue("sOLPUserName"))
{
$headers['http']['header'] = "Authorization: Basic ".$this->getAuthorizationHeader()."\r\n";
}
//return json_encode($headers);
$request = array(
"request" => array(
"text" =>$this->AlertText
)
);
$url = $this->OLPAddress."/api/alert?data=".urlencode(json_encode($request));
$context = stream_context_create($headers);
$response = file_get_contents($url,false,$context);
return $response;
}
}
17 changes: 16 additions & 1 deletion src/ChurchCRM/dto/SystemConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ private static function buildConfigs()
"iPersonNameStyle" => new ConfigItem(2020, "iPersonNameStyle", "choice", "4", "","", json_encode(SystemConfig::getNameChoices())),
"bDisplayBillCounts" => new ConfigItem(2002, "bDisplayBillCounts", "boolean", "1", gettext("Display bill counts on deposit slip")),
"sCloudURL" => new ConfigItem(2003, "sCloudURL", "text", "http://demo.churchcrm.io/", gettext("ChurchCRM Cloud Access URL")),
"sNexmoAPIKey" => new ConfigItem(2012, "sNexmoAPIKey", "text", "", gettext("Nexmo SMS API Key")),
"sNexmoAPISecret" => new ConfigItem(2005, "sNexmoAPISecret", "text", "", gettext("Nexmo SMS API Secret")),
"sNexmoFromNumber" => new ConfigItem(2006, "sNexmoFromNumber", "text", "", gettext("Nexmo SMS From Number")),
"sOLPURL" => new ConfigItem(2007, "sOLPURL", "text", "http://192.168.1.1:4316", gettext("OpenLP URL")),
"sOLPUserName" => new ConfigItem(2008, "sOLPUserName", "text", "", gettext("OpenLP Username")),
"sOLPPassword" => new ConfigItem(2009, "sOLPPassword", "text", "", gettext("OpenLP Password")),
"sKioskVisibilityTimestamp" => new ConfigItem(2011, "sKioskVisibilityTimestamp", "text", "", gettext("KioskVisibilityTimestamp")),
"bEnableLostPassword" => new ConfigItem(2004, "bEnableLostPassword", "boolean", "1", gettext("Show/Hide Lost Password Link on the login screen"))
);
}
Expand All @@ -214,7 +221,7 @@ private static function buildCategories()
gettext('System Settings') => ["sLogLevel", "bRegistered","sGZIPname","sZIPname","sPGPname","bCSVAdminOnly","sHeader","bEnableIntegrityCheck","iIntegrityCheckInterval","sLastIntegrityCheckTimeStamp"],
gettext('Backup') => ["sLastBackupTimeStamp","bEnableExternalBackupTarget","sExternalBackupType","sExternalBackupAutoInterval","sExternalBackupEndpoint","sExternalBackupUsername","sExternalBackupPassword"],
gettext('Localization') => ["sLanguage","sDistanceUnit","sPhoneFormat","sPhoneFormatWithExt","sDateFormatLong","sDateFormatNoYear","sDateFormatShort","sDateTimeFormat","sDateFilenameFormat"],
gettext('Integration') => ["sMailChimpApiKey","bEnableGravatarPhotos","sGoogleTrackingID"]
gettext('Integration') => ["sMailChimpApiKey","bEnableGravatarPhotos","sGoogleTrackingID","sNexmoAPIKey","sNexmoAPISecret","sNexmoFromNumber","sOLPURL","sOLPUserName","sOLPPassword"]
);
}

Expand Down Expand Up @@ -323,5 +330,13 @@ public static function hasValidMailServerSettings() {

return $hasValidSettings;
}

public static function hasValidSMSServerSettings() {
return (!empty(self::getValue("sNexmoAPIKey"))) && (!empty(self::getValue("sNexmoAPISecret"))) && (!empty(self::getValue("sNexmoFromNumber")));
}

public static function hasValidOpenLPSerrings() {
return (!empty(self::getValue("sOLPURL")));
}

}
Loading