예제 #1
0
파일: table.php 프로젝트: nikshade/fabrik21
    /**
     * Display all available tables
     * @param array array of table_rule objects
     * @param object page navigation
     * @param array lists
     */
    function show($tables, $pageNav, $lists)
    {
        JHTML::stylesheet('fabrikadmin.css', 'administrator/components/com_fabrik/views/');
        FabrikViewTable::setTablesToolbar();
        $user =& JFactory::getUser();
        JHTML::_('behavior.tooltip');
        ?>
<form action="index.php" method="post" name="adminForm" id="adminForm">
<table summary="table filter">
	<tr>
		<td><?php 
        echo $lists['packages'];
        ?>
</td>
		<td><?php 
        echo JText::_('TABLE') . ": ";
        echo $lists['filter_table'];
        ?>
</td>
	</tr>
</table>
<table class="adminlist">
	<thead>
		<tr>
			<th width="2%"><?php 
        echo JHTML::_('grid.sort', '#', 't.id', @$lists['order_Dir'], @$lists['order']);
        ?>
</th>
			<th width="1%"><input type="checkbox" name="toggle" value=""
				onclick="checkAll(<?php 
        echo count($tables);
        ?>
);" /></th>
			<th width="14%"><?php 
        echo JHTML::_('grid.sort', 'Table name', 'label', @$lists['order_Dir'], @$lists['order']);
        ?>
			</th>
			<th width="15%"><?php 
        echo JHTML::_('grid.sort', 'DB Table', 'db_table_name', @$lists['order_Dir'], @$lists['order']);
        ?>
			</th>
			<th width="14%"><?php 
        echo JText::_('ELEMENT');
        ?>
</th>
			<th width="14%"><?php 
        echo JText::_('FORM');
        ?>
</th>
			<th width="20%"><?php 
        echo JText::_('VIEW DATA');
        ?>
</th>
			<th width="5%"><?php 
        echo JHTML::_('grid.sort', 'Published', 'state', @$lists['order_Dir'], @$lists['order']);
        ?>
			</th>
			<th width="20%"><?php 
        echo JText::_('VIEW DETAILS');
        ?>
</th>
		</tr>
	</thead>
	<tfoot>
		<tr>
			<td colspan="9"><?php 
        echo $pageNav->getListFooter();
        ?>
</td>
		</tr>
	</tfoot>
	<tbody>
	<?php 
        $k = 0;
        for ($i = 0, $n = count($tables); $i < $n; $i++) {
            $row =& $tables[$i];
            $checked = JHTML::_('grid.checkedout', $row, $i);
            $link = JRoute::_('index.php?option=com_fabrik&c=table&task=edit&cid=' . $row->id);
            $formLink = JRoute::_('index.php?option=com_fabrik&c=form&task=edit&cid=' . $row->form_id);
            if (array_key_exists($row->id, $lists['table_groups'])) {
                $elementLink = JRoute::_('index.php?option=com_fabrik&c=element&task=edit&cid=0&filter_groupId=' . $lists['table_groups'][$row->id]->group_id);
                $elementLink = '<a href="' . $elementLink . '">' . JText::_('ADD') . '</a>';
            } else {
                $elementLink = JText::_('No group found');
            }
            $row->published = $row->state;
            $published = JHTML::_('grid.published', $row, $i);
            $params = new JParameter($row->attribs, 'administrator/components/com_fabrik/models/table.xml');
            $img = $params->get('isview') ? 'base_view.png' : 'base.png';
            $title = $params->get('isview') ? JText::_('VIEW') : JText::_('TABLE');
            $img = JHTML::image('media/com_fabrik/images/' . $img, $title, 'title="' . $title . '" class="dbimg"');
            ?>
		<tr class="<?php 
            echo "row{$k}";
            ?>
">
			<td width="3%"><?php 
            echo $img . $row->id;
            ?>
</td>
			<td width="1%"><?php 
            echo $checked;
            ?>
</td>
			<td width="27%"><?php 
            if ($row->checked_out && $row->checked_out != $user->get('id')) {
                ?>
 <span class="editlinktip hasTip"
				title="<?php 
                echo $row->label . "::" . $params->get('note');
                ?>
"> <?php 
                echo $row->label;
                ?>
			</span> <?php 
            } else {
                ?>
 <a href="<?php 
                echo $link;
                ?>
"> <span class="editlinktip hasTip"
				title="<?php 
                echo $row->label . "::" . $params->get('note');
                ?>
"> <?php 
                echo $row->label;
                ?>
			</span> </a> <?php 
            }
            ?>
</td>
			<td>

				<?php 
            echo $row->db_table_name;
            ?>
			</td>
			<td width="14%">
				<?php 
            echo $elementLink;
            ?>
			</td>
			<td width="28%"><a href="<?php 
            echo $formLink;
            ?>
"><?php 
            echo JText::_('EDIT');
            ?>
</a>
			</td>
			<td width="20%"><a href="#view"
				onclick="return listItemTask('cb<?php 
            echo $i;
            ?>
','viewTable');"><?php 
            echo JText::_('VIEW DATA');
            ?>
</a>
			</td>
			<td width="5%"><?php 
            echo $published;
            ?>
</td>
			<td width="20%"><a href="#showlinkedelements"
				onclick="return listItemTask('cb<?php 
            echo $i;
            ?>
','showlinkedelements');"><?php 
            echo JText::_('VIEW DETAILS');
            ?>
</a>
			</td>
		</tr>
		<?php 
            $k = 1 - $k;
        }
        ?>
	</tbody>
</table>
<input type="hidden" name="option" value="com_fabrik" /> <input
	type="hidden" name="boxchecked" value="0" /> <input type="hidden"
	name="c" value="table" /> <input type="hidden" name="task" value="" />
<input type="hidden" name="filter_order"
	value="<?php 
        echo $lists['order'];
        ?>
" /> <input type="hidden"
	name="filter_order_Dir" value="<?php 
        echo $lists['order_Dir'];
        ?>
" /> <?php 
        echo JHTML::_('form.token');
        ?>
</form>
	<?php 
    }