Skip to content

Commit

Permalink
Merge pull request techjoomla#46 from techjoomla/master
Browse files Browse the repository at this point in the history
Merge master into release-1.1.0
  • Loading branch information
manojLondhe authored Jun 14, 2019
2 parents b242b58 + 3198cda commit d2e2d03
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 79 deletions.
35 changes: 17 additions & 18 deletions src/com_tjnotifications/admin/models/notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ protected function getListQuery()
}
}

// Fot getting templates
// For getting templates
if (!empty($client) && !empty($key))
{
$query->where($db->quoteName('client') . ' = ' . $db->quote($client) . ' AND ' . $db->quoteName('key') . ' = ' . $db->quote($key));
Expand All @@ -110,37 +110,36 @@ protected function getListQuery()
/**
* Method to get the record form.
*
* @param array $client An optional array of data for the form to interogate.
* @param array $key True if the form is to load its own data (default case), false if not.
* @param String $client An optional array of data for the form to interogate.
* @param String $key True if the form is to load its own data (default case), false if not.
*
* @return JForm A JForm object on success, false on failure
*
* @since 1.6
*/
public function getTemplate($client,$key)
public function getTemplate($client, $key)
{
$this->setState('filter.client', $client);
$object = clone $this;

$this->setState('filter.key', $key);
$this->setState('filter.client', $client);

// Explode the key at #. e.g : donate#vendor1#store1
$key_parts = explode('#', $key);
// Return exact template according key and client
$templates = $this->getItems();

// If $key_parts[1] i.e vendor1 is set means overrided then it will return latest template. i.e donate#vendor1#store1
if (isset($key_parts[1]))
// If templates object is empty and key contain # then check for default (fallback) template.
if (empty($templates) && strpos($key, '#'))
{
// Get index of latest template.
$latest = sizeof($templates) - 1;
$template = $templates[$latest];
// Regex for removing last part of the string
// Eg if input string is global#vendor#course then the output is global#vendor

return $template;
}
else
{
// If template is not overrided then return original template e.g: donate
$key = preg_replace('/#[^#]*$/', '', $key);

return $templates[0];
// Call function recursively with modified key
return $object->getTemplate($client, $key);
}

return $templates[0];
}

/**
Expand Down
49 changes: 0 additions & 49 deletions src/com_tjnotifications/admin/tjnotifications.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ class Com_TjnotificationsInstallerScript
),
);

/** @var array Obsolete files and folders to remove*/
private $removeFilesAndFolders = array(
'files' => array(
),
'folders' => array(
)
);

/**
* method to install the component
*
Expand Down Expand Up @@ -194,6 +202,8 @@ public function postflight($type, $parent)

// Install SQL FIles
$this->installSqlFiles($parent);

$this->removeObsoleteFilesAndFolders($this->removeFilesAndFolders);
}

/**
Expand Down Expand Up @@ -355,7 +365,7 @@ public function fixMenuLinks()
$db = JFactory::getDbo();
$link = 'index.php?option=com_tjnotifications&view=notifications&extension=com_jticketing';
$link1 = 'index.php?option=com_tjnotifications&extension=com_tjvendors';
$allLinks = '"' . $link . '","'. $link1 . '"';
$allLinks = '"' . $link . '","' . $link1 . '"';

// Delete the mainmenu from menu table
$deleteMenu = $db->getQuery(true);
Expand All @@ -365,4 +375,44 @@ public function fixMenuLinks()
$db->setQuery($deleteMenu);
$db->execute();
}

/**
* Removes obsolete files and folders
*
* @param array $removeFilesAndFolders Array of the files and folders to be removed
*
* @return void
*
* @since 1.0.3
*/
private function removeObsoleteFilesAndFolders($removeFilesAndFolders)
{
// Remove files
if (!empty($removeFilesAndFolders['files']))
{
foreach ($removeFilesAndFolders['files'] as $file)
{
$f = JPATH_ROOT . '/' . $file;

if (JFile::exists($f))
{
JFile::delete($f);
}
}
}

// Remove folders
if (!empty($removeFilesAndFolders['folders']))
{
foreach ($removeFilesAndFolders['folders'] as $folder)
{
$f = JPATH_ROOT . '/' . $folder;

if (JFolder::exists($f))
{
JFolder::delete($f);
}
}
}
}
}
10 changes: 5 additions & 5 deletions src/com_tjnotifications/tjnotifications.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<author>Techjoomla</author>
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://techjoomla.com</authorUrl>
<copyright>Copyright (C) 2016 - 2018 Techjoomla. All rights reserved.</copyright>
<copyright>Copyright (C) 2016 - 2019 Techjoomla. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<creationDate>16th Nov 2018</creationDate>
<version>1.0.2</version>
<creationDate>7th Feb 2019</creationDate>
<version>1.0.3</version>
<install>
<sql>
<file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file>
Expand All @@ -28,7 +28,7 @@
<folder>controllers</folder>
</files>
<languages folder="site/language">
<language tag="en-GB">en-GB.com_tjnotification.ini</language>
<language tag="en-GB">en-GB.com_tjnotifications.ini</language>
</languages>
<administration>
<menu>com_tjnotifications</menu>
Expand All @@ -49,5 +49,5 @@
<language tag="en-GB">en-GB.com_tjnotifications.sys.ini</language>
</languages>
</administration>
<scriptfile>install.tjnotification.php</scriptfile>
<scriptfile>install.tjnotifications.php</scriptfile>
</extension>
6 changes: 3 additions & 3 deletions src/plugins/actionlog/tjnotification/tjnotification.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<extension version="3.9" type="plugin" group="actionlog" method="upgrade">
<name>plg_actionlog_tjnotification</name>
<author>Techjoomla</author>
<creationDate>16th Nov 2018</creationDate>
<copyright>Copyright (C) 2016 - 2018 Techjoomla. All rights reserved.</copyright>
<creationDate>7th Feb 2019</creationDate>
<copyright>Copyright (C) 2016 - 2019 Techjoomla. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://techjoomla.com</authorUrl>
<version>1.0.2</version>
<version>1.0.3</version>
<description>PLG_ACTIONLOG_TJNOTIFICATION_XML_DESCRIPTION</description>
<files>
<filename plugin="tjnotification">tjnotification.php</filename>
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/privacy/tjnotification/tjnotification.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.9" type="plugin" group="privacy" method="upgrade">
<name>plg_privacy_tjnotification</name>
<version>1.0.2</version>
<creationDate>16th Nov 2018</creationDate>
<version>1.0.3</version>
<creationDate>7th Feb 2019</creationDate>
<author>Techjoomla</author>
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://techjoomla.com</authorUrl>
<copyright>Copyright (C) 2016 - 2018 Techjoomla. All rights reserved.</copyright>
<copyright>Copyright (C) 2016 - 2019 Techjoomla. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<description>PLG_PRIVACY_TJNOTIFICATION_XML_DESCRIPTION</description>
<files>
Expand Down

0 comments on commit d2e2d03

Please sign in to comment.