@my wife Roline van der Merwe
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
Builds Complex Joomla Components
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Compiler class
*/
class Fields extends Structure
{
/**
* Metadate Switch
*
* @var array
*/
public $metadataBuilder = array();
/**
* View access Switch
*
* @var array
*/
public $accessBuilder = array();
/**
* edit view tabs counter
*
* @var array
*/
public $tabCounter = array();
/**
* layout builder
*
* @var array
*/
public $layoutBuilder = array();
/**
* Site field data
*
* @var array
*/
public $siteFieldData = array();
/**
* Category other name bucket
*
* @var array
*/
public $catOtherName = array();
/**
* list of fields that are not being escaped
*
* @var array
*/
public $doNotEscape = array();
/**
* tags builder
*
* @var array
*/
public $tagsBuilder = array();
/**
* query builder
*
* @var array
*/
public $queryBuilder = array();
/**
* unique keys for database field
*
* @var array
*/
public $dbUniqueKeys = array();
/**
* keys for database field
*
* @var array
*/
public $dbKeys = array();
/**
* history builder
*
* @var array
*/
public $historyBuilder = array();
/**
* alias builder
*
* @var array
*/
public $aliasBuilder = array();
/**
* title builder
*
* @var array
*/
public $titleBuilder = array();
/**
* list builder
*
* @var array
*/
public $listBuilder = array();
/**
* custom Builder List
*
* @var array
*/
public $customBuilderList = array();
/**
* Hidden Fields Builder
*
* @var array
*/
public $hiddenFieldsBuilder = array();
/**
* INT Field Builder
*
* @var array
*/
public $intFieldsBuilder = array();
/**
* Dynamic Fields Builder
*
* @var array
*/
public $dynamicfieldsBuilder = array();
/**
* Main text Builder
*
* @var array
*/
public $maintextBuilder = array();
/**
* Custom Builder
*
* @var array
*/
public $customBuilder = array();
/**
* Custom Field Links Builder
*
* @var array
*/
public $customFieldLinksBuilder = array();
/**
* Set Script for User Switch
*
* @var array
*/
public $setScriptUserSwitch = array();
/**
* Set Script for Media Switch
*
* @var array
*/
public $setScriptMediaSwitch = array();
/**
* Category builder
*
* @var array
*/
public $categoryBuilder = array();
/**
* Category Code builder
*
* @var array
*/
public $catCodeBuilder = array();
/**
* Check Box builder
*
* @var array
*/
public $checkboxBuilder = array();
/**
* Json String Builder
*
* @var array
*/
public $jsonStringBuilder = array();
/**
* Json Item Builder
*
* @var array
*/
public $jsonItemBuilder = array();
/**
* Base 64 Builder
*
* @var array
*/
public $base64Builder = array();
/**
* Basic Encryption Builder
*
* @var array
*/
public $basicEncryptionBuilder = array();
/**
* Advnaced Encryption Builder
*
* @var array
*/
public $advancedEncryptionBuilder = array();
/**
* Get Items Method List String Fix Builder
*
* @var array
*/
public $getItemsMethodListStringFixBuilder = array();
/**
* Get Items Method Eximport String Fix Builder
*
* @var array
*/
public $getItemsMethodEximportStringFixBuilder = array();
/**
* Selection Translation Fix Builder
*
* @var array
*/
public $selectionTranslationFixBuilder = array();
/**
* Sort Builder
*
* @var array
*/
public $sortBuilder = array();
/**
* Search Builder
*
* @var array
*/
public $searchBuilder = array();
/**
* Filter Builder
*
* @var array
*/
public $filterBuilder = array();
/**
* Set Group Control
*
* @var array
*/
public $setGroupControl = array();
/**
* set the Field set of a view
*
* @param array $view The view data
* @param string $component The component name
*
* @return string The fields set in xml
*
*/
public function setFieldSet($view, $component)
{
// setup the fieldset of this view
if (isset($view['settings']->fields) && ComponentbuilderHelper::checkArray($view['settings']->fields))
{
// setup the list view and single view name
$listViewName = ComponentbuilderHelper::safeString($view['settings']->name_list);
$viewName = ComponentbuilderHelper::safeString($view['settings']->name_single);
// add metadata to the view
if ($view['metadata'])
{
$this->metadataBuilder[$viewName] = $viewName;
}
// add access to the view
if ($view['access'])
{
$this->accessBuilder[$viewName] = $viewName;
}
// set the read only
$readOnly = "";
if ($view['settings']->type == 2)
{
$readOnly = "\n\t\t\t" . 'readonly="true"' . "\n\t\t\t" . 'disabled="true"';
}
// main lang prefix
$langView = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($view['settings']->name_single, 'U');
$langViews = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($view['settings']->name_list, 'U');
// set default lang
$this->langContent[$this->lang][$langView] = $view['settings']->name_single;
$this->langContent[$this->lang][$langViews] = $view['settings']->name_list;
// set the singel name
$viewSingleName = ComponentbuilderHelper::safeString($view['settings']->name_single, 'W');
// set global item strings
$this->langContent[$this->lang][$langViews . '_N_ITEMS_ARCHIVED'] = "%s " . $view['settings']->name_list . " archived.";
$this->langContent[$this->lang][$langViews . '_N_ITEMS_ARCHIVED_1'] = "%s " . $view['settings']->name_single . " archived.";
$this->langContent[$this->lang][$langViews . '_N_ITEMS_CHECKED_IN_0'] = "No " . $view['settings']->name_single . " successfully checked in.";
$this->langContent[$this->lang][$langViews . '_N_ITEMS_CHECKED_IN_1'] = "%d " . $view['settings']->name_single . " successfully checked in.";
$this->langContent[$this->lang][$langViews . '_N_ITEMS_CHECKED_IN_MORE'] = "%d " . $view['settings']->name_list . " successfully checked in.";
$this->langContent[$this->lang][$langViews . '_N_ITEMS_DELETED'] = "%s " . $view['settings']->name_list . " deleted.";
$this->langContent[$this->lang][$langViews . '_N_ITEMS_DELETED_1'] = "%s " . $view['settings']->name_single . " deleted.";
$this->langContent[$this->lang][$langViews . '_N_ITEMS_FEATURED'] = "%s " . $view['settings']->name_list . " featured.";
$this->langContent[$this->lang][$langViews . '_N_ITEMS_FEATURED_1'] = "%s " . $view['settings']->name_single . " featured.";
$this->langContent[$this->lang][$langViews . '_N_ITEMS_PUBLISHED'] = "%s " . $view['settings']->name_list . " published.";
$this->langContent[$this->lang][$langViews . '_N_ITEMS_PUBLISHED_1'] = "%s " . $view['settings']->name_single . " published.";
$this->langContent[$this->lang][$langViews . '_N_ITEMS_TRASHED'] = "%s " . $view['settings']->name_list . " trashed.";
$this->langContent[$this->lang][$langViews . '_N_ITEMS_TRASHED_1'] = "%s " . $view['settings']->name_single . " trashed.";
$this->langContent[$this->lang][$langViews . '_N_ITEMS_UNFEATURED'] = "%s " . $view['settings']->name_list . " unfeatured.";
$this->langContent[$this->lang][$langViews . '_N_ITEMS_UNFEATURED_1'] = "%s " . $view['settings']->name_single . " unfeatured.";
$this->langContent[$this->lang][$langViews . '_N_ITEMS_UNPUBLISHED'] = "%s " . $view['settings']->name_list . " unpublished.";
$this->langContent[$this->lang][$langViews . '_N_ITEMS_UNPUBLISHED_1'] = "%s " . $view['settings']->name_single . " unpublished.";
$this->langContent[$this->lang][$langViews . '_BATCH_OPTIONS'] = "Batch process the selected " . $view['settings']->name_list;
$this->langContent[$this->lang][$langViews . '_BATCH_TIP'] = "All changes will be applied to all selected " . $view['settings']->name_list;
// set some basic defaults
$this->langContent[$this->lang][$langView . '_ERROR_UNIQUE_ALIAS'] = "Another " . $view['settings']->name_single . " has the same alias.";
$this->langContent[$this->lang][$langView . '_CREATED_DATE_LABEL'] = "Created date";
$this->langContent[$this->lang][$langView . '_CREATED_DATE_DESC'] = "The date " . $view['settings']->name_single . " was created.";
$this->langContent[$this->lang][$langView . '_CREATED_BY_LABEL'] = "Created by";
$this->langContent[$this->lang][$langView . '_CREATED_BY_DESC'] = "The user that created the " . $view['settings']->name_single . ".";
$this->langContent[$this->lang][$langView . '_ORDERING_LABEL'] = "Ordering";
$this->langContent[$this->lang][$langView . '_VERSION_LABEL'] = "Revision";
$this->langContent[$this->lang][$langView . '_VERSION_DESC'] = "A count of the number of times this " . $view['settings']->name_single . " has been revised.";
$this->langContent[$this->lang][$langView . '_SAVE_WARNING'] = "Alias already existed so a number was added at the end. You can re-edit the " . $view['settings']->name_single . " to customise the alias.";
// set the defautl fields
$fieldSet = '
";
// check if metadata is added to this view
if (isset($this->metadataBuilder[$viewName]) && ComponentbuilderHelper::checkString($this->metadataBuilder[$viewName]))
{
$fieldSet .= "\n\n\t";
$fieldSet .= "\n\t';
$fieldSet .= "\n\t\t" . '