<?php
// No direct access
defined('_JEXEC') or die('Restricted access');
     
    // Load the tooltip behavior.
    JHtml::_('behavior.tooltip');
    JHtml::_('behavior.formvalidation');
    JHtml::_('behavior.keepalive');
    
    $nbMassContent=$this->params->get('nb_of_articles');
    if ($nbMassContent==0 || $nbMassContent=="")
        $nbMassContent=5;
    $this->cpt=0;

 

?>

<script type="text/javascript">
/*
Joomla.submitbutton = function(task) {
    if (task == 'article.cancel' || document.formvalidator.isValid(document.id('item-form'))) {
        <?php //echo $this->form->getField('articletext')->save(); ?>
        Joomla.submitform(task, document.getElementById('item-form'));
    } else {
        alert('<?php echo $this->escape(JText::_('JGLOBAL_VALIDATION_FORM_FAILED'));?>');
    }
}
*/

 
</script>
<form action="<?php echo JRoute::_('index.php?option=com_masscontent&layout=articles&view=articles'); ?>" method="post" name="adminForm" id="article-form" class="form-validate">
<?php for ($i=1;$i< $nbMassContent +1;$i++) { 

        $this->cpt=$i;?>
<div class="width-100">
	<div class="width-60 fltlft">
		<fieldset class="adminform">
			<legend><?php echo  JText::_('COM_CONTENT_NEW_ARTICLE')." #".$i  ?></legend>
			<ul class="adminformlist">
				<li><?php echo $this->form->getLabel('title');
                 $this->form->setFieldAttribute('title',"id","title_".$i);  
                 echo str_replace("]","][]", $this->form->getInput('title'));?></li>

				<li><?php echo $this->form->getLabel('alias');
                     $this->form->setFieldAttribute('alias',"id","alias_".$i);   ?>
				<?php echo str_replace("]","][]", $this->form->getInput('alias')); ?></li>

				<li><?php echo $this->form->getLabel('catid'); 
                    $this->form->setFieldAttribute('catid',"id","catid_".$i);  ?>
				<?php echo str_replace("]","][]", $this->form->getInput('catid')); ?></li>

				<li><?php echo $this->form->getLabel('state'); 
                     $this->form->setFieldAttribute('state',"id","state_".$i);?>
				<?php echo str_replace("]","][]", $this->form->getInput('state')); ?></li>

				<li><?php echo $this->form->getLabel('access');
                  $this->form->setFieldAttribute('access',"id","access_".$i);?>
				<?php echo str_replace("]","][]", $this->form->getInput('access')); ?></li>
<?php /* ?>
     
            <li><span class="faux-label"><?php echo JText::_('JGLOBAL_ACTION_PERMISSIONS_LABEL'); ?></span> 
            <div class="button2-left"><div class="blank">
            <button type="button" onclick="document.location.href='#access-rules<?php echo $i; ?>';">
            <?php echo JText::_('JGLOBAL_PERMISSIONS_ANCHOR'); ?>
            </button>
            </div></div>
            </li>
<?php */ ?>    



				<li><?php echo $this->form->getLabel('featured');
                      $this->form->setFieldAttribute('featured',"id","featured_".$i);?> 
				<?php echo str_replace("]","][]", $this->form->getInput('featured')); ?></li>

				<li><?php echo $this->form->getLabel('language');
                      $this->form->setFieldAttribute('language',"id","language_".$i);?> 
				<?php echo str_replace("]","][]", $this->form->getInput('language')); ?></li>

				<li><?php echo $this->form->getLabel('id'); ?>
				<?php echo str_replace("]","][]", $this->form->getInput('id')); ?></li>
			</ul>

			<div class="clr"></div>
			<?php echo $this->form->getLabel('articletext'); ?>
			<div class="clr"></div>
			<?php $input =str_replace("]","][]", $this->form->getInput('articletext')); 
                $input=str_replace('id="','id=".$i."_',$input);
                //echo $input;
                
                $editor =& JFactory::getEditor();
                echo $editor->display('jform[articletext]['.($i-1).']', '', '100%', '100%', '60', '20', true);
                ?>
		</fieldset>
	</div>

<div class="width-40 fltrt">    
        <?php if ($i==1){?>
				<div class="toolbar-list" id="toolbar">
<ul class="hasTip" title="<?php echo JText::_('COM_MASSCONTENT_ARTICLE_COPY_PARAMS_ARTICLE_DESC');?>">
<li class="button" id="toolbar-copy">
<a id="copyAll" href="#"   class="toolbar">
<span class="icon-32-copy">
</span>
<?php echo JText::_('COM_MASSCONTENT_ARTICLE_COPY_PARAMS_ARTICLE'); ?></a>
</li>
</div>
<br /><br /><br />
<?php } ?>
		<?php echo JHtml::_('sliders.start','content-sliders-'.$i, array('useCookie'=>1)); ?>

			<?php echo JHtml::_('sliders.panel',JText::_('COM_CONTENT_FIELDSET_PUBLISHING')." #".$i, 'publishing-details'); ?>
			<fieldset class="panelform">
				<ul class="adminformlist">
					<li><?php echo $this->form->getLabel('created_by'); ?>
					<?php 
                         $this->form->setFieldAttribute('created_by',"id","created_by_".$i);
                      echo str_replace("]","][]", $this->form->getInput('created_by'));
                      ?></li>

					<li><?php echo $this->form->getLabel('created_by_alias'); 
                         $this->form->setFieldAttribute('created_by_alias',"id","created_by_alias_".$i); ?>
					<?php echo str_replace("]","][]", $this->form->getInput('created_by_alias')); ?></li>

					<li><?php echo $this->form->getLabel('created');
                        $this->form->setFieldAttribute('created',"id","created_".$i);?>   
					<?php echo str_replace("]","][]", $this->form->getInput('created')); ?></li>

					<li><?php echo $this->form->getLabel('publish_up');
                        $this->form->setFieldAttribute('publish_up',"id","publish_up_".$i);?> 
					<?php echo str_replace("]","][]", $this->form->getInput('publish_up')); ?></li>

					<li><?php echo $this->form->getLabel('publish_down');
                        $this->form->setFieldAttribute('publish_down',"id","publish_down_".$i);?>   
					<?php echo str_replace("]","][]", $this->form->getInput('publish_down')); ?></li>

					<?php /*if ($this->item->modified_by) : ?>
						<li><?php echo $this->form->getLabel('modified_by'); 
                            $this->form->setFieldAttribute('modified_by',"id","modified_by_".$i);?> 
						<?php echo str_replace("]","][]", $this->form->getInput('modified_by')); ?></li>

						<li><?php echo $this->form->getLabel('modified');
                            $this->form->setFieldAttribute('modified',"id","modified_".$i);?> 
						<?php echo str_replace("]","][]", $this->form->getInput('modified')); ?></li>
					<?php endif;*/ ?>

					<?php /*if ($this->item->version) : ?>
						<li><?php echo $this->form->getLabel('version'); ?>
						<?php echo str_replace("]","][]", $this->form->getInput('version')); ?></li>
					<?php endif;*/ ?>

					<?php /*if ($this->item->hits) : ?>
						<li><?php echo $this->form->getLabel('hits'); ?>
						<?php echo str_replace("]","][]", $this->form->getInput('hits')); ?></li>
					<?php endif;*/ ?>
				</ul>
			</fieldset>

			<?php $fieldSets = $this->form->getFieldsets('attribs'); ?>
			<?php foreach ($fieldSets as $name => $fieldSet) : ?>
				<?php echo JHtml::_('sliders.panel',JText::_($fieldSet->label)." #".$i, $name.'-options'); ?>
				<?php if (isset($fieldSet->description) && trim($fieldSet->description)) : ?>
					<p class="tip"><?php echo $this->escape(JText::_($fieldSet->description));?></p>
				<?php endif; ?>
				<fieldset class="panelform">
					<ul class="adminformlist">
					<?php foreach ($this->form->getFieldset($name) as $field) : ?>
						<li><?php echo $field->label; ?>
						<?php 
                          $input=str_replace(']">','][]">',$field->input);
                         $input=str_replace(']" ','][]" ',$input);
                         $input=str_replace('id="','id="'.$i.'_',$input);
                        
                        echo $input; ?></li>
					<?php endforeach; ?>
					</ul>
				</fieldset>
			<?php endforeach; ?>

			<?php echo JHtml::_('sliders.panel',JText::_('JGLOBAL_FIELDSET_METADATA_OPTIONS')." #".$i, 'meta-options'); ?>
			<fieldset class="panelform">
				<?php echo $this->loadTemplate('metadata'); ?>
			</fieldset>

		<?php echo JHtml::_('sliders.end'); ?>
	</div>
    </div>
	<div class="clr"></div>
<?php /* ?>
<div class="clr"></div>
<div class="width-100 fltlft">
<?php echo JHtml::_('sliders.start','permissions-sliders-'.$i, array('useCookie'=>1)); ?>

<?php echo JHtml::_('sliders.panel',JText::_('COM_CONTENT_FIELDSET_RULES')." #".$i, 'access-rules'.$i); ?>
<fieldset class="panelform">
<?php echo $this->form->getLabel('rules'); ?>
<?php 
    $input=str_replace(']" id=','][]" id='.$i.'_',$this->form->getInput('rules'));
     echo $input; ?>
</fieldset>

<?php echo JHtml::_('sliders.end'); ?>
</div>
<br />
<?php */ ?>
<?php } ?>

 
	<div>
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="return" value="<?php echo JRequest::getCmd('return');?>" />
		<?php echo JHtml::_('form.token'); ?>
	</div>
</form>
