Example #1
0
    function importChooseElements($fields, $lists)
    {
        $addkey = JRequest::getVar('addkey', array(), 'default', 'array');
        $addkey = $addkey[0];
        FabrikViewTable::setImportChooseElementsToolbar();
        ?>
<form id="adminForm" name="adminForm" method="post" action="index.php">
<table class="adminlist">
	<thead>
		<tr>
			<th><?php 
        echo JText::_('FIELD');
        ?>
</th>
			<th><?php 
        echo JText::_('ELEMENT TYPE');
        ?>
</th>
			<th><?php 
        echo JText::_('LABEL');
        ?>
</th>
			<?php 
        if ($addkey == 0) {
            ?>
				<th><?php 
            echo JText::_('PRIMARY KEY');
            ?>
</th>
				<th><?php 
            echo JText::_('AUTO INCREMENT');
            ?>
</th>
			<?php 
        }
        ?>
		</tr>
	</thead>
	<tbody>
	<?php 
        foreach ($fields as $field) {
            $field = strtolower($field);
            $cleaned = FabrikString::clean($field, "UTF-8", "ASCII//TRANSLIT//IGNORE");
            ?>
		<tr>
			<td><label for="userfile"><?php 
            echo $cleaned;
            ?>
</label></td>
			<td><?php 
            echo $lists['elementtype'];
            ?>
</td>
			<td>
			<input name="label[]" value="<?php 
            echo str_replace("_", " ", $cleaned);
            ?>
" />
			<input type="hidden" name="field[]" value="<?php 
            echo $cleaned;
            ?>
" />
			</td>
			<?php 
            if ($addkey == 0) {
                ?>
				<td>
					<label>
						<input type="radio" checked="checked" name="primarykey[<?php 
                echo $cleaned;
                ?>
][]" value="0" /><?php 
                echo JText::_('NO');
                ?>
					</label>
					<label>
						<input type="radio" name="primarykey[<?php 
                echo $cleaned;
                ?>
][]" value="1" /><?php 
                echo JText::_('YES');
                ?>
					</label>
				</td>
				<td>
					<label>
						<input type="radio" checked="checked" name="autoinc[<?php 
                echo $cleaned;
                ?>
][]" value="0" /><?php 
                echo JText::_('NO');
                ?>
					</label>
					<label>
						<input type="radio" name="autoinc[<?php 
                echo $cleaned;
                ?>
][]" value="1" /><?php 
                echo JText::_('YES');
                ?>
					</label>
				</td>
				<?php 
            }
            ?>
		</tr>
		<?php 
        }
        ?>
	</tbody>
</table>
	<input type="hidden" name="option" value="com_fabrik" />
	<input type="hidden" name="c" value="table" />
	<input type="hidden" name="task" value="" />
	<input type="hidden" name="db_table_name" value="<?php 
        echo JRequest::getVar('db_table_name');
        ?>
" />
	<input type="hidden" name="db_table_label" value="<?php 
        echo JRequest::getVar('label');
        ?>
" />
	<input type="hidden" name="connection_id" value="<?php 
        echo JRequest::getVar('connection_id');
        ?>
" />
	<input type="hidden" name="addkey" value="<?php 
        echo $addkey;
        ?>
" />
		<?php 
        echo JHTML::_('form.token');
        ?>
</form>

		<?php 
    }
Example #2
0
 /**
  * delete table
  */
 function remove()
 {
     $cid = JRequest::getVar('cid', array(), 'post', 'array');
     $db =& JFactory::getDBO();
     $db->setQuery("SELECT db_table_name FROM #__fabrik_tables WHERE id IN(" . implode(",", $cid) . ")");
     $names = $db->loadResultArray();
     require_once JPATH_COMPONENT . DS . 'views' . DS . 'table.php';
     FabrikViewTable::askDeleteTableMethod($names);
 }