view.html.php
1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/**
* Joomla! component Creative Contact Form
*
* @version $Id: 2012-04-05 14:30:25 svn $
* @author creative-solutions.net
* @package Creative Contact Form
* @subpackage com_creativecontactform
* @license GNU/GPL
*
*/
// no direct access
defined('_JEXEC') or die('Restircted access');
// Import Joomla! libraries
jimport( 'joomla.application.component.view');
class CreativeContactFormViewCreativeoption extends JViewLegacy
{
protected $form;
protected $item;
protected $state;
/**
* Display the view
*/
public function display($tpl = null)
{
// Initialiase variables.
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->state = $this->get('State');
$max_id = $this->get('max_id');
$this->assignRef( 'max_id', $max_id );
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
$this->addToolbar($max_id);
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
JRequest::setVar('hidemainmenu', true);
$user = JFactory::getUser();
$userId = $user->get('id');
$isNew = ($this->item->id == 0);
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
// Since we don't track these assets at the item level, use the category id.
$text = $isNew ? JText::_( 'New' ) : JText::_( 'Edit' );
JToolBarHelper::title( JText::_( 'Creative Option' ).': <small><small>[ ' . $text.' ]</small></small>','manage.png' );
// Build the actions for new and existing records.
if ($isNew) {
JToolBarHelper::save('creativeoption.save');
JToolBarHelper::cancel('creativeoption.cancel');
}
else {
JToolBarHelper::save('creativeoption.save');
JToolBarHelper::apply('creativeoption.apply');
JToolBarHelper::cancel('creativeoption.cancel','close');
}
}
}