Skip to content

Commit

Permalink
Messenger: restored SMS credit balance to New Message screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Ross Parker committed Aug 31, 2023
1 parent 4c9cfad commit b105a56
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ v26.0.00
Markbook: adjusted Term filter in teacher view to default to current term
Messenger: updated message copies sent to sender to include an example confirm link
Messenger: added a setting to customise the signature used in messages
Messenger: restored SMS credit balance to New Message screen
Reports: added a filter to view Pending Edits on Proof Read page, pre-selected filter in notifications
Reports: added the name of who wrote the comment to CourseCriteria data source
Rubrics: updated visualize and historical data views so teachers can see unpublished results
Expand Down
16 changes: 12 additions & 4 deletions modules/Messenger/src/Forms/MessageForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@

namespace Gibbon\Module\Messenger\Forms;

use Gibbon\View\View;
use Gibbon\Forms\Form;
use Gibbon\Services\Format;
use Gibbon\Contracts\Services\Session;
use Gibbon\Contracts\Database\Connection;
use Gibbon\Contracts\Comms\SMS;
use Gibbon\Domain\User\RoleGateway;
use Gibbon\Contracts\Services\Session;
use Gibbon\Domain\System\SettingGateway;
use Gibbon\Contracts\Database\Connection;
use Gibbon\Domain\Messenger\MessengerGateway;
use Gibbon\Domain\Messenger\CannedResponseGateway;
use Gibbon\View\View;

/**
* MessageForm
Expand All @@ -40,6 +41,7 @@ class MessageForm extends Form
protected $session;
protected $db;
protected $messengerGateway;
protected $sms;
protected $cannedResponseGateway;
protected $settingGateway;
protected $roleGateway;
Expand All @@ -50,11 +52,12 @@ class MessageForm extends Form
protected $signatureTemplate;
protected $view;

public function __construct(Session $session, Connection $db, MessengerGateway $messengerGateway, CannedResponseGateway $cannedResponseGateway, SettingGateway $settingGateway, RoleGateway $roleGateway, View $view)
public function __construct(Session $session, Connection $db, MessengerGateway $messengerGateway, SMS $smsGateway, CannedResponseGateway $cannedResponseGateway, SettingGateway $settingGateway, RoleGateway $roleGateway, View $view)
{
$this->session = $session;
$this->db = $db;
$this->messengerGateway = $messengerGateway;
$this->smsGateway = $smsGateway;
$this->cannedResponseGateway = $cannedResponseGateway;
$this->settingGateway = $settingGateway;
$this->roleGateway = $roleGateway;
Expand Down Expand Up @@ -163,6 +166,11 @@ public function createForm($action, $gibbonMessengerID = null)
} else {
$row->addYesNoRadio('sms')->checked('N')->required();

if ($smsCredits = $this->smsGateway->getCreditBalance()) {
$row = $form->addRow()->addClass('sms');
$row->addAlert("<b>" . sprintf(__('Current balance: %1$s credit(s).'), $smsCredits) . "</u></b>", 'message');
}

$this->getSMSSignatureJS($signature);
}
}
Expand Down

0 comments on commit b105a56

Please sign in to comment.