Update with all the latest changes to JCB. Fixed the permissions issue by adding the created_by to the query. vdm-io/Joomla-Component-Builder#335
This commit is contained in:
parent
508dd34a81
commit
1f8a137949
@ -10,20 +10,20 @@ Just a basic demo of the most basic implementations of the [Joomla](http://www.j
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
+ *Name*: [Demo](https://www.vdm.io/)
|
||||
+ *First Build*: 18th October, 2016
|
||||
+ *Last Build*: 5th May, 2018
|
||||
+ *Last Build*: 13th September, 2018
|
||||
+ *Version*: 2.0.0
|
||||
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
|
||||
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
## Build Time
|
||||
|
||||
**41 Hours** or **5 Eight Hour Days** (actual time the author saved -
|
||||
**42 Hours** or **5 Eight Hour Days** (actual time the author saved -
|
||||
due to [Automated Component Builder](https://www.vdm.io/joomla-component-builder))
|
||||
|
||||
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
|
||||
> never making one mistake or taking any coffee break.)
|
||||
|
||||
+ *Line count*: **14621**
|
||||
+ *Line count*: **14920**
|
||||
+ *File count*: **147**
|
||||
+ *Folder count*: **54**
|
||||
|
||||
@ -35,7 +35,7 @@ due to [Automated Component Builder](https://www.vdm.io/joomla-component-builder
|
||||
> **mapping @4hours** = codingtime / 10;
|
||||
> **office @7hours** = codingtime / 6;)
|
||||
|
||||
**68 Hours** or **9 Eight Hour Days**
|
||||
**69 Hours** or **9 Eight Hour Days**
|
||||
(a total of the realistic time frame for this project)
|
||||
|
||||
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
|
||||
|
@ -10,20 +10,20 @@ Just a basic demo of the most basic implementations of the [Joomla](http://www.j
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
+ *Name*: [Demo](https://www.vdm.io/)
|
||||
+ *First Build*: 18th October, 2016
|
||||
+ *Last Build*: 5th May, 2018
|
||||
+ *Last Build*: 13th September, 2018
|
||||
+ *Version*: 2.0.0
|
||||
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
|
||||
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
## Build Time
|
||||
|
||||
**41 Hours** or **5 Eight Hour Days** (actual time the author saved -
|
||||
**42 Hours** or **5 Eight Hour Days** (actual time the author saved -
|
||||
due to [Automated Component Builder](https://www.vdm.io/joomla-component-builder))
|
||||
|
||||
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
|
||||
> never making one mistake or taking any coffee break.)
|
||||
|
||||
+ *Line count*: **14621**
|
||||
+ *Line count*: **14920**
|
||||
+ *File count*: **147**
|
||||
+ *Folder count*: **54**
|
||||
|
||||
@ -35,7 +35,7 @@ due to [Automated Component Builder](https://www.vdm.io/joomla-component-builder
|
||||
> **mapping @4hours** = codingtime / 10;
|
||||
> **office @7hours** = codingtime / 6;)
|
||||
|
||||
**68 Hours** or **9 Eight Hour Days**
|
||||
**69 Hours** or **9 Eight Hour Days**
|
||||
(a total of the realistic time frame for this project)
|
||||
|
||||
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
|
||||
|
@ -13,6 +13,7 @@
|
||||
<action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_COMPONENT_DESC" />
|
||||
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_ACCESS_EDITSTATE_DESC" />
|
||||
<action name="core.edit.own" title="JACTION_EDITOWN" description="JACTION_EDITOWN_COMPONENT_DESC" />
|
||||
<action name="core.edit.value" title="JACTION_EDITVALUE" description="JACTION_EDITVALUE_COMPONENT_DESC" />
|
||||
<action name="core.edit.created_by" title="COM_DEMO_EDIT_CREATED_BY" description="COM_DEMO_EDIT_CREATED_BY_DESC" />
|
||||
<action name="core.edit.created" title="COM_DEMO_EDIT_CREATED_DATE" description="COM_DEMO_EDIT_CREATED_DATE_DESC" />
|
||||
<action name="site.looking.access" title="COM_DEMO_LOOKING_ACCESS_SITE" description="COM_DEMO_LOOKING_ACCESS_SITE_DESC" />
|
||||
@ -43,5 +44,19 @@
|
||||
<action name="look.delete" title="COM_DEMO_LOOKS_DELETE" description="COM_DEMO_LOOKS_DELETE_DESC" />
|
||||
<action name="look.access" title="COM_DEMO_LOOKS_ACCESS" description="COM_DEMO_LOOKS_ACCESS_DESC" />
|
||||
<action name="look.version" title="COM_DEMO_LOOKS_EDIT_VERSION" description="COM_DEMO_LOOKS_EDIT_VERSION_DESC" />
|
||||
</section>
|
||||
<section name="fieldgroup">
|
||||
<action name="core.create" title="JACTION_CREATE" description="COM_FIELDS_GROUP_PERMISSION_CREATE_DESC" />
|
||||
<action name="core.delete" title="JACTION_DELETE" description="COM_FIELDS_GROUP_PERMISSION_DELETE_DESC" />
|
||||
<action name="core.edit" title="JACTION_EDIT" description="COM_FIELDS_GROUP_PERMISSION_EDIT_DESC" />
|
||||
<action name="core.edit.state" title="JACTION_EDITSTATE" description="COM_FIELDS_GROUP_PERMISSION_EDITSTATE_DESC" />
|
||||
<action name="core.edit.own" title="JACTION_EDITOWN" description="COM_FIELDS_GROUP_PERMISSION_EDITOWN_DESC" />
|
||||
<action name="core.edit.value" title="JACTION_EDITVALUE" description="COM_FIELDS_GROUP_PERMISSION_EDITVALUE_DESC" />
|
||||
</section>
|
||||
<section name="field">
|
||||
<action name="core.delete" title="JACTION_DELETE" description="COM_FIELDS_FIELD_PERMISSION_DELETE_DESC" />
|
||||
<action name="core.edit" title="JACTION_EDIT" description="COM_FIELDS_FIELD_PERMISSION_EDIT_DESC" />
|
||||
<action name="core.edit.state" title="JACTION_EDITSTATE" description="COM_FIELDS_FIELD_PERMISSION_EDITSTATE_DESC" />
|
||||
<action name="core.edit.value" title="JACTION_EDITVALUE" description="COM_FIELDS_FIELD_PERMISSION_EDITVALUE_DESC" />
|
||||
</section>
|
||||
</access>
|
@ -3,7 +3,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage admin.css
|
||||
|
@ -3,7 +3,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage dashboard.css
|
||||
|
@ -3,7 +3,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage look.css
|
||||
|
@ -3,7 +3,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage looks.css
|
||||
|
@ -3,7 +3,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage admin.js
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage controller.php
|
||||
@ -21,9 +21,6 @@
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import Joomla controller library
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
/**
|
||||
* General Controller of Demo component
|
||||
*/
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage demo.php
|
||||
@ -21,9 +21,6 @@
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import Joomla controlleradmin library
|
||||
jimport('joomla.application.component.controlleradmin');
|
||||
|
||||
/**
|
||||
* Demo Controller
|
||||
*/
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage import.php
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage look.php
|
||||
@ -21,9 +21,6 @@
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import Joomla controllerform library
|
||||
jimport('joomla.application.component.controllerform');
|
||||
|
||||
/**
|
||||
* Look Controller
|
||||
*/
|
||||
@ -38,6 +35,13 @@ class DemoControllerLook extends JControllerForm
|
||||
*/
|
||||
protected $task;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param array $config A named array of configuration variables.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
$this->view_list = 'Looks'; // safeguard for setting the return view listing to the main view.
|
||||
@ -55,14 +59,17 @@ class DemoControllerLook extends JControllerForm
|
||||
*/
|
||||
protected function allowAdd($data = array())
|
||||
{
|
||||
// Get user object.
|
||||
$user = JFactory::getUser();
|
||||
// Access check.
|
||||
$access = JFactory::getUser()->authorise('look.access', 'com_demo');
|
||||
$access = $user->authorise('look.access', 'com_demo');
|
||||
if (!$access)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// In the absense of better information, revert to the component permissions.
|
||||
return JFactory::getUser()->authorise('look.create', $this->option);
|
||||
return $user->authorise('look.create', $this->option);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -78,9 +85,9 @@ class DemoControllerLook extends JControllerForm
|
||||
protected function allowEdit($data = array(), $key = 'id')
|
||||
{
|
||||
// get user object.
|
||||
$user = JFactory::getUser();
|
||||
$user = JFactory::getUser();
|
||||
// get record id.
|
||||
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
|
||||
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
|
||||
|
||||
|
||||
// Access check.
|
||||
@ -136,42 +143,25 @@ class DemoControllerLook extends JControllerForm
|
||||
*
|
||||
* @return string The arguments to append to the redirect URL.
|
||||
*
|
||||
* @since 12.2
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
|
||||
{
|
||||
$tmpl = $this->input->get('tmpl');
|
||||
$layout = $this->input->get('layout', 'edit', 'string');
|
||||
// get the referral options (old method use return instead see parent)
|
||||
$ref = $this->input->get('ref', 0, 'string');
|
||||
$refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
$ref = $this->input->get('ref', 0, 'string');
|
||||
$refid = $this->input->get('refid', 0, 'int');
|
||||
// get redirect info.
|
||||
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
|
||||
|
||||
// Setup redirect info.
|
||||
|
||||
$append = '';
|
||||
|
||||
if ($refid)
|
||||
// set the referral options
|
||||
if ($refid && $ref)
|
||||
{
|
||||
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid;
|
||||
$append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
|
||||
}
|
||||
elseif ($ref)
|
||||
{
|
||||
$append .= '&ref='.(string)$ref;
|
||||
}
|
||||
|
||||
if ($tmpl)
|
||||
{
|
||||
$append .= '&tmpl=' . $tmpl;
|
||||
}
|
||||
|
||||
if ($layout)
|
||||
{
|
||||
$append .= '&layout=' . $layout;
|
||||
}
|
||||
|
||||
if ($recordId)
|
||||
{
|
||||
$append .= '&' . $urlVar . '=' . $recordId;
|
||||
$append = '&ref='. (string)$ref . $append;
|
||||
}
|
||||
|
||||
return $append;
|
||||
@ -210,43 +200,45 @@ class DemoControllerLook extends JControllerForm
|
||||
*/
|
||||
public function cancel($key = null)
|
||||
{
|
||||
// get the referal details
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
// get the referral options
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// Check if there is a return value
|
||||
$return = $this->input->get('return', null, 'base64');
|
||||
|
||||
$cancel = parent::cancel($key);
|
||||
|
||||
if ($cancel)
|
||||
if (!is_null($return) && JUri::isInternal(base64_decode($return)))
|
||||
{
|
||||
if ($this->refid)
|
||||
{
|
||||
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid;
|
||||
$redirect = base64_decode($return);
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view='.(string)$this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Redirect to the items screen.
|
||||
// Redirect to the return value.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . '&view=' . $this->view_list, false
|
||||
$redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->refid && $this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view='.(string)$this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -265,11 +257,15 @@ class DemoControllerLook extends JControllerForm
|
||||
*/
|
||||
public function save($key = null, $urlVar = null)
|
||||
{
|
||||
// get the referal details
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
// get the referral options
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
if ($this->ref || $this->refid)
|
||||
// Check if there is a return value
|
||||
$return = $this->input->get('return', null, 'base64');
|
||||
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
|
||||
|
||||
if ($this->ref || $this->refid || $canReturn)
|
||||
{
|
||||
// to make sure the item is checkedin on redirect
|
||||
$this->task = 'save';
|
||||
@ -277,9 +273,22 @@ class DemoControllerLook extends JControllerForm
|
||||
|
||||
$saved = parent::save($key, $urlVar);
|
||||
|
||||
if ($this->refid && $saved)
|
||||
// This is not needed since parent save already does this
|
||||
// Due to the ref and refid implementation we need to add this
|
||||
if ($canReturn)
|
||||
{
|
||||
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid;
|
||||
$redirect = base64_decode($return);
|
||||
|
||||
// Redirect to the return value.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
$redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->refid && $this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
@ -288,9 +297,9 @@ class DemoControllerLook extends JControllerForm
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref && $saved)
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view='.(string)$this->ref;
|
||||
$redirect = '&view=' . (string)$this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage looks.php
|
||||
@ -21,24 +21,33 @@
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import Joomla controlleradmin library
|
||||
jimport('joomla.application.component.controlleradmin');
|
||||
|
||||
/**
|
||||
* Looks Controller
|
||||
*/
|
||||
class DemoControllerLooks extends JControllerAdmin
|
||||
{
|
||||
protected $text_prefix = 'COM_DEMO_LOOKS';
|
||||
/**
|
||||
* Proxy for getModel.
|
||||
* @since 2.5
|
||||
* The prefix to use with controller messages.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getModel($name = 'Look', $prefix = 'DemoModel', $config = array())
|
||||
protected $text_prefix = 'COM_DEMO_LOOKS';
|
||||
|
||||
/**
|
||||
* Method to get a model object, loading it if required.
|
||||
*
|
||||
* @param string $name The model name. Optional.
|
||||
* @param string $prefix The class prefix. Optional.
|
||||
* @param array $config Configuration array for model. Optional.
|
||||
*
|
||||
* @return JModelLegacy The model.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getModel($name = 'Look', $prefix = 'DemoModel', $config = array('ignore_request' => true))
|
||||
{
|
||||
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||
|
||||
return $model;
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
public function exportData()
|
||||
@ -102,5 +111,5 @@ class DemoControllerLooks extends JControllerAdmin
|
||||
$message = JText::_('COM_DEMO_IMPORT_FAILED');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_demo&view=looks', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage demo.php
|
||||
@ -20,29 +20,22 @@
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
JHtml::_('behavior.tabstate');
|
||||
|
||||
// Access check.
|
||||
if (!JFactory::getUser()->authorise('core.manage', 'com_demo'))
|
||||
{
|
||||
return JError::raiseWaring(404, JText::_('JERROR_ALERTNOAUTHOR'));
|
||||
throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403);
|
||||
};
|
||||
|
||||
// Load cms libraries
|
||||
JLoader::registerPrefix('J', JPATH_PLATFORM . '/cms');
|
||||
// Load joomla libraries without overwrite
|
||||
JLoader::registerPrefix('J', JPATH_PLATFORM . '/joomla',false);
|
||||
|
||||
// Add CSS file for all pages
|
||||
$document = JFactory::getDocument();
|
||||
$document->addStyleSheet('components/com_demo/assets/css/admin.css');
|
||||
$document->addScript('components/com_demo/assets/js/admin.js');
|
||||
|
||||
// require helper files
|
||||
JLoader::register('DemoHelper', dirname(__FILE__) . '/helpers/demo.php');
|
||||
JLoader::register('JHtmlBatch_', dirname(__FILE__) . '/helpers/html/batch_.php');
|
||||
|
||||
// import joomla controller library
|
||||
jimport('joomla.application.component.controller');
|
||||
JLoader::register('DemoHelper', __DIR__ . '/helpers/demo.php');
|
||||
JLoader::register('JHtmlBatch_', __DIR__ . '/helpers/html/batch_.php');
|
||||
|
||||
// Get an instance of the controller prefixed by Demo
|
||||
$controller = JControllerLegacy::getInstance('Demo');
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage demo.php
|
||||
@ -25,7 +25,7 @@ defined('_JEXEC') or die('Restricted access');
|
||||
* Demo component helper.
|
||||
*/
|
||||
abstract class DemoHelper
|
||||
{
|
||||
{
|
||||
/**
|
||||
* Load the Component xml manifest.
|
||||
**/
|
||||
@ -92,8 +92,8 @@ abstract class DemoHelper
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be used to build help urls.
|
||||
**/
|
||||
* Can be used to build help urls.
|
||||
**/
|
||||
public static function getHelpUrl($view)
|
||||
{
|
||||
return false;
|
||||
@ -111,12 +111,17 @@ abstract class DemoHelper
|
||||
if ($user->authorise('look.access', 'com_demo') && $user->authorise('look.submenu', 'com_demo'))
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_DEMO_SUBMENU_LOOKS'), 'index.php?option=com_demo&view=looks', $submenu === 'looks');
|
||||
}
|
||||
if (JComponentHelper::isEnabled('com_fields'))
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_DEMO_SUBMENU_LOOKS_FIELDS'), 'index.php?option=com_fields&context=com_demo.look', $submenu === 'fields.fields');
|
||||
JHtmlSidebar::addEntry(JText::_('COM_DEMO_SUBMENU_LOOKS_FIELDS_GROUPS'), 'index.php?option=com_fields&view=groups&context=com_demo.look', $submenu === 'fields.groups');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* UIKIT Component Classes
|
||||
**/
|
||||
* UIKIT Component Classes
|
||||
**/
|
||||
public static $uk_components = array(
|
||||
'data-uk-grid' => array(
|
||||
'grid' ),
|
||||
@ -170,15 +175,15 @@ abstract class DemoHelper
|
||||
'upload-drop' => array(
|
||||
'upload', 'form-file' )
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Add UIKIT Components
|
||||
**/
|
||||
* Add UIKIT Components
|
||||
**/
|
||||
public static $uikit = false;
|
||||
|
||||
/**
|
||||
* Get UIKIT Components
|
||||
**/
|
||||
* Get UIKIT Components
|
||||
**/
|
||||
public static function getUikitComp($content,$classes = array())
|
||||
{
|
||||
if (strpos($content,'class="uk-') !== false)
|
||||
@ -208,13 +213,13 @@ abstract class DemoHelper
|
||||
}
|
||||
return $temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (self::checkArray($classes))
|
||||
{
|
||||
return $classes;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the xml document
|
||||
@ -244,19 +249,19 @@ abstract class DemoHelper
|
||||
{
|
||||
$subjectTab = 'Sheet1';
|
||||
}
|
||||
|
||||
// make sure the file is loaded
|
||||
|
||||
// make sure the file is loaded
|
||||
JLoader::import('PHPExcel', JPATH_COMPONENT_ADMINISTRATOR . '/helpers');
|
||||
|
||||
|
||||
// Create new PHPExcel object
|
||||
$objPHPExcel = new PHPExcel();
|
||||
|
||||
|
||||
// Set document properties
|
||||
$objPHPExcel->getProperties()->setCreator($creator)
|
||||
->setCompany('Vast Development Method')
|
||||
->setLastModifiedBy($modified)
|
||||
->setTitle($title)
|
||||
->setSubject($subjectTab);
|
||||
->setCompany('Vast Development Method')
|
||||
->setLastModifiedBy($modified)
|
||||
->setTitle($title)
|
||||
->setSubject($subjectTab);
|
||||
if (!$description)
|
||||
{
|
||||
$objPHPExcel->getProperties()->setDescription($description);
|
||||
@ -269,7 +274,7 @@ abstract class DemoHelper
|
||||
{
|
||||
$objPHPExcel->getProperties()->setCategory($category);
|
||||
}
|
||||
|
||||
|
||||
// Some styles
|
||||
$headerStyles = array(
|
||||
'font' => array(
|
||||
@ -291,7 +296,7 @@ abstract class DemoHelper
|
||||
'size' => 11,
|
||||
'name' => 'Verdana'
|
||||
));
|
||||
|
||||
|
||||
// Add some data
|
||||
if (self::checkArray($rows))
|
||||
{
|
||||
@ -318,43 +323,43 @@ abstract class DemoHelper
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Rename worksheet
|
||||
$objPHPExcel->getActiveSheet()->setTitle($subjectTab);
|
||||
|
||||
|
||||
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
|
||||
$objPHPExcel->setActiveSheetIndex(0);
|
||||
|
||||
|
||||
// Redirect output to a client's web browser (Excel5)
|
||||
header('Content-Type: application/vnd.ms-excel');
|
||||
header('Content-Disposition: attachment;filename="'.$fileName.'.xls"');
|
||||
header('Cache-Control: max-age=0');
|
||||
// If you're serving to IE 9, then the following may be needed
|
||||
header('Cache-Control: max-age=1');
|
||||
|
||||
|
||||
// If you're serving to IE over SSL, then the following may be needed
|
||||
header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
|
||||
header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified
|
||||
header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1
|
||||
header ('Pragma: public'); // HTTP/1.0
|
||||
|
||||
|
||||
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
|
||||
$objWriter->save('php://output');
|
||||
jexit();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get CSV Headers
|
||||
*/
|
||||
* Get CSV Headers
|
||||
*/
|
||||
public static function getFileHeaders($dataType)
|
||||
{
|
||||
// make sure these files are loaded
|
||||
{
|
||||
// make sure these files are loaded
|
||||
JLoader::import('PHPExcel', JPATH_COMPONENT_ADMINISTRATOR . '/helpers');
|
||||
JLoader::import('ChunkReadFilter', JPATH_COMPONENT_ADMINISTRATOR . '/helpers/PHPExcel/Reader');
|
||||
// get session object
|
||||
$session = JFactory::getSession();
|
||||
$package = $session->get('package', null);
|
||||
$package = json_decode($package, true);
|
||||
$session = JFactory::getSession();
|
||||
$package = $session->get('package', null);
|
||||
$package = json_decode($package, true);
|
||||
// set the headers
|
||||
if(isset($package['dir']))
|
||||
{
|
||||
@ -532,16 +537,16 @@ abstract class DemoHelper
|
||||
{
|
||||
if ($external)
|
||||
{
|
||||
if ($name = self::getVar(null, $val, $id, $name, '=', $table))
|
||||
if ($_name = self::getVar(null, $val, $id, $name, '=', $table))
|
||||
{
|
||||
$names[] = $name;
|
||||
$names[] = $_name;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($name = self::getVar($table, $val, $id, $name))
|
||||
if ($_name = self::getVar($table, $val, $id, $name))
|
||||
{
|
||||
$names[] = $name;
|
||||
$names[] = $_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -931,7 +936,7 @@ abstract class DemoHelper
|
||||
}
|
||||
}
|
||||
// check if there are any view values remaining
|
||||
if (count($_result))
|
||||
if (count((array)$_result))
|
||||
{
|
||||
$_result = json_encode($_result);
|
||||
$_result = array($_result);
|
||||
@ -1037,6 +1042,46 @@ abstract class DemoHelper
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the field object
|
||||
*
|
||||
* @param array $attributes The array of attributes
|
||||
* @param string $default The default of the field
|
||||
* @param array $options The options to apply to the XML element
|
||||
*
|
||||
* @return object
|
||||
*
|
||||
*/
|
||||
public static function getFieldObject(&$attributes, $default = '', $options = null)
|
||||
{
|
||||
// make sure we have attributes and a type value
|
||||
if (self::checkArray($attributes) && isset($attributes['type']))
|
||||
{
|
||||
// make sure the form helper class is loaded
|
||||
if (!method_exists('JFormHelper', 'loadFieldType'))
|
||||
{
|
||||
jimport('joomla.form.form');
|
||||
}
|
||||
// get field type
|
||||
$field = JFormHelper::loadFieldType($attributes['type'],true);
|
||||
// start field xml
|
||||
$XML = new SimpleXMLElement('<field/>');
|
||||
// load the attributes
|
||||
self::xmlAddAttributes($XML, $attributes);
|
||||
// check if we have options
|
||||
if (self::checkArray($options))
|
||||
{
|
||||
// load the options
|
||||
self::xmlAddOptions($XML, $options);
|
||||
}
|
||||
// setup the field
|
||||
$field->setup($XML, $default);
|
||||
// return the field object
|
||||
return $field;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render Bool Button
|
||||
*
|
||||
@ -1055,8 +1100,6 @@ abstract class DemoHelper
|
||||
$args = func_get_args();
|
||||
// check if there is additional button class
|
||||
$additional = isset($args[1]) ? (string) $args[1] : ''; // not used at this time
|
||||
// start the xml
|
||||
$buttonXML = new SimpleXMLElement('<field/>');
|
||||
// button attributes
|
||||
$buttonAttributes = array(
|
||||
'type' => 'radio',
|
||||
@ -1065,22 +1108,12 @@ abstract class DemoHelper
|
||||
'class' => 'btn-group',
|
||||
'filter' => 'INT',
|
||||
'default' => isset($args[2]) ? (int) $args[2] : 0);
|
||||
// load the haskey attributes
|
||||
self::xmlAddAttributes($buttonXML, $buttonAttributes);
|
||||
// set the button options
|
||||
$buttonOptions = array(
|
||||
'1' => isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES',
|
||||
'0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO');
|
||||
// load the button options
|
||||
self::xmlAddOptions($buttonXML, $buttonOptions);
|
||||
|
||||
// get the radio element
|
||||
$button = JFormHelper::loadFieldType('radio');
|
||||
|
||||
// run
|
||||
$button->setup($buttonXML, $buttonAttributes['default']);
|
||||
|
||||
return $button->input;
|
||||
// return the input
|
||||
return self::getFieldObject($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1125,7 +1158,7 @@ abstract class DemoHelper
|
||||
**/
|
||||
public static function checkArray($array, $removeEmptyString = false)
|
||||
{
|
||||
if (isset($array) && is_array($array) && count($array) > 0)
|
||||
if (isset($array) && is_array($array) && count((array)$array) > 0)
|
||||
{
|
||||
// also make sure the empty strings are removed
|
||||
if ($removeEmptyString)
|
||||
@ -1228,7 +1261,7 @@ abstract class DemoHelper
|
||||
{
|
||||
$initial = strlen($string);
|
||||
$words = preg_split('/([\s\n\r]+)/', $string, null, PREG_SPLIT_DELIM_CAPTURE);
|
||||
$words_count = count($words);
|
||||
$words_count = count((array)$words);
|
||||
|
||||
$word_length = 0;
|
||||
$last_word = 0;
|
||||
@ -1263,7 +1296,7 @@ abstract class DemoHelper
|
||||
*
|
||||
* @returns string on success
|
||||
**/
|
||||
public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true)
|
||||
public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true)
|
||||
{
|
||||
if ($replaceNumbers === true)
|
||||
{
|
||||
@ -1292,7 +1325,16 @@ abstract class DemoHelper
|
||||
$string = trim($string);
|
||||
$string = preg_replace('/'.$spacer.'+/', ' ', $string);
|
||||
$string = preg_replace('/\s+/', ' ', $string);
|
||||
$string = preg_replace("/[^A-Za-z ]/", '', $string);
|
||||
// remove all and keep only characters
|
||||
if ($keepOnlyCharacters)
|
||||
{
|
||||
$string = preg_replace("/[^A-Za-z ]/", '', $string);
|
||||
}
|
||||
// keep both numbers and characters
|
||||
else
|
||||
{
|
||||
$string = preg_replace("/[^A-Za-z0-9 ]/", '', $string);
|
||||
}
|
||||
// select final adaptations
|
||||
if ($type === 'L' || $type === 'strtolower')
|
||||
{
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage headercheck.php
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage batch_.php
|
||||
|
@ -111,9 +111,9 @@ COM_DEMO_LOOKS_BATCH_USE_DESC="Allows users in this group to use batch copy/upda
|
||||
COM_DEMO_LOOKS_CREATE="Looks Create"
|
||||
COM_DEMO_LOOKS_CREATE_DESC="Allows the users in this group to create create looks"
|
||||
COM_DEMO_LOOKS_DASHBOARD_ADD="Looks Dashboard Add"
|
||||
COM_DEMO_LOOKS_DASHBOARD_ADD_DESC="Allows the users in this group to update the dashboard add of the look"
|
||||
COM_DEMO_LOOKS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of look"
|
||||
COM_DEMO_LOOKS_DASHBOARD_LIST="Looks Dashboard List"
|
||||
COM_DEMO_LOOKS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the look"
|
||||
COM_DEMO_LOOKS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of look"
|
||||
COM_DEMO_LOOKS_DELETE="Looks Delete"
|
||||
COM_DEMO_LOOKS_DELETE_DESC="Allows the users in this group to delete delete looks"
|
||||
COM_DEMO_LOOKS_EDIT="Looks Edit"
|
||||
@ -150,7 +150,7 @@ COM_DEMO_LOOKS_N_ITEMS_UNFEATURED_1="%s Look unfeatured."
|
||||
COM_DEMO_LOOKS_N_ITEMS_UNPUBLISHED="%s Looks unpublished."
|
||||
COM_DEMO_LOOKS_N_ITEMS_UNPUBLISHED_1="%s Look unpublished."
|
||||
COM_DEMO_LOOKS_SUBMENU="Looks Submenu"
|
||||
COM_DEMO_LOOKS_SUBMENU_DESC="Allows the users in this group to update the submenu of the look"
|
||||
COM_DEMO_LOOKS_SUBMENU_DESC="Allows the users in this group to submenu of look"
|
||||
COM_DEMO_LOOK_ADD="Add"
|
||||
COM_DEMO_LOOK_ADD_LABEL="Add More"
|
||||
COM_DEMO_LOOK_ALIAS="Alias"
|
||||
@ -217,6 +217,8 @@ COM_DEMO_SAVE_SUCCESS="Great! Item successfully saved."
|
||||
COM_DEMO_SAVE_WARNING="The value already existed so please select another."
|
||||
COM_DEMO_SUBMENU_DASHBOARD="Dashboard"
|
||||
COM_DEMO_SUBMENU_LOOKS="Looks"
|
||||
COM_DEMO_SUBMENU_LOOKS_FIELDS="Looks Fields"
|
||||
COM_DEMO_SUBMENU_LOOKS_FIELDS_GROUPS="Looks Field Groups"
|
||||
COM_DEMO_TRASHED="Trashed"
|
||||
COM_DEMO_USE_BATCH="Use Batch"
|
||||
COM_DEMO_USE_BATCH_DESC=" Allows users in this group to use batch copy/update method."
|
||||
|
@ -21,9 +21,9 @@ COM_DEMO_LOOKS_BATCH_USE_DESC="Allows users in this group to use batch copy/upda
|
||||
COM_DEMO_LOOKS_CREATE="Looks Create"
|
||||
COM_DEMO_LOOKS_CREATE_DESC="Allows the users in this group to create create looks"
|
||||
COM_DEMO_LOOKS_DASHBOARD_ADD="Looks Dashboard Add"
|
||||
COM_DEMO_LOOKS_DASHBOARD_ADD_DESC="Allows the users in this group to update the dashboard add of the look"
|
||||
COM_DEMO_LOOKS_DASHBOARD_ADD_DESC="Allows the users in this group to dashboard add of look"
|
||||
COM_DEMO_LOOKS_DASHBOARD_LIST="Looks Dashboard List"
|
||||
COM_DEMO_LOOKS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the look"
|
||||
COM_DEMO_LOOKS_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of look"
|
||||
COM_DEMO_LOOKS_DELETE="Looks Delete"
|
||||
COM_DEMO_LOOKS_DELETE_DESC="Allows the users in this group to delete delete looks"
|
||||
COM_DEMO_LOOKS_EDIT="Looks Edit"
|
||||
@ -43,7 +43,7 @@ COM_DEMO_LOOKS_EXPORT_DESC="Allows the users in this group to export export look
|
||||
COM_DEMO_LOOKS_IMPORT="Looks Import"
|
||||
COM_DEMO_LOOKS_IMPORT_DESC="Allows the users in this group to import import looks"
|
||||
COM_DEMO_LOOKS_SUBMENU="Looks Submenu"
|
||||
COM_DEMO_LOOKS_SUBMENU_DESC="Allows the users in this group to update the submenu of the look"
|
||||
COM_DEMO_LOOKS_SUBMENU_DESC="Allows the users in this group to submenu of look"
|
||||
COM_DEMO_MENU="» Demo"
|
||||
COM_DEMO_MENU_LOOKS="Looks"
|
||||
COM_DEMO_MENU_LOOKS_DESC="The List of all published looks"
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage batchselection.php
|
||||
@ -22,8 +22,8 @@
|
||||
defined('JPATH_BASE') or die;
|
||||
|
||||
JHtmlBehavior::core();
|
||||
$divWrapper = range(1,120,2);
|
||||
$counter = 0;
|
||||
$divWrapper = range(1,120,2);
|
||||
$counter = 0;
|
||||
?>
|
||||
<?php if ($displayData->ListSelection) : ?>
|
||||
<div class="row-fluid">
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage details_above.php
|
||||
@ -19,7 +19,6 @@
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$form = $displayData->getForm();
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage details_fullwidth.php
|
||||
@ -19,7 +19,6 @@
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$form = $displayData->getForm();
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage details_under.php
|
||||
@ -19,7 +19,6 @@
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$form = $displayData->getForm();
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage metadata.php
|
||||
@ -19,7 +19,6 @@
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$form = $displayData->getForm();
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage more_left.php
|
||||
@ -19,7 +19,6 @@
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$form = $displayData->getForm();
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage more_right.php
|
||||
@ -19,7 +19,6 @@
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$form = $displayData->getForm();
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage publishing.php
|
||||
@ -19,7 +19,6 @@
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage demo.php
|
||||
@ -21,10 +21,6 @@
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import the Joomla modellist library
|
||||
jimport('joomla.application.component.modellist');
|
||||
jimport('joomla.application.component.helper');
|
||||
|
||||
/**
|
||||
* Demo Model
|
||||
*/
|
||||
|
@ -3,7 +3,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage look.js
|
||||
@ -20,6 +20,7 @@
|
||||
// Some Global Values
|
||||
jform_vvvvvvvvvv_required = false;
|
||||
jform_vvvvvvvvvw_required = false;
|
||||
jform_vvvvvvvvvx_required = false;
|
||||
|
||||
// Initial Script
|
||||
jQuery(document).ready(function()
|
||||
@ -35,50 +36,70 @@ function vvvvvvv(add_vvvvvvv)
|
||||
if (add_vvvvvvv == 1)
|
||||
{
|
||||
jQuery('#jform_dateofbirth').closest('.control-group').show();
|
||||
jQuery('#jform_email').closest('.control-group').show();
|
||||
// add required attribute to dateofbirth field
|
||||
if (jform_vvvvvvvvvv_required)
|
||||
{
|
||||
updateFieldRequired('dateofbirth',0);
|
||||
jQuery('#jform_dateofbirth').prop('required','required');
|
||||
jQuery('#jform_dateofbirth').attr('aria-required',true);
|
||||
jQuery('#jform_dateofbirth').addClass('required');
|
||||
jform_vvvvvvvvvv_required = false;
|
||||
}
|
||||
jQuery('#jform_email').closest('.control-group').show();
|
||||
// add required attribute to email field
|
||||
if (jform_vvvvvvvvvw_required)
|
||||
{
|
||||
updateFieldRequired('email',0);
|
||||
jQuery('#jform_email').prop('required','required');
|
||||
jQuery('#jform_email').attr('aria-required',true);
|
||||
jQuery('#jform_email').addClass('required');
|
||||
jform_vvvvvvvvvv_required = false;
|
||||
jform_vvvvvvvvvw_required = false;
|
||||
}
|
||||
|
||||
jQuery('#jform_image').closest('.control-group').show();
|
||||
jQuery('#jform_mobile_phone').closest('.control-group').show();
|
||||
if (jform_vvvvvvvvvw_required)
|
||||
// add required attribute to mobile_phone field
|
||||
if (jform_vvvvvvvvvx_required)
|
||||
{
|
||||
updateFieldRequired('mobile_phone',0);
|
||||
jQuery('#jform_mobile_phone').prop('required','required');
|
||||
jQuery('#jform_mobile_phone').attr('aria-required',true);
|
||||
jQuery('#jform_mobile_phone').addClass('required');
|
||||
jform_vvvvvvvvvw_required = false;
|
||||
jform_vvvvvvvvvx_required = false;
|
||||
}
|
||||
|
||||
jQuery('#jform_website').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_dateofbirth').closest('.control-group').hide();
|
||||
jQuery('#jform_email').closest('.control-group').hide();
|
||||
// remove required attribute from dateofbirth field
|
||||
if (!jform_vvvvvvvvvv_required)
|
||||
{
|
||||
updateFieldRequired('dateofbirth',1);
|
||||
jQuery('#jform_dateofbirth').removeAttr('required');
|
||||
jQuery('#jform_dateofbirth').removeAttr('aria-required');
|
||||
jQuery('#jform_dateofbirth').removeClass('required');
|
||||
jform_vvvvvvvvvv_required = true;
|
||||
}
|
||||
jQuery('#jform_email').closest('.control-group').hide();
|
||||
// remove required attribute from email field
|
||||
if (!jform_vvvvvvvvvw_required)
|
||||
{
|
||||
updateFieldRequired('email',1);
|
||||
jQuery('#jform_email').removeAttr('required');
|
||||
jQuery('#jform_email').removeAttr('aria-required');
|
||||
jQuery('#jform_email').removeClass('required');
|
||||
jform_vvvvvvvvvv_required = true;
|
||||
jform_vvvvvvvvvw_required = true;
|
||||
}
|
||||
jQuery('#jform_image').closest('.control-group').hide();
|
||||
jQuery('#jform_mobile_phone').closest('.control-group').hide();
|
||||
if (!jform_vvvvvvvvvw_required)
|
||||
// remove required attribute from mobile_phone field
|
||||
if (!jform_vvvvvvvvvx_required)
|
||||
{
|
||||
updateFieldRequired('mobile_phone',1);
|
||||
jQuery('#jform_mobile_phone').removeAttr('required');
|
||||
jQuery('#jform_mobile_phone').removeAttr('aria-required');
|
||||
jQuery('#jform_mobile_phone').removeClass('required');
|
||||
jform_vvvvvvvvvw_required = true;
|
||||
jform_vvvvvvvvvx_required = true;
|
||||
}
|
||||
jQuery('#jform_website').closest('.control-group').hide();
|
||||
}
|
||||
|
@ -142,6 +142,7 @@
|
||||
class="text_area"
|
||||
filter="url"
|
||||
validated="url"
|
||||
scheme="http,https"
|
||||
message="COM_DEMO_LOOK_WEBSITE_MESSAGE"
|
||||
hint="COM_DEMO_LOOK_WEBSITE_HINT"
|
||||
/>
|
||||
@ -160,6 +161,11 @@
|
||||
default="1970-01-01"
|
||||
description="COM_DEMO_LOOK_DATEOFBIRTH_DESCRIPTION"
|
||||
format="%Y-%m-%d"
|
||||
filter="STRING"
|
||||
required="true"
|
||||
todaybutton="false"
|
||||
minyear="-120"
|
||||
maxyear="-1"
|
||||
/>
|
||||
<!-- Mobile_phone Field. Type: Tel. (joomla) -->
|
||||
<field
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage import.php
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage look.php
|
||||
@ -23,9 +23,6 @@ defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Registry\Registry;
|
||||
|
||||
// import Joomla modelform library
|
||||
jimport('joomla.application.component.modeladmin');
|
||||
|
||||
/**
|
||||
* Demo Look Model
|
||||
*/
|
||||
@ -58,6 +55,9 @@ class DemoModelLook extends JModelAdmin
|
||||
*/
|
||||
public function getTable($type = 'look', $prefix = 'DemoTable', $config = array())
|
||||
{
|
||||
// add table path for when model gets used from other component
|
||||
$this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_demo/tables');
|
||||
// get instance of the table
|
||||
return JTable::getInstance($type, $prefix, $config);
|
||||
}
|
||||
|
||||
@ -98,22 +98,25 @@ class DemoModelLook extends JModelAdmin
|
||||
}
|
||||
|
||||
return $item;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the record form.
|
||||
*
|
||||
* @param array $data Data for the form.
|
||||
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
|
||||
* @param array $options Optional array of options for the form creation.
|
||||
*
|
||||
* @return mixed A JForm object on success, false on failure
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getForm($data = array(), $loadData = true)
|
||||
{
|
||||
public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform'))
|
||||
{
|
||||
// set load data option
|
||||
$options['load_data'] = $loadData;
|
||||
// Get the form.
|
||||
$form = $this->loadForm('com_demo.look', 'look', array('control' => 'jform', 'load_data' => $loadData));
|
||||
$form = $this->loadForm('com_demo.look', 'look', $options);
|
||||
|
||||
if (empty($form))
|
||||
{
|
||||
@ -176,17 +179,20 @@ class DemoModelLook extends JModelAdmin
|
||||
// Only load these values if no id is found
|
||||
if (0 == $id)
|
||||
{
|
||||
// Set redirected field name
|
||||
$redirectedField = $jinput->get('ref', null, 'STRING');
|
||||
// Set redirected field value
|
||||
$redirectedValue = $jinput->get('refid', 0, 'INT');
|
||||
// Set redirected view name
|
||||
$redirectedView = $jinput->get('ref', null, 'STRING');
|
||||
// Set field name (or fall back to view name)
|
||||
$redirectedField = $jinput->get('field', $redirectedView, 'STRING');
|
||||
// Set redirected view id
|
||||
$redirectedId = $jinput->get('refid', 0, 'INT');
|
||||
// Set field id (or fall back to redirected view id)
|
||||
$redirectedValue = $jinput->get('field_id', $redirectedId, 'INT');
|
||||
if (0 != $redirectedValue && $redirectedField)
|
||||
{
|
||||
// Now set the local-redirected field default value
|
||||
$form->setValue($redirectedField, null, $redirectedValue);
|
||||
}
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
@ -237,7 +243,7 @@ class DemoModelLook extends JModelAdmin
|
||||
protected function canEditState($record)
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
$recordId = (!empty($record->id)) ? $record->id : 0;
|
||||
$recordId = (!empty($record->id)) ? $record->id : 0;
|
||||
|
||||
if ($recordId)
|
||||
{
|
||||
@ -348,18 +354,18 @@ class DemoModelLook extends JModelAdmin
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to validate the form data.
|
||||
*
|
||||
* @param JForm $form The form to validate against.
|
||||
* @param array $data The data to validate.
|
||||
* @param string $group The name of the field group to validate.
|
||||
*
|
||||
* @return mixed Array of filtered data if valid, false otherwise.
|
||||
*
|
||||
* @see JFormRule
|
||||
* @see JFilterInput
|
||||
* @since 12.2
|
||||
*/
|
||||
* Method to validate the form data.
|
||||
*
|
||||
* @param JForm $form The form to validate against.
|
||||
* @param array $data The data to validate.
|
||||
* @param string $group The name of the field group to validate.
|
||||
*
|
||||
* @return mixed Array of filtered data if valid, false otherwise.
|
||||
*
|
||||
* @see JFormRule
|
||||
* @see JFilterInput
|
||||
* @since 12.2
|
||||
*/
|
||||
public function validate($form, $data, $group = null)
|
||||
{
|
||||
// check if the not_required field is set
|
||||
@ -381,7 +387,7 @@ class DemoModelLook extends JModelAdmin
|
||||
}
|
||||
}
|
||||
return parent::validate($form, $data, $group);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the unique fields of this table.
|
||||
@ -539,7 +545,7 @@ class DemoModelLook extends JModelAdmin
|
||||
*
|
||||
* @return mixed An array of new IDs on success, boolean false on failure.
|
||||
*
|
||||
* @since 12.2
|
||||
* @since 12.2
|
||||
*/
|
||||
protected function batchCopy($values, $pks, $contexts)
|
||||
{
|
||||
@ -632,7 +638,7 @@ class DemoModelLook extends JModelAdmin
|
||||
$this->table->id = 0;
|
||||
|
||||
// TODO: Deal with ordering?
|
||||
// $this->table->ordering = 1;
|
||||
// $this->table->ordering = 1;
|
||||
|
||||
// Check the row.
|
||||
if (!$this->table->check())
|
||||
@ -666,7 +672,7 @@ class DemoModelLook extends JModelAdmin
|
||||
$this->cleanCache();
|
||||
|
||||
return $newIds;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch move items to a new category
|
||||
@ -677,7 +683,7 @@ class DemoModelLook extends JModelAdmin
|
||||
*
|
||||
* @return boolean True if successful, false otherwise and internal error is set.
|
||||
*
|
||||
* @since 12.2
|
||||
* @since 12.2
|
||||
*/
|
||||
protected function batchMove($values, $pks, $contexts)
|
||||
{
|
||||
@ -798,7 +804,7 @@ class DemoModelLook extends JModelAdmin
|
||||
$metadata = new JRegistry;
|
||||
$metadata->loadArray($data['metadata']);
|
||||
$data['metadata'] = (string) $metadata;
|
||||
}
|
||||
}
|
||||
|
||||
// Set the Params Items to data
|
||||
if (isset($data['params']) && is_array($data['params']))
|
||||
@ -907,14 +913,14 @@ class DemoModelLook extends JModelAdmin
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the title/s & alias.
|
||||
*
|
||||
* @param string $alias The alias.
|
||||
* @param string/array $title The title.
|
||||
*
|
||||
* @return array/string Contains the modified title/s and/or alias.
|
||||
*
|
||||
*/
|
||||
* Method to change the title/s & alias.
|
||||
*
|
||||
* @param string $alias The alias.
|
||||
* @param string/array $title The title.
|
||||
*
|
||||
* @return array/string Contains the modified title/s and/or alias.
|
||||
*
|
||||
*/
|
||||
protected function _generateNewTitle($alias, $title = null)
|
||||
{
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage looks.php
|
||||
@ -21,9 +21,6 @@
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import the Joomla modellist library
|
||||
jimport('joomla.application.component.modellist');
|
||||
|
||||
/**
|
||||
* Looks Model
|
||||
*/
|
||||
@ -95,7 +92,7 @@ class DemoModelLooks extends JModelList
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
{
|
||||
// check in items
|
||||
$this->checkInNow();
|
||||
|
||||
@ -105,11 +102,9 @@ class DemoModelLooks extends JModelList
|
||||
// set values to display correctly.
|
||||
if (DemoHelper::checkArray($items))
|
||||
{
|
||||
// get user object.
|
||||
$user = JFactory::getUser();
|
||||
foreach ($items as $nr => &$item)
|
||||
{
|
||||
$access = ($user->authorise('look.access', 'com_demo.look.' . (int) $item->id) && $user->authorise('look.access', 'com_demo'));
|
||||
$access = (JFactory::getUser()->authorise('look.access', 'com_demo.look.' . (int) $item->id) && JFactory::getUser()->authorise('look.access', 'com_demo'));
|
||||
if (!$access)
|
||||
{
|
||||
unset($items[$nr]);
|
||||
@ -117,7 +112,7 @@ class DemoModelLooks extends JModelList
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// return items
|
||||
return $items;
|
||||
@ -195,10 +190,10 @@ class DemoModelLooks extends JModelList
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get list export data.
|
||||
*
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
*/
|
||||
* Method to get list export data.
|
||||
*
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
*/
|
||||
public function getExportData($pks)
|
||||
{
|
||||
// setup the query
|
||||
@ -238,11 +233,9 @@ class DemoModelLooks extends JModelList
|
||||
// set values to display correctly.
|
||||
if (DemoHelper::checkArray($items))
|
||||
{
|
||||
// get user object.
|
||||
$user = JFactory::getUser();
|
||||
foreach ($items as $nr => &$item)
|
||||
{
|
||||
$access = ($user->authorise('look.access', 'com_demo.look.' . (int) $item->id) && $user->authorise('look.access', 'com_demo'));
|
||||
$access = (JFactory::getUser()->authorise('look.access', 'com_demo.look.' . (int) $item->id) && JFactory::getUser()->authorise('look.access', 'com_demo'));
|
||||
if (!$access)
|
||||
{
|
||||
unset($items[$nr]);
|
||||
@ -292,7 +285,7 @@ class DemoModelLooks extends JModelList
|
||||
return $headers;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get a store id based on model configuration state.
|
||||
@ -316,16 +309,16 @@ class DemoModelLooks extends JModelList
|
||||
}
|
||||
|
||||
/**
|
||||
* Build an SQL query to checkin all items left checked out longer then a set time.
|
||||
*
|
||||
* @return a bool
|
||||
*
|
||||
*/
|
||||
* Build an SQL query to checkin all items left checked out longer then a set time.
|
||||
*
|
||||
* @return a bool
|
||||
*
|
||||
*/
|
||||
protected function checkInNow()
|
||||
{
|
||||
// Get set check in time
|
||||
$time = JComponentHelper::getParams('com_demo')->get('check_in');
|
||||
|
||||
|
||||
if ($time)
|
||||
{
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage look.php
|
||||
@ -23,9 +23,6 @@ defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Registry\Registry;
|
||||
|
||||
// import Joomla table library
|
||||
jimport('joomla.database.table');
|
||||
|
||||
/**
|
||||
* Looks Table class
|
||||
*/
|
||||
@ -49,7 +46,7 @@ class DemoTableLook extends JTable
|
||||
parent::__construct('#__demo_look', 'id', $db);
|
||||
|
||||
// Adding History Options
|
||||
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_demo.look'));
|
||||
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_demo.look'));
|
||||
}
|
||||
|
||||
public function bind($array, $ignore = '')
|
||||
@ -321,11 +318,11 @@ class DemoTableLook extends JTable
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a valid alias from title / date.
|
||||
* Remains public to be able to check for duplicated alias before saving
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
* Generate a valid alias from title / date.
|
||||
* Remains public to be able to check for duplicated alias before saving
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function generateAlias()
|
||||
{
|
||||
if (empty($this->alias))
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage default.php
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage default_main.php
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage default_vdm.php
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage view.html.php
|
||||
@ -21,9 +21,6 @@
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import Joomla view library
|
||||
jimport('joomla.application.component.view');
|
||||
|
||||
/**
|
||||
* Demo View class
|
||||
*/
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage default.php
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage view.html.php
|
||||
@ -21,9 +21,6 @@
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import Joomla view library
|
||||
jimport('joomla.application.component.view');
|
||||
|
||||
/**
|
||||
* Demo Import View
|
||||
*/
|
||||
|
@ -3,7 +3,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage submitbutton.js
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage edit.php
|
||||
@ -51,7 +51,7 @@ $componentParams = JComponentHelper::getParams('com_demo');
|
||||
});
|
||||
</script>
|
||||
<div id="demo_loader" style="display: none;">
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_demo&layout=edit&id='.(int) $this->item->id.$this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_demo&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
|
||||
|
||||
<?php echo JLayoutHelper::render('look.details_above', $this); ?>
|
||||
<div class="form-horizontal">
|
||||
@ -79,6 +79,10 @@ $componentParams = JComponentHelper::getParams('com_demo');
|
||||
</div>
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
|
||||
<?php $this->ignore_fieldsets = array('details','metadata','vdmmetadata','accesscontrol'); ?>
|
||||
<?php $this->tab_name = 'lookTab'; ?>
|
||||
<?php echo JLayoutHelper::render('joomla.edit.params', $this); ?>
|
||||
|
||||
<?php if ($this->canDo->get('look.delete') || $this->canDo->get('look.edit.created_by') || $this->canDo->get('look.edit.state') || $this->canDo->get('look.edit.created')) : ?>
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'lookTab', 'publishing', JText::_('COM_DEMO_LOOK_PUBLISHING', true)); ?>
|
||||
<div class="row-fluid form-horizontal-desktop">
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage view.html.php
|
||||
@ -21,9 +21,6 @@
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import Joomla view library
|
||||
jimport('joomla.application.component.view');
|
||||
|
||||
/**
|
||||
* Look View class
|
||||
*/
|
||||
@ -46,16 +43,24 @@ class DemoViewLook extends JViewLegacy
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
$this->ref = $jinput->get('ref', 0, 'word');
|
||||
$this->refid = $jinput->get('refid', 0, 'int');
|
||||
$return = $jinput->get('return', null, 'base64');
|
||||
// set the referral string
|
||||
$this->referral = '';
|
||||
if ($this->refid)
|
||||
if ($this->refid && $this->ref)
|
||||
{
|
||||
// return to the item that refered to this item
|
||||
$this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid;
|
||||
// return to the item that referred 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;
|
||||
// return to the list view that referred to this item
|
||||
$this->referral = '&ref=' . (string)$this->ref;
|
||||
}
|
||||
// check return value
|
||||
if (!is_null($return))
|
||||
{
|
||||
// add the return value
|
||||
$this->referral .= '&return=' . (string)$return;
|
||||
}
|
||||
|
||||
// Set the toolbar
|
||||
@ -87,7 +92,7 @@ class DemoViewLook extends JViewLegacy
|
||||
|
||||
JToolbarHelper::title( JText::_($isNew ? 'COM_DEMO_LOOK_NEW' : 'COM_DEMO_LOOK_EDIT'), 'pencil-2 article-add');
|
||||
// Built the actions for new and existing records.
|
||||
if ($this->refid || $this->ref)
|
||||
if (DemoHelper::checkString($this->referral))
|
||||
{
|
||||
if ($this->canDo->get('look.create') && $isNew)
|
||||
{
|
||||
@ -189,7 +194,7 @@ class DemoViewLook extends JViewLegacy
|
||||
$this->document = JFactory::getDocument();
|
||||
}
|
||||
$this->document->setTitle(JText::_($isNew ? 'COM_DEMO_LOOK_NEW' : 'COM_DEMO_LOOK_EDIT'));
|
||||
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_demo/assets/css/look.css", (DemoHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
|
||||
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_demo/assets/css/look.css", (DemoHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
|
||||
$this->document->addScript(JURI::root() . $this->script, (DemoHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
|
||||
$this->document->addScript(JURI::root() . "administrator/components/com_demo/views/look/submitbutton.js", (DemoHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
|
||||
JText::script('view not acceptable. Error');
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage default.php
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage default_batch_body.php
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage default_batch_footer.php
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage default_body.php
|
||||
@ -70,16 +70,16 @@ $edit = "index.php?option=com_demo&view=looks&task=look.edit";
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td class="nowrap">
|
||||
<?php if ($canDo->get('look.edit')): ?>
|
||||
<div class="name">
|
||||
<div class="name">
|
||||
<?php if ($canDo->get('look.edit')): ?>
|
||||
<a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?>"><?php echo $this->escape($item->name); ?></a>
|
||||
<?php if ($item->checked_out): ?>
|
||||
<?php echo JHtml::_('jgrid.checkedout', $i, $userChkOut->name, $item->checked_out_time, 'looks.', $canCheckin); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="name"><?php echo $this->escape($item->name); ?></div>
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
<?php echo $this->escape($item->name); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</td>
|
||||
<td class="hidden-phone">
|
||||
<?php echo $this->escape($item->description); ?>
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage default_foot.php
|
||||
@ -19,7 +19,7 @@
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
?>
|
||||
<tr>
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage default_head.php
|
||||
@ -19,7 +19,7 @@
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
?>
|
||||
<tr>
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage default_toolbar.php
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage view.html.php
|
||||
@ -21,9 +21,6 @@
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import Joomla view library
|
||||
jimport('joomla.application.component.view');
|
||||
|
||||
/**
|
||||
* Demo View class for the Looks
|
||||
*/
|
||||
@ -128,7 +125,7 @@ class DemoViewLooks extends JViewLegacy
|
||||
// add the button to the page
|
||||
$dhtml = $layout->render(array('title' => $title));
|
||||
$bar->appendButton('Custom', $dhtml, 'batch');
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
|
||||
{
|
||||
@ -143,7 +140,7 @@ class DemoViewLooks extends JViewLegacy
|
||||
{
|
||||
JToolBarHelper::custom('looks.exportData', 'download', '', 'COM_DEMO_EXPORT_DATA', true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->canDo->get('core.import') && $this->canDo->get('look.import'))
|
||||
{
|
||||
@ -194,7 +191,7 @@ class DemoViewLooks extends JViewLegacy
|
||||
'batch[access]',
|
||||
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text')
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
2
demo.xml
2
demo.xml
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="component" version="3.2" method="upgrade">
|
||||
<name>COM_DEMO</name>
|
||||
<creationDate>5th May, 2018</creationDate>
|
||||
<creationDate>13th September, 2018</creationDate>
|
||||
<author>Llewellyn van der Merwe</author>
|
||||
<authorEmail>joomla@vdm.io</authorEmail>
|
||||
<authorUrl>https://www.vdm.io/</authorUrl>
|
||||
|
174
script.php
174
script.php
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage script.php
|
||||
@ -22,8 +22,6 @@
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
JHTML::_('behavior.modal');
|
||||
jimport('joomla.installer.installer');
|
||||
jimport('joomla.installer.helper');
|
||||
|
||||
/**
|
||||
* Script File of Demo Component
|
||||
@ -53,6 +51,168 @@ class com_demoInstallerScript
|
||||
// Get The Database object
|
||||
$db = JFactory::getDbo();
|
||||
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
// Select ids from fields
|
||||
$query->select($db->quoteName('id'));
|
||||
$query->from($db->quoteName('#__fields'));
|
||||
// Where look context is found
|
||||
$query->where( $db->quoteName('context') . ' = '. $db->quote('com_demo.look') );
|
||||
$db->setQuery($query);
|
||||
// Execute query to see if context is found
|
||||
$db->execute();
|
||||
$look_found = $db->getNumRows();
|
||||
// Now check if there were any rows
|
||||
if ($look_found)
|
||||
{
|
||||
// Since there are load the needed look field ids
|
||||
$look_field_ids = $db->loadColumn();
|
||||
// Remove look from the field table
|
||||
$look_condition = array( $db->quoteName('context') . ' = '. $db->quote('com_demo.look') );
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
$query->delete($db->quoteName('#__fields'));
|
||||
$query->where($look_condition);
|
||||
$db->setQuery($query);
|
||||
// Execute the query to remove look items
|
||||
$look_done = $db->execute();
|
||||
if ($look_done)
|
||||
{
|
||||
// If succesfully remove look add queued success message.
|
||||
$app->enqueueMessage(JText::_('The fields with type (com_demo.look) context was removed from the <b>#__fields</b> table'));
|
||||
}
|
||||
// Also Remove look field values
|
||||
$look_condition = array( $db->quoteName('field_id') . ' IN ('. implode(',', $look_field_ids) .')');
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
$query->delete($db->quoteName('#__fields_values'));
|
||||
$query->where($look_condition);
|
||||
$db->setQuery($query);
|
||||
// Execute the query to remove look field values
|
||||
$look_done = $db->execute();
|
||||
if ($look_done)
|
||||
{
|
||||
// If succesfully remove look add queued success message.
|
||||
$app->enqueueMessage(JText::_('The fields values for look was removed from the <b>#__fields_values</b> table'));
|
||||
}
|
||||
}
|
||||
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
// Select ids from field groups
|
||||
$query->select($db->quoteName('id'));
|
||||
$query->from($db->quoteName('#__fields_groups'));
|
||||
// Where look context is found
|
||||
$query->where( $db->quoteName('context') . ' = '. $db->quote('com_demo.look') );
|
||||
$db->setQuery($query);
|
||||
// Execute query to see if context is found
|
||||
$db->execute();
|
||||
$look_found = $db->getNumRows();
|
||||
// Now check if there were any rows
|
||||
if ($look_found)
|
||||
{
|
||||
// Remove look from the field groups table
|
||||
$look_condition = array( $db->quoteName('context') . ' = '. $db->quote('com_demo.look') );
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
$query->delete($db->quoteName('#__fields_groups'));
|
||||
$query->where($look_condition);
|
||||
$db->setQuery($query);
|
||||
// Execute the query to remove look items
|
||||
$look_done = $db->execute();
|
||||
if ($look_done)
|
||||
{
|
||||
// If succesfully remove look add queued success message.
|
||||
$app->enqueueMessage(JText::_('The field groups with type (com_demo.look) context was removed from the <b>#__fields_groups</b> table'));
|
||||
}
|
||||
}
|
||||
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
// Select id from content type table
|
||||
$query->select($db->quoteName('type_id'));
|
||||
$query->from($db->quoteName('#__content_types'));
|
||||
// Where look alias is found
|
||||
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_demo.look') );
|
||||
$db->setQuery($query);
|
||||
// Execute query to see if alias is found
|
||||
$db->execute();
|
||||
$look_found = $db->getNumRows();
|
||||
// Now check if there were any rows
|
||||
if ($look_found)
|
||||
{
|
||||
// Since there are load the needed look type ids
|
||||
$look_ids = $db->loadColumn();
|
||||
// Remove look from the content type table
|
||||
$look_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_demo.look') );
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
$query->delete($db->quoteName('#__content_types'));
|
||||
$query->where($look_condition);
|
||||
$db->setQuery($query);
|
||||
// Execute the query to remove look items
|
||||
$look_done = $db->execute();
|
||||
if ($look_done)
|
||||
{
|
||||
// If succesfully remove look add queued success message.
|
||||
$app->enqueueMessage(JText::_('The (com_demo.look) type alias was removed from the <b>#__content_type</b> table'));
|
||||
}
|
||||
|
||||
// Remove look items from the contentitem tag map table
|
||||
$look_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_demo.look') );
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
$query->delete($db->quoteName('#__contentitem_tag_map'));
|
||||
$query->where($look_condition);
|
||||
$db->setQuery($query);
|
||||
// Execute the query to remove look items
|
||||
$look_done = $db->execute();
|
||||
if ($look_done)
|
||||
{
|
||||
// If succesfully remove look add queued success message.
|
||||
$app->enqueueMessage(JText::_('The (com_demo.look) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
||||
}
|
||||
|
||||
// Remove look items from the ucm content table
|
||||
$look_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_demo.look') );
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
$query->delete($db->quoteName('#__ucm_content'));
|
||||
$query->where($look_condition);
|
||||
$db->setQuery($query);
|
||||
// Execute the query to remove look items
|
||||
$look_done = $db->execute();
|
||||
if ($look_done)
|
||||
{
|
||||
// If succesfully remove look add queued success message.
|
||||
$app->enqueueMessage(JText::_('The (com_demo.look) type alias was removed from the <b>#__ucm_content</b> table'));
|
||||
}
|
||||
|
||||
// Make sure that all the look items are cleared from DB
|
||||
foreach ($look_ids as $look_id)
|
||||
{
|
||||
// Remove look items from the ucm base table
|
||||
$look_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $look_id);
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
$query->delete($db->quoteName('#__ucm_base'));
|
||||
$query->where($look_condition);
|
||||
$db->setQuery($query);
|
||||
// Execute the query to remove look items
|
||||
$db->execute();
|
||||
|
||||
// Remove look items from the ucm history table
|
||||
$look_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $look_id);
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
$query->delete($db->quoteName('#__ucm_history'));
|
||||
$query->where($look_condition);
|
||||
$db->setQuery($query);
|
||||
// Execute the query to remove look items
|
||||
$db->execute();
|
||||
}
|
||||
}
|
||||
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
// Select id from content type table
|
||||
@ -78,7 +238,7 @@ class com_demoInstallerScript
|
||||
$db->setQuery($query);
|
||||
// Execute the query to remove Look items
|
||||
$look_done = $db->execute();
|
||||
if ($look_done);
|
||||
if ($look_done)
|
||||
{
|
||||
// If succesfully remove Look add queued success message.
|
||||
$app->enqueueMessage(JText::_('The (com_demo.look) type alias was removed from the <b>#__content_type</b> table'));
|
||||
@ -93,7 +253,7 @@ class com_demoInstallerScript
|
||||
$db->setQuery($query);
|
||||
// Execute the query to remove Look items
|
||||
$look_done = $db->execute();
|
||||
if ($look_done);
|
||||
if ($look_done)
|
||||
{
|
||||
// If succesfully remove Look add queued success message.
|
||||
$app->enqueueMessage(JText::_('The (com_demo.look) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
|
||||
@ -108,7 +268,7 @@ class com_demoInstallerScript
|
||||
$db->setQuery($query);
|
||||
// Execute the query to remove Look items
|
||||
$look_done = $db->execute();
|
||||
if ($look_done);
|
||||
if ($look_done)
|
||||
{
|
||||
// If succesfully remove Look add queued success message.
|
||||
$app->enqueueMessage(JText::_('The (com_demo.look) type alias was removed from the <b>#__ucm_content</b> table'));
|
||||
@ -152,7 +312,7 @@ class com_demoInstallerScript
|
||||
$query->where($demo_condition);
|
||||
$db->setQuery($query);
|
||||
$look_done = $db->execute();
|
||||
if ($look_done);
|
||||
if ($look_done)
|
||||
{
|
||||
// If succesfully remove demo add queued success message.
|
||||
$app->enqueueMessage(JText::_('All related items was removed from the <b>#__assets</b> table'));
|
||||
|
@ -3,7 +3,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage look.css
|
||||
|
@ -3,7 +3,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage looking.css
|
||||
|
@ -3,7 +3,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage looks.css
|
||||
|
@ -3,7 +3,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage site.css
|
||||
|
@ -3,7 +3,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage site.js
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage controller.php
|
||||
@ -21,9 +21,6 @@
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import Joomla controller library
|
||||
jimport('joomla.application.component.controller');
|
||||
|
||||
/**
|
||||
* Demo Component Controller
|
||||
*/
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage look.php
|
||||
@ -21,9 +21,6 @@
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import Joomla controllerform library
|
||||
jimport('joomla.application.component.controllerform');
|
||||
|
||||
/**
|
||||
* Look Controller
|
||||
*/
|
||||
@ -38,6 +35,13 @@ class DemoControllerLook extends JControllerForm
|
||||
*/
|
||||
protected $task;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param array $config A named array of configuration variables.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
$this->view_list = 'looks'; // safeguard for setting the return view listing to the default site view.
|
||||
@ -55,14 +59,17 @@ class DemoControllerLook extends JControllerForm
|
||||
*/
|
||||
protected function allowAdd($data = array())
|
||||
{
|
||||
// Get user object.
|
||||
$user = JFactory::getUser();
|
||||
// Access check.
|
||||
$access = JFactory::getUser()->authorise('look.access', 'com_demo');
|
||||
$access = $user->authorise('look.access', 'com_demo');
|
||||
if (!$access)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// In the absense of better information, revert to the component permissions.
|
||||
return JFactory::getUser()->authorise('look.create', $this->option);
|
||||
return $user->authorise('look.create', $this->option);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -78,9 +85,9 @@ class DemoControllerLook extends JControllerForm
|
||||
protected function allowEdit($data = array(), $key = 'id')
|
||||
{
|
||||
// get user object.
|
||||
$user = JFactory::getUser();
|
||||
$user = JFactory::getUser();
|
||||
// get record id.
|
||||
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
|
||||
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
|
||||
|
||||
|
||||
// Access check.
|
||||
@ -136,42 +143,25 @@ class DemoControllerLook extends JControllerForm
|
||||
*
|
||||
* @return string The arguments to append to the redirect URL.
|
||||
*
|
||||
* @since 12.2
|
||||
* @since 1.6
|
||||
*/
|
||||
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
|
||||
{
|
||||
$tmpl = $this->input->get('tmpl');
|
||||
$layout = $this->input->get('layout', 'edit', 'string');
|
||||
// get the referral options (old method use return instead see parent)
|
||||
$ref = $this->input->get('ref', 0, 'string');
|
||||
$refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
$ref = $this->input->get('ref', 0, 'string');
|
||||
$refid = $this->input->get('refid', 0, 'int');
|
||||
// get redirect info.
|
||||
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
|
||||
|
||||
// Setup redirect info.
|
||||
|
||||
$append = '';
|
||||
|
||||
if ($refid)
|
||||
{
|
||||
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid;
|
||||
// set the referral options
|
||||
if ($refid && $ref)
|
||||
{
|
||||
$append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append;
|
||||
}
|
||||
elseif ($ref)
|
||||
{
|
||||
$append .= '&ref='.(string)$ref;
|
||||
}
|
||||
|
||||
if ($tmpl)
|
||||
{
|
||||
$append .= '&tmpl=' . $tmpl;
|
||||
}
|
||||
|
||||
if ($layout)
|
||||
{
|
||||
$append .= '&layout=' . $layout;
|
||||
}
|
||||
|
||||
if ($recordId)
|
||||
{
|
||||
$append .= '&' . $urlVar . '=' . $recordId;
|
||||
$append = '&ref='. (string)$ref . $append;
|
||||
}
|
||||
|
||||
return $append;
|
||||
@ -210,43 +200,45 @@ class DemoControllerLook extends JControllerForm
|
||||
*/
|
||||
public function cancel($key = null)
|
||||
{
|
||||
// get the referal details
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
// get the referral options
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
// Check if there is a return value
|
||||
$return = $this->input->get('return', null, 'base64');
|
||||
|
||||
$cancel = parent::cancel($key);
|
||||
|
||||
if ($cancel)
|
||||
if (!is_null($return) && JUri::isInternal(base64_decode($return)))
|
||||
{
|
||||
if ($this->refid)
|
||||
{
|
||||
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid;
|
||||
$redirect = base64_decode($return);
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view='.(string)$this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Redirect to the items screen.
|
||||
// Redirect to the return value.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . '&view=' . $this->view_list, false
|
||||
$redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->refid && $this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
'index.php?option=' . $this->option . $redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -265,11 +257,15 @@ class DemoControllerLook extends JControllerForm
|
||||
*/
|
||||
public function save($key = null, $urlVar = null)
|
||||
{
|
||||
// get the referal details
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
// get the referral options
|
||||
$this->ref = $this->input->get('ref', 0, 'word');
|
||||
$this->refid = $this->input->get('refid', 0, 'int');
|
||||
|
||||
if ($this->ref || $this->refid)
|
||||
// Check if there is a return value
|
||||
$return = $this->input->get('return', null, 'base64');
|
||||
$canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return)));
|
||||
|
||||
if ($this->ref || $this->refid || $canReturn)
|
||||
{
|
||||
// to make sure the item is checkedin on redirect
|
||||
$this->task = 'save';
|
||||
@ -277,9 +273,22 @@ class DemoControllerLook extends JControllerForm
|
||||
|
||||
$saved = parent::save($key, $urlVar);
|
||||
|
||||
if ($this->refid && $saved)
|
||||
// This is not needed since parent save already does this
|
||||
// Due to the ref and refid implementation we need to add this
|
||||
if ($canReturn)
|
||||
{
|
||||
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid;
|
||||
$redirect = base64_decode($return);
|
||||
|
||||
// Redirect to the return value.
|
||||
$this->setRedirect(
|
||||
JRoute::_(
|
||||
$redirect, false
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->refid && $this->ref)
|
||||
{
|
||||
$redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid;
|
||||
|
||||
// Redirect to the item screen.
|
||||
$this->setRedirect(
|
||||
@ -288,9 +297,9 @@ class DemoControllerLook extends JControllerForm
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($this->ref && $saved)
|
||||
elseif ($this->ref)
|
||||
{
|
||||
$redirect = '&view='.(string)$this->ref;
|
||||
$redirect = '&view=' . (string)$this->ref;
|
||||
|
||||
// Redirect to the list screen.
|
||||
$this->setRedirect(
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage demo.php
|
||||
@ -20,6 +20,7 @@
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
JHtml::_('behavior.tabstate');
|
||||
|
||||
// Set the component css/js
|
||||
$document = JFactory::getDocument();
|
||||
@ -27,18 +28,14 @@ $document->addStyleSheet('components/com_demo/assets/css/site.css');
|
||||
$document->addScript('components/com_demo/assets/js/site.js');
|
||||
|
||||
// Require helper files
|
||||
JLoader::register('DemoHelper', dirname(__FILE__) . '/helpers/demo.php');
|
||||
JLoader::register('DemoHelperRoute', dirname(__FILE__) . '/helpers/route.php');
|
||||
|
||||
// import joomla controller library
|
||||
jimport('joomla.application.component.controller');
|
||||
JLoader::register('DemoHelper', __DIR__ . '/helpers/demo.php');
|
||||
JLoader::register('DemoHelperRoute', __DIR__ . '/helpers/route.php');
|
||||
|
||||
// Get an instance of the controller prefixed by Demo
|
||||
$controller = JControllerLegacy::getInstance('Demo');
|
||||
|
||||
// Perform the request task
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
$controller->execute($jinput->get('task', null, 'CMD'));
|
||||
$controller->execute(JFactory::getApplication()->input->get('task'));
|
||||
|
||||
// Redirect if set by the controller
|
||||
$controller->redirect();
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage category.php
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage demo.php
|
||||
@ -25,7 +25,7 @@ defined('_JEXEC') or die('Restricted access');
|
||||
* Demo component helper
|
||||
*/
|
||||
abstract class DemoHelper
|
||||
{
|
||||
{
|
||||
|
||||
/**
|
||||
* Change to nice fancy date
|
||||
@ -72,7 +72,7 @@ abstract class DemoHelper
|
||||
&& ($timestamp <= PHP_INT_MAX)
|
||||
&& ($timestamp >= ~PHP_INT_MAX);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name')
|
||||
{
|
||||
@ -97,16 +97,16 @@ abstract class DemoHelper
|
||||
{
|
||||
if ($external)
|
||||
{
|
||||
if ($name = self::getVar(null, $val, $id, $name, '=', $table))
|
||||
if ($_name = self::getVar(null, $val, $id, $name, '=', $table))
|
||||
{
|
||||
$names[] = $name;
|
||||
$names[] = $_name;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($name = self::getVar($table, $val, $id, $name))
|
||||
if ($_name = self::getVar($table, $val, $id, $name))
|
||||
{
|
||||
$names[] = $name;
|
||||
$names[] = $_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -188,8 +188,8 @@ abstract class DemoHelper
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be used to build help urls.
|
||||
**/
|
||||
* Can be used to build help urls.
|
||||
**/
|
||||
public static function getHelpUrl($view)
|
||||
{
|
||||
return false;
|
||||
@ -340,7 +340,7 @@ abstract class DemoHelper
|
||||
}
|
||||
}
|
||||
// check if there are any view values remaining
|
||||
if (count($_result))
|
||||
if (count((array)$_result))
|
||||
{
|
||||
$_result = json_encode($_result);
|
||||
$_result = array($_result);
|
||||
@ -446,10 +446,50 @@ abstract class DemoHelper
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the field object
|
||||
*
|
||||
* @param array $attributes The array of attributes
|
||||
* @param string $default The default of the field
|
||||
* @param array $options The options to apply to the XML element
|
||||
*
|
||||
* @return object
|
||||
*
|
||||
*/
|
||||
public static function getFieldObject($attributes, $default = '', $options = null)
|
||||
{
|
||||
// make sure we have attributes and a type value
|
||||
if (self::checkArray($attributes) && isset($attributes['type']))
|
||||
{
|
||||
// make sure the form helper class is loaded
|
||||
if (!method_exists('JFormHelper', 'loadFieldType'))
|
||||
{
|
||||
jimport('joomla.form.form');
|
||||
}
|
||||
// get field type
|
||||
$field = JFormHelper::loadFieldType($attributes['type'],true);
|
||||
// start field xml
|
||||
$XML = new SimpleXMLElement('<field/>');
|
||||
// load the attributes
|
||||
self::xmlAddAttributes($XML, $attributes);
|
||||
// check if we have options
|
||||
if (self::checkArray($options))
|
||||
{
|
||||
// load the options
|
||||
self::xmlAddOptions($XML, $options);
|
||||
}
|
||||
// setup the field
|
||||
$field->setup($XML, $default);
|
||||
// return the field object
|
||||
return $field;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render Bool Button
|
||||
*
|
||||
* @param array $args All the args for the button
|
||||
* @param array $args All the args for the button
|
||||
* 0) name
|
||||
* 1) additional (options class) // not used at this time
|
||||
* 2) default
|
||||
@ -464,8 +504,6 @@ abstract class DemoHelper
|
||||
$args = func_get_args();
|
||||
// check if there is additional button class
|
||||
$additional = isset($args[1]) ? (string) $args[1] : ''; // not used at this time
|
||||
// start the xml
|
||||
$buttonXML = new SimpleXMLElement('<field/>');
|
||||
// button attributes
|
||||
$buttonAttributes = array(
|
||||
'type' => 'radio',
|
||||
@ -474,27 +512,17 @@ abstract class DemoHelper
|
||||
'class' => 'btn-group',
|
||||
'filter' => 'INT',
|
||||
'default' => isset($args[2]) ? (int) $args[2] : 0);
|
||||
// load the haskey attributes
|
||||
self::xmlAddAttributes($buttonXML, $buttonAttributes);
|
||||
// set the button options
|
||||
$buttonOptions = array(
|
||||
'1' => isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES',
|
||||
'0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO');
|
||||
// load the button options
|
||||
self::xmlAddOptions($buttonXML, $buttonOptions);
|
||||
|
||||
// get the radio element
|
||||
$button = JFormHelper::loadFieldType('radio');
|
||||
|
||||
// run
|
||||
$button->setup($buttonXML, $buttonAttributes['default']);
|
||||
|
||||
return $button->input;
|
||||
// return the input
|
||||
return self::getFieldObject($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input;
|
||||
}
|
||||
|
||||
/**
|
||||
* UIKIT Component Classes
|
||||
**/
|
||||
* UIKIT Component Classes
|
||||
**/
|
||||
public static $uk_components = array(
|
||||
'data-uk-grid' => array(
|
||||
'grid' ),
|
||||
@ -548,15 +576,15 @@ abstract class DemoHelper
|
||||
'upload-drop' => array(
|
||||
'upload', 'form-file' )
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Add UIKIT Components
|
||||
**/
|
||||
* Add UIKIT Components
|
||||
**/
|
||||
public static $uikit = false;
|
||||
|
||||
/**
|
||||
* Get UIKIT Components
|
||||
**/
|
||||
* Get UIKIT Components
|
||||
**/
|
||||
public static function getUikitComp($content,$classes = array())
|
||||
{
|
||||
if (strpos($content,'class="uk-') !== false)
|
||||
@ -586,13 +614,13 @@ abstract class DemoHelper
|
||||
}
|
||||
return $temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (self::checkArray($classes))
|
||||
{
|
||||
return $classes;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a variable
|
||||
@ -982,7 +1010,7 @@ abstract class DemoHelper
|
||||
**/
|
||||
public static function checkArray($array, $removeEmptyString = false)
|
||||
{
|
||||
if (isset($array) && is_array($array) && count($array) > 0)
|
||||
if (isset($array) && is_array($array) && count((array)$array) > 0)
|
||||
{
|
||||
// also make sure the empty strings are removed
|
||||
if ($removeEmptyString)
|
||||
@ -1085,7 +1113,7 @@ abstract class DemoHelper
|
||||
{
|
||||
$initial = strlen($string);
|
||||
$words = preg_split('/([\s\n\r]+)/', $string, null, PREG_SPLIT_DELIM_CAPTURE);
|
||||
$words_count = count($words);
|
||||
$words_count = count((array)$words);
|
||||
|
||||
$word_length = 0;
|
||||
$last_word = 0;
|
||||
@ -1120,7 +1148,7 @@ abstract class DemoHelper
|
||||
*
|
||||
* @returns string on success
|
||||
**/
|
||||
public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true)
|
||||
public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true)
|
||||
{
|
||||
if ($replaceNumbers === true)
|
||||
{
|
||||
@ -1149,7 +1177,16 @@ abstract class DemoHelper
|
||||
$string = trim($string);
|
||||
$string = preg_replace('/'.$spacer.'+/', ' ', $string);
|
||||
$string = preg_replace('/\s+/', ' ', $string);
|
||||
$string = preg_replace("/[^A-Za-z ]/", '', $string);
|
||||
// remove all and keep only characters
|
||||
if ($keepOnlyCharacters)
|
||||
{
|
||||
$string = preg_replace("/[^A-Za-z ]/", '', $string);
|
||||
}
|
||||
// keep both numbers and characters
|
||||
else
|
||||
{
|
||||
$string = preg_replace("/[^A-Za-z0-9 ]/", '', $string);
|
||||
}
|
||||
// select final adaptations
|
||||
if ($type === 'L' || $type === 'strtolower')
|
||||
{
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage headercheck.php
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage route.php
|
||||
@ -21,10 +21,6 @@
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// Component Helper
|
||||
jimport('joomla.application.component.helper');
|
||||
jimport('joomla.application.categories');
|
||||
|
||||
/**
|
||||
* Demo Route Helper
|
||||
**/
|
||||
@ -33,8 +29,8 @@ abstract class DemoHelperRoute
|
||||
protected static $lookup;
|
||||
|
||||
/**
|
||||
* @param int The route of the Looks
|
||||
*/
|
||||
* @param int The route of the Looks
|
||||
*/
|
||||
public static function getLooksRoute($id = 0, $catid = 0)
|
||||
{
|
||||
if ($id > 0)
|
||||
@ -74,8 +70,8 @@ abstract class DemoHelperRoute
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int The route of the Looking
|
||||
*/
|
||||
* @param int The route of the Looking
|
||||
*/
|
||||
public static function getLookingRoute($id = 0, $catid = 0)
|
||||
{
|
||||
if ($id > 0)
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage details_above.php
|
||||
@ -19,7 +19,6 @@
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$form = $displayData->getForm();
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage details_fullwidth.php
|
||||
@ -19,7 +19,6 @@
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$form = $displayData->getForm();
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage details_under.php
|
||||
@ -19,7 +19,6 @@
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$form = $displayData->getForm();
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage metadata.php
|
||||
@ -19,7 +19,6 @@
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$form = $displayData->getForm();
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage more_left.php
|
||||
@ -19,7 +19,6 @@
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$form = $displayData->getForm();
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage more_right.php
|
||||
@ -19,7 +19,6 @@
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$form = $displayData->getForm();
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage publishing.php
|
||||
@ -19,7 +19,6 @@
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
|
@ -3,7 +3,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage look.js
|
||||
@ -20,6 +20,7 @@
|
||||
// Some Global Values
|
||||
jform_vvvvvvvvvv_required = false;
|
||||
jform_vvvvvvvvvw_required = false;
|
||||
jform_vvvvvvvvvx_required = false;
|
||||
|
||||
// Initial Script
|
||||
jQuery(document).ready(function()
|
||||
@ -35,50 +36,70 @@ function vvvvvvv(add_vvvvvvv)
|
||||
if (add_vvvvvvv == 1)
|
||||
{
|
||||
jQuery('#jform_dateofbirth').closest('.control-group').show();
|
||||
jQuery('#jform_email').closest('.control-group').show();
|
||||
// add required attribute to dateofbirth field
|
||||
if (jform_vvvvvvvvvv_required)
|
||||
{
|
||||
updateFieldRequired('dateofbirth',0);
|
||||
jQuery('#jform_dateofbirth').prop('required','required');
|
||||
jQuery('#jform_dateofbirth').attr('aria-required',true);
|
||||
jQuery('#jform_dateofbirth').addClass('required');
|
||||
jform_vvvvvvvvvv_required = false;
|
||||
}
|
||||
jQuery('#jform_email').closest('.control-group').show();
|
||||
// add required attribute to email field
|
||||
if (jform_vvvvvvvvvw_required)
|
||||
{
|
||||
updateFieldRequired('email',0);
|
||||
jQuery('#jform_email').prop('required','required');
|
||||
jQuery('#jform_email').attr('aria-required',true);
|
||||
jQuery('#jform_email').addClass('required');
|
||||
jform_vvvvvvvvvv_required = false;
|
||||
jform_vvvvvvvvvw_required = false;
|
||||
}
|
||||
|
||||
jQuery('#jform_image').closest('.control-group').show();
|
||||
jQuery('#jform_mobile_phone').closest('.control-group').show();
|
||||
if (jform_vvvvvvvvvw_required)
|
||||
// add required attribute to mobile_phone field
|
||||
if (jform_vvvvvvvvvx_required)
|
||||
{
|
||||
updateFieldRequired('mobile_phone',0);
|
||||
jQuery('#jform_mobile_phone').prop('required','required');
|
||||
jQuery('#jform_mobile_phone').attr('aria-required',true);
|
||||
jQuery('#jform_mobile_phone').addClass('required');
|
||||
jform_vvvvvvvvvw_required = false;
|
||||
jform_vvvvvvvvvx_required = false;
|
||||
}
|
||||
|
||||
jQuery('#jform_website').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_dateofbirth').closest('.control-group').hide();
|
||||
jQuery('#jform_email').closest('.control-group').hide();
|
||||
// remove required attribute from dateofbirth field
|
||||
if (!jform_vvvvvvvvvv_required)
|
||||
{
|
||||
updateFieldRequired('dateofbirth',1);
|
||||
jQuery('#jform_dateofbirth').removeAttr('required');
|
||||
jQuery('#jform_dateofbirth').removeAttr('aria-required');
|
||||
jQuery('#jform_dateofbirth').removeClass('required');
|
||||
jform_vvvvvvvvvv_required = true;
|
||||
}
|
||||
jQuery('#jform_email').closest('.control-group').hide();
|
||||
// remove required attribute from email field
|
||||
if (!jform_vvvvvvvvvw_required)
|
||||
{
|
||||
updateFieldRequired('email',1);
|
||||
jQuery('#jform_email').removeAttr('required');
|
||||
jQuery('#jform_email').removeAttr('aria-required');
|
||||
jQuery('#jform_email').removeClass('required');
|
||||
jform_vvvvvvvvvv_required = true;
|
||||
jform_vvvvvvvvvw_required = true;
|
||||
}
|
||||
jQuery('#jform_image').closest('.control-group').hide();
|
||||
jQuery('#jform_mobile_phone').closest('.control-group').hide();
|
||||
if (!jform_vvvvvvvvvw_required)
|
||||
// remove required attribute from mobile_phone field
|
||||
if (!jform_vvvvvvvvvx_required)
|
||||
{
|
||||
updateFieldRequired('mobile_phone',1);
|
||||
jQuery('#jform_mobile_phone').removeAttr('required');
|
||||
jQuery('#jform_mobile_phone').removeAttr('aria-required');
|
||||
jQuery('#jform_mobile_phone').removeClass('required');
|
||||
jform_vvvvvvvvvw_required = true;
|
||||
jform_vvvvvvvvvx_required = true;
|
||||
}
|
||||
jQuery('#jform_website').closest('.control-group').hide();
|
||||
}
|
||||
|
@ -142,6 +142,7 @@
|
||||
class="text_area"
|
||||
filter="url"
|
||||
validated="url"
|
||||
scheme="http,https"
|
||||
message="COM_DEMO_LOOK_WEBSITE_MESSAGE"
|
||||
hint="COM_DEMO_LOOK_WEBSITE_HINT"
|
||||
/>
|
||||
@ -160,6 +161,11 @@
|
||||
default="1970-01-01"
|
||||
description="COM_DEMO_LOOK_DATEOFBIRTH_DESCRIPTION"
|
||||
format="%Y-%m-%d"
|
||||
filter="STRING"
|
||||
required="true"
|
||||
todaybutton="false"
|
||||
minyear="-120"
|
||||
maxyear="-1"
|
||||
/>
|
||||
<!-- Mobile_phone Field. Type: Tel. (joomla) -->
|
||||
<field
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage look.php
|
||||
@ -23,9 +23,6 @@ defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
use Joomla\Registry\Registry;
|
||||
|
||||
// import Joomla modelform library
|
||||
jimport('joomla.application.component.modeladmin');
|
||||
|
||||
/**
|
||||
* Demo Look Model
|
||||
*/
|
||||
@ -58,6 +55,9 @@ class DemoModelLook extends JModelAdmin
|
||||
*/
|
||||
public function getTable($type = 'look', $prefix = 'DemoTable', $config = array())
|
||||
{
|
||||
// add table path for when model gets used from other component
|
||||
$this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_demo/tables');
|
||||
// get instance of the table
|
||||
return JTable::getInstance($type, $prefix, $config);
|
||||
}
|
||||
|
||||
@ -98,22 +98,25 @@ class DemoModelLook extends JModelAdmin
|
||||
}
|
||||
|
||||
return $item;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the record form.
|
||||
*
|
||||
* @param array $data Data for the form.
|
||||
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
|
||||
* @param array $options Optional array of options for the form creation.
|
||||
*
|
||||
* @return mixed A JForm object on success, false on failure
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getForm($data = array(), $loadData = true)
|
||||
{
|
||||
public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform'))
|
||||
{
|
||||
// set load data option
|
||||
$options['load_data'] = $loadData;
|
||||
// Get the form.
|
||||
$form = $this->loadForm('com_demo.look', 'look', array('control' => 'jform', 'load_data' => $loadData));
|
||||
$form = $this->loadForm('com_demo.look', 'look', $options);
|
||||
|
||||
if (empty($form))
|
||||
{
|
||||
@ -176,17 +179,20 @@ class DemoModelLook extends JModelAdmin
|
||||
// Only load these values if no id is found
|
||||
if (0 == $id)
|
||||
{
|
||||
// Set redirected field name
|
||||
$redirectedField = $jinput->get('ref', null, 'STRING');
|
||||
// Set redirected field value
|
||||
$redirectedValue = $jinput->get('refid', 0, 'INT');
|
||||
// Set redirected view name
|
||||
$redirectedView = $jinput->get('ref', null, 'STRING');
|
||||
// Set field name (or fall back to view name)
|
||||
$redirectedField = $jinput->get('field', $redirectedView, 'STRING');
|
||||
// Set redirected view id
|
||||
$redirectedId = $jinput->get('refid', 0, 'INT');
|
||||
// Set field id (or fall back to redirected view id)
|
||||
$redirectedValue = $jinput->get('field_id', $redirectedId, 'INT');
|
||||
if (0 != $redirectedValue && $redirectedField)
|
||||
{
|
||||
// Now set the local-redirected field default value
|
||||
$form->setValue($redirectedField, null, $redirectedValue);
|
||||
}
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
@ -237,7 +243,7 @@ class DemoModelLook extends JModelAdmin
|
||||
protected function canEditState($record)
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
$recordId = (!empty($record->id)) ? $record->id : 0;
|
||||
$recordId = (!empty($record->id)) ? $record->id : 0;
|
||||
|
||||
if ($recordId)
|
||||
{
|
||||
@ -348,18 +354,18 @@ class DemoModelLook extends JModelAdmin
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to validate the form data.
|
||||
*
|
||||
* @param JForm $form The form to validate against.
|
||||
* @param array $data The data to validate.
|
||||
* @param string $group The name of the field group to validate.
|
||||
*
|
||||
* @return mixed Array of filtered data if valid, false otherwise.
|
||||
*
|
||||
* @see JFormRule
|
||||
* @see JFilterInput
|
||||
* @since 12.2
|
||||
*/
|
||||
* Method to validate the form data.
|
||||
*
|
||||
* @param JForm $form The form to validate against.
|
||||
* @param array $data The data to validate.
|
||||
* @param string $group The name of the field group to validate.
|
||||
*
|
||||
* @return mixed Array of filtered data if valid, false otherwise.
|
||||
*
|
||||
* @see JFormRule
|
||||
* @see JFilterInput
|
||||
* @since 12.2
|
||||
*/
|
||||
public function validate($form, $data, $group = null)
|
||||
{
|
||||
// check if the not_required field is set
|
||||
@ -381,7 +387,7 @@ class DemoModelLook extends JModelAdmin
|
||||
}
|
||||
}
|
||||
return parent::validate($form, $data, $group);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the unique fields of this table.
|
||||
@ -539,7 +545,7 @@ class DemoModelLook extends JModelAdmin
|
||||
*
|
||||
* @return mixed An array of new IDs on success, boolean false on failure.
|
||||
*
|
||||
* @since 12.2
|
||||
* @since 12.2
|
||||
*/
|
||||
protected function batchCopy($values, $pks, $contexts)
|
||||
{
|
||||
@ -632,7 +638,7 @@ class DemoModelLook extends JModelAdmin
|
||||
$this->table->id = 0;
|
||||
|
||||
// TODO: Deal with ordering?
|
||||
// $this->table->ordering = 1;
|
||||
// $this->table->ordering = 1;
|
||||
|
||||
// Check the row.
|
||||
if (!$this->table->check())
|
||||
@ -666,7 +672,7 @@ class DemoModelLook extends JModelAdmin
|
||||
$this->cleanCache();
|
||||
|
||||
return $newIds;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch move items to a new category
|
||||
@ -677,7 +683,7 @@ class DemoModelLook extends JModelAdmin
|
||||
*
|
||||
* @return boolean True if successful, false otherwise and internal error is set.
|
||||
*
|
||||
* @since 12.2
|
||||
* @since 12.2
|
||||
*/
|
||||
protected function batchMove($values, $pks, $contexts)
|
||||
{
|
||||
@ -798,7 +804,7 @@ class DemoModelLook extends JModelAdmin
|
||||
$metadata = new JRegistry;
|
||||
$metadata->loadArray($data['metadata']);
|
||||
$data['metadata'] = (string) $metadata;
|
||||
}
|
||||
}
|
||||
|
||||
// Set the Params Items to data
|
||||
if (isset($data['params']) && is_array($data['params']))
|
||||
@ -907,14 +913,14 @@ class DemoModelLook extends JModelAdmin
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the title/s & alias.
|
||||
*
|
||||
* @param string $alias The alias.
|
||||
* @param string/array $title The title.
|
||||
*
|
||||
* @return array/string Contains the modified title/s and/or alias.
|
||||
*
|
||||
*/
|
||||
* Method to change the title/s & alias.
|
||||
*
|
||||
* @param string $alias The alias.
|
||||
* @param string/array $title The title.
|
||||
*
|
||||
* @return array/string Contains the modified title/s and/or alias.
|
||||
*
|
||||
*/
|
||||
protected function _generateNewTitle($alias, $title = null)
|
||||
{
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage looking.php
|
||||
@ -21,9 +21,6 @@
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import Joomla modelitem library
|
||||
jimport('joomla.application.component.modelitem');
|
||||
|
||||
/**
|
||||
* Demo Looking Model
|
||||
*/
|
||||
@ -123,8 +120,8 @@ class DemoModelLooking extends JModelItem
|
||||
|
||||
// Get from #__demo_look as a
|
||||
$query->select($db->quoteName(
|
||||
array('a.id','a.name','a.alias','a.description','a.add','a.email','a.mobile_phone','a.dateofbirth','a.image','a.website','a.published','a.hits'),
|
||||
array('id','name','alias','description','add','email','mobile_phone','dateofbirth','image','website','published','hits')));
|
||||
array('a.id','a.name','a.alias','a.description','a.add','a.email','a.mobile_phone','a.dateofbirth','a.image','a.website','a.published','a.hits','a.created_by'),
|
||||
array('id','name','alias','description','add','email','mobile_phone','dateofbirth','image','website','published','hits','created_by')));
|
||||
$query->from($db->quoteName('#__demo_look', 'a'));
|
||||
$query->where('a.id = ' . (int) $pk);
|
||||
|
||||
@ -144,11 +141,13 @@ class DemoModelLooking extends JModelItem
|
||||
// Load the JEvent Dispatcher
|
||||
JPluginHelper::importPlugin('content');
|
||||
$this->_dispatcher = JEventDispatcher::getInstance();
|
||||
// Check if item has params, or pass whole item.
|
||||
$params = (isset($data->params) && DemoHelper::checkJson($data->params)) ? json_decode($data->params) : $data;
|
||||
// Make sure the content prepare plugins fire on description
|
||||
$_description = new stdClass();
|
||||
$_description->text =& $data->description; // value must be in text
|
||||
// Since all values are now in text (Joomla Limitation), we also add the field name (description) to context
|
||||
$this->_dispatcher->trigger("onContentPrepare", array('com_demo.looking.description', &$_description, &$this->params, 0));
|
||||
$this->_dispatcher->trigger("onContentPrepare", array('com_demo.looking.description', &$_description, &$params, 0));
|
||||
// Checking if description has uikit components that must be loaded.
|
||||
$this->uikitComp = DemoHelper::getUikitComp($data->description,$this->uikitComp);
|
||||
|
||||
@ -171,15 +170,14 @@ class DemoModelLooking extends JModelItem
|
||||
}
|
||||
|
||||
return $this->_item[$pk];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uikit needed components
|
||||
*
|
||||
* @return mixed An array of objects on success.
|
||||
*
|
||||
*/
|
||||
* Get the uikit needed components
|
||||
*
|
||||
* @return mixed An array of objects on success.
|
||||
*
|
||||
*/
|
||||
public function getUikitComp()
|
||||
{
|
||||
if (isset($this->uikitComp) && DemoHelper::checkArray($this->uikitComp))
|
||||
@ -187,5 +185,5 @@ class DemoModelLooking extends JModelItem
|
||||
return $this->uikitComp;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage looks.php
|
||||
@ -21,9 +21,6 @@
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import the Joomla modellist library
|
||||
jimport('joomla.application.component.modellist');
|
||||
|
||||
/**
|
||||
* Demo Model for Looks
|
||||
*/
|
||||
@ -68,8 +65,8 @@ class DemoModelLooks extends JModelList
|
||||
|
||||
// Get from #__demo_look as a
|
||||
$query->select($db->quoteName(
|
||||
array('a.id','a.name','a.alias','a.description','a.add','a.email','a.mobile_phone','a.dateofbirth','a.image','a.website','a.not_required','a.published','a.hits','a.ordering'),
|
||||
array('id','name','alias','description','add','email','mobile_phone','dateofbirth','image','website','not_required','published','hits','ordering')));
|
||||
array('a.id','a.name','a.alias','a.description','a.add','a.email','a.mobile_phone','a.dateofbirth','a.image','a.website','a.not_required','a.published','a.hits','a.ordering','a.created_by'),
|
||||
array('id','name','alias','description','add','email','mobile_phone','dateofbirth','image','website','not_required','published','hits','ordering','created_by')));
|
||||
$query->from($db->quoteName('#__demo_look', 'a'));
|
||||
// Get where a.published is 1
|
||||
$query->where('a.published = 1');
|
||||
@ -95,7 +92,7 @@ class DemoModelLooks extends JModelList
|
||||
// redirect away to the home page if no access allowed.
|
||||
$app->redirect(JURI::root());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// load parent items
|
||||
$items = parent::getItems();
|
||||
|
||||
@ -112,15 +109,17 @@ class DemoModelLooks extends JModelList
|
||||
{
|
||||
// Always create a slug for sef URL's
|
||||
$item->slug = (isset($item->alias) && isset($item->id)) ? $item->id.':'.$item->alias : $item->id;
|
||||
// Check if item has params, or pass whole item.
|
||||
$params = (isset($item->params) && DemoHelper::checkJson($item->params)) ? json_decode($item->params) : $item;
|
||||
// Make sure the content prepare plugins fire on description
|
||||
$_description = new stdClass();
|
||||
$_description->text =& $item->description; // value must be in text
|
||||
// Since all values are now in text (Joomla Limitation), we also add the field name (description) to context
|
||||
$this->_dispatcher->trigger("onContentPrepare", array('com_demo.looks.description', &$_description, &$this->params, 0));
|
||||
$this->_dispatcher->trigger("onContentPrepare", array('com_demo.looks.description', &$_description, &$params, 0));
|
||||
// Checking if description has uikit components that must be loaded.
|
||||
$this->uikitComp = DemoHelper::getUikitComp($item->description,$this->uikitComp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// do a quick build of all edit links links
|
||||
@ -146,15 +145,14 @@ class DemoModelLooks extends JModelList
|
||||
|
||||
// return items
|
||||
return $items;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uikit needed components
|
||||
*
|
||||
* @return mixed An array of objects on success.
|
||||
*
|
||||
*/
|
||||
* Get the uikit needed components
|
||||
*
|
||||
* @return mixed An array of objects on success.
|
||||
*
|
||||
*/
|
||||
public function getUikitComp()
|
||||
{
|
||||
if (isset($this->uikitComp) && DemoHelper::checkArray($this->uikitComp))
|
||||
@ -162,5 +160,5 @@ class DemoModelLooks extends JModelList
|
||||
return $this->uikitComp;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage router.php
|
||||
|
@ -3,7 +3,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage submitbutton.js
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage edit.php
|
||||
@ -31,7 +31,7 @@ JHtml::_('behavior.calendar');
|
||||
$componentParams = JComponentHelper::getParams('com_demo');
|
||||
?>
|
||||
<?php echo $this->toolbar->render(); ?>
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_demo&layout=edit&id='.(int) $this->item->id.$this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_demo&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
|
||||
|
||||
<?php echo JLayoutHelper::render('look.details_above', $this); ?>
|
||||
<div class="form-horizontal">
|
||||
@ -59,6 +59,10 @@ $componentParams = JComponentHelper::getParams('com_demo');
|
||||
</div>
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
|
||||
<?php $this->ignore_fieldsets = array('details','metadata','vdmmetadata','accesscontrol'); ?>
|
||||
<?php $this->tab_name = 'lookTab'; ?>
|
||||
<?php echo JLayoutHelper::render('joomla.edit.params', $this); ?>
|
||||
|
||||
<?php if ($this->canDo->get('look.delete') || $this->canDo->get('look.edit.created_by') || $this->canDo->get('look.edit.state') || $this->canDo->get('look.edit.created')) : ?>
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'lookTab', 'publishing', JText::_('COM_DEMO_LOOK_PUBLISHING', true)); ?>
|
||||
<div class="row-fluid form-horizontal-desktop">
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage view.html.php
|
||||
@ -21,9 +21,6 @@
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import Joomla view library
|
||||
jimport('joomla.application.component.view');
|
||||
|
||||
/**
|
||||
* Look View class
|
||||
*/
|
||||
@ -36,26 +33,34 @@ class DemoViewLook extends JViewLegacy
|
||||
public function display($tpl = null)
|
||||
{
|
||||
// Assign the variables
|
||||
$this->form = $this->get('Form');
|
||||
$this->item = $this->get('Item');
|
||||
$this->script = $this->get('Script');
|
||||
$this->state = $this->get('State');
|
||||
$this->form = $this->get('Form');
|
||||
$this->item = $this->get('Item');
|
||||
$this->script = $this->get('Script');
|
||||
$this->state = $this->get('State');
|
||||
// get action permissions
|
||||
$this->canDo = DemoHelper::getActions('look',$this->item);
|
||||
$this->canDo = DemoHelper::getActions('look',$this->item);
|
||||
// get input
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
$this->ref = $jinput->get('ref', 0, 'word');
|
||||
$this->refid = $jinput->get('refid', 0, 'int');
|
||||
$this->referral = '';
|
||||
if ($this->refid)
|
||||
$this->ref = $jinput->get('ref', 0, 'word');
|
||||
$this->refid = $jinput->get('refid', 0, 'int');
|
||||
$return = $jinput->get('return', null, 'base64');
|
||||
// set the referral string
|
||||
$this->referral = '';
|
||||
if ($this->refid && $this->ref)
|
||||
{
|
||||
// return to the item that refered to this item
|
||||
$this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid;
|
||||
// return to the item that referred 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;
|
||||
// return to the list view that referred to this item
|
||||
$this->referral = '&ref=' . (string)$this->ref;
|
||||
}
|
||||
// check return value
|
||||
if (!is_null($return))
|
||||
{
|
||||
// add the return value
|
||||
$this->referral .= '&return=' . (string)$return;
|
||||
}
|
||||
|
||||
// Set the toolbar
|
||||
@ -89,7 +94,7 @@ class DemoViewLook extends JViewLegacy
|
||||
|
||||
JToolbarHelper::title( JText::_($isNew ? 'COM_DEMO_LOOK_NEW' : 'COM_DEMO_LOOK_EDIT'), 'pencil-2 article-add');
|
||||
// Built the actions for new and existing records.
|
||||
if ($this->refid || $this->ref)
|
||||
if (DemoHelper::checkString($this->referral))
|
||||
{
|
||||
if ($this->canDo->get('look.create') && $isNew)
|
||||
{
|
||||
@ -197,7 +202,7 @@ class DemoViewLook extends JViewLegacy
|
||||
$this->document->addStyleSheet(JURI::root()."administrator/templates/isis/css/template.css", (DemoHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
|
||||
$this->document->addScript(JURI::root()."administrator/templates/isis/js/template.js", (DemoHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
|
||||
// the default style of this view
|
||||
$this->document->addStyleSheet(JURI::root()."components/com_demo/assets/css/look.css", (DemoHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
|
||||
$this->document->addStyleSheet(JURI::root()."components/com_demo/assets/css/look.css", (DemoHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
|
||||
// default javascript of this view
|
||||
$this->document->addScript(JURI::root().$this->script, (DemoHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
|
||||
$this->document->addScript(JURI::root(). "components/com_demo/views/look/submitbutton.js", (DemoHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage default.php
|
||||
@ -19,10 +19,10 @@
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
?>
|
||||
<div class="uk-clearfix"><div class="uk-float-right"><?php echo $this->toolbar->render(); ?></div></div>
|
||||
<div class="uk-clearfix"><div class="uk-float-right"><?php echo $this->toolbar->render(); ?></div></div>
|
||||
<article class="uk-comment">
|
||||
<header class="uk-comment-header">
|
||||
<img class="uk-comment-avatar" src="{imageurl}" alt="">
|
||||
@ -59,4 +59,4 @@ defined('_JEXEC') or die('Restricted access');
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage view.html.php
|
||||
@ -21,9 +21,6 @@
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import Joomla view library
|
||||
jimport('joomla.application.component.view');
|
||||
|
||||
/**
|
||||
* Demo View class for the Looking
|
||||
*/
|
||||
@ -104,7 +101,7 @@ class DemoViewLooking extends JViewLegacy
|
||||
// Load the header checker class.
|
||||
require_once( JPATH_COMPONENT_SITE.'/helpers/headercheck.php' );
|
||||
// Initialize the header checker.
|
||||
$HeaderCheck = new demoHeaderCheck;
|
||||
$HeaderCheck = new demoHeaderCheck;
|
||||
|
||||
// Load uikit options.
|
||||
$uikit = $this->params->get('uikit_load');
|
||||
@ -149,7 +146,7 @@ class DemoViewLooking extends JViewLegacy
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// load the meta description
|
||||
if (isset($this->item->metadesc) && $this->item->metadesc)
|
||||
{
|
||||
@ -193,9 +190,9 @@ class DemoViewLooking extends JViewLegacy
|
||||
$this->document->setMetadata($k, $v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// add the document default css file
|
||||
$this->document->addStyleSheet(JURI::root(true) .'/components/com_demo/assets/css/looking.css', (DemoHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
|
||||
$this->document->addStyleSheet(JURI::root(true) .'/components/com_demo/assets/css/looking.css', (DemoHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage default.php
|
||||
@ -19,10 +19,11 @@
|
||||
/------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
?>
|
||||
<table class="uk-table uk-table-hover">
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_demo'); ?>" method="post" name="adminForm" id="adminForm">
|
||||
<table class="uk-table uk-table-hover">
|
||||
<caption><?php echo JText::_('COM_DEMO_LIST_OF_ALL_LOOKS'); ?></caption>
|
||||
<thead>
|
||||
<tr>
|
||||
@ -41,12 +42,13 @@ defined('_JEXEC') or die('Restricted access');
|
||||
</table>
|
||||
|
||||
<?php if (isset($this->items) && isset($this->pagination) && isset($this->pagination->pagesTotal) && $this->pagination->pagesTotal > 1): ?>
|
||||
<form name="adminForm" method="post">
|
||||
<div class="pagination">
|
||||
<?php if ($this->params->def('show_pagination_results', 1)) : ?>
|
||||
<p class="counter pull-right"> <?php echo $this->pagination->getPagesCounter(); ?> <?php echo $this->pagination->getLimitBox(); ?></p>
|
||||
<?php endif; ?>
|
||||
<?php echo $this->pagination->getPagesLinks(); ?>
|
||||
</div>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<input type="hidden" name="task" value="" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</form>
|
||||
|
@ -4,7 +4,7 @@
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.0.0
|
||||
@build 5th May, 2018
|
||||
@build 13th September, 2018
|
||||
@created 18th October, 2016
|
||||
@package Demo
|
||||
@subpackage view.html.php
|
||||
@ -21,9 +21,6 @@
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import Joomla view library
|
||||
jimport('joomla.application.component.view');
|
||||
|
||||
/**
|
||||
* Demo View class for the Looks
|
||||
*/
|
||||
@ -68,7 +65,7 @@ class DemoViewLooks extends JViewLegacy
|
||||
// Load the header checker class.
|
||||
require_once( JPATH_COMPONENT_SITE.'/helpers/headercheck.php' );
|
||||
// Initialize the header checker.
|
||||
$HeaderCheck = new demoHeaderCheck;
|
||||
$HeaderCheck = new demoHeaderCheck;
|
||||
|
||||
// Load uikit options.
|
||||
$uikit = $this->params->get('uikit_load');
|
||||
@ -113,7 +110,7 @@ class DemoViewLooks extends JViewLegacy
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// load the meta description
|
||||
if ($this->params->get('menu-meta_description'))
|
||||
{
|
||||
@ -128,9 +125,9 @@ class DemoViewLooks extends JViewLegacy
|
||||
if ($this->params->get('robots'))
|
||||
{
|
||||
$this->document->setMetadata('robots', $this->params->get('robots'));
|
||||
}
|
||||
}
|
||||
// add the document default css file
|
||||
$this->document->addStyleSheet(JURI::root(true) .'/components/com_demo/assets/css/looks.css', (DemoHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
|
||||
$this->document->addStyleSheet(JURI::root(true) .'/components/com_demo/assets/css/looks.css', (DemoHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user