phpeveryday.com

The best tutorial of php, php framework, php strategies, object oriented oriented,


Joomla - MVC: Adding Element Paginating for Back End

Tag: joomla, MVC, component, pattern, controller, paginating   Category: PHP Application
post: 07 Feb 2008 read: 1,351


Joomla Back End MVC Step by Step Tutorial - Part 5: After update controller for pagination. Now, we will update our view at "admin.hello.html.php".

joomla mvc backend paginating


<?php
defined( '_JEXEC' ) or die( 'Restricted access' );

class HTML_hellos
{
	function showHellos($option, &$rows, &$pageNav){

		JHTML::_('behavior.tooltip');

	?>
	<form action="index.php?option=com_hello" 
          method="post" name="adminForm">
    
		<table>
		<tr>
			<td align="left" width="100%">
				<?php echo JText::_( 'Filter' ); ?>:
				<input type="text" name="search" 
                id="search" 
                value="<?php echo $lists['search'];?>" 
                class="text_area" 
                onchange="document.adminForm.submit();" />
				<button onclick="this.form.submit();">
				<?php echo JText::_( 'Go' ); ?></button>
				<button onclick="document.getElementById('search').value='';
                this.form.submit();">
				<?php echo JText::_( 'Reset' ); ?></button>
			</td>
		</tr>
		</table>    
    
        
    <table class="adminlist">
    <thead>
    	<tr>
        	<th width="20">
            <input type="checkbox" name="toggle" value="" 
            onclick="checkAll(<?php echo count($rows)?>)">
            </th>
            <th width="50" class="title">
			<?php echo JHTML::_('grid.sort',   'ID', 'id', 
			               @$lists['order_Dir'], 
						   @$lists['order'] ); ?>
            </td>
            <th><?php echo JHTML::_('grid.sort',   
			               'Message', 'message', 
			               @$lists['order_Dir'], 
						   @$lists['order'] ); ?></th>
            <th nowrap="nowrap">
			       <?php echo JHTML::_('grid.sort',   
			               'Published', 'published', 
						   @$lists['order_Dir'], 
						   @$lists['order'] ); ?></th>
        </tr>
    </thead>
	<tfoot>
		<tr>
			<td colspan="11">
	<?php echo $pageNav->getListFooter(); ?>
			</td>
		</tr>
	</tfoot>    
                
    <?php
	
    $k = 0;
	for($i=0, $n=count($rows); $i < $n ; $i++)
	{
		$row = &$rows[$i];
		$checked 	= JHTML::_('grid.id', $i, $row->id);
		$published 	= JHTML::_('grid.published', $row, $i); 
		$link 		= JRoute::_( 'index.php?option=com_hello&task=edit&cid[]='. $row->id );
		?>
        <tr class="<?php echo "row$k"; ?>">
        	<td><?php echo $checked?></td>
        	<td><a href="<?php echo $link; ?>">
<?php echo $row->id?></a></td>
        	<td><?php echo $row->message?></td>            
        	<td><?php echo $published?></td>            
        </tr>
        <?
		$k = 1 - $k;
	}
	?>
    </table>
    <input type="hidden" name="option" value="com_hello">
    <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="" />       
    </form>
    <?php
	}
	
}
?>

The result may like this:

joomla mvc back end paginating



Series this article:
Joomla - MVC: Reorganizing Back End Code
Joomla - MVC: Creating Controller and Model for Back End
Joomla - MVC: Creating View for Back End
Joomla - MVC: Adding Pagination for Back End
Joomla - MVC: Adding Element Paginating for Back End
Joomla - MVC: Creating Form Input Data for Back-End
Joomla - MVC: Saving Data for Back End
Joomla - MVC: Editing Data for Back-End
Joomla - MVC: Adding Delete Function at Back-End
Joomla - MVC: Controlling Publish State for Back-End

| Give Your Opinion | Recommend
Share and Bookmark to: These icons link to social bookmarking sites where readers can share and discover new web pages.
digg del.icio.us technorati Ma.gnolia BlinkList

Recommended articles by other readers:
Web Services: How PHP Kiss VB.NET? (Part 1)
Chart: How to Build Cool Animation Real Time Chart
Joomla: Fast Road to Understand Component Programming
Email: Send Attachement Mail
mod_rewrite - Part 1: create your "fantasy" URL

What do You Think?
Your Name *:
Email *:
(Will not be published)
Website/URL:
Your Comment *:
* Required


619
posting