Spade
Mini Shell
| Directory:~$ /home/lmsyaran/www/administrator/components/com_invoices/views/contacts/ |
| [Home] [System Details] [Kill Me] |
<?php
/*------------------------------------------------------------------------
# com_invoices - Invoice Manager for Joomla
# ------------------------------------------------------------------------
# author Germinal Camps
# copyright Copyright (C) 2012 - 2016 JoomlaThat.com. All Rights
Reserved.
# @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.joomlathat.com
# Technical Support: Forum - http://www.joomlathat.com/support
-------------------------------------------------------------------------*/
//no direct access
defined('_JEXEC') or die('Restricted access.');
jimport( 'joomla.application.component.view' );
class ContactsViewContacts extends JViewLegacy
{
protected $input;
function __construct()
{
parent::__construct();
$mainframe = JFactory::getApplication();
$this->input = $mainframe->input;
}
function display($tpl = null)
{
JToolbarHelper::title( JText::_( 'CONTACT_MANAGER' ),
'contacts' );
JToolbarHelper::addNew();
JToolbarHelper::deleteList(JText::_( 'SURE_CONTACTS' ));
JToolbarHelper::preferences( 'com_invoices' , '500',
'700');
InvoicesHelper::addSubmenu('contacts');
$this->sidebar = JHtmlSidebar::render();
$document = JFactory::getDocument();
$this->params = JComponentHelper::getParams( 'com_invoices'
);
// Get data from the model
$this->pagination = $this->get('Pagination');
$this->keywords = $this->get('keywords');
$this->currencies = InvoicesHelper::getCurrencies();
$this->alltaxes = InvoicesHelper::getAllTaxes();
$this->templates = InvoicesHelper::getTemplatesData();
$this->taxes = InvoicesHelper::getTaxes();
$lists['order_Dir'] = $this->get('FilterOrderDir')
;
$lists['order'] = $this->get('FilterOrder') ;
$document->addScript('components/com_invoices/assets/js/contacts.js');
$document->addScript('components/com_invoices/assets/libs/jquery.form.min.js');
$document->addScript('components/com_invoices/assets/js/ajax_submit_contact.js');
//JS models
$document->addScript('components/com_invoices/assets/js/models/Contact.js');
$document->addScript('components/com_invoices/assets/js/models/Invoice.js');
$document->addScript('components/com_invoices/assets/js/models/Payment.js');
$this->lists = $lists;
//load language strings
InvoicesHelper::loadStatusLanguageStrings();
$lang = JFactory::getLanguage();
$langs = $lang->getKnownLanguages(JPATH_SITE) ;
foreach($langs as $language){
$this->load('com_invoices', JPATH_SITE,
$language['tag'], true);
}
$document->addScriptDeclaration('var strings =
'.json_encode($this->strings).'; ');
parent::display($tpl);
}
//as taken from the JLanguage file
//but some things taken out
public function load($extension = 'joomla', $basePath =
JPATH_BASE, $lang = null, $reload = false, $default = true)
{
$path = $this->getLanguagePath($basePath, $lang);
$internal = $extension == 'joomla' || $extension ==
'';
$filename = $internal ? $lang : $lang . '.' . $extension;
$filename = "$path/$filename.ini";
// Load the language file
$result = $this->loadLanguage($filename, $extension, $lang);
return $result;
}
protected function loadLanguage($filename, $extension =
'unknown', $lang)
{
$result = false;
$strings = false;
if (file_exists($filename))
{
$strings = $this->parse($filename);
}
if ($strings)
{
if (is_array($strings) && count($strings))
{
//$this->strings = array_replace($this->strings, $strings,
false);
$this->strings[$lang] = $strings;
$result = true;
}
}
return $result;
}
protected function parse($filename)
{
$contents = file_get_contents($filename);
$contents = str_replace('_QQ_',
'"\""', $contents);
$strings = @parse_ini_string($contents);
if (!is_array($strings))
{
$strings = array();
}
return $strings;
}
public static function getLanguagePath($basePath = JPATH_BASE, $language =
null)
{
$dir = $basePath . '/language';
if (!empty($language))
{
$dir .= '/' . $language;
}
return $dir;
}
}