/** * Override JController 1) Remove creation of JModel; 2) Give prefix as %ComponentName%View. */ public function display($cachable = false) { $document =& JFactory::getDocument(); $viewType = $document->getType(); $viewName = JRequest::getCmd('view', $this->getName()); $viewLayout = JRequest::getCmd('layout', null); if ($viewLayout === null) { $viewLayout = 'index'; JRequest::setVar('layout', 'index'); } $component_name = JofeComponent::parseComponentName($this); $prefix = ucwords($component_name) . 'View'; $view =& $this->getView($viewName, $viewType, $prefix, array('base_path' => $this->_basePath)); // Set the layout $view->setLayout($viewLayout); // Display the view if ($cachable && $viewType != 'feed') { global $option; $cache =& JFactory::getCache($option, 'view'); $cache->get($view, 'display'); } else { $view->display(); } }
public function getComponent() { return JofeApplication::getComponent(JofeComponent::parseComponentName($this)); }
public function getTablePrefix() { return ucwords(JofeComponent::parseComponentName($this)) . 'Table'; }
/** * Override this function if join tables. * * By default it finds the JTable that maps to the same resource as the model. * Assume class name of JTable is in format $ComponentName$Table$TableName$ */ function _listFrom() { // To be overrided if join tables $tbl =& JTable::getInstance($this->_table_name, ucwords(JofeComponent::parseComponentName($this)) . 'Table'); if ($tbl) { return 'FROM ' . $tbl->getTableName(); } else { JError::raiseError('500', '_listFrom function is not overrided and can not get JTable associated with the model ' . get_class($this)); } }