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

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

45
README.md Normal file
View File

@ -0,0 +1,45 @@
# Demo (1.0.4)
Just a basic demo of the most basic implementations of the [Joomla] (http://www.joomla.org) Component Builder's ability.
# Build Details
+ *Company*: [Vast Development Method] (https://www.vdm.io/)
+ *Author*: [Llewellyn van der Merwe] (mailto:info@vdm.io)
+ *Name*: [Demo] (https://www.vdm.io/)
+ *First Build*: 5th August, 2015
+ *Last Build*: 3rd December, 2015
+ *Version*: 1.0.4
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
## Build Time
**42 Hours** or **5 Eight Hour Days** (actual time the author saved -
due to [Automated Component Builder] (https://www.vdm.io/joomla-component-builder))
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> never making one mistake or taking any coffee break.)
+ *Line count*: **15117**
+ *File count*: **147**
+ *Folder count*: **50**
**28 Hours** or **4 Eight Hour Days** (the actual time the author spent)
> (with the following break down:
> **debugging @11hours** = codingtime / 4;
> **planning @6hours** = codingtime / 7;
> **mapping @4hours** = codingtime / 10;
> **office @7hours** = codingtime / 6;)
**70 Hours** or **9 Eight Hour Days**
(a total of the realistic time frame for this project)
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)
Project duration: **1.8 weeks** or **0.4 months**
> This **component** was build with a Joomla [Automated Component Builder] (https://www.vdm.io/joomla-component-builder).
> Developed by [Llewellyn van der Merwe] (mailto:joomla@vdm.io)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage help.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -67,7 +69,9 @@ class DemoControllerHelp extends JControllerLegacy
}
break;
}
} else {
}
else
{
// stop execution gracefully
jexit();
}
@ -80,7 +84,6 @@ class DemoControllerHelp extends JControllerLegacy
$query->select(array('a.title','a.content'));
$query->from('#__demo_help_document AS a');
$query->where('a.id = '.(int) $id);
$query->where('a.location = 1');
$query->where('a.published = 1');
$db->setQuery($query);
$db->execute();

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage help_document.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -53,10 +55,9 @@ class DemoControllerHelp_document extends JControllerForm
*/
protected function allowAdd($data = array())
{
// Access check.
$accessAdmin = JFactory::getUser()->authorise('help_document.access', 'com_demo');
if (!$accessAdmin && !is_null($accessAdmin))
$access = JFactory::getUser()->authorise('help_document.access', 'com_demo');
if (!$access)
{
return false;
}
@ -81,10 +82,10 @@ class DemoControllerHelp_document extends JControllerForm
// get record id.
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
// Access check.
$access = $user->authorise('help_document.access', 'com_demo.help_document.' . (int) $recordId);
$accessAdmin = $user->authorise('help_document.access', 'com_demo');
if ((!$access && !is_null($access)) || (!$accessAdmin && !is_null($accessAdmin)))
$access = ($user->authorise('help_document.access', 'com_demo.help_document.' . (int) $recordId) && $user->authorise('help_document.access', 'com_demo'));
if (!$access)
{
return false;
}

View File

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

View File

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

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage look.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -52,8 +54,7 @@ class DemoControllerLook extends JControllerForm
* @since 1.6
*/
protected function allowAdd($data = array())
{
// In the absense of better information, revert to the component permissions.
{ // In the absense of better information, revert to the component permissions.
return parent::allowAdd($data);
}
@ -74,6 +75,7 @@ class DemoControllerLook extends JControllerForm
// get record id.
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
if ($recordId)
{
// The record has been set. Check the record permissions.

View File

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

View File

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

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage demo.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -33,13 +35,51 @@ abstract class DemoHelper
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;
}
/**
* Load the Component Help URLs.
**/
public static function getHelpUrl($view)
{
$user = JFactory::getUser();
$groups = $user->getAuthorisedGroups();
$groups = $user->get('groups');
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select(array('a.id','a.groups','a.target','a.type','a.article','a.url'));
@ -115,7 +155,7 @@ abstract class DemoHelper
// 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_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');
}
@ -256,7 +296,7 @@ abstract class DemoHelper
// make sure the file is loaded
JLoader::import('PHPExcel', JPATH_COMPONENT_ADMINISTRATOR . '/helpers');
// get session object
$session =& JFactory::getSession();
$session = JFactory::getSession();
$package = $session->get('package', null);
$package = json_decode($package, true);
// set the headers
@ -290,6 +330,76 @@ $headers = array();
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 = ", ")
{
// check if string is JSON
@ -563,6 +673,120 @@ $headers = array();
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()
{
$args = func_get_args();
@ -614,6 +838,23 @@ $headers = array();
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)
{
if (self::checkString($string))
@ -726,254 +967,117 @@ $headers = array();
public static function replaceNumbers($string)
{
// remove all numbers and replace with english text version (works well only up to a thousand)
if (strcspn($string, '0123456789') != strlen($string))
// set numbers array
$numbers = array();
// first get all numbers
preg_match_all('!\d+!', $string, $numbers);
// check if we have any numbers
if (isset($numbers[0]) && self::checkArray($numbers[0]))
{
$replace = array(
'one thousand', 'nine hundred ninety nine','nine hundred ninety eight','nine hundred ninety seven','nine hundred ninety six','nine hundred ninety five',
'nine hundred ninety four','nine hundred ninety three','nine hundred ninety two','nine hundred ninety one','nine hundred ninety',
'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',
'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',
'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',
'nine hundred fifty nine','nine hundred fifty eight','nine hundred fifty seven','nine hundred fifty six','nine hundred fifty five',
'nine hundred fifty four','nine hundred fifty three','nine hundred fifty two','nine hundred fifty one','nine hundred fifty',
'nine hundred forty nine','nine hundred forty eight','nine hundred forty seven','nine hundred forty six','nine hundred forty five',
'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);
foreach ($numbers[0] as $number)
{
$searchReplace[$number] = self::numberToString((int)$number);
}
// now replace numbers in string
$string = str_replace(array_keys($searchReplace), array_values($searchReplace),$string);
// check if we missed any, strange if we did.
return self::replaceNumbers($string);
}
// return the string with no numbers remaining.
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
*

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage demo.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -40,9 +42,14 @@ class DemoModelDemo extends JModelList
);
// view access array
$viewAccess = array(
'looks.submenu' => 'look.submenu',
'looks.dashboard_list' => 'look.dashboard_list',
'look.dashboard_add' => 'look.dashboard_add',
'help_document.create' => 'help_document.create',
'help_documents.access' => 'help_document.access',
'help_document.access' => 'help_document.access');
'help_document.access' => 'help_document.access',
'help_documents.submenu' => 'help_document.submenu',
'help_documents.dashboard_list' => 'help_document.dashboard_list');
foreach($viewGroups as $group => $views)
{
$i = 0;
@ -53,7 +60,16 @@ class DemoModelDemo extends JModelList
$add = false;
if (strpos($view,'.') !== false)
{
list($type, $name, $action) = explode('.', $view);
$dwd = explode('.', $view);
if (count($dwd) == 3)
{
list($type, $name, $action) = $dwd;
}
elseif (count($dwd) == 2)
{
list($type, $name) = $dwd;
$action = false;
}
if ($action)
{
$viewName = $name;
@ -96,11 +112,17 @@ class DemoModelDemo extends JModelList
// 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']);
// 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)
{
@ -115,10 +137,19 @@ class DemoModelDemo extends JModelList
{
$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'))
if($user->authorise($accessAdd, 'com_demo') && $user->authorise($accessTo, 'com_demo') && $dashboard_add)
{
$icons[$group][$i] = new StdClass;
$icons[$group][$i]->url = $url;
@ -130,7 +161,7 @@ class DemoModelDemo extends JModelList
elseif (DemoHelper::checkString($accessTo))
{
// check access
if($user->authorise($accessTo, 'com_demo'))
if($user->authorise($accessTo, 'com_demo') && $dashboard_list)
{
$icons[$group][$i] = new StdClass;
$icons[$group][$i]->url = $url;
@ -142,7 +173,7 @@ class DemoModelDemo extends JModelList
elseif (DemoHelper::checkString($accessAdd))
{
// check access
if($user->authorise($accessAdd, 'com_demo'))
if($user->authorise($accessAdd, 'com_demo') && $dashboard_add)
{
$icons[$group][$i] = new StdClass;
$icons[$group][$i]->url = $url;
@ -178,39 +209,4 @@ class DemoModelDemo extends JModelList
}
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
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage articles.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -34,6 +36,50 @@ class JFormFieldArticles extends JFormFieldList
* @var string
*/
public $type = 'articles';
/**
* Override to add new button
*
* @return string The field input markup.
*
* @since 3.2
*/
protected function getInput()
{
// see if we should add buttons
$setButton = $this->getAttribute('button');
// get html
$html = parent::getInput();
// if true set button
if ($setButton === 'true')
{
$user = JFactory::getUser();
// only add if user allowed to create article
if ($user->authorise('core.create', 'com_demo'))
{
// get the input from url
$jinput = JFactory::getApplication()->input;
// get the view name & id
$values = $jinput->getArray(array(
'id' => 'int',
'view' => 'word'
));
// check if new item
$ref = '';
if (!is_null($values['id']) && strlen($values['view']))
{
// only load referal if not new item.
$ref = '&amp;ref=' . $values['view'] . '&amp;refid=' . $values['id'];
}
// build the button
$button = '<a class="btn btn-small btn-success"
href="index.php?option=com_demo&amp;view=article&amp;layout=edit'.$ref.'" >
<span class="icon-new icon-white"></span>' . JText::_('COM_DEMO_NEW') . '</a>';
// return the button attached to input field
return $html . $button;
}
}
return $html;
}
/**
* Method to get a list of options for a list input.

View File

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

View File

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

View File

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

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage help_document.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -90,10 +92,8 @@ class DemoModelHelp_document extends JModelAdmin
if (!empty($item->groups))
{
// Convert the groups field to an array.
$groups = new Registry;
$groups->loadString($item->groups);
$item->groups = $groups->toArray();
// JSON Decode groups.
$item->groups = json_decode($item->groups,true);
}
if (!empty($item->id))
@ -117,8 +117,7 @@ class DemoModelHelp_document extends JModelAdmin
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
{ // Get the form.
$form = $this->loadForm('com_demo.help_document', 'help_document', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form))
@ -250,6 +249,7 @@ class DemoModelHelp_document extends JModelAdmin
{
// Check specific edit permission then general edit permission.
$user = JFactory::getUser();
return $user->authorise('help_document.edit', 'com_demo.help_document.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('help_document.edit', 'com_demo');
}
@ -326,7 +326,7 @@ class DemoModelHelp_document extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
};
}
return $data;
}
@ -405,7 +405,6 @@ class DemoModelHelp_document extends JModelAdmin
if (empty($pks))
{
$this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
return false;
}
@ -420,6 +419,12 @@ class DemoModelHelp_document extends JModelAdmin
$this->canDo = DemoHelper::getActions('help_document');
$this->batchSet = true;
if (!$this->canDo->get('core.batch'))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
return false;
}
if ($this->type == false)
{
$type = new JUcmType;
@ -494,7 +499,7 @@ class DemoModelHelp_document extends JModelAdmin
$this->canDo = DemoHelper::getActions('help_document');
}
if (!$this->canDo->get('help_document.create'))
if (!$this->canDo->get('help_document.create') && !$this->canDo->get('help_document.batch'))
{
return false;
}
@ -524,6 +529,20 @@ class DemoModelHelp_document extends JModelAdmin
$this->table->reset();
// only allow copy if user may edit this item.
if (!$this->user->authorise('help_document.edit', $contexts[$pk]))
{
// Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
// Check that the row actually exists
if (!$this->table->load($pk))
{
@ -629,7 +648,7 @@ class DemoModelHelp_document extends JModelAdmin
$this->canDo = DemoHelper::getActions('help_document');
}
if (!$this->canDo->get('help_document.edit'))
if (!$this->canDo->get('help_document.edit') && !$this->canDo->get('help_document.batch'))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
return false;
@ -671,12 +690,17 @@ class DemoModelHelp_document extends JModelAdmin
}
}
// insert all set values
// insert all set values.
if (DemoHelper::checkArray($values))
{
foreach ($values as $key => $value)
{
if (strlen($value) > 0 && isset($this->table->$key))
// Do special action for access.
if ('access' == $key && strlen($value) > 0)
{
$this->table->$key = $value;
}
elseif (strlen($value) > 0 && isset($this->table->$key))
{
$this->table->$key = $value;
}
@ -736,17 +760,10 @@ class DemoModelHelp_document extends JModelAdmin
$data['metadata'] = (string) $metadata;
}
// Set the groups items to data.
if (isset($data['groups']) && is_array($data['groups']))
// Set the groups string to JSON string.
if (isset($data['groups']))
{
$groups = new JRegistry;
$groups->loadArray($data['groups']);
$data['groups'] = (string) $groups;
}
elseif (!isset($data['groups']))
{
// Set the empty items to data
$data['groups'] = '';
$data['groups'] = (string) json_encode($data['groups']);
}
// Set the Params Items to data

View File

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

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage import.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -82,7 +84,7 @@ class DemoModelImport extends JModelLegacy
{
$this->setState('action', 'import');
$app = JFactory::getApplication();
$session =& JFactory::getSession();
$session = JFactory::getSession();
$package = null;
$continue = false;
// get import type
@ -226,7 +228,7 @@ class DemoModelImport extends JModelLegacy
// Was the package downloaded?
if (!$p_file)
{
$session =& JFactory::getSession();
$session = JFactory::getSession();
$session->clear('package');
$session->clear('dataType');
$session->clear('hasPackage');
@ -383,9 +385,12 @@ class DemoModelImport extends JModelLegacy
$package = $config->get('tmp_path'). '/' .$package;
// Is the package file a valid file?
if (is_file($package)) {
if (is_file($package))
{
JFile::delete($package);
} elseif (is_file(JPath::clean($package))) {
}
elseif (is_file(JPath::clean($package)))
{
// It might also be just a base filename
JFile::delete(JPath::clean($package));
}
@ -411,7 +416,8 @@ class DemoModelImport extends JModelLegacy
$data['target_headers'][$header] = $jinput->getString($header, null);
}
// set the data
if(isset($package['dir'])){
if(isset($package['dir']))
{
$inputFileType = PHPExcel_IOFactory::identify($package['dir']);
$excelReader = PHPExcel_IOFactory::createReader($inputFileType);
$excelReader->setReadDataOnly(true);
@ -467,6 +473,7 @@ class DemoModelImport extends JModelLegacy
$canEdit = $canDo->get('core.edit');
$canState = $canDo->get('core.edit.state');
$canCreate = $canDo->get('core.create');
$hasAlias = $this->getAliasesUsed($table);
// prosses the data
foreach($data['array'] as $row)
{
@ -498,28 +505,28 @@ class DemoModelImport extends JModelLegacy
foreach($row as $key => $cell)
{
// ignore column
if ($target[$key] == 'IGNORE')
if ('IGNORE' == $target[$key])
{
continue;
}
// update modified
if ($target[$key] == 'modified_by')
if ('modified_by' == $target[$key])
{
continue;
}
// update modified
if ($target[$key] == 'modified')
if ('modified' == $target[$key])
{
continue;
}
// update version
if ($target[$key] == 'version')
if ('version' == $target[$key])
{
$cell = (int) $version + 1;
$version = true;
}
// verfy publish autority
if ($target[$key] == 'published' && !$canState)
// verify publish authority
if ('published' == $target[$key] && !$canState)
{
continue;
}
@ -538,7 +545,7 @@ class DemoModelImport extends JModelLegacy
$fields[] = $db->quoteName($target[$key]) . " = ''";
}
}
// load the defautls
// load the defaults
$fields[] = $db->quoteName('modified_by') . ' = ' . $db->quote($user->id);
$fields[] = $db->quoteName('modified') . ' = ' . $db->quote($todayDate);
if (!$version)
@ -551,10 +558,8 @@ class DemoModelImport extends JModelLegacy
);
$query->update($db->quoteName('#__demo_'.$table))->set($fields)->where($conditions);
$db->setQuery($query);
$db->query();
$db->execute();
}
elseif ($canCreate)
{
@ -568,27 +573,32 @@ class DemoModelImport extends JModelLegacy
foreach($row as $key => $cell)
{
// ignore column
if ($target[$key] == 'IGNORE')
if ('IGNORE' == $target[$key])
{
continue;
}
// remove id
if ($target[$key] == 'id')
if ('id' == $target[$key])
{
continue;
}
// update created
if ($target[$key] == 'created_by')
if ('created_by' == $target[$key])
{
continue;
}
// update created
if ($target[$key] == 'created')
if ('created' == $target[$key])
{
continue;
}
// Make sure the alias is incremented
if ('alias' == $target[$key])
{
$cell = $this->getAlias($cell,$table);
}
// update version
if ($target[$key] == 'version')
if ('version' == $target[$key])
{
$cell = 1;
$version = true;
@ -628,7 +638,13 @@ class DemoModelImport extends JModelLegacy
->values(implode(',', $values));
// Set the query using our newly populated query object and execute it.
$db->setQuery($query);
$db->query();
$done = $db->execute();
if ($done)
{
$aId = $db->insertid();
// make sure the access of asset is set
DemoHelper::setAsset($aId,$table);
}
}
else
{
@ -640,4 +656,69 @@ class DemoModelImport extends JModelLegacy
}
return false;
}
protected function getAlias($name,$type = false)
{
// sanitize the name to an alias
if (JFactory::getConfig()->get('unicodeslugs') == 1)
{
$alias = JFilterOutput::stringURLUnicodeSlug($name);
}
else
{
$alias = JFilterOutput::stringURLSafe($name);
}
// must be a uniqe alias
if ($type)
{
return $this->getUniqe($alias,'alias',$type);
}
return $alias;
}
/**
* Method to generate a uniqe value.
*
* @param string $field name.
* @param string $value data.
* @param string $type table.
*
* @return string New value.
*/
protected function getUniqe($value,$field,$type)
{
// insure the filed is always uniqe
while (isset($this->uniqeValueArray[$type][$field][$value]))
{
$value = JString::increment($value, 'dash');
}
$this->uniqeValueArray[$type][$field][$value] = $value;
return $value;
}
protected function getAliasesUsed($table)
{
// Get a db connection.
$db = JFactory::getDbo();
// first we check if there is a alias column
$columns = $db->getTableColumns('#__demo_'.$table);
if(isset($columns['alias'])){
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName(array('alias')));
$query->from($db->quoteName('#__demo_'.$table));
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
$aliases = $db->loadColumn();
foreach($aliases as $alias)
{
$this->uniqeValueArray[$table]['alias'][$alias] = $alias;
}
}
return true;
}
return false;
}
}

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage look.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -109,8 +111,7 @@ class DemoModelLook extends JModelAdmin
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
{ // Get the form.
$form = $this->loadForm('com_demo.look', 'look', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form))
@ -241,6 +242,7 @@ class DemoModelLook extends JModelAdmin
protected function allowEdit($data = array(), $key = 'id')
{
// Check specific edit permission then general edit permission.
return JFactory::getUser()->authorise('core.edit', 'com_demo.look.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or parent::allowEdit($data, $key);
}
@ -317,7 +319,7 @@ class DemoModelLook extends JModelAdmin
if (empty($data))
{
$data = $this->getItem();
};
}
return $data;
}
@ -396,7 +398,6 @@ class DemoModelLook extends JModelAdmin
if (empty($pks))
{
$this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
return false;
}
@ -411,6 +412,12 @@ class DemoModelLook extends JModelAdmin
$this->canDo = DemoHelper::getActions('look');
$this->batchSet = true;
if (!$this->canDo->get('core.batch'))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
return false;
}
if ($this->type == false)
{
$type = new JUcmType;
@ -485,7 +492,7 @@ class DemoModelLook extends JModelAdmin
$this->canDo = DemoHelper::getActions('look');
}
if (!$this->canDo->get('core.create'))
if (!$this->canDo->get('core.create') || !$this->canDo->get('core.batch'))
{
return false;
}
@ -515,6 +522,20 @@ class DemoModelLook extends JModelAdmin
$this->table->reset();
// only allow copy if user may edit this item.
if (!$this->user->authorise('core.edit', $contexts[$pk]))
{
// Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
// Check that the row actually exists
if (!$this->table->load($pk))
{
@ -620,7 +641,7 @@ class DemoModelLook extends JModelAdmin
$this->canDo = DemoHelper::getActions('look');
}
if (!$this->canDo->get('core.edit'))
if (!$this->canDo->get('core.edit') && !$this->canDo->get('core.batch'))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
return false;
@ -662,12 +683,17 @@ class DemoModelLook extends JModelAdmin
}
}
// insert all set values
// insert all set values.
if (DemoHelper::checkArray($values))
{
foreach ($values as $key => $value)
{
if (strlen($value) > 0 && isset($this->table->$key))
// Do special action for access.
if ('access' == $key && strlen($value) > 0)
{
$this->table->$key = $value;
}
elseif (strlen($value) > 0 && isset($this->table->$key))
{
$this->table->$key = $value;
}

View File

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

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage help_document.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -195,7 +197,7 @@ class DemoTableHelp_document extends JTable
// If we don't have any access rules set at this point just use an empty JAccessRules class
if (!$this->getRules())
{
$rules = $this->getDefaultAssetValues('com_demo');
$rules = $this->getDefaultAssetValues('com_demo.help_document.'.$this->id);
$this->setRules($rules);
}
@ -216,7 +218,7 @@ class DemoTableHelp_document extends JTable
*
* @return JAccessRules The JAccessRules object for the asset
*/
protected function getDefaultAssetValues($component)
protected function getDefaultAssetValues($component, $try = true)
{
// Need to find the asset id by the name of the component.
$db = JFactory::getDbo();
@ -225,10 +227,55 @@ class DemoTableHelp_document extends JTable
->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();
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 $rules;
}
}
return $result;
}
}
return JAccess::getAssetRules(0);
}
/**
* Method to compute the default name of the asset.
@ -251,9 +298,13 @@ class DemoTableHelp_document extends JTable
* @since 2.5
*/
protected function _getAssetTitle()
{
if (isset($this->title))
{
return $this->title;
}
return '';
}
/**
* Get the parent asset id for the record
@ -261,7 +312,7 @@ class DemoTableHelp_document extends JTable
* @return int
* @since 2.5
*/
protected function _getAssetParentId($table = null, $id = null)
protected function _getAssetParentId(JTable $table = NULL, $id = NULL)
{
$asset = JTable::getInstance('Asset');
$asset->loadByName('com_demo');

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage look.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -195,7 +197,7 @@ class DemoTableLook extends JTable
// If we don't have any access rules set at this point just use an empty JAccessRules class
if (!$this->getRules())
{
$rules = $this->getDefaultAssetValues('com_demo');
$rules = $this->getDefaultAssetValues('com_demo.look.'.$this->id);
$this->setRules($rules);
}
@ -216,7 +218,7 @@ class DemoTableLook extends JTable
*
* @return JAccessRules The JAccessRules object for the asset
*/
protected function getDefaultAssetValues($component)
protected function getDefaultAssetValues($component, $try = true)
{
// Need to find the asset id by the name of the component.
$db = JFactory::getDbo();
@ -225,10 +227,55 @@ class DemoTableLook extends JTable
->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();
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 $rules;
}
}
return $result;
}
}
return JAccess::getAssetRules(0);
}
/**
* Method to compute the default name of the asset.
@ -251,9 +298,13 @@ class DemoTableLook extends JTable
* @since 2.5
*/
protected function _getAssetTitle()
{
if (isset($this->title))
{
return $this->title;
}
return '';
}
/**
* Get the parent asset id for the record
@ -261,7 +312,7 @@ class DemoTableLook extends JTable
* @return int
* @since 2.5
*/
protected function _getAssetParentId($table = null, $id = null)
protected function _getAssetParentId(JTable $table = NULL, $id = NULL)
{
$asset = JTable::getInstance('Asset');
$asset->loadByName('com_demo');

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage view.html.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -38,7 +40,7 @@ class DemoViewHelp_document extends JViewLegacy
{
JError::raiseError(500, implode('<br />', $errors));
return false;
};
}
// Assign the variables
$this->form = $this->get('Form');
@ -136,7 +138,8 @@ class DemoViewHelp_document extends JViewLegacy
JToolBarHelper::custom('help_document.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
if ($this->state->params->get('save_history', 1) && $this->canDo->get('help_document.edit'))
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('help_document.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('help_document.edit') && $canVersion)
{
JToolbarHelper::versions('com_demo.help_document', $this->item->id);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage view.html.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -44,7 +46,7 @@ class DemoViewHelp_documents extends JViewLegacy
{
JError::raiseError(500, implode('<br />', $errors));
return false;
};
}
// Assign data to the view
$this->items = $this->get('Items');
@ -60,6 +62,7 @@ class DemoViewHelp_documents extends JViewLegacy
$this->canState = $this->canDo->get('help_document.edit.state');
$this->canCreate = $this->canDo->get('help_document.create');
$this->canDelete = $this->canDo->get('help_document.delete');
$this->canBatch = $this->canDo->get('core.batch');
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
@ -85,7 +88,7 @@ class DemoViewHelp_documents extends JViewLegacy
*/
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');
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
@ -104,12 +107,8 @@ class DemoViewHelp_documents extends JViewLegacy
if ($this->canState)
{
JToolBarHelper::divider();
JToolBarHelper::publishList('help_documents.publish');
JToolBarHelper::unpublishList('help_documents.unpublish');
JToolBarHelper::divider();
JToolBarHelper::archiveList('help_documents.archive');
if ($this->canDo->get('core.admin'))
@ -118,17 +117,8 @@ class DemoViewHelp_documents extends JViewLegacy
}
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
JToolbarHelper::deleteList('', 'help_documents.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
JToolbarHelper::trash('help_documents.trash');
}
// Add a batch button
if ($this->canCreate && $this->canEdit && $this->canState)
if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState)
{
// Get the toolbar object instance
$bar = JToolBar::getInstance('toolbar');
@ -141,6 +131,15 @@ class DemoViewHelp_documents extends JViewLegacy
$bar->appendButton('Custom', $dhtml, 'batch');
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
JToolbarHelper::deleteList('', 'help_documents.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
JToolbarHelper::trash('help_documents.trash');
}
if ($this->canDo->get('core.export') && $this->canDo->get('help_document.export'))
{
JToolBarHelper::custom('help_documents.exportData', 'download', '', 'COM_DEMO_EXPORT_DATA', true);
@ -152,13 +151,6 @@ class DemoViewHelp_documents extends JViewLegacy
JToolBarHelper::custom('help_documents.importData', 'upload', '', 'COM_DEMO_IMPORT_DATA', false);
}
JToolBarHelper::divider();
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
JToolBarHelper::preferences('com_demo');
}
// set help url for this view if found
$help_url = DemoHelper::getHelpUrl('help_documents');
if (DemoHelper::checkString($help_url))
@ -166,6 +158,12 @@ class DemoViewHelp_documents extends JViewLegacy
JToolbarHelper::help('COM_DEMO_HELP_MANAGER', false, $help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
JToolBarHelper::preferences('com_demo');
}
if ($this->canState)
{
JHtmlSidebar::addFilter(
@ -173,13 +171,16 @@ class DemoViewHelp_documents extends JViewLegacy
'filter_published',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true)
);
// only load if batch allowed
if ($this->canBatch)
{
JHtmlBatch_::addListSelection(
JText::_('COM_DEMO_KEEP_ORIGINAL_STATE'),
'batch[published]',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
);
}
}
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_ACCESS'),
@ -187,7 +188,7 @@ class DemoViewHelp_documents extends JViewLegacy
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))
);
if ($this->canCreate && $this->canEdit)
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
JHtmlBatch_::addListSelection(
JText::_('COM_DEMO_KEEP_ORIGINAL_ACCESS'),
@ -207,9 +208,9 @@ class DemoViewHelp_documents extends JViewLegacy
JHtml::_('select.options', $this->typeOptions, 'value', 'text', $this->state->get('filter.type'))
);
if ($this->canCreate && $this->canEdit)
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Batch Selection
// Type Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_DEMO_HELP_DOCUMENT_TYPE_LABEL').' -',
'batch[type]',
@ -229,9 +230,9 @@ class DemoViewHelp_documents extends JViewLegacy
JHtml::_('select.options', $this->locationOptions, 'value', 'text', $this->state->get('filter.location'))
);
if ($this->canCreate && $this->canEdit)
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Batch Selection
// Location Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_DEMO_HELP_DOCUMENT_LOCATION_LABEL').' -',
'batch[location]',
@ -251,9 +252,9 @@ class DemoViewHelp_documents extends JViewLegacy
JHtml::_('select.options', $this->admin_viewOptions, 'value', 'text', $this->state->get('filter.admin_view'))
);
if ($this->canCreate && $this->canEdit)
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Batch Selection
// Admin View Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_DEMO_HELP_DOCUMENT_ADMIN_VIEW_LABEL').' -',
'batch[admin_view]',
@ -273,9 +274,9 @@ class DemoViewHelp_documents extends JViewLegacy
JHtml::_('select.options', $this->site_viewOptions, 'value', 'text', $this->state->get('filter.site_view'))
);
if ($this->canCreate && $this->canEdit)
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Batch Selection
// Site View Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_DEMO_HELP_DOCUMENT_SITE_VIEW_LABEL').' -',
'batch[site_view]',
@ -355,7 +356,7 @@ class DemoViewHelp_documents extends JViewLegacy
if ($results)
{
// get model
$model = &$this->getModel();
$model = $this->getModel();
$results = array_unique($results);
$filter = array();
foreach ($results as $type)
@ -391,7 +392,7 @@ class DemoViewHelp_documents extends JViewLegacy
if ($results)
{
// get model
$model = &$this->getModel();
$model = $this->getModel();
$results = array_unique($results);
$filter = array();
foreach ($results as $location)

View File

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

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage view.html.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -45,7 +47,7 @@ class DemoViewImport extends JViewLegacy
if (count($errors = $this->get('Errors'))){
JError::raiseError(500, implode('<br />', $errors));
return false;
};
}
$paths = new stdClass;
$paths->first = '';
@ -64,7 +66,7 @@ class DemoViewImport extends JViewLegacy
}
// get the session object
$session =& JFactory::getSession();
$session = JFactory::getSession();
// check if it has package
$this->hasPackage = $session->get('hasPackage', false);
$this->dataType = $session->get('dataType', false);

View File

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

View File

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

View File

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

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage view.html.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -38,7 +40,7 @@ class DemoViewLook extends JViewLegacy
{
JError::raiseError(500, implode('<br />', $errors));
return false;
};
}
// Assign the variables
$this->form = $this->get('Form');
@ -136,7 +138,8 @@ class DemoViewLook extends JViewLegacy
JToolBarHelper::custom('look.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
if ($this->state->params->get('save_history', 1) && $this->canDo->get(''))
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('look.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('') && $canVersion)
{
JToolbarHelper::versions('com_demo.look', $this->item->id);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage view.html.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -44,7 +46,7 @@ class DemoViewLooks extends JViewLegacy
{
JError::raiseError(500, implode('<br />', $errors));
return false;
};
}
// Assign data to the view
$this->items = $this->get('Items');
@ -60,6 +62,7 @@ class DemoViewLooks extends JViewLegacy
$this->canState = $this->canDo->get('core.edit.state');
$this->canCreate = $this->canDo->get('core.create');
$this->canDelete = $this->canDo->get('core.delete');
$this->canBatch = $this->canDo->get('core.batch');
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
@ -85,7 +88,7 @@ class DemoViewLooks extends JViewLegacy
*/
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');
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
@ -104,12 +107,8 @@ class DemoViewLooks extends JViewLegacy
if ($this->canState)
{
JToolBarHelper::divider();
JToolBarHelper::publishList('looks.publish');
JToolBarHelper::unpublishList('looks.unpublish');
JToolBarHelper::divider();
JToolBarHelper::archiveList('looks.archive');
if ($this->canDo->get('core.admin'))
@ -118,17 +117,8 @@ class DemoViewLooks extends JViewLegacy
}
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
JToolbarHelper::deleteList('', 'looks.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
JToolbarHelper::trash('looks.trash');
}
// Add a batch button
if ($this->canCreate && $this->canEdit && $this->canState)
if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState)
{
// Get the toolbar object instance
$bar = JToolBar::getInstance('toolbar');
@ -141,6 +131,15 @@ class DemoViewLooks extends JViewLegacy
$bar->appendButton('Custom', $dhtml, 'batch');
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
JToolbarHelper::deleteList('', 'looks.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
JToolbarHelper::trash('looks.trash');
}
if ($this->canDo->get('core.export') && $this->canDo->get('look.export'))
{
JToolBarHelper::custom('looks.exportData', 'download', '', 'COM_DEMO_EXPORT_DATA', true);
@ -152,13 +151,6 @@ class DemoViewLooks extends JViewLegacy
JToolBarHelper::custom('looks.importData', 'upload', '', 'COM_DEMO_IMPORT_DATA', false);
}
JToolBarHelper::divider();
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
JToolBarHelper::preferences('com_demo');
}
// set help url for this view if found
$help_url = DemoHelper::getHelpUrl('looks');
if (DemoHelper::checkString($help_url))
@ -166,6 +158,12 @@ class DemoViewLooks extends JViewLegacy
JToolbarHelper::help('COM_DEMO_HELP_MANAGER', false, $help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
JToolBarHelper::preferences('com_demo');
}
if ($this->canState)
{
JHtmlSidebar::addFilter(
@ -173,13 +171,16 @@ class DemoViewLooks extends JViewLegacy
'filter_published',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true)
);
// only load if batch allowed
if ($this->canBatch)
{
JHtmlBatch_::addListSelection(
JText::_('COM_DEMO_KEEP_ORIGINAL_STATE'),
'batch[published]',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
);
}
}
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_ACCESS'),
@ -187,7 +188,7 @@ class DemoViewLooks extends JViewLegacy
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access'))
);
if ($this->canCreate && $this->canEdit)
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
JHtmlBatch_::addListSelection(
JText::_('COM_DEMO_KEEP_ORIGINAL_ACCESS'),
@ -207,9 +208,9 @@ class DemoViewLooks extends JViewLegacy
JHtml::_('select.options', $this->addOptions, 'value', 'text', $this->state->get('filter.add'))
);
if ($this->canCreate && $this->canEdit)
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Batch Selection
// Add Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_DEMO_LOOK_ADD_LABEL').' -',
'batch[add]',
@ -229,9 +230,9 @@ class DemoViewLooks extends JViewLegacy
JHtml::_('select.options', $this->acronymOptions, 'value', 'text', $this->state->get('filter.acronym'))
);
if ($this->canCreate && $this->canEdit)
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Batch Selection
// Acronym Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_DEMO_LOOK_ACRONYM_LABEL').' -',
'batch[acronym]',
@ -311,7 +312,7 @@ class DemoViewLooks extends JViewLegacy
if ($results)
{
// get model
$model = &$this->getModel();
$model = $this->getModel();
$results = array_unique($results);
$filter = array();
foreach ($results as $add)

View File

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

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage script.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -275,7 +277,8 @@ class com_demoInstallerScript
$app = JFactory::getApplication();
$jversion = new JVersion();
if (!$jversion->isCompatible('3.4.1')) {
if (!$jversion->isCompatible('3.4.1'))
{
$app->enqueueMessage('Please upgrade to at least Joomla! 3.4.1 before continuing!', 'error');
return false;
}
@ -337,6 +340,17 @@ class com_demoInstallerScript
$query->update($db->quoteName('#__extensions'))->set($fields)->where($conditions);
$db->setQuery($query);
$allDone = $db->execute();
echo '<a target="_blank" href="https://www.vdm.io/" title="Demo">
<img src="components/com_demo/assets/images/component-300.jpg"/>
</a>';
}
// do any updates needed
if ($type == 'update')
{
echo '<a target="_blank" href="https://www.vdm.io/" title="Demo">
<img src="components/com_demo/assets/images/component-300.jpg"/>
</a>
<h3>Upgrade to Version (1.0.4) Was Successful!</h3>';
}
}
}

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

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

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

View File

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

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

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

View File

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

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage demo.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -23,7 +25,7 @@ defined('_JEXEC') or die('Restricted access');
* Demo component helper
*/
abstract class DemoHelper
{###SITE_CUSTOM_HELPER_SCRIPT###
{###SITE_GLOBAL_EVENT_HELPER### ###SITE_CUSTOM_HELPER_SCRIPT###
public static function jsonToString($value)
{
@ -53,10 +55,129 @@ abstract class DemoHelper
return $value;
}
/**
* Load the Component xml manifest.
**/
public static function manifest()
{
$manifestUrl = JPATH_ADMINISTRATOR."/components/com_demo/demo.xml";
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) == 2 || $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;
}
/**
* Load the Component Help URLs.
**/
public static function getHelpUrl($view)
{
$user = JFactory::getUser();
$groups = $user->get('groups');
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select(array('a.id','a.groups','a.target','a.type','a.article','a.url'));
$query->from('#__demo_help_document AS a');
$query->where('a.site_view = '.$db->quote($view));
$query->where('a.location = 2');
$query->where('a.published = 1');
$db->setQuery($query);
$db->execute();
if($db->getNumRows())
{
$helps = $db->loadObjectList();
if (self::checkArray($helps))
{
foreach ($helps as $nr => $help)
{
if ($help->target == 1)
{
$targetgroups = json_decode($help->groups, true);
if (!array_intersect($targetgroups, $groups))
{
// if user not in those target groups then remove the item
unset($helps[$nr]);
continue;
}
}
// set the return type
switch ($help->type)
{
// set joomla article
case 1:
return self::loadArticleLink($help->article);
break;
// set help text
case 2:
return self::loadHelpTextLink($help->id);
break;
// set Link
case 3:
return $help->url;
break;
}
}
}
}
return false;
}
/**
* Get the Article Link.
**/
protected static function loadArticleLink($id)
{
return JURI::root().'index.php?option=com_content&view=article&id='.$id.'&tmpl=component&layout=modal';
}
/**
* Get the Help Text Link.
**/
protected static function loadHelpTextLink($id)
{
$token = JSession::getFormToken();
return 'index.php?option=com_demo&task=help.getText&id=' . (int) $id . '&token=' . $token;
}
/**
* Get any component's model
**/
public static function getModel($name, $path = JPATH_COMPONENT_ADMINISTRATOR, $component = 'demo')
public static function getModel($name, $path = JPATH_COMPONENT_SITE, $component = 'demo')
{
// load some joomla helpers
JLoader::import('joomla.application.component.model');
@ -66,6 +187,122 @@ abstract class DemoHelper
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)
{
$this->setError($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()
{
$args = func_get_args();
@ -90,6 +327,268 @@ abstract class DemoHelper
}
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;
}
/**
* Get the actions permissions
**/
public static function getActions($view,&$record = null,$views = null)
{
jimport('joomla.access.access');
$user = JFactory::getUser();
$result = new JObject;
$view = self::safeString($view);
if (self::checkString($views))
{
$views = self::safeString($views);
}
// get all actions from component
$actions = JAccess::getActions('com_demo', 'component');
// set acctions only set in component settiongs
$componentActions = array('core.admin','core.manage','core.options','core.export');
// loop the actions and set the permissions
foreach ($actions as $action)
{
// set to use component default
$allow = true;
if (self::checkObject($record) && isset($record->id) && $record->id > 0 && !in_array($action->name,$componentActions))
{
// The record has been set. Check the record permissions.
$permission = $user->authorise($action->name, 'com_demo.'.$view.'.' . (int) $record->id);
if (!$permission && !is_null($permission))
{
if ($action->name == 'core.edit' || $action->name == $view.'.edit')
{
if ($user->authorise('core.edit.own', 'com_demo.'.$view.'.' . (int) $record->id))
{
// If the owner matches 'me' then allow.
if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id))
{
$result->set($action->name, true);
// set not to use component default
$allow = false;
}
else
{
$result->set($action->name, false);
// set not to use component default
$allow = false;
}
}
elseif ($user->authorise($view.'edit.own', 'com_demo.'.$view.'.' . (int) $record->id))
{
// If the owner matches 'me' then allow.
if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id))
{
$result->set($action->name, true);
// set not to use component default
$allow = false;
}
else
{
$result->set($action->name, false);
// set not to use component default
$allow = false;
}
}
elseif ($user->authorise('core.edit.own', 'com_demo'))
{
// If the owner matches 'me' then allow.
if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id))
{
$result->set($action->name, true);
// set not to use component default
$allow = false;
}
else
{
$result->set($action->name, false);
// set not to use component default
$allow = false;
}
}
elseif ($user->authorise($view.'edit.own', 'com_demo'))
{
// If the owner matches 'me' then allow.
if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id))
{
$result->set($action->name, true);
// set not to use component default
$allow = false;
}
else
{
$result->set($action->name, false);
// set not to use component default
$allow = false;
}
}
}
}
elseif (self::checkString($views) && isset($record->catid) && $record->catid > 0)
{
// make sure we use the core. action check for the categories
if (strpos($action->name,$view) !== false && strpos($action->name,'core.') === false ) {
$coreCheck = explode('.',$action->name);
$coreCheck[0] = 'core';
$categoryCheck = implode('.',$coreCheck);
}
else
{
$categoryCheck = $action->name;
}
// The record has a category. Check the category permissions.
$catpermission = $user->authorise($categoryCheck, 'com_demo.'.$views.'.category.' . (int) $record->catid);
if (!$catpermission && !is_null($catpermission))
{
if ($action->name == 'core.edit' || $action->name == $view.'.edit')
{
if ($user->authorise('core.edit.own', 'com_demo.'.$views.'.category.' . (int) $record->catid))
{
// If the owner matches 'me' then allow.
if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id))
{
$result->set($action->name, true);
// set not to use component default
$allow = false;
}
else
{
$result->set($action->name, false);
// set not to use component default
$allow = false;
}
}
elseif ($user->authorise($view.'edit.own', 'com_demo.'.$views.'.category.' . (int) $record->catid))
{
// If the owner matches 'me' then allow.
if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id))
{
$result->set($action->name, true);
// set not to use component default
$allow = false;
}
else
{
$result->set($action->name, false);
// set not to use component default
$allow = false;
}
}
elseif ($user->authorise('core.edit.own', 'com_demo'))
{
// If the owner matches 'me' then allow.
if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id))
{
$result->set($action->name, true);
// set not to use component default
$allow = false;
}
else
{
$result->set($action->name, false);
// set not to use component default
$allow = false;
}
}
elseif ($user->authorise($view.'edit.own', 'com_demo'))
{
// If the owner matches 'me' then allow.
if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id))
{
$result->set($action->name, true);
// set not to use component default
$allow = false;
}
else
{
$result->set($action->name, false);
// set not to use component default
$allow = false;
}
}
}
}
}
}
// if allowed then fall back on component global settings
if ($allow)
{
$result->set($action->name, $user->authorise($action->name, 'com_demo'));
}
}
return $result;
}
public static function checkObject($object)
{
if (isset($object) && is_object($object) && count($object) > 0)
@ -117,6 +616,23 @@ abstract class DemoHelper
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)
{
if (self::checkString($string))
@ -229,251 +745,132 @@ abstract class DemoHelper
public static function replaceNumbers($string)
{
// remove all numbers and replace with english text version (works well only up to a thousand)
if (strcspn($string, '0123456789') != strlen($string))
// set numbers array
$numbers = array();
// first get all numbers
preg_match_all('!\d+!', $string, $numbers);
// check if we have any numbers
if (isset($numbers[0]) && self::checkArray($numbers[0]))
{
$replace = array(
'one thousand', 'nine hundred ninety nine','nine hundred ninety eight','nine hundred ninety seven','nine hundred ninety six','nine hundred ninety five',
'nine hundred ninety four','nine hundred ninety three','nine hundred ninety two','nine hundred ninety one','nine hundred ninety',
'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',
'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',
'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',
'nine hundred fifty nine','nine hundred fifty eight','nine hundred fifty seven','nine hundred fifty six','nine hundred fifty five',
'nine hundred fifty four','nine hundred fifty three','nine hundred fifty two','nine hundred fifty one','nine hundred fifty',
'nine hundred forty nine','nine hundred forty eight','nine hundred forty seven','nine hundred forty six','nine hundred forty five',
'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);
foreach ($numbers[0] as $number)
{
$searchReplace[$number] = self::numberToString((int)$number);
}
// now replace numbers in string
$string = str_replace(array_keys($searchReplace), array_values($searchReplace),$string);
// check if we missed any, strange if we did.
return self::replaceNumbers($string);
}
// return the string with no numbers remaining.
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
*
* @returns a string
**/
public static function randomkey($size)
{
$bag = "abcefghijknopqrstuwxyzABCDDEFGHIJKLLMMNOPQRSTUVVWXYZabcddefghijkllmmnopqrstuvvwxyzABCEFGHIJKNOPQRSTUWXYZ";
$key = array();
$bagsize = strlen($bag) - 1;
for ($i = 0; $i < $size; $i++)
{
$get = rand(0, $bagsize);
$key[] = $bag[$get];
}
return implode($key);
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,9 @@
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.3 - 24th August, 2015
@version 1.0.4
@build 3rd December, 2015
@created 5th August, 2015
@package Demo
@subpackage router.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@ -19,35 +21,174 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
function DemoBuildRoute(&$query)
/**
* 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']))
{
$segments[] = $query['view'];
unset($query['view']);
};
$view = $query['view'];
if(isset($query['id']))
if (empty($query['Itemid']))
{
$segments[] = $query['id'];
unset($query['id']);
};
$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;
}
function DemoParseRoute($segments)
if (isset($view) && isset($query['id']) && 0)
{
$vars = array();
// Count segments
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)
{
$router = new DemoRouter;
return $router->build($query);
}
function DemoParseRoute($segments)
{
$router = new ContentRouter;
return $router->parse($segments);
}