create a folder with component name and prefix like:com_ukmpartandclient
create install.xml in the location:com_ukmpartandclient/ and add the following code
<?xml version="1.0" encoding="utf-8"?> <install type="component" version="1.5.0"> <name>ukm part and client</name> <!-- The following elements are optional and free of formatting conttraints --> <creationDate>2010-10-22</creationDate> <author>ukmodak</author> <authorEmail>uzzalmodak@yahoo.com</authorEmail> <authorUrl>http://www.ukmodak.com</authorUrl> <copyright>Copyright Info</copyright> <license>License Info</license> <!-- The version string is recorded in the components table --> <version>4.01</version> <!-- The description is optional and defaults to the name --> <description>This component will add partner or client to the ibcs-primax website</description> <!-- Site Main File Copy Section --> <files folder="site"> <filename>controller.php</filename> <filename>ukmpartandclient.php</filename> <filename>index.html</filename> <filename>models/ukmpartandclient.php</filename> <filename>views/ukmpartandclient/index.html</filename> <filename>views/ukmpartandclient/view.html.php</filename> <filename>views/ukmpartandclient/tmpl/index.html</filename> <filename>views/ukmpartandclient/tmpl/default.php</filename> <filename>views/ukmpartandclient/tmpl/clist.php</filename> <filename>views/ukmpartandclient/tmpl/list.php</filename> <filename>views/ukmpartandclient/tmpl/parclient.css</filename> <filename>views/ukmpartandclient/tmpl/plist.php</filename> <filename>views/index.html</filename> </files> <files> <filename>install.xml</filename> </files> <install> <sql> <file charset="utf8" driver="mysql">install.sql</file> </sql> </install> <uninstall> <sql> <file charset="utf8" driver="mysql">uninstall.sql</file> </sql> </uninstall> <administration> <!-- Administration Menu Section --> <menu>ukm part and client</menu> <!-- Administration Main File Copy Section --> <files folder="admin"> <!-- Site Main File Copy Section --> <filename>ukmpartandclient.php</filename> <filename>index.html</filename> <filename>install.sql</filename> <filename>uninstall.sql</filename> <filename>controller.php</filename> <filename>controllers/ukmpartandclient.php</filename> <filename>controllers/index.html</filename> <filename>models/ukmpartandclient.php</filename> <filename>models/index.html</filename> <filename>tables/ukmpartandclient.php</filename> <filename>tables/index.html</filename> <filename>views/ukmpartandclient/view.html.php</filename> <filename>views/ukmpartandclient/index.html</filename> <filename>views/ukmpartandclient/tmpl/form.php</filename> <filename>views/ukmpartandclient/tmpl/create.php</filename> <filename>views/ukmpartandclient/tmpl/index.html</filename> <filename>views/ukmpartandclient/tmpl/default.php</filename> </files> </administration> </install>
create a folder admin in the location:com_ukmpartandclient/ for admin panel
create a file index.html in the location:com_ukmpartandclient/admin/ and add the following code
<html><body bgcolor="#FFFFFF"></body></html>
create a file ukmpartandclient.php in the location:com_ukmpartandclient/admin/ which file call controller and add the following code
<?php
/**
* @package Joomla.Tutorials
* @subpackage Components
* @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component
* @license GNU/GPL
*/
// No direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
// Require the base controller
require_once( JPATH_COMPONENT.DS.'controller.php' );
// Require specific controller if requested
if($controller = JRequest::getWord('controller')) {
$path = JPATH_COMPONENT.DS.'controllers'.DS.$controller.'.php'; // if ?controller="somename" then call this path otherwise call default controller
if (file_exists($path)) {
require_once $path;
} else {
$controller = '';
}
}
// Create the controller
$classname = 'UkmpartandclientController'.$controller;
$controller = new $classname( );
// Perform the Request task
$controller->execute( JRequest::getVar( 'task' ) );
// Redirect if set by the controller
$controller->redirect();
create a file install.sql in the location:com_ukmpartandclient/admin/ which create table in the database when install module and add the following code
DROP TABLE IF EXISTS '#__ukmpartandclient'; CREATE TABLE '#__ukmpartandclient' ( 'id' int(11) NOT NULL auto_increment, 'name' varchar(255) NOT NULL, 'website' varchar(255) NOT NULL, 'address' varchar(255) NOT NULL, 'type' varchar(25) NOT NULL, 'relation' text NOT NULL, 'logo' varchar(255) NOT NULL, PRIMARY KEY ('id') ) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
create a file uninstall.sql in the location:com_ukmpartandclient/admin/ which delete table from the database when uninstall module and add the following code
DROP TABLE IF EXISTS '#__ukmpartandclient';
create a file controller.php in the location:com_ukmpartandclient/admin/ which call models,views(ukmpartandclient) and views call layout or template file from tmpl and add the following code
<?php /** * Parclient World default controller * * @package Joomla.Tutorials * @subpackage Components * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component * @license GNU/GPL */ // No direct access defined( '_JEXEC' ) or die( 'Restricted access' ); jimport('joomla.application.component.controller'); /** * Parclient World Component Controller * * @package Joomla.Tutorials * @subpackage Components */ class UkmpartandclientController extends JController { /** * Method to display the view * * @access public */ function display() { parent::display(); } }Note:Here i can show that controller run default task display and display call default view display and view display call model,JToolBarHelper api,default layout or template
create a file index.html in the location:com_ukmpartandclient/admin/controllers/ and add the following code
<html><body bgcolor="#FFFFFF"></body></html>
create another controller ukmpartandclient.php in the location:com_ukmpartandclient/admin/controllers/ which is called where url patterm ?controller="somename" and add the following code
<?php
/**
* Parclient Controller for Parclient World Component
*
* @package Joomla.Tutorials
* @subpackage Components
* @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_
* @license GNU/GPL
*/
// No direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
/**
* Parclient Parclient Controller
*
* @package Joomla.Tutorials
* @subpackage Components
*/
class UkmpartandclientControllerUkmpartandclient extends UkmpartandclientController
{
/**
* constructor (registers additional tasks to methods)
* @return void
*/
function __construct()
{
parent::__construct();
$this->registerTask( 'save' ,'save');
$this->registerTask( 'edit' ,'edit');
$this->registerTask( 'create' ,'create');
}
function display()
{
// Set the view and the model
$view = JRequest::getVar( 'view', 'ukmpartandclient' );
$layout = JRequest::getVar( 'layout', 'default' );
$view =& $this->getView( $view, 'html' );
$model =& $this->getModel( 'ukmpartandclient' );
$view->setModel( $model, true );
$view->setLayout( $layout );
// Display the revue
$view->display();
}
function create()
{
JRequest::setVar( 'view', 'ukmpartandclient' );
JRequest::setVar( 'layout', 'create' );
parent::display();
}
function edit()
{
JRequest::setVar( 'view', 'ukmpartandclient' );
JRequest::setVar( 'layout', 'form' );
JRequest::setVar('hidemainmenu', 1);
parent::display();
}
/**
* save a record (and redirect to main page)
* @return void
*/
function save()
{
$model = $this->getModel('ukmpartandclient');
if ($model->store($post)) {
$msg = JText::_( 'Name Saved!' );
} else {
$msg = JText::_( 'Error Saving Name' );
}
// Check the table in so it can be edited.... we are done with it anyway
$link = 'index.php?option=com_ukmpartandclient';
$this->setRedirect($link, $msg);
}
}
create a file index.html in the location:com_ukmpartandclient/admin/models/ and add the following code
<html><body bgcolor="#FFFFFF"></body></html>
create a model ukmpartandclient.php in the location:com_ukmpartandclient/admin/models/ which call table service for fetching table data and add the following code
<?php
/**
* Parclient Model for Parclient World Component
*
* @package Joomla.Tutorials
* @subpackage Components
* @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component
* @license GNU/GPL
*/
// No direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport('joomla.application.component.model');
/**
* Parclient Parclient Model
*
* @package Joomla.Tutorials
* @subpackage Components
*/
class UkmpartandclientModelUkmpartandclient extends JModel
{
/**
* Constructor that retrieves the ID from the request
*
* @access public
* @return void
*/
var $_data;
function __construct()
{
parent::__construct();
$array = JRequest::getVar('cid', 0, '', 'array');
$this->setId((int)$array[0]);
}
/**
* Method to set the parclient identifier
*
* @access public
* @param int Parclient identifier
* @return void
*/
function setId($id)
{
// Set id and wipe data
$this->_id = $id;
$this->_data = null;
}
/**
* Method to get a parclient
* @return object with data
*/
function &getData()
{
// Load the data
if (empty( $this->_data )) {
$query = ' SELECT * FROM #__ukmpartandclient'.
' WHERE id = '.$this->_id;
$this->_db->setQuery( $query );
$this->_data = $this->_db->loadObject();
}
if (!$this->_data) {
$this->_data = new stdClass();
$this->_data->id = 0;
$this->_data->name = null;
}
return $this->_data;
}
/**
* Method to store a record
*
* @access public
* @return boolean True on success
*/
function store()
{
$row =& $this->getTable();
$data = JRequest::get( 'post' );
$file = JRequest::getVar('logo', null, 'files', 'array');
jimport('joomla.filesystem.file');
$filename = JFile::makeSafe($file['name']);
$src = $file['tmp_name'];
$dest = JPATH_SITE .DS . "uploads" . DS . $filename;
//First check if the file has the right extension, we need jpg only
if ( strtolower(JFile::getExt($filename) ) == 'jpg' || strtolower(JFile::getExt($filename) ) == 'jpeg') {
if ( JFile::upload($src, $dest) ) {
//Redirect to a page of your choice
$data['logo'] = $filename;
} else {
//Redirect and throw an error message
}
} else {
//Redirect and notify user file is not right extension
}
// Bind the form fields to the parclient table
if (!$row->bind($data)) {
$this->setError($this->_db->getErrorMsg());
return false;
}
// Make sure the parclient record is valid
if (!$row->check()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
// Store the web link table to the database
if (!$row->store()) {
$this->setError( $row->getErrorMsg() );
return false;
}
return true;
}
/**
* Method to delete record(s)
*
* @access public
* @return boolean True on success
*/
function delete()
{
$cids = JRequest::getVar( 'cid', array(0), 'post', 'array' );
$row =& $this->getTable();
if (count( $cids )) {
foreach($cids as $cid) {
if (!$row->delete( $cid )) {
$this->setError( $row->getErrorMsg() );
return false;
}
}
}
return true;
}
function _buildQuery()
{
$query = ' SELECT * '
. ' FROM #__ukmpartandclient'
;
return $query;
}
/**
* Retrieves the parclient data
* @return array Array of objects containing the data from the database
*/
function getAllData()
{
// Lets load the data if it doesn't already exist
if (empty( $this->_data ))
{
$query = $this->_buildQuery();
$this->_data = $this->_getList( $query );
}
return $this->_data;
}
}
create a file index.html in the location:com_ukmpartandclient/admin/tables/ and add the following code
<html><body bgcolor="#FFFFFF"></body></html>
create a service ukmpartandclient.php in the location:com_ukmpartandclient/admin/tables/ which fetching table data and add the following code
<?php
/**
* Parclient World table class
*
* @package Joomla.Tutorials
* @subpackage Components
* @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component
* @license GNU/GPL
*/
// No direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
/**
* Parclient Table class
*
* @package Joomla.Tutorials
* @subpackage Components
*/
class TableUkmpartandclient extends JTable
{
/**
* Primary Key
*
* @var int
*/
var $id = null;
/**
* @var string
*/
var $name = null;
var $website = null;
var $address = null;
var $type = null;
var $relation = null;
var $logo = null;
/**
* Constructor
*
* @param object Database connector object
*/
function TableUkmpartandclient(& $db) {
parent::__construct('#__ukmpartandclient', 'id', $db);
}
}
create a view view.html.php in the location:com_ukmpartandclient/admin/views/ukmpartandclient/ which may call model,toolbar,layout and add the following code
<?php
/**
* Parclient View for Parclient World Component
*
* @package Joomla.Tutorials
* @subpackage Components
* @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component
* @license GNU/GPL
*/
// No direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.application.component.view' );
/**
* Parclient View
*
* @package Joomla.Tutorials
* @subpackage Components
*/
class UkmpartandclientViewUkmpartandclient extends JView
{
/**
* display method of Parclient view
* @return void
**/
function display($tpl = null)
{
// Get the model
$model =& $this->getModel();
if( $this->getLayout() == 'create' ){
JToolBarHelper::preferences('com_ukmpartandclient');
JToolBarHelper::title( JText::_( 'new ukmpartandclient Manager' ), 'generic.png' );
JToolBarHelper::save('save');
$parclients =null;
}elseif( $this->getLayout() == 'form' ){
JToolBarHelper::preferences('com_ukmpartandclient');
JToolBarHelper::title( JText::_( 'update ukmpartandclient Manager' ), 'generic.png' );
JToolBarHelper::save('save');
$parclients =null;
$parclients = &$model->getData();
$this->assignRef( 'parclient', $parclients );
}else
{
JToolBarHelper::title( JText::_( 'ukmpartandclient Manager' ), 'generic.png' );
JToolBarHelper::preferences('com_ukmpartandclient');
//JToolBarHelper::deleteList();
//JToolBarHelper::editListX();
JToolBarHelper::addNewX('create'); // task
$items = &$model->getAllData();
//print_r($items);die;
$this->assignRef( 'items',$items);
}
parent::display($tpl); // is call for display it's layout
}
}
create a file index.html in the location:com_ukmpartandclient/admin/views/ukmpartandclient/ and add the following code
<html><body bgcolor="#FFFFFF"></body></html>
create latout default.php in the location:com_ukmpartandclient/admin/views/ukmpartandclient/tmpl/ which render html and add the following code
<?php defined('_JEXEC') or die('Restricted access'); ?> <form action="index.php" method="post" name="adminForm"> <div id="editcell"> <table class="adminlist"> <thead> <tr> <th width="5"> <?php echo JText::_( 'ID' ); ?></th> <th width="20"> <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $this->items ); ?>);" /></th> <th> <?php echo JText::_( 'Name' ); ?></th> <th> <?php echo JText::_( 'Website' ); ?></th> <th> <?php echo JText::_( 'Address' ); ?></th><th> <?php echo JText::_( 'Type' ); ?></th> <th> <?php echo JText::_( 'Description' ); ?></th> <th> <?php echo JText::_( 'Logo' ); ?></th> </tr> </thead> <?php $k = 0; for ($i=0, $n=count( $this->items ); $i < $n; $i++) { $row = &$this->items[$i]; $checked = JHTML::_('grid.id', $i, $row->id ); $link = JRoute::_( 'index.php?option=com_ukmpartandclient&controller=ukmpartandclient&task=edit&layout=form&cid[]='. $row->id ); ?> <tr class="<?php echo "row$k"; ?>"> <td> <?php echo $row->id; ?></td> <td> <?php echo $checked; ?></td> <td> <a href="<?php echo $link; ?>"><?php echo $row->name; ?></a></td> <td> <?php echo $row->website; ?></td> <td> <?php echo $row->address; ?></td> <td> <?php echo $row->type; ?></td> <td> <?php echo $row->relation; ?></td> <td> <?php echo $row->logo; ?></td> </tr> <?php $k = 1 - $k; } ?> </table> </div> <input type="hidden" name="option" value="com_ukmpartandclient" > <input type="hidden" name="task" value="save" > <input type="hidden" name="boxchecked" value="0" > <input type="hidden" name="controller" value="ukmpartandclient" > </form>
create latout create.php in the location:com_ukmpartandclient/admin/views/ukmpartandclient/tmpl/ which render html and add the following code
<?php defined('_JEXEC') or die('Restricted access'); ?> <form action="index.php" method="POST" name="adminForm" id="adminForm" enctype="multipart/form-data"> <div class="col100"> <fieldset class="adminform"> <legend><?php echo JText::_( 'Details' ); ?></legend> <table class="admintable"> <tr> <td width="100" align="right" class="key"> <label for="name"> <?php echo JText::_( 'Name' ); ?>: </label> </td> <td> <input class="text_area" type="text" name="name" id="name" size="32" maxlength="250" value="" /> </td> </tr> <tr> <td width="100" align="right" class="key"> <label for="website"> <?php echo JText::_( 'Website' ); ?>: </label> </td> <td> <input class="text_area" type="text" name="website" id="website" size="32" maxlength="250" value="" /> </td> </tr> <tr> <td width="100" align="right" class="key"> <label for="address"> <?php echo JText::_( 'Address' ); ?>: </label> </td> <td> <input class="text_area" type="text" name="address" id="address" size="32" maxlength="250" value="" /> </td> </tr> <tr> <td width="100" align="right" class="key"> <label for="type"> <?php echo JText::_( 'Type' ); ?>: </label> </td> <td> <?php $checkedP = ''; $checkedC = ''; ?> <input class="radio-class" type="radio" name="type" value="Partner" <?php print $checkedP ?> />Partner <input class="radio-class" type="radio" name="type" value="Client" <?php print $checkedC ?> />Client </td> </tr> <tr> <td width="100" align="right" class="key"> <label for="relation"> <?php echo JText::_( 'Description' ); ?>: </label> </td> <td> <textarea class="text_area" name="relation" id="relation"></textarea> </td> </tr> <tr> <td width="100" align="right" class="key"> <label for="logo"> <?php echo JText::_( 'Logo' ); ?>: </label> </td> <td> <input type="file" name="logo" id="logo" /> </td> </tr> </table> </fieldset> </div> <div class="clr"></div> <input type="hidden" name="option" value="com_ukmpartandclient" /> <input type="hidden" name="task" value="save" /> <input type="hidden" name="controller" value="ukmpartandclient" /> </form>
create latout form.php in the location:com_ukmpartandclient/admin/views/ukmpartandclient/tmpl/ which render html and add the following code
<?php defined('_JEXEC') or die('Restricted access'); ?> <form action="index.php" method="POST" name="adminForm" id="adminForm" enctype="multipart/form-data"> <div class="col100"> <fieldset class="adminform"> <legend><?php echo JText::_( 'Details' ); ?></legend> <table class="admintable"> <tr> <td width="100" align="right" class="key"> <label for="name"> <?php echo JText::_( 'Name' ); ?>: </label> </td> <td> <input class="text_area" type="text" name="name" id="name" size="32" maxlength="250" value="<?php echo $this->parclient->name;?>" /> </td> </tr> <tr> <td width="100" align="right" class="key"> <label for="website"> <?php echo JText::_( 'Website' ); ?>: </label> </td> <td> <input class="text_area" type="text" name="website" id="website" size="32" maxlength="250" value="<?php echo $this->parclient->website;?>" /> </td> </tr> <tr> <td width="100" align="right" class="key"> <label for="address"> <?php echo JText::_( 'Address' ); ?>: </label> </td> <td> <input class="text_area" type="text" name="address" id="address" size="32" maxlength="250" value="<?php echo $this->parclient->address;?>" /> </td> </tr> <tr> <td width="100" align="right" class="key"> <label for="type"> <?php echo JText::_( 'Type' ); ?>: </label> </td> <td> <?php $checkedP = ''; $checkedC = ''; if($this->parclient->type == 'Partner'){ $checkedP = 'checked=""'; }else{ $checkedC = 'checked=""'; } ?> <input class="radio-class" type="radio" name="type" value="Partner" <?php print $checkedP ?> />Partner <input class="radio-class" type="radio" name="type" value="Client" <?php print $checkedC ?> />Client </td> </tr> <tr> <td width="100" align="right" class="key"> <label for="relation"> <?php echo JText::_( 'Description' ); ?>: </label> </td> <td> <textarea class="text_area" name="relation" id="relation"><?php echo $this->parclient->relation;?></textarea> </td> </tr> <tr> <td width="100" align="right" class="key"> <label for="logo"> <?php echo JText::_( 'Logo' ); ?>: </label> </td> <td> <input type="file" name="logo" id="logo" /> </td> <?php if($this->parclient->logo){?> <td> <img src="<?php echo JURI::root() ."/uploads/".$this->parclient->logo?>" width="100" height="60"/> </td> <?php }?> </tr> </table> </fieldset> </div> <div class="clr"></div> <input type="hidden" name="option" value="com_ukmpartandclient" /> <input type="hidden" name="task" value="save" /> <input type="hidden" name="controller" value="ukmpartandclient" /> </form>
create a file index.html in the location:com_ukmpartandclient/admin/views/ukmpartandclient/tmpl/ and add the following code
<html><body bgcolor="#FFFFFF"></body></html>
create a folder site in the location:com_ukmpartandclient/
create a file index.html in the location:com_ukmpartandclient/site/ and add the following code
<html><body bgcolor="#FFFFFF"></body></html>
create a file ukmpartandclient.php in the location:com_ukmpartandclient/site/ and add the following code
<?php
/**
* Parclient World entry point file for Parclient World Component
*
* @package Joomla.Tutorials
* @subpackage Components
* @link http://dev.joomla.org/component/option,com_jd-wiki/Itemid,31/id,tutorials:components/
* @license GNU/GPL
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
// Require the base controller
require_once (JPATH_COMPONENT.DS.'controller.php');
// Require specific controller if requested
if($controller = JRequest::getVar('controller')) {
require_once (JPATH_COMPONENT.DS.'controllers'.DS.$controller.'.php');
}
// Create the controller
$classname = 'UkmpartandclientController'.$controller;
$controller = new $classname();
// Perform the Request task
$controller->execute( JRequest::getVar('task'));
// Redirect if set by the controller
$controller->redirect();
?>
create a file controller.php in the location:com_ukmpartandclient/site/ and add the following code
<?php
/**
* Parclient World default controller
*
* @package Joomla.Tutorials
* @subpackage Components
* @link http://dev.joomla.org/component/option,com_jd-wiki/Itemid,31/id,tutorials:components/
* @license GNU/GPL
*/
jimport('joomla.application.component.controller');
/**
* Parclient World Component Controller
*
* @package ParclientWorld
*/
class UkmpartandclientController extends JController
{
/**
* Method to display the view
*
* @access public
*/
function display()
{
// Set the view and the model
$view = JRequest::getVar( 'view', 'ukmpartandclient' );
$layout = JRequest::getVar( 'layout', 'default' );
$view =& $this->getView( $view, 'html' );
$model =& $this->getModel( 'ukmpartandclient' );
$view->setModel( $model, true );
$view->setLayout( $layout );
// Display the revue
$view->display();
}
}
?>
create a file ukmpartandclient.php in the location:com_ukmpartandclient/site/models/ and add the following code
<?php
/**
* Parclient Model for Parclient World Component
*
* @package Joomla.Tutorials
* @subpackage Components
* @link http://dev.joomla.org/component/option,com_jd-wiki/Itemid,31/id,tutorials:components/
* @license GNU/GPL
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();
jimport( 'joomla.application.component.model' );
/**
* Parclient Model
*
* @package Joomla.Tutorials
* @subpackage Components
*/
class UkmpartandclientModelUkmpartandclient extends JModel
{
var $_total = null;
var $_pagination = null;
var $_pageResult = null;
function __construct()
{
parent::__construct();
global $mainframe, $option;
// Get pagination request variables
$limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
$limit = 2;
$limitstart = JRequest::getVar('limitstart', 0, '', 'int');
// In case limit has been changed, adjust it
$limitstart = ($limit != 0 ? (floor($limitstart / $limit) * $limit) : 0);
$this->setState('limit', $limit);
$this->setState('limitstart', $limitstart);
}
/**
* Gets the name
* @return string The name to be displayed to the user
*/
function getName()
{
$db =& JFactory::getDBO();
$query = 'SELECT name FROM #__ukmpartandclient';
$db->setQuery( $query);
$name = $db->loadResult();
return $name;
}
/**
* Get the partners and clients
*
* @return object
*/
function getParclients()
{
$db =& $this->getDBO();
$table = $db->nameQuote( '#__ukmpartandclient' );
$query = "SELECT * FROM " . $table;
$this->_parclients = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit'));
// Return the revue data
return $this->_parclients;
}
function getTotal($type)
{
// Load the content if it doesn't already exist
if (empty($this->_total)) {
$db =& $this->getDBO();
$table = $db->nameQuote( '#__ukmpartandclient' );
if($type){
$filterPartner = $db->nameQuote('type');
$filterPartnerValue = $db->Quote($type);
$query = "SELECT * FROM " . $table .' WHERE '. $filterPartner . '=' . $filterPartnerValue;
}else{
$query = "SELECT * FROM " . $table;
}
$this->_total = $this->_getListCount($query);
}
return $this->_total;
}
function getPagination()
{
// Load the content if it doesn't already exist
if (empty($this->_pagination)) {
jimport('joomla.html.pagination');
$this->_pagination = new JPagination($this->getTotal(null), $this->getState('limitstart'), $this->getState('limit') );
}
return $this->_pagination;
}
function getPaginationPartner(){
if (empty($this->_pagination)) {
jimport('joomla.html.pagination');
$this->_pagination = new JPagination($this->getTotal('Partner'), $this->getState('limitstart'), $this->getState('limit') );
}
return $this->_pagination;
}
function getPaginationClient(){
if (empty($this->_pagination)) {
jimport('joomla.html.pagination');
$this->_pagination = new JPagination($this->getTotal('Client'), $this->getState('limitstart'), $this->getState('limit') );
}
return $this->_pagination;
}
function getPartners(){
$db =& $this->getDBO();
$table = $db->nameQuote( '#__ukmpartandclient' );
$filterPartner = $db->nameQuote('type');
$filterPartnerValue = $db->Quote('Partner');
$query = "SELECT * FROM " . $table . ' WHERE '. $filterPartner . '=' . $filterPartnerValue;
//$db->setQuery( $query );
$this->_parclients = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit'));
//$this->_parclients = $db->loadObjectList();
return $this->_parclients;
}
function getClients(){
$db =& $this->getDBO();
$table = $db->nameQuote( '#__ukmpartandclient' );
$filterPartner = $db->nameQuote('type');
$filterPartnerValue = $db->Quote('Client');
$query = "SELECT * FROM " . $table . ' WHERE '. $filterPartner . '=' . $filterPartnerValue;
$db->setQuery( $query );
$this->_parclients = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit'));
return $this->_parclients;
}
}
create a file index.html in the location:com_ukmpartandclient/site/models/ and add the following code
<html><body bgcolor="#FFFFFF"></body></html>
create a file index.html in the location:com_ukmpartandclient/site/views/ and add the following code
<html><body bgcolor="#FFFFFF"></body></html>
create a file index.html in the location:com_ukmpartandclient/site/views/ukmpartandclient/ and add the following code
<html><body bgcolor="#FFFFFF"></body></html>
create a file view.html.php in the location:com_ukmpartandclient/site/views/ukmpartandclient/ and add the following code
<?php
/**
* Parclient View for Parclient World Component
*
* @package Joomla.Tutorials
* @subpackage Components
* @link http://dev.joomla.org/component/option,com_jd-wiki/Itemid,31/id,tutorials:components/
* @license GNU/GPL
*/
jimport( 'joomla.application.component.view');
/**
* HTML View class for the ParclientWorld Component
*
* @package Joomla.Tutorials
* @subpackage Components
*/
class UkmpartandclientViewUkmpartandclient extends JView
{
function display($tpl = null)
{
// Get the model
$model =& $this->getModel();
if( $this->getLayout() == 'list' )
{
// Get all of the revues
$parclients = $model->getParclients();
$this->assignRef( 'parclients', $parclients );
$pagination =& $this->get('Pagination');
$this->assignRef('pagination', $pagination);
}
elseif( $this->getLayout() == 'plist' ){
$parclients = $model->getPartners();
$this->assignRef( 'parclients', $parclients );
$pagination =& $this->get('PaginationPartner');
$this->assignRef('pagination', $pagination);
}
elseif( $this->getLayout() == 'clist' ){
$parclients = $model->getClients();
$this->assignRef( 'parclients', $parclients );
$pagination =& $this->get('PaginationClient');
$this->assignRef('pagination', $pagination);
}
else
{
$name = $this->get( 'Name' );
$this->assignRef( 'name', $name );
}
parent::display($tpl);
}
}
?>
create a file index.html in the location:com_ukmpartandclient/site/views/ukmpartandclient/tmpl/ and add the following code
<html><body bgcolor="#FFFFFF"></body></html>
create a file parclient.css in the location:com_ukmpartandclient/site/views/ukmpartandclient/tmpl/ and add the following code
root { display: block; } .parclient-page a,.parclient-page span{ margin-left:10px; } .parclient-page .counter{ margin-left:20px; } .parclient-page .limit{ display:none; } .parclient{ margin-top:15px; padding-left:10px; width:100%; } .parclient .clear{ clear:both; } .parclient-info{ width:55%; float:left; } .parclient-info h2{ color: #000; text-align:left; font-weight:bold; font-size:15px; margin:0; } .parclient-link{ background:none repeat scroll 0 0 #999999; font-weight:bold; height:20px; padding-top:5px; text-align:center; text-transform:uppercase; width:70px; } .parclient-description{ } .parclient-address{ } .parclient-image{ width:40%; float:right; border-left: 1px dashed rgb(102, 102, 102); } .parclient-href{ padding-left:20px; }
create a file default.php in the location:com_ukmpartandclient/site/views/ukmpartandclient/tmpl/ and add the following code
<?php // no direct access defined('_JEXEC') or die('Restricted access'); ?> <h1><?php echo $this->name; ?></h1>
create a file clist.php in the location:com_ukmpartandclient/site/views/ukmpartandclient/tmpl/ and add the following code
<?php /* * To change this template, choose Tools | Templates * and open the template in the editor. */ defined('_JEXEC') or die(); $document = JFactory::getDocument(); $document->addStyleSheet(JURI::root(true).'/components/com_parclient/views/parclient/tmpl/parclient.css'); foreach($this->parclients as $pc){ $weblink = $pc->website; ?> <div class="parclient-<?php print $pc->id ?> parclient"> <h3><?php print $pc->name?></h3> <div class="parclient-info"> <div class="parclient-description"> <p><?php print $pc->relation?></p> </div> </div> <div class="parclient-image"> <a href="<?php print $pc->website?>" class="parclient-href"><img src="<?php echo JURI::root() ."/uploads/".$pc->logo?>"/></a> </div> <div class="clear"></div> <div class="parclient-link"> <a target="_blank" href="<?php print $weblink; ?>">Visit site</a> </div> </div> <?php } ?> <div class="parclient-page"> <?php echo $this->pagination->getListFooter(); ?> </div>
create a file plist.php in the location:com_ukmpartandclient/site/views/ukmpartandclient/tmpl/ and add the following code
<?php /* * To change this template, choose Tools | Templates * and open the template in the editor. */ defined('_JEXEC') or die(); $document = JFactory::getDocument(); $document->addStyleSheet(JURI::root(true).'/components/com_parclient/views/parclient/tmpl/parclient.css'); foreach($this->parclients as $pc){ $weblink = $pc->website; ?> <div class="parclient-<?php print $pc->id ?> parclient"> <h3><?php print $pc->name?></h3> <div class="parclient-info"> <div class="parclient-description"> <p><?php print $pc->relation?></p> </div> </div> <div class="parclient-image"> <a href="<?php print $pc->website?>" class="parclient-href"><img src="<?php echo JURI::root() ."/uploads/".$pc->logo?>"/></a> </div> <div class="clear"></div> <div class="parclient-link"> <a target="_blank" href="<?php print $weblink; ?>">Visit site</a> </div> </div> <?php } ?> <div class="parclient-page"> <?php echo $this->pagination->getListFooter(); ?> </div>
create a file list.php in the location:com_ukmpartandclient/site/views/ukmpartandclient/tmpl/ and add the following code
<?php /* * To change this template, choose Tools | Templates * and open the template in the editor. */ defined('_JEXEC') or die(); foreach($this->parclients as $pc){ ?> <div class="parclient-<?php print $pc->id ?>"> <div class="parclient-info"> <h2>name?></h2> <div class="parclient-description"> <?php print $pc->relation?> </div> <div class="parclient-address"> <?php print $pc->address ?> </div> </div> <div class="parclient-image"> <a href="website?>" class="parclient-href"><img src="logo?>" width="100" height="60"/></a> </div> </div> <?php } ?> <?php echo $this->pagination->getListFooter(); ?>
Total : 26654
Today :3
Today Visit Country :