@copyright Copyright (C) 2015. All Rights Reserved @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html Support Groups /-----------------------------------------------------------------------------------------------------------------------------*/ // No direct access to this file defined('_JEXEC') or die('Restricted access'); use Joomla\Utilities\ArrayHelper; /** * Supportgroups Ajax Model */ class SupportgroupsModelAjax extends JModelList { protected $app_params; public function __construct() { parent::__construct(); // get params $this->app_params = JComponentHelper::getParams('com_supportgroups'); } // Used in support_group /** * Check and if a vdm notice is new (per/user) **/ public function isNew($notice) { // first get the file path $path_filename = SupportgroupsHelper::getFilePath('path', 'usernotice', 'md', JFactory::getUser()->username, JPATH_COMPONENT_ADMINISTRATOR); // check if the file is set if (($content = @file_get_contents($path_filename)) !== FALSE) { if ($notice == $content) { return false; } } return true; } /** * set That a notice has been read (per/user) **/ public function isRead($notice) { // first get the file path $path_filename = SupportgroupsHelper::getFilePath('path', 'usernotice', 'md', JFactory::getUser()->username, JPATH_COMPONENT_ADMINISTRATOR); // set as read if not already set if (($content = @file_get_contents($path_filename)) !== FALSE) { if ($notice == $content) { return true; } } return $this->saveFile($notice,$path_filename); } protected function saveFile($data,$path_filename) { if (SupportgroupsHelper::checkString($data)) { $fp = fopen($path_filename, 'w'); fwrite($fp, $data); fclose($fp); return true; } return false; } }