Demonstration of the latest basic build conventions in Automated Component Builder (v.2.0.7)

This commit is contained in:
Llewellyn van der Merwe 2015-12-03 04:17:44 +02:00
parent c7fd1ca511
commit 6518f2416c
93 changed files with 3297 additions and 1940 deletions

45
README.md Normal file
View File

@ -0,0 +1,45 @@
# Demo (1.0.4)
Just a basic demo of the most basic implementations of the [Joomla] (http://www.joomla.org) Component Builder's ability.
# Build Details
+ *Company*: [Vast Development Method] (https://www.vdm.io/)
+ *Author*: [Llewellyn van der Merwe] (mailto:info@vdm.io)
+ *Name*: [Demo] (https://www.vdm.io/)
+ *First Build*: 5th August, 2015
+ *Last Build*: 3rd December, 2015
+ *Version*: 1.0.4
+ *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
**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*: **15117**
+ *File count*: **147**
+ *Folder count*: **50**
**28 Hours** or **4 Eight Hour Days** (the actual time the author spent)
> (with the following break down:
> **debugging @11hours** = codingtime / 4;
> **planning @6hours** = codingtime / 7;
> **mapping @4hours** = codingtime / 10;
> **office @7hours** = codingtime / 6;)
**70 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**,
> with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)
Project duration: **1.8 weeks** or **0.4 months**
> This **component** was build with a Joomla [Automated Component Builder] (https://www.vdm.io/joomla-component-builder).
> Developed by [Llewellyn van der Merwe] (mailto:joomla@vdm.io)

View File

@ -16,7 +16,9 @@
<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="help_document.access" title="COM_DEMO_HELP_DOCUMENTS_ACCESS" description="COM_DEMO_HELP_DOCUMENTS_ACCESS_DESC" />
<action name="help_document.batch" title="COM_DEMO_HELP_DOCUMENTS_BATCH_USE" description="COM_DEMO_HELP_DOCUMENTS_BATCH_USE_DESC" />
<action name="help_document.create" title="COM_DEMO_HELP_DOCUMENTS_CREATE" description="COM_DEMO_HELP_DOCUMENTS_CREATE_DESC" />
<action name="help_document.dashboard_list" title="COM_DEMO_HELP_DOCUMENTS_DASHBOARD_LIST" description="COM_DEMO_HELP_DOCUMENTS_DASHBOARD_LIST_DESC" />
<action name="help_document.delete" title="COM_DEMO_HELP_DOCUMENTS_DELETE" description="COM_DEMO_HELP_DOCUMENTS_DELETE_DESC" />
<action name="help_document.edit" title="COM_DEMO_HELP_DOCUMENTS_EDIT" description="COM_DEMO_HELP_DOCUMENTS_EDIT_DESC" />
<action name="help_document.edit.own" title="COM_DEMO_HELP_DOCUMENTS_EDIT_OWN" description="COM_DEMO_HELP_DOCUMENTS_EDIT_OWN_DESC" />
@ -24,9 +26,14 @@
<action name="help_document.version" title="COM_DEMO_HELP_DOCUMENTS_EDIT_VERSION" description="COM_DEMO_HELP_DOCUMENTS_EDIT_VERSION_DESC" />
<action name="help_document.export" title="COM_DEMO_HELP_DOCUMENTS_EXPORT" description="COM_DEMO_HELP_DOCUMENTS_EXPORT_DESC" />
<action name="help_document.import" title="COM_DEMO_HELP_DOCUMENTS_IMPORT" description="COM_DEMO_HELP_DOCUMENTS_IMPORT_DESC" />
<action name="help_document.submenu" title="COM_DEMO_HELP_DOCUMENTS_SUBMENU" description="COM_DEMO_HELP_DOCUMENTS_SUBMENU_DESC" />
<action name="look.batch" title="COM_DEMO_LOOKS_BATCH_USE" description="COM_DEMO_LOOKS_BATCH_USE_DESC" />
<action name="look.dashboard_add" title="COM_DEMO_LOOKS_DASHBOARD_ADD" description="COM_DEMO_LOOKS_DASHBOARD_ADD_DESC" />
<action name="look.dashboard_list" title="COM_DEMO_LOOKS_DASHBOARD_LIST" description="COM_DEMO_LOOKS_DASHBOARD_LIST_DESC" />
<action name="look.version" title="COM_DEMO_LOOKS_EDIT_VERSION" description="COM_DEMO_LOOKS_EDIT_VERSION_DESC" />
<action name="look.export" title="COM_DEMO_LOOKS_EXPORT" description="COM_DEMO_LOOKS_EXPORT_DESC" />
<action name="look.import" title="COM_DEMO_LOOKS_IMPORT" description="COM_DEMO_LOOKS_IMPORT_DESC" />
<action name="look.submenu" title="COM_DEMO_LOOKS_SUBMENU" description="COM_DEMO_LOOKS_SUBMENU_DESC" />
</section>
<section name="look">
<action name="look.version" title="COM_DEMO_LOOKS_EDIT_VERSION" description="COM_DEMO_LOOKS_EDIT_VERSION_DESC" />

View File

@ -2,7 +2,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage admin.css
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -2,7 +2,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage dashboard.css
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -2,7 +2,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage help_document.css
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -2,7 +2,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage help_documents.css
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -2,7 +2,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage look.css
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -2,7 +2,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage looks.css
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -43,6 +43,7 @@
description="JGLOBAL_HISTORY_LIMIT_OPTIONS_DESC"
default="10"
/>
<field type="spacer" name="spacerHistory" hr="true" />
<field name="autorTitle"
type="spacer"
label="COM_DEMO_CONFIG_AUTHOR"

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage controller.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -32,69 +34,69 @@ class DemoController extends JControllerLegacy
*
* @return void
*/
function display($cachable = false, $urlparams = false)
function display($cachable = false, $urlparams = false)
{
// set default view if not set
// set default view if not set
$view = $this->input->getCmd('view', 'Demo');
$data = $this->getViewRelation($view);
$layout = $this->input->get('layout', null, 'WORD');
$id = $this->input->getInt('id');
// Check for edit form.
if(DemoHelper::checkArray($data))
{
if ($data['edit'] && $layout == 'edit' && !$this->checkEditId('com_demo.edit.'.$data['view'], $id))
{
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
$this->setMessage($this->getError(), 'error');
// check if item was opend from other then its own list view
$ref = $this->input->getCmd('ref', 0);
$refid = $this->input->getInt('refid', 0);
// set redirect
if ($refid > 0 && DemoHelper::checkString($ref))
if(DemoHelper::checkArray($data))
{
// redirect to item of ref
$this->setRedirect(JRoute::_('index.php?option=com_demo&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false));
if ($data['edit'] && $layout == 'edit' && !$this->checkEditId('com_demo.edit.'.$data['view'], $id))
{
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
$this->setMessage($this->getError(), 'error');
// check if item was opend from other then its own list view
$ref = $this->input->getCmd('ref', 0);
$refid = $this->input->getInt('refid', 0);
// set redirect
if ($refid > 0 && DemoHelper::checkString($ref))
{
// redirect to item of ref
$this->setRedirect(JRoute::_('index.php?option=com_demo&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false));
}
elseif (DemoHelper::checkString($ref))
{
// redirect to ref
$this->setRedirect(JRoute::_('index.php?option=com_demo&view='.(string)$ref, false));
}
else
{
// normal redirect back to the list view
$this->setRedirect(JRoute::_('index.php?option=com_demo&view='.$data['views'], false));
}
return false;
}
}
elseif (DemoHelper::checkString($ref))
{
// redirect to ref
$this->setRedirect(JRoute::_('index.php?option=com_demo&view='.(string)$ref, false));
}
else
{
// normal redirect back to the list view
$this->setRedirect(JRoute::_('index.php?option=com_demo&view='.$data['views'], false));
}
return false;
}
}
return parent::display($cachable, $urlparams);
}
protected function getViewRelation($view)
{
if (DemoHelper::checkString($view))
{
$views = array(
if (DemoHelper::checkString($view))
{
$views = array(
'look' => 'looks',
'help_document' => 'help_documents'
);
// check if this is a list view
if (in_array($view,$views))
{
return array('edit' => false, 'view' => array_search($view,$views), 'views' => $view);
}
// check if it is an edit view
elseif (array_key_exists($view,$views))
{
return array('edit' => true, 'view' => $view, 'views' => $views[$view]);
}
}
);
// check if this is a list view
if (in_array($view,$views))
{
return array('edit' => false, 'view' => array_search($view,$views), 'views' => $view);
}
// check if it is an edit view
elseif (array_key_exists($view,$views))
{
return array('edit' => true, 'view' => $view, 'views' => $views[$view]);
}
}
return false;
}
}

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage demo.php
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage help.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -30,10 +32,10 @@ class DemoControllerHelp extends JControllerLegacy
public function __construct($config)
{
parent::__construct($config);
// load the tasks
// load the tasks
$this->registerTask('getText', 'help');
}
public function help()
{
$user = JFactory::getUser();
@ -57,30 +59,31 @@ class DemoControllerHelp extends JControllerLegacy
$result = '';
}
echo $result;
// stop execution gracefully
jexit();
// stop execution gracefully
jexit();
}
catch(Exception $e)
{
// stop execution gracefully
// stop execution gracefully
jexit();
}
break;
}
} else {
// stop execution gracefully
}
else
{
// stop execution gracefully
jexit();
}
}
protected function getHelpDocumentText($id)
protected function getHelpDocumentText($id)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select(array('a.title','a.content'));
$query->from('#__demo_help_document AS a');
$query->where('a.id = '.(int) $id);
$query->where('a.location = 1');
$query->where('a.published = 1');
$db->setQuery($query);
$db->execute();
@ -113,7 +116,7 @@ class DemoControllerHelp extends JControllerLegacy
$text[] = '</div>';
$text[] = "</body>";
$text[] = "</html>";
return implode("\n",$text);
}
return false;

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage help_document.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -35,14 +37,14 @@ class DemoControllerHelp_document extends JControllerForm
* @note Replaces _task.
*/
protected $task;
public function __construct($config = array())
{
$this->view_list = 'Help_documents'; // safeguard for setting the return view listing to the main view.
parent::__construct($config);
}
/**
/**
* Method override to check if you can add a new record.
*
* @param array $data An array of input data.
@ -53,10 +55,9 @@ class DemoControllerHelp_document extends JControllerForm
*/
protected function allowAdd($data = array())
{
// Access check.
$accessAdmin = JFactory::getUser()->authorise('help_document.access', 'com_demo');
if (!$accessAdmin && !is_null($accessAdmin))
$access = JFactory::getUser()->authorise('help_document.access', 'com_demo');
if (!$access)
{
return false;
}
@ -81,10 +82,10 @@ class DemoControllerHelp_document extends JControllerForm
// get record id.
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
// Access check.
$access = $user->authorise('help_document.access', 'com_demo.help_document.' . (int) $recordId);
$accessAdmin = $user->authorise('help_document.access', 'com_demo');
if ((!$access && !is_null($access)) || (!$accessAdmin && !is_null($accessAdmin)))
$access = ($user->authorise('help_document.access', 'com_demo.help_document.' . (int) $recordId) && $user->authorise('help_document.access', 'com_demo'));
if (!$access)
{
return false;
}
@ -126,7 +127,7 @@ class DemoControllerHelp_document extends JControllerForm
// Since there is no permission, revert to the component permissions.
return $user->authorise('help_document.edit', $this->option);
}
/**
* Gets the URL arguments to append to an item redirect.
*
@ -141,23 +142,23 @@ class DemoControllerHelp_document extends JControllerForm
{
$tmpl = $this->input->get('tmpl');
$layout = $this->input->get('layout', 'edit', 'string');
$ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
// Setup redirect info.
$append = '';
if ($refid)
{
{
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid;
}
elseif ($ref)
{
elseif ($ref)
{
$append .= '&ref='.(string)$ref;
}
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
@ -212,15 +213,15 @@ class DemoControllerHelp_document extends JControllerForm
// get the referal details
$this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int');
$cancel = parent::cancel($key);
if ($cancel)
{
{
if ($this->refid)
{
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid;
// Redirect to the item screen.
$this->setRedirect(
JRoute::_(
@ -231,7 +232,7 @@ class DemoControllerHelp_document extends JControllerForm
elseif ($this->ref)
{
$redirect = '&view='.(string)$this->ref;
// Redirect to the list screen.
$this->setRedirect(
JRoute::_(
@ -267,15 +268,15 @@ class DemoControllerHelp_document extends JControllerForm
// get the referal details
$this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid)
{
// to make sure the item is checkedin on redirect
$this->task = 'save';
}
if ($this->ref || $this->refid)
{
// to make sure the item is checkedin on redirect
$this->task = 'save';
}
$saved = parent::save($key, $urlVar);
if ($this->refid && $saved)
{
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid;
@ -304,12 +305,12 @@ class DemoControllerHelp_document extends JControllerForm
/**
* Function that allows child controller access to model data
* after the data has been saved.
*
*
* @param JModel &$model The data model object.
* @param array $validData The validated data.
*
*
* @return void
*
*
* @since 11.1
*/
protected function postSaveHook(JModelLegacy &$model, $validData = array())

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage help_documents.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -32,7 +34,7 @@ class DemoControllerHelp_documents extends JControllerAdmin
* Proxy for getModel.
* @since 2.5
*/
public function getModel($name = 'Help_document', $prefix = 'DemoModel')
public function getModel($name = 'Help_document', $prefix = 'DemoModel', $config = array())
{
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
@ -85,7 +87,7 @@ class DemoControllerHelp_documents extends JControllerAdmin
if (DemoHelper::checkObject($headers))
{
// Load headers to session.
$session =& JFactory::getSession();
$session = JFactory::getSession();
$headers = json_encode($headers);
$session->set('help_document_VDM_IMPORTHEADERS', $headers);
$session->set('backto_VDM_IMPORT', 'help_documents');
@ -100,5 +102,5 @@ class DemoControllerHelp_documents extends JControllerAdmin
$message = JText::_('COM_DEMO_IMPORT_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_demo&view=help_documents', false), $message, 'error');
return;
}
}
}

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage import.php
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage look.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -35,14 +37,14 @@ class DemoControllerLook extends JControllerForm
* @note Replaces _task.
*/
protected $task;
public function __construct($config = array())
{
$this->view_list = 'Looks'; // safeguard for setting the return view listing to the main view.
parent::__construct($config);
}
/**
/**
* Method override to check if you can add a new record.
*
* @param array $data An array of input data.
@ -52,8 +54,7 @@ class DemoControllerLook extends JControllerForm
* @since 1.6
*/
protected function allowAdd($data = array())
{
// In the absense of better information, revert to the component permissions.
{ // In the absense of better information, revert to the component permissions.
return parent::allowAdd($data);
}
@ -74,6 +75,7 @@ class DemoControllerLook extends JControllerForm
// get record id.
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
if ($recordId)
{
// The record has been set. Check the record permissions.
@ -111,7 +113,7 @@ class DemoControllerLook extends JControllerForm
// Since there is no permission, revert to the component permissions.
return parent::allowEdit($data, $key);
}
/**
* Gets the URL arguments to append to an item redirect.
*
@ -126,23 +128,23 @@ class DemoControllerLook extends JControllerForm
{
$tmpl = $this->input->get('tmpl');
$layout = $this->input->get('layout', 'edit', 'string');
$ref = $this->input->get('ref', 0, 'string');
$refid = $this->input->get('refid', 0, 'int');
// Setup redirect info.
$append = '';
if ($refid)
{
{
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid;
}
elseif ($ref)
{
elseif ($ref)
{
$append .= '&ref='.(string)$ref;
}
}
if ($tmpl)
{
$append .= '&tmpl=' . $tmpl;
@ -197,15 +199,15 @@ class DemoControllerLook extends JControllerForm
// get the referal details
$this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int');
$cancel = parent::cancel($key);
if ($cancel)
{
{
if ($this->refid)
{
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid;
// Redirect to the item screen.
$this->setRedirect(
JRoute::_(
@ -216,7 +218,7 @@ class DemoControllerLook extends JControllerForm
elseif ($this->ref)
{
$redirect = '&view='.(string)$this->ref;
// Redirect to the list screen.
$this->setRedirect(
JRoute::_(
@ -252,15 +254,15 @@ class DemoControllerLook extends JControllerForm
// get the referal details
$this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid)
{
// to make sure the item is checkedin on redirect
$this->task = 'save';
}
if ($this->ref || $this->refid)
{
// to make sure the item is checkedin on redirect
$this->task = 'save';
}
$saved = parent::save($key, $urlVar);
if ($this->refid && $saved)
{
$redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid;
@ -289,12 +291,12 @@ class DemoControllerLook extends JControllerForm
/**
* Function that allows child controller access to model data
* after the data has been saved.
*
*
* @param JModel &$model The data model object.
* @param array $validData The validated data.
*
*
* @return void
*
*
* @since 11.1
*/
protected function postSaveHook(JModelLegacy &$model, $validData = array())

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage looks.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -32,7 +34,7 @@ class DemoControllerLooks extends JControllerAdmin
* Proxy for getModel.
* @since 2.5
*/
public function getModel($name = 'Look', $prefix = 'DemoModel')
public function getModel($name = 'Look', $prefix = 'DemoModel', $config = array())
{
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
@ -85,7 +87,7 @@ class DemoControllerLooks extends JControllerAdmin
if (DemoHelper::checkObject($headers))
{
// Load headers to session.
$session =& JFactory::getSession();
$session = JFactory::getSession();
$headers = json_encode($headers);
$session->set('look_VDM_IMPORTHEADERS', $headers);
$session->set('backto_VDM_IMPORT', 'looks');
@ -100,5 +102,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;
}
}
}

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage demo.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -30,18 +32,18 @@ JLoader::registerPrefix('J', JPATH_PLATFORM . '/cms');
// Load joomla libraries without overwrite
JLoader::registerPrefix('J', JPATH_PLATFORM . '/joomla',false);
// 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');
// 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');
// Get an instance of the controller prefixed by Demo
$controller = JControllerLegacy::getInstance('Demo');

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage batch_.php
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -36,25 +36,29 @@ COM_DEMO_EXPORT_FAILED="Export Failed"
COM_DEMO_HELP_DOCUMENT="Help Document"
COM_DEMO_HELP_DOCUMENTS="Help Documents"
COM_DEMO_HELP_DOCUMENTS_ACCESS="Help Documents Access"
COM_DEMO_HELP_DOCUMENTS_ACCESS_DESC="Allows the users in this group to access help documents"
COM_DEMO_HELP_DOCUMENTS_ACCESS_DESC="Allows the users in this group to access access help documents"
COM_DEMO_HELP_DOCUMENTS_BATCH_OPTIONS="Batch process the selected Help Documents"
COM_DEMO_HELP_DOCUMENTS_BATCH_TIP="All changes will be applied to all selected Help Documents"
COM_DEMO_HELP_DOCUMENTS_BATCH_USE="Help Documents Batch Use"
COM_DEMO_HELP_DOCUMENTS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch help documents"
COM_DEMO_HELP_DOCUMENTS_CREATE="Help Documents Create"
COM_DEMO_HELP_DOCUMENTS_CREATE_DESC="Allows the users in this group to create help documents"
COM_DEMO_HELP_DOCUMENTS_CREATE_DESC="Allows the users in this group to create create help documents"
COM_DEMO_HELP_DOCUMENTS_DASHBOARD_LIST="Help Documents Dashboard List"
COM_DEMO_HELP_DOCUMENTS_DASHBOARD_LIST_DESC="Allows the users in this group to update the dashboard list of the help document"
COM_DEMO_HELP_DOCUMENTS_DELETE="Help Documents Delete"
COM_DEMO_HELP_DOCUMENTS_DELETE_DESC="Allows the users in this group to delete help documents"
COM_DEMO_HELP_DOCUMENTS_DELETE_DESC="Allows the users in this group to delete delete help documents"
COM_DEMO_HELP_DOCUMENTS_EDIT="Help Documents Edit"
COM_DEMO_HELP_DOCUMENTS_EDIT_DESC="Allows the users in this group to edit the help document"
COM_DEMO_HELP_DOCUMENTS_EDIT_OWN="Help Documents Edit Own"
COM_DEMO_HELP_DOCUMENTS_EDIT_OWN_DESC="Allows the users in this group to edit help documents created by them"
COM_DEMO_HELP_DOCUMENTS_EDIT_OWN_DESC="Allows the users in this group to edit edit own help documents created by them"
COM_DEMO_HELP_DOCUMENTS_EDIT_STATE="Help Documents Edit State"
COM_DEMO_HELP_DOCUMENTS_EDIT_STATE_DESC="Allows the users in this group to update the state of the help document"
COM_DEMO_HELP_DOCUMENTS_EDIT_VERSION="Help Documents Edit Version"
COM_DEMO_HELP_DOCUMENTS_EDIT_VERSION_DESC="Allows users in this group to edit versions of help documents"
COM_DEMO_HELP_DOCUMENTS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version help documents"
COM_DEMO_HELP_DOCUMENTS_EXPORT="Help Documents Export"
COM_DEMO_HELP_DOCUMENTS_EXPORT_DESC="Allows the users in this group to export help documents"
COM_DEMO_HELP_DOCUMENTS_EXPORT_DESC="Allows the users in this group to export export help documents"
COM_DEMO_HELP_DOCUMENTS_IMPORT="Help Documents Import"
COM_DEMO_HELP_DOCUMENTS_IMPORT_DESC="Allows the users in this group to import help documents"
COM_DEMO_HELP_DOCUMENTS_IMPORT_DESC="Allows the users in this group to import import help documents"
COM_DEMO_HELP_DOCUMENTS_N_ITEMS_ARCHIVED="%s Help Documents archived."
COM_DEMO_HELP_DOCUMENTS_N_ITEMS_ARCHIVED_1="%s Help Document archived."
COM_DEMO_HELP_DOCUMENTS_N_ITEMS_CHECKED_IN_0="No Help Document successfully checked in."
@ -72,6 +76,8 @@ COM_DEMO_HELP_DOCUMENTS_N_ITEMS_UNFEATURED="%s Help Documents unfeatured."
COM_DEMO_HELP_DOCUMENTS_N_ITEMS_UNFEATURED_1="%s Help Document unfeatured."
COM_DEMO_HELP_DOCUMENTS_N_ITEMS_UNPUBLISHED="%s Help Documents unpublished."
COM_DEMO_HELP_DOCUMENTS_N_ITEMS_UNPUBLISHED_1="%s Help Document unpublished."
COM_DEMO_HELP_DOCUMENTS_SUBMENU="Help Documents Submenu"
COM_DEMO_HELP_DOCUMENTS_SUBMENU_DESC="Allows the users in this group to update the submenu of the help document"
COM_DEMO_HELP_DOCUMENT_ADMIN="Admin"
COM_DEMO_HELP_DOCUMENT_ADMIN_VIEW="Admin View"
COM_DEMO_HELP_DOCUMENT_ADMIN_VIEW_DESCRIPTION="Select the view being targeted"
@ -170,33 +176,41 @@ COM_DEMO_KEEP_ORIGINAL_ACCESS="- Keep Original Access -"
COM_DEMO_KEEP_ORIGINAL_CATEGORY="- Keep Original Category -"
COM_DEMO_KEEP_ORIGINAL_STATE="- Keep Original State -"
COM_DEMO_LICENSE="License"
COM_DEMO_LOOK="look"
COM_DEMO_LOOKS="looks"
COM_DEMO_LOOKS_BATCH_OPTIONS="Batch process the selected looks"
COM_DEMO_LOOKS_BATCH_TIP="All changes will be applied to all selected looks"
COM_DEMO_LOOK="Look"
COM_DEMO_LOOKS="Looks"
COM_DEMO_LOOKS_BATCH_OPTIONS="Batch process the selected Looks"
COM_DEMO_LOOKS_BATCH_TIP="All changes will be applied to all selected Looks"
COM_DEMO_LOOKS_BATCH_USE="Looks Batch Use"
COM_DEMO_LOOKS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch 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_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_EDIT_VERSION="Looks Edit Version"
COM_DEMO_LOOKS_EDIT_VERSION_DESC="Allows users in this group to edit versions of looks"
COM_DEMO_LOOKS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version looks"
COM_DEMO_LOOKS_EXPORT="Looks Export"
COM_DEMO_LOOKS_EXPORT_DESC="Allows the users in this group to export looks"
COM_DEMO_LOOKS_EXPORT_DESC="Allows the users in this group to export export looks"
COM_DEMO_LOOKS_IMPORT="Looks Import"
COM_DEMO_LOOKS_IMPORT_DESC="Allows the users in this group to import looks"
COM_DEMO_LOOKS_N_ITEMS_ARCHIVED="%s looks archived."
COM_DEMO_LOOKS_N_ITEMS_ARCHIVED_1="%s look archived."
COM_DEMO_LOOKS_N_ITEMS_CHECKED_IN_0="No look successfully checked in."
COM_DEMO_LOOKS_N_ITEMS_CHECKED_IN_1="%d look successfully checked in."
COM_DEMO_LOOKS_N_ITEMS_CHECKED_IN_MORE="%d looks successfully checked in."
COM_DEMO_LOOKS_N_ITEMS_DELETED="%s looks deleted."
COM_DEMO_LOOKS_N_ITEMS_DELETED_1="%s look deleted."
COM_DEMO_LOOKS_N_ITEMS_FEATURED="%s looks featured."
COM_DEMO_LOOKS_N_ITEMS_FEATURED_1="%s look featured."
COM_DEMO_LOOKS_N_ITEMS_PUBLISHED="%s looks published."
COM_DEMO_LOOKS_N_ITEMS_PUBLISHED_1="%s look published."
COM_DEMO_LOOKS_N_ITEMS_TRASHED="%s looks trashed."
COM_DEMO_LOOKS_N_ITEMS_TRASHED_1="%s look trashed."
COM_DEMO_LOOKS_N_ITEMS_UNFEATURED="%s looks unfeatured."
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_IMPORT_DESC="Allows the users in this group to import import looks"
COM_DEMO_LOOKS_N_ITEMS_ARCHIVED="%s Looks archived."
COM_DEMO_LOOKS_N_ITEMS_ARCHIVED_1="%s Look archived."
COM_DEMO_LOOKS_N_ITEMS_CHECKED_IN_0="No Look successfully checked in."
COM_DEMO_LOOKS_N_ITEMS_CHECKED_IN_1="%d Look successfully checked in."
COM_DEMO_LOOKS_N_ITEMS_CHECKED_IN_MORE="%d Looks successfully checked in."
COM_DEMO_LOOKS_N_ITEMS_DELETED="%s Looks deleted."
COM_DEMO_LOOKS_N_ITEMS_DELETED_1="%s Look deleted."
COM_DEMO_LOOKS_N_ITEMS_FEATURED="%s Looks featured."
COM_DEMO_LOOKS_N_ITEMS_FEATURED_1="%s Look featured."
COM_DEMO_LOOKS_N_ITEMS_PUBLISHED="%s Looks published."
COM_DEMO_LOOKS_N_ITEMS_PUBLISHED_1="%s Look published."
COM_DEMO_LOOKS_N_ITEMS_TRASHED="%s Looks trashed."
COM_DEMO_LOOKS_N_ITEMS_TRASHED_1="%s Look trashed."
COM_DEMO_LOOKS_N_ITEMS_UNFEATURED="%s Looks unfeatured."
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_LOOK_ACRONYM="Acronym"
COM_DEMO_LOOK_ACRONYM_DESCRIPTION="Enter an acronym"
COM_DEMO_LOOK_ACRONYM_HINT="Acronym Here"
@ -206,17 +220,17 @@ COM_DEMO_LOOK_ADD_LABEL="Add Custom Stuff"
COM_DEMO_LOOK_AGE_LABEL="Age Group"
COM_DEMO_LOOK_ALIAS="Alias"
COM_DEMO_LOOK_ALIAS_HINT="Auto-generated from name"
COM_DEMO_LOOK_CREATED_BY_DESC="The user that created the look."
COM_DEMO_LOOK_CREATED_BY_DESC="The user that created the Look."
COM_DEMO_LOOK_CREATED_BY_LABEL="Created by"
COM_DEMO_LOOK_CREATED_DATE_DESC="The date look was created."
COM_DEMO_LOOK_CREATED_DATE_DESC="The date Look was created."
COM_DEMO_LOOK_CREATED_DATE_LABEL="Created date"
COM_DEMO_LOOK_DESCRIPTION="Description"
COM_DEMO_LOOK_DESCRIPTION_DESCRIPTION="Add Description Here"
COM_DEMO_LOOK_DESCRIPTION_HINT="Add Description Here"
COM_DEMO_LOOK_DESCRIPTION_LABEL="Description"
COM_DEMO_LOOK_DETAILS="Details"
COM_DEMO_LOOK_EDIT="Editing the look"
COM_DEMO_LOOK_ERROR_UNIQUE_ALIAS="Another look has the same alias."
COM_DEMO_LOOK_EDIT="Editing the Look"
COM_DEMO_LOOK_ERROR_UNIQUE_ALIAS="Another Look has the same alias."
COM_DEMO_LOOK_FEMALE="Female"
COM_DEMO_LOOK_FEMALE_DESCRIPTION="Here you can add females data."
COM_DEMO_LOOK_FEMALE_SELECT="Edit/Add"
@ -233,7 +247,7 @@ COM_DEMO_LOOK_NAME="Name"
COM_DEMO_LOOK_NAME_DESCRIPTION="Enter Name Here"
COM_DEMO_LOOK_NAME_HINT="Name Here"
COM_DEMO_LOOK_NAME_LABEL="Name"
COM_DEMO_LOOK_NEW="A New look"
COM_DEMO_LOOK_NEW="A New Look"
COM_DEMO_LOOK_NO="No"
COM_DEMO_LOOK_NOT_REQUIRED="Not Required"
COM_DEMO_LOOK_NUMBER_HINT="Number Here"
@ -242,7 +256,7 @@ COM_DEMO_LOOK_ORDERING_LABEL="Ordering"
COM_DEMO_LOOK_PERMISSION="Permissions"
COM_DEMO_LOOK_PUBLISHING="Publishing"
COM_DEMO_LOOK_REPETABLE_NUMBERS="Repetable Numbers"
COM_DEMO_LOOK_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the look to customise the alias."
COM_DEMO_LOOK_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Look to customise the alias."
COM_DEMO_LOOK_SELECT_A_YEAR="Select a year"
COM_DEMO_LOOK_SIXTYSIXTY_FOUR="60-64"
COM_DEMO_LOOK_STATUS="Status"
@ -250,22 +264,22 @@ COM_DEMO_LOOK_THIRTYTHIRTY_FOUR="30-34"
COM_DEMO_LOOK_THIRTY_FIVETHIRTY_NINE="35-39"
COM_DEMO_LOOK_TWENTYTWENTY_FOUR="20-24"
COM_DEMO_LOOK_TWENTY_FIVETWENTY_NINE="25-29"
COM_DEMO_LOOK_TWO_HUNDRED_ONEEIGHT="2018"
COM_DEMO_LOOK_TWO_HUNDRED_ONEFIVE="2015"
COM_DEMO_LOOK_TWO_HUNDRED_ONEFOUR="2014"
COM_DEMO_LOOK_TWO_HUNDRED_ONENINE="2019"
COM_DEMO_LOOK_TWO_HUNDRED_ONEONE="2011"
COM_DEMO_LOOK_TWO_HUNDRED_ONESEVEN="2017"
COM_DEMO_LOOK_TWO_HUNDRED_ONESIX="2016"
COM_DEMO_LOOK_TWO_HUNDRED_ONETHREE="2013"
COM_DEMO_LOOK_TWO_HUNDRED_ONETWO="2012"
COM_DEMO_LOOK_TWO_HUNDRED_ONEZERO="2010"
COM_DEMO_LOOK_TWO_HUNDRED_TWOFOUR="2024"
COM_DEMO_LOOK_TWO_HUNDRED_TWOONE="2021"
COM_DEMO_LOOK_TWO_HUNDRED_TWOTHREE="2023"
COM_DEMO_LOOK_TWO_HUNDRED_TWOTWO="2022"
COM_DEMO_LOOK_TWO_HUNDRED_TWOZERO="2020"
COM_DEMO_LOOK_VERSION_DESC="A count of the number of times this look has been revised."
COM_DEMO_LOOK_TWO_THOUSAND_AND_EIGHTEEN="2018"
COM_DEMO_LOOK_TWO_THOUSAND_AND_ELEVEN="2011"
COM_DEMO_LOOK_TWO_THOUSAND_AND_FIFTEEN="2015"
COM_DEMO_LOOK_TWO_THOUSAND_AND_FOURTEEN="2014"
COM_DEMO_LOOK_TWO_THOUSAND_AND_NINETEEN="2019"
COM_DEMO_LOOK_TWO_THOUSAND_AND_SEVENTEEN="2017"
COM_DEMO_LOOK_TWO_THOUSAND_AND_SIXTEEN="2016"
COM_DEMO_LOOK_TWO_THOUSAND_AND_TEN="2010"
COM_DEMO_LOOK_TWO_THOUSAND_AND_THIRTEEN="2013"
COM_DEMO_LOOK_TWO_THOUSAND_AND_TWELVE="2012"
COM_DEMO_LOOK_TWO_THOUSAND_AND_TWENTY="2020"
COM_DEMO_LOOK_TWO_THOUSAND_AND_TWENTY_FOUR="2024"
COM_DEMO_LOOK_TWO_THOUSAND_AND_TWENTY_ONE="2021"
COM_DEMO_LOOK_TWO_THOUSAND_AND_TWENTY_THREE="2023"
COM_DEMO_LOOK_TWO_THOUSAND_AND_TWENTY_TWO="2022"
COM_DEMO_LOOK_VERSION_DESC="A count of the number of times this Look has been revised."
COM_DEMO_LOOK_VERSION_LABEL="Revision"
COM_DEMO_LOOK_WEBSITE="Website"
COM_DEMO_LOOK_WEBSITE_DESCRIPTION="Enter website address"
@ -274,11 +288,12 @@ COM_DEMO_LOOK_WEBSITE_LABEL="Website"
COM_DEMO_LOOK_YEAR_LABEL="Data Year"
COM_DEMO_LOOK_YES="Yes"
COM_DEMO_NEW="New"
COM_DEMO_NO_ACCESS_GRANTED="No Access Granted!"
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_HELP_DOCUMENTS="Help Documents"
COM_DEMO_SUBMENU_LOOKS="looks"
COM_DEMO_SUBMENU_LOOKS="Looks"
COM_DEMO_USE_BATCH="Use Batch"
COM_DEMO_USE_BATCH_DESC=" Allows users in this group to use batch copy/update method."
COM_DEMO_VERSION="Version"

View File

@ -2,4 +2,4 @@ COM_DEMO="Demo"
COM_DEMO_CONFIGURATION="Demo Configuration"
COM_DEMO_MENU="&#187; Demo"
COM_DEMO_MENU_HELP_DOCUMENTS="Help Documents"
COM_DEMO_MENU_LOOKS="looks"
COM_DEMO_MENU_LOOKS="Looks"

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage batchselection.php
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage details_above.php
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage details_fullwidth.php
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage details_left.php
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage details_right.php
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage details_under.php
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage metadata.php
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage publishing.php
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage details_above.php
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage details_left.php
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage details_right.php
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage details_under.php
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage metadata.php
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage publishing.php
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage repetable_numbers_left.php
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage repetable_numbers_right.php
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage demo.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -28,189 +30,183 @@ jimport('joomla.application.component.helper');
*/
class DemoModelDemo extends JModelList
{
public function getIcons()
public function getIcons()
{
// load user for access menus
$user = JFactory::getUser();
// reset icon array
// load user for access menus
$user = JFactory::getUser();
// reset icon array
$icons = array();
// view groups array
// view groups array
$viewGroups = array(
'main' => array('png.look.add', 'png.looks', 'png.help_documents')
);
// view access array
$viewAccess = array(
'looks.submenu' => 'look.submenu',
'looks.dashboard_list' => 'look.dashboard_list',
'look.dashboard_add' => 'look.dashboard_add',
'help_document.create' => 'help_document.create',
'help_documents.access' => 'help_document.access',
'help_document.access' => 'help_document.access');
'help_document.access' => 'help_document.access',
'help_documents.submenu' => 'help_document.submenu',
'help_documents.dashboard_list' => 'help_document.dashboard_list');
foreach($viewGroups as $group => $views)
{
{
$i = 0;
if (DemoHelper::checkArray($views))
{
{
foreach($views as $view)
{
$add = false;
if (strpos($view,'.') !== false)
{
list($type, $name, $action) = explode('.', $view);
if ($action)
{
$viewName = $name;
switch($action)
{
case 'add':
$url ='index.php?option=com_demo&view='.$name.'&layout=edit';
$image = $name.'_'.$action.'.'.$type;
$alt = $name.'&nbsp;'.$action;
$name = 'COM_DEMO_DASHBOARD_'.DemoHelper::safeString($name,'U').'_ADD';
$add = true;
break;
default:
$url = 'index.php?option=com_categories&view=categories&extension=com_demo.'.$name;
$image = $name.'_'.$action.'.'.$type;
$alt = $name.'&nbsp;'.$action;
$name = 'COM_DEMO_DASHBOARD_'.DemoHelper::safeString($name,'U').'_'.DemoHelper::safeString($action,'U');
break;
}
{
$dwd = explode('.', $view);
if (count($dwd) == 3)
{
list($type, $name, $action) = $dwd;
}
elseif (count($dwd) == 2)
{
list($type, $name) = $dwd;
$action = false;
}
if ($action)
{
$viewName = $name;
switch($action)
{
case 'add':
$url ='index.php?option=com_demo&view='.$name.'&layout=edit';
$image = $name.'_'.$action.'.'.$type;
$alt = $name.'&nbsp;'.$action;
$name = 'COM_DEMO_DASHBOARD_'.DemoHelper::safeString($name,'U').'_ADD';
$add = true;
break;
default:
$url = 'index.php?option=com_categories&view=categories&extension=com_demo.'.$name;
$image = $name.'_'.$action.'.'.$type;
$alt = $name.'&nbsp;'.$action;
$name = 'COM_DEMO_DASHBOARD_'.DemoHelper::safeString($name,'U').'_'.DemoHelper::safeString($action,'U');
break;
}
}
else
{
$viewName = $name;
$alt = $name;
$url = 'index.php?option=com_demo&view='.$name;
$image = $name.'.'.$type;
$name = 'COM_DEMO_DASHBOARD_'.DemoHelper::safeString($name,'U');
$hover = false;
}
}
else
{
$viewName = $view;
$alt = $view;
$url = 'index.php?option=com_demo&view='.$view;
$image = $view.'.png';
$name = ucwords($view).'<br /><br />';
$hover = false;
}
// first make sure the view access is set
if (DemoHelper::checkArray($viewAccess))
{
// setup some defaults
$dashboard_add = false;
$dashboard_list = false;
$accessTo = '';
$accessAdd = '';
// acces checking start
$accessCreate = (isset($viewAccess[$viewName.'.create'])) ? DemoHelper::checkString($viewAccess[$viewName.'.create']):false;
$accessAccess = (isset($viewAccess[$viewName.'.access'])) ? DemoHelper::checkString($viewAccess[$viewName.'.access']):false;
// set main controllers
$accessDashboard_add = (isset($viewAccess[$viewName.'.dashboard_add'])) ? DemoHelper::checkString($viewAccess[$viewName.'.dashboard_add']):false;
$accessDashboard_list = (isset($viewAccess[$viewName.'.dashboard_list'])) ? DemoHelper::checkString($viewAccess[$viewName.'.dashboard_list']):false;
// check for adding access
if ($add && $accessCreate)
{
$accessAdd = $viewAccess[$viewName.'.create'];
}
elseif ($add)
{
$accessAdd = 'core.create';
}
// check if acces to view is set
if ($accessAccess)
{
$accessTo = $viewAccess[$viewName.'.access'];
}
// set main access controllers
if ($accessDashboard_add)
{
$dashboard_add = $user->authorise($viewAccess[$viewName.'.dashboard_add'], 'com_demo');
}
if ($accessDashboard_list)
{
$dashboard_list = $user->authorise($viewAccess[$viewName.'.dashboard_list'], 'com_demo');
}
if (DemoHelper::checkString($accessAdd) && DemoHelper::checkString($accessTo))
{
// check access
if($user->authorise($accessAdd, 'com_demo') && $user->authorise($accessTo, 'com_demo') && $dashboard_add)
{
$icons[$group][$i] = new StdClass;
$icons[$group][$i]->url = $url;
$icons[$group][$i]->name = $name;
$icons[$group][$i]->image = $image;
$icons[$group][$i]->alt = $alt;
}
}
elseif (DemoHelper::checkString($accessTo))
{
// check access
if($user->authorise($accessTo, 'com_demo') && $dashboard_list)
{
$icons[$group][$i] = new StdClass;
$icons[$group][$i]->url = $url;
$icons[$group][$i]->name = $name;
$icons[$group][$i]->image = $image;
$icons[$group][$i]->alt = $alt;
}
}
elseif (DemoHelper::checkString($accessAdd))
{
// check access
if($user->authorise($accessAdd, 'com_demo') && $dashboard_add)
{
$icons[$group][$i] = new StdClass;
$icons[$group][$i]->url = $url;
$icons[$group][$i]->name = $name;
$icons[$group][$i]->image = $image;
$icons[$group][$i]->alt = $alt;
}
}
else
{
$icons[$group][$i] = new StdClass;
$icons[$group][$i]->url = $url;
$icons[$group][$i]->name = $name;
$icons[$group][$i]->image = $image;
$icons[$group][$i]->alt = $alt;
}
}
else
{
$icons[$group][$i] = new StdClass;
$icons[$group][$i]->url = $url;
$icons[$group][$i]->name = $name;
$icons[$group][$i]->image = $image;
$icons[$group][$i]->alt = $alt;
}
$i++;
}
}
else
{
$viewName = $name;
$alt = $name;
$url = 'index.php?option=com_demo&view='.$name;
$image = $name.'.'.$type;
$name = 'COM_DEMO_DASHBOARD_'.DemoHelper::safeString($name,'U');
$hover = false;
}
}
else
{
$viewName = $view;
$alt = $view;
$url = 'index.php?option=com_demo&view='.$view;
$image = $view.'.png';
$name = ucwords($view).'<br /><br />';
$hover = false;
}
// first make sure the view access is set
if (DemoHelper::checkArray($viewAccess))
{
// acces checking start
$accessCreate = DemoHelper::checkString($viewAccess[$viewName.'.create']);
$accessAccess = DemoHelper::checkString($viewAccess[$viewName.'.access']);
$accessTo = '';
$accessAdd = '';
// check for adding access
if ($add && $accessCreate)
{
$accessAdd = $viewAccess[$viewName.'.create'];
}
elseif ($add)
{
$accessAdd = 'core.create';
}
// check if acces to view is set
if ($accessAccess)
{
$accessTo = $viewAccess[$viewName.'.access'];
}
if (DemoHelper::checkString($accessAdd) && DemoHelper::checkString($accessTo))
{
// check access
if($user->authorise($accessAdd, 'com_demo') && $user->authorise($accessTo, 'com_demo'))
{
$icons[$group][$i] = new StdClass;
$icons[$group][$i]->url = $url;
$icons[$group][$i]->name = $name;
$icons[$group][$i]->image = $image;
$icons[$group][$i]->alt = $alt;
}
}
elseif (DemoHelper::checkString($accessTo))
{
// check access
if($user->authorise($accessTo, 'com_demo'))
{
$icons[$group][$i] = new StdClass;
$icons[$group][$i]->url = $url;
$icons[$group][$i]->name = $name;
$icons[$group][$i]->image = $image;
$icons[$group][$i]->alt = $alt;
}
}
elseif (DemoHelper::checkString($accessAdd))
{
// check access
if($user->authorise($accessAdd, 'com_demo'))
{
$icons[$group][$i] = new StdClass;
$icons[$group][$i]->url = $url;
$icons[$group][$i]->name = $name;
$icons[$group][$i]->image = $image;
$icons[$group][$i]->alt = $alt;
}
}
else
{
$icons[$group][$i] = new StdClass;
$icons[$group][$i]->url = $url;
$icons[$group][$i]->name = $name;
$icons[$group][$i]->image = $image;
$icons[$group][$i]->alt = $alt;
}
}
else
{
$icons[$group][$i] = new StdClass;
$icons[$group][$i]->url = $url;
$icons[$group][$i]->name = $name;
$icons[$group][$i]->image = $image;
$icons[$group][$i]->alt = $alt;
}
$i++;
}
}
else
{
$icons[$group][$i] = false;
$icons[$group][$i] = false;
}
}
return $icons;
}
public function getContributors()
{
// get params
$params = JComponentHelper::getParams('com_demo');
// start contributors array
$contributors = array();
// get all Contributors
$searchArray = range('0','20');
foreach($searchArray as $nr)
{
if ((NULL !== $params->get("showContributor".$nr)) && ($params->get("showContributor".$nr) == 1 || $params->get("showContributor".$nr) == 3))
{
// set link based of selected option
if($params->get("useContributor".$nr) == 1)
{
$link_front = '<a href="mailto:'.$params->get("emailContributor".$nr).'" target="_blank">';
$link_back = '</a>';
}
elseif($params->get("useContributor".$nr) == 2)
{
$link_front = '<a href="'.$params->get("linkContributor".$nr).'" target="_blank">';
$link_back = '</a>';
}
else
{
$link_front = '';
$link_back = '';
}
$contributors[$nr]['title'] = DemoHelper::htmlEscape($params->get("titleContributor".$nr));
$contributors[$nr]['name'] = $link_front.DemoHelper::htmlEscape($params->get("nameContributor".$nr)).$link_back;
}
}
return $contributors;
return $icons;
}
}

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage articles.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -33,7 +35,51 @@ class JFormFieldArticles extends JFormFieldList
*
* @var string
*/
public $type = 'articles';
public $type = 'articles';
/**
* Override to add new button
*
* @return string The field input markup.
*
* @since 3.2
*/
protected function getInput()
{
// see if we should add buttons
$setButton = $this->getAttribute('button');
// get html
$html = parent::getInput();
// if true set button
if ($setButton === 'true')
{
$user = JFactory::getUser();
// only add if user allowed to create article
if ($user->authorise('core.create', 'com_demo'))
{
// get the input from url
$jinput = JFactory::getApplication()->input;
// get the view name & id
$values = $jinput->getArray(array(
'id' => 'int',
'view' => 'word'
));
// check if new item
$ref = '';
if (!is_null($values['id']) && strlen($values['view']))
{
// only load referal if not new item.
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
}
// build the button
$button = '<a class="btn btn-small btn-success"
href="index.php?option=com_demo&amp;view=article&amp;layout=edit'.$ref.'" >
<span class="icon-new icon-white"></span>' . JText::_('COM_DEMO_NEW') . '</a>';
// return the button attached to input field
return $html . $button;
}
}
return $html;
}
/**
* Method to get a list of options for a list input.

View File

@ -2,7 +2,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage help_document.js
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -16,38 +18,38 @@
/------------------------------------------------------------------------------------------------------*/
// Some Global Values
jform_yZpGWZMghB_required = false;
jform_CGEclrjDuN_required = false;
jform_IlNsWahRYM_required = false;
jform_UqLidJhNMm_required = false;
jform_XvephxzImu_required = false;
jform_yFWFBjoUSy_required = false;
jform_revjpJkdku_required = false;
jform_MhQPsZtPMB_required = false;
// Initial Script
jQuery(document).ready(function()
{
var location_kWBkVYH = jQuery("#jform_location input[type='radio']:checked").val();
kWBkVYH(location_kWBkVYH);
var location_sLnxlWV = jQuery("#jform_location input[type='radio']:checked").val();
sLnxlWV(location_sLnxlWV);
var location_HqKSXxe = jQuery("#jform_location input[type='radio']:checked").val();
HqKSXxe(location_HqKSXxe);
var location_fqbSveC = jQuery("#jform_location input[type='radio']:checked").val();
fqbSveC(location_fqbSveC);
var type_yZpGWZM = jQuery("#jform_type").val();
yZpGWZM(type_yZpGWZM);
var type_Xvephxz = jQuery("#jform_type").val();
Xvephxz(type_Xvephxz);
var type_CGEclrj = jQuery("#jform_type").val();
CGEclrj(type_CGEclrj);
var type_yFWFBjo = jQuery("#jform_type").val();
yFWFBjo(type_yFWFBjo);
var type_IlNsWah = jQuery("#jform_type").val();
IlNsWah(type_IlNsWah);
var type_revjpJk = jQuery("#jform_type").val();
revjpJk(type_revjpJk);
var target_UqLidJh = jQuery("#jform_target input[type='radio']:checked").val();
UqLidJh(target_UqLidJh);
var target_MhQPsZt = jQuery("#jform_target input[type='radio']:checked").val();
MhQPsZt(target_MhQPsZt);
});
// the kWBkVYH function
function kWBkVYH(location_kWBkVYH)
// the sLnxlWV function
function sLnxlWV(location_sLnxlWV)
{
// set the function logic
if (location_kWBkVYH == 1)
if (location_sLnxlWV == 1)
{
jQuery('#jform_admin_view').closest('.control-group').show();
}
@ -57,11 +59,11 @@ function kWBkVYH(location_kWBkVYH)
}
}
// the HqKSXxe function
function HqKSXxe(location_HqKSXxe)
// the fqbSveC function
function fqbSveC(location_fqbSveC)
{
// set the function logic
if (location_HqKSXxe == 2)
if (location_fqbSveC == 2)
{
jQuery('#jform_site_view').closest('.control-group').show();
}
@ -71,198 +73,198 @@ function HqKSXxe(location_HqKSXxe)
}
}
// the yZpGWZM function
function yZpGWZM(type_yZpGWZM)
// the Xvephxz function
function Xvephxz(type_Xvephxz)
{
if (isSet(type_yZpGWZM) && type_yZpGWZM.constructor !== Array)
if (isSet(type_Xvephxz) && type_Xvephxz.constructor !== Array)
{
var temp_yZpGWZM = type_yZpGWZM;
var type_yZpGWZM = [];
type_yZpGWZM.push(temp_yZpGWZM);
var temp_Xvephxz = type_Xvephxz;
var type_Xvephxz = [];
type_Xvephxz.push(temp_Xvephxz);
}
else if (!isSet(type_yZpGWZM))
else if (!isSet(type_Xvephxz))
{
var type_yZpGWZM = [];
var type_Xvephxz = [];
}
var type = type_yZpGWZM.some(type_yZpGWZM_SomeFunc);
var type = type_Xvephxz.some(type_Xvephxz_SomeFunc);
// set this function logic
if (type)
{
jQuery('#jform_url').closest('.control-group').show();
if (jform_yZpGWZMghB_required)
if (jform_XvephxzImu_required)
{
updateFieldRequired('url',0);
jQuery('#jform_url').prop('required','required');
jQuery('#jform_url').attr('aria-required',true);
jQuery('#jform_url').addClass('required');
jform_yZpGWZMghB_required = false;
jform_XvephxzImu_required = false;
}
}
else
{
jQuery('#jform_url').closest('.control-group').hide();
if (!jform_yZpGWZMghB_required)
if (!jform_XvephxzImu_required)
{
updateFieldRequired('url',1);
jQuery('#jform_url').removeAttr('required');
jQuery('#jform_url').removeAttr('aria-required');
jQuery('#jform_url').removeClass('required');
jform_yZpGWZMghB_required = true;
jform_XvephxzImu_required = true;
}
}
}
// the yZpGWZM Some function
function type_yZpGWZM_SomeFunc(type_yZpGWZM)
// the Xvephxz Some function
function type_Xvephxz_SomeFunc(type_Xvephxz)
{
// set the function logic
if (type_yZpGWZM == 3)
if (type_Xvephxz == 3)
{
return true;
}
return false;
}
// the CGEclrj function
function CGEclrj(type_CGEclrj)
// the yFWFBjo function
function yFWFBjo(type_yFWFBjo)
{
if (isSet(type_CGEclrj) && type_CGEclrj.constructor !== Array)
if (isSet(type_yFWFBjo) && type_yFWFBjo.constructor !== Array)
{
var temp_CGEclrj = type_CGEclrj;
var type_CGEclrj = [];
type_CGEclrj.push(temp_CGEclrj);
var temp_yFWFBjo = type_yFWFBjo;
var type_yFWFBjo = [];
type_yFWFBjo.push(temp_yFWFBjo);
}
else if (!isSet(type_CGEclrj))
else if (!isSet(type_yFWFBjo))
{
var type_CGEclrj = [];
var type_yFWFBjo = [];
}
var type = type_CGEclrj.some(type_CGEclrj_SomeFunc);
var type = type_yFWFBjo.some(type_yFWFBjo_SomeFunc);
// set this function logic
if (type)
{
jQuery('#jform_article').closest('.control-group').show();
if (jform_CGEclrjDuN_required)
if (jform_yFWFBjoUSy_required)
{
updateFieldRequired('article',0);
jQuery('#jform_article').prop('required','required');
jQuery('#jform_article').attr('aria-required',true);
jQuery('#jform_article').addClass('required');
jform_CGEclrjDuN_required = false;
jform_yFWFBjoUSy_required = false;
}
}
else
{
jQuery('#jform_article').closest('.control-group').hide();
if (!jform_CGEclrjDuN_required)
if (!jform_yFWFBjoUSy_required)
{
updateFieldRequired('article',1);
jQuery('#jform_article').removeAttr('required');
jQuery('#jform_article').removeAttr('aria-required');
jQuery('#jform_article').removeClass('required');
jform_CGEclrjDuN_required = true;
jform_yFWFBjoUSy_required = true;
}
}
}
// the CGEclrj Some function
function type_CGEclrj_SomeFunc(type_CGEclrj)
// the yFWFBjo Some function
function type_yFWFBjo_SomeFunc(type_yFWFBjo)
{
// set the function logic
if (type_CGEclrj == 1)
if (type_yFWFBjo == 1)
{
return true;
}
return false;
}
// the IlNsWah function
function IlNsWah(type_IlNsWah)
// the revjpJk function
function revjpJk(type_revjpJk)
{
if (isSet(type_IlNsWah) && type_IlNsWah.constructor !== Array)
if (isSet(type_revjpJk) && type_revjpJk.constructor !== Array)
{
var temp_IlNsWah = type_IlNsWah;
var type_IlNsWah = [];
type_IlNsWah.push(temp_IlNsWah);
var temp_revjpJk = type_revjpJk;
var type_revjpJk = [];
type_revjpJk.push(temp_revjpJk);
}
else if (!isSet(type_IlNsWah))
else if (!isSet(type_revjpJk))
{
var type_IlNsWah = [];
var type_revjpJk = [];
}
var type = type_IlNsWah.some(type_IlNsWah_SomeFunc);
var type = type_revjpJk.some(type_revjpJk_SomeFunc);
// set this function logic
if (type)
{
jQuery('#jform_content-lbl').closest('.control-group').show();
if (jform_IlNsWahRYM_required)
if (jform_revjpJkdku_required)
{
updateFieldRequired('content',0);
jQuery('#jform_content').prop('required','required');
jQuery('#jform_content').attr('aria-required',true);
jQuery('#jform_content').addClass('required');
jform_IlNsWahRYM_required = false;
jform_revjpJkdku_required = false;
}
}
else
{
jQuery('#jform_content-lbl').closest('.control-group').hide();
if (!jform_IlNsWahRYM_required)
if (!jform_revjpJkdku_required)
{
updateFieldRequired('content',1);
jQuery('#jform_content').removeAttr('required');
jQuery('#jform_content').removeAttr('aria-required');
jQuery('#jform_content').removeClass('required');
jform_IlNsWahRYM_required = true;
jform_revjpJkdku_required = true;
}
}
}
// the IlNsWah Some function
function type_IlNsWah_SomeFunc(type_IlNsWah)
// the revjpJk Some function
function type_revjpJk_SomeFunc(type_revjpJk)
{
// set the function logic
if (type_IlNsWah == 2)
if (type_revjpJk == 2)
{
return true;
}
return false;
}
// the UqLidJh function
function UqLidJh(target_UqLidJh)
// the MhQPsZt function
function MhQPsZt(target_MhQPsZt)
{
// set the function logic
if (target_UqLidJh == 1)
if (target_MhQPsZt == 1)
{
jQuery('#jform_groups').closest('.control-group').show();
if (jform_UqLidJhNMm_required)
if (jform_MhQPsZtPMB_required)
{
updateFieldRequired('groups',0);
jQuery('#jform_groups').prop('required','required');
jQuery('#jform_groups').attr('aria-required',true);
jQuery('#jform_groups').addClass('required');
jform_UqLidJhNMm_required = false;
jform_MhQPsZtPMB_required = false;
}
}
else
{
jQuery('#jform_groups').closest('.control-group').hide();
if (!jform_UqLidJhNMm_required)
if (!jform_MhQPsZtPMB_required)
{
updateFieldRequired('groups',1);
jQuery('#jform_groups').removeAttr('required');
jQuery('#jform_groups').removeAttr('aria-required');
jQuery('#jform_groups').removeClass('required');
jform_UqLidJhNMm_required = true;
jform_MhQPsZtPMB_required = true;
}
}
}

View File

@ -2,7 +2,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage look.js
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -16,23 +18,23 @@
/------------------------------------------------------------------------------------------------------*/
// Some Global Values
jform_jiUxEbzAKh_required = false;
jform_FKWPxIhXqG_required = false;
// Initial Script
jQuery(document).ready(function()
{
var name_ABgmXJb = jQuery("#jform_name").val();
ABgmXJb(name_ABgmXJb);
var name_CxBsGuj = jQuery("#jform_name").val();
CxBsGuj(name_CxBsGuj);
var add_jiUxEbz = jQuery("#jform_add input[type='radio']:checked").val();
jiUxEbz(add_jiUxEbz);
var add_FKWPxIh = jQuery("#jform_add input[type='radio']:checked").val();
FKWPxIh(add_FKWPxIh);
});
// the ABgmXJb function
function ABgmXJb(name_ABgmXJb)
// the CxBsGuj function
function CxBsGuj(name_CxBsGuj)
{
// set the function logic
if (isSet(name_ABgmXJb))
if (isSet(name_CxBsGuj))
{
jQuery('#jform_alias').closest('.control-group').show();
jQuery('#jform_description').closest('.control-group').show();
@ -44,37 +46,35 @@ function ABgmXJb(name_ABgmXJb)
}
}
// the jiUxEbz function
function jiUxEbz(add_jiUxEbz)
// the FKWPxIh function
function FKWPxIh(add_FKWPxIh)
{
// set the function logic
if (add_jiUxEbz == 1)
if (add_FKWPxIh == 1)
{
jQuery('#jform_acronym').closest('.control-group').show();
if (jform_jiUxEbzAKh_required)
if (jform_FKWPxIhXqG_required)
{
updateFieldRequired('acronym',0);
jQuery('#jform_acronym').prop('required','required');
jQuery('#jform_acronym').attr('aria-required',true);
jQuery('#jform_acronym').addClass('required');
jform_jiUxEbzAKh_required = false;
jform_FKWPxIhXqG_required = false;
}
jQuery('#jform_6').closest('.control-group').show();
jQuery('#jform_website').closest('.control-group').show();
}
else
{
jQuery('#jform_acronym').closest('.control-group').hide();
if (!jform_jiUxEbzAKh_required)
if (!jform_FKWPxIhXqG_required)
{
updateFieldRequired('acronym',1);
jQuery('#jform_acronym').removeAttr('required');
jQuery('#jform_acronym').removeAttr('aria-required');
jQuery('#jform_acronym').removeClass('required');
jform_jiUxEbzAKh_required = true;
jform_FKWPxIhXqG_required = true;
}
jQuery('#jform_6').closest('.control-group').hide();
jQuery('#jform_website').closest('.control-group').hide();
}
}

View File

@ -225,35 +225,35 @@
<option value="">
COM_DEMO_LOOK_SELECT_A_YEAR</option>
<option value="2010">
COM_DEMO_LOOK_TWO_HUNDRED_ONEZERO</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_TEN</option>
<option value="2011">
COM_DEMO_LOOK_TWO_HUNDRED_ONEONE</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_ELEVEN</option>
<option value="2012">
COM_DEMO_LOOK_TWO_HUNDRED_ONETWO</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_TWELVE</option>
<option value="2013">
COM_DEMO_LOOK_TWO_HUNDRED_ONETHREE</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_THIRTEEN</option>
<option value="2014">
COM_DEMO_LOOK_TWO_HUNDRED_ONEFOUR</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_FOURTEEN</option>
<option value="2015">
COM_DEMO_LOOK_TWO_HUNDRED_ONEFIVE</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_FIFTEEN</option>
<option value="2016">
COM_DEMO_LOOK_TWO_HUNDRED_ONESIX</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_SIXTEEN</option>
<option value="2017">
COM_DEMO_LOOK_TWO_HUNDRED_ONESEVEN</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_SEVENTEEN</option>
<option value="2018">
COM_DEMO_LOOK_TWO_HUNDRED_ONEEIGHT</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_EIGHTEEN</option>
<option value="2019">
COM_DEMO_LOOK_TWO_HUNDRED_ONENINE</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_NINETEEN</option>
<option value="2020">
COM_DEMO_LOOK_TWO_HUNDRED_TWOZERO</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_TWENTY</option>
<option value="2021">
COM_DEMO_LOOK_TWO_HUNDRED_TWOONE</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_TWENTY_ONE</option>
<option value="2022">
COM_DEMO_LOOK_TWO_HUNDRED_TWOTWO</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_TWENTY_TWO</option>
<option value="2023">
COM_DEMO_LOOK_TWO_HUNDRED_TWOTHREE</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_TWENTY_THREE</option>
<option value="2024">
COM_DEMO_LOOK_TWO_HUNDRED_TWOFOUR</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_TWENTY_FOUR</option>
</field>
</fieldset>
</fields>
@ -350,35 +350,35 @@
<option value="">
COM_DEMO_LOOK_SELECT_A_YEAR</option>
<option value="2010">
COM_DEMO_LOOK_TWO_HUNDRED_ONEZERO</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_TEN</option>
<option value="2011">
COM_DEMO_LOOK_TWO_HUNDRED_ONEONE</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_ELEVEN</option>
<option value="2012">
COM_DEMO_LOOK_TWO_HUNDRED_ONETWO</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_TWELVE</option>
<option value="2013">
COM_DEMO_LOOK_TWO_HUNDRED_ONETHREE</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_THIRTEEN</option>
<option value="2014">
COM_DEMO_LOOK_TWO_HUNDRED_ONEFOUR</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_FOURTEEN</option>
<option value="2015">
COM_DEMO_LOOK_TWO_HUNDRED_ONEFIVE</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_FIFTEEN</option>
<option value="2016">
COM_DEMO_LOOK_TWO_HUNDRED_ONESIX</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_SIXTEEN</option>
<option value="2017">
COM_DEMO_LOOK_TWO_HUNDRED_ONESEVEN</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_SEVENTEEN</option>
<option value="2018">
COM_DEMO_LOOK_TWO_HUNDRED_ONEEIGHT</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_EIGHTEEN</option>
<option value="2019">
COM_DEMO_LOOK_TWO_HUNDRED_ONENINE</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_NINETEEN</option>
<option value="2020">
COM_DEMO_LOOK_TWO_HUNDRED_TWOZERO</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_TWENTY</option>
<option value="2021">
COM_DEMO_LOOK_TWO_HUNDRED_TWOONE</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_TWENTY_ONE</option>
<option value="2022">
COM_DEMO_LOOK_TWO_HUNDRED_TWOTWO</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_TWENTY_TWO</option>
<option value="2023">
COM_DEMO_LOOK_TWO_HUNDRED_TWOTHREE</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_TWENTY_THREE</option>
<option value="2024">
COM_DEMO_LOOK_TWO_HUNDRED_TWOFOUR</option>
COM_DEMO_LOOK_TWO_THOUSAND_AND_TWENTY_FOUR</option>
</field>
</fieldset>
</fields>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage help_document.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -59,7 +61,7 @@ class DemoModelHelp_document extends JModelAdmin
return JTable::getInstance($type, $prefix, $config);
}
/**
/**
* Method to get a single record.
*
* @param integer $pk The id of the primary key.
@ -90,10 +92,8 @@ class DemoModelHelp_document extends JModelAdmin
if (!empty($item->groups))
{
// Convert the groups field to an array.
$groups = new Registry;
$groups->loadString($item->groups);
$item->groups = $groups->toArray();
// JSON Decode groups.
$item->groups = json_decode($item->groups,true);
}
if (!empty($item->id))
@ -104,7 +104,7 @@ class DemoModelHelp_document extends JModelAdmin
}
return $item;
}
}
/**
* Method to get the record form.
@ -117,8 +117,7 @@ class DemoModelHelp_document extends JModelAdmin
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
{ // Get the form.
$form = $this->loadForm('com_demo.help_document', 'help_document', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form))
@ -250,10 +249,11 @@ class DemoModelHelp_document extends JModelAdmin
{
// Check specific edit permission then general edit permission.
$user = JFactory::getUser();
return $user->authorise('help_document.edit', 'com_demo.help_document.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('help_document.edit', 'com_demo');
}
/**
/**
* Prepare and sanitise the table data prior to saving.
*
* @param JTable $table A JTable object.
@ -298,17 +298,17 @@ class DemoModelHelp_document extends JModelAdmin
$table->ordering = $max + 1;
}
}
else
{
else
{
$table->modified = $date->toSql();
$table->modified_by = $user->id;
}
}
if (!empty($table->id))
{
// Increment the items version number.
$table->version++;
}
// Increment the items version number.
$table->version++;
}
}
/**
@ -324,9 +324,9 @@ class DemoModelHelp_document extends JModelAdmin
$data = JFactory::getApplication()->getUserState('com_demo.edit.help_document.data', array());
if (empty($data))
{
{
$data = $this->getItem();
};
}
return $data;
}
@ -405,21 +405,26 @@ class DemoModelHelp_document extends JModelAdmin
if (empty($pks))
{
$this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
return false;
}
$done = false;
// Set some needed variables.
$this->user = JFactory::getUser();
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
$this->tableClassName = get_class($this->table);
$this->contentType = new JUcmType;
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
$this->canDo = DemoHelper::getActions('help_document');
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
$this->canDo = DemoHelper::getActions('help_document');
$this->batchSet = true;
if (!$this->canDo->get('core.batch'))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
return false;
}
if ($this->type == false)
{
$type = new JUcmType;
@ -486,15 +491,15 @@ class DemoModelHelp_document extends JModelAdmin
if (empty($this->batchSet))
{
// Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
$this->contentType = new JUcmType;
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
$this->canDo = DemoHelper::getActions('help_document');
$this->contentType = new JUcmType;
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
$this->canDo = DemoHelper::getActions('help_document');
}
if (!$this->canDo->get('help_document.create'))
if (!$this->canDo->get('help_document.create') && !$this->canDo->get('help_document.batch'))
{
return false;
}
@ -524,6 +529,20 @@ class DemoModelHelp_document extends JModelAdmin
$this->table->reset();
// only allow copy if user may edit this item.
if (!$this->user->authorise('help_document.edit', $contexts[$pk]))
{
// Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
// Check that the row actually exists
if (!$this->table->load($pk))
{
@ -621,15 +640,15 @@ class DemoModelHelp_document extends JModelAdmin
if (empty($this->batchSet))
{
// Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
$this->contentType = new JUcmType;
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
$this->canDo = DemoHelper::getActions('help_document');
$this->contentType = new JUcmType;
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
$this->canDo = DemoHelper::getActions('help_document');
}
if (!$this->canDo->get('help_document.edit'))
if (!$this->canDo->get('help_document.edit') && !$this->canDo->get('help_document.batch'))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
return false;
@ -671,12 +690,17 @@ class DemoModelHelp_document extends JModelAdmin
}
}
// insert all set values
// insert all set values.
if (DemoHelper::checkArray($values))
{
foreach ($values as $key => $value)
{
if (strlen($value) > 0 && isset($this->table->$key))
// Do special action for access.
if ('access' == $key && strlen($value) > 0)
{
$this->table->$key = $value;
}
elseif (strlen($value) > 0 && isset($this->table->$key))
{
$this->table->$key = $value;
}
@ -723,30 +747,23 @@ class DemoModelHelp_document extends JModelAdmin
*/
public function save($data)
{
$input = JFactory::getApplication()->input;
$filter = JFilterInput::getInstance();
$input = JFactory::getApplication()->input;
$filter = JFilterInput::getInstance();
// set the metadata to the Item Data
// set the metadata to the Item Data
if (isset($data['metadata']) && isset($data['metadata']['author']))
{
$data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
$metadata = new JRegistry;
$metadata = new JRegistry;
$metadata->loadArray($data['metadata']);
$data['metadata'] = (string) $metadata;
}
// Set the groups items to data.
if (isset($data['groups']) && is_array($data['groups']))
// Set the groups string to JSON string.
if (isset($data['groups']))
{
$groups = new JRegistry;
$groups->loadArray($data['groups']);
$data['groups'] = (string) $groups;
}
elseif (!isset($data['groups']))
{
// Set the empty items to data
$data['groups'] = '';
$data['groups'] = (string) json_encode($data['groups']);
}
// Set the Params Items to data

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage help_documents.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -83,7 +85,7 @@ class DemoModelHelp_documents extends JModelList
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
$this->setState('filter.access', $access);
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $search);
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
@ -105,7 +107,7 @@ class DemoModelHelp_documents extends JModelList
* @return mixed An array of data items on success, false on failure.
*/
public function getItems()
{
{
// check in items
$this->checkInNow();
@ -119,9 +121,8 @@ class DemoModelHelp_documents extends JModelList
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
$access = $user->authorise('help_document.access', 'com_demo.help_document.' . (int) $item->id);
$accessAdmin = $user->authorise('help_document.access', 'com_demo');
if ((!$access && !is_null($access)) || (!$accessAdmin && !is_null($accessAdmin)))
$access = ($user->authorise('help_document.access', 'com_demo.help_document.' . (int) $item->id) && $user->authorise('help_document.access', 'com_demo'));
if (!$access)
{
unset($items[$nr]);
continue;
@ -184,7 +185,7 @@ class DemoModelHelp_documents extends JModelList
3 => 'COM_DEMO_HELP_DOCUMENT_URL'
);
// Now check if value is found in this array
if (DemoHelper::checkString($typeArray[$value]))
if (isset($typeArray[$value]) && DemoHelper::checkString($typeArray[$value]))
{
return $typeArray[$value];
}
@ -197,7 +198,7 @@ class DemoModelHelp_documents extends JModelList
2 => 'COM_DEMO_HELP_DOCUMENT_SITE'
);
// Now check if value is found in this array
if (DemoHelper::checkString($locationArray[$value]))
if (isset($locationArray[$value]) && DemoHelper::checkString($locationArray[$value]))
{
return $locationArray[$value];
}
@ -244,7 +245,7 @@ class DemoModelHelp_documents extends JModelList
$query->where('a.access = ' . (int) $access);
}
// Implement View Level Access
if (!$user->authorise('core.admin'))
if (!$user->authorise('core.options', 'com_demo'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
@ -319,7 +320,7 @@ class DemoModelHelp_documents extends JModelList
$query->from($db->quoteName('#__demo_help_document', 'a'));
$query->where('a.id IN (' . implode(',',$pks) . ')');
// Implement View Level Access
if (!$user->authorise('core.admin'))
if (!$user->authorise('core.options', 'com_demo'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
@ -342,9 +343,8 @@ class DemoModelHelp_documents extends JModelList
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
$access = $user->authorise('help_document.access', 'com_demo.help_document.' . (int) $item->id);
$accessAdmin = $user->authorise('help_document.access', 'com_demo');
if ((!$access && !is_null($access)) || (!$accessAdmin && !is_null($accessAdmin)))
$access = ($user->authorise('help_document.access', 'com_demo.help_document.' . (int) $item->id) && $user->authorise('help_document.access', 'com_demo'));
if (!$access)
{
unset($items[$nr]);
continue;
@ -393,7 +393,7 @@ class DemoModelHelp_documents extends JModelList
return $headers;
}
return false;
}
}
/**
* Method to get a store id based on model configuration state.
@ -443,12 +443,12 @@ class DemoModelHelp_documents extends JModelList
$db->execute();
if ($db->getNumRows())
{
// Get Yesterdays date
$date =& JFactory::getDate()->modify($time)->toSql();
// Get Yesterdays date
$date = JFactory::getDate()->modify($time)->toSql();
// reset query
$query = $db->getQuery(true);
// Fields to update.
// Fields to update.
$fields = array(
$db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'',
$db->quoteName('checked_out') . '=0'
@ -461,7 +461,7 @@ class DemoModelHelp_documents extends JModelList
);
// Check table
$query->update(('#__demo_help_document'))->set($fields)->where($conditions);
$query->update($db->quoteName('#__demo_help_document'))->set($fields)->where($conditions);
$db->setQuery($query);

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage import.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -65,10 +67,10 @@ class DemoModelImport extends JModelLegacy
// Recall the 'Import from Directory' path.
$path = $app->getUserStateFromRequest($this->_context . '.import_directory', 'import_directory', $app->get('tmp_path'));
$this->setState('import.directory', $path);
// set uploading values
$this->use_streams = false;
$this->allow_unsafe = false;
$this->safeFileOptions = array();
// set uploading values
$this->use_streams = false;
$this->allow_unsafe = false;
$this->safeFileOptions = array();
parent::populateState();
}
@ -82,7 +84,7 @@ class DemoModelImport extends JModelLegacy
{
$this->setState('action', 'import');
$app = JFactory::getApplication();
$session =& JFactory::getSession();
$session = JFactory::getSession();
$package = null;
$continue = false;
// get import type
@ -137,7 +139,7 @@ class DemoModelImport extends JModelLegacy
return false;
}
// first link data to table headers
// first link data to table headers
if(!$continue){
$package = json_encode($package);
$session->set('package', $package);
@ -153,11 +155,11 @@ class DemoModelImport extends JModelLegacy
// There was an error importing the package
$msg = JText::_('COM_DEMO_IMPORT_ERROR');
$back = $session->get('backto_VDM_IMPORT', NULL);
if ($back)
{
$app->setUserState('com_demo.redirect_url', 'index.php?option=com_demo&view='.$back);
$session->clear('backto_VDM_IMPORT');
}
if ($back)
{
$app->setUserState('com_demo.redirect_url', 'index.php?option=com_demo&view='.$back);
$session->clear('backto_VDM_IMPORT');
}
$result = false;
}
else
@ -165,11 +167,11 @@ class DemoModelImport extends JModelLegacy
// Package imported sucessfully
$msg = JText::sprintf('COM_DEMO_IMPORT_SUCCESS', $package['packagename']);
$back = $session->get('backto_VDM_IMPORT', NULL);
if ($back)
{
$app->setUserState('com_demo.redirect_url', 'index.php?option=com_demo&view='.$back);
$session->clear('backto_VDM_IMPORT');
}
if ($back)
{
$app->setUserState('com_demo.redirect_url', 'index.php?option=com_demo&view='.$back);
$session->clear('backto_VDM_IMPORT');
}
$result = true;
}
@ -226,7 +228,7 @@ class DemoModelImport extends JModelLegacy
// Was the package downloaded?
if (!$p_file)
{
$session =& JFactory::getSession();
$session = JFactory::getSession();
$session->clear('package');
$session->clear('dataType');
$session->clear('hasPackage');
@ -359,10 +361,10 @@ class DemoModelImport extends JModelLegacy
$check['packagename'] = $archivename;
// set directory
$check['dir'] = $config->get('tmp_path'). '/' .$archivename;
$check['dir'] = $config->get('tmp_path'). '/' .$archivename;
// set type
$check['type'] = $this->getType;
$check['type'] = $this->getType;
return $check;
}
@ -383,9 +385,12 @@ class DemoModelImport extends JModelLegacy
$package = $config->get('tmp_path'). '/' .$package;
// Is the package file a valid file?
if (is_file($package)) {
if (is_file($package))
{
JFile::delete($package);
} elseif (is_file(JPath::clean($package))) {
}
elseif (is_file(JPath::clean($package)))
{
// It might also be just a base filename
JFile::delete(JPath::clean($package));
}
@ -404,14 +409,15 @@ class DemoModelImport extends JModelLegacy
if (DemoHelper::checkArray($target_headers))
{
// make sure the file is loaded
JLoader::import('PHPExcel', JPATH_COMPONENT_ADMINISTRATOR . '/helpers');
JLoader::import('PHPExcel', JPATH_COMPONENT_ADMINISTRATOR . '/helpers');
$jinput = JFactory::getApplication()->input;
foreach($target_headers as $header)
{
$data['target_headers'][$header] = $jinput->getString($header, null);
}
// set the data
if(isset($package['dir'])){
if(isset($package['dir']))
{
$inputFileType = PHPExcel_IOFactory::identify($package['dir']);
$excelReader = PHPExcel_IOFactory::createReader($inputFileType);
$excelReader->setReadDataOnly(true);
@ -438,10 +444,10 @@ class DemoModelImport extends JModelLegacy
// import the data if there is any
if(DemoHelper::checkArray($data['array']))
{
// get user object
$user = JFactory::getUser();
// get user object
$user = JFactory::getUser();
// remove header if it has headers
$id_key = $data['target_headers']['id'];
$id_key = $data['target_headers']['id'];
$published_key = $data['target_headers']['published'];
$ordering_key = $data['target_headers']['ordering'];
// get the first array set
@ -462,11 +468,12 @@ class DemoModelImport extends JModelLegacy
$db = JFactory::getDbo();
// set some defaults
$todayDate = JFactory::getDate()->toSql();
// get global action permissions
$canDo = DemoHelper::getActions($table);
$canEdit = $canDo->get('core.edit');
$canState = $canDo->get('core.edit.state');
$canCreate = $canDo->get('core.create');
// get global action permissions
$canDo = DemoHelper::getActions($table);
$canEdit = $canDo->get('core.edit');
$canState = $canDo->get('core.edit.state');
$canCreate = $canDo->get('core.create');
$hasAlias = $this->getAliasesUsed($table);
// prosses the data
foreach($data['array'] as $row)
{
@ -497,29 +504,29 @@ class DemoModelImport extends JModelLegacy
// Fields to update.
foreach($row as $key => $cell)
{
// ignore column
if ($target[$key] == 'IGNORE')
{
continue;
}
// update modified
if ($target[$key] == 'modified_by')
// ignore column
if ('IGNORE' == $target[$key])
{
continue;
}
// update modified
if ($target[$key] == 'modified')
if ('modified_by' == $target[$key])
{
continue;
}
// update modified
if ('modified' == $target[$key])
{
continue;
}
// update version
if ($target[$key] == 'version')
if ('version' == $target[$key])
{
$cell = (int) $version + 1;
$version = true;
}
// verfy publish autority
if ($target[$key] == 'published' && !$canState)
// verify publish authority
if ('published' == $target[$key] && !$canState)
{
continue;
}
@ -538,7 +545,7 @@ class DemoModelImport extends JModelLegacy
$fields[] = $db->quoteName($target[$key]) . " = ''";
}
}
// load the defautls
// load the defaults
$fields[] = $db->quoteName('modified_by') . ' = ' . $db->quote($user->id);
$fields[] = $db->quoteName('modified') . ' = ' . $db->quote($todayDate);
if (!$version)
@ -551,10 +558,8 @@ class DemoModelImport extends JModelLegacy
);
$query->update($db->quoteName('#__demo_'.$table))->set($fields)->where($conditions);
$db->setQuery($query);
$db->query();
$db->execute();
}
elseif ($canCreate)
{
@ -567,33 +572,38 @@ class DemoModelImport extends JModelLegacy
// Insert columns. Insert values.
foreach($row as $key => $cell)
{
// ignore column
if ($target[$key] == 'IGNORE')
{
// ignore column
if ('IGNORE' == $target[$key])
{
continue;
}
}
// remove id
if ($target[$key] == 'id')
if ('id' == $target[$key])
{
continue;
}
// update created
if ($target[$key] == 'created_by')
if ('created_by' == $target[$key])
{
continue;
}
// update created
if ($target[$key] == 'created')
if ('created' == $target[$key])
{
continue;
}
// Make sure the alias is incremented
if ('alias' == $target[$key])
{
$cell = $this->getAlias($cell,$table);
}
// update version
if ($target[$key] == 'version')
if ('version' == $target[$key])
{
$cell = 1;
$version = true;
}
// set to insert array
// set to insert array
if(in_array($key, $data['target_headers']) && is_numeric($cell))
{
$columns[] = $target[$key];
@ -628,16 +638,87 @@ class DemoModelImport extends JModelLegacy
->values(implode(',', $values));
// Set the query using our newly populated query object and execute it.
$db->setQuery($query);
$db->query();
$done = $db->execute();
if ($done)
{
$aId = $db->insertid();
// make sure the access of asset is set
DemoHelper::setAsset($aId,$table);
}
}
else
{
else
{
return false;
}
}
}
return true;
}
}
return false;
}
protected function getAlias($name,$type = false)
{
// sanitize the name to an alias
if (JFactory::getConfig()->get('unicodeslugs') == 1)
{
$alias = JFilterOutput::stringURLUnicodeSlug($name);
}
else
{
$alias = JFilterOutput::stringURLSafe($name);
}
// must be a uniqe alias
if ($type)
{
return $this->getUniqe($alias,'alias',$type);
}
return $alias;
}
/**
* Method to generate a uniqe value.
*
* @param string $field name.
* @param string $value data.
* @param string $type table.
*
* @return string New value.
*/
protected function getUniqe($value,$field,$type)
{
// insure the filed is always uniqe
while (isset($this->uniqeValueArray[$type][$field][$value]))
{
$value = JString::increment($value, 'dash');
}
$this->uniqeValueArray[$type][$field][$value] = $value;
return $value;
}
protected function getAliasesUsed($table)
{
// Get a db connection.
$db = JFactory::getDbo();
// first we check if there is a alias column
$columns = $db->getTableColumns('#__demo_'.$table);
if(isset($columns['alias'])){
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName(array('alias')));
$query->from($db->quoteName('#__demo_'.$table));
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
$aliases = $db->loadColumn();
foreach($aliases as $alias)
{
$this->uniqeValueArray[$table]['alias'][$alias] = $alias;
}
}
return true;
}
return false;
}
}

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage look.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -59,7 +61,7 @@ class DemoModelLook extends JModelAdmin
return JTable::getInstance($type, $prefix, $config);
}
/**
/**
* Method to get a single record.
*
* @param integer $pk The id of the primary key.
@ -96,7 +98,7 @@ class DemoModelLook extends JModelAdmin
}
return $item;
}
}
/**
* Method to get the record form.
@ -109,8 +111,7 @@ class DemoModelLook extends JModelAdmin
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
{ // Get the form.
$form = $this->loadForm('com_demo.look', 'look', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form))
@ -241,10 +242,11 @@ class DemoModelLook extends JModelAdmin
protected function allowEdit($data = array(), $key = 'id')
{
// Check specific edit permission then general edit permission.
return JFactory::getUser()->authorise('core.edit', 'com_demo.look.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key);
}
/**
/**
* Prepare and sanitise the table data prior to saving.
*
* @param JTable $table A JTable object.
@ -289,17 +291,17 @@ class DemoModelLook extends JModelAdmin
$table->ordering = $max + 1;
}
}
else
{
else
{
$table->modified = $date->toSql();
$table->modified_by = $user->id;
}
}
if (!empty($table->id))
{
// Increment the items version number.
$table->version++;
}
// Increment the items version number.
$table->version++;
}
}
/**
@ -315,9 +317,9 @@ class DemoModelLook extends JModelAdmin
$data = JFactory::getApplication()->getUserState('com_demo.edit.look.data', array());
if (empty($data))
{
{
$data = $this->getItem();
};
}
return $data;
}
@ -396,21 +398,26 @@ class DemoModelLook extends JModelAdmin
if (empty($pks))
{
$this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
return false;
}
$done = false;
// Set some needed variables.
$this->user = JFactory::getUser();
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
$this->tableClassName = get_class($this->table);
$this->contentType = new JUcmType;
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
$this->canDo = DemoHelper::getActions('look');
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
$this->canDo = DemoHelper::getActions('look');
$this->batchSet = true;
if (!$this->canDo->get('core.batch'))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
return false;
}
if ($this->type == false)
{
$type = new JUcmType;
@ -477,15 +484,15 @@ class DemoModelLook extends JModelAdmin
if (empty($this->batchSet))
{
// Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
$this->contentType = new JUcmType;
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
$this->canDo = DemoHelper::getActions('look');
$this->contentType = new JUcmType;
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
$this->canDo = DemoHelper::getActions('look');
}
if (!$this->canDo->get('core.create'))
if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch'))
{
return false;
}
@ -515,6 +522,20 @@ class DemoModelLook extends JModelAdmin
$this->table->reset();
// only allow copy if user may edit this item.
if (!$this->user->authorise('core.edit', $contexts[$pk]))
{
// Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
// Check that the row actually exists
if (!$this->table->load($pk))
{
@ -612,15 +633,15 @@ class DemoModelLook extends JModelAdmin
if (empty($this->batchSet))
{
// Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
$this->contentType = new JUcmType;
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
$this->canDo = DemoHelper::getActions('look');
$this->contentType = new JUcmType;
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
$this->canDo = DemoHelper::getActions('look');
}
if (!$this->canDo->get('core.edit'))
if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch'))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
return false;
@ -662,12 +683,17 @@ class DemoModelLook extends JModelAdmin
}
}
// insert all set values
// insert all set values.
if (DemoHelper::checkArray($values))
{
foreach ($values as $key => $value)
{
if (strlen($value) > 0 && isset($this->table->$key))
// Do special action for access.
if ('access' == $key && strlen($value) > 0)
{
$this->table->$key = $value;
}
elseif (strlen($value) > 0 && isset($this->table->$key))
{
$this->table->$key = $value;
}
@ -714,15 +740,15 @@ class DemoModelLook extends JModelAdmin
*/
public function save($data)
{
$input = JFactory::getApplication()->input;
$filter = JFilterInput::getInstance();
$input = JFactory::getApplication()->input;
$filter = JFilterInput::getInstance();
// set the metadata to the Item Data
// set the metadata to the Item Data
if (isset($data['metadata']) && isset($data['metadata']['author']))
{
$data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
$metadata = new JRegistry;
$metadata = new JRegistry;
$metadata->loadArray($data['metadata']);
$data['metadata'] = (string) $metadata;
}

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage looks.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -83,7 +85,7 @@ class DemoModelLooks extends JModelList
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
$this->setState('filter.access', $access);
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $search);
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
@ -105,7 +107,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();
@ -142,7 +144,7 @@ class DemoModelLooks extends JModelList
0 => 'COM_DEMO_LOOK_NO'
);
// Now check if value is found in this array
if (DemoHelper::checkString($addArray[$value]))
if (isset($addArray[$value]) && DemoHelper::checkString($addArray[$value]))
{
return $addArray[$value];
}
@ -189,7 +191,7 @@ class DemoModelLooks extends JModelList
$query->where('a.access = ' . (int) $access);
}
// Implement View Level Access
if (!$user->authorise('core.admin'))
if (!$user->authorise('core.options', 'com_demo'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
@ -254,7 +256,7 @@ class DemoModelLooks extends JModelList
$query->from($db->quoteName('#__demo_look', 'a'));
$query->where('a.id IN (' . implode(',',$pks) . ')');
// Implement View Level Access
if (!$user->authorise('core.admin'))
if (!$user->authorise('core.options', 'com_demo'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
@ -318,7 +320,7 @@ class DemoModelLooks extends JModelList
return $headers;
}
return false;
}
}
/**
* Method to get a store id based on model configuration state.
@ -368,12 +370,12 @@ class DemoModelLooks extends JModelList
$db->execute();
if ($db->getNumRows())
{
// Get Yesterdays date
$date =& JFactory::getDate()->modify($time)->toSql();
// Get Yesterdays date
$date = JFactory::getDate()->modify($time)->toSql();
// reset query
$query = $db->getQuery(true);
// Fields to update.
// Fields to update.
$fields = array(
$db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'',
$db->quoteName('checked_out') . '=0'
@ -386,7 +388,7 @@ class DemoModelLooks extends JModelList
);
// Check table
$query->update(('#__demo_look'))->set($fields)->where($conditions);
$query->update($db->quoteName('#__demo_look'))->set($fields)->where($conditions);
$db->setQuery($query);

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage help_document.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -47,13 +49,13 @@ class DemoTableHelp_document extends JTable
parent::__construct('#__demo_help_document', 'id', $db);
// Adding History Options
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_demo.help_document'));
JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_demo.help_document'));
}
public function bind($array, $ignore = '')
{
if (isset($array['params']) && is_array($array['params']))
if (isset($array['params']) && is_array($array['params']))
{
$registry = new JRegistry;
$registry->loadArray($array['params']);
@ -69,14 +71,14 @@ class DemoTableHelp_document extends JTable
// Bind the rules.
if (isset($array['rules']) && is_array($array['rules']))
{
{
$rules = new JAccessRules($array['rules']);
$this->setRules($rules);
}
return parent::bind($array, $ignore);
}
/**
/**
* Overload the store method for the Help_document table.
*
* @param boolean Toggle whether null values should be updated.
@ -108,33 +110,33 @@ class DemoTableHelp_document extends JTable
}
}
if (isset($this->alias))
{
// Verify that the alias is unique
$table = JTable::getInstance('help_document', 'DemoTable');
if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
{
$this->setError(JText::_('COM_DEMO_HELP_DOCUMENT_ERROR_UNIQUE_ALIAS'));
return false;
}
}
if (isset($this->alias))
{
// Verify that the alias is unique
$table = JTable::getInstance('help_document', 'DemoTable');
if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
{
$this->setError(JText::_('COM_DEMO_HELP_DOCUMENT_ERROR_UNIQUE_ALIAS'));
return false;
}
}
if (isset($this->url))
{
// Convert IDN urls to punycode
$this->url = JStringPunycode::urlToPunycode($this->url);
}
if (isset($this->website))
{
// Convert IDN urls to punycode
$this->website = JStringPunycode::urlToPunycode($this->website);
}
if (isset($this->url))
{
// Convert IDN urls to punycode
$this->url = JStringPunycode::urlToPunycode($this->url);
}
if (isset($this->website))
{
// Convert IDN urls to punycode
$this->website = JStringPunycode::urlToPunycode($this->website);
}
return parent::store($updateNulls);
}
/**
/**
* Overloaded check method to ensure data integrity.
*
* @return boolean True on success.
@ -146,7 +148,7 @@ class DemoTableHelp_document extends JTable
// Generate a valid alias
$this->generateAlias();
$table = JTable::getInstance('help_document', 'demoTable');
$table = JTable::getInstance('help_document', 'demoTable');
while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
{
@ -192,14 +194,14 @@ class DemoTableHelp_document extends JTable
$this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc);
}
// If we don't have any access rules set at this point just use an empty JAccessRules class
if (!$this->getRules())
{
$rules = $this->getDefaultAssetValues('com_demo');
$this->setRules($rules);
}
// If we don't have any access rules set at this point just use an empty JAccessRules class
if (!$this->getRules())
{
$rules = $this->getDefaultAssetValues('com_demo.help_document.'.$this->id);
$this->setRules($rules);
}
// Set ordering
// Set ordering
if ($this->published < 0)
{
// Set ordering to 0 if state is archived or trashed
@ -216,7 +218,7 @@ class DemoTableHelp_document extends JTable
*
* @return JAccessRules The JAccessRules object for the asset
*/
protected function getDefaultAssetValues($component)
protected function getDefaultAssetValues($component, $try = true)
{
// Need to find the asset id by the name of the component.
$db = JFactory::getDbo();
@ -225,9 +227,54 @@ class DemoTableHelp_document extends JTable
->from($db->quoteName('#__assets'))
->where($db->quoteName('name') . ' = ' . $db->quote($component));
$db->setQuery($query);
$assetId = (int) $db->loadResult();
$db->execute();
if ($db->loadRowList())
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
}
// try again
elseif ($try)
{
$try = explode('.',$component);
$result = $this->getDefaultAssetValues($try[0], false);
if ($result instanceof JAccessRules)
{
if (isset($try[1]))
{
$_result = (string) $result;
$_result = json_decode($_result);
foreach ($_result as $name => &$rule)
{
$v = explode('.', $name);
if ($try[1] !== $v[0])
{
// remove since it is not part of this view
unset($_result->$name);
}
else
{
// clear the value since we inherit
$rule = array();
}
}
// check if there are any view values remaining
if (count($_result))
{
$_result = json_encode($_result);
$_result = array($_result);
// Instantiate and return the JAccessRules object for the asset rules.
$rules = new JAccessRules;
$rules->mergeCollection($_result);
return JAccess::getAssetRules($assetId);
return $rules;
}
}
return $result;
}
}
return JAccess::getAssetRules(0);
}
/**
@ -252,7 +299,11 @@ class DemoTableHelp_document extends JTable
*/
protected function _getAssetTitle()
{
return $this->title;
if (isset($this->title))
{
return $this->title;
}
return '';
}
/**
@ -261,7 +312,7 @@ class DemoTableHelp_document extends JTable
* @return int
* @since 2.5
*/
protected function _getAssetParentId($table = null, $id = null)
protected function _getAssetParentId(JTable $table = NULL, $id = NULL)
{
$asset = JTable::getInstance('Asset');
$asset->loadByName('com_demo');

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage look.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -47,13 +49,13 @@ 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 = '')
{
if (isset($array['params']) && is_array($array['params']))
if (isset($array['params']) && is_array($array['params']))
{
$registry = new JRegistry;
$registry->loadArray($array['params']);
@ -69,14 +71,14 @@ class DemoTableLook extends JTable
// Bind the rules.
if (isset($array['rules']) && is_array($array['rules']))
{
{
$rules = new JAccessRules($array['rules']);
$this->setRules($rules);
}
return parent::bind($array, $ignore);
}
/**
/**
* Overload the store method for the Look table.
*
* @param boolean Toggle whether null values should be updated.
@ -108,33 +110,33 @@ class DemoTableLook extends JTable
}
}
if (isset($this->alias))
{
// Verify that the alias is unique
$table = JTable::getInstance('look', 'DemoTable');
if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
{
$this->setError(JText::_('COM_DEMO_LOOK_ERROR_UNIQUE_ALIAS'));
return false;
}
}
if (isset($this->alias))
{
// Verify that the alias is unique
$table = JTable::getInstance('look', 'DemoTable');
if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
{
$this->setError(JText::_('COM_DEMO_LOOK_ERROR_UNIQUE_ALIAS'));
return false;
}
}
if (isset($this->url))
{
// Convert IDN urls to punycode
$this->url = JStringPunycode::urlToPunycode($this->url);
}
if (isset($this->website))
{
// Convert IDN urls to punycode
$this->website = JStringPunycode::urlToPunycode($this->website);
}
if (isset($this->url))
{
// Convert IDN urls to punycode
$this->url = JStringPunycode::urlToPunycode($this->url);
}
if (isset($this->website))
{
// Convert IDN urls to punycode
$this->website = JStringPunycode::urlToPunycode($this->website);
}
return parent::store($updateNulls);
}
/**
/**
* Overloaded check method to ensure data integrity.
*
* @return boolean True on success.
@ -146,7 +148,7 @@ class DemoTableLook extends JTable
// Generate a valid alias
$this->generateAlias();
$table = JTable::getInstance('look', 'demoTable');
$table = JTable::getInstance('look', 'demoTable');
while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
{
@ -192,14 +194,14 @@ class DemoTableLook extends JTable
$this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc);
}
// If we don't have any access rules set at this point just use an empty JAccessRules class
if (!$this->getRules())
{
$rules = $this->getDefaultAssetValues('com_demo');
$this->setRules($rules);
}
// If we don't have any access rules set at this point just use an empty JAccessRules class
if (!$this->getRules())
{
$rules = $this->getDefaultAssetValues('com_demo.look.'.$this->id);
$this->setRules($rules);
}
// Set ordering
// Set ordering
if ($this->published < 0)
{
// Set ordering to 0 if state is archived or trashed
@ -216,7 +218,7 @@ class DemoTableLook extends JTable
*
* @return JAccessRules The JAccessRules object for the asset
*/
protected function getDefaultAssetValues($component)
protected function getDefaultAssetValues($component, $try = true)
{
// Need to find the asset id by the name of the component.
$db = JFactory::getDbo();
@ -225,9 +227,54 @@ class DemoTableLook extends JTable
->from($db->quoteName('#__assets'))
->where($db->quoteName('name') . ' = ' . $db->quote($component));
$db->setQuery($query);
$assetId = (int) $db->loadResult();
$db->execute();
if ($db->loadRowList())
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
return JAccess::getAssetRules($assetId);
}
// try again
elseif ($try)
{
$try = explode('.',$component);
$result = $this->getDefaultAssetValues($try[0], false);
if ($result instanceof JAccessRules)
{
if (isset($try[1]))
{
$_result = (string) $result;
$_result = json_decode($_result);
foreach ($_result as $name => &$rule)
{
$v = explode('.', $name);
if ($try[1] !== $v[0])
{
// remove since it is not part of this view
unset($_result->$name);
}
else
{
// clear the value since we inherit
$rule = array();
}
}
// check if there are any view values remaining
if (count($_result))
{
$_result = json_encode($_result);
$_result = array($_result);
// Instantiate and return the JAccessRules object for the asset rules.
$rules = new JAccessRules;
$rules->mergeCollection($_result);
return JAccess::getAssetRules($assetId);
return $rules;
}
}
return $result;
}
}
return JAccess::getAssetRules(0);
}
/**
@ -252,7 +299,11 @@ class DemoTableLook extends JTable
*/
protected function _getAssetTitle()
{
return $this->title;
if (isset($this->title))
{
return $this->title;
}
return '';
}
/**
@ -261,7 +312,7 @@ class DemoTableLook extends JTable
* @return int
* @since 2.5
*/
protected function _getAssetParentId($table = null, $id = null)
protected function _getAssetParentId(JTable $table = NULL, $id = NULL)
{
$asset = JTable::getInstance('Asset');
$asset->loadByName('com_demo');

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage default.php
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage default_main.php
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage default_vdm.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -28,7 +30,7 @@ JHtml::_('bootstrap.loadCss');
<li><b><?php echo JText::_('COM_DEMO_VERSION'); ?>:</b> <?php echo $manifest->version; ?></li>
<li><b><?php echo JText::_('COM_DEMO_DATE'); ?>:</b> <?php echo $manifest->creationDate; ?></li>
<li><b><?php echo JText::_('COM_DEMO_AUTHOR'); ?>:</b> <a href="mailto:<?php echo $manifest->authorEmail; ?>"><?php echo $manifest->author; ?></a></li>
<li><b><?php echo JText::_('COM_DEMO_WEBSITE'); ?>:</b> <a href="https://<?php echo $manifest->authorUrl; ?>" target="_balnk"><?php echo $manifest->authorUrl; ?></a></li>
<li><b><?php echo JText::_('COM_DEMO_WEBSITE'); ?>:</b> <a href="<?php echo $manifest->authorUrl; ?>" target="_blank"><?php echo $manifest->authorUrl; ?></a></li>
<li><b><?php echo JText::_('COM_DEMO_LICENSE'); ?>:</b> <?php echo $manifest->license; ?></li>
<li><b><?php echo $manifest->copyright; ?></b></li>
</ul>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage view.html.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -31,17 +33,17 @@ class DemoViewDemo extends JViewLegacy
* View display method
* @return void
*/
function display($tpl = null)
function display($tpl = null)
{
// Check for errors.
if (count($errors = $this->get('Errors')))
{
{
JError::raiseError(500, implode('<br />', $errors));
return false;
};
// Assign data to the view
$this->icons = $this->get('Icons');
$this->contributors = $this->get('Contributors');
$this->contributors = DemoHelper::getContributors();
// Set the toolbar
$this->addToolBar();
@ -56,23 +58,22 @@ class DemoViewDemo extends JViewLegacy
/**
* Setting the toolbar
*/
protected function addToolBar()
protected function addToolBar()
{
$canDo = DemoHelper::getActions('demo');
JToolBarHelper::title(JText::_('COM_DEMO_DASHBOARD'), 'grid-2');
if ($canDo->get('core.admin') || $canDo->get('core.options'))
{
JToolBarHelper::divider();
JToolBarHelper::preferences('com_demo');
};
// set help url for this view if found
$help_url = DemoHelper::getHelpUrl('demo');
if (DemoHelper::checkString($help_url))
{
// set help url for this view if found
$help_url = DemoHelper::getHelpUrl('demo');
if (DemoHelper::checkString($help_url))
{
JToolbarHelper::help('COM_DEMO_HELP_MANAGER', false, $help_url);
}
}
if ($canDo->get('core.admin') || $canDo->get('core.options'))
{
JToolBarHelper::preferences('com_demo');
}
}
/**
@ -81,12 +82,12 @@ class DemoViewDemo extends JViewLegacy
*
* @return void
*/
protected function setDocument()
protected function setDocument()
{
$document = JFactory::getDocument();
$document->addStyleSheet(JURI::root() . "administrator/components/com_demo/assets/css/dashboard.css");
$document->setTitle(JText::_('COM_DEMO_DASHBOARD'));
}
}

View File

@ -2,7 +2,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage submitbutton.js
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage edit.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -93,93 +95,93 @@ $componentParams = JComponentHelper::getParams('com_demo');
<script type="text/javascript">
// #jform_location listeners for location_kWBkVYH function
// #jform_location listeners for location_sLnxlWV function
jQuery('#jform_location').on('keyup',function()
{
var location_kWBkVYH = jQuery("#jform_location input[type='radio']:checked").val();
kWBkVYH(location_kWBkVYH);
var location_sLnxlWV = jQuery("#jform_location input[type='radio']:checked").val();
sLnxlWV(location_sLnxlWV);
});
jQuery('#adminForm').on('change', '#jform_location',function (e)
{
e.preventDefault();
var location_kWBkVYH = jQuery("#jform_location input[type='radio']:checked").val();
kWBkVYH(location_kWBkVYH);
var location_sLnxlWV = jQuery("#jform_location input[type='radio']:checked").val();
sLnxlWV(location_sLnxlWV);
});
// #jform_location listeners for location_HqKSXxe function
// #jform_location listeners for location_fqbSveC function
jQuery('#jform_location').on('keyup',function()
{
var location_HqKSXxe = jQuery("#jform_location input[type='radio']:checked").val();
HqKSXxe(location_HqKSXxe);
var location_fqbSveC = jQuery("#jform_location input[type='radio']:checked").val();
fqbSveC(location_fqbSveC);
});
jQuery('#adminForm').on('change', '#jform_location',function (e)
{
e.preventDefault();
var location_HqKSXxe = jQuery("#jform_location input[type='radio']:checked").val();
HqKSXxe(location_HqKSXxe);
var location_fqbSveC = jQuery("#jform_location input[type='radio']:checked").val();
fqbSveC(location_fqbSveC);
});
// #jform_type listeners for type_yZpGWZM function
// #jform_type listeners for type_Xvephxz function
jQuery('#jform_type').on('keyup',function()
{
var type_yZpGWZM = jQuery("#jform_type").val();
yZpGWZM(type_yZpGWZM);
var type_Xvephxz = jQuery("#jform_type").val();
Xvephxz(type_Xvephxz);
});
jQuery('#adminForm').on('change', '#jform_type',function (e)
{
e.preventDefault();
var type_yZpGWZM = jQuery("#jform_type").val();
yZpGWZM(type_yZpGWZM);
var type_Xvephxz = jQuery("#jform_type").val();
Xvephxz(type_Xvephxz);
});
// #jform_type listeners for type_CGEclrj function
// #jform_type listeners for type_yFWFBjo function
jQuery('#jform_type').on('keyup',function()
{
var type_CGEclrj = jQuery("#jform_type").val();
CGEclrj(type_CGEclrj);
var type_yFWFBjo = jQuery("#jform_type").val();
yFWFBjo(type_yFWFBjo);
});
jQuery('#adminForm').on('change', '#jform_type',function (e)
{
e.preventDefault();
var type_CGEclrj = jQuery("#jform_type").val();
CGEclrj(type_CGEclrj);
var type_yFWFBjo = jQuery("#jform_type").val();
yFWFBjo(type_yFWFBjo);
});
// #jform_type listeners for type_IlNsWah function
// #jform_type listeners for type_revjpJk function
jQuery('#jform_type').on('keyup',function()
{
var type_IlNsWah = jQuery("#jform_type").val();
IlNsWah(type_IlNsWah);
var type_revjpJk = jQuery("#jform_type").val();
revjpJk(type_revjpJk);
});
jQuery('#adminForm').on('change', '#jform_type',function (e)
{
e.preventDefault();
var type_IlNsWah = jQuery("#jform_type").val();
IlNsWah(type_IlNsWah);
var type_revjpJk = jQuery("#jform_type").val();
revjpJk(type_revjpJk);
});
// #jform_target listeners for target_UqLidJh function
// #jform_target listeners for target_MhQPsZt function
jQuery('#jform_target').on('keyup',function()
{
var target_UqLidJh = jQuery("#jform_target input[type='radio']:checked").val();
UqLidJh(target_UqLidJh);
var target_MhQPsZt = jQuery("#jform_target input[type='radio']:checked").val();
MhQPsZt(target_MhQPsZt);
});
jQuery('#adminForm').on('change', '#jform_target',function (e)
{
e.preventDefault();
var target_UqLidJh = jQuery("#jform_target input[type='radio']:checked").val();
UqLidJh(target_UqLidJh);
var target_MhQPsZt = jQuery("#jform_target input[type='radio']:checked").val();
MhQPsZt(target_MhQPsZt);
});

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage view.html.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -35,34 +37,34 @@ class DemoViewHelp_document extends JViewLegacy
{
// Check for errors.
if (count($errors = $this->get('Errors')))
{
{
JError::raiseError(500, implode('<br />', $errors));
return false;
};
}
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->script = $this->get('Script');
$this->state = $this->get('State');
// get action permissions
// get action permissions
$this->canDo = DemoHelper::getActions('help_document',$this->item);
// get input
$jinput = JFactory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$this->referral = '';
$this->refid = $jinput->get('refid', 0, 'int');
$this->referral = '';
if ($this->refid)
{
// return to the item that refered to this item
$this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid;
}
elseif($this->ref)
{
// return to the list view that refered to this item
$this->referral = '&ref='.(string)$this->ref;
}
{
// return to the item that refered to this item
$this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid;
}
elseif($this->ref)
{
// return to the list view that refered to this item
$this->referral = '&ref='.(string)$this->ref;
}
// Set the toolbar
$this->addToolBar();
@ -136,7 +138,8 @@ class DemoViewHelp_document extends JViewLegacy
JToolBarHelper::custom('help_document.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
if ($this->state->params->get('save_history', 1) && $this->canDo->get('help_document.edit'))
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('help_document.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('help_document.edit') && $canVersion)
{
JToolbarHelper::versions('com_demo.help_document', $this->item->id);
}
@ -155,8 +158,8 @@ class DemoViewHelp_document extends JViewLegacy
JToolbarHelper::help('COM_DEMO_HELP_MANAGER', false, $help_url);
}
}
/**
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
@ -170,7 +173,7 @@ class DemoViewHelp_document extends JViewLegacy
// use the helper htmlEscape method instead and shorten the string
return DemoHelper::htmlEscape($var, $this->_charset, true, 30);
}
// use the helper htmlEscape method instead.
// use the helper htmlEscape method instead.
return DemoHelper::htmlEscape($var, $this->_charset);
}

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage default.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -17,7 +19,7 @@
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
defined('_JEXEC') or die('Restricted access');
// load tooltip behavior
JHtml::_('behavior.tooltip');
@ -82,11 +84,9 @@ if ($this->saveOrder)
$this->loadTemplate('batch_body')
); ?>
<?php endif; ?>
<div>
<input type="hidden" name="filter_order" value="<?php echo $this->sortColumn; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->sortDirection; ?>" />
<input type="hidden" name="boxchecked" value="0" />
</div>
<input type="hidden" name="filter_order" value="" />
<input type="hidden" name="filter_order_Dir" value="" />
<input type="hidden" name="boxchecked" value="0" />
</div>
<?php endif; ?>
<input type="hidden" name="task" value="" />

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage default_batch_body.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -17,7 +19,7 @@
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
defined('_JEXEC') or die('Restricted access');
?>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage default_batch_footer.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -17,7 +19,7 @@
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
defined('_JEXEC') or die('Restricted access');
?>
<!-- clear the batch values if cancel -->

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage default_body.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -17,7 +19,7 @@
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
defined('_JEXEC') or die('Restricted access');
$edit = "index.php?option=com_demo&view=help_documents&task=help_document.edit";

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage default_foot.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -17,7 +19,7 @@
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
defined('_JEXEC') or die('Restricted access');
?>
<tr>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage default_head.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -17,7 +19,7 @@
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
defined('_JEXEC') or die('Restricted access');
?>
<tr>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage default_toolbar.php
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage view.html.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -31,7 +33,7 @@ class DemoViewHelp_documents extends JViewLegacy
* Help_documents view display method
* @return void
*/
function display($tpl = null)
function display($tpl = null)
{
if ($this->getLayout() !== 'modal')
{
@ -41,10 +43,10 @@ class DemoViewHelp_documents extends JViewLegacy
// Check for errors.
if (count($errors = $this->get('Errors')))
{
{
JError::raiseError(500, implode('<br />', $errors));
return false;
};
}
// Assign data to the view
$this->items = $this->get('Items');
@ -54,23 +56,24 @@ class DemoViewHelp_documents extends JViewLegacy
$this->listOrder = $this->escape($this->state->get('list.ordering'));
$this->listDirn = $this->escape($this->state->get('list.direction'));
$this->saveOrder = $this->listOrder == 'ordering';
// get global action permissions
// get global action permissions
$this->canDo = DemoHelper::getActions('help_document');
$this->canEdit = $this->canDo->get('help_document.edit');
$this->canState = $this->canDo->get('help_document.edit.state');
$this->canCreate = $this->canDo->get('help_document.create');
$this->canDelete = $this->canDo->get('help_document.delete');
$this->canDelete = $this->canDo->get('help_document.delete');
$this->canBatch = $this->canDo->get('core.batch');
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
// load the batch html
if ($this->canCreate && $this->canEdit && $this->canState)
{
$this->batchDisplay = JHtmlBatch_::render();
}
// load the batch html
if ($this->canCreate && $this->canEdit && $this->canState)
{
$this->batchDisplay = JHtmlBatch_::render();
}
}
// Display the template
@ -83,102 +86,100 @@ class DemoViewHelp_documents extends JViewLegacy
/**
* Setting the toolbar
*/
protected function addToolBar()
{
JToolBarHelper::title(JText::_('COM_DEMO_HELP_DOCUMENTS'), 'joomla');
protected function addToolBar()
{
JToolBarHelper::title(JText::_('COM_DEMO_HELP_DOCUMENTS'), 'support');
JHtmlSidebar::setAction('index.php?option=com_demo&view=help_documents');
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
if ($this->canCreate)
{
{
JToolBarHelper::addNew('help_document.add');
}
// Only load if there are items
if (DemoHelper::checkArray($this->items))
// Only load if there are items
if (DemoHelper::checkArray($this->items))
{
if ($this->canEdit)
{
JToolBarHelper::editList('help_document.edit');
}
if ($this->canState)
{
JToolBarHelper::divider();
JToolBarHelper::publishList('help_documents.publish');
JToolBarHelper::unpublishList('help_documents.unpublish');
JToolBarHelper::divider();
JToolBarHelper::archiveList('help_documents.archive');
if ($this->canDo->get('core.admin'))
{
JToolBarHelper::checkin('help_documents.checkin');
}
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
JToolbarHelper::deleteList('', 'help_documents.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
JToolbarHelper::trash('help_documents.trash');
}
// Add a batch button
if ($this->canCreate && $this->canEdit && $this->canState)
{
// Get the toolbar object instance
$bar = JToolBar::getInstance('toolbar');
// set the batch button name
$title = JText::_('JTOOLBAR_BATCH');
// Instantiate a new JLayoutFile instance and render the batch button
$layout = new JLayoutFile('joomla.toolbar.batch');
// add the button to the page
$dhtml = $layout->render(array('title' => $title));
$bar->appendButton('Custom', $dhtml, 'batch');
}
if ($this->canEdit)
{
JToolBarHelper::editList('help_document.edit');
}
if ($this->canState)
{
JToolBarHelper::publishList('help_documents.publish');
JToolBarHelper::unpublishList('help_documents.unpublish');
JToolBarHelper::archiveList('help_documents.archive');
if ($this->canDo->get('core.admin'))
{
JToolBarHelper::checkin('help_documents.checkin');
}
}
// Add a batch button
if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState)
{
// Get the toolbar object instance
$bar = JToolBar::getInstance('toolbar');
// set the batch button name
$title = JText::_('JTOOLBAR_BATCH');
// Instantiate a new JLayoutFile instance and render the batch button
$layout = new JLayoutFile('joomla.toolbar.batch');
// add the button to the page
$dhtml = $layout->render(array('title' => $title));
$bar->appendButton('Custom', $dhtml, 'batch');
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
JToolbarHelper::deleteList('', 'help_documents.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
JToolbarHelper::trash('help_documents.trash');
}
if ($this->canDo->get('core.export') && $this->canDo->get('help_document.export'))
{
JToolBarHelper::custom('help_documents.exportData', 'download', '', 'COM_DEMO_EXPORT_DATA', true);
}
}
}
if ($this->canDo->get('core.import') && $this->canDo->get('help_document.import'))
{
JToolBarHelper::custom('help_documents.importData', 'upload', '', 'COM_DEMO_IMPORT_DATA', false);
}
JToolBarHelper::divider();
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
JToolBarHelper::preferences('com_demo');
}
// set help url for this view if found
$help_url = DemoHelper::getHelpUrl('help_documents');
if (DemoHelper::checkString($help_url))
{
JToolbarHelper::help('COM_DEMO_HELP_MANAGER', false, $help_url);
}
if ($this->canState)
{
// set help url for this view if found
$help_url = DemoHelper::getHelpUrl('help_documents');
if (DemoHelper::checkString($help_url))
{
JToolbarHelper::help('COM_DEMO_HELP_MANAGER', false, $help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
JToolBarHelper::preferences('com_demo');
}
if ($this->canState)
{
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_PUBLISHED'),
'filter_published',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true)
);
JHtmlBatch_::addListSelection(
JText::_('COM_DEMO_KEEP_ORIGINAL_STATE'),
'batch[published]',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
);
// only load if batch allowed
if ($this->canBatch)
{
JHtmlBatch_::addListSelection(
JText::_('COM_DEMO_KEEP_ORIGINAL_STATE'),
'batch[published]',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
);
}
}
JHtmlSidebar::addFilter(
@ -186,15 +187,15 @@ class DemoViewHelp_documents extends JViewLegacy
'filter_access',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))
);
if ($this->canCreate && $this->canEdit)
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
JHtmlBatch_::addListSelection(
JText::_('COM_DEMO_KEEP_ORIGINAL_ACCESS'),
'batch[access]',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text')
JText::_('COM_DEMO_KEEP_ORIGINAL_ACCESS'),
'batch[access]',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text')
);
}
}
// Set Type Selection
$this->typeOptions = $this->getTheTypeSelections();
@ -207,9 +208,9 @@ class DemoViewHelp_documents extends JViewLegacy
JHtml::_('select.options', $this->typeOptions, 'value', 'text', $this->state->get('filter.type'))
);
if ($this->canCreate && $this->canEdit)
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Batch Selection
// Type Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_DEMO_HELP_DOCUMENT_TYPE_LABEL').' -',
'batch[type]',
@ -229,9 +230,9 @@ class DemoViewHelp_documents extends JViewLegacy
JHtml::_('select.options', $this->locationOptions, 'value', 'text', $this->state->get('filter.location'))
);
if ($this->canCreate && $this->canEdit)
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Batch Selection
// Location Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_DEMO_HELP_DOCUMENT_LOCATION_LABEL').' -',
'batch[location]',
@ -251,9 +252,9 @@ class DemoViewHelp_documents extends JViewLegacy
JHtml::_('select.options', $this->admin_viewOptions, 'value', 'text', $this->state->get('filter.admin_view'))
);
if ($this->canCreate && $this->canEdit)
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Batch Selection
// Admin View Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_DEMO_HELP_DOCUMENT_ADMIN_VIEW_LABEL').' -',
'batch[admin_view]',
@ -273,9 +274,9 @@ class DemoViewHelp_documents extends JViewLegacy
JHtml::_('select.options', $this->site_viewOptions, 'value', 'text', $this->state->get('filter.site_view'))
);
if ($this->canCreate && $this->canEdit)
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Batch Selection
// Site View Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_DEMO_HELP_DOCUMENT_SITE_VIEW_LABEL').' -',
'batch[site_view]',
@ -290,14 +291,14 @@ class DemoViewHelp_documents extends JViewLegacy
*
* @return void
*/
protected function setDocument()
protected function setDocument()
{
$document = JFactory::getDocument();
$document->setTitle(JText::_('COM_DEMO_HELP_DOCUMENTS'));
$document->addStyleSheet(JURI::root() . "administrator/components/com_demo/assets/css/help_documents.css");
}
/**
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
@ -308,13 +309,13 @@ class DemoViewHelp_documents extends JViewLegacy
{
if(strlen($var) > 50)
{
// use the helper htmlEscape method instead and shorten the string
// use the helper htmlEscape method instead and shorten the string
return DemoHelper::htmlEscape($var, $this->_charset, true);
}
// use the helper htmlEscape method instead.
// use the helper htmlEscape method instead.
return DemoHelper::htmlEscape($var, $this->_charset);
}
/**
* Returns an array of fields the table can be sorted by
*
@ -355,7 +356,7 @@ class DemoViewHelp_documents extends JViewLegacy
if ($results)
{
// get model
$model = &$this->getModel();
$model = $this->getModel();
$results = array_unique($results);
$filter = array();
foreach ($results as $type)
@ -391,7 +392,7 @@ class DemoViewHelp_documents extends JViewLegacy
if ($results)
{
// get model
$model = &$this->getModel();
$model = $this->getModel();
$results = array_unique($results);
$filter = array();
foreach ($results as $location)

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage default.php
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage view.html.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -26,13 +28,13 @@ jimport('joomla.application.component.view');
* Demo Import View
*/
class DemoViewImport extends JViewLegacy
{
{
protected $headerList;
protected $hasPackage = false;
protected $headers;
protected $hasHeader = 0;
protected $dataType;
public function display($tpl = null)
{
if ($this->getLayout() !== 'modal')
@ -40,31 +42,31 @@ class DemoViewImport extends JViewLegacy
// Include helper submenu
DemoHelper::addSubmenu('import');
}
// Check for errors.
if (count($errors = $this->get('Errors'))){
JError::raiseError(500, implode('<br />', $errors));
return false;
};
}
$paths = new stdClass;
$paths->first = '';
$state = $this->get('state');
$this->paths = &$paths;
$this->state = &$state;
// get global action permissions
// get global action permissions
$this->canDo = DemoHelper::getActions('import');
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
}
// get the session object
$session =& JFactory::getSession();
$session = JFactory::getSession();
// check if it has package
$this->hasPackage = $session->get('hasPackage', false);
$this->dataType = $session->get('dataType', false);
@ -75,7 +77,7 @@ class DemoViewImport extends JViewLegacy
// clear the data type
$session->clear('dataType');
}
// Display the template
parent::display($tpl);
}
@ -83,21 +85,21 @@ class DemoViewImport extends JViewLegacy
/**
* Setting the toolbar
*/
protected function addToolBar()
{
protected function addToolBar()
{
JToolBarHelper::title(JText::_('COM_DEMO_IMPORT_TITLE'), 'upload');
JHtmlSidebar::setAction('index.php?option=com_demo&view=import');
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
JToolBarHelper::preferences('com_demo');
}
// set help url for this view if found
$help_url = DemoHelper::getHelpUrl('import');
if (DemoHelper::checkString($help_url))
{
JToolbarHelper::help('COM_DEMO_HELP_MANAGER', false, $help_url);
}
$help_url = DemoHelper::getHelpUrl('import');
if (DemoHelper::checkString($help_url))
{
JToolbarHelper::help('COM_DEMO_HELP_MANAGER', false, $help_url);
}
}
}

View File

@ -1 +0,0 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -2,7 +2,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage submitbutton.js
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage edit.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -99,33 +101,33 @@ $componentParams = JComponentHelper::getParams('com_demo');
<script type="text/javascript">
// #jform_name listeners for name_ABgmXJb function
// #jform_name listeners for name_CxBsGuj function
jQuery('#jform_name').on('keyup',function()
{
var name_ABgmXJb = jQuery("#jform_name").val();
ABgmXJb(name_ABgmXJb);
var name_CxBsGuj = jQuery("#jform_name").val();
CxBsGuj(name_CxBsGuj);
});
jQuery('#adminForm').on('change', '#jform_name',function (e)
{
e.preventDefault();
var name_ABgmXJb = jQuery("#jform_name").val();
ABgmXJb(name_ABgmXJb);
var name_CxBsGuj = jQuery("#jform_name").val();
CxBsGuj(name_CxBsGuj);
});
// #jform_add listeners for add_jiUxEbz function
// #jform_add listeners for add_FKWPxIh function
jQuery('#jform_add').on('keyup',function()
{
var add_jiUxEbz = jQuery("#jform_add input[type='radio']:checked").val();
jiUxEbz(add_jiUxEbz);
var add_FKWPxIh = jQuery("#jform_add input[type='radio']:checked").val();
FKWPxIh(add_FKWPxIh);
});
jQuery('#adminForm').on('change', '#jform_add',function (e)
{
e.preventDefault();
var add_jiUxEbz = jQuery("#jform_add input[type='radio']:checked").val();
jiUxEbz(add_jiUxEbz);
var add_FKWPxIh = jQuery("#jform_add input[type='radio']:checked").val();
FKWPxIh(add_FKWPxIh);
});

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage view.html.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -35,34 +37,34 @@ class DemoViewLook extends JViewLegacy
{
// Check for errors.
if (count($errors = $this->get('Errors')))
{
{
JError::raiseError(500, implode('<br />', $errors));
return false;
};
}
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->script = $this->get('Script');
$this->state = $this->get('State');
// get action permissions
// get action permissions
$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 = '';
$this->refid = $jinput->get('refid', 0, 'int');
$this->referral = '';
if ($this->refid)
{
// return to the item that refered to this item
$this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid;
}
elseif($this->ref)
{
// return to the list view that refered to this item
$this->referral = '&ref='.(string)$this->ref;
}
{
// return to the item that refered to this item
$this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid;
}
elseif($this->ref)
{
// return to the list view that refered to this item
$this->referral = '&ref='.(string)$this->ref;
}
// Set the toolbar
$this->addToolBar();
@ -136,7 +138,8 @@ class DemoViewLook extends JViewLegacy
JToolBarHelper::custom('look.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
if ($this->state->params->get('save_history', 1) && $this->canDo->get(''))
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('look.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('') && $canVersion)
{
JToolbarHelper::versions('com_demo.look', $this->item->id);
}
@ -155,8 +158,8 @@ class DemoViewLook extends JViewLegacy
JToolbarHelper::help('COM_DEMO_HELP_MANAGER', false, $help_url);
}
}
/**
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
@ -170,7 +173,7 @@ class DemoViewLook extends JViewLegacy
// use the helper htmlEscape method instead and shorten the string
return DemoHelper::htmlEscape($var, $this->_charset, true, 30);
}
// use the helper htmlEscape method instead.
// use the helper htmlEscape method instead.
return DemoHelper::htmlEscape($var, $this->_charset);
}

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage default.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -17,7 +19,7 @@
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
defined('_JEXEC') or die('Restricted access');
// load tooltip behavior
JHtml::_('behavior.tooltip');
@ -82,11 +84,9 @@ if ($this->saveOrder)
$this->loadTemplate('batch_body')
); ?>
<?php endif; ?>
<div>
<input type="hidden" name="filter_order" value="<?php echo $this->sortColumn; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $this->sortDirection; ?>" />
<input type="hidden" name="boxchecked" value="0" />
</div>
<input type="hidden" name="filter_order" value="" />
<input type="hidden" name="filter_order_Dir" value="" />
<input type="hidden" name="boxchecked" value="0" />
</div>
<?php endif; ?>
<input type="hidden" name="task" value="" />

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage default_batch_body.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -17,7 +19,7 @@
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
defined('_JEXEC') or die('Restricted access');
?>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage default_batch_footer.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -17,7 +19,7 @@
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
defined('_JEXEC') or die('Restricted access');
?>
<!-- clear the batch values if cancel -->

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage default_body.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -17,7 +19,7 @@
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
defined('_JEXEC') or die('Restricted access');
$edit = "index.php?option=com_demo&view=looks&task=look.edit";

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage default_foot.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -17,7 +19,7 @@
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
defined('_JEXEC') or die('Restricted access');
?>
<tr>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage default_head.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -17,7 +19,7 @@
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
defined('_JEXEC') or die('Restricted access');
?>
<tr>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage default_toolbar.php
@author Llewellyn van der Merwe <https://www.vdm.io/>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage view.html.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -31,7 +33,7 @@ class DemoViewLooks extends JViewLegacy
* Looks view display method
* @return void
*/
function display($tpl = null)
function display($tpl = null)
{
if ($this->getLayout() !== 'modal')
{
@ -41,10 +43,10 @@ class DemoViewLooks extends JViewLegacy
// Check for errors.
if (count($errors = $this->get('Errors')))
{
{
JError::raiseError(500, implode('<br />', $errors));
return false;
};
}
// Assign data to the view
$this->items = $this->get('Items');
@ -54,23 +56,24 @@ class DemoViewLooks extends JViewLegacy
$this->listOrder = $this->escape($this->state->get('list.ordering'));
$this->listDirn = $this->escape($this->state->get('list.direction'));
$this->saveOrder = $this->listOrder == 'ordering';
// get global action permissions
// get global action permissions
$this->canDo = DemoHelper::getActions('look');
$this->canEdit = $this->canDo->get('core.edit');
$this->canState = $this->canDo->get('core.edit.state');
$this->canCreate = $this->canDo->get('core.create');
$this->canDelete = $this->canDo->get('core.delete');
$this->canDelete = $this->canDo->get('core.delete');
$this->canBatch = $this->canDo->get('core.batch');
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
// load the batch html
if ($this->canCreate && $this->canEdit && $this->canState)
{
$this->batchDisplay = JHtmlBatch_::render();
}
// load the batch html
if ($this->canCreate && $this->canEdit && $this->canState)
{
$this->batchDisplay = JHtmlBatch_::render();
}
}
// Display the template
@ -83,102 +86,100 @@ class DemoViewLooks extends JViewLegacy
/**
* Setting the toolbar
*/
protected function addToolBar()
{
JToolBarHelper::title(JText::_('COM_DEMO_LOOKS'), 'joomla');
protected function addToolBar()
{
JToolBarHelper::title(JText::_('COM_DEMO_LOOKS'), 'eye-open');
JHtmlSidebar::setAction('index.php?option=com_demo&view=looks');
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
if ($this->canCreate)
{
{
JToolBarHelper::addNew('look.add');
}
// Only load if there are items
if (DemoHelper::checkArray($this->items))
// Only load if there are items
if (DemoHelper::checkArray($this->items))
{
if ($this->canEdit)
{
JToolBarHelper::editList('look.edit');
}
if ($this->canState)
{
JToolBarHelper::divider();
JToolBarHelper::publishList('looks.publish');
JToolBarHelper::unpublishList('looks.unpublish');
JToolBarHelper::divider();
JToolBarHelper::archiveList('looks.archive');
if ($this->canDo->get('core.admin'))
{
JToolBarHelper::checkin('looks.checkin');
}
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
JToolbarHelper::deleteList('', 'looks.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
JToolbarHelper::trash('looks.trash');
}
// Add a batch button
if ($this->canCreate && $this->canEdit && $this->canState)
{
// Get the toolbar object instance
$bar = JToolBar::getInstance('toolbar');
// set the batch button name
$title = JText::_('JTOOLBAR_BATCH');
// Instantiate a new JLayoutFile instance and render the batch button
$layout = new JLayoutFile('joomla.toolbar.batch');
// add the button to the page
$dhtml = $layout->render(array('title' => $title));
$bar->appendButton('Custom', $dhtml, 'batch');
}
if ($this->canEdit)
{
JToolBarHelper::editList('look.edit');
}
if ($this->canState)
{
JToolBarHelper::publishList('looks.publish');
JToolBarHelper::unpublishList('looks.unpublish');
JToolBarHelper::archiveList('looks.archive');
if ($this->canDo->get('core.admin'))
{
JToolBarHelper::checkin('looks.checkin');
}
}
// Add a batch button
if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState)
{
// Get the toolbar object instance
$bar = JToolBar::getInstance('toolbar');
// set the batch button name
$title = JText::_('JTOOLBAR_BATCH');
// Instantiate a new JLayoutFile instance and render the batch button
$layout = new JLayoutFile('joomla.toolbar.batch');
// add the button to the page
$dhtml = $layout->render(array('title' => $title));
$bar->appendButton('Custom', $dhtml, 'batch');
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
JToolbarHelper::deleteList('', 'looks.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
JToolbarHelper::trash('looks.trash');
}
if ($this->canDo->get('core.export') && $this->canDo->get('look.export'))
{
JToolBarHelper::custom('looks.exportData', 'download', '', 'COM_DEMO_EXPORT_DATA', true);
}
}
}
if ($this->canDo->get('core.import') && $this->canDo->get('look.import'))
{
JToolBarHelper::custom('looks.importData', 'upload', '', 'COM_DEMO_IMPORT_DATA', false);
}
JToolBarHelper::divider();
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
JToolBarHelper::preferences('com_demo');
}
// set help url for this view if found
$help_url = DemoHelper::getHelpUrl('looks');
if (DemoHelper::checkString($help_url))
{
JToolbarHelper::help('COM_DEMO_HELP_MANAGER', false, $help_url);
}
if ($this->canState)
{
// set help url for this view if found
$help_url = DemoHelper::getHelpUrl('looks');
if (DemoHelper::checkString($help_url))
{
JToolbarHelper::help('COM_DEMO_HELP_MANAGER', false, $help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
JToolBarHelper::preferences('com_demo');
}
if ($this->canState)
{
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_PUBLISHED'),
'filter_published',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true)
);
JHtmlBatch_::addListSelection(
JText::_('COM_DEMO_KEEP_ORIGINAL_STATE'),
'batch[published]',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
);
// only load if batch allowed
if ($this->canBatch)
{
JHtmlBatch_::addListSelection(
JText::_('COM_DEMO_KEEP_ORIGINAL_STATE'),
'batch[published]',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
);
}
}
JHtmlSidebar::addFilter(
@ -186,15 +187,15 @@ class DemoViewLooks extends JViewLegacy
'filter_access',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))
);
if ($this->canCreate && $this->canEdit)
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
JHtmlBatch_::addListSelection(
JText::_('COM_DEMO_KEEP_ORIGINAL_ACCESS'),
'batch[access]',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text')
JText::_('COM_DEMO_KEEP_ORIGINAL_ACCESS'),
'batch[access]',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text')
);
}
}
// Set Add Selection
$this->addOptions = $this->getTheAddSelections();
@ -207,9 +208,9 @@ class DemoViewLooks extends JViewLegacy
JHtml::_('select.options', $this->addOptions, 'value', 'text', $this->state->get('filter.add'))
);
if ($this->canCreate && $this->canEdit)
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Batch Selection
// Add Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_DEMO_LOOK_ADD_LABEL').' -',
'batch[add]',
@ -229,9 +230,9 @@ class DemoViewLooks extends JViewLegacy
JHtml::_('select.options', $this->acronymOptions, 'value', 'text', $this->state->get('filter.acronym'))
);
if ($this->canCreate && $this->canEdit)
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Batch Selection
// Acronym Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_DEMO_LOOK_ACRONYM_LABEL').' -',
'batch[acronym]',
@ -246,14 +247,14 @@ class DemoViewLooks extends JViewLegacy
*
* @return void
*/
protected function setDocument()
protected function setDocument()
{
$document = JFactory::getDocument();
$document->setTitle(JText::_('COM_DEMO_LOOKS'));
$document->addStyleSheet(JURI::root() . "administrator/components/com_demo/assets/css/looks.css");
}
/**
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
@ -264,13 +265,13 @@ class DemoViewLooks extends JViewLegacy
{
if(strlen($var) > 50)
{
// use the helper htmlEscape method instead and shorten the string
// use the helper htmlEscape method instead and shorten the string
return DemoHelper::htmlEscape($var, $this->_charset, true);
}
// use the helper htmlEscape method instead.
// use the helper htmlEscape method instead.
return DemoHelper::htmlEscape($var, $this->_charset);
}
/**
* Returns an array of fields the table can be sorted by
*
@ -311,7 +312,7 @@ class DemoViewLooks extends JViewLegacy
if ($results)
{
// get model
$model = &$this->getModel();
$model = $this->getModel();
$results = array_unique($results);
$filter = array();
foreach ($results as $add)

View File

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>COM_DEMO</name>
<creationDate>24th August, 2015</creationDate>
<creationDate>5th August, 2015</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>info@vdm.io</authorEmail>
<authorUrl>https://www.vdm.io/</authorUrl>
<copyright>Copyright (C) 2015. All Rights Reserved</copyright>
<license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license>
<version>1.0.3</version>
<version>1.0.4</version>
<description><![CDATA[
<h1>Demo (v.1.0.3)</h1>
<h1>Demo (v.1.0.4)</h1>
<div style="clear: both;"></div>
<p></p>
<p>Just a basic demo of the most basic implementations of the [Joomla] (http://www.joomla.org) Component Builder's ability.</p>
<p>Created by <a href="https://www.vdm.io/" target="_blank">Llewellyn van der Merwe</a>
]]></description>
@ -31,12 +31,12 @@
<!-- Runs on install/uninstall/update; New in Joomla 2.5 -->
<scriptfile>script.php</scriptfile>
<media destination="com_demo" folder="media">
<filename>index.html</filename>
<folder>js</folder>
<folder>css</folder>
<folder>images</folder>###EXSTRA_MEDIA_FOLDERS###
<folder>images</folder>
</media>
<!-- Update Schema; New in Joomla 2.5 -->
@ -53,6 +53,7 @@
<filename>demo.php</filename>
<folder>assets</folder>
<folder>helpers</folder>
<folder>controllers</folder>
<folder>models</folder>
<folder>views</folder>
<folder>layouts</folder>
@ -62,7 +63,7 @@
<language tag="en-GB">language/en-GB/en-GB.com_demo.ini</language>
<language tag="en-GB">language/en-GB/en-GB.com_demo.sys.ini</language>
</languages>
<administration>
<menu>COM_DEMO_MENU</menu>
<submenu>

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage script.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -244,11 +246,11 @@ class com_demoInstallerScript
}
// little notice as after service, in case of bad experience with component.
echo '<h2>Did something go wrong? Are you disappointed?</h2>
<p>Please let me know at <a href="mailto:info@vdm.io">info@vdm.io</a>.
<br />We at Vast Development Method are committed to building extensions that performs proficiently! You can help us, really!
<br />Send me your thoughts on improvements that is needed, trust me, I will be very grateful!
<br />Visit us at <a href="https://www.vdm.io/" target="_blank">https://www.vdm.io/</a> today!</p>';
echo '<h2>Did something go wrong? Are you disappointed?</h2>
<p>Please let me know at <a href="mailto:info@vdm.io">info@vdm.io</a>.
<br />We at Vast Development Method are committed to building extensions that performs proficiently! You can help us, really!
<br />Send me your thoughts on improvements that is needed, trust me, I will be very grateful!
<br />Visit us at <a href="https://www.vdm.io/" target="_blank">https://www.vdm.io/</a> today!</p>';
}
/**
@ -269,13 +271,14 @@ class com_demoInstallerScript
function preflight($type, $parent)
{
if ($type == 'uninstall')
{
{
return true;
}
$app = JFactory::getApplication();
$jversion = new JVersion();
if (!$jversion->isCompatible('3.4.1')) {
if (!$jversion->isCompatible('3.4.1'))
{
$app->enqueueMessage('Please upgrade to at least Joomla! 3.4.1 before continuing!', 'error');
return false;
}
@ -288,9 +291,9 @@ class com_demoInstallerScript
*/
function postflight($type, $parent)
{
//set the default component settings
// set the default component settings
if ($type == 'install')
{
{
// Get The Database object
@ -336,7 +339,18 @@ class com_demoInstallerScript
$query->update($db->quoteName('#__extensions'))->set($fields)->where($conditions);
$db->setQuery($query);
$allDone = $db->execute();
}
$allDone = $db->execute();
echo '<a target="_blank" href="https://www.vdm.io/" title="Demo">
<img src="components/com_demo/assets/images/component-300.jpg"/>
</a>';
}
// do any updates needed
if ($type == 'update')
{
echo '<a target="_blank" href="https://www.vdm.io/" title="Demo">
<img src="components/com_demo/assets/images/component-300.jpg"/>
</a>
<h3>Upgrade to Version (1.0.4) Was Successful!</h3>';
}
}
}

24
site/assets/css/site.css Normal file
View File

@ -0,0 +1,24 @@
/*----------------------------------------------------------------------------------| www.vdm.io |----/
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage site.css
@author Llewellyn van der Merwe <https://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/
/* CSS Document */
.no-click {
pointer-events: none;
}

0
site/assets/js/site.js Normal file
View File

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage controller.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -27,5 +29,68 @@ jimport('joomla.application.component.controller');
*/
class DemoController extends JControllerLegacy
{
/**
* display task
*
* @return void
*/
function display($cachable = false, $urlparams = false)
{
// set default view if not set
$view = $this->input->getCmd('view', '###SITE_DEFAULT_VIEW###');
$isEdit = $this->checkEditView($view);
$layout = $this->input->get('layout', null, 'WORD');
$id = $this->input->getInt('id');
$cachable = true;
// Check for edit form.
if($isEdit)
{
if ($layout == 'edit' && !$this->checkEditId('com_demo.edit.'.$view, $id))
{
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
$this->setMessage($this->getError(), 'error');
// check if item was opend from other then its own list view
$ref = $this->input->getCmd('ref', 0);
$refid = $this->input->getInt('refid', 0);
// set redirect
if ($refid > 0 && DemoHelper::checkString($ref))
{
// redirect to item of ref
$this->setRedirect(JRoute::_('index.php?option=com_demo&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false));
}
elseif (DemoHelper::checkString($ref))
{
// redirect to ref
$this->setRedirect(JRoute::_('index.php?option=com_demo&view='.(string)$ref, false));
}
else
{
// normal redirect back to the list default site view
$this->setRedirect(JRoute::_('index.php?option=com_demo&view=###SITE_DEFAULT_VIEW###', false));
}
return false;
}
}
return parent::display($cachable, $urlparams);
}
protected function checkEditView($view)
{
if (DemoHelper::checkString($view))
{
$views = array(
);
// check if this is a edit view
if (in_array($view,$views))
{
return true;
}
}
return false;
}
}

125
site/controllers/help.php Normal file
View File

@ -0,0 +1,125 @@
<?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage help.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import Joomla controllerform library
jimport('joomla.application.component.controller');
/**
* Demo Help Controller
*/
class DemoControllerHelp extends JControllerLegacy
{
public function __construct($config)
{
parent::__construct($config);
// load the tasks
$this->registerTask('getText', 'help');
}
public function help()
{
$user = JFactory::getUser();
$jinput = JFactory::getApplication()->input;
// Check Token!
$token = JSession::getFormToken();
$call_token = $jinput->get('token', 0, 'ALNUM');
if($token == $call_token){
$task = $this->getTask();
switch($task){
case 'getText':
try
{
$idValue = $jinput->get('id', 0, 'INT');
if($idValue)
{
$result = $this->getHelpDocumentText($idValue);
}
else
{
$result = '';
}
echo $result;
// stop execution gracefully
jexit();
}
catch(Exception $e)
{
// stop execution gracefully
jexit();
}
break;
}
}
else
{
// stop execution gracefully
jexit();
}
}
protected function getHelpDocumentText($id)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select(array('a.title','a.content'));
$query->from('#__demo_help_document AS a');
$query->where('a.id = '.(int) $id);
$query->where('a.published = 1');
$query->where('a.location = 2');
$db->setQuery($query);
$db->execute();
if($db->getNumRows())
{
$text = array();
$document = $db->loadObject();
// fix image issue
$images['src="images'] = 'src="'.JURI::root().'images';
$images["src='images"] = "src='".JURI::root()."images";
$images['src="/images'] = 'src="'.JURI::root().'images';
$images["src='/images"] = "src='".JURI::root()."images";
// set document template
$text[] = "<!doctype html>";
$text[] = '<html>';
$text[] = "<head>";
$text[] = '<meta charset="utf-8">';
$text[] = "<title>".$document->title."</title>";
$text[] = '<link type="text/css" href="'.JURI::root().'media/com_demo/uikit/css/uikit.gradient.min.css" rel="stylesheet"></link>';
$text[] = '<script type="text/javascript" src="'.JURI::root().'media/com_demo/uikit/js/uikit.min.js"></script>';
$text[] = "</head>";
$text[] = '<body><br />';
$text[] = '<div class="uk-container uk-container-center uk-grid-collapse">';
$text[] = '<div class="uk-panel uk-width-1-1 uk-panel-box uk-panel-box-primary">';
// build the help text
$text[] = '<h3 class="uk-panel-title">'.$document->title."</h3>";
$text[] = str_replace(array_keys($images),array_values($images),$document->content);
// end template
$text[] = '</div>';
$text[] = '</div>';
$text[] = "</body>";
$text[] = "</html>";
return implode("\n",$text);
}
return false;
}
}

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage demo.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -21,10 +23,12 @@ defined('_JEXEC') or die('Restricted access');
// Set the component css/js
$document = JFactory::getDocument();
$document->addStyleSheet('components/com_demo/assets/css/component.css');
$document->addStyleSheet('components/com_demo/assets/css/site.css');
$document->addScript('components/com_demo/assets/js/site.js');
// Require helper file
// Require helper files
JLoader::register('DemoHelper', dirname(__FILE__) . '/helpers/demo.php');
JLoader::register('DemoHelperRoute', dirname(__FILE__) . '/helpers/route.php'); ###SITE_GLOBAL_EVENT###
// import joomla controller library
jimport('joomla.application.component.controller');

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage headercheck.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -35,7 +37,7 @@ class HeaderCheck
}
}
$document =& JFactory::getDocument();
$document = JFactory::getDocument();
$head_data = $document->getHeadData();
foreach (array_keys($head_data['scripts']) as $script)
{
@ -62,7 +64,7 @@ class HeaderCheck
}
}
$document =& JFactory::getDocument();
$document = JFactory::getDocument();
$head_data = $document->getHeadData();
foreach (array_keys($head_data['styleSheets']) as $script)

View File

@ -3,9 +3,11 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage router.php
@subpackage route.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
@ -40,9 +42,9 @@ abstract class DemoHelperRoute
*
* @since 1.5
*/
public static function getCategoryRoute($catid, $language = 0)
public static function getCategoryRoute_keep_for_later($catid, $language = 0)
{
if ($catid instanceof JCategoryNode)
if ($catid instanceof JCategoryNode)
{
$id = $catid->id;
$category = $catid;
@ -73,9 +75,9 @@ abstract class DemoHelperRoute
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('a.sef AS sef')
->select('a.lang_code AS lang_code')
->from('#__languages AS a');
->select('a.sef AS sef')
->select('a.lang_code AS lang_code')
->from('#__languages AS a');
$db->setQuery($query);
$langs = $db->loadObjectList();
@ -113,62 +115,60 @@ abstract class DemoHelperRoute
}
}
}
return $link;
}
protected static function _findItem($needles = null, $identifier = 'id')
protected static function _findItem($needles = null,$type = null)
{
$app = JFactory::getApplication();
$menus = $app->getMenu('site');
$language = isset($needles['language']) ? $needles['language'] : '*';
$app = JFactory::getApplication();
$menus = $app->getMenu('site');
$language = isset($needles['language']) ? $needles['language'] : '*';
// Prepare the reverse lookup array.
if (!isset(self::$lookup[$language]))
{
self::$lookup[$language] = array();
$component = JComponentHelper::getComponent('com_demo');
$component = JComponentHelper::getComponent('com_demo');
$attributes = array('component_id');
$values = array($component->id);
$values = array($component->id);
if ($language != '*')
{
$attributes[] = 'language';
$values[] = array($needles['language'], '*');
$values[] = array($needles['language'], '*');
}
$items = $menus->getItems($attributes, $values);
foreach ($items as $item)
{
if (isset($item->query) && isset($item->query['view']))
{
$view = $item->query['view'];
if (!isset(self::$lookup[$language][$view]))
{
self::$lookup[$language][$view] = array();
}
if (isset($item->query[$identifier]))
{
// here it will become a bit tricky
// language != * can override existing entries
// language == * cannot override existing entries
if (!isset(self::$lookup[$language][$view][$item->query[$identifier]]) || $item->language != '*')
if (isset($item->query['id']))
{
/**
* Here it will become a bit tricky
* language != * can override existing entries
* language == * cannot override existing entries
*/
if (!isset(self::$lookup[$language][$view][$item->query['id']]) || $item->language != '*')
{
if($item->query[$identifier] != 'all') {
self::$lookup[$language][$view][$item->query[$identifier]] = $item->id;
}
self::$lookup[$language][$view][$item->query['id']] = $item->id;
}
}
}
}
}
if ($needles)
{
foreach ($needles as $view => $ids)
@ -179,23 +179,36 @@ abstract class DemoHelperRoute
{
if (isset(self::$lookup[$language][$view][(int) $id]))
{
if ($id != 'all') {
return self::$lookup[$language][$view][(int) $id];
}
return self::$lookup[$language][$view][(int) $id];
}
}
}
}
}
if ($type)
{
// Check if the global menu item has been set.
$params = JComponentHelper::getParams('com_demo');
if ($item = $params->get($type.'_menu', 0))
{
return $item;
}
}
// Check if the active menuitem matches the requested language
$active = $menus->getActive();
if ($active && ($active->language == '*' || !JLanguageMultilang::isEnabled()))
if ($active
&& $active->component == 'com_demo'
&& ($language == '*' || in_array($active->language, array('*', $language)) || !JLanguageMultilang::isEnabled()))
{
return $active->id;
}
// if not found, return language specific home link
// If not found, return language specific home link
$default = $menus->getDefault($language);
return !empty($default->id) ? $default->id : null;
}
}

View File

@ -1 +1,14 @@
###LANG_SITE###
COM_CONTENT_FIELD_MODIFIED_DESC="The last date this item was modified."
COM_DEMO="Demo"
JGLOBAL_FIELD_ID_DESC="Record number in the database."
JGLOBAL_FIELD_ID_LABEL="ID"
JGLOBAL_FIELD_MODIFIED_BY_DESC="The user who did the last modification."
JGLOBAL_FIELD_MODIFIED_BY_LABEL="Modified By"
JGLOBAL_FIELD_MODIFIED_LABEL="Modified Date"
JTOOLBAR_APPLY="Save"
JTOOLBAR_CANCEL="Cancel"
JTOOLBAR_CLOSE="Close"
JTOOLBAR_HELP="Help"
JTOOLBAR_SAVE="Save & Close"
JTOOLBAR_SAVE_AND_NEW="Save & New"
JTOOLBAR_SAVE_AS_COPY="Save as Copy"

View File

@ -1 +1 @@
###LANG_SITE_SYS###
COM_DEMO="Demo"

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage router.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -19,35 +21,174 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Routing class from com_demo
*
* @since 3.3
*/
class DemoRouter extends JComponentRouterBase
{
/**
* Build the route for the com_demo component
*
* @param array &$query An array of URL arguments
*
* @return array The URL arguments to use to assemble the subsequent URL.
*
* @since 3.3
*/
public function build(&$query)
{
$segments = array();
// Get a menu item based on Itemid or currently active
$params = JComponentHelper::getParams('com_demo');
if (empty($query['Itemid']))
{
$menuItem = $this->menu->getActive();
}
else
{
$menuItem = $this->menu->getItem($query['Itemid']);
}
$mView = (empty($menuItem->query['view'])) ? null : $menuItem->query['view'];
$mId = (empty($menuItem->query['id'])) ? null : $menuItem->query['id'];
if (isset($query['view']))
{
$view = $query['view'];
if (empty($query['Itemid']))
{
$segments[] = $query['view'];
}
unset($query['view']);
}
// Are we dealing with a item that is attached to a menu item?
if (isset($view) && ($mView == $view) and (isset($query['id'])) and ($mId == (int) $query['id']))
{
unset($query['view']);
unset($query['catid']);
unset($query['id']);
return $segments;
}
if (isset($view) && isset($query['id']) && 0)
{
if ($mId != (int) $query['id'] || $mView != $view)
{
if (0)
{
$segments[] = $view;
$id = explode(':', $query['id']);
if (count($id) == 2)
{
$segments[] = $id[1];
}
else
{
$segments[] = $id[0];
}
}
}
unset($query['id']);
}
$total = count($segments);
for ($i = 0; $i < $total; $i++)
{
$segments[$i] = str_replace(':', '-', $segments[$i]);
}
return $segments;
}
/**
* Parse the segments of a URL.
*
* @param array &$segments The segments of the URL to parse.
*
* @return array The URL attributes to be used by the application.
*
* @since 3.3
*/
public function parse(&$segments)
{
//var_dump($segments);
//$app = JFactory::getApplication();
//$menu = $app->getMenu();
//$item = $menu->getActive();
$count = count($segments);
$vars = array();
//var_dump($item->query['view']);
//Handle View and Identifier
switch($segments[0])
{
}
return $vars;
}
protected function getVar($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = 'demo')
{
if(!$where)
{
$where = JFactory::getUser()->id;
}
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName(array($what)));
if ('categories' == $table || 'category' == $table)
{
$query->from($db->quoteName('#__categories'));
}
else
{
$query->from($db->quoteName('#__'.$main.'_'.$table));
}
if (is_numeric($where))
{
$query->where($db->quoteName($whereString) . ' '.$operator.' '.(int) $where);
}
elseif (is_string($where))
{
$query->where($db->quoteName($whereString) . ' '.$operator.' '. $db->quote((string)$where));
}
else
{
return false;
}
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
return $db->loadResult();
}
return false;
}
}
function DemoBuildRoute(&$query)
{
$segments = array();
if(isset($query['view']))
{
$segments[] = $query['view'];
unset($query['view']);
};
if(isset($query['id']))
{
$segments[] = $query['id'];
unset($query['id']);
};
return $segments;
$router = new DemoRouter;
return $router->build($query);
}
function DemoParseRoute($segments)
{
$vars = array();
// Count segments
$count = count($segments);
//Handle View and Identifier
switch($segments[0])
{
}
$router = new ContentRouter;
return $vars;
}
return $router->parse($segments);
}