PageRenderTime 50ms CodeModel.GetById 31ms RepoModel.GetById 1ms app.codeStats 0ms

/contentmanager/code/trunk/administrator/components/com_contentmanager/views/splash/view.html.php

https://bitbucket.org/eddieajau/the-art-of-joomla-archive
PHP | 78 lines | 47 code | 9 blank | 22 comment | 6 complexity | 0301dff0ec2072c2279669005ddc6b04 MD5 | raw file
  1. <?php
  2. /**
  3. * @version $Id: view.html.php 57 2009-05-25 12:21:31Z eddieajau $
  4. * @copyright Copyright (C) 2009 New Life in IT Pty Ltd. All rights reserved.
  5. * @license GNU General Public License <http://www.gnu.org/copyleft/gpl.html>
  6. * @link http://www.theartofjoomla.com
  7. */
  8. // no direct access
  9. defined('_JEXEC') or die;
  10. jimport('joomla.application.component.view');
  11. /**
  12. * @package TAOJ.ContentManager
  13. * @subpackage com_contentmanager
  14. */
  15. class ContentManagerViewSplash extends JView
  16. {
  17. /**
  18. * Display the view
  19. *
  20. * @access public
  21. */
  22. function display($tpl = null)
  23. {
  24. $state = $this->get('State');
  25. $item = $this->get('Item');
  26. $form = $this->get('Form');
  27. // Check for errors.
  28. if (count($errors = $this->get('Errors'))) {
  29. JError::raiseError(500, implode("\n", $errors));
  30. return false;
  31. }
  32. $form->setName('adminForm');
  33. $form->setAction(JRoute::_('index.php?option=com_contentmanager'));
  34. $form->loadObject($item);
  35. $this->assignRef('state', $state);
  36. $this->assignRef('item', $item);
  37. $this->assignRef('form', $form);
  38. $this->_setToolbar();
  39. parent::display($tpl);
  40. JRequest::setVar('hidemainmenu', true);
  41. }
  42. /**
  43. * Display the toolbar
  44. *
  45. * @access private
  46. */
  47. function _setToolbar()
  48. {
  49. $user = &JFactory::getUser();
  50. if (is_object($this->item)) {
  51. $isCheckedOut = JTable::isCheckedOut($user->get('id'), $this->item->checked_out);
  52. $isNew = ($this->item->id == 0);
  53. }
  54. else {
  55. $isCheckedOut = false;
  56. $isNew = true;
  57. }
  58. JToolBarHelper::title(JText::_('ContMan_Page_'.($isCheckedOut ? 'View_Splash_Page' : ($isNew ? 'Add_Splash_Page' : 'Edit_Splash_Page'))), 'logo');
  59. if (!$isNew) {
  60. JToolBarHelper::custom('splash.save2copy', 'copy.png', 'copy_f2.png', 'ContMan_Toolbar_Save_To_Copy', false);
  61. }
  62. if (!$isCheckedOut) {
  63. JToolBarHelper::custom('splash.save2new', 'new.png', 'new_f2.png', 'ContMan_Toolbar_Save_And_New', false);
  64. JToolBarHelper::save('splash.save');
  65. JToolBarHelper::apply('splash.apply');
  66. }
  67. JToolBarHelper::cancel('splash.cancel');
  68. }
  69. }