Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
9b4c33c
Merge Release 1.0.3 into Master (#87)
praneettekdi Jan 15, 2021
8c513b1
Merge Release 1.0.4 into Master (#91)
praneettekdi Jan 19, 2021
0a267a2
Merge Release 1.0.5 into Master (#97)
praneettekdi Mar 17, 2021
a97585b
Feature #168713 feat: Make Tj-certificate multi-agency aware (#96)
tushar33 Mar 24, 2021
06762bc
Feature #169747 feat: Generate QR code to validate certificate (#99)
shinderohanoffical Mar 24, 2021
205654d
Task #169750 feat: Set default value of qr code config (#100)
shinderohanoffical Mar 24, 2021
684ee5e
Task #169750 feat: Set default value of multy engancy (#101)
shinderohanoffical Mar 24, 2021
cc57b9e
Bug #169802 Fix: Backend > Issued Certificates > Add Training record …
divyachaudhari Mar 24, 2021
81e7e52
Feature #168713 feat: Don't validate agency if manage all permission …
tushar33 Mar 26, 2021
4a93740
Feature #168713 feat: Add external record delete permission (#103)
tushar33 Mar 30, 2021
8944163
Bug #168131 Fix: Backend > Issued Certificates > Warning displayed on…
divyachaudhari Apr 1, 2021
7dd7077
Bug #170717 Fix: Frontend > My Certificate > Warnings and notices dis…
divyachaudhari Apr 20, 2021
868f263
Feature #169954 chore: Add training records in bulk (#105)
tushar33 Apr 26, 2021
930a65b
Feature #169954 chore: Certificates query improvment for multiagency,…
tushar33 May 5, 2021
b24de0e
Bug #171258 fix: Issue date is not getting saved if not using current…
tushar33 May 12, 2021
4afa6c1
Task #171054 Chore: Resolving php 7.4 Notices (#110)
divyachaudhari Jun 8, 2021
4093c6c
Bug #172375 Fix: Backend > Issued Certificates > Bulk Training Record…
divyachaudhari Jun 16, 2021
98d6e6e
Bug #172375 Fix: Backend > Issued Certificates > Bulk Training Record…
divyachaudhari Jun 18, 2021
a62cb56
Bug #173454 fix: Certificate preview popup not getting hide in edit c…
Jul 19, 2021
c206a5e
Bug #173551 fix: Certificate image need to reload to fetch new data i…
praneettekdi Jul 22, 2021
8bd326d
Task #173189 Chore: PHP 8 warnings and notices fix (#116)
divyachaudhari Jul 22, 2021
41585b8
Task #173189 Chore: PHP8 notices (#117)
divyachaudhari Jul 26, 2021
3d4304c
Bug #170572 fix: Certificate template > When trying to 'Save as a Cop…
shinderohanoffical Jul 29, 2021
ff91fb1
Bug #173711 Fix: Backend > Certificate Templates > 500 error occurs o…
divyachaudhari Jul 29, 2021
ac7e152
Certificate Library issue
MeghaBiranje Aug 16, 2022
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
5 changes: 5 additions & 0 deletions src/components/com_tjcertificate/administrator/access.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,10 @@
<action name="template.edit.own" title="COM_TJCERTIFICATE_PERMISSION_TEMPLATE_EDIT_OWN_TITLE" description="COM_TJCERTIFICATE_PERMISSION_TEMPLATE_EDIT_OWN_DESC" />
<action name="certificate.download.own" title="COM_TJCERTIFICATE_PERMISSION_CERTIFICATE_DOWNLOAD_OWN" description="COM_TJCERTIFICATE_PERMISSION_CERTIFICATE_DOWNLOAD_OWN_DESC" />
<action name="certificate.download.all" title="COM_TJCERTIFICATE_PERMISSION_CERTIFICATE_DOWNLOAD_ALL" description="COM_TJCERTIFICATE_PERMISSION_CERTIFICATE_DOWNLOAD_ALL_DESC" />
<action name="certificate.external.create" title="COM_TJCERTIFICATE_PERMISSION_CREATE_EXTERNAL_CERTIFICATE" description="COM_TJCERTIFICATE_PERMISSION_CREATE_EXTERNAL_CERTIFICATE_DESC" />
<action name="certificate.external.manage" title="COM_TJCERTIFICATE_PERMISSION_MANAGE_EXTERNAL_CERTIFICATE" description="COM_TJCERTIFICATE_PERMISSION_MANAGE_EXTERNAL_CERTIFICATE_DESC" />
<action name="certificate.external.delete" title="COM_TJCERTIFICATE_PERMISSION_DELETE_EXTERNAL_CERTIFICATE" description="COM_TJCERTIFICATE_PERMISSION_DELETE_EXTERNAL_CERTIFICATE_DESC" />
<action name="certificate.external.manageown" title="COM_TJCERTIFICATE_PERMISSION_MANAGEOWN_EXTERNAL_CERTIFICATE" description="COM_TJCERTIFICATE_PERMISSION_MANAGEOWN_EXTERNAL_CERTIFICATE_DESC" />
<action name="certificate.external.deleteown" title="COM_TJCERTIFICATE_PERMISSION_DELETEOWN_EXTERNAL_CERTIFICATE" description="COM_TJCERTIFICATE_PERMISSION_DELETEOWN_EXTERNAL_CERTIFICATE_DESC" />
</section>
</access>
65 changes: 63 additions & 2 deletions src/components/com_tjcertificate/administrator/config.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<config>
<fieldset name="component" label="COM_TJCERTIFICATE_GENEARAL_SETINGS" description="" >
<fieldset name="component" label="COM_TJCERTIFICATE_GENEARAL_SETINGS" description="" addfieldpath="/media/com_tjcertificate/fields">
<field
name="certificate_prefix"
type="text"
Expand Down Expand Up @@ -37,6 +37,28 @@
<option value="1">JYES</option>
<option value="0">JNo</option>
</field>
<field name="date_format_show" class="btn-group" default="Y-m-d H:i:s" type="list" label="COM_TJCERTIFICATE_DATE_FORMAT_TO_SHOW" description="COM_TJCERTIFICATE_DATE_FORMAT_TO_SHOW_DESC">
<option value="Y-m-d H:i:s">COM_TJCERTIFICATE_DATE_FORMAT_1</option>
<option value="D, M d h:i A">COM_TJCERTIFICATE_DATE_FORMAT_2</option>
<option value="F j, Y, g:i a">COM_TJCERTIFICATE_DATE_FORMAT_3</option>
<option value="m.d.y">COM_TJCERTIFICATE_DATE_FORMAT_4</option>
<option value="j, n, Y">COM_TJCERTIFICATE_DATE_FORMAT_5</option>
<option value="h-i-s, j-m-y">COM_TJCERTIFICATE_DATE_FORMAT_6</option>
<option value="H:i:s">COM_TJCERTIFICATE_DATE_FORMAT_7</option>
<option value="custom">Custom</option>
</field>
<field name="custom_format" class="inputbox" type="text" label="COM_TJCERTIFICATE_CUSTOM_DATE_FORMAT"
showon="date_format_show:custom" description="COM_TJCERTIFICATE_CUSTOM_DATE_FORMAT_DESC" />

<field name="enable_multiagency" class="btn-group" type="radio" default="0" description="COM_TJCERTIFICATE_INTEGRATE_MULTIAGENCY_DESC" label="COM_TJCERTIFICATE_INTEGRATE_MULTIAGENCY" >
<option value="1">JYES</option>
<option value="0">JNo</option>
</field>

<field menu="hide" name="" type="legend" default="COM_TJCERTIFICATE_QR_CODE_SETTING" label="" description="" />
<field name="qr_code_width" class="validate-numeric" type="text" default="130" label="COM_TJCERTIFICATE_QR_CODE_WIDTH" description="COM_TJCERTIFICATE_QR_CODE_WIDTH_DESC" />
<field name="qr_code_height" class="validate-numeric" type="text" default="130" label="COM_TJCERTIFICATE_QR_CODE_HEIGHT" description="COM_TJCERTIFICATE_QR_CODE_HEIGHT_DESC" />
<field type="note" name="qr-code-settings-note" label="COM_TJCERTIFICATE_QR_CODE_SETTINGS_NOTE" />
</fieldset>

<!-- Social sharing -->
Expand All @@ -50,7 +72,15 @@
<option value="linkedin">COM_TJCERTIFICATE_SOCIAL_SHARING_LINKEDIN</option>
<option value="twitter">COM_TJCERTIFICATE_SOCIAL_SHARING_TWITTER</option>
</field>

<field name="linkedin_profile_btn" class="btn-group" type="radio" default="1" description="COM_TJCERTIFICATE_LINKEDIN_PROFILE_BTN_DESC" label="COM_TJCERTIFICATE_LINKEDIN_PROFILE_BTN" >
<option value="1">JYES</option>
<option value="0">JNo</option>
</field>
<field name="organization_info" class="btn-group" type="radio" default="organizationName" label="COM_TJCERTIFICATE_LINKEDIN_ORGANIZATION_INFO" description="COM_TJCERTIFICATE_LINKEDIN_ORGANIZATION_INFO_DESC" showon="linkedin_profile_btn:1">
<option value="organizationName">COM_TJCERTIFICATE_LINKEDIN_ORGANIZATION_NAME</option>
<option value="organizationId">COM_TJCERTIFICATE_LINKEDIN_ORGANIZATION_ID</option>
</field>
<field name="organization_id_name" type="text" label="COM_TJCERTIFICATE_LINKEDIN_ORGANIZATION_ID_NAME" showon="linkedin_profile_btn:1" description="COM_TJCERTIFICATE_LINKEDIN_ORGANIZATION_ID_NAME_DESC" />
<!--
<field name="social_sharing_type" class="btn-group" type="radio" default="native" label="COM_TJCERTIFICATE_SOCIAL_SHARING_TYPE" description="COM_TJCERTIFICATE_SOCIAL_SHARING_TYPE_DESC" >
<option value="addthis">COM_TJCERTIFICATE_ADDTHIS_SOCIAL</option>
Expand All @@ -61,6 +91,37 @@
-->
</fieldset>

<!-- Media setting -->
<fieldset name="media_sets" label="COM_TJCERTIFICATE_MEDIA_SETS" description="">
<field name="upload_maxsize" type="text" default="10" label="COM_TJCERTIFICATE_UPLOAD_MAX_SIZE" description="COM_TJCERTIFICATE_UPLOAD_MAX_SIZE_DESC" />
<field name="upload_extensions" type="text" cols="60" rows="5" default="image/jpeg,image/jpg,image/png,application/pdf" label="COM_TJCERTIFICATE_LEGAL_EXTENSION" description="COM_TJCERTIFICATE_LEGAL_EXTENSION_DESC" />
</fieldset>

<fieldset name="certificate_image_generation" label="COM_TJCERTIFICATE_IMAGE_GENERATION">
<field type="note" id="tjcert-certificate-image-settings" name="tjcert-certificate-image-settings" label="COM_TJCERTIFICATE_IMAGE_GENERATION_SETTINGS" />
<field name="cert_image_gen_type" class="btn-group" type="radio" default="canvas" label="COM_TJCERTIFICATE_IMAGE_GENERATION_TYPE" description="COM_TJCERTIFICATE_IMAGE_GENERATION_TYPE_DESC" >
<option value="canvas">COM_TJCERTIFICATE_IMAGE_GENERATION_TYPE_CANVAS</option>
<option value="imagick">COM_TJCERTIFICATE_IMAGE_GENERATION_TYPE_IMAGICK</option>
</field>
<field type="note" id="tjcert-certificate-image-settings-note" name="tjcert-certificate-image-settings-note" label="COM_TJCERTIFICATE_IMAGE_GENERATION_SETTINGS_NOTE" showon="cert_image_gen_type:imagick" />
</fieldset>

<!-- Bulk record setting -->
<fieldset name="bulk_record" label="COM_TJCERTIFICATE_BULK_RECORD_SETTINGS">
<field
name="users_select_limit"
type="text"
default="40"
label="COM_TJCERTIFICATE_RECORDS_USER_SELECT_LIMIT"
description="COM_TJCERTIFICATE_RECORDS_USER_SELECT_LIMIT_DESC"
/>
<field name="tjqueue_records" class="btn-group" type="radio" default="0" description="COM_TJCERTIFICATE_TJQUEUE_SETTING_DESC" label="COM_TJCERTIFICATE_TJQUEUE_SETTING" >
<option value="1">JYES</option>
<option value="0">JNo</option>
</field>
<field type="note" label="COM_TJCERTIFICATE_BULK_RECORD_SETTINGS_NOTE" showon="tjqueue_records:1" />
</fieldset>

<!-- Permission setting -->
<fieldset name="permissions" label="JCONFIG_PERMISSIONS_LABEL" description="JCONFIG_PERMISSIONS_DESC">
<field name="rules" type="rules" label="JCONFIG_PERMISSIONS_LABEL" class="inputbox" validate="rules" filter="rules" component="com_tjcertificate" section="component" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?php
/**
* @package TJCertificate
* @subpackage com_tjcertificate
*
* @author Techjoomla <extensions@techjoomla.com>
* @copyright Copyright (C) 2009 - 2021 Techjoomla. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\FormController;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Response\JsonResponse;
use Joomla\CMS\HTML\HTMLHelper;

/**
* The Tj Certificate Agency controller
*
* @since __DEPLOY_VERSION__
*/
class TjCertificateControllerAgency extends FormController
{
protected $comMultiAgency = 'com_multiagency';

/**
* Function to get agency users
*
* @return void|boolean
*
* @since __DEPLOY_VERSION__
*/
public function getAgencyUsers()
{
$app = Factory::getApplication();

if (!Session::checkToken())
{
$app->enqueueMessage(Text::_('JINVALID_TOKEN'), 'error');
echo new JsonResponse(null, null, true);
$app->close();
}

// Get the current user id
$user = Factory::getuser();

if (!$user->id)
{
return false;
}

if (!$user->authorise('core.manage.own.agency.user', $this->comMultiAgency))
{
return false;
}

$agencyId = $app->input->get('agency_id', 0, 'INT');

$model = $this->getModel();

if ($agencyId)
{
if (!$model->validateUserAgency($agencyId))
{
$app->enqueueMessage(Text::_('COM_TJCERTIFICATE_INVALID_ORGANIZATION'), 'error');
echo new JsonResponse(null, null, true);
$app->close();
}
}

$userOptions = array();

// Initialize array to store dropdown options
$userOptions[] = HTMLHelper::_('select.option', "", Text::_('COM_TJCERTIFICATE_AGENCY_USER_SELECT'));

$users = $model->getUsers($agencyId);

if (!empty($users))
{
foreach ($users as $user)
{
$userOptions[] = HTMLHelper::_('select.option', $user->id, trim($user->name));
}
}

echo new JsonResponse($userOptions);
$app->close();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
<?php
/**
* @package TJCertificate
* @subpackage com_tjcertificate
*
* @author Techjoomla <extensions@techjoomla.com>
* @copyright Copyright (C) 2009 - 2021 Techjoomla. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\Controller\FormController;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Response\JsonResponse;
use Joomla\CMS\Component\ComponentHelper;

/**
* The Tj Certificate Training Records controller
*
* @since __DEPLOY_VERSION__
*/
class TjCertificateControllerBulkTrainingRecord extends FormController
{
protected $comMultiAgency = 'com_multiagency';

/**
* Function to save multiple records
*
* @param string $key The name of the primary key of the URL variable.
*
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
*
* @return void
*
* @since __DEPLOY_VERSION__
*/
public function save($key = null, $urlVar = null)
{
$app = Factory::getApplication();

if (!Session::checkToken())
{
$app->enqueueMessage(Text::_('JINVALID_TOKEN'), 'error');
echo new JsonResponse(null, null, true);
$app->close();
}

$user = Factory::getUser();
$data = $app->input->post->get('jform', array(), 'array');

$model = $this->getModel();

// Validate the posted data.
$form = $model->getForm($data, false);
$data = $model->validate($form, $data);

if ($data == false)
{
$errors = $model->getErrors();

if (!empty($errors))
{
$msg = array();

// Push up to three validation messages out to the user.
for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++)
{
if ($errors[$i] instanceof Exception)
{
$msg[] = $errors[$i]->getMessage();
}
else
{
$msg[] = $errors[$i];
}
}

$errormsg = implode("<br>", $msg);
echo new JsonResponse(0, $errormsg, true);
}
}
else
{
$params = ComponentHelper::getParams('com_tjcertificate');
$userIds = $data['assigned_user_id'];
$data['client'] = "external";
$data['is_external'] = 1;

unset($data['assigned_user_id']);

foreach ($userIds as $userId)
{
if (ComponentHelper::isEnabled($this->comMultiAgency) && $params->get('enable_multiagency'))
{
$manageOwn = $user->authorise('core.manage.own.agency.user', $this->comMultiAgency);
$manage = $user->authorise('core.manage.all.agency.user', $this->comMultiAgency);

if ($manageOwn && empty($manage))
{
$agencyModel = TJCERT::model('Agency', array('ignore_request' => true));

// Get agencies of logged-in user and assigned user
$assignedUserAgencies = $agencyModel->getUserAgencies($userId);
$loggedInUserAgencies = $agencyModel->getUserAgencies($user->id);

$result = array();

if (!empty($assignedUserAgencies && $loggedInUserAgencies))
{
// Convert object to array
$assignedUserAgencyArr = array_column($assignedUserAgencies, 'id');
$loggedInUserAgencyArr = array_column($loggedInUserAgencies, 'id');

// Compare both users agencies
$result = array_intersect($loggedInUserAgencyArr, $assignedUserAgencyArr);
}

if (empty($result))
{
continue;
}
}
}

$data['user_id'] = $userId;
$returnData = array();

if (ComponentHelper::isEnabled('com_tjqueue') && $params->get('tjqueue_records'))
{
$recordsModel = TJCERT::model('BulkTrainingRecord', array('ignore_request' => true));
$response = $recordsModel->addToQueue($data);
$msg = $response ? Text::_("COM_TJCERTIFICATE_RECORDS_ADDED_TO_QUEUE_SUCCESSFULLY") : Text::_("COM_TJCERTIFICATE_RECORDS_FAILED");
$returnData['msg'] = $msg;
}
else
{
$certificateModel = TJCERT::model('Certificate', array('ignore_request' => true));
$certificateModel->save($data);
$certificateIds[] = $certificateModel->getState('certificate.id');

if ($certificateIds)
{
$returnData['msg'] = Text::sprintf('COM_TJCERTIFICATE_TOTAL_RECORDS_ADDED', count($certificateIds));
}
}
}

echo new JsonResponse($returnData);
$app->close();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
/**
* @package TJCertificate
* @subpackage com_tjcertificate
*
* @author Techjoomla <extensions@techjoomla.com>
* @copyright Copyright (C) 2009 - 2021 Techjoomla. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

use Joomla\CMS\MVC\Controller\FormController;

/**
* The Tj Certificate Training Records controller
*
* @since __DEPLOY_VERSION__
*/
class TjCertificateControllerBulkTrainingRecord extends FormController
{
}
Loading