Major code formate to try and set a standared. Added four new fields for JavaScript files
This commit is contained in:
@ -105,10 +105,10 @@ class ###Component###Controller###View### extends JControllerForm
|
||||
{
|
||||
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid;
|
||||
}
|
||||
elseif ($ref)
|
||||
{
|
||||
elseif ($ref)
|
||||
{
|
||||
$append .= '&ref='.(string)$ref;
|
||||
}
|
||||
}
|
||||
|
||||
if ($tmpl)
|
||||
{
|
||||
@ -220,11 +220,11 @@ class ###Component###Controller###View### extends JControllerForm
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
if ($this->ref || $this->refid)
|
||||
{
|
||||
// to make sure the item is checkedin on redirect
|
||||
$this->task = 'save';
|
||||
}
|
||||
if ($this->ref || $this->refid)
|
||||
{
|
||||
// to make sure the item is checkedin on redirect
|
||||
$this->task = 'save';
|
||||
}
|
||||
|
||||
$saved = parent::save($key, $urlVar);
|
||||
|
||||
|
@ -102,13 +102,13 @@ class ###Component###Controller###View### extends JControllerForm
|
||||
$append = '';
|
||||
|
||||
if ($refid)
|
||||
{
|
||||
{
|
||||
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid;
|
||||
}
|
||||
elseif ($ref)
|
||||
{
|
||||
elseif ($ref)
|
||||
{
|
||||
$append .= '&ref='.(string)$ref;
|
||||
}
|
||||
}
|
||||
|
||||
if ($tmpl)
|
||||
{
|
||||
@ -220,11 +220,11 @@ class ###Component###Controller###View### extends JControllerForm
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
if ($this->ref || $this->refid)
|
||||
{
|
||||
// to make sure the item is checkedin on redirect
|
||||
$this->task = 'save';
|
||||
}
|
||||
if ($this->ref || $this->refid)
|
||||
{
|
||||
// to make sure the item is checkedin on redirect
|
||||
$this->task = 'save';
|
||||
}
|
||||
|
||||
$saved = parent::save($key, $urlVar);
|
||||
|
||||
|
@ -42,7 +42,7 @@ class ###Component###Controller extends JControllerLegacy
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function display($cachable = false, $urlparams = false)
|
||||
function display($cachable = false, $urlparams = false)
|
||||
{
|
||||
// set default view if not set
|
||||
$view = $this->input->getCmd('view', '###Component###');
|
||||
@ -51,58 +51,58 @@ class ###Component###Controller extends JControllerLegacy
|
||||
$id = $this->input->getInt('id');
|
||||
|
||||
// Check for edit form.
|
||||
if(###Component###Helper::checkArray($data))
|
||||
{
|
||||
if ($data['edit'] && $layout == 'edit' && !$this->checkEditId('com_###component###.edit.'.$data['view'], $id))
|
||||
{
|
||||
// Somehow the person just went to the form - we don't allow that.
|
||||
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
|
||||
$this->setMessage($this->getError(), 'error');
|
||||
// check if item was opend from other then its own list view
|
||||
$ref = $this->input->getCmd('ref', 0);
|
||||
$refid = $this->input->getInt('refid', 0);
|
||||
// set redirect
|
||||
if ($refid > 0 && ###Component###Helper::checkString($ref))
|
||||
{
|
||||
// redirect to item of ref
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_###component###&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false));
|
||||
}
|
||||
elseif (###Component###Helper::checkString($ref))
|
||||
{
|
||||
if(###Component###Helper::checkArray($data))
|
||||
{
|
||||
if ($data['edit'] && $layout == 'edit' && !$this->checkEditId('com_###component###.edit.'.$data['view'], $id))
|
||||
{
|
||||
// Somehow the person just went to the form - we don't allow that.
|
||||
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
|
||||
$this->setMessage($this->getError(), 'error');
|
||||
// check if item was opend from other then its own list view
|
||||
$ref = $this->input->getCmd('ref', 0);
|
||||
$refid = $this->input->getInt('refid', 0);
|
||||
// set redirect
|
||||
if ($refid > 0 && ###Component###Helper::checkString($ref))
|
||||
{
|
||||
// redirect to item of ref
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_###component###&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false));
|
||||
}
|
||||
elseif (###Component###Helper::checkString($ref))
|
||||
{
|
||||
|
||||
// redirect to ref
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_###component###&view='.(string)$ref, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
// normal redirect back to the list view
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_###component###&view='.$data['views'], false));
|
||||
}
|
||||
// redirect to ref
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_###component###&view='.(string)$ref, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
// normal redirect back to the list view
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_###component###&view='.$data['views'], false));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return parent::display($cachable, $urlparams);
|
||||
}
|
||||
|
||||
protected function getViewRelation($view)
|
||||
{
|
||||
if (###Component###Helper::checkString($view))
|
||||
{
|
||||
$views = array(###VIEWARRAY###
|
||||
);
|
||||
// check if this is a list view
|
||||
if (in_array($view,$views))
|
||||
{
|
||||
return array('edit' => false, 'view' => array_search($view,$views), 'views' => $view);
|
||||
}
|
||||
// check if it is an edit view
|
||||
elseif (array_key_exists($view,$views))
|
||||
{
|
||||
return array('edit' => true, 'view' => $view, 'views' => $views[$view]);
|
||||
}
|
||||
}
|
||||
if (###Component###Helper::checkString($view))
|
||||
{
|
||||
$views = array(###VIEWARRAY###
|
||||
);
|
||||
// check if this is a list view
|
||||
if (in_array($view,$views))
|
||||
{
|
||||
return array('edit' => false, 'view' => array_search($view,$views), 'views' => $view);
|
||||
}
|
||||
// check if it is an edit view
|
||||
elseif (array_key_exists($view,$views))
|
||||
{
|
||||
return array('edit' => true, 'view' => $view, 'views' => $views[$view]);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -55,20 +55,20 @@ class ###Component###ControllerAjax extends JControllerLegacy
|
||||
$token = JSession::getFormToken();
|
||||
$call_token = $jinput->get('token', 0, 'ALNUM');
|
||||
if($token == $call_token)
|
||||
{
|
||||
{
|
||||
$task = $this->getTask();
|
||||
switch($task)
|
||||
{###AJAX_INPUT_RETURN###
|
||||
{###AJAX_INPUT_RETURN###
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else
|
||||
{
|
||||
if($callback = $jinput->get('callback', null, 'CMD'))
|
||||
{
|
||||
{
|
||||
echo $callback."(".json_encode(false).");";
|
||||
}
|
||||
else
|
||||
{
|
||||
else
|
||||
{
|
||||
echo "(".json_encode(false).");";
|
||||
}
|
||||
}
|
||||
|
@ -55,20 +55,20 @@ class ###Component###ControllerAjax extends JControllerLegacy
|
||||
$token = JSession::getFormToken();
|
||||
$call_token = $jinput->get('token', 0, 'ALNUM');
|
||||
if($token == $call_token)
|
||||
{
|
||||
{
|
||||
$task = $this->getTask();
|
||||
switch($task)
|
||||
{###AJAX_SITE_INPUT_RETURN###
|
||||
{###AJAX_SITE_INPUT_RETURN###
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else
|
||||
{
|
||||
if($callback = $jinput->get('callback', null, 'CMD'))
|
||||
{
|
||||
{
|
||||
echo $callback."(".json_encode(false).");";
|
||||
}
|
||||
else
|
||||
{
|
||||
else
|
||||
{
|
||||
echo "(".json_encode(false).");";
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,8 @@ class ###Component###ControllerHelp extends JControllerLegacy
|
||||
// Check Token!
|
||||
$token = JSession::getFormToken();
|
||||
$call_token = $jinput->get('token', 0, 'ALNUM');
|
||||
if($user->id != 0 && $token == $call_token){
|
||||
if($user->id != 0 && $token == $call_token)
|
||||
{
|
||||
$task = $this->getTask();
|
||||
switch($task){
|
||||
case 'getText':
|
||||
@ -67,25 +68,25 @@ class ###Component###ControllerHelp extends JControllerLegacy
|
||||
$result = '';
|
||||
}
|
||||
echo $result;
|
||||
// stop execution gracefully
|
||||
jexit();
|
||||
// stop execution gracefully
|
||||
jexit();
|
||||
}
|
||||
catch(Exception $e)
|
||||
catch(Exception $e)
|
||||
{
|
||||
// stop execution gracefully
|
||||
// stop execution gracefully
|
||||
jexit();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// stop execution gracefully
|
||||
else
|
||||
{
|
||||
// stop execution gracefully
|
||||
jexit();
|
||||
}
|
||||
}
|
||||
|
||||
protected function getHelpDocumentText($id)
|
||||
protected function getHelpDocumentText($id)
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
|
@ -51,7 +51,8 @@ class ###Component###ControllerHelp extends JControllerLegacy
|
||||
// Check Token!
|
||||
$token = JSession::getFormToken();
|
||||
$call_token = $jinput->get('token', 0, 'ALNUM');
|
||||
if($token == $call_token){
|
||||
if($token == $call_token)
|
||||
{
|
||||
$task = $this->getTask();
|
||||
switch($task){
|
||||
case 'getText':
|
||||
@ -67,25 +68,25 @@ class ###Component###ControllerHelp extends JControllerLegacy
|
||||
$result = '';
|
||||
}
|
||||
echo $result;
|
||||
// stop execution gracefully
|
||||
jexit();
|
||||
// stop execution gracefully
|
||||
jexit();
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
// stop execution gracefully
|
||||
// stop execution gracefully
|
||||
jexit();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// stop execution gracefully
|
||||
else
|
||||
{
|
||||
// stop execution gracefully
|
||||
jexit();
|
||||
}
|
||||
}
|
||||
|
||||
protected function getHelpDocumentText($id)
|
||||
protected function getHelpDocumentText($id)
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
|
@ -42,18 +42,18 @@ class ###Component###Controller extends JControllerLegacy
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function display($cachable = false, $urlparams = false)
|
||||
function display($cachable = false, $urlparams = false)
|
||||
{
|
||||
// set default view if not set
|
||||
$view = $this->input->getCmd('view', '###SITE_DEFAULT_VIEW###');
|
||||
$isEdit = $this->checkEditView($view);
|
||||
$layout = $this->input->get('layout', null, 'WORD');
|
||||
$id = $this->input->getInt('id');
|
||||
$id = $this->input->getInt('id');
|
||||
$cachable = true;
|
||||
|
||||
// Check for edit form.
|
||||
if($isEdit)
|
||||
{
|
||||
if($isEdit)
|
||||
{
|
||||
if ($layout == 'edit' && !$this->checkEditId('com_###component###.edit.'.$view, $id))
|
||||
{
|
||||
// Somehow the person just went to the form - we don't allow that.
|
||||
@ -70,7 +70,6 @@ class ###Component###Controller extends JControllerLegacy
|
||||
}
|
||||
elseif (###Component###Helper::checkString($ref))
|
||||
{
|
||||
|
||||
// redirect to ref
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_###component###&view='.(string)$ref, false));
|
||||
}
|
||||
@ -81,23 +80,23 @@ class ###Component###Controller extends JControllerLegacy
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return parent::display($cachable, $urlparams);
|
||||
}
|
||||
|
||||
protected function checkEditView($view)
|
||||
{
|
||||
if (###Component###Helper::checkString($view))
|
||||
{
|
||||
$views = array(###SITE_EDIT_VIEW_ARRAY###
|
||||
);
|
||||
// check if this is a edit view
|
||||
if (in_array($view,$views))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (###Component###Helper::checkString($view))
|
||||
{
|
||||
$views = array(###SITE_EDIT_VIEW_ARRAY###
|
||||
);
|
||||
// check if this is a edit view
|
||||
if (in_array($view,$views))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ class ###Component###Controller###SView### extends JControllerLegacy
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
public function dashboard()
|
||||
public function dashboard()
|
||||
{
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_###component###', false));
|
||||
return;
|
||||
|
@ -37,16 +37,16 @@ jimport('joomla.application.component.modellist');
|
||||
*/
|
||||
class ###Component###Model###SViews### extends JModelList
|
||||
{
|
||||
/**
|
||||
/**
|
||||
* Model user data.
|
||||
*
|
||||
* @var strings
|
||||
* @var strings
|
||||
*/
|
||||
protected $user;
|
||||
protected $userId;
|
||||
protected $guest;
|
||||
protected $groups;
|
||||
protected $levels;
|
||||
protected $user;
|
||||
protected $userId;
|
||||
protected $guest;
|
||||
protected $groups;
|
||||
protected $levels;
|
||||
protected $app;
|
||||
protected $input;
|
||||
protected $uikitComp;
|
||||
@ -58,14 +58,14 @@ class ###Component###Model###SViews### extends JModelList
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
// Get the current user for authorisation checks
|
||||
$this->user = JFactory::getUser();
|
||||
// Get the current user for authorisation checks
|
||||
$this->user = JFactory::getUser();
|
||||
$this->userId = $this->user->get('id');
|
||||
$this->guest = $this->user->get('guest');
|
||||
$this->groups = $this->user->get('groups');
|
||||
$this->authorisedGroups = $this->user->getAuthorisedGroups();
|
||||
$this->groups = $this->user->get('groups');
|
||||
$this->authorisedGroups = $this->user->getAuthorisedGroups();
|
||||
$this->levels = $this->user->getAuthorisedViewLevels();
|
||||
$this->app = JFactory::getApplication();
|
||||
$this->app = JFactory::getApplication();
|
||||
$this->input = $this->app->input;
|
||||
$this->initSet = true; ###CUSTOM_ADMIN_GET_LIST_QUERY###
|
||||
}
|
||||
@ -77,16 +77,16 @@ class ###Component###Model###SViews### extends JModelList
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
// check if this user has permission to access items
|
||||
if (!$user->authorise('###sviews###.access', 'com_###component###'))
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
// check if this user has permission to access items
|
||||
if (!$user->authorise('###sviews###.access', 'com_###component###'))
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$app->enqueueMessage(JText::_('Not authorised!'), 'error');
|
||||
// redirect away if not a correct (TODO for now we go to default view)
|
||||
$app->redirect('index.php?option=com_###component###');
|
||||
return false;
|
||||
}###LICENSE_LOCKED_CHECK### ###CUSTOM_ADMIN_BEFORE_GET_ITEMS###
|
||||
}###LICENSE_LOCKED_CHECK### ###CUSTOM_ADMIN_BEFORE_GET_ITEMS###
|
||||
// load parent items
|
||||
$items = parent::getItems();
|
||||
|
||||
|
@ -59,13 +59,13 @@ class ###Component###Model###SViews### extends JModelList
|
||||
protected function getListQuery()
|
||||
{
|
||||
// Get the current user for authorisation checks
|
||||
$this->user = JFactory::getUser();
|
||||
$this->user = JFactory::getUser();
|
||||
$this->userId = $this->user->get('id');
|
||||
$this->guest = $this->user->get('guest');
|
||||
$this->groups = $this->user->get('groups');
|
||||
$this->authorisedGroups = $this->user->getAuthorisedGroups();
|
||||
$this->groups = $this->user->get('groups');
|
||||
$this->authorisedGroups = $this->user->getAuthorisedGroups();
|
||||
$this->levels = $this->user->getAuthorisedViewLevels();
|
||||
$this->app = JFactory::getApplication();
|
||||
$this->app = JFactory::getApplication();
|
||||
$this->input = $this->app->input;
|
||||
$this->initSet = true; ###SITE_GET_LIST_QUERY###
|
||||
}
|
||||
|
@ -40,24 +40,24 @@ class ###Component###View###SView### extends JViewLegacy
|
||||
// Overwriting JView display method
|
||||
function display($tpl = null)
|
||||
{
|
||||
// get component params
|
||||
// get component params
|
||||
$this->params = JComponentHelper::getParams('com_###component###');
|
||||
// get the application
|
||||
$this->app = JFactory::getApplication();
|
||||
// get the user object
|
||||
$this->user = JFactory::getUser();
|
||||
// get global action permissions
|
||||
// get global action permissions
|
||||
$this->canDo = ###Component###Helper::getActions('###sview###');###CUSTOM_ADMIN_DIPLAY_METHOD###
|
||||
}###CUSTOM_ADMIN_EXTRA_DIPLAY_METHODS###
|
||||
|
||||
/**
|
||||
/**
|
||||
* Prepares the document
|
||||
*/
|
||||
protected function setDocument()
|
||||
{###CUSTOM_ADMIN_LIBRARIES_LOADER### ###CUSTOM_ADMIN_DOCUMENT_METADATA### ###CUSTOM_ADMIN_UIKIT_LOADER### ###CUSTOM_ADMIN_GOOGLECHART_LOADER### ###CUSTOM_ADMIN_FOOTABLE_LOADER### ###CUSTOM_ADMIN_DOCUMENT_CUSTOM_PHP###
|
||||
// add the document default css file
|
||||
// add the document default css file
|
||||
$this->document->addStyleSheet(JURI::root(true) .'/administrator/components/com_###component###/assets/css/###sview###.css');###CUSTOM_ADMIN_DOCUMENT_CUSTOM_CSS### ###CUSTOM_ADMIN_DOCUMENT_CUSTOM_JS###
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting the toolbar
|
||||
@ -78,26 +78,26 @@ class ###Component###View###SView### extends JViewLegacy
|
||||
}
|
||||
// add title to the page
|
||||
JToolbarHelper::title($title,'###ICOMOON###');
|
||||
// add the back button
|
||||
// JToolBarHelper::custom('###sview###.back', 'undo-2', '', 'COM_###COMPONENT###_BACK', false);
|
||||
// add cpanel button
|
||||
// add the back button
|
||||
// JToolBarHelper::custom('###sview###.back', 'undo-2', '', 'COM_###COMPONENT###_BACK', false);
|
||||
// add cpanel button
|
||||
JToolBarHelper::custom('###sview###.dashboard', 'grid-2', '', 'COM_###COMPONENT###_DASH', false);###CUSTOM_ADMIN_CUSTOM_BUTTONS###
|
||||
|
||||
// set help url for this view if found
|
||||
$help_url = ###Component###Helper::getHelpUrl('###sviews###');
|
||||
if (###Component###Helper::checkString($help_url))
|
||||
{
|
||||
$help_url = ###Component###Helper::getHelpUrl('###sviews###');
|
||||
if (###Component###Helper::checkString($help_url))
|
||||
{
|
||||
JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $help_url);
|
||||
}
|
||||
}
|
||||
|
||||
// add the options comp button
|
||||
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
|
||||
// add the options comp button
|
||||
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
|
||||
{
|
||||
JToolBarHelper::preferences('com_###component###');
|
||||
}
|
||||
}###CUSTOM_ADMIN_GET_MODULE###
|
||||
|
||||
/**
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
@ -106,8 +106,8 @@ class ###Component###View###SView### extends JViewLegacy
|
||||
*/
|
||||
public function escape($var)
|
||||
{
|
||||
// use the helper htmlEscape method instead.
|
||||
// use the helper htmlEscape method instead.
|
||||
return ###Component###Helper::htmlEscape($var, $this->_charset);
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
@ -56,15 +56,15 @@ class ###Component###View###View### extends JViewLegacy
|
||||
$this->refid = $jinput->get('refid', 0, 'int');
|
||||
$this->referral = '';
|
||||
if ($this->refid)
|
||||
{
|
||||
// return to the item that refered to this item
|
||||
$this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid;
|
||||
}
|
||||
elseif($this->ref)
|
||||
{
|
||||
// return to the list view that refered to this item
|
||||
$this->referral = '&ref='.(string)$this->ref;
|
||||
}###LINKEDVIEWITEMS###
|
||||
{
|
||||
// return to the item that refered to this item
|
||||
$this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid;
|
||||
}
|
||||
elseif($this->ref)
|
||||
{
|
||||
// return to the list view that refered to this item
|
||||
$this->referral = '&ref='.(string)$this->ref;
|
||||
}###LINKEDVIEWITEMS###
|
||||
|
||||
// Set the toolbar
|
||||
$this->addToolBar();
|
||||
@ -91,7 +91,7 @@ class ###Component###View###View### extends JViewLegacy
|
||||
###ADDTOOLBAR###
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
@ -105,7 +105,7 @@ class ###Component###View###View### extends JViewLegacy
|
||||
// use the helper htmlEscape method instead and shorten the string
|
||||
return ###Component###Helper::htmlEscape($var, $this->_charset, true, 30);
|
||||
}
|
||||
// use the helper htmlEscape method instead.
|
||||
// use the helper htmlEscape method instead.
|
||||
return ###Component###Helper::htmlEscape($var, $this->_charset);
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ class ###Component###View###View### extends JViewLegacy
|
||||
$this->item = $this->get('Item');
|
||||
$this->script = $this->get('Script');
|
||||
$this->state = $this->get('State');
|
||||
// get action permissions
|
||||
// get action permissions
|
||||
$this->canDo = ###Component###Helper::getActions('###view###',$this->item);
|
||||
// get input
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
@ -56,15 +56,15 @@ class ###Component###View###View### extends JViewLegacy
|
||||
$this->refid = $jinput->get('refid', 0, 'int');
|
||||
$this->referral = '';
|
||||
if ($this->refid)
|
||||
{
|
||||
// return to the item that refered to this item
|
||||
$this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid;
|
||||
}
|
||||
elseif($this->ref)
|
||||
{
|
||||
// return to the list view that refered to this item
|
||||
$this->referral = '&ref='.(string)$this->ref;
|
||||
}###LINKEDVIEWITEMS###
|
||||
{
|
||||
// return to the item that refered to this item
|
||||
$this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid;
|
||||
}
|
||||
elseif($this->ref)
|
||||
{
|
||||
// return to the list view that refered to this item
|
||||
$this->referral = '&ref='.(string)$this->ref;
|
||||
}###LINKEDVIEWITEMS###
|
||||
|
||||
// Set the toolbar
|
||||
$this->addToolBar();
|
||||
@ -95,7 +95,7 @@ class ###Component###View###View### extends JViewLegacy
|
||||
$this->toolbar = JToolbar::getInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
@ -109,7 +109,7 @@ class ###Component###View###View### extends JViewLegacy
|
||||
// use the helper htmlEscape method instead and shorten the string
|
||||
return ###Component###Helper::htmlEscape($var, $this->_charset, true, 30);
|
||||
}
|
||||
// use the helper htmlEscape method instead.
|
||||
// use the helper htmlEscape method instead.
|
||||
return ###Component###Helper::htmlEscape($var, $this->_charset);
|
||||
}
|
||||
|
||||
|
@ -104,10 +104,10 @@ class ###Component###ViewImport extends JViewLegacy
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
$help_url = ###Component###Helper::getHelpUrl('import');
|
||||
if (###Component###Helper::checkString($help_url))
|
||||
{
|
||||
JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $help_url);
|
||||
}
|
||||
$help_url = ###Component###Helper::getHelpUrl('import');
|
||||
if (###Component###Helper::checkString($help_url))
|
||||
{
|
||||
JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $help_url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -52,10 +52,10 @@ class ###Component###View###View### extends JViewLegacy
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
$help_url = ###Component###Helper::getHelpUrl('###view###');
|
||||
if (###Component###Helper::checkString($help_url))
|
||||
{
|
||||
JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $help_url);
|
||||
}
|
||||
$help_url = ###Component###Helper::getHelpUrl('###view###');
|
||||
if (###Component###Helper::checkString($help_url))
|
||||
{
|
||||
JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $help_url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,8 +56,7 @@ class ###Component###View###Views### extends JViewLegacy
|
||||
$this->user = JFactory::getUser();
|
||||
$this->listOrder = $this->escape($this->state->get('list.ordering'));
|
||||
$this->listDirn = $this->escape($this->state->get('list.direction'));
|
||||
$this->saveOrder = $this->listOrder == 'ordering';
|
||||
// get global action permissions
|
||||
// get global action permissions
|
||||
$this->canDo = ###Component###Helper::getActions('###view###');###JVIEWLISTCANDO###
|
||||
|
||||
// We don't need toolbar in the modal window.
|
||||
@ -65,11 +64,11 @@ class ###Component###View###Views### extends JViewLegacy
|
||||
{
|
||||
$this->addToolbar();
|
||||
$this->sidebar = JHtmlSidebar::render();
|
||||
// load the batch html
|
||||
if ($this->canCreate && $this->canEdit && $this->canState)
|
||||
{
|
||||
$this->batchDisplay = JHtmlBatch_::render();
|
||||
}
|
||||
// load the batch html
|
||||
if ($this->canCreate && $this->canEdit && $this->canState)
|
||||
{
|
||||
$this->batchDisplay = JHtmlBatch_::render();
|
||||
}
|
||||
}
|
||||
|
||||
// Check for errors.
|
||||
@ -92,86 +91,86 @@ class ###Component###View###Views### extends JViewLegacy
|
||||
{
|
||||
JToolBarHelper::title(JText::_('COM_###COMPONENT###_###VIEWS###'), '###ICOMOON###');
|
||||
JHtmlSidebar::setAction('index.php?option=com_###component###&view=###views###');
|
||||
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
|
||||
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
|
||||
|
||||
if ($this->canCreate)
|
||||
{
|
||||
{
|
||||
JToolBarHelper::addNew('###view###.add');
|
||||
}
|
||||
|
||||
// Only load if there are items
|
||||
if (###Component###Helper::checkArray($this->items))
|
||||
// Only load if there are items
|
||||
if (###Component###Helper::checkArray($this->items))
|
||||
{
|
||||
if ($this->canEdit)
|
||||
{
|
||||
JToolBarHelper::editList('###view###.edit');
|
||||
}
|
||||
if ($this->canEdit)
|
||||
{
|
||||
JToolBarHelper::editList('###view###.edit');
|
||||
}
|
||||
|
||||
if ($this->canState)
|
||||
{
|
||||
JToolBarHelper::publishList('###views###.publish');
|
||||
JToolBarHelper::unpublishList('###views###.unpublish');
|
||||
JToolBarHelper::archiveList('###views###.archive');
|
||||
if ($this->canState)
|
||||
{
|
||||
JToolBarHelper::publishList('###views###.publish');
|
||||
JToolBarHelper::unpublishList('###views###.unpublish');
|
||||
JToolBarHelper::archiveList('###views###.archive');
|
||||
|
||||
if ($this->canDo->get('core.admin'))
|
||||
{
|
||||
JToolBarHelper::checkin('###views###.checkin');
|
||||
}
|
||||
}
|
||||
if ($this->canDo->get('core.admin'))
|
||||
{
|
||||
JToolBarHelper::checkin('###views###.checkin');
|
||||
}
|
||||
}
|
||||
|
||||
// Add a batch button
|
||||
if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState)
|
||||
{
|
||||
// Get the toolbar object instance
|
||||
$bar = JToolBar::getInstance('toolbar');
|
||||
// set the batch button name
|
||||
$title = JText::_('JTOOLBAR_BATCH');
|
||||
// Instantiate a new JLayoutFile instance and render the batch button
|
||||
$layout = new JLayoutFile('joomla.toolbar.batch');
|
||||
// add the button to the page
|
||||
$dhtml = $layout->render(array('title' => $title));
|
||||
$bar->appendButton('Custom', $dhtml, 'batch');
|
||||
}###CUSTOM_ADMIN_DYNAMIC_BUTTONS### ###ADMIN_CUSTOM_BUTTONS_LIST###
|
||||
// Add a batch button
|
||||
if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState)
|
||||
{
|
||||
// Get the toolbar object instance
|
||||
$bar = JToolBar::getInstance('toolbar');
|
||||
// set the batch button name
|
||||
$title = JText::_('JTOOLBAR_BATCH');
|
||||
// Instantiate a new JLayoutFile instance and render the batch button
|
||||
$layout = new JLayoutFile('joomla.toolbar.batch');
|
||||
// add the button to the page
|
||||
$dhtml = $layout->render(array('title' => $title));
|
||||
$bar->appendButton('Custom', $dhtml, 'batch');
|
||||
}###CUSTOM_ADMIN_DYNAMIC_BUTTONS### ###ADMIN_CUSTOM_BUTTONS_LIST###
|
||||
|
||||
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
|
||||
{
|
||||
JToolbarHelper::deleteList('', '###views###.delete', 'JTOOLBAR_EMPTY_TRASH');
|
||||
}
|
||||
elseif ($this->canState && $this->canDelete)
|
||||
{
|
||||
JToolbarHelper::trash('###views###.trash');
|
||||
}###EXPORTBUTTON###
|
||||
}###ADMIN_CUSTOM_FUNCTION_ONLY_BUTTONS_LIST### ###IMPORTBUTTON###
|
||||
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
|
||||
{
|
||||
JToolbarHelper::deleteList('', '###views###.delete', 'JTOOLBAR_EMPTY_TRASH');
|
||||
}
|
||||
elseif ($this->canState && $this->canDelete)
|
||||
{
|
||||
JToolbarHelper::trash('###views###.trash');
|
||||
}###EXPORTBUTTON###
|
||||
}###ADMIN_CUSTOM_FUNCTION_ONLY_BUTTONS_LIST### ###IMPORTBUTTON###
|
||||
|
||||
// set help url for this view if found
|
||||
$help_url = ###Component###Helper::getHelpUrl('###views###');
|
||||
if (###Component###Helper::checkString($help_url))
|
||||
{
|
||||
JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $help_url);
|
||||
}
|
||||
// set help url for this view if found
|
||||
$help_url = ###Component###Helper::getHelpUrl('###views###');
|
||||
if (###Component###Helper::checkString($help_url))
|
||||
{
|
||||
JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $help_url);
|
||||
}
|
||||
|
||||
// add the options comp button
|
||||
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
|
||||
{
|
||||
JToolBarHelper::preferences('com_###component###');
|
||||
}
|
||||
// add the options comp button
|
||||
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
|
||||
{
|
||||
JToolBarHelper::preferences('com_###component###');
|
||||
}
|
||||
|
||||
if ($this->canState)
|
||||
{
|
||||
if ($this->canState)
|
||||
{
|
||||
JHtmlSidebar::addFilter(
|
||||
JText::_('JOPTION_SELECT_PUBLISHED'),
|
||||
'filter_published',
|
||||
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true)
|
||||
);
|
||||
// only load if batch allowed
|
||||
if ($this->canBatch)
|
||||
{
|
||||
JHtmlBatch_::addListSelection(
|
||||
JText::_('COM_###COMPONENT###_KEEP_ORIGINAL_STATE'),
|
||||
'batch[published]',
|
||||
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
|
||||
);
|
||||
}
|
||||
// only load if batch allowed
|
||||
if ($this->canBatch)
|
||||
{
|
||||
JHtmlBatch_::addListSelection(
|
||||
JText::_('COM_###COMPONENT###_KEEP_ORIGINAL_STATE'),
|
||||
'batch[published]',
|
||||
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
JHtmlSidebar::addFilter(
|
||||
@ -183,11 +182,11 @@ class ###Component###View###Views### extends JViewLegacy
|
||||
if ($this->canBatch && $this->canCreate && $this->canEdit)
|
||||
{
|
||||
JHtmlBatch_::addListSelection(
|
||||
JText::_('COM_###COMPONENT###_KEEP_ORIGINAL_ACCESS'),
|
||||
'batch[access]',
|
||||
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text')
|
||||
JText::_('COM_###COMPONENT###_KEEP_ORIGINAL_ACCESS'),
|
||||
'batch[access]',
|
||||
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text')
|
||||
);
|
||||
} ###CATEGORYFILTER### ###OTHERFILTERS###
|
||||
}###CATEGORYFILTER### ###OTHERFILTERS###
|
||||
}
|
||||
|
||||
/**
|
||||
@ -205,7 +204,7 @@ class ###Component###View###Views### extends JViewLegacy
|
||||
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_###component###/assets/css/###views###.css");
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
@ -216,10 +215,10 @@ class ###Component###View###Views### extends JViewLegacy
|
||||
{
|
||||
if(strlen($var) > 50)
|
||||
{
|
||||
// use the helper htmlEscape method instead and shorten the string
|
||||
// use the helper htmlEscape method instead and shorten the string
|
||||
return ###Component###Helper::htmlEscape($var, $this->_charset, true);
|
||||
}
|
||||
// use the helper htmlEscape method instead.
|
||||
// use the helper htmlEscape method instead.
|
||||
return ###Component###Helper::htmlEscape($var, $this->_charset);
|
||||
}
|
||||
|
||||
@ -231,5 +230,5 @@ class ###Component###View###Views### extends JViewLegacy
|
||||
protected function getSortFields()
|
||||
{
|
||||
###SORTFIELDS###
|
||||
} ###FILTERFUNCTIONS###
|
||||
}###FILTERFUNCTIONS###
|
||||
}
|
||||
|
@ -40,24 +40,24 @@ class ###Component###View###SViews### extends JViewLegacy
|
||||
// Overwriting JView display method
|
||||
function display($tpl = null)
|
||||
{
|
||||
// get component params
|
||||
// get component params
|
||||
$this->params = JComponentHelper::getParams('com_###component###');
|
||||
// get the application
|
||||
$this->app = JFactory::getApplication();
|
||||
// get the user object
|
||||
$this->user = JFactory::getUser();
|
||||
// get global action permissions
|
||||
// get global action permissions
|
||||
$this->canDo = ###Component###Helper::getActions('###sview###');###CUSTOM_ADMIN_DIPLAY_METHOD###
|
||||
}###CUSTOM_ADMIN_EXTRA_DIPLAY_METHODS###
|
||||
|
||||
/**
|
||||
/**
|
||||
* Prepares the document
|
||||
*/
|
||||
protected function setDocument()
|
||||
{###CUSTOM_ADMIN_LIBRARIES_LOADER### ###CUSTOM_ADMIN_UIKIT_LOADER### ###CUSTOM_ADMIN_GOOGLECHART_LOADER### ###CUSTOM_ADMIN_FOOTABLE_LOADER### ###CUSTOM_ADMIN_DOCUMENT_CUSTOM_PHP###
|
||||
// add the document default css file
|
||||
// add the document default css file
|
||||
$this->document->addStyleSheet(JURI::root(true) .'/administrator/components/com_###component###/assets/css/###sviews###.css');###CUSTOM_ADMIN_DOCUMENT_CUSTOM_CSS### ###CUSTOM_ADMIN_DOCUMENT_CUSTOM_JS###
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting the toolbar
|
||||
@ -65,29 +65,29 @@ class ###Component###View###SViews### extends JViewLegacy
|
||||
protected function addToolBar()
|
||||
{
|
||||
// hide the main menu
|
||||
$this->app->input->set('hidemainmenu', true);
|
||||
$this->app->input->set('hidemainmenu', true);
|
||||
// add title to the page
|
||||
JToolbarHelper::title(JText::_('COM_###COMPONENT###_###SVIEWS###'),'###ICOMOON###');
|
||||
// add the back button
|
||||
// JToolBarHelper::custom('###sviews###.back', 'undo-2', '', 'COM_###COMPONENT###_BACK', false);
|
||||
// add cpanel button
|
||||
// add the back button
|
||||
// JToolBarHelper::custom('###sviews###.back', 'undo-2', '', 'COM_###COMPONENT###_BACK', false);
|
||||
// add cpanel button
|
||||
JToolBarHelper::custom('###sviews###.dashboard', 'grid-2', '', 'COM_###COMPONENT###_DASH', false);###CUSTOM_ADMIN_CUSTOM_BUTTONS###
|
||||
|
||||
// set help url for this view if found
|
||||
$help_url = ###Component###Helper::getHelpUrl('###sviews###');
|
||||
if (###Component###Helper::checkString($help_url))
|
||||
{
|
||||
JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $help_url);
|
||||
}
|
||||
$help_url = ###Component###Helper::getHelpUrl('###sviews###');
|
||||
if (###Component###Helper::checkString($help_url))
|
||||
{
|
||||
JToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $help_url);
|
||||
}
|
||||
|
||||
// add the options comp button
|
||||
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
|
||||
// add the options comp button
|
||||
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
|
||||
{
|
||||
JToolBarHelper::preferences('com_###component###');
|
||||
}
|
||||
}###CUSTOM_ADMIN_GET_MODULE###
|
||||
|
||||
/**
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
@ -96,7 +96,7 @@ class ###Component###View###SViews### extends JViewLegacy
|
||||
*/
|
||||
public function escape($var)
|
||||
{
|
||||
// use the helper htmlEscape method instead.
|
||||
// use the helper htmlEscape method instead.
|
||||
return ###Component###Helper::htmlEscape($var, $this->_charset);
|
||||
}
|
||||
}
|
||||
|
@ -48,14 +48,14 @@ class ###Component###View###SViews### extends JViewLegacy
|
||||
$this->user = JFactory::getUser();###SITE_DIPLAY_METHOD###
|
||||
}###SITE_EXTRA_DIPLAY_METHODS###
|
||||
|
||||
/**
|
||||
/**
|
||||
* Prepares the document
|
||||
*/
|
||||
protected function _prepareDocument()
|
||||
{###SITE_LIBRARIES_LOADER### ###SITE_UIKIT_LOADER### ###SITE_GOOGLECHART_LOADER### ###SITE_FOOTABLE_LOADER### ###SITE_DOCUMENT_METADATA### ###SITE_DOCUMENT_CUSTOM_PHP###
|
||||
// add the document default css file
|
||||
$this->document->addStyleSheet(JURI::root(true) .'/components/com_###component###/assets/css/###sview###.css');###SITE_DOCUMENT_CUSTOM_CSS### ###SITE_DOCUMENT_CUSTOM_JS###
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting the toolbar
|
||||
@ -75,7 +75,7 @@ class ###Component###View###SViews### extends JViewLegacy
|
||||
$this->toolbar = JToolbar::getInstance();
|
||||
}###SITE_GET_MODULE###
|
||||
|
||||
/**
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
@ -84,7 +84,7 @@ class ###Component###View###SViews### extends JViewLegacy
|
||||
*/
|
||||
public function escape($var, $sorten = false, $length = 40)
|
||||
{
|
||||
// use the helper htmlEscape method instead.
|
||||
// use the helper htmlEscape method instead.
|
||||
return ###Component###Helper::htmlEscape($var, $this->_charset, $sorten, $length);
|
||||
}
|
||||
}
|
||||
|
@ -48,14 +48,14 @@ class ###Component###View###SView### extends JViewLegacy
|
||||
$this->user = JFactory::getUser();###SITE_DIPLAY_METHOD###
|
||||
}###SITE_EXTRA_DIPLAY_METHODS###
|
||||
|
||||
/**
|
||||
/**
|
||||
* Prepares the document
|
||||
*/
|
||||
protected function _prepareDocument()
|
||||
{###SITE_LIBRARIES_LOADER### ###SITE_UIKIT_LOADER### ###SITE_GOOGLECHART_LOADER### ###SITE_FOOTABLE_LOADER### ###SITE_DOCUMENT_METADATA### ###SITE_DOCUMENT_CUSTOM_PHP###
|
||||
// add the document default css file
|
||||
$this->document->addStyleSheet(JURI::root(true) .'/components/com_###component###/assets/css/###sview###.css');###SITE_DOCUMENT_CUSTOM_CSS### ###SITE_DOCUMENT_CUSTOM_JS###
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting the toolbar
|
||||
@ -64,7 +64,7 @@ class ###Component###View###SView### extends JViewLegacy
|
||||
{
|
||||
// adding the joomla toolbar to the front
|
||||
JLoader::register('JToolbarHelper', JPATH_ADMINISTRATOR.'/includes/toolbar.php');###SITE_CUSTOM_BUTTONS###
|
||||
|
||||
|
||||
// set help url for this view if found
|
||||
$help_url = ###Component###Helper::getHelpUrl('###sview###');
|
||||
if (###Component###Helper::checkString($help_url))
|
||||
@ -75,7 +75,7 @@ class ###Component###View###SView### extends JViewLegacy
|
||||
$this->toolbar = JToolbar::getInstance();
|
||||
}###SITE_GET_MODULE###
|
||||
|
||||
/**
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
@ -84,7 +84,7 @@ class ###Component###View###SView### extends JViewLegacy
|
||||
*/
|
||||
public function escape($var, $sorten = false, $length = 40)
|
||||
{
|
||||
// use the helper htmlEscape method instead.
|
||||
// use the helper htmlEscape method instead.
|
||||
return ###Component###Helper::htmlEscape($var, $this->_charset, $sorten, $length);
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
4
admin/compiler/joomla_3/viewFile.js
Normal file
4
admin/compiler/joomla_3/viewFile.js
Normal file
@ -0,0 +1,4 @@
|
||||
###BOM###
|
||||
|
||||
/* JS Document */
|
||||
###ADMINJS###
|
4
admin/compiler/joomla_3/viewFileCustomAdmin.js
Normal file
4
admin/compiler/joomla_3/viewFileCustomAdmin.js
Normal file
@ -0,0 +1,4 @@
|
||||
###BOM###
|
||||
|
||||
/* JS Document */
|
||||
###CUSTOM_ADMIN_JAVASCRIPT_FILE###
|
4
admin/compiler/joomla_3/viewFileSite.js
Normal file
4
admin/compiler/joomla_3/viewFileSite.js
Normal file
@ -0,0 +1,4 @@
|
||||
###BOM###
|
||||
|
||||
/* JS Document */
|
||||
###SITE_JAVASCRIPT_FILE###
|
Reference in New Issue
Block a user