Skip to content

Commit

Permalink
Merge Release 1.0.3 into Master (#87)
Browse files Browse the repository at this point in the history
* Task #165254 chore: Native Add to linkedin Button - Linkdin Education Profile certificate upload/share (#69)

* Bug #164674 fix: search box for cert-xxxx is showing error (#48)

* Bug #164625 fix: title is showing blank data, it should display course name (#49)

* Bug #164705 fix: click on the social media post the back button on the certificate is of no use (#52)

* Bug #164705 fix: click on the social media post :: the back button on the certificate is of no use

* Bug #164705 fix: Resolve comment

* Bug #164707 fix: user able to download others certificate as well (#53)

* Bug #164707 fix: user able to download others certificate as well

* Bug #164707 fix: Resolve comments

* Bug #164707 fix: Resolve comments

* Bug #164707 fix: Resolve comment

* Task #164910 chore: Button to copy shareble certificate link (#51)

* Task #164910 chore: Button to copy shareble certificate link

* Task #164910 chore: Button to copy shareble certificate link

* Task #164910 chore: Button to copy shareble certificate link

* Task #164910 chore: Resolve comment

* Task #164910 chore: Resolve comments

* Task #164910 chore: Resolve comments

* Task #164910 chore: Resolve comments

* Task #164910 chore: Resolve comments

* Task #163318 fix: Fixed image cut issue while image generation (#54)

* Issue #164867 style: desing changes update (#50)

Co-authored-by: “Mangesh <“[email protected]”>

* Task #163318 fix: Added fixed width height for certificate container (#58)

* Bug165031 : Backend > Attendees > Error '0 Call to a member function getDownloadUrl() on string' occurs on checkin the attendee (#62)

Co-authored-by: Snehal Patil <[email protected]>

* Task #165230 Chore: Back end>>Issued Certificate >> Search should also be done by username. (#59)

* Task #165122 Chore: Backend certificate view changes- Adding Course co… (#55)

* Task #165122 Chore: Backend certificate view changes- Adding Curse column at Issued certificate View

* Changing title of column

* Resolving conflicts

* Task #165122 Chore: Backend Issued certificate view changes- Adding attendee… (#56)

* Task #165122 Chore: Backend certificate view changes- Adding attendee name to the user column

* Changing title of column User

* Resolving phpcs issue

* Resolving conflicts

* Task #165166 Chore: Add Certificate Url column under Issued Certificate View (#57)

* Task #165166 Chore: Add Copy Url column under Issued Cetificate VIew

* Resolving conflicts

* Resolving comments

* Resolving comments

* Resolving comments

* Task #165166 Feat: Adding (#63)

* Bug165031 : Backend > Attendees > Error '0 Call to a member function … (#64)

* Bug165031 : Backend > Attendees > Error '0 Call to a member function …

* Bug165031 : Backend > Attendees > Error '0 Call to a member function …

Co-authored-by: Snehal Patil <[email protected]>

* Task #165259 Chore: Adding proper names to the client filter and column in Issue… (#66)

* Task #165259 Chore: Adding proper names to the client filter in Issued Certificate view

* Adding names to client column

* Task #165259 Chore: Renaming Unique Certificate Id column name to Certificate Id at both end (#67)

* Task #165259 Chore: Reordering columns of Issues Certificate View (#68)

* Task #165254 chore: Native Add to linkedin Button - Linkdin Education Profile certificate upload/share

* Task #165254 chore: Native Add to linkedin Button - Linkdin Education Profile certificate upload/share

* Task #165254 chore: Resolve comments

* Task #165254 chore: update download permission code

* Task #165254 chore: Resolve comments

* Task #165254 chore: Remove images

Co-authored-by: praneettekdi <[email protected]>
Co-authored-by: Mangesh Mane <[email protected]>
Co-authored-by: “Mangesh <“[email protected]”>
Co-authored-by: snehal patil <[email protected]>
Co-authored-by: Snehal Patil <[email protected]>
Co-authored-by: divyachaudhari <[email protected]>

* Bug #164674 fix: search box for cert-xxxx is showing error (#73)

* Bug #164674 fix: search box for cert-xxxx is showing error

* Bug #164674 fix: Resolve comments

* Bug #164674 fix: Resolve commenys

* Task #165166 Chore: Adding SEF url to the certificate copy Url functi… (#72)

* Bug #164674 fix: search box for cert-xxxx is showing error (#48)

* Bug #164625 fix: title is showing blank data, it should display course name (#49)

* Bug #164705 fix: click on the social media post the back button on the certificate is of no use (#52)

* Bug #164705 fix: click on the social media post :: the back button on the certificate is of no use

* Bug #164705 fix: Resolve comment

* Bug #164707 fix: user able to download others certificate as well (#53)

* Bug #164707 fix: user able to download others certificate as well

* Bug #164707 fix: Resolve comments

* Bug #164707 fix: Resolve comments

* Bug #164707 fix: Resolve comment

* Task #164910 chore: Button to copy shareble certificate link (#51)

* Task #164910 chore: Button to copy shareble certificate link

* Task #164910 chore: Button to copy shareble certificate link

* Task #164910 chore: Button to copy shareble certificate link

* Task #164910 chore: Resolve comment

* Task #164910 chore: Resolve comments

* Task #164910 chore: Resolve comments

* Task #164910 chore: Resolve comments

* Task #164910 chore: Resolve comments

* Task #163318 fix: Fixed image cut issue while image generation (#54)

* Issue #164867 style: desing changes update (#50)

Co-authored-by: “Mangesh <“[email protected]”>

* Task #163318 fix: Added fixed width height for certificate container (#58)

* Bug165031 : Backend > Attendees > Error '0 Call to a member function getDownloadUrl() on string' occurs on checkin the attendee (#62)

Co-authored-by: Snehal Patil <[email protected]>

* Task #165230 Chore: Back end>>Issued Certificate >> Search should also be done by username. (#59)

* Task #165122 Chore: Backend certificate view changes- Adding Course co… (#55)

* Task #165122 Chore: Backend certificate view changes- Adding Curse column at Issued certificate View

* Changing title of column

* Resolving conflicts

* Task #165122 Chore: Backend Issued certificate view changes- Adding attendee… (#56)

* Task #165122 Chore: Backend certificate view changes- Adding attendee name to the user column

* Changing title of column User

* Resolving phpcs issue

* Resolving conflicts

* Task #165166 Chore: Add Certificate Url column under Issued Certificate View (#57)

* Task #165166 Chore: Add Copy Url column under Issued Cetificate VIew

* Resolving conflicts

* Resolving comments

* Resolving comments

* Resolving comments

* Task #165166 Feat: Adding (#63)

* Bug165031 : Backend > Attendees > Error '0 Call to a member function … (#64)

* Bug165031 : Backend > Attendees > Error '0 Call to a member function …

* Bug165031 : Backend > Attendees > Error '0 Call to a member function …

Co-authored-by: Snehal Patil <[email protected]>

* Task #165259 Chore: Adding proper names to the client filter and column in Issue… (#66)

* Task #165259 Chore: Adding proper names to the client filter in Issued Certificate view

* Adding names to client column

* Task #165259 Chore: Renaming Unique Certificate Id column name to Certificate Id at both end (#67)

* Task #165166 Chore: Adding SEF url to the certificate copy Url functioning

* Changing the routing of getUrl()

* Changing the routing of getUrl()

* Changing the routing of getUrl()

Co-authored-by: Tushar Shekokar <[email protected]>
Co-authored-by: praneettekdi <[email protected]>
Co-authored-by: Mangesh Mane <[email protected]>
Co-authored-by: “Mangesh <“[email protected]”>
Co-authored-by: snehal patil <[email protected]>
Co-authored-by: Snehal Patil <[email protected]>

* Task #165166 Chore: Adding SEF url to the certificate copy Url functioning (#74)

* Bug #163318 fix: Fixed image generation issue in smaller devices (#75)

* Issue #166260 fix: Render default template issue when a different editor is used other than tinyMCE & CodeMirror (#78)

* Merge Release 1.0.4 into Release 1.0.3 (#79)

* Task #165032 chore: Changes in TjCertificate Issued Certificate list view to allow admin to edit Issued Certificates (#76)

* Task #165032 chore: Changes in TjCertificate Issued Certificate list view to allow admin to edit Issued Certificate

* Task #165032 chore: Changes in TjCertificate Issued Certificate list view to allow admin to edit Issued Certificates

* Task #165032 chore: Backend list view changes

* Task #165032 chore: Resolve comments

* Task #165032 chore: Resolve comments

* Task #165032 chore: Resolve comments

* Task #165032 chore: Resolve comments

* Feature #165030 chore: Changes for certificate re-generate feature (#77)

* Feature #165030 chore: Changes for certificate re-generate feature

* Feature #165030 chore: Resolve comments

* Task #166208 chore: Tj certificate list view changes

* Feature #165030 chore: Delete certificate image

* Feature #165030 chore: Changes for certificate re-generate feature

* Update view.html.php

Co-authored-by: Tushar Shekokar <[email protected]>

* Task #165032 chore: Resolve conflicts and update folder in xml (#80)

* Task #165032 chore: Changes in TjCertificate Issued Certificate list view to allow admin to edit Issued Certificates (#76)

* Task #165032 chore: Changes in TjCertificate Issued Certificate list view to allow admin to edit Issued Certificate

* Task #165032 chore: Changes in TjCertificate Issued Certificate list view to allow admin to edit Issued Certificates

* Task #165032 chore: Backend list view changes

* Task #165032 chore: Resolve comments

* Task #165032 chore: Resolve comments

* Task #165032 chore: Resolve comments

* Task #165032 chore: Resolve comments

* Feature #165030 chore: Changes for certificate re-generate feature (#77)

* Feature #165030 chore: Changes for certificate re-generate feature

* Feature #165030 chore: Resolve comments

* Task #166208 chore: Tj certificate list view changes

* Feature #165030 chore: Delete certificate image

* Feature #165030 chore: Changes for certificate re-generate feature

* Update view.html.php

* Task #165032 chore: Resolve conflicts

* Task #165032 chore: Add version in XML

* Task #165032 chore: Resolve comments

* Task #165032 chore: Resolve scrutinizer issue

Co-authored-by: praneettekdi <[email protected]>

* Issue #166434 task: Server side certificate image generation using Imagick (#81)

* Issue #166434 task: Server side certificate image generation using Imagick

* Issue #166434 task: Server side certificate image generation using Imagick

* Issue #166434 task: Server side certificate image generation using Imagick

* Issue #166434 task: Server side certificate image generation using Imagick

* Issue #166434 task: Server side certificate image generation using Imagick

* Issue #166434 task: Server side certificate image generation using Imagick

* Issue #166434 task: Server side certificate image generation using Imagick

* Update default.php

Make sure Canvas image generation works even if the global config values are not saved

* Feature #166428 chore: Add external record and integrate tjnotification (#82)

* Feature #166428 chore: Add external record and integrate tjnotification

* Feature #166428 chore: Resolve comments

* Feature #166428 chore: Resolve comments

* Feature #166428 chore: Resolve comments

* Feature #166428 chore: Resolve comments

* Feature #166428 chore: Resolve comments

* Feature #166428 chore: Resolve comments

* Feature #166428 chore: Resolve comments

* Feature #166428 chore: Resolve comments

* Feature #166428 chore: Resolve comments

* Feature #166428 chore: Resolve comments

* Feature #166428 chore: Update file and class name

* Feature #166428 chore: Resolve comments

* Feature #166428 chore: Resolve comments

* Feature #166428 chore: Backend functionality for add training records

* Feature #166428 chore: Backend functionality for add training records

* Feature #166428 chore: Backend functionality for add training records

* Feature #166428 chore: Backend functionality for add training records

* Feature #166428 chore: Resolve comments

* Feature #166428 chore: Resolve comments

* Feature #166428 chore: Update sql file version

* Feature #166428 chore: Update js

* Feature #166428 chore: Update js

* Feature #166428 chore: Update changes after UT (#83)

* Feature #166428 chore: Add external record and integrate tjnotification

* Feature #166428 chore: Resolve comments

* Feature #166428 chore: Resolve comments

* Feature #166428 chore: Resolve comments

* Feature #166428 chore: Resolve comments

* Feature #166428 chore: Resolve comments

* Feature #166428 chore: Resolve comments

* Feature #166428 chore: Resolve comments

* Feature #166428 chore: Resolve comments

* Feature #166428 chore: Resolve comments

* Feature #166428 chore: Resolve comments

* Feature #166428 chore: Update file and class name

* Feature #166428 chore: Resolve comments

* Feature #166428 chore: Resolve comments

* Feature #166428 chore: Backend functionality for add training records

* Feature #166428 chore: Backend functionality for add training records

* Feature #166428 chore: Backend functionality for add training records

* Feature #166428 chore: Backend functionality for add training records

* Feature #166428 chore: Resolve comments

* Feature #166428 chore: Resolve comments

* Feature #166428 chore: Update sql file version

* Feature #166428 chore: Update js

* Feature #166428 chore: Update js

* Feature #166428 chore: Update changes after UT

* Feature #166428 chore: Load fontawesome css on init

* Feature #166428 chore :Fix Bug #167401 and Bug #167402 (#84)

* Bug #167400 fix: Redirect on list view on after action 'Save & Close' in backend  (#85)

* Feature #166428 chore :Fix Bug #167401 and Bug #167402

* Bug #167400 fix: Redirect on list view on after action 'Save & Close' in backend

* Bug #167400 fix: Resolve comment

Co-authored-by: Tushar Shekokar <[email protected]>
Co-authored-by: Mangesh Mane <[email protected]>
Co-authored-by: “Mangesh <“[email protected]”>
Co-authored-by: snehal patil <[email protected]>
Co-authored-by: Snehal Patil <[email protected]>
Co-authored-by: divyachaudhari <[email protected]>
  • Loading branch information
7 people authored Jan 15, 2021
1 parent 2aa9fe0 commit 9b4c33c
Show file tree
Hide file tree
Showing 70 changed files with 3,993 additions and 192 deletions.
3 changes: 3 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,8 @@
<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.manageown" title="COM_TJCERTIFICATE_PERMISSION_MANAGEOWN_EXTERNAL_CERTIFICATE" description="COM_TJCERTIFICATE_PERMISSION_MANAGEOWN_EXTERNAL_CERTIFICATE_DESC" />
</section>
</access>
39 changes: 37 additions & 2 deletions src/components/com_tjcertificate/administrator/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,19 @@
<option value="1">JYES</option>
<option value="0">JNo</option>
</field>
</fieldset>
<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" />
</fieldset>

<!-- Social sharing -->
<fieldset name="social_sharing" label="COM_TJCERTIFICATE_SOCIAL_SHARING_SETINGS">
Expand All @@ -50,7 +62,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 +81,21 @@
-->
</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>

<!-- 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
Expand Up @@ -24,6 +24,48 @@
*/
class TjCertificateControllerCertificate extends FormController
{
/**
* The client for which the templates are being created.
*
* @var string
* @since __DEPLOY_VERSION__
*/
protected $client;

/**
* The extension for which the templates are being created.
*
* @var string
* @since __DEPLOY_VERSION__
*/
protected $extension;

/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
*
* @since __DEPLOY_VERSION__
* @see JControllerLegacy
*/
public function __construct($config = array())
{
parent::__construct($config);

$app = Factory::getApplication();
$jinput = $app->input;

if (empty($this->extension))
{
$this->extension = $jinput->get('extension', '');
}

if (empty($this->client))
{
$this->client = $jinput->get('client', '');
}
}

/**
* Method to download issued certificate.
*
Expand All @@ -48,15 +90,22 @@ public function download()

$certificate = TJCERT::Certificate();

$certificateObj = $certificate::validateCertificate($uniqueCertificateId);

// If $uniqueCertificateId is not valid then object is empty so need to handle error (CALL TO A MEMBER FUNCTION CANDOWNLOAD() ON BOOLEAN)
if (!$certificateObj->id)
{
$app->enqueueMessage(Text::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
$app->redirect('index.php');
}

// Check user having permission to download
if (!$certificate::canDownload($uniqueCertificateId))
if (!$certificateObj->canDownload())
{
$app->enqueueMessage(Text::_('JERROR_ALERTNOAUTHOR'));
$app->redirect('index.php');
}

$certificateObj = $certificate::validateCertificate($uniqueCertificateId);

if (!$certificateObj->id)
{
$app->enqueueMessage(Text::_('COM_TJCERTIFICATE_ERROR_CERTIFICATE_EXPIRED'), 'error');
Expand Down Expand Up @@ -101,4 +150,53 @@ public function uploadCertificate()

jexit();
}

/**
* Gets the URL arguments to append to an item redirect.
*
* @param integer $recordId The primary key id for the item.
* @param string $urlVar The name of the URL variable for the id.
*
* @return string The arguments to append to the redirect URL.
*
* @since __DEPLOY_VERSION__
*/
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{
$append = parent::getRedirectToItemAppend($recordId);

if (!empty ($this->extension))
{
$append .= '&extension=' . $this->extension;
}
elseif (!empty ($this->client))
{
$append .= '&client=' . $this->client;
}

return $append;
}

/**
* Gets the URL arguments to append to a list redirect.
*
* @return string The arguments to append to the redirect URL.
*
* @since __DEPLOY_VERSION__
*/
protected function getRedirectToListAppend()
{
$append = parent::getRedirectToListAppend();

if (!empty ($this->extension))
{
$append .= '&extension=' . $this->extension;
}
elseif (!empty ($this->client))
{
$append .= '&client=' . $this->client;
}

return $append;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
defined('_JEXEC') or die('Restricted access');

use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\Utilities\ArrayHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;

/**
* Certificate list controller class.
Expand All @@ -34,4 +37,46 @@ public function getModel($name = 'Certificate', $prefix = 'TjCertificateModel')
{
return parent::getModel($name, $prefix, array('ignore_request' => true));
}

/**
* Method to remove a record.
*
* @return void
*
* @since __DEPLOY_VERSION__
*/
public function delete()
{
$this->checkToken();

// Get items to remove from the request.
$cid = $this->input->get('cid', array(), 'array');

$extension = $this->input->getCmd('extension', null);

if (!is_array($cid) || count($cid) < 1)
{
JError::raiseWarning(500, Text::_($this->text_prefix . '_NO_ITEM_SELECTED'));
}
else
{
// Get the model.
$model = $this->getModel();

// Make sure the item ids are integers
$cid = ArrayHelper::toInteger($cid);

// Remove the items.
if ($model->delete($cid))
{
$this->setMessage(Text::plural($this->text_prefix . '_N_ITEMS_DELETED', count($cid)));
}
else
{
$this->setMessage($model->getError());
}
}

$this->setRedirect(Route::_('index.php?option=com_tjcertificate&view=certificates', false));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
use Joomla\CMS\MVC\Controller\FormController;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Response\JsonResponse;
use Joomla\CMS\Session\Session;

jimport('joomla.filesystem.folder');

Expand Down Expand Up @@ -84,4 +86,34 @@ public function loadDefaultTemplate()
echo new JResponseJson($templateData);
}
}

/**
* Function to load custom template
*
* @return object|void object
*/
public function loadCustomTemplate()
{
if (!Session::checkToken('get'))
{
echo new JsonResponse(null, Text::_('JINVALID_TOKEN'), true);
}
else
{
$app = Factory::getApplication();
$input = $app->input;
$templateId = $input->get('templateId');

if (empty($templateId))
{
echo new JsonResponse(null, Text::_('COM_TJCERTIFICATE_ERROR_SOMETHING_WENT_WRONG'), true);

return;
}

$tjCertificateTemplate = TJCERT::Template($templateId);

echo new JsonResponse($tjCertificateTemplate->body);
}
}
}
Loading

0 comments on commit 9b4c33c

Please sign in to comment.