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_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="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.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.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.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" 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" /> <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.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.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.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.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.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.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>
<section name="look"> <section name="look">
<action name="look.version" title="COM_DEMO_LOOKS_EDIT_VERSION" description="COM_DEMO_LOOKS_EDIT_VERSION_DESC" /> <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 Vast Development Method
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015 @version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo @package Demo
@subpackage admin.css @subpackage admin.css
@author Llewellyn van der Merwe <https://www.vdm.io/> @author Llewellyn van der Merwe <https://www.vdm.io/>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,9 @@
Vast Development Method Vast Development Method
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015 @version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo @package Demo
@subpackage controller.php @subpackage controller.php
@author Llewellyn van der Merwe <https://www.vdm.io/> @author Llewellyn van der Merwe <https://www.vdm.io/>
@ -32,7 +34,7 @@ class DemoController extends JControllerLegacy
* *
* @return void * @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'); $view = $this->input->getCmd('view', 'Demo');
@ -41,60 +43,60 @@ class DemoController extends JControllerLegacy
$id = $this->input->getInt('id'); $id = $this->input->getInt('id');
// Check for edit form. // Check for edit form.
if(DemoHelper::checkArray($data)) 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))
{
// 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))
{ {
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 // redirect to ref
$this->setRedirect(JRoute::_('index.php?option=com_demo&view='.(string)$ref, false)); $this->setRedirect(JRoute::_('index.php?option=com_demo&view='.(string)$ref, false));
} }
else else
{ {
// normal redirect back to the list view // normal redirect back to the list view
$this->setRedirect(JRoute::_('index.php?option=com_demo&view='.$data['views'], false)); $this->setRedirect(JRoute::_('index.php?option=com_demo&view='.$data['views'], false));
} }
return false; return false;
} }
} }
return parent::display($cachable, $urlparams); return parent::display($cachable, $urlparams);
} }
protected function getViewRelation($view) protected function getViewRelation($view)
{ {
if (DemoHelper::checkString($view)) if (DemoHelper::checkString($view))
{ {
$views = array( $views = array(
'look' => 'looks', 'look' => 'looks',
'help_document' => 'help_documents' 'help_document' => 'help_documents'
); );
// check if this is a list view // check if this is a list view
if (in_array($view,$views)) if (in_array($view,$views))
{ {
return array('edit' => false, 'view' => array_search($view,$views), 'views' => $view); return array('edit' => false, 'view' => array_search($view,$views), 'views' => $view);
} }
// check if it is an edit view // check if it is an edit view
elseif (array_key_exists($view,$views)) elseif (array_key_exists($view,$views))
{ {
return array('edit' => true, 'view' => $view, 'views' => $views[$view]); return array('edit' => true, 'view' => $view, 'views' => $views[$view]);
} }
} }
return false; return false;
} }
} }

View File

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

View File

@ -3,7 +3,9 @@
Vast Development Method Vast Development Method
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015 @version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo @package Demo
@subpackage help.php @subpackage help.php
@author Llewellyn van der Merwe <https://www.vdm.io/> @author Llewellyn van der Merwe <https://www.vdm.io/>
@ -57,30 +59,31 @@ class DemoControllerHelp extends JControllerLegacy
$result = ''; $result = '';
} }
echo $result; echo $result;
// stop execution gracefully // stop execution gracefully
jexit(); jexit();
} }
catch(Exception $e) catch(Exception $e)
{ {
// stop execution gracefully // stop execution gracefully
jexit(); jexit();
} }
break; break;
} }
} else { }
// stop execution gracefully else
{
// stop execution gracefully
jexit(); jexit();
} }
} }
protected function getHelpDocumentText($id) protected function getHelpDocumentText($id)
{ {
$db = JFactory::getDbo(); $db = JFactory::getDbo();
$query = $db->getQuery(true); $query = $db->getQuery(true);
$query->select(array('a.title','a.content')); $query->select(array('a.title','a.content'));
$query->from('#__demo_help_document AS a'); $query->from('#__demo_help_document AS a');
$query->where('a.id = '.(int) $id); $query->where('a.id = '.(int) $id);
$query->where('a.location = 1');
$query->where('a.published = 1'); $query->where('a.published = 1');
$db->setQuery($query); $db->setQuery($query);
$db->execute(); $db->execute();

View File

@ -3,7 +3,9 @@
Vast Development Method Vast Development Method
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015 @version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo @package Demo
@subpackage help_document.php @subpackage help_document.php
@author Llewellyn van der Merwe <https://www.vdm.io/> @author Llewellyn van der Merwe <https://www.vdm.io/>
@ -42,7 +44,7 @@ class DemoControllerHelp_document extends JControllerForm
parent::__construct($config); parent::__construct($config);
} }
/** /**
* Method override to check if you can add a new record. * Method override to check if you can add a new record.
* *
* @param array $data An array of input data. * @param array $data An array of input data.
@ -53,10 +55,9 @@ class DemoControllerHelp_document extends JControllerForm
*/ */
protected function allowAdd($data = array()) protected function allowAdd($data = array())
{ {
// Access check. // Access check.
$accessAdmin = JFactory::getUser()->authorise('help_document.access', 'com_demo'); $access = JFactory::getUser()->authorise('help_document.access', 'com_demo');
if (!$accessAdmin && !is_null($accessAdmin)) if (!$access)
{ {
return false; return false;
} }
@ -81,10 +82,10 @@ class DemoControllerHelp_document extends JControllerForm
// get record id. // get record id.
$recordId = (int) isset($data[$key]) ? $data[$key] : 0; $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
// Access check. // Access check.
$access = $user->authorise('help_document.access', 'com_demo.help_document.' . (int) $recordId); $access = ($user->authorise('help_document.access', 'com_demo.help_document.' . (int) $recordId) && $user->authorise('help_document.access', 'com_demo'));
$accessAdmin = $user->authorise('help_document.access', 'com_demo'); if (!$access)
if ((!$access && !is_null($access)) || (!$accessAdmin && !is_null($accessAdmin)))
{ {
return false; return false;
} }
@ -150,13 +151,13 @@ class DemoControllerHelp_document extends JControllerForm
$append = ''; $append = '';
if ($refid) if ($refid)
{ {
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid; $append .= '&ref='.(string)$ref.'&refid='.(int)$refid;
} }
elseif ($ref) elseif ($ref)
{ {
$append .= '&ref='.(string)$ref; $append .= '&ref='.(string)$ref;
} }
if ($tmpl) if ($tmpl)
{ {
@ -268,11 +269,11 @@ class DemoControllerHelp_document extends JControllerForm
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid) if ($this->ref || $this->refid)
{ {
// to make sure the item is checkedin on redirect // to make sure the item is checkedin on redirect
$this->task = 'save'; $this->task = 'save';
} }
$saved = parent::save($key, $urlVar); $saved = parent::save($key, $urlVar);

View File

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

View File

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

View File

@ -3,7 +3,9 @@
Vast Development Method Vast Development Method
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015 @version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo @package Demo
@subpackage look.php @subpackage look.php
@author Llewellyn van der Merwe <https://www.vdm.io/> @author Llewellyn van der Merwe <https://www.vdm.io/>
@ -42,7 +44,7 @@ class DemoControllerLook extends JControllerForm
parent::__construct($config); parent::__construct($config);
} }
/** /**
* Method override to check if you can add a new record. * Method override to check if you can add a new record.
* *
* @param array $data An array of input data. * @param array $data An array of input data.
@ -52,8 +54,7 @@ class DemoControllerLook extends JControllerForm
* @since 1.6 * @since 1.6
*/ */
protected function allowAdd($data = array()) 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); return parent::allowAdd($data);
} }
@ -74,6 +75,7 @@ class DemoControllerLook extends JControllerForm
// get record id. // get record id.
$recordId = (int) isset($data[$key]) ? $data[$key] : 0; $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
if ($recordId) if ($recordId)
{ {
// The record has been set. Check the record permissions. // The record has been set. Check the record permissions.
@ -135,13 +137,13 @@ class DemoControllerLook extends JControllerForm
$append = ''; $append = '';
if ($refid) if ($refid)
{ {
$append .= '&ref='.(string)$ref.'&refid='.(int)$refid; $append .= '&ref='.(string)$ref.'&refid='.(int)$refid;
} }
elseif ($ref) elseif ($ref)
{ {
$append .= '&ref='.(string)$ref; $append .= '&ref='.(string)$ref;
} }
if ($tmpl) if ($tmpl)
{ {
@ -253,11 +255,11 @@ class DemoControllerLook extends JControllerForm
$this->ref = $this->input->get('ref', 0, 'word'); $this->ref = $this->input->get('ref', 0, 'word');
$this->refid = $this->input->get('refid', 0, 'int'); $this->refid = $this->input->get('refid', 0, 'int');
if ($this->ref || $this->refid) if ($this->ref || $this->refid)
{ {
// to make sure the item is checkedin on redirect // to make sure the item is checkedin on redirect
$this->task = 'save'; $this->task = 'save';
} }
$saved = parent::save($key, $urlVar); $saved = parent::save($key, $urlVar);

View File

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

View File

@ -3,7 +3,9 @@
Vast Development Method Vast Development Method
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015 @version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo @package Demo
@subpackage demo.php @subpackage demo.php
@author Llewellyn van der Merwe <https://www.vdm.io/> @author Llewellyn van der Merwe <https://www.vdm.io/>
@ -30,6 +32,11 @@ JLoader::registerPrefix('J', JPATH_PLATFORM . '/cms');
// Load joomla libraries without overwrite // Load joomla libraries without overwrite
JLoader::registerPrefix('J', JPATH_PLATFORM . '/joomla',false); JLoader::registerPrefix('J', JPATH_PLATFORM . '/joomla',false);
// Add CSS file for all pages
$document = JFactory::getDocument();
$document->addStyleSheet('components/com_demo/assets/css/admin.css');
$document->addScript('components/com_demo/assets/js/admin.js');
// require helper files // require helper files
JLoader::register('DemoHelper', dirname(__FILE__) . '/helpers/demo.php'); JLoader::register('DemoHelper', dirname(__FILE__) . '/helpers/demo.php');
JLoader::register('JHtmlBatch_', dirname(__FILE__) . '/helpers/html/batch_.php'); JLoader::register('JHtmlBatch_', dirname(__FILE__) . '/helpers/html/batch_.php');
@ -37,11 +44,6 @@ JLoader::register('JHtmlBatch_', dirname(__FILE__) . '/helpers/html/batch_.php')
// import joomla controller library // import joomla controller library
jimport('joomla.application.component.controller'); 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');
// Get an instance of the controller prefixed by Demo // Get an instance of the controller prefixed by Demo
$controller = JControllerLegacy::getInstance('Demo'); $controller = JControllerLegacy::getInstance('Demo');

View File

@ -3,7 +3,9 @@
Vast Development Method Vast Development Method
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015 @version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo @package Demo
@subpackage demo.php @subpackage demo.php
@author Llewellyn van der Merwe <https://www.vdm.io/> @author Llewellyn van der Merwe <https://www.vdm.io/>
@ -27,10 +29,48 @@ abstract class DemoHelper
/** /**
* Load the Component xml manifest. * Load the Component xml manifest.
**/ **/
public static function manifest() public static function manifest()
{ {
$manifestUrl = JPATH_ADMINISTRATOR."/components/com_demo/demo.xml"; $manifestUrl = JPATH_ADMINISTRATOR."/components/com_demo/demo.xml";
return simplexml_load_file($manifestUrl); return simplexml_load_file($manifestUrl);
}
/**
* Load the Contributors details.
**/
public static function getContributors()
{
// get params
$params = JComponentHelper::getParams('com_demo');
// start contributors array
$contributors = array();
// get all Contributors (max 20)
$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'] = self::htmlEscape($params->get("titleContributor".$nr));
$contributors[$nr]['name'] = $link_front.self::htmlEscape($params->get("nameContributor".$nr)).$link_back;
}
}
return $contributors;
} }
/** /**
@ -39,8 +79,8 @@ abstract class DemoHelper
public static function getHelpUrl($view) public static function getHelpUrl($view)
{ {
$user = JFactory::getUser(); $user = JFactory::getUser();
$groups = $user->getAuthorisedGroups(); $groups = $user->get('groups');
$db = JFactory::getDbo(); $db = JFactory::getDbo();
$query = $db->getQuery(true); $query = $db->getQuery(true);
$query->select(array('a.id','a.groups','a.target','a.type','a.article','a.url')); $query->select(array('a.id','a.groups','a.target','a.type','a.article','a.url'));
$query->from('#__demo_help_document AS a'); $query->from('#__demo_help_document AS a');
@ -110,12 +150,12 @@ abstract class DemoHelper
**/ **/
public static function addSubmenu($submenu) public static function addSubmenu($submenu)
{ {
// load user for access menus // load user for access menus
$user = JFactory::getUser(); $user = JFactory::getUser();
// load the submenus to sidebar // load the submenus to sidebar
JHtmlSidebar::addEntry(JText::_('COM_DEMO_SUBMENU_DASHBOARD'), 'index.php?option=com_demo&view=demo', $submenu == 'demo'); JHtmlSidebar::addEntry(JText::_('COM_DEMO_SUBMENU_DASHBOARD'), 'index.php?option=com_demo&view=demo', $submenu == 'demo');
JHtmlSidebar::addEntry(JText::_('COM_DEMO_SUBMENU_LOOKS'), 'index.php?option=com_demo&view=looks', $submenu == 'looks'); JHtmlSidebar::addEntry(JText::_('COM_DEMO_SUBMENU_LOOKS'), 'index.php?option=com_demo&view=looks', $submenu == 'looks');
if ($user->authorise('help_document.access', 'com_demo')) if ($user->authorise('help_document.access', 'com_demo') && $user->authorise('help_document.submenu', 'com_demo'))
{ {
JHtmlSidebar::addEntry(JText::_('COM_DEMO_SUBMENU_HELP_DOCUMENTS'), 'index.php?option=com_demo&view=help_documents', $submenu == 'help_documents'); JHtmlSidebar::addEntry(JText::_('COM_DEMO_SUBMENU_HELP_DOCUMENTS'), 'index.php?option=com_demo&view=help_documents', $submenu == 'help_documents');
} }
@ -256,7 +296,7 @@ abstract class DemoHelper
// make sure the file is loaded // make sure the file is loaded
JLoader::import('PHPExcel', JPATH_COMPONENT_ADMINISTRATOR . '/helpers'); JLoader::import('PHPExcel', JPATH_COMPONENT_ADMINISTRATOR . '/helpers');
// get session object // get session object
$session =& JFactory::getSession(); $session = JFactory::getSession();
$package = $session->get('package', null); $package = $session->get('package', null);
$package = json_decode($package, true); $package = json_decode($package, true);
// set the headers // set the headers
@ -290,12 +330,82 @@ $headers = array();
return false; return false;
} }
public static 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)));
$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;
}
public static function getVars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = 'demo', $unique = true)
{
if(!$where)
{
$where = JFactory::getUser()->id;
}
if (!self::checkArray($where) && $where > 0)
{
$where = array($where);
}
if (self::checkArray($where))
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName(array($what)));
$query->from($db->quoteName('#__'.$main.'_'.$table));
$query->where($db->quoteName($whereString) . ' '.$operator.' (' . implode(',',$where) . ')');
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
if ($unique)
{
return array_unique($db->loadColumn());
}
return $db->loadColumn();
}
}
return false;
}
public static function jsonToString($value, $sperator = ", ") public static function jsonToString($value, $sperator = ", ")
{ {
// check if string is JSON // check if string is JSON
$result = json_decode($value, true); $result = json_decode($value, true);
if (json_last_error() === JSON_ERROR_NONE) { if (json_last_error() === JSON_ERROR_NONE) {
// is JSON // is JSON
if (self::checkArray($result)) if (self::checkArray($result))
{ {
$value = ''; $value = '';
@ -314,15 +424,15 @@ $headers = array();
} }
return $value; return $value;
} }
return json_decode($value); return json_decode($value);
}
return $value;
} }
return $value;
}
public static function isPublished($id,$type) public static function isPublished($id,$type)
{ {
if ($type == 'raw') if ($type == 'raw')
{ {
$type = 'item'; $type = 'item';
} }
$db = JFactory::getDbo(); $db = JFactory::getDbo();
@ -335,7 +445,7 @@ $headers = array();
$db->execute(); $db->execute();
$found = $db->getNumRows(); $found = $db->getNumRows();
if($found) if($found)
{ {
return true; return true;
} }
return false; return false;
@ -352,33 +462,33 @@ $headers = array();
$db->execute(); $db->execute();
$found = $db->getNumRows(); $found = $db->getNumRows();
if($found) if($found)
{ {
return $db->loadResult(); return $db->loadResult();
} }
return $id; return $id;
} }
/** /**
* Get the actions permissions * Get the actions permissions
**/ **/
public static function getActions($view,&$record = null,$views = null) public static function getActions($view,&$record = null,$views = null)
{ {
jimport('joomla.access.access'); jimport('joomla.access.access');
$user = JFactory::getUser(); $user = JFactory::getUser();
$result = new JObject; $result = new JObject;
$view = self::safeString($view); $view = self::safeString($view);
if (self::checkString($views)) if (self::checkString($views))
{ {
$views = self::safeString($views); $views = self::safeString($views);
} }
// get all actions from component // get all actions from component
$actions = JAccess::getActions('com_demo', 'component'); $actions = JAccess::getActions('com_demo', 'component');
// set acctions only set in component settiongs // set acctions only set in component settiongs
$componentActions = array('core.admin','core.manage','core.options','core.export'); $componentActions = array('core.admin','core.manage','core.options','core.export');
// loop the actions and set the permissions // loop the actions and set the permissions
foreach ($actions as $action) foreach ($actions as $action)
{ {
// set to use component default // set to use component default
$allow = true; $allow = true;
if (self::checkObject($record) && isset($record->id) && $record->id > 0 && !in_array($action->name,$componentActions)) if (self::checkObject($record) && isset($record->id) && $record->id > 0 && !in_array($action->name,$componentActions))
@ -457,17 +567,17 @@ $headers = array();
} }
elseif (self::checkString($views) && isset($record->catid) && $record->catid > 0) elseif (self::checkString($views) && isset($record->catid) && $record->catid > 0)
{ {
// make sure we use the core. action check for the categories // make sure we use the core. action check for the categories
if (strpos($action->name,$view) !== false && strpos($action->name,'core.') === false ) { if (strpos($action->name,$view) !== false && strpos($action->name,'core.') === false ) {
$coreCheck = explode('.',$action->name); $coreCheck = explode('.',$action->name);
$coreCheck[0] = 'core'; $coreCheck[0] = 'core';
$categoryCheck = implode('.',$coreCheck); $categoryCheck = implode('.',$coreCheck);
} }
else else
{ {
$categoryCheck = $action->name; $categoryCheck = $action->name;
} }
// The record has a category. Check the category permissions. // The record has a category. Check the category permissions.
$catpermission = $user->authorise($categoryCheck, 'com_demo.'.$views.'.category.' . (int) $record->catid); $catpermission = $user->authorise($categoryCheck, 'com_demo.'.$views.'.category.' . (int) $record->catid);
if (!$catpermission && !is_null($catpermission)) if (!$catpermission && !is_null($catpermission))
{ {
@ -563,6 +673,120 @@ $headers = array();
return JModelLegacy::getInstance( $name, $component.'Model' ); return JModelLegacy::getInstance( $name, $component.'Model' );
} }
/**
* Add to asset Table
*/
public static function setAsset($id,$table)
{
$parent = JTable::getInstance('Asset');
$parent->loadByName('com_demo');
$parentId = $parent->id;
$name = 'com_demo.'.$table.'.'.$id;
$title = '';
$asset = JTable::getInstance('Asset');
$asset->loadByName($name);
// Check for an error.
$error = $asset->getError();
if ($error)
{
return false;
}
else
{
// Specify how a new or moved node asset is inserted into the tree.
if ($asset->parent_id != $parentId)
{
$asset->setLocation($parentId, 'last-child');
}
// Prepare the asset to be stored.
$asset->parent_id = $parentId;
$asset->name = $name;
$asset->title = $title;
// get the default asset rules
$rules = self::getDefaultAssetRules('com_demo',$table);
if ($rules instanceof JAccessRules)
{
$asset->rules = (string) $rules;
}
if (!$asset->check() || !$asset->store())
{
JError::raiseWarning(500, $asset->getError());
return false;
}
else
{
// Create an asset_id or heal one that is corrupted.
$object = new stdClass();
// Must be a valid primary key value.
$object->id = $id;
$object->asset_id = (int) $asset->id;
// Update their asset_id to link to the asset table.
return JFactory::getDbo()->updateObject('#__demo_'.$table, $object, 'id');
}
}
return false;
}
/**
* Gets the default asset Rules for a component/view.
*/
protected static function getDefaultAssetRules($component,$view)
{
// Need to find the asset id by the name of the component.
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('id'))
->from($db->quoteName('#__assets'))
->where($db->quoteName('name') . ' = ' . $db->quote($component));
$db->setQuery($query);
$db->execute();
if ($db->loadRowList())
{
// asset alread set so use saved rules
$assetId = (int) $db->loadResult();
$result = JAccess::getAssetRules($assetId);
if ($result instanceof JAccessRules)
{
$_result = (string) $result;
$_result = json_decode($_result);
foreach ($_result as $name => &$rule)
{
$v = explode('.', $name);
if ($view !== $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($_result);
return $rules;
}
return $result;
}
}
return JAccess::getAssetRules(0);
}
public static function renderBoolButton() public static function renderBoolButton()
{ {
$args = func_get_args(); $args = func_get_args();
@ -614,6 +838,23 @@ $headers = array();
return false; return false;
} }
public static function mergeArrays($arrays)
{
if(self::checkArray($arrays))
{
$arrayBuket = array();
foreach ($arrays as $array)
{
if (self::checkArray($array))
{
$arrayBuket = array_merge($arrayBuket, $array);
}
}
return $arrayBuket;
}
return false;
}
public static function sorten($string, $length = 40, $addTip = true) public static function sorten($string, $length = 40, $addTip = true)
{ {
if (self::checkString($string)) if (self::checkString($string))
@ -651,62 +892,62 @@ $headers = array();
public static function safeString($string, $type = 'L', $spacer = '_') public static function safeString($string, $type = 'L', $spacer = '_')
{ {
// remove all numbers and replace with english text version (works well only up to a thousand) // remove all numbers and replace with english text version (works well only up to a thousand)
$string = self::replaceNumbers($string); $string = self::replaceNumbers($string);
if (self::checkString($string)) if (self::checkString($string))
{ {
// remove all other characters // remove all other characters
$string = trim($string); $string = trim($string);
$string = preg_replace('/'.$spacer.'+/', ' ', $string); $string = preg_replace('/'.$spacer.'+/', ' ', $string);
$string = preg_replace('/\s+/', ' ', $string); $string = preg_replace('/\s+/', ' ', $string);
$string = preg_replace("/[^A-Za-z ]/", '', $string); $string = preg_replace("/[^A-Za-z ]/", '', $string);
// return a string with all first letter of each word uppercase(no undersocre) // return a string with all first letter of each word uppercase(no undersocre)
if ($type == 'W') if ($type == 'W')
{ {
return ucwords(strtolower($string)); return ucwords(strtolower($string));
} }
elseif ($type == 'w') elseif ($type == 'w')
{ {
return strtolower($string); return strtolower($string);
} }
elseif ($type == 'Ww') elseif ($type == 'Ww')
{ {
return ucfirst(strtolower($string)); return ucfirst(strtolower($string));
} }
elseif ($type == 'WW') elseif ($type == 'WW')
{ {
return strtoupper($string); return strtoupper($string);
} }
elseif ($type == 'U') elseif ($type == 'U')
{ {
// replace white space with underscore // replace white space with underscore
$string = preg_replace('/\s+/', $spacer, $string); $string = preg_replace('/\s+/', $spacer, $string);
// return all upper // return all upper
return strtoupper($string); return strtoupper($string);
} }
elseif ($type == 'F') elseif ($type == 'F')
{ {
// replace white space with underscore // replace white space with underscore
$string = preg_replace('/\s+/', $spacer, $string); $string = preg_replace('/\s+/', $spacer, $string);
// return with first caracter to upper // return with first caracter to upper
return ucfirst(strtolower($string)); return ucfirst(strtolower($string));
} }
elseif ($type == 'L') elseif ($type == 'L')
{ {
// replace white space with underscore // replace white space with underscore
$string = preg_replace('/\s+/', $spacer, $string); $string = preg_replace('/\s+/', $spacer, $string);
// default is to return lower // default is to return lower
return strtolower($string); return strtolower($string);
} }
// return string // return string
return $string; return $string;
} }
// not a string // not a string
return ''; return '';
} }
public static function htmlEscape($var, $charset = 'UTF-8', $sorten = false, $length = 40) public static function htmlEscape($var, $charset = 'UTF-8', $sorten = false, $length = 40)
{ {
if (self::checkString($var)) if (self::checkString($var))
{ {
@ -714,266 +955,129 @@ $headers = array();
$string = $filter->clean(html_entity_decode(htmlentities($var, ENT_COMPAT, $charset)), 'HTML'); $string = $filter->clean(html_entity_decode(htmlentities($var, ENT_COMPAT, $charset)), 'HTML');
if ($sorten) if ($sorten)
{ {
return self::sorten($string,$length); return self::sorten($string,$length);
} }
return $string; return $string;
} }
else else
{ {
return ''; return '';
} }
} }
public static function replaceNumbers($string) public static function replaceNumbers($string)
{ {
// remove all numbers and replace with english text version (works well only up to a thousand) // set numbers array
if (strcspn($string, '0123456789') != strlen($string)) $numbers = array();
{ // first get all numbers
$replace = array( preg_match_all('!\d+!', $string, $numbers);
'one thousand', 'nine hundred ninety nine','nine hundred ninety eight','nine hundred ninety seven','nine hundred ninety six','nine hundred ninety five', // check if we have any numbers
'nine hundred ninety four','nine hundred ninety three','nine hundred ninety two','nine hundred ninety one','nine hundred ninety', if (isset($numbers[0]) && self::checkArray($numbers[0]))
'nine hundred eighty nine','nine hundred eighty eight','nine hundred eighty seven','nine hundred eighty six','nine hundred eighty five', {
'nine hundred eighty four','nine hundred eighty three','nine hundred eighty two','nine hundred eighty one','nine hundred eighty', foreach ($numbers[0] as $number)
'nine hundred seventy nine','nine hundred seventy eight','nine hundred seventy seven','nine hundred seventy six','nine hundred seventy five', {
'nine hundred seventy four','nine hundred seventy three','nine hundred seventy two','nine hundred seventy one','nine hundred seventy', $searchReplace[$number] = self::numberToString((int)$number);
'nine hundred sixty nine','nine hundred sixty eight','nine hundred sixty seven','nine hundred sixty six','nine hundred sixty five', }
'nine hundred sixty four','nine hundred sixty three','nine hundred sixty two','nine hundred sixty one','nine hundred sixty', // now replace numbers in string
'nine hundred fifty nine','nine hundred fifty eight','nine hundred fifty seven','nine hundred fifty six','nine hundred fifty five', $string = str_replace(array_keys($searchReplace), array_values($searchReplace),$string);
'nine hundred fifty four','nine hundred fifty three','nine hundred fifty two','nine hundred fifty one','nine hundred fifty', // check if we missed any, strange if we did.
'nine hundred forty nine','nine hundred forty eight','nine hundred forty seven','nine hundred forty six','nine hundred forty five', return self::replaceNumbers($string);
'nine hundred forty four','nine hundred forty three','nine hundred forty two','nine hundred forty one','nine hundred forty',
'nine hundred thirty nine','nine hundred thirty eight','nine hundred thirty seven','nine hundred thirty six','nine hundred thirty five',
'nine hundred thirty four','nine hundred thirty three','nine hundred thirty two','nine hundred thirty one','nine hundred thirty',
'nine hundred twenty nine','nine hundred twenty eight','nine hundred twenty seven','nine hundred twenty six','nine hundred twenty five',
'nine hundred twenty four','nine hundred twenty three','nine hundred twenty two','nine hundred twenty one','nine hundred twenty',
'nine hundred nineteen','nine hundred eighteen','nine hundred seventeen','nine hundred sixteen','nine hundred fifteen',
'nine hundred fourteen','nine hundred thirteen','nine hundred twelve','nine hundred eleven','nine hundred ten',
'nine hundred nine','nine hundred eight','nine hundred seven','nine hundred six','nine hundred five',
'nine hundred four','nine hundred three','nine hundred two','nine hundred one','nine hundred','eight hundred ninety nine',
'eight hundred ninety eight','eight hundred ninety seven','eight hundred ninety six','eight hundred ninety five','eight hundred ninety four',
'eight hundred ninety three','eight hundred ninety two','eight hundred ninety one','eight hundred ninety','eight hundred eighty nine',
'eight hundred eighty eight','eight hundred eighty seven','eight hundred eighty six','eight hundred eighty five','eight hundred eighty four',
'eight hundred eighty three','eight hundred eighty two','eight hundred eighty one','eight hundred eighty','eight hundred seventy nine',
'eight hundred seventy eight','eight hundred seventy seven','eight hundred seventy six','eight hundred seventy five','eight hundred seventy four',
'eight hundred seventy three','eight hundred seventy two','eight hundred seventy one','eight hundred seventy','eight hundred sixty nine',
'eight hundred sixty eight','eight hundred sixty seven','eight hundred sixty six','eight hundred sixty five','eight hundred sixty four',
'eight hundred sixty three','eight hundred sixty two','eight hundred sixty one','eight hundred sixty','eight hundred fifty nine',
'eight hundred fifty eight','eight hundred fifty seven','eight hundred fifty six','eight hundred fifty five','eight hundred fifty four',
'eight hundred fifty three','eight hundred fifty two','eight hundred fifty one','eight hundred fifty','eight hundred forty nine',
'eight hundred forty eight','eight hundred forty seven','eight hundred forty six','eight hundred forty five','eight hundred forty four',
'eight hundred forty three','eight hundred forty two','eight hundred forty one','eight hundred forty','eight hundred thirty nine',
'eight hundred thirty eight','eight hundred thirty seven','eight hundred thirty six','eight hundred thirty five','eight hundred thirty four',
'eight hundred thirty three','eight hundred thirty two','eight hundred thirty one','eight hundred thirty','eight hundred twenty nine',
'eight hundred twenty eight','eight hundred twenty seven','eight hundred twenty six','eight hundred twenty five','eight hundred twenty four',
'eight hundred twenty three','eight hundred twenty two','eight hundred twenty one','eight hundred twenty','eight hundred nineteen',
'eight hundred eighteen','eight hundred seventeen','eight hundred sixteen','eight hundred fifteen','eight hundred fourteen',
'eight hundred thirteen','eight hundred twelve','eight hundred eleven','eight hundred ten','eight hundred nine',
'eight hundred eight','eight hundred seven','eight hundred six','eight hundred five','eight hundred four',
'eight hundred three','eight hundred two','eight hundred one','eight hundred','seven hundred ninety nine','seven hundred ninety eight',
'seven hundred ninety seven','seven hundred ninety six','seven hundred ninety five','seven hundred ninety four','seven hundred ninety three',
'seven hundred ninety two','seven hundred ninety one','seven hundred ninety','seven hundred eighty nine','seven hundred eighty eight',
'seven hundred eighty seven','seven hundred eighty six','seven hundred eighty five','seven hundred eighty four','seven hundred eighty three',
'seven hundred eighty two','seven hundred eighty one','seven hundred eighty','seven hundred seventy nine','seven hundred seventy eight',
'seven hundred seventy seven','seven hundred seventy six','seven hundred seventy five','seven hundred seventy four','seven hundred seventy three',
'seven hundred seventy two','seven hundred seventy one','seven hundred seventy','seven hundred sixty nine','seven hundred sixty eight',
'seven hundred sixty seven','seven hundred sixty six','seven hundred sixty five','seven hundred sixty four','seven hundred sixty three',
'seven hundred sixty two','seven hundred sixty one','seven hundred sixty','seven hundred fifty nine','seven hundred fifty eight',
'seven hundred fifty seven','seven hundred fifty six','seven hundred fifty five','seven hundred fifty four','seven hundred fifty three',
'seven hundred fifty two','seven hundred fifty one','seven hundred fifty','seven hundred forty nine','seven hundred forty eight',
'seven hundred forty seven','seven hundred forty six','seven hundred forty five','seven hundred forty four','seven hundred forty three',
'seven hundred forty two','seven hundred forty one','seven hundred forty','seven hundred thirty nine','seven hundred thirty eight',
'seven hundred thirty seven','seven hundred thirty six','seven hundred thirty five','seven hundred thirty four','seven hundred thirty three',
'seven hundred thirty two','seven hundred thirty one','seven hundred thirty','seven hundred twenty nine','seven hundred twenty eight',
'seven hundred twenty seven','seven hundred twenty six','seven hundred twenty five','seven hundred twenty four','seven hundred twenty three',
'seven hundred twenty two','seven hundred twenty one','seven hundred twenty','seven hundred nineteen','seven hundred eighteen',
'seven hundred seventeen','seven hundred sixteen','seven hundred fifteen','seven hundred fourteen','seven hundred thirteen',
'seven hundred twelve','seven hundred eleven','seven hundred ten','seven hundred nine','seven hundred eight',
'seven hundred seven','seven hundred six','seven hundred five','seven hundred four','seven hundred three',
'seven hundred two','seven hundred one','seven hundred','six hundred ninety nine','six hundred ninety eight','six hundred ninety seven',
'six hundred ninety six','six hundred ninety five','six hundred ninety four','six hundred ninety three','six hundred ninety two',
'six hundred ninety one','six hundred ninety','six hundred eighty nine','six hundred eighty eight','six hundred eighty seven',
'six hundred eighty six','six hundred eighty five','six hundred eighty four','six hundred eighty three','six hundred eighty two',
'six hundred eighty one','six hundred eighty','six hundred seventy nine','six hundred seventy eight','six hundred seventy seven',
'six hundred seventy six','six hundred seventy five','six hundred seventy four','six hundred seventy three','six hundred seventy two',
'six hundred seventy one','six hundred seventy','six hundred sixty nine','six hundred sixty eight','six hundred sixty seven',
'six hundred sixty six','six hundred sixty five','six hundred sixty four','six hundred sixty three','six hundred sixty two',
'six hundred sixty one','six hundred sixty','six hundred fifty nine','six hundred fifty eight','six hundred fifty seven',
'six hundred fifty six','six hundred fifty five','six hundred fifty four','six hundred fifty three','six hundred fifty two',
'six hundred fifty one','six hundred fifty','six hundred forty nine','six hundred forty eight','six hundred forty seven',
'six hundred forty six','six hundred forty five','six hundred forty four','six hundred forty three','six hundred forty two',
'six hundred forty one','six hundred forty','six hundred thirty nine','six hundred thirty eight','six hundred thirty seven',
'six hundred thirty six','six hundred thirty five','six hundred thirty four','six hundred thirty three','six hundred thirty two',
'six hundred thirty one','six hundred thirty','six hundred twenty nine','six hundred twenty eight','six hundred twenty seven',
'six hundred twenty six','six hundred twenty five','six hundred twenty four','six hundred twenty three','six hundred twenty two',
'six hundred twenty one','six hundred twenty','six hundred nineteen','six hundred eighteen','six hundred seventeen',
'six hundred sixteen','six hundred fifteen','six hundred fourteen','six hundred thirteen','six hundred twelve',
'six hundred eleven','six hundred ten','six hundred nine','six hundred eight','six hundred seven',
'six hundred six','six hundred five','six hundred four','six hundred three','six hundred two',
'six hundred one','six hundred','five hundred ninety nine','five hundred ninety eight','five hundred ninety seven','five hundred ninety six',
'five hundred ninety five','five hundred ninety four','five hundred ninety three','five hundred ninety two','five hundred ninety one',
'five hundred ninety','five hundred eighty nine','five hundred eighty eight','five hundred eighty seven','five hundred eighty six',
'five hundred eighty five','five hundred eighty four','five hundred eighty three','five hundred eighty two','five hundred eighty one',
'five hundred eighty','five hundred seventy nine','five hundred seventy eight','five hundred seventy seven','five hundred seventy six',
'five hundred seventy five','five hundred seventy four','five hundred seventy three','five hundred seventy two','five hundred seventy one',
'five hundred seventy','five hundred sixty nine','five hundred sixty eight','five hundred sixty seven','five hundred sixty six',
'five hundred sixty five','five hundred sixty four','five hundred sixty three','five hundred sixty two','five hundred sixty one',
'five hundred sixty','five hundred fifty nine','five hundred fifty eight','five hundred fifty seven','five hundred fifty six',
'five hundred fifty five','five hundred fifty four','five hundred fifty three','five hundred fifty two','five hundred fifty one',
'five hundred fifty','five hundred forty nine','five hundred forty eight','five hundred forty seven','five hundred forty six',
'five hundred forty five','five hundred forty four','five hundred forty three','five hundred forty two','five hundred forty one',
'five hundred forty','five hundred thirty nine','five hundred thirty eight','five hundred thirty seven','five hundred thirty six',
'five hundred thirty five','five hundred thirty four','five hundred thirty three','five hundred thirty two','five hundred thirty one',
'five hundred thirty','five hundred twenty nine','five hundred twenty eight','five hundred twenty seven','five hundred twenty six',
'five hundred twenty five','five hundred twenty four','five hundred twenty three','five hundred twenty two','five hundred twenty one',
'five hundred twenty','five hundred nineteen','five hundred eighteen','five hundred seventeen','five hundred sixteen',
'five hundred fifteen','five hundred fourteen','five hundred thirteen','five hundred twelve','five hundred eleven',
'five hundred ten','five hundred nine','five hundred eight','five hundred seven','five hundred six',
'five hundred five','five hundred four','five hundred three','five hundred two','five hundred one','five hundred',
'four hundred ninety nine','four hundred ninety eight','four hundred ninety seven','four hundred ninety six','four hundred ninety five',
'four hundred ninety four','four hundred ninety three','four hundred ninety two','four hundred ninety one','four hundred ninety',
'four hundred eighty nine','four hundred eighty eight','four hundred eighty seven','four hundred eighty six','four hundred eighty five',
'four hundred eighty four','four hundred eighty three','four hundred eighty two','four hundred eighty one','four hundred eighty',
'four hundred seventy nine','four hundred seventy eight','four hundred seventy seven','four hundred seventy six','four hundred seventy five',
'four hundred seventy four','four hundred seventy three','four hundred seventy two','four hundred seventy one','four hundred seventy',
'four hundred sixty nine','four hundred sixty eight','four hundred sixty seven','four hundred sixty six','four hundred sixty five',
'four hundred sixty four','four hundred sixty three','four hundred sixty two','four hundred sixty one','four hundred sixty',
'four hundred fifty nine','four hundred fifty eight','four hundred fifty seven','four hundred fifty six','four hundred fifty five',
'four hundred fifty four','four hundred fifty three','four hundred fifty two','four hundred fifty one','four hundred fifty',
'four hundred forty nine','four hundred forty eight','four hundred forty seven','four hundred forty six','four hundred forty five',
'four hundred forty four','four hundred forty three','four hundred forty two','four hundred forty one','four hundred forty',
'four hundred thirty nine','four hundred thirty eight','four hundred thirty seven','four hundred thirty six','four hundred thirty five',
'four hundred thirty four','four hundred thirty three','four hundred thirty two','four hundred thirty one','four hundred thirty',
'four hundred twenty nine','four hundred twenty eight','four hundred twenty seven','four hundred twenty six','four hundred twenty five',
'four hundred twenty four','four hundred twenty three','four hundred twenty two','four hundred twenty one','four hundred twenty',
'four hundred nineteen','four hundred eighteen','four hundred seventeen','four hundred sixteen','four hundred fifteen',
'four hundred fourteen','four hundred thirteen','four hundred twelve','four hundred eleven','four hundred ten',
'four hundred nine','four hundred eight','four hundred seven','four hundred six','four hundred five',
'four hundred four','four hundred three','four hundred two','four hundred one','four hundred','three hundred ninety nine',
'three hundred ninety eight','three hundred ninety seven','three hundred ninety six','three hundred ninety five','three hundred ninety four',
'three hundred ninety three','three hundred ninety two','three hundred ninety one','three hundred ninety','three hundred eighty nine',
'three hundred eighty eight','three hundred eighty seven','three hundred eighty six','three hundred eighty five','three hundred eighty four',
'three hundred eighty three','three hundred eighty two','three hundred eighty one','three hundred eighty','three hundred seventy nine',
'three hundred seventy eight','three hundred seventy seven','three hundred seventy six','three hundred seventy five','three hundred seventy four',
'three hundred seventy three','three hundred seventy two','three hundred seventy one','three hundred seventy','three hundred sixty nine',
'three hundred sixty eight','three hundred sixty seven','three hundred sixty six','three hundred sixty five','three hundred sixty four',
'three hundred sixty three','three hundred sixty two','three hundred sixty one','three hundred sixty','three hundred fifty nine',
'three hundred fifty eight','three hundred fifty seven','three hundred fifty six','three hundred fifty five','three hundred fifty four',
'three hundred fifty three','three hundred fifty two','three hundred fifty one','three hundred fifty','three hundred forty nine',
'three hundred forty eight','three hundred forty seven','three hundred forty six','three hundred forty five','three hundred forty four',
'three hundred forty three','three hundred forty two','three hundred forty one','three hundred forty','three hundred thirty nine',
'three hundred thirty eight','three hundred thirty seven','three hundred thirty six','three hundred thirty five','three hundred thirty four',
'three hundred thirty three','three hundred thirty two','three hundred thirty one','three hundred thirty','three hundred twenty nine',
'three hundred twenty eight','three hundred twenty seven','three hundred twenty six','three hundred twenty five','three hundred twenty four',
'three hundred twenty three','three hundred twenty two','three hundred twenty one','three hundred twenty','three hundred nineteen',
'three hundred eighteen','three hundred seventeen','three hundred sixteen','three hundred fifteen','three hundred fourteen',
'three hundred thirteen','three hundred twelve','three hundred eleven','three hundred ten','three hundred nine',
'three hundred eight','three hundred seven','three hundred six','three hundred five','three hundred four',
'three hundred three','three hundred two','three hundred one','three hundred','two hundred ninety nine','two hundred ninety eight',
'two hundred ninety seven','two hundred ninety six','two hundred ninety five','two hundred ninety four','two hundred ninety three',
'two hundred ninety two','two hundred ninety one','two hundred ninety','two hundred eighty nine','two hundred eighty eight',
'two hundred eighty seven','two hundred eighty six','two hundred eighty five','two hundred eighty four','two hundred eighty three',
'two hundred eighty two','two hundred eighty one','two hundred eighty','two hundred seventy nine','two hundred seventy eight',
'two hundred seventy seven','two hundred seventy six','two hundred seventy five','two hundred seventy four','two hundred seventy three',
'two hundred seventy two','two hundred seventy one','two hundred seventy','two hundred sixty nine','two hundred sixty eight',
'two hundred sixty seven','two hundred sixty six','two hundred sixty five','two hundred sixty four','two hundred sixty three',
'two hundred sixty two','two hundred sixty one','two hundred sixty','two hundred fifty nine','two hundred fifty eight',
'two hundred fifty seven','two hundred fifty six','two hundred fifty five','two hundred fifty four','two hundred fifty three',
'two hundred fifty two','two hundred fifty one','two hundred fifty','two hundred forty nine','two hundred forty eight',
'two hundred forty seven','two hundred forty six','two hundred forty five','two hundred forty four','two hundred forty three',
'two hundred forty two','two hundred forty one','two hundred forty','two hundred thirty nine','two hundred thirty eight',
'two hundred thirty seven','two hundred thirty six','two hundred thirty five','two hundred thirty four','two hundred thirty three',
'two hundred thirty two','two hundred thirty one','two hundred thirty','two hundred twenty nine','two hundred twenty eight',
'two hundred twenty seven','two hundred twenty six','two hundred twenty five','two hundred twenty four','two hundred twenty three',
'two hundred twenty two','two hundred twenty one','two hundred twenty','two hundred nineteen','two hundred eighteen',
'two hundred seventeen','two hundred sixteen','two hundred fifteen','two hundred fourteen','two hundred thirteen',
'two hundred twelve','two hundred eleven','two hundred ten','two hundred nine','two hundred eight',
'two hundred seven','two hundred six','two hundred five','two hundred four','two hundred three',
'two hundred two','two hundred one','two hundred','one hundred ninety nine','one hundred ninety eight','one hundred ninety seven',
'one hundred ninety six','one hundred ninety five','one hundred ninety four','one hundred ninety three','one hundred ninety two',
'one hundred ninety one','one hundred ninety','one hundred eighty nine','one hundred eighty eight','one hundred eighty seven',
'one hundred eighty six','one hundred eighty five','one hundred eighty four','one hundred eighty three','one hundred eighty two',
'one hundred eighty one','one hundred eighty','one hundred seventy nine','one hundred seventy eight','one hundred seventy seven',
'one hundred seventy six','one hundred seventy five','one hundred seventy four','one hundred seventy three','one hundred seventy two',
'one hundred seventy one','one hundred seventy','one hundred sixty nine','one hundred sixty eight','one hundred sixty seven',
'one hundred sixty six','one hundred sixty five','one hundred sixty four','one hundred sixty three','one hundred sixty two',
'one hundred sixty one','one hundred sixty','one hundred fifty nine','one hundred fifty eight','one hundred fifty seven',
'one hundred fifty six','one hundred fifty five','one hundred fifty four','one hundred fifty three','one hundred fifty two',
'one hundred fifty one','one hundred fifty','one hundred forty nine','one hundred forty eight','one hundred forty seven',
'one hundred forty six','one hundred forty five','one hundred forty four','one hundred forty three','one hundred forty two',
'one hundred forty one','one hundred forty','one hundred thirty nine','one hundred thirty eight','one hundred thirty seven',
'one hundred thirty six','one hundred thirty five','one hundred thirty four','one hundred thirty three','one hundred thirty two',
'one hundred thirty one','one hundred thirty','one hundred twenty nine','one hundred twenty eight','one hundred twenty seven',
'one hundred twenty six','one hundred twenty five','one hundred twenty four','one hundred twenty three','one hundred twenty two',
'one hundred twenty one','one hundred twenty','one hundred nineteen','one hundred eighteen','one hundred seventeen',
'one hundred sixteen','one hundred fifteen','one hundred fourteen','one hundred thirteen','one hundred twelve',
'one hundred eleven','one hundred ten','one hundred nine','one hundred eight','one hundred seven',
'one hundred six','one hundred five','one hundred four','one hundred three','one hundred two','one hundred one',
'one hundred', 'ninety nine','ninety eight','ninety seven','ninety six','ninety five','ninety four','ninety three','ninety two','ninety one',
'ninety','eighty nine','eighty eight','eighty seven','eighty six','eighty five','eighty four','eighty three','eighty two','eighty one',
'eighty','seventy nine','seventy eight','seventy seven','seventy six','seventy five','seventy four','seventy three','seventy two','seventy one',
'seventy','sixty nine','sixty eight','sixty seven','sixty six','sixty five','sixty four','sixty three','sixty two','sixty one',
'sixty','fifty nine','fifty eight','fifty seven','fifty six','fifty five','fifty four','fifty three','fifty two','fifty one',
'fifty','forty nine','forty eight','forty seven','forty six','forty five','forty four','forty three','forty two','forty one',
'forty','thirty nine','thirty eight','thirty seven','thirty six','thirty five','thirty four','thirty three','thirty two','thirty one',
'thirty','twenty nine','twenty eight','twenty seven','twenty six','twenty five','twenty four','twenty three','twenty two','twenty one',
'twenty','nineteen','eighteen','seventeen','sixteen','fifteen','fourteen','thirteen','twelve','eleven',
'ten','nine','eight','seven','six','five','four','three','two','one','zero');
$search = array(
'1000','999','998','997','996','995','994','993','992','991','990','989','988','987','986','985','984','983','982','981',
'980','979','978','977','976','975','974','973','972','971','970','969','968','967','966','965','964','963','962','961',
'960','959','958','957','956','955','954','953','952','951','950','949','948','947','946','945','944','943','942','941',
'940','939','938','937','936','935','934','933','932','931','930','929','928','927','926','925','924','923','922','921',
'920','919','918','917','916','915','914','913','912','911','910','909','908','907','906','905','904','903','902','901',
'900','899','898','897','896','895','894','893','892','891','890','889','888','887','886','885','884','883','882','881',
'880','879','878','877','876','875','874','873','872','871','870','869','868','867','866','865','864','863','862','861',
'860','859','858','857','856','855','854','853','852','851','850','849','848','847','846','845','844','843','842','841',
'840','839','838','837','836','835','834','833','832','831','830','829','828','827','826','825','824','823','822','821',
'820','819','818','817','816','815','814','813','812','811','810','809','808','807','806','805','804','803','802','801',
'800','799','798','797','796','795','794','793','792','791','790','789','788','787','786','785','784','783','782','781',
'780','779','778','777','776','775','774','773','772','771','770','769','768','767','766','765','764','763','762','761',
'760','759','758','757','756','755','754','753','752','751','750','749','748','747','746','745','744','743','742','741',
'740','739','738','737','736','735','734','733','732','731','730','729','728','727','726','725','724','723','722','721',
'720','719','718','717','716','715','714','713','712','711','710','709','708','707','706','705','704','703','702','701',
'700','699','698','697','696','695','694','693','692','691','690','689','688','687','686','685','684','683','682','681',
'680','679','678','677','676','675','674','673','672','671','670','669','668','667','666','665','664','663','662','661',
'660','659','658','657','656','655','654','653','652','651','650','649','648','647','646','645','644','643','642','641',
'640','639','638','637','636','635','634','633','632','631','630','629','628','627','626','625','624','623','622','621',
'620','619','618','617','616','615','614','613','612','611','610','609','608','607','606','605','604','603','602','601',
'600','599','598','597','596','595','594','593','592','591','590','589','588','587','586','585','584','583','582','581',
'580','579','578','577','576','575','574','573','572','571','570','569','568','567','566','565','564','563','562','561',
'560','559','558','557','556','555','554','553','552','551','550','549','548','547','546','545','544','543','542','541',
'540','539','538','537','536','535','534','533','532','531','530','529','528','527','526','525','524','523','522','521',
'520','519','518','517','516','515','514','513','512','511','510','509','508','507','506','505','504','503','502','501',
'500','499','498','497','496','495','494','493','492','491','490','489','488','487','486','485','484','483','482','481',
'480','479','478','477','476','475','474','473','472','471','470','469','468','467','466','465','464','463','462','461',
'460','459','458','457','456','455','454','453','452','451','450','449','448','447','446','445','444','443','442','441',
'440','439','438','437','436','435','434','433','432','431','430','429','428','427','426','425','424','423','422','421',
'420','419','418','417','416','415','414','413','412','411','410','409','408','407','406','405','404','403','402','401',
'400','399','398','397','396','395','394','393','392','391','390','389','388','387','386','385','384','383','382','381',
'380','379','378','377','376','375','374','373','372','371','370','369','368','367','366','365','364','363','362','361',
'360','359','358','357','356','355','354','353','352','351','350','349','348','347','346','345','344','343','342','341',
'340','339','338','337','336','335','334','333','332','331','330','329','328','327','326','325','324','323','322','321',
'320','319','318','317','316','315','314','313','312','311','310','309','308','307','306','305','304','303','302','301',
'300','299','298','297','296','295','294','293','292','291','290','289','288','287','286','285','284','283','282','281',
'280','279','278','277','276','275','274','273','272','271','270','269','268','267','266','265','264','263','262','261',
'260','259','258','257','256','255','254','253','252','251','250','249','248','247','246','245','244','243','242','241',
'240','239','238','237','236','235','234','233','232','231','230','229','228','227','226','225','224','223','222','221',
'220','219','218','217','216','215','214','213','212','211','210','209','208','207','206','205','204','203','202','201',
'200','199','198','197','196','195','194','193','192','191','190','189','188','187','186','185','184','183','182','181',
'180','179','178','177','176','175','174','173','172','171','170','169','168','167','166','165','164','163','162','161',
'160','159','158','157','156','155','154','153','152','151','150','149','148','147','146','145','144','143','142','141',
'140','139','138','137','136','135','134','133','132','131','130','129','128','127','126','125','124','123','122','121',
'120','119','118','117','116','115','114','113','112','111','110','109','108','107','106','105','104','103','102','101',
'100','99','98','97','96','95','94','93','92','91','90','89','88','87','86','85','84','83','82','81',
'80','79','78','77','76','75','74','73','72','71','70','69','68','67','66','65','64','63','62','61',
'60','59','58','57','56','55','54','53','52','51','50','49','48','47','46','45','44','43','42','41',
'40','39','38','37','36','35','34','33','32','31','30','29','28','27','26','25','24','23','22','21',
'20','19','18','17','16','15','14','13','12','11','10','9','8','7','6','5','4','3','2','1','0');
return str_replace($search,$replace,$string);
} }
// return the string with no numbers remaining.
return $string; return $string;
} }
/**
* Convert an integer into an English word string
* Thanks to Tom Nicholson <http://php.net/manual/en/function.strval.php#41988>
*
* @input an int
* @returns a string
**/
public static function numberToString($x)
{
$nwords = array( "zero", "one", "two", "three", "four", "five", "six", "seven",
"eight", "nine", "ten", "eleven", "twelve", "thirteen",
"fourteen", "fifteen", "sixteen", "seventeen", "eighteen",
"nineteen", "twenty", 30 => "thirty", 40 => "forty",
50 => "fifty", 60 => "sixty", 70 => "seventy", 80 => "eighty",
90 => "ninety" );
if(!is_numeric($x))
{
$w = $x;
}
elseif(fmod($x, 1) != 0)
{
$w = $x;
}
else
{
if($x < 0)
{
$w = 'minus ';
$x = -$x;
}
else
{
$w = '';
// ... now $x is a non-negative integer.
}
if($x < 21) // 0 to 20
{
$w .= $nwords[$x];
}
elseif($x < 100) // 21 to 99
{
$w .= $nwords[10 * floor($x/10)];
$r = fmod($x, 10);
if($r > 0)
{
$w .= ' '. $nwords[$r];
}
}
elseif($x < 1000) // 100 to 999
{
$w .= $nwords[floor($x/100)] .' hundred';
$r = fmod($x, 100);
if($r > 0)
{
$w .= ' and '. self::numberToString($r);
}
}
elseif($x < 1000000) // 1000 to 999999
{
$w .= self::numberToString(floor($x/1000)) .' thousand';
$r = fmod($x, 1000);
if($r > 0)
{
$w .= ' ';
if($r < 100)
{
$w .= 'and ';
}
$w .= self::numberToString($r);
}
}
else // millions
{
$w .= self::numberToString(floor($x/1000000)) .' million';
$r = fmod($x, 1000000);
if($r > 0)
{
$w .= ' ';
if($r < 100)
{
$word .= 'and ';
}
$w .= self::numberToString($r);
}
}
}
return $w;
}
/** /**
* Random Key * Random Key
* *

View File

@ -3,7 +3,9 @@
Vast Development Method Vast Development Method
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015 @version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo @package Demo
@subpackage batch_.php @subpackage batch_.php
@author Llewellyn van der Merwe <https://www.vdm.io/> @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_DOCUMENT="Help Document"
COM_DEMO_HELP_DOCUMENTS="Help Documents" COM_DEMO_HELP_DOCUMENTS="Help Documents"
COM_DEMO_HELP_DOCUMENTS_ACCESS="Help Documents Access" 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_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_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="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="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="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_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="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="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_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="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="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="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="%s Help Documents archived."
COM_DEMO_HELP_DOCUMENTS_N_ITEMS_ARCHIVED_1="%s Help Document 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." 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_UNFEATURED_1="%s Help Document unfeatured."
COM_DEMO_HELP_DOCUMENTS_N_ITEMS_UNPUBLISHED="%s Help Documents unpublished." 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_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="Admin"
COM_DEMO_HELP_DOCUMENT_ADMIN_VIEW="Admin View" COM_DEMO_HELP_DOCUMENT_ADMIN_VIEW="Admin View"
COM_DEMO_HELP_DOCUMENT_ADMIN_VIEW_DESCRIPTION="Select the view being targeted" 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_CATEGORY="- Keep Original Category -"
COM_DEMO_KEEP_ORIGINAL_STATE="- Keep Original State -" COM_DEMO_KEEP_ORIGINAL_STATE="- Keep Original State -"
COM_DEMO_LICENSE="License" COM_DEMO_LICENSE="License"
COM_DEMO_LOOK="look" COM_DEMO_LOOK="Look"
COM_DEMO_LOOKS="looks" COM_DEMO_LOOKS="Looks"
COM_DEMO_LOOKS_BATCH_OPTIONS="Batch process the selected 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_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="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="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="Looks Import"
COM_DEMO_LOOKS_IMPORT_DESC="Allows the users in this group to import looks" 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="%s Looks archived."
COM_DEMO_LOOKS_N_ITEMS_ARCHIVED_1="%s look 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_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_1="%d Look successfully checked in."
COM_DEMO_LOOKS_N_ITEMS_CHECKED_IN_MORE="%d looks 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="%s Looks deleted."
COM_DEMO_LOOKS_N_ITEMS_DELETED_1="%s look 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="%s Looks featured."
COM_DEMO_LOOKS_N_ITEMS_FEATURED_1="%s look 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="%s Looks published."
COM_DEMO_LOOKS_N_ITEMS_PUBLISHED_1="%s look 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="%s Looks trashed."
COM_DEMO_LOOKS_N_ITEMS_TRASHED_1="%s look 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="%s Looks unfeatured."
COM_DEMO_LOOKS_N_ITEMS_UNFEATURED_1="%s look 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="%s Looks unpublished."
COM_DEMO_LOOKS_N_ITEMS_UNPUBLISHED_1="%s look 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="Acronym"
COM_DEMO_LOOK_ACRONYM_DESCRIPTION="Enter an acronym" COM_DEMO_LOOK_ACRONYM_DESCRIPTION="Enter an acronym"
COM_DEMO_LOOK_ACRONYM_HINT="Acronym Here" 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_AGE_LABEL="Age Group"
COM_DEMO_LOOK_ALIAS="Alias" COM_DEMO_LOOK_ALIAS="Alias"
COM_DEMO_LOOK_ALIAS_HINT="Auto-generated from name" 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_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_CREATED_DATE_LABEL="Created date"
COM_DEMO_LOOK_DESCRIPTION="Description" COM_DEMO_LOOK_DESCRIPTION="Description"
COM_DEMO_LOOK_DESCRIPTION_DESCRIPTION="Add Description Here" COM_DEMO_LOOK_DESCRIPTION_DESCRIPTION="Add Description Here"
COM_DEMO_LOOK_DESCRIPTION_HINT="Add Description Here" COM_DEMO_LOOK_DESCRIPTION_HINT="Add Description Here"
COM_DEMO_LOOK_DESCRIPTION_LABEL="Description" COM_DEMO_LOOK_DESCRIPTION_LABEL="Description"
COM_DEMO_LOOK_DETAILS="Details" COM_DEMO_LOOK_DETAILS="Details"
COM_DEMO_LOOK_EDIT="Editing the look" COM_DEMO_LOOK_EDIT="Editing the Look"
COM_DEMO_LOOK_ERROR_UNIQUE_ALIAS="Another look has the same alias." COM_DEMO_LOOK_ERROR_UNIQUE_ALIAS="Another Look has the same alias."
COM_DEMO_LOOK_FEMALE="Female" COM_DEMO_LOOK_FEMALE="Female"
COM_DEMO_LOOK_FEMALE_DESCRIPTION="Here you can add females data." COM_DEMO_LOOK_FEMALE_DESCRIPTION="Here you can add females data."
COM_DEMO_LOOK_FEMALE_SELECT="Edit/Add" 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_DESCRIPTION="Enter Name Here"
COM_DEMO_LOOK_NAME_HINT="Name Here" COM_DEMO_LOOK_NAME_HINT="Name Here"
COM_DEMO_LOOK_NAME_LABEL="Name" 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_NO="No"
COM_DEMO_LOOK_NOT_REQUIRED="Not Required" COM_DEMO_LOOK_NOT_REQUIRED="Not Required"
COM_DEMO_LOOK_NUMBER_HINT="Number Here" 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_PERMISSION="Permissions"
COM_DEMO_LOOK_PUBLISHING="Publishing" COM_DEMO_LOOK_PUBLISHING="Publishing"
COM_DEMO_LOOK_REPETABLE_NUMBERS="Repetable Numbers" 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_SELECT_A_YEAR="Select a year"
COM_DEMO_LOOK_SIXTYSIXTY_FOUR="60-64" COM_DEMO_LOOK_SIXTYSIXTY_FOUR="60-64"
COM_DEMO_LOOK_STATUS="Status" 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_THIRTY_FIVETHIRTY_NINE="35-39"
COM_DEMO_LOOK_TWENTYTWENTY_FOUR="20-24" COM_DEMO_LOOK_TWENTYTWENTY_FOUR="20-24"
COM_DEMO_LOOK_TWENTY_FIVETWENTY_NINE="25-29" COM_DEMO_LOOK_TWENTY_FIVETWENTY_NINE="25-29"
COM_DEMO_LOOK_TWO_HUNDRED_ONEEIGHT="2018" COM_DEMO_LOOK_TWO_THOUSAND_AND_EIGHTEEN="2018"
COM_DEMO_LOOK_TWO_HUNDRED_ONEFIVE="2015" COM_DEMO_LOOK_TWO_THOUSAND_AND_ELEVEN="2011"
COM_DEMO_LOOK_TWO_HUNDRED_ONEFOUR="2014" COM_DEMO_LOOK_TWO_THOUSAND_AND_FIFTEEN="2015"
COM_DEMO_LOOK_TWO_HUNDRED_ONENINE="2019" COM_DEMO_LOOK_TWO_THOUSAND_AND_FOURTEEN="2014"
COM_DEMO_LOOK_TWO_HUNDRED_ONEONE="2011" COM_DEMO_LOOK_TWO_THOUSAND_AND_NINETEEN="2019"
COM_DEMO_LOOK_TWO_HUNDRED_ONESEVEN="2017" COM_DEMO_LOOK_TWO_THOUSAND_AND_SEVENTEEN="2017"
COM_DEMO_LOOK_TWO_HUNDRED_ONESIX="2016" COM_DEMO_LOOK_TWO_THOUSAND_AND_SIXTEEN="2016"
COM_DEMO_LOOK_TWO_HUNDRED_ONETHREE="2013" COM_DEMO_LOOK_TWO_THOUSAND_AND_TEN="2010"
COM_DEMO_LOOK_TWO_HUNDRED_ONETWO="2012" COM_DEMO_LOOK_TWO_THOUSAND_AND_THIRTEEN="2013"
COM_DEMO_LOOK_TWO_HUNDRED_ONEZERO="2010" COM_DEMO_LOOK_TWO_THOUSAND_AND_TWELVE="2012"
COM_DEMO_LOOK_TWO_HUNDRED_TWOFOUR="2024" COM_DEMO_LOOK_TWO_THOUSAND_AND_TWENTY="2020"
COM_DEMO_LOOK_TWO_HUNDRED_TWOONE="2021" COM_DEMO_LOOK_TWO_THOUSAND_AND_TWENTY_FOUR="2024"
COM_DEMO_LOOK_TWO_HUNDRED_TWOTHREE="2023" COM_DEMO_LOOK_TWO_THOUSAND_AND_TWENTY_ONE="2021"
COM_DEMO_LOOK_TWO_HUNDRED_TWOTWO="2022" COM_DEMO_LOOK_TWO_THOUSAND_AND_TWENTY_THREE="2023"
COM_DEMO_LOOK_TWO_HUNDRED_TWOZERO="2020" 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_DESC="A count of the number of times this Look has been revised."
COM_DEMO_LOOK_VERSION_LABEL="Revision" COM_DEMO_LOOK_VERSION_LABEL="Revision"
COM_DEMO_LOOK_WEBSITE="Website" COM_DEMO_LOOK_WEBSITE="Website"
COM_DEMO_LOOK_WEBSITE_DESCRIPTION="Enter website address" 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_YEAR_LABEL="Data Year"
COM_DEMO_LOOK_YES="Yes" COM_DEMO_LOOK_YES="Yes"
COM_DEMO_NEW="New" COM_DEMO_NEW="New"
COM_DEMO_NO_ACCESS_GRANTED="No Access Granted!"
COM_DEMO_SAVE_SUCCESS="Great! Item successfully saved." COM_DEMO_SAVE_SUCCESS="Great! Item successfully saved."
COM_DEMO_SAVE_WARNING="The value already existed so please select another." COM_DEMO_SAVE_WARNING="The value already existed so please select another."
COM_DEMO_SUBMENU_DASHBOARD="Dashboard" COM_DEMO_SUBMENU_DASHBOARD="Dashboard"
COM_DEMO_SUBMENU_HELP_DOCUMENTS="Help Documents" 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="Use Batch"
COM_DEMO_USE_BATCH_DESC=" Allows users in this group to use batch copy/update method." COM_DEMO_USE_BATCH_DESC=" Allows users in this group to use batch copy/update method."
COM_DEMO_VERSION="Version" COM_DEMO_VERSION="Version"

View File

@ -2,4 +2,4 @@ COM_DEMO="Demo"
COM_DEMO_CONFIGURATION="Demo Configuration" COM_DEMO_CONFIGURATION="Demo Configuration"
COM_DEMO_MENU="&#187; Demo" COM_DEMO_MENU="&#187; Demo"
COM_DEMO_MENU_HELP_DOCUMENTS="Help Documents" 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 Vast Development Method
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015 @version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo @package Demo
@subpackage batchselection.php @subpackage batchselection.php
@author Llewellyn van der Merwe <https://www.vdm.io/> @author Llewellyn van der Merwe <https://www.vdm.io/>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,9 @@
Vast Development Method Vast Development Method
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015 @version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo @package Demo
@subpackage demo.php @subpackage demo.php
@author Llewellyn van der Merwe <https://www.vdm.io/> @author Llewellyn van der Merwe <https://www.vdm.io/>
@ -30,187 +32,181 @@ class DemoModelDemo extends JModelList
{ {
public function getIcons() public function getIcons()
{ {
// load user for access menus // load user for access menus
$user = JFactory::getUser(); $user = JFactory::getUser();
// reset icon array // reset icon array
$icons = array(); $icons = array();
// view groups array // view groups array
$viewGroups = array( $viewGroups = array(
'main' => array('png.look.add', 'png.looks', 'png.help_documents') 'main' => array('png.look.add', 'png.looks', 'png.help_documents')
); );
// view access array // view access array
$viewAccess = 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_document.create' => 'help_document.create',
'help_documents.access' => 'help_document.access', '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) foreach($viewGroups as $group => $views)
{ {
$i = 0; $i = 0;
if (DemoHelper::checkArray($views)) if (DemoHelper::checkArray($views))
{ {
foreach($views as $view) foreach($views as $view)
{ {
$add = false; $add = false;
if (strpos($view,'.') !== false) if (strpos($view,'.') !== false)
{ {
list($type, $name, $action) = explode('.', $view); $dwd = explode('.', $view);
if ($action) if (count($dwd) == 3)
{ {
$viewName = $name; list($type, $name, $action) = $dwd;
switch($action) }
{ elseif (count($dwd) == 2)
case 'add': {
$url ='index.php?option=com_demo&view='.$name.'&layout=edit'; list($type, $name) = $dwd;
$image = $name.'_'.$action.'.'.$type; $action = false;
$alt = $name.'&nbsp;'.$action; }
$name = 'COM_DEMO_DASHBOARD_'.DemoHelper::safeString($name,'U').'_ADD'; if ($action)
$add = true; {
break; $viewName = $name;
default: switch($action)
$url = 'index.php?option=com_categories&view=categories&extension=com_demo.'.$name; {
$image = $name.'_'.$action.'.'.$type; case 'add':
$alt = $name.'&nbsp;'.$action; $url ='index.php?option=com_demo&view='.$name.'&layout=edit';
$name = 'COM_DEMO_DASHBOARD_'.DemoHelper::safeString($name,'U').'_'.DemoHelper::safeString($action,'U'); $image = $name.'_'.$action.'.'.$type;
break; $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 else
{ {
$viewName = $name; $icons[$group][$i] = false;
$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;
} }
} }
return $icons; 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;
}
} }

View File

@ -3,7 +3,9 @@
Vast Development Method Vast Development Method
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015 @version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo @package Demo
@subpackage articles.php @subpackage articles.php
@author Llewellyn van der Merwe <https://www.vdm.io/> @author Llewellyn van der Merwe <https://www.vdm.io/>
@ -34,6 +36,50 @@ class JFormFieldArticles extends JFormFieldList
* @var string * @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. * Method to get a list of options for a list input.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,9 @@
Vast Development Method Vast Development Method
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015 @version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo @package Demo
@subpackage import.php @subpackage import.php
@author Llewellyn van der Merwe <https://www.vdm.io/> @author Llewellyn van der Merwe <https://www.vdm.io/>
@ -65,10 +67,10 @@ class DemoModelImport extends JModelLegacy
// Recall the 'Import from Directory' path. // Recall the 'Import from Directory' path.
$path = $app->getUserStateFromRequest($this->_context . '.import_directory', 'import_directory', $app->get('tmp_path')); $path = $app->getUserStateFromRequest($this->_context . '.import_directory', 'import_directory', $app->get('tmp_path'));
$this->setState('import.directory', $path); $this->setState('import.directory', $path);
// set uploading values // set uploading values
$this->use_streams = false; $this->use_streams = false;
$this->allow_unsafe = false; $this->allow_unsafe = false;
$this->safeFileOptions = array(); $this->safeFileOptions = array();
parent::populateState(); parent::populateState();
} }
@ -82,7 +84,7 @@ class DemoModelImport extends JModelLegacy
{ {
$this->setState('action', 'import'); $this->setState('action', 'import');
$app = JFactory::getApplication(); $app = JFactory::getApplication();
$session =& JFactory::getSession(); $session = JFactory::getSession();
$package = null; $package = null;
$continue = false; $continue = false;
// get import type // get import type
@ -137,7 +139,7 @@ class DemoModelImport extends JModelLegacy
return false; return false;
} }
// first link data to table headers // first link data to table headers
if(!$continue){ if(!$continue){
$package = json_encode($package); $package = json_encode($package);
$session->set('package', $package); $session->set('package', $package);
@ -153,11 +155,11 @@ class DemoModelImport extends JModelLegacy
// There was an error importing the package // There was an error importing the package
$msg = JText::_('COM_DEMO_IMPORT_ERROR'); $msg = JText::_('COM_DEMO_IMPORT_ERROR');
$back = $session->get('backto_VDM_IMPORT', NULL); $back = $session->get('backto_VDM_IMPORT', NULL);
if ($back) if ($back)
{ {
$app->setUserState('com_demo.redirect_url', 'index.php?option=com_demo&view='.$back); $app->setUserState('com_demo.redirect_url', 'index.php?option=com_demo&view='.$back);
$session->clear('backto_VDM_IMPORT'); $session->clear('backto_VDM_IMPORT');
} }
$result = false; $result = false;
} }
else else
@ -165,11 +167,11 @@ class DemoModelImport extends JModelLegacy
// Package imported sucessfully // Package imported sucessfully
$msg = JText::sprintf('COM_DEMO_IMPORT_SUCCESS', $package['packagename']); $msg = JText::sprintf('COM_DEMO_IMPORT_SUCCESS', $package['packagename']);
$back = $session->get('backto_VDM_IMPORT', NULL); $back = $session->get('backto_VDM_IMPORT', NULL);
if ($back) if ($back)
{ {
$app->setUserState('com_demo.redirect_url', 'index.php?option=com_demo&view='.$back); $app->setUserState('com_demo.redirect_url', 'index.php?option=com_demo&view='.$back);
$session->clear('backto_VDM_IMPORT'); $session->clear('backto_VDM_IMPORT');
} }
$result = true; $result = true;
} }
@ -226,7 +228,7 @@ class DemoModelImport extends JModelLegacy
// Was the package downloaded? // Was the package downloaded?
if (!$p_file) if (!$p_file)
{ {
$session =& JFactory::getSession(); $session = JFactory::getSession();
$session->clear('package'); $session->clear('package');
$session->clear('dataType'); $session->clear('dataType');
$session->clear('hasPackage'); $session->clear('hasPackage');
@ -359,10 +361,10 @@ class DemoModelImport extends JModelLegacy
$check['packagename'] = $archivename; $check['packagename'] = $archivename;
// set directory // set directory
$check['dir'] = $config->get('tmp_path'). '/' .$archivename; $check['dir'] = $config->get('tmp_path'). '/' .$archivename;
// set type // set type
$check['type'] = $this->getType; $check['type'] = $this->getType;
return $check; return $check;
} }
@ -383,9 +385,12 @@ class DemoModelImport extends JModelLegacy
$package = $config->get('tmp_path'). '/' .$package; $package = $config->get('tmp_path'). '/' .$package;
// Is the package file a valid file? // Is the package file a valid file?
if (is_file($package)) { if (is_file($package))
{
JFile::delete($package); JFile::delete($package);
} elseif (is_file(JPath::clean($package))) { }
elseif (is_file(JPath::clean($package)))
{
// It might also be just a base filename // It might also be just a base filename
JFile::delete(JPath::clean($package)); JFile::delete(JPath::clean($package));
} }
@ -404,14 +409,15 @@ class DemoModelImport extends JModelLegacy
if (DemoHelper::checkArray($target_headers)) if (DemoHelper::checkArray($target_headers))
{ {
// make sure the file is loaded // make sure the file is loaded
JLoader::import('PHPExcel', JPATH_COMPONENT_ADMINISTRATOR . '/helpers'); JLoader::import('PHPExcel', JPATH_COMPONENT_ADMINISTRATOR . '/helpers');
$jinput = JFactory::getApplication()->input; $jinput = JFactory::getApplication()->input;
foreach($target_headers as $header) foreach($target_headers as $header)
{ {
$data['target_headers'][$header] = $jinput->getString($header, null); $data['target_headers'][$header] = $jinput->getString($header, null);
} }
// set the data // set the data
if(isset($package['dir'])){ if(isset($package['dir']))
{
$inputFileType = PHPExcel_IOFactory::identify($package['dir']); $inputFileType = PHPExcel_IOFactory::identify($package['dir']);
$excelReader = PHPExcel_IOFactory::createReader($inputFileType); $excelReader = PHPExcel_IOFactory::createReader($inputFileType);
$excelReader->setReadDataOnly(true); $excelReader->setReadDataOnly(true);
@ -438,10 +444,10 @@ class DemoModelImport extends JModelLegacy
// import the data if there is any // import the data if there is any
if(DemoHelper::checkArray($data['array'])) if(DemoHelper::checkArray($data['array']))
{ {
// get user object // get user object
$user = JFactory::getUser(); $user = JFactory::getUser();
// remove header if it has headers // remove header if it has headers
$id_key = $data['target_headers']['id']; $id_key = $data['target_headers']['id'];
$published_key = $data['target_headers']['published']; $published_key = $data['target_headers']['published'];
$ordering_key = $data['target_headers']['ordering']; $ordering_key = $data['target_headers']['ordering'];
// get the first array set // get the first array set
@ -462,11 +468,12 @@ class DemoModelImport extends JModelLegacy
$db = JFactory::getDbo(); $db = JFactory::getDbo();
// set some defaults // set some defaults
$todayDate = JFactory::getDate()->toSql(); $todayDate = JFactory::getDate()->toSql();
// get global action permissions // get global action permissions
$canDo = DemoHelper::getActions($table); $canDo = DemoHelper::getActions($table);
$canEdit = $canDo->get('core.edit'); $canEdit = $canDo->get('core.edit');
$canState = $canDo->get('core.edit.state'); $canState = $canDo->get('core.edit.state');
$canCreate = $canDo->get('core.create'); $canCreate = $canDo->get('core.create');
$hasAlias = $this->getAliasesUsed($table);
// prosses the data // prosses the data
foreach($data['array'] as $row) foreach($data['array'] as $row)
{ {
@ -497,29 +504,29 @@ class DemoModelImport extends JModelLegacy
// Fields to update. // Fields to update.
foreach($row as $key => $cell) foreach($row as $key => $cell)
{ {
// ignore column // ignore column
if ($target[$key] == 'IGNORE') if ('IGNORE' == $target[$key])
{
continue;
}
// update modified
if ($target[$key] == 'modified_by')
{ {
continue; continue;
} }
// update modified // update modified
if ($target[$key] == 'modified') if ('modified_by' == $target[$key])
{
continue;
}
// update modified
if ('modified' == $target[$key])
{ {
continue; continue;
} }
// update version // update version
if ($target[$key] == 'version') if ('version' == $target[$key])
{ {
$cell = (int) $version + 1; $cell = (int) $version + 1;
$version = true; $version = true;
} }
// verfy publish autority // verify publish authority
if ($target[$key] == 'published' && !$canState) if ('published' == $target[$key] && !$canState)
{ {
continue; continue;
} }
@ -538,7 +545,7 @@ class DemoModelImport extends JModelLegacy
$fields[] = $db->quoteName($target[$key]) . " = ''"; $fields[] = $db->quoteName($target[$key]) . " = ''";
} }
} }
// load the defautls // load the defaults
$fields[] = $db->quoteName('modified_by') . ' = ' . $db->quote($user->id); $fields[] = $db->quoteName('modified_by') . ' = ' . $db->quote($user->id);
$fields[] = $db->quoteName('modified') . ' = ' . $db->quote($todayDate); $fields[] = $db->quoteName('modified') . ' = ' . $db->quote($todayDate);
if (!$version) if (!$version)
@ -551,10 +558,8 @@ class DemoModelImport extends JModelLegacy
); );
$query->update($db->quoteName('#__demo_'.$table))->set($fields)->where($conditions); $query->update($db->quoteName('#__demo_'.$table))->set($fields)->where($conditions);
$db->setQuery($query); $db->setQuery($query);
$db->execute();
$db->query();
} }
elseif ($canCreate) elseif ($canCreate)
{ {
@ -567,33 +572,38 @@ class DemoModelImport extends JModelLegacy
// Insert columns. Insert values. // Insert columns. Insert values.
foreach($row as $key => $cell) foreach($row as $key => $cell)
{ {
// ignore column // ignore column
if ($target[$key] == 'IGNORE') if ('IGNORE' == $target[$key])
{ {
continue; continue;
} }
// remove id // remove id
if ($target[$key] == 'id') if ('id' == $target[$key])
{ {
continue; continue;
} }
// update created // update created
if ($target[$key] == 'created_by') if ('created_by' == $target[$key])
{ {
continue; continue;
} }
// update created // update created
if ($target[$key] == 'created') if ('created' == $target[$key])
{ {
continue; continue;
} }
// Make sure the alias is incremented
if ('alias' == $target[$key])
{
$cell = $this->getAlias($cell,$table);
}
// update version // update version
if ($target[$key] == 'version') if ('version' == $target[$key])
{ {
$cell = 1; $cell = 1;
$version = true; $version = true;
} }
// set to insert array // set to insert array
if(in_array($key, $data['target_headers']) && is_numeric($cell)) if(in_array($key, $data['target_headers']) && is_numeric($cell))
{ {
$columns[] = $target[$key]; $columns[] = $target[$key];
@ -628,16 +638,87 @@ class DemoModelImport extends JModelLegacy
->values(implode(',', $values)); ->values(implode(',', $values));
// Set the query using our newly populated query object and execute it. // Set the query using our newly populated query object and execute it.
$db->setQuery($query); $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 false;
} }
} }
return true; return true;
} }
} }
return false; 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 Vast Development Method
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015 @version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo @package Demo
@subpackage look.php @subpackage look.php
@author Llewellyn van der Merwe <https://www.vdm.io/> @author Llewellyn van der Merwe <https://www.vdm.io/>
@ -59,7 +61,7 @@ class DemoModelLook extends JModelAdmin
return JTable::getInstance($type, $prefix, $config); return JTable::getInstance($type, $prefix, $config);
} }
/** /**
* Method to get a single record. * Method to get a single record.
* *
* @param integer $pk The id of the primary key. * @param integer $pk The id of the primary key.
@ -109,8 +111,7 @@ class DemoModelLook extends JModelAdmin
* @since 1.6 * @since 1.6
*/ */
public function getForm($data = array(), $loadData = true) 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)); $form = $this->loadForm('com_demo.look', 'look', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form)) if (empty($form))
@ -241,10 +242,11 @@ class DemoModelLook extends JModelAdmin
protected function allowEdit($data = array(), $key = 'id') protected function allowEdit($data = array(), $key = 'id')
{ {
// Check specific edit permission then general edit permission. // 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); 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. * Prepare and sanitise the table data prior to saving.
* *
* @param JTable $table A JTable object. * @param JTable $table A JTable object.
@ -289,17 +291,17 @@ class DemoModelLook extends JModelAdmin
$table->ordering = $max + 1; $table->ordering = $max + 1;
} }
} }
else else
{ {
$table->modified = $date->toSql(); $table->modified = $date->toSql();
$table->modified_by = $user->id; $table->modified_by = $user->id;
} }
if (!empty($table->id)) if (!empty($table->id))
{ {
// Increment the items version number. // Increment the items version number.
$table->version++; $table->version++;
} }
} }
/** /**
@ -315,9 +317,9 @@ class DemoModelLook extends JModelAdmin
$data = JFactory::getApplication()->getUserState('com_demo.edit.look.data', array()); $data = JFactory::getApplication()->getUserState('com_demo.edit.look.data', array());
if (empty($data)) if (empty($data))
{ {
$data = $this->getItem(); $data = $this->getItem();
}; }
return $data; return $data;
} }
@ -396,21 +398,26 @@ class DemoModelLook extends JModelAdmin
if (empty($pks)) if (empty($pks))
{ {
$this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
return false; return false;
} }
$done = false; $done = false;
// Set some needed variables. // Set some needed variables.
$this->user = JFactory::getUser(); $this->user = JFactory::getUser();
$this->table = $this->getTable(); $this->table = $this->getTable();
$this->tableClassName = get_class($this->table); $this->tableClassName = get_class($this->table);
$this->contentType = new JUcmType; $this->contentType = new JUcmType;
$this->type = $this->contentType->getTypeByTable($this->tableClassName); $this->type = $this->contentType->getTypeByTable($this->tableClassName);
$this->canDo = DemoHelper::getActions('look'); $this->canDo = DemoHelper::getActions('look');
$this->batchSet = true; $this->batchSet = true;
if (!$this->canDo->get('core.batch'))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
return false;
}
if ($this->type == false) if ($this->type == false)
{ {
$type = new JUcmType; $type = new JUcmType;
@ -477,15 +484,15 @@ class DemoModelLook extends JModelAdmin
if (empty($this->batchSet)) if (empty($this->batchSet))
{ {
// Set some needed variables. // Set some needed variables.
$this->user = JFactory::getUser(); $this->user = JFactory::getUser();
$this->table = $this->getTable(); $this->table = $this->getTable();
$this->tableClassName = get_class($this->table); $this->tableClassName = get_class($this->table);
$this->contentType = new JUcmType; $this->contentType = new JUcmType;
$this->type = $this->contentType->getTypeByTable($this->tableClassName); $this->type = $this->contentType->getTypeByTable($this->tableClassName);
$this->canDo = DemoHelper::getActions('look'); $this->canDo = DemoHelper::getActions('look');
} }
if (!$this->canDo->get('core.create')) if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch'))
{ {
return false; return false;
} }
@ -515,6 +522,20 @@ class DemoModelLook extends JModelAdmin
$this->table->reset(); $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 // Check that the row actually exists
if (!$this->table->load($pk)) if (!$this->table->load($pk))
{ {
@ -612,15 +633,15 @@ class DemoModelLook extends JModelAdmin
if (empty($this->batchSet)) if (empty($this->batchSet))
{ {
// Set some needed variables. // Set some needed variables.
$this->user = JFactory::getUser(); $this->user = JFactory::getUser();
$this->table = $this->getTable(); $this->table = $this->getTable();
$this->tableClassName = get_class($this->table); $this->tableClassName = get_class($this->table);
$this->contentType = new JUcmType; $this->contentType = new JUcmType;
$this->type = $this->contentType->getTypeByTable($this->tableClassName); $this->type = $this->contentType->getTypeByTable($this->tableClassName);
$this->canDo = DemoHelper::getActions('look'); $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')); $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
return false; return false;
@ -662,12 +683,17 @@ class DemoModelLook extends JModelAdmin
} }
} }
// insert all set values // insert all set values.
if (DemoHelper::checkArray($values)) if (DemoHelper::checkArray($values))
{ {
foreach ($values as $key => $value) 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; $this->table->$key = $value;
} }
@ -714,15 +740,15 @@ class DemoModelLook extends JModelAdmin
*/ */
public function save($data) public function save($data)
{ {
$input = JFactory::getApplication()->input; $input = JFactory::getApplication()->input;
$filter = JFilterInput::getInstance(); $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'])) if (isset($data['metadata']) && isset($data['metadata']['author']))
{ {
$data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
$metadata = new JRegistry; $metadata = new JRegistry;
$metadata->loadArray($data['metadata']); $metadata->loadArray($data['metadata']);
$data['metadata'] = (string) $metadata; $data['metadata'] = (string) $metadata;
} }

View File

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

View File

@ -3,7 +3,9 @@
Vast Development Method Vast Development Method
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015 @version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo @package Demo
@subpackage help_document.php @subpackage help_document.php
@author Llewellyn van der Merwe <https://www.vdm.io/> @author Llewellyn van der Merwe <https://www.vdm.io/>
@ -53,7 +55,7 @@ class DemoTableHelp_document extends JTable
public function bind($array, $ignore = '') 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 = new JRegistry;
$registry->loadArray($array['params']); $registry->loadArray($array['params']);
@ -69,14 +71,14 @@ class DemoTableHelp_document extends JTable
// Bind the rules. // Bind the rules.
if (isset($array['rules']) && is_array($array['rules'])) if (isset($array['rules']) && is_array($array['rules']))
{ {
$rules = new JAccessRules($array['rules']); $rules = new JAccessRules($array['rules']);
$this->setRules($rules); $this->setRules($rules);
} }
return parent::bind($array, $ignore); return parent::bind($array, $ignore);
} }
/** /**
* Overload the store method for the Help_document table. * Overload the store method for the Help_document table.
* *
* @param boolean Toggle whether null values should be updated. * @param boolean Toggle whether null values should be updated.
@ -108,33 +110,33 @@ class DemoTableHelp_document extends JTable
} }
} }
if (isset($this->alias)) if (isset($this->alias))
{ {
// Verify that the alias is unique // Verify that the alias is unique
$table = JTable::getInstance('help_document', 'DemoTable'); $table = JTable::getInstance('help_document', 'DemoTable');
if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
{ {
$this->setError(JText::_('COM_DEMO_HELP_DOCUMENT_ERROR_UNIQUE_ALIAS')); $this->setError(JText::_('COM_DEMO_HELP_DOCUMENT_ERROR_UNIQUE_ALIAS'));
return false; return false;
} }
} }
if (isset($this->url)) if (isset($this->url))
{ {
// Convert IDN urls to punycode // Convert IDN urls to punycode
$this->url = JStringPunycode::urlToPunycode($this->url); $this->url = JStringPunycode::urlToPunycode($this->url);
} }
if (isset($this->website)) if (isset($this->website))
{ {
// Convert IDN urls to punycode // Convert IDN urls to punycode
$this->website = JStringPunycode::urlToPunycode($this->website); $this->website = JStringPunycode::urlToPunycode($this->website);
} }
return parent::store($updateNulls); return parent::store($updateNulls);
} }
/** /**
* Overloaded check method to ensure data integrity. * Overloaded check method to ensure data integrity.
* *
* @return boolean True on success. * @return boolean True on success.
@ -146,7 +148,7 @@ class DemoTableHelp_document extends JTable
// Generate a valid alias // Generate a valid alias
$this->generateAlias(); $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)) 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); $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 we don't have any access rules set at this point just use an empty JAccessRules class
if (!$this->getRules()) if (!$this->getRules())
{ {
$rules = $this->getDefaultAssetValues('com_demo'); $rules = $this->getDefaultAssetValues('com_demo.help_document.'.$this->id);
$this->setRules($rules); $this->setRules($rules);
} }
// Set ordering // Set ordering
if ($this->published < 0) if ($this->published < 0)
{ {
// Set ordering to 0 if state is archived or trashed // 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 * @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. // Need to find the asset id by the name of the component.
$db = JFactory::getDbo(); $db = JFactory::getDbo();
@ -225,9 +227,54 @@ class DemoTableHelp_document extends JTable
->from($db->quoteName('#__assets')) ->from($db->quoteName('#__assets'))
->where($db->quoteName('name') . ' = ' . $db->quote($component)); ->where($db->quoteName('name') . ' = ' . $db->quote($component));
$db->setQuery($query); $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() 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 * @return int
* @since 2.5 * @since 2.5
*/ */
protected function _getAssetParentId($table = null, $id = null) protected function _getAssetParentId(JTable $table = NULL, $id = NULL)
{ {
$asset = JTable::getInstance('Asset'); $asset = JTable::getInstance('Asset');
$asset->loadByName('com_demo'); $asset->loadByName('com_demo');

View File

@ -3,7 +3,9 @@
Vast Development Method Vast Development Method
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015 @version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo @package Demo
@subpackage look.php @subpackage look.php
@author Llewellyn van der Merwe <https://www.vdm.io/> @author Llewellyn van der Merwe <https://www.vdm.io/>
@ -53,7 +55,7 @@ class DemoTableLook extends JTable
public function bind($array, $ignore = '') 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 = new JRegistry;
$registry->loadArray($array['params']); $registry->loadArray($array['params']);
@ -69,14 +71,14 @@ class DemoTableLook extends JTable
// Bind the rules. // Bind the rules.
if (isset($array['rules']) && is_array($array['rules'])) if (isset($array['rules']) && is_array($array['rules']))
{ {
$rules = new JAccessRules($array['rules']); $rules = new JAccessRules($array['rules']);
$this->setRules($rules); $this->setRules($rules);
} }
return parent::bind($array, $ignore); return parent::bind($array, $ignore);
} }
/** /**
* Overload the store method for the Look table. * Overload the store method for the Look table.
* *
* @param boolean Toggle whether null values should be updated. * @param boolean Toggle whether null values should be updated.
@ -108,33 +110,33 @@ class DemoTableLook extends JTable
} }
} }
if (isset($this->alias)) if (isset($this->alias))
{ {
// Verify that the alias is unique // Verify that the alias is unique
$table = JTable::getInstance('look', 'DemoTable'); $table = JTable::getInstance('look', 'DemoTable');
if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
{ {
$this->setError(JText::_('COM_DEMO_LOOK_ERROR_UNIQUE_ALIAS')); $this->setError(JText::_('COM_DEMO_LOOK_ERROR_UNIQUE_ALIAS'));
return false; return false;
} }
} }
if (isset($this->url)) if (isset($this->url))
{ {
// Convert IDN urls to punycode // Convert IDN urls to punycode
$this->url = JStringPunycode::urlToPunycode($this->url); $this->url = JStringPunycode::urlToPunycode($this->url);
} }
if (isset($this->website)) if (isset($this->website))
{ {
// Convert IDN urls to punycode // Convert IDN urls to punycode
$this->website = JStringPunycode::urlToPunycode($this->website); $this->website = JStringPunycode::urlToPunycode($this->website);
} }
return parent::store($updateNulls); return parent::store($updateNulls);
} }
/** /**
* Overloaded check method to ensure data integrity. * Overloaded check method to ensure data integrity.
* *
* @return boolean True on success. * @return boolean True on success.
@ -146,7 +148,7 @@ class DemoTableLook extends JTable
// Generate a valid alias // Generate a valid alias
$this->generateAlias(); $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)) 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); $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 we don't have any access rules set at this point just use an empty JAccessRules class
if (!$this->getRules()) if (!$this->getRules())
{ {
$rules = $this->getDefaultAssetValues('com_demo'); $rules = $this->getDefaultAssetValues('com_demo.look.'.$this->id);
$this->setRules($rules); $this->setRules($rules);
} }
// Set ordering // Set ordering
if ($this->published < 0) if ($this->published < 0)
{ {
// Set ordering to 0 if state is archived or trashed // 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 * @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. // Need to find the asset id by the name of the component.
$db = JFactory::getDbo(); $db = JFactory::getDbo();
@ -225,9 +227,54 @@ class DemoTableLook extends JTable
->from($db->quoteName('#__assets')) ->from($db->quoteName('#__assets'))
->where($db->quoteName('name') . ' = ' . $db->quote($component)); ->where($db->quoteName('name') . ' = ' . $db->quote($component));
$db->setQuery($query); $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() protected function _getAssetTitle()
{ {
return $this->title; if (isset($this->title))
{
return $this->title;
}
return '';
} }
/** /**
@ -261,7 +312,7 @@ class DemoTableLook extends JTable
* @return int * @return int
* @since 2.5 * @since 2.5
*/ */
protected function _getAssetParentId($table = null, $id = null) protected function _getAssetParentId(JTable $table = NULL, $id = NULL)
{ {
$asset = JTable::getInstance('Asset'); $asset = JTable::getInstance('Asset');
$asset->loadByName('com_demo'); $asset->loadByName('com_demo');

View File

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

View File

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

View File

@ -3,7 +3,9 @@
Vast Development Method Vast Development Method
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015 @version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo @package Demo
@subpackage default_vdm.php @subpackage default_vdm.php
@author Llewellyn van der Merwe <https://www.vdm.io/> @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_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_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_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 JText::_('COM_DEMO_LICENSE'); ?>:</b> <?php echo $manifest->license; ?></li>
<li><b><?php echo $manifest->copyright; ?></b></li> <li><b><?php echo $manifest->copyright; ?></b></li>
</ul> </ul>

View File

@ -3,7 +3,9 @@
Vast Development Method Vast Development Method
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015 @version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo @package Demo
@subpackage view.html.php @subpackage view.html.php
@author Llewellyn van der Merwe <https://www.vdm.io/> @author Llewellyn van der Merwe <https://www.vdm.io/>
@ -35,13 +37,13 @@ class DemoViewDemo extends JViewLegacy
{ {
// Check for errors. // Check for errors.
if (count($errors = $this->get('Errors'))) if (count($errors = $this->get('Errors')))
{ {
JError::raiseError(500, implode('<br />', $errors)); JError::raiseError(500, implode('<br />', $errors));
return false; return false;
}; };
// Assign data to the view // Assign data to the view
$this->icons = $this->get('Icons'); $this->icons = $this->get('Icons');
$this->contributors = $this->get('Contributors'); $this->contributors = DemoHelper::getContributors();
// Set the toolbar // Set the toolbar
$this->addToolBar(); $this->addToolBar();
@ -61,18 +63,17 @@ class DemoViewDemo extends JViewLegacy
$canDo = DemoHelper::getActions('demo'); $canDo = DemoHelper::getActions('demo');
JToolBarHelper::title(JText::_('COM_DEMO_DASHBOARD'), 'grid-2'); JToolBarHelper::title(JText::_('COM_DEMO_DASHBOARD'), 'grid-2');
if ($canDo->get('core.admin') || $canDo->get('core.options')) // set help url for this view if found
{ $help_url = DemoHelper::getHelpUrl('demo');
JToolBarHelper::divider(); if (DemoHelper::checkString($help_url))
JToolBarHelper::preferences('com_demo'); {
};
// 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); JToolbarHelper::help('COM_DEMO_HELP_MANAGER', false, $help_url);
} }
if ($canDo->get('core.admin') || $canDo->get('core.options'))
{
JToolBarHelper::preferences('com_demo');
}
} }
/** /**

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,9 @@
Vast Development Method Vast Development Method
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015 @version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo @package Demo
@subpackage view.html.php @subpackage view.html.php
@author Llewellyn van der Merwe <https://www.vdm.io/> @author Llewellyn van der Merwe <https://www.vdm.io/>
@ -41,10 +43,10 @@ class DemoViewHelp_documents extends JViewLegacy
// Check for errors. // Check for errors.
if (count($errors = $this->get('Errors'))) if (count($errors = $this->get('Errors')))
{ {
JError::raiseError(500, implode('<br />', $errors)); JError::raiseError(500, implode('<br />', $errors));
return false; return false;
}; }
// Assign data to the view // Assign data to the view
$this->items = $this->get('Items'); $this->items = $this->get('Items');
@ -54,23 +56,24 @@ class DemoViewHelp_documents extends JViewLegacy
$this->listOrder = $this->escape($this->state->get('list.ordering')); $this->listOrder = $this->escape($this->state->get('list.ordering'));
$this->listDirn = $this->escape($this->state->get('list.direction')); $this->listDirn = $this->escape($this->state->get('list.direction'));
$this->saveOrder = $this->listOrder == 'ordering'; $this->saveOrder = $this->listOrder == 'ordering';
// get global action permissions // get global action permissions
$this->canDo = DemoHelper::getActions('help_document'); $this->canDo = DemoHelper::getActions('help_document');
$this->canEdit = $this->canDo->get('help_document.edit'); $this->canEdit = $this->canDo->get('help_document.edit');
$this->canState = $this->canDo->get('help_document.edit.state'); $this->canState = $this->canDo->get('help_document.edit.state');
$this->canCreate = $this->canDo->get('help_document.create'); $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. // We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal') if ($this->getLayout() !== 'modal')
{ {
$this->addToolbar(); $this->addToolbar();
$this->sidebar = JHtmlSidebar::render(); $this->sidebar = JHtmlSidebar::render();
// load the batch html // load the batch html
if ($this->canCreate && $this->canEdit && $this->canState) if ($this->canCreate && $this->canEdit && $this->canState)
{ {
$this->batchDisplay = JHtmlBatch_::render(); $this->batchDisplay = JHtmlBatch_::render();
} }
} }
// Display the template // Display the template
@ -85,100 +88,98 @@ class DemoViewHelp_documents extends JViewLegacy
*/ */
protected function addToolBar() protected function addToolBar()
{ {
JToolBarHelper::title(JText::_('COM_DEMO_HELP_DOCUMENTS'), 'joomla'); JToolBarHelper::title(JText::_('COM_DEMO_HELP_DOCUMENTS'), 'support');
JHtmlSidebar::setAction('index.php?option=com_demo&view=help_documents'); 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) if ($this->canCreate)
{ {
JToolBarHelper::addNew('help_document.add'); JToolBarHelper::addNew('help_document.add');
} }
// Only load if there are items // Only load if there are items
if (DemoHelper::checkArray($this->items)) if (DemoHelper::checkArray($this->items))
{ {
if ($this->canEdit) if ($this->canEdit)
{ {
JToolBarHelper::editList('help_document.edit'); JToolBarHelper::editList('help_document.edit');
} }
if ($this->canState) if ($this->canState)
{ {
JToolBarHelper::divider(); JToolBarHelper::publishList('help_documents.publish');
JToolBarHelper::unpublishList('help_documents.unpublish');
JToolBarHelper::archiveList('help_documents.archive');
JToolBarHelper::publishList('help_documents.publish'); if ($this->canDo->get('core.admin'))
JToolBarHelper::unpublishList('help_documents.unpublish'); {
JToolBarHelper::checkin('help_documents.checkin');
}
}
JToolBarHelper::divider(); // Add a batch button
JToolBarHelper::archiveList('help_documents.archive'); 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->canDo->get('core.admin')) if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{ {
JToolBarHelper::checkin('help_documents.checkin'); JToolbarHelper::deleteList('', 'help_documents.delete', 'JTOOLBAR_EMPTY_TRASH');
} }
} elseif ($this->canState && $this->canDelete)
{
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) JToolbarHelper::trash('help_documents.trash');
{ }
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->canDo->get('core.export') && $this->canDo->get('help_document.export')) if ($this->canDo->get('core.export') && $this->canDo->get('help_document.export'))
{ {
JToolBarHelper::custom('help_documents.exportData', 'download', '', 'COM_DEMO_EXPORT_DATA', true); JToolBarHelper::custom('help_documents.exportData', 'download', '', 'COM_DEMO_EXPORT_DATA', true);
} }
} }
if ($this->canDo->get('core.import') && $this->canDo->get('help_document.import')) if ($this->canDo->get('core.import') && $this->canDo->get('help_document.import'))
{ {
JToolBarHelper::custom('help_documents.importData', 'upload', '', 'COM_DEMO_IMPORT_DATA', false); JToolBarHelper::custom('help_documents.importData', 'upload', '', 'COM_DEMO_IMPORT_DATA', false);
} }
JToolBarHelper::divider(); // 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->canDo->get('core.admin') || $this->canDo->get('core.options')) // add the options comp button
{ if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
JToolBarHelper::preferences('com_demo'); {
} JToolBarHelper::preferences('com_demo');
}
// set help url for this view if found if ($this->canState)
$help_url = DemoHelper::getHelpUrl('help_documents'); {
if (DemoHelper::checkString($help_url))
{
JToolbarHelper::help('COM_DEMO_HELP_MANAGER', false, $help_url);
}
if ($this->canState)
{
JHtmlSidebar::addFilter( JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_PUBLISHED'), JText::_('JOPTION_SELECT_PUBLISHED'),
'filter_published', 'filter_published',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true)
); );
// only load if batch allowed
JHtmlBatch_::addListSelection( if ($this->canBatch)
JText::_('COM_DEMO_KEEP_ORIGINAL_STATE'), {
'batch[published]', JHtmlBatch_::addListSelection(
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) JText::_('COM_DEMO_KEEP_ORIGINAL_STATE'),
); 'batch[published]',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
);
}
} }
JHtmlSidebar::addFilter( JHtmlSidebar::addFilter(
@ -187,14 +188,14 @@ class DemoViewHelp_documents extends JViewLegacy
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('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( JHtmlBatch_::addListSelection(
JText::_('COM_DEMO_KEEP_ORIGINAL_ACCESS'), JText::_('COM_DEMO_KEEP_ORIGINAL_ACCESS'),
'batch[access]', 'batch[access]',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text')
); );
} }
// Set Type Selection // Set Type Selection
$this->typeOptions = $this->getTheTypeSelections(); $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')) 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( JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_DEMO_HELP_DOCUMENT_TYPE_LABEL').' -', '- Keep Original '.JText::_('COM_DEMO_HELP_DOCUMENT_TYPE_LABEL').' -',
'batch[type]', 'batch[type]',
@ -229,9 +230,9 @@ class DemoViewHelp_documents extends JViewLegacy
JHtml::_('select.options', $this->locationOptions, 'value', 'text', $this->state->get('filter.location')) 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( JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_DEMO_HELP_DOCUMENT_LOCATION_LABEL').' -', '- Keep Original '.JText::_('COM_DEMO_HELP_DOCUMENT_LOCATION_LABEL').' -',
'batch[location]', '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')) 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( JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_DEMO_HELP_DOCUMENT_ADMIN_VIEW_LABEL').' -', '- Keep Original '.JText::_('COM_DEMO_HELP_DOCUMENT_ADMIN_VIEW_LABEL').' -',
'batch[admin_view]', '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')) 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( JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_DEMO_HELP_DOCUMENT_SITE_VIEW_LABEL').' -', '- Keep Original '.JText::_('COM_DEMO_HELP_DOCUMENT_SITE_VIEW_LABEL').' -',
'batch[site_view]', 'batch[site_view]',
@ -297,7 +298,7 @@ class DemoViewHelp_documents extends JViewLegacy
$document->addStyleSheet(JURI::root() . "administrator/components/com_demo/assets/css/help_documents.css"); $document->addStyleSheet(JURI::root() . "administrator/components/com_demo/assets/css/help_documents.css");
} }
/** /**
* Escapes a value for output in a view script. * Escapes a value for output in a view script.
* *
* @param mixed $var The output to escape. * @param mixed $var The output to escape.
@ -308,10 +309,10 @@ class DemoViewHelp_documents extends JViewLegacy
{ {
if(strlen($var) > 50) 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); 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); return DemoHelper::htmlEscape($var, $this->_charset);
} }
@ -355,7 +356,7 @@ class DemoViewHelp_documents extends JViewLegacy
if ($results) if ($results)
{ {
// get model // get model
$model = &$this->getModel(); $model = $this->getModel();
$results = array_unique($results); $results = array_unique($results);
$filter = array(); $filter = array();
foreach ($results as $type) foreach ($results as $type)
@ -391,7 +392,7 @@ class DemoViewHelp_documents extends JViewLegacy
if ($results) if ($results)
{ {
// get model // get model
$model = &$this->getModel(); $model = $this->getModel();
$results = array_unique($results); $results = array_unique($results);
$filter = array(); $filter = array();
foreach ($results as $location) foreach ($results as $location)

View File

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

View File

@ -3,7 +3,9 @@
Vast Development Method Vast Development Method
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015 @version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo @package Demo
@subpackage view.html.php @subpackage view.html.php
@author Llewellyn van der Merwe <https://www.vdm.io/> @author Llewellyn van der Merwe <https://www.vdm.io/>
@ -45,7 +47,7 @@ class DemoViewImport extends JViewLegacy
if (count($errors = $this->get('Errors'))){ if (count($errors = $this->get('Errors'))){
JError::raiseError(500, implode('<br />', $errors)); JError::raiseError(500, implode('<br />', $errors));
return false; return false;
}; }
$paths = new stdClass; $paths = new stdClass;
$paths->first = ''; $paths->first = '';
@ -53,7 +55,7 @@ class DemoViewImport extends JViewLegacy
$this->paths = &$paths; $this->paths = &$paths;
$this->state = &$state; $this->state = &$state;
// get global action permissions // get global action permissions
$this->canDo = DemoHelper::getActions('import'); $this->canDo = DemoHelper::getActions('import');
// We don't need toolbar in the modal window. // We don't need toolbar in the modal window.
@ -64,7 +66,7 @@ class DemoViewImport extends JViewLegacy
} }
// get the session object // get the session object
$session =& JFactory::getSession(); $session = JFactory::getSession();
// check if it has package // check if it has package
$this->hasPackage = $session->get('hasPackage', false); $this->hasPackage = $session->get('hasPackage', false);
$this->dataType = $session->get('dataType', false); $this->dataType = $session->get('dataType', false);
@ -94,10 +96,10 @@ class DemoViewImport extends JViewLegacy
} }
// set help url for this view if found // set help url for this view if found
$help_url = DemoHelper::getHelpUrl('import'); $help_url = DemoHelper::getHelpUrl('import');
if (DemoHelper::checkString($help_url)) if (DemoHelper::checkString($help_url))
{ {
JToolbarHelper::help('COM_DEMO_HELP_MANAGER', false, $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 Vast Development Method
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015 @version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo @package Demo
@subpackage submitbutton.js @subpackage submitbutton.js
@author Llewellyn van der Merwe <https://www.vdm.io/> @author Llewellyn van der Merwe <https://www.vdm.io/>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade"> <extension type="component" version="3.2" method="upgrade">
<name>COM_DEMO</name> <name>COM_DEMO</name>
<creationDate>24th August, 2015</creationDate> <creationDate>5th August, 2015</creationDate>
<author>Llewellyn van der Merwe</author> <author>Llewellyn van der Merwe</author>
<authorEmail>info@vdm.io</authorEmail> <authorEmail>info@vdm.io</authorEmail>
<authorUrl>https://www.vdm.io/</authorUrl> <authorUrl>https://www.vdm.io/</authorUrl>
<copyright>Copyright (C) 2015. All Rights Reserved</copyright> <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> <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[ <description><![CDATA[
<h1>Demo (v.1.0.3)</h1> <h1>Demo (v.1.0.4)</h1>
<div style="clear: both;"></div> <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> <p>Created by <a href="https://www.vdm.io/" target="_blank">Llewellyn van der Merwe</a>
]]></description> ]]></description>
@ -36,7 +36,7 @@
<filename>index.html</filename> <filename>index.html</filename>
<folder>js</folder> <folder>js</folder>
<folder>css</folder> <folder>css</folder>
<folder>images</folder>###EXSTRA_MEDIA_FOLDERS### <folder>images</folder>
</media> </media>
<!-- Update Schema; New in Joomla 2.5 --> <!-- Update Schema; New in Joomla 2.5 -->
@ -53,6 +53,7 @@
<filename>demo.php</filename> <filename>demo.php</filename>
<folder>assets</folder> <folder>assets</folder>
<folder>helpers</folder> <folder>helpers</folder>
<folder>controllers</folder>
<folder>models</folder> <folder>models</folder>
<folder>views</folder> <folder>views</folder>
<folder>layouts</folder> <folder>layouts</folder>

View File

@ -3,7 +3,9 @@
Vast Development Method Vast Development Method
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015 @version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo @package Demo
@subpackage script.php @subpackage script.php
@author Llewellyn van der Merwe <https://www.vdm.io/> @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. // little notice as after service, in case of bad experience with component.
echo '<h2>Did something go wrong? Are you disappointed?</h2> 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>. <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 />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 />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>'; <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) function preflight($type, $parent)
{ {
if ($type == 'uninstall') if ($type == 'uninstall')
{ {
return true; return true;
} }
$app = JFactory::getApplication(); $app = JFactory::getApplication();
$jversion = new JVersion(); $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'); $app->enqueueMessage('Please upgrade to at least Joomla! 3.4.1 before continuing!', 'error');
return false; return false;
} }
@ -288,9 +291,9 @@ class com_demoInstallerScript
*/ */
function postflight($type, $parent) function postflight($type, $parent)
{ {
//set the default component settings // set the default component settings
if ($type == 'install') if ($type == 'install')
{ {
// Get The Database object // Get The Database object
@ -337,6 +340,17 @@ class com_demoInstallerScript
$query->update($db->quoteName('#__extensions'))->set($fields)->where($conditions); $query->update($db->quoteName('#__extensions'))->set($fields)->where($conditions);
$db->setQuery($query); $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 Vast Development Method
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015 @version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo @package Demo
@subpackage controller.php @subpackage controller.php
@author Llewellyn van der Merwe <https://www.vdm.io/> @author Llewellyn van der Merwe <https://www.vdm.io/>
@ -27,5 +29,68 @@ jimport('joomla.application.component.controller');
*/ */
class DemoController extends JControllerLegacy 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 Vast Development Method
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015 @version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo @package Demo
@subpackage demo.php @subpackage demo.php
@author Llewellyn van der Merwe <https://www.vdm.io/> @author Llewellyn van der Merwe <https://www.vdm.io/>
@ -21,10 +23,12 @@ defined('_JEXEC') or die('Restricted access');
// Set the component css/js // Set the component css/js
$document = JFactory::getDocument(); $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('DemoHelper', dirname(__FILE__) . '/helpers/demo.php');
JLoader::register('DemoHelperRoute', dirname(__FILE__) . '/helpers/route.php'); ###SITE_GLOBAL_EVENT###
// import joomla controller library // import joomla controller library
jimport('joomla.application.component.controller'); jimport('joomla.application.component.controller');

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -3,9 +3,11 @@
Vast Development Method Vast Development Method
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015 @version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo @package Demo
@subpackage router.php @subpackage route.php
@author Llewellyn van der Merwe <https://www.vdm.io/> @author Llewellyn van der Merwe <https://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved @copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @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 * @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; $id = $catid->id;
$category = $catid; $category = $catid;
@ -73,9 +75,9 @@ abstract class DemoHelperRoute
{ {
$db = JFactory::getDbo(); $db = JFactory::getDbo();
$query = $db->getQuery(true) $query = $db->getQuery(true)
->select('a.sef AS sef') ->select('a.sef AS sef')
->select('a.lang_code AS lang_code') ->select('a.lang_code AS lang_code')
->from('#__languages AS a'); ->from('#__languages AS a');
$db->setQuery($query); $db->setQuery($query);
$langs = $db->loadObjectList(); $langs = $db->loadObjectList();
@ -113,31 +115,29 @@ abstract class DemoHelperRoute
} }
} }
} }
return $link; return $link;
} }
protected static function _findItem($needles = null, $identifier = 'id') protected static function _findItem($needles = null,$type = null)
{ {
$app = JFactory::getApplication(); $app = JFactory::getApplication();
$menus = $app->getMenu('site'); $menus = $app->getMenu('site');
$language = isset($needles['language']) ? $needles['language'] : '*';
$language = isset($needles['language']) ? $needles['language'] : '*';
// Prepare the reverse lookup array. // Prepare the reverse lookup array.
if (!isset(self::$lookup[$language])) if (!isset(self::$lookup[$language]))
{ {
self::$lookup[$language] = array(); self::$lookup[$language] = array();
$component = JComponentHelper::getComponent('com_demo'); $component = JComponentHelper::getComponent('com_demo');
$attributes = array('component_id'); $attributes = array('component_id');
$values = array($component->id); $values = array($component->id);
if ($language != '*') if ($language != '*')
{ {
$attributes[] = 'language'; $attributes[] = 'language';
$values[] = array($needles['language'], '*'); $values[] = array($needles['language'], '*');
} }
$items = $menus->getItems($attributes, $values); $items = $menus->getItems($attributes, $values);
@ -147,28 +147,28 @@ abstract class DemoHelperRoute
if (isset($item->query) && isset($item->query['view'])) if (isset($item->query) && isset($item->query['view']))
{ {
$view = $item->query['view']; $view = $item->query['view'];
if (!isset(self::$lookup[$language][$view])) if (!isset(self::$lookup[$language][$view]))
{ {
self::$lookup[$language][$view] = array(); self::$lookup[$language][$view] = array();
} }
if (isset($item->query[$identifier]))
{
// here it will become a bit tricky if (isset($item->query['id']))
// language != * can override existing entries {
// language == * cannot override existing entries /**
if (!isset(self::$lookup[$language][$view][$item->query[$identifier]]) || $item->language != '*') * 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['id']] = $item->id;
self::$lookup[$language][$view][$item->query[$identifier]] = $item->id;
}
} }
} }
} }
} }
} }
if ($needles) if ($needles)
{ {
foreach ($needles as $view => $ids) foreach ($needles as $view => $ids)
@ -179,23 +179,36 @@ abstract class DemoHelperRoute
{ {
if (isset(self::$lookup[$language][$view][(int) $id])) 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(); $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; return $active->id;
} }
// if not found, return language specific home link // If not found, return language specific home link
$default = $menus->getDefault($language); $default = $menus->getDefault($language);
return !empty($default->id) ? $default->id : null; 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 Vast Development Method
/-------------------------------------------------------------------------------------------------------/ /-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015 @version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo @package Demo
@subpackage router.php @subpackage router.php
@author Llewellyn van der Merwe <https://www.vdm.io/> @author Llewellyn van der Merwe <https://www.vdm.io/>
@ -19,35 +21,174 @@
// No direct access to this file // No direct access to this file
defined('_JEXEC') or die('Restricted access'); 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) function DemoBuildRoute(&$query)
{ {
$segments = array(); $router = new DemoRouter;
if(isset($query['view'])) return $router->build($query);
{
$segments[] = $query['view'];
unset($query['view']);
};
if(isset($query['id']))
{
$segments[] = $query['id'];
unset($query['id']);
};
return $segments;
} }
function DemoParseRoute($segments) function DemoParseRoute($segments)
{ {
$vars = array(); $router = new ContentRouter;
// Count segments
$count = count($segments);
//Handle View and Identifier
switch($segments[0])
{
} return $router->parse($segments);
return $vars;
} }