|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @package Com_Localise |
|
4
|
|
|
* @subpackage views |
|
5
|
|
|
* |
|
6
|
|
|
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. |
|
7
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
defined('_JEXEC') or die; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* View to edit a language. |
|
14
|
|
|
* |
|
15
|
|
|
* @package Extensions.Components |
|
16
|
|
|
* @subpackage Localise |
|
17
|
|
|
* |
|
18
|
|
|
* @since 1.0 |
|
19
|
|
|
*/ |
|
20
|
|
|
class LocaliseViewLanguage extends JViewLegacy |
|
21
|
|
|
{ |
|
22
|
|
|
protected $state; |
|
23
|
|
|
|
|
24
|
|
|
protected $item; |
|
25
|
|
|
|
|
26
|
|
|
protected $form; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* Display the view |
|
30
|
|
|
* |
|
31
|
|
|
* @param string $tpl The name of the template file to parse; automatically searches through the template paths. |
|
32
|
|
|
* |
|
33
|
|
|
* @return void |
|
34
|
|
|
*/ |
|
35
|
|
|
public function display($tpl = null) |
|
36
|
|
|
{ |
|
37
|
|
|
jimport('joomla.client.helper'); |
|
38
|
|
|
|
|
39
|
|
|
// Get the data |
|
40
|
|
|
$this->state = $this->get('State'); |
|
41
|
|
|
$this->item = $this->get('Item'); |
|
42
|
|
|
$this->form = $this->get('Form'); |
|
43
|
|
|
$this->formftp = $this->get('FormFtp'); |
|
44
|
|
|
$this->ftp = JClientHelper::setCredentialsFromRequest('ftp'); |
|
45
|
|
|
|
|
46
|
|
|
// Check for errors. |
|
47
|
|
|
if (count($errors = $this->get('Errors'))) |
|
48
|
|
|
{ |
|
49
|
|
|
JError::raiseError(500, implode("\n", $errors)); |
|
50
|
|
|
|
|
51
|
|
|
return false; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
// Set the toolbar |
|
55
|
|
|
$this->addToolbar(); |
|
56
|
|
|
|
|
57
|
|
|
// Display the view |
|
58
|
|
|
parent::display($tpl); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* Add the page title and toolbar. |
|
63
|
|
|
* |
|
64
|
|
|
* @return void |
|
65
|
|
|
* |
|
66
|
|
|
* @since 1.6 |
|
67
|
|
|
*/ |
|
68
|
|
|
protected function addToolbar() |
|
69
|
|
|
{ |
|
70
|
|
|
JFactory::getApplication()->input->set('hidemainmenu', true); |
|
71
|
|
|
$canDo = JHelperContent::getActions('com_localise', 'component'); |
|
72
|
|
|
|
|
73
|
|
|
$user = JFactory::getUser(); |
|
74
|
|
|
$isNew = empty($this->item->id); |
|
75
|
|
|
$client = $this->item->client; |
|
76
|
|
|
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id')); |
|
77
|
|
|
|
|
78
|
|
|
JToolbarHelper::title( |
|
79
|
|
|
JText::sprintf( |
|
80
|
|
|
'COM_LOCALISE_HEADER_MANAGER', |
|
81
|
|
|
$isNew ? JText::_('COM_LOCALISE_HEADER_LANGUAGE_NEW') : JText::_('COM_LOCALISE_HEADER_LANGUAGE_EDIT') |
|
82
|
|
|
), |
|
83
|
|
|
'icon-comments-2 langmanager' |
|
84
|
|
|
); |
|
85
|
|
|
|
|
86
|
|
|
// If not checked out, can save the item. |
|
87
|
|
|
if (!$checkedOut) |
|
88
|
|
|
{ |
|
89
|
|
|
JToolbarHelper::apply('language.apply'); |
|
90
|
|
|
JToolbarHelper::save('language.save'); |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
JToolBarHelper::cancel('language.cancel', $isNew ? 'JTOOLBAR_CANCEL' : 'JTOOLBAR_CLOSE'); |
|
94
|
|
|
JToolBarHelper::divider(); |
|
95
|
|
|
|
|
96
|
|
|
if ($canDo->get('localise.create') && !$isNew && $client != 'installation') |
|
97
|
|
|
{ |
|
98
|
|
|
JToolbarHelper::custom('language.copy', 'copy.png', 'copy.png', 'COM_LOCALISE_COPY_REF_TO_NEW_LANG', false); |
|
99
|
|
|
JToolBarHelper::divider(); |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
JToolBarHelper::help('screen.language', true); |
|
103
|
|
|
} |
|
104
|
|
|
} |
|
105
|
|
|
|