<?php 
    defined('_JEXEC') or die('Restricted access');
    ARTIOFusionChartsHelper::importLinesJS(); 
?>
<fieldset class="adminform">
    <legend><?php echo JText::_('Trend Lines'); ?></legend>
    <div id="chartToolbar">
        <a href="javascript:Lines.add()" class="addCol"><?php echo JText::_('Add Trend Line')?></a>
        <a href="javascript:Lines.remove()" class="removeCol"><?php echo JText::_('Remove Trend Lines')?></a>
        <div class="cleaner"></div>
    </div>
    <div id="editcell">
    	<table class="adminlist">
    		<thead>
    			<tr>
    				<th class="title" align="left">
    					<input type="checkbox" id="line-check-all" onclick="Lines.checkAll()"/>
    				</th>
    				<th class="title">
    					<span class="editlinktip hasTip" title="<?php echo JText::_('Start Value'); ?>::<?php echo JText::_('Start Value Title'); ?>">
    					    <?php echo JText::_('Start Value'); ?>
    					</span>
    				</th>
    				<th class="title">
    					<span class="editlinktip hasTip" title="<?php echo JText::_('End Value'); ?>::<?php echo JText::_('End Value Title'); ?>">
    					    <?php echo JText::_('End Value'); ?>
    					</span>
    				</th>
    				<th class="title">
    					<span class="editlinktip hasTip" title="<?php echo JText::_('Color'); ?>::<?php echo JText::_('Color Title'); ?>">
    					    <?php echo JText::_('Color'); ?>
    					</span>
    				</th>
    				<th class="title">
    					<span class="editlinktip hasTip" title="<?php echo JText::_('Display Value'); ?>::<?php echo JText::_('Display Value Title'); ?>">
    					    <?php echo JText::_('Display Value'); ?>
    					</span>
    				</th>
    				<th class="title">
    					<span class="editlinktip hasTip" title="<?php echo JText::_('Thickness'); ?>::<?php echo JText::_('Thickness Title'); ?>">
    					    <?php echo JText::_('Thickness Value'); ?>
    					</span>
    				</th>
    				<th class="title">
    					<span class="editlinktip hasTip" title="<?php echo JText::_('Is Trend Zone'); ?>::<?php echo JText::_('Is Trend Zone Title'); ?>">
    					    <?php echo JText::_('Is Trend Zone'); ?>
    					</span>
    				</th>
    				<th class="title">
    					<span class="editlinktip hasTip" title="<?php echo JText::_('Show On Top'); ?>::<?php echo JText::_('Show On Top Title'); ?>">
    					    <?php echo JText::_('Show On Top'); ?>
    					</span>
    				</th>
    				<th class="title">
    					<span class="editlinktip hasTip" title="<?php echo JText::_('Alpha'); ?>::<?php echo JText::_('Alpha Title'); ?>">
    					    <?php echo JText::_('Alpha'); ?>
    					</span>
    				</th>
    			</tr>	
    		</thead>			
    		<tbody id="dataLineBody">				
                <?php foreach ($this->chart->lines as $i=>$item) { ?>
                	<?php JFilterOutput::objectHTMLSafe($item, ENT_QUOTES); ?>
                    <?php $id = $i + 1; ?>
        			<tr id="line-row-<?php echo $id; ?>" class="row<?php echo $i%2; ?>">
        				<td>	
        					<input type="checkbox" id="line-checkbox-<?php echo $id; ?>" name="line-checkbox-<?php echo $id; ?>" value="<?php echo $id; ?>"/>
        				</td>
        				<td>
        					<input type="text" id="line-start-value-<?php echo $id; ?>" name="line-start-value[]" value="<?php echo $item->start_value; ?>" size="10" tabindex=""/>
        				</td>
        				<td>		
        					<input type="text" id="line-end-value-<?php echo $id; ?>" name="line-end-value[]" value="<?php echo $item->end_value; ?>" size="10"/>
        				</td>	
        				<td>		
        					<input class="color {pickerPosition:'top',required:false}" value="<?php echo $item->color; ?>" id="line-color-<?php echo $id; ?>" name="line-color[]" size="7" maxLength="7">
        				</td>
        				<td>		
        					<input type="text"  id="line-display-<?php echo $id; ?>"name="line-display[]" value="<?php echo $item->display; ?>" size="30"/>
        				</td>
        				<td>		
        					<input type="text" id="line-thickness-<?php echo $id; ?>" name="line-thickness[]" value="<?php echo $item->thickness; ?>" size="6"/>
        				</td>
        				<td>	
        					<input type="checkbox" id="line-zone-<?php echo $id; ?>"name="line-zone[]" value="<?php echo $id; ?>" <?php echo $item->zone ? 'checked="checked"' : ''; ?>/>
        				</td>
        				<td>	
        					<input type="checkbox" id="line-top-<?php echo $id; ?>"name="line-top[]" value="<?php echo $id; ?>" <?php echo $item->top ? 'checked="checked"' : ''; ?>/>
        				</td>
        				<td>		
        					<input type="text" id="line-alpha-<?php echo $id; ?>" name="line-alpha[]" value="<?php echo $item->alpha; ?>" size="3" maxLength="3"/>
        				</td>
        			</tr>		
                <?php } ?>
                <?php if ( count ( $this->chart->lines ) == 0 ) { ?>
                	<tr class="row0" id="emptyLinesInfo">
                		<td colspan="9"> 
                            <?php echo JText::_('Click on Add Trend Lines Button to Create Trend Line'); ?>
                		</td>
                	</tr>
                <?php } ?>
    		</tbody>
    	</table>
    </div>
</fieldset>

<input type="hidden" name="lastLineID" id="lastLineID" value="<?php echo count($this->chart->lines); ?>" />