コード例 #1
0
ファイル: package.php プロジェクト: nikshade/fabrik21
    /**
     * Display all available packages
     * @param array array of package_rule objects
     * @param object page navigation 
     */
    function show($packages, $pageNav)
    {
        FabrikViewPackage::setPackagesToolbar();
        $user =& JFactory::getUser();
        $n = count($packages);
        ?>
 
		
		<form action="index.php" method="post" name="adminForm">
			<table class="adminlist">
				<thead>
				<tr> 
					<th width="2%">#</th>
					<th width="1%">
						<input type="checkbox" id="toggle" name="toggle" value="" onclick="checkAll(<?php 
        echo $n;
        ?>
);" />
					</th>
					<th width="95%" ><?php 
        echo JText::_('LABEL');
        ?>
</th>
					<th width="3%"><?php 
        echo JText::_('PUBLISHED');
        ?>
</th>
				</tr> 
				</thead>
				<?php 
        $k = 0;
        for ($i = 0; $i < $n; $i++) {
            $row =& $packages[$i];
            $checked = JHTML::_('grid.checkedout', $row, $i);
            $link = JRoute::_('index.php?option=com_fabrik&c=package&task=edit&cid=' . $row->id);
            $row->published = $row->state;
            $published = JHTML::_('grid.published', $row, $i);
            ?>
					<tr class="<?php 
            echo "row{$k}";
            ?>
">
					<td><?php 
            echo $row->id;
            ?>
</td>
					<td width="1%"><?php 
            echo $checked;
            ?>
</td>
					<td width="35%">
						<?php 
            if ($row->checked_out && $row->checked_out != $user->get('id')) {
                echo $row->label;
            } else {
                ?>
						<a href="<?php 
                echo $link;
                ?>
">
							<?php 
                echo $row->label;
                ?>
						</a>
					<?php 
            }
            ?>
					</td>
		
					<td width="5%">
						<?php 
            echo $published;
            ?>
					</td>
				</tr> 
				
				<?php 
            $k = 1 - $k;
        }
        ?>
				<tfoot>
					<tr><td colspan="4">
						<?php 
        echo $pageNav->getListFooter();
        ?>
					</td></tr>
				</tfoot>
			</table>
			<input type="hidden" name="option" value="com_fabrik" />
			<input type="hidden" name="c" value="package" />
			<input type="hidden" name="boxchecked" value="0" />
			<input type="hidden" name="task" value="package" />
			<?php 
        echo JHTML::_('form.token');
        ?>
		</form>
	<?php 
    }
コード例 #2
0
ファイル: package.php プロジェクト: nikshade/fabrik21
 /**
  * Display the list of packages
  */
 function display()
 {
     $app =& JFactory::getApplication();
     $db =& JFactory::getDBO();
     // get the total number of records
     $db->setQuery("SELECT count(*) FROM #__fabrik_packages");
     $total = $db->loadResult();
     $context = 'com_fabrik.package.list.';
     $limit = $app->getUserStateFromRequest($context . 'limit', 'limit', $app->getCfg('list_limit'), 'int');
     $limitstart = $app->getUserStateFromRequest($context . 'limitstart', 'limitstart', 0, 'int');
     $sql = "SELECT * FROM #__fabrik_packages";
     $db->setQuery($sql, $limitstart, $limit);
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $limitstart, $limit);
     $rows = $db->loadObjectList();
     require_once JPATH_COMPONENT . DS . 'views' . DS . 'package.php';
     FabrikViewPackage::show($rows, $pageNav);
 }