Skip to content

Commit

Permalink
Merge pull request #5 from jibon57/v2.0.2
Browse files Browse the repository at this point in the history
v2.0.2
  • Loading branch information
jibon57 authored Aug 6, 2018
2 parents e1f8341 + ec71706 commit 886c0c8
Show file tree
Hide file tree
Showing 20 changed files with 335 additions and 6 deletions.
1 change: 1 addition & 0 deletions packages/com_bigbluebutton/admin/access.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<action name="core.edit.own" title="JACTION_EDITOWN" description="JACTION_EDITOWN_COMPONENT_DESC" />
<action name="core.edit.created_by" title="COM_BIGBLUEBUTTON_EDIT_CREATED_BY" description="COM_BIGBLUEBUTTON_EDIT_CREATED_BY_DESC" />
<action name="core.edit.created" title="COM_BIGBLUEBUTTON_EDIT_CREATED_DATE" description="COM_BIGBLUEBUTTON_EDIT_CREATED_DATE_DESC" />
<action name="event.resent_email" title="COM_BIGBLUEBUTTON_EVENT_RESENT_EMAIL_BUTTON_ACCESS" description="COM_BIGBLUEBUTTON_EVENT_RESENT_EMAIL_BUTTON_ACCESS_DESC" />
<action name="event.access" title="COM_BIGBLUEBUTTON_EVENTS_ACCESS" description="COM_BIGBLUEBUTTON_EVENTS_ACCESS_DESC" />
<action name="event.batch" title="COM_BIGBLUEBUTTON_EVENTS_BATCH_USE" description="COM_BIGBLUEBUTTON_EVENTS_BATCH_USE_DESC" />
<action name="event.dashboard_add" title="COM_BIGBLUEBUTTON_EVENTS_DASHBOARD_ADD" description="COM_BIGBLUEBUTTON_EVENTS_DASHBOARD_ADD_DESC" />
Expand Down
28 changes: 28 additions & 0 deletions packages/com_bigbluebutton/admin/controllers/event.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ public function __construct($config = array())
parent::__construct($config);
}


/**
* This method will send email again
*
*/

function reSendEmail(){
$id = $this->input->get('id');
$model = $this->getModel('Event', '', array());
$model->reSendEmail($id);

}


/**
* Method override to check if you can add a new record.
*
Expand Down Expand Up @@ -299,6 +313,20 @@ public function save($key = null, $urlVar = null)
*/
protected function postSaveHook(JModelLegacy $model, $validData = array())
{

if(!$validData['id'] && $validData['send_invitation_email'] == 1){

$item = $model->getItem();
$eventID = $item->get('id');

if(!class_exists('BBBManageClass')){
require_once JPATH_COMPONENT_ADMINISTRATOR."/helpers/bbbManageClass.php";
}
$class = new BBBManageClass();
$class->sendInvitationEmails($item, $redirect);

}

return;
}

Expand Down
4 changes: 4 additions & 0 deletions packages/com_bigbluebutton/admin/controllers/events.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,8 @@ public function importData()
$this->setRedirect(JRoute::_('index.php?option=com_bigbluebutton&view=events', false), $message, 'error');
return;
}

function reSendEmail(){
//
}
}
145 changes: 145 additions & 0 deletions packages/com_bigbluebutton/admin/helpers/bbbManageClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,151 @@ private function prepareBBBUrl($meetingID, $meetingName, $studentPass, $teacherP
return $output;

}

public function formatTimeZoneWithGMT($event){
$timeZone = "";
$config = JFactory::getConfig();

if($event->timezone == 1){
$timeZone = $config->get('offset');
} else{
$timeZone = $event->event_timezone;
}
$dtz = new DateTimeZone($timeZone);
$time_in_sofia = new DateTime('now', $dtz);
$offset = $dtz->getOffset($time_in_sofia) / 3600;

$GMT = $timeZone." (GMT" . ($offset < 0 ? $offset : "+" . $offset).")";
return $GMT;
}

public function sendInvitationEmails($event, $redirect = true){

$config = JFactory::getConfig();
$host = JUri::getInstance()->getHost();
$mailer = JFactory::getMailer();
$app = JFactory::getApplication();

if($event->timezone == 1){
$timeZone = $config->get('offset');
} else{
$timeZone = $event->event_timezone;
}

$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query = "SELECT * FROM `#__bigbluebutton_meeting` WHERE `id`=" . $db->quote($event->meeting_id);
$db->setQuery($query);
$meeting = $db->loadObject();

$mettingRoomName = $meeting->title;
$mettingRoomAttendeepw = $meeting->attendeepw;
$timeZoneWithGMT = $this->formatTimeZoneWithGMT($event);
$attendeeEmailAddresses = explode(",", rtrim($event->emails, ","));
$invitationSender = JFactory::getUser()->name;
$eventDes = $event->event_des;

if($event->event_password == 0){
$mettingRoomAttendeepw = $event->custom_event_pass;
}
if($meeting->assign_to){
$invitationSender = JFactory::getUser($meeting->assign_to)->name;
}
if($event->event_des){
$eventDes = strip_tags($event->event_des);
}

$subject = JText::sprintf('COM_BIGBLUEBUTTON_ATTENDEE_INVITATION_EMAIL_SUBJECT', $invitationSender, $event->event_start, $event->event_end);
$body = JText::sprintf('COM_BIGBLUEBUTTON_ATTENDEE_INVITATION_EMAIL_BODY', $invitationSender, $invitationSender, $mettingRoomName, $event->event_title,
$event->event_des, $event->event_start, $event->event_end, $timeZoneWithGMT, $mettingRoomAttendeepw, $event->join_url, $event->join_url, $config->get('sitename'));

$icsFile = $this->createICSfile($host, $event->id, $timeZone, $event->event_start, $event->event_end, $event->event_title,
$eventDes, $mettingRoomName, $event->join_url);

$sender = array(
$config->get('mailfrom'),
$config->get('fromname')
);

$mailer->setSender($sender);
$mailer->addRecipient($attendeeEmailAddresses);

$mailer->setSubject($subject);
$mailer->setBody($body);
$mailer->isHTML(true);
$mailer->addAttachment($icsFile);
$send = $mailer->Send();

if ($send == "true") {
unlink($icsFile);
if($redirect){
$app->redirect( Juri::current().'?option=com_bigbluebutton&view=event&layout=edit&id='.$event->id, JText::_('COM_BIGBLUEBUTTON_ATTENDEE_INVITATION_EMAIL_SUCCESS'), 'success');
}
} else {
unlink($icsFile);
if($redirect){
$app->redirect( Juri::current().'?option=com_bigbluebutton&view=event&layout=edit&id='.$event->id, JText::_('COM_BIGBLUEBUTTON_ATTENDEE_INVITATION_EMAIL_FAILURE')." ".$send, 'error');
}
}
}

protected function createICSfile($host, $eventID, $userTimeZone, $start, $end, $title, $description, $roomName, $url) {

date_default_timezone_set('UTC');
$current = date("Ymd\THis\Z", time()); // TZOFFSETTO of "right now"

date_default_timezone_set($userTimeZone);

$ics = "BEGIN:VCALENDAR\n";
$ics .= "PRODID:-//{$host}//Event Management\n";
$ics .= "VERSION:2.0\n";
$ics .= "METHOD:PUBLISH\n";
$ics .= "X-MS-OLK-FORCEINSPECTOROPEN:TRUE\n";
$ics .= "BEGIN:VTIMEZONE\n";
$ics .= "TZID:{$userTimeZone}\n";
$ics .= "TZURL:http://tzurl.org/zoneinfo-outlook/{$userTimeZone}\n";
$ics .= "X-LIC-LOCATION:{$userTimeZone}\n";
$ics .= "BEGIN:STANDARD\n";
$ics .= "TZOFFSETFROM:" . date('O', time()) . "\n";
$ics .= "END:STANDARD\n";
$ics .= "END:VTIMEZONE\n";
$ics .= "BEGIN:VEVENT\n";
$ics .= "CLASS:PUBLIC\n";
$ics .= "DTSTAMP:" . $current . "\n";
$ics .= "DTSTART;TZID={$userTimeZone}:" . date("Ymd\THis", strtotime($start)) . "\n";
$ics .= "DTEND;TZID={$userTimeZone}:" . date("Ymd\THis", strtotime($end)) . "\n";
$ics .= "LOCATION:{$roomName}\n";
$ics .= "PRIORITY:5\n";
$ics .= "SEQUENCE:0\n";
$ics .= "SUMMARY;LANGUAGE=en-us:{$title}\n";
$ics .= "DESCRIPTION:{$description}\n";
$ics .= "TRANSP:OPAQUE\n";
$ics .= "UID:" . uniqid('Myna_') . "\n";
$ics .= "X-MICROSOFT-CDO-BUSYSTATUS:BUSY\n";
$ics .= "X-MICROSOFT-CDO-IMPORTANCE:1\n";
$ics .= "X-MICROSOFT-DISALLOW-COUNTER:FALSE\n";
$ics .= "X-MS-OLK-ALLOWEXTERNCHECK:TRUE\n";
$ics .= "X-MS-OLK-AUTOFILLLOCATION:FALSE\n";
$ics .= "X-MS-OLK-CONFTYPE:0\n";
//Here is to set the reminder for the event.
$ics .= "BEGIN:VALARM\n";
$ics .= "DESCRIPTION:{$title}\n";
$ics .= "TRIGGER:-PT10M\n";
$ics .= "ACTION:DISPLAY\n";
$ics .= "DESCRIPTION:Reminder\n";
$ics .= "END:VALARM\n";
$ics .= "END:VEVENT\n";
$ics .= "END:VCALENDAR\n";

$file = JPATH_ROOT . "/tmp/" . $eventID . "_calender.ics";

file_put_contents($file, $ics);

if (file_exists($file)) {
return $file;
}
return false;
}
}

?>
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
COM_BIGBLUEBUTTON="BigBlueButton"
COM_BIGBLUEBUTTON_ACTION="Action"
COM_BIGBLUEBUTTON_ARCHIVED="Archived"
COM_BIGBLUEBUTTON_ATTENDEE_INVITATION_EMAIL_BODY="<p>Hello,</p>
<p>You have an invitation to join <strong>%s</strong> in their virtual meeting room. Here is the information:</p>
<p> </p><br>
<p><strong>Sender Name:</strong> %s</p>
<p><strong>Room Name:</strong> %s</p>
<p><strong>Event Title:</strong> %s</p>
<p><strong>Description:</strong> %s</p>
<p><strong>Event Start:</strong> %s</p>
<p><strong>Event End:</strong> %s</p>
<p><strong>TimeZone:</strong> %s</p>
<p><strong>Password/PIN Number:</strong> %s</p>
<p> </p><br>
<p>Click this link to participate in the conference [The link may only work for a certain period.]:</p>
<p><a href='%s'>Click here to enter room</a></p>
<p> </p>
<p>If you have problems with the link, please copy and paste this to your browser: </p>
<p> %s </p>
<p><br /><br />Enjoy!<br />All the best,<br />%s</p>"
COM_BIGBLUEBUTTON_ATTENDEE_INVITATION_EMAIL_FAILURE="Sending message wasn't successful!"
COM_BIGBLUEBUTTON_ATTENDEE_INVITATION_EMAIL_SUBJECT="You have an invitation from %s Start: %s End: %s"
COM_BIGBLUEBUTTON_ATTENDEE_INVITATION_EMAIL_SUCCESS="Sending message was successful"
COM_BIGBLUEBUTTON_AUTHOR="Author"
COM_BIGBLUEBUTTON_BACK="Back"
COM_BIGBLUEBUTTON_CANT_DELETED_RECORD="Can\'t deleted record"
Expand Down Expand Up @@ -109,6 +130,10 @@ COM_BIGBLUEBUTTON_EVENT_CUSTOM_EVENT_PASS_LABEL="Custom Event Password"
COM_BIGBLUEBUTTON_EVENT_CUSTOM_EVENT_PASS_MESSAGE="Error! Please add some text here."
COM_BIGBLUEBUTTON_EVENT_DETAILS="Details"
COM_BIGBLUEBUTTON_EVENT_EDIT="Editing the event"
COM_BIGBLUEBUTTON_EVENT_EMAILS="Emails"
COM_BIGBLUEBUTTON_EVENT_EMAILS_DESCRIPTION="Attendee Email(s). For multiple emails use comma (,) to make separation."
COM_BIGBLUEBUTTON_EVENT_EMAILS_HINT="Attendee Email(s). For multiple emails use comma (,) to make separation."
COM_BIGBLUEBUTTON_EVENT_EMAILS_LABEL="Attendee Email(s)"
COM_BIGBLUEBUTTON_EVENT_ERROR_UNIQUE_ALIAS="Another event has the same alias."
COM_BIGBLUEBUTTON_EVENT_EVENT_DES="Event Des"
COM_BIGBLUEBUTTON_EVENT_EVENT_DES_DESCRIPTION="Event Description"
Expand Down Expand Up @@ -149,17 +174,24 @@ COM_BIGBLUEBUTTON_EVENT_MODIFIED_BY_LABEL="Modified By"
COM_BIGBLUEBUTTON_EVENT_MODIFIED_DATE_DESC="The date this event was modified."
COM_BIGBLUEBUTTON_EVENT_MODIFIED_DATE_LABEL="Modified Date"
COM_BIGBLUEBUTTON_EVENT_NEW="A New event"
COM_BIGBLUEBUTTON_EVENT_NO="No"
COM_BIGBLUEBUTTON_EVENT_ORDERING_LABEL="Ordering"
COM_BIGBLUEBUTTON_EVENT_PERMISSION="Permissions"
COM_BIGBLUEBUTTON_EVENT_PUBLISHING="Publishing"
COM_BIGBLUEBUTTON_EVENT_RESENT_EMAIL_BUTTON_ACCESS="event Resent Email Button Access"
COM_BIGBLUEBUTTON_EVENT_RESENT_EMAIL_BUTTON_ACCESS_DESC=" Allows the users in this group to access the resent email button."
COM_BIGBLUEBUTTON_EVENT_ROOMS_PASSWORD="Room's Password"
COM_BIGBLUEBUTTON_EVENT_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the event to customise the alias."
COM_BIGBLUEBUTTON_EVENT_SEND_INVITATION_EMAIL="Send Invitation Email"
COM_BIGBLUEBUTTON_EVENT_SEND_INVITATION_EMAIL_DESCRIPTION="Send Invitation Email to the attendees' given above."
COM_BIGBLUEBUTTON_EVENT_SEND_INVITATION_EMAIL_LABEL="Send Invitation Email"
COM_BIGBLUEBUTTON_EVENT_STATUS="Status"
COM_BIGBLUEBUTTON_EVENT_TIMEZONE="Timezone"
COM_BIGBLUEBUTTON_EVENT_TIMEZONE_DESCRIPTION="Select timezone for the event."
COM_BIGBLUEBUTTON_EVENT_TIMEZONE_LABEL="Timezone"
COM_BIGBLUEBUTTON_EVENT_VERSION_DESC="A count of the number of times this event has been revised."
COM_BIGBLUEBUTTON_EVENT_VERSION_LABEL="Revision"
COM_BIGBLUEBUTTON_EVENT_YES="Yes"
COM_BIGBLUEBUTTON_EXPORT_DATA="Export Data"
COM_BIGBLUEBUTTON_EXPORT_DATA_DESC=" Allows users in this group to export data."
COM_BIGBLUEBUTTON_EXPORT_FAILED="Export Failed"
Expand Down Expand Up @@ -351,6 +383,7 @@ COM_BIGBLUEBUTTON_RECORDING_DESC="Recording"
COM_BIGBLUEBUTTON_RECORDING_SUBMENU="Recording Submenu"
COM_BIGBLUEBUTTON_RECORDING_SUBMENU_DESC="Allows the users in this group to submenu of Recording"
COM_BIGBLUEBUTTON_RECORD_DELETED_SUCCESSFULLY="Record deleted successfully"
COM_BIGBLUEBUTTON_RESENT_EMAIL="Resent Email"
COM_BIGBLUEBUTTON_SAVE_SUCCESS="Great! Item successfully saved."
COM_BIGBLUEBUTTON_SAVE_WARNING="The value already existed so please select another."
COM_BIGBLUEBUTTON_SELECT_MEETING_ROOM="Select Meeting Room"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ COM_BIGBLUEBUTTON_EVENTS_IMPORT="Events Import"
COM_BIGBLUEBUTTON_EVENTS_IMPORT_DESC="Allows the users in this group to import import events"
COM_BIGBLUEBUTTON_EVENTS_SUBMENU="Events Submenu"
COM_BIGBLUEBUTTON_EVENTS_SUBMENU_DESC="Allows the users in this group to submenu of event"
COM_BIGBLUEBUTTON_EVENT_RESENT_EMAIL_BUTTON_ACCESS="event Resent Email Button Access"
COM_BIGBLUEBUTTON_EVENT_RESENT_EMAIL_BUTTON_ACCESS_DESC=" Allows the users in this group to access the resent email button."
COM_BIGBLUEBUTTON_EXPORT_DATA="Export Data"
COM_BIGBLUEBUTTON_EXPORT_DATA_DESC=" Allows users in this group to export data."
COM_BIGBLUEBUTTON_IMPORT_DATA="Import Data"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
'event_title',
'alias',
'event_des',
'emails',
'send_invitation_email',
'event_start',
'event_end',
'timezone',
Expand Down
21 changes: 21 additions & 0 deletions packages/com_bigbluebutton/admin/models/event.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,27 @@ public function getTable($type = 'event', $prefix = 'BigbluebuttonTable', $confi
{
return JTable::getInstance($type, $prefix, $config);
}


/**
* Method to send emails.
*
* @param integer .
*
*/
function reSendEmail($id){
if(!class_exists('BBBManageClass')){
require_once JPATH_COMPONENT_ADMINISTRATOR."/helpers/bbbManageClass.php";
}
$class = new BBBManageClass();
$item = $this->getItem($id);
$class->sendInvitationEmails($item);
//JText::_('COM_BIGBLUEBUTTON_ATTENDEE_INVITATION_EMAIL_SUBJECT');
//JText::_('COM_BIGBLUEBUTTON_ATTENDEE_INVITATION_EMAIL_BODY');
//JText::_('COM_BIGBLUEBUTTON_ATTENDEE_INVITATION_EMAIL_SUCCESS');
//JText::_('COM_BIGBLUEBUTTON_ATTENDEE_INVITATION_EMAIL_FAILURE');
}


/**
* Method to get a single record.
Expand Down
4 changes: 4 additions & 0 deletions packages/com_bigbluebutton/admin/models/events.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ public function __construct($config = array())

parent::__construct($config);
}

function reSendEmail(){
//
}

/**
* Method to auto-populate the model state.
Expand Down
17 changes: 17 additions & 0 deletions packages/com_bigbluebutton/admin/models/forms/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ jQuery(document).ready(function()
{
var timezone_vvvvvvx = jQuery("#jform_timezone input[type='radio']:checked").val();
vvvvvvx(timezone_vvvvvvx);

var emails_vvvvvvy = jQuery("#jform_emails").val();
vvvvvvy(emails_vvvvvvy);
});

// the vvvvvvx function
Expand All @@ -29,6 +32,20 @@ function vvvvvvx(timezone_vvvvvvx)
}
}

// the vvvvvvy function
function vvvvvvy(emails_vvvvvvy)
{
// set the function logic
if (emails_vvvvvvy.length >= 5)
{
jQuery('#jform_send_invitation_email').closest('.control-group').show();
}
else
{
jQuery('#jform_send_invitation_email').closest('.control-group').hide();
}
}

// the isSet function
function isSet(val)
{
Expand Down
Loading

0 comments on commit 886c0c8

Please sign in to comment.