Example #1
0
    /**
     * Display all available validation rules
     * @param array array of validation_rule objects
     * @param object page navigation
     * @param array lists
     */
    function show($elements, $pageNav, $lists)
    {
        FabrikViewElement::setElementsToolbar();
        $user =& JFactory::getUser();
        ?>
		<form action="index.php" method="post" name="adminForm">
			<table cellpadding="4" cellspacing="0" border="0" width="100%">
				<tr>
					<td><?php 
        echo JText::_('NAME') . ": ";
        ?>
						<input type="text" name="filter_elementName" value="<?php 
        echo $lists['search'];
        ?>
" class="text_area" onChange="document.adminForm.submit();" />
					</td>
					<td>
						<?php 
        echo $lists['filter_formId'];
        ?>
					</td>
					<td>
						<?php 
        echo $lists['groupId'];
        ?>
					</td>
					<td>
						<?php 
        echo $lists['elementId'];
        ?>
					</td>
					<td>
						<?php 
        echo $lists['filter_showInTable'];
        ?>
					</td>
					<td>
						<?php 
        echo $lists['filter_published'];
        ?>
					</td>
				</tr>
			</table>
			<table class="adminlist">
			<thead>
			<tr>
				<th width="2%"><?php 
        echo JHTML::_('grid.sort', '#', 'e.id', @$lists['order_Dir'], @$lists['order']);
        ?>
</th>
				<th width="2%"> <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php 
        echo count($elements);
        ?>
);" /></th>
				<th width="20%" >
					<?php 
        echo JHTML::_('grid.sort', 'Name', 'e.name', @$lists['order_Dir'], @$lists['order']);
        ?>
				</th>
				<th width="20%" >
					<?php 
        echo JHTML::_('grid.sort', 'Label', 'e.label', @$lists['order_Dir'], @$lists['order']);
        ?>
				</th>
				<th width="15%" >
					<?php 
        echo JText::_('FULL_ELEMENT_NAME');
        ?>
				</th>
				<th width="15%" >
					<?php 
        echo JHTML::_('grid.sort', 'Group', 'g.name', @$lists['order_Dir'], @$lists['order']);
        ?>
				</th>

				<th width="10%" >
					<?php 
        echo JHTML::_('grid.sort', 'Element type', 'plugin', @$lists['order_Dir'], @$lists['order']);
        ?>
				</th>
				<th width="3%">
					<?php 
        echo JHTML::_('grid.sort', 'Show in table', 'show_in_table_summary', @$lists['order_Dir'], @$lists['order']);
        ?>
				</th>
				<th width="3%">
					<?php 
        echo JHTML::_('grid.sort', 'Published', 'e.state', @$lists['order_Dir'], @$lists['order']);
        ?>
				</th>
				<th width="10%">
					<?php 
        echo JHTML::_('grid.sort', 'Order', 'e.ordering', @$lists['order_Dir'], @$lists['order']);
        ?>
					<?php 
        echo JHTML::_('grid.order', $elements);
        ?>
				</th>
			</tr>
			</thead>
			<tfoot>
				<tr>
				<td colspan="10">
					<?php 
        echo $pageNav->getListFooter();
        ?>
				</td>
				</tr>
			</tfoot>
			<tbody>
			<?php 
        $k = 0;
        for ($i = 0, $n = count($elements); $i < $n; $i++) {
            $row =& $elements[$i];
            $checked = JHTML::_('grid.checkedout', $row, $i);
            $link = JRoute::_('index.php?option=com_fabrik&c=element&task=edit&cid=' . $row->id);
            $row->published = $row->state;
            $published = JHTML::_('grid.published', $row, $i);
            //PN 19-Jun-11: Create the element plugin model - used for selfDiagnose():
            $pluginManager =& JModel::getInstance('Pluginmanager', 'FabrikModel');
            $elementModel = $pluginManager->getPlugIn($row->plugin, 'element');
            $elementModel->setId($row->id);
            $elementModel->getElement(true);
            $elementSelfDiagnose = $elementModel->selfDiagnose();
            ?>
				<tr class="<?php 
            echo "row{$k}";
            ?>
">
					<td width="4%">
					<?php 
            if ($row->parent_id != 0) {
                echo "<a href='index.php?option=com_fabrik&c=element\n&task=edit&cid=" . $row->parent_id . "'>" . JHTML::image('media/com_fabrik/images/link.png', JText::_('LINKED_ELEMENT'), 'title="' . JText::_('LINKED_ELEMENT') . '"') . '</a>&nbsp';
            } else {
                echo JHTML::image('media/com_fabrik/images/link_break.png', JText::_('PARENT_ELEMENT'), 'title="' . JText::_('PARENT_ELEMENT') . '"') . '&nbsp;';
            }
            ?>
			<?php 
            echo $row->id;
            ?>
					</td>
					<td>
						<?php 
            echo $checked;
            ?>
					</td>
					<td>

						<?php 
            if ($row->checked_out && $row->checked_out != $user->get('id')) {
                echo $row->name;
            } else {
                echo '<a ';
                //PN 19-Jun-11: If there's an element error, display the link in red with an error mesage:
                if ($elementSelfDiagnose) {
                    echo 'style="color:red" ';
                    echo 'title="' . $elementSelfDiagnose . '" ';
                }
                echo 'href="' . $link . '">';
                echo $row->name;
                echo '</a>';
            }
            ?>

					</td>
					<td>

						<?php 
            echo $row->label;
            ?>
					</td>
					<td>
						<?php 
            echo $row->tablename;
            ?>
					</td>

					<td>
						<a href="index.php?option=com_fabrik&c=group&task=edit&cid=<?php 
            echo $row->group_id;
            ?>
">
							<?php 
            echo $row->group_name;
            ?>
						</a>
					</td>
					<td><?php 
            echo htmlentities($row->pluginlabel);
            ?>
</td>
					<td>
					<?php 
            if ($row->show_in_table_summary == "1") {
                $img = 'publish_g.png';
                $alt = JText::_('SHOW IN TABLE');
            } else {
                $img = "publish_x.png";
                $alt = JText::_('HIDE IN TABLE');
            }
            ?>
						<a href="javascript:void(0);" onclick="return listItemTask('cb<?php 
            echo $i;
            ?>
','<?php 
            echo $row->show_in_table_summary ? "removeFromTableview" : "addToTableView";
            ?>
');">
							<img src="images/<?php 
            echo $img;
            ?>
" border="0" alt="<?php 
            echo $alt;
            ?>
" />
						</a>
					</td>
					<td>
						<?php 
            echo $published;
            ?>
					</td>
					<td class="order">
					<?php 
            $condition = $row->group_id == @$elements[$i - 1]->group_id;
            echo '<span>' . $pageNav->orderUpIcon($i, $condition, 'orderUpElement') . '</span>';
            $condition = $row->group_id == @$elements[$i + 1]->group_id;
            echo '<span>' . $pageNav->orderDownIcon($i, $n, $condition, 'orderDownElement') . '</span>';
            ?>
						<input type="text" name="order[]" size="5" value="<?php 
            echo $row->ordering;
            ?>
" class="text_area" style="text-align: center" />
					</td>
				</tr>
			<?php 
            $k = 1 - $k;
        }
        ?>
			</tbody>
		</table>
		<input type="hidden" name="option" value="com_fabrik" />
		<input type="hidden" name="c" value="element" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="boxchecked" value="0" />
		<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 
    }