<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
 
// import Joomla view library
jimport('joomla.application.component.view');
    
  
 
/**
 * MassContent View
 */
class MassContentViewArticles extends JView
{
	/**
	 * display method of Hello view
	 * @return void
	 */
	public function display($tpl = null) 
	{ 
		// get the Data
		$form = $this->get('Form');  
		
		$item = null;
		$script = $this->get('Script');
        $params = JComponentHelper::getParams("com_masscontent");
      
		// Check for errors.
		if (count($errors = $this->get('Errors'))) 
		{
			JError::raiseError(500, implode('<br />', $errors));
			return false;
		}
                               
		// Assign the Data
		$this->form = $form;
		$this->item = $item;
		$this->script = $script;
        $this->params = $params;
 
		// Set the toolbar
		$this->addToolBar();
 
		// Display the template
		parent::display($tpl);
 
		// Set the document
        $this->setDocument();


	}
 
	/**
	 * Setting the toolbar
	 */
	protected function addToolBar() 
	{
    	//	JRequest::setVar('hidemainmenu', true);		
		JToolBarHelper::title(JText::_('COM_MASSCONTENT_MANAGER_NEW_CONTENT') );				
		JToolBarHelper::custom('articles.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
        JToolBarHelper::preferences('com_masscontent');			 	 
	}
	/**
	 * Method to set up the document properties
	 *
	 * @return void
	 */
	protected function setDocument() 
	{
		$document = JFactory::getDocument();
		$document->setTitle(JText::_('COM_MASSCONTENT_CONTENT_CREATING'));
		$document->addScript(JURI::root() . $this->script);
		$document->addScript(JURI::root() . "administrator/components/com_masscontent/views/content/submitbutton.js");
		JText::script('COM_MASSCONTENT_CONTENT_ERROR_UNACCEPTABLE');
	}
}
