Library manager implementation #195
@ -362,10 +362,11 @@ class Fields extends Structure {
|
|||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private function setLine($nr) {
|
private function setLine($nr)
|
||||||
|
{
|
||||||
if ($this->debugLinenr)
|
if ($this->debugLinenr)
|
||||||
{
|
{
|
||||||
return ' [Fields ' . $nr . ']';
|
return ' [Fields '.$nr.']';
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@ -379,7 +380,8 @@ class Fields extends Structure {
|
|||||||
* @return string The fields set in xml
|
* @return string The fields set in xml
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function setFieldSet($view, $component) {
|
public function setFieldSet($view, $component)
|
||||||
|
{
|
||||||
// setup the fieldset of this view
|
// setup the fieldset of this view
|
||||||
if (isset($view['settings']->fields) && ComponentbuilderHelper::checkArray($view['settings']->fields))
|
if (isset($view['settings']->fields) && ComponentbuilderHelper::checkArray($view['settings']->fields))
|
||||||
{
|
{
|
||||||
@ -478,69 +480,70 @@ class Fields extends Structure {
|
|||||||
// set the default fields
|
// set the default fields
|
||||||
$XML = new simpleXMLElement('<a/>');
|
$XML = new simpleXMLElement('<a/>');
|
||||||
$fieldSetXML = $XML->addChild('fieldset');
|
$fieldSetXML = $XML->addChild('fieldset');
|
||||||
$fieldSetXML->addAttribute('name','details');
|
$fieldSetXML->addAttribute('name', 'details');
|
||||||
$this->xmlComment($fieldSetXML,$this->setLine(__LINE__) . " Default Fields.");
|
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Default Fields.");
|
||||||
$this->xmlComment($fieldSetXML,$this->setLine(__LINE__) . " Id Field. Type: Text (joomla)");
|
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Id Field. Type: Text (joomla)");
|
||||||
// if id is not set
|
// if id is not set
|
||||||
if (!isset($this->fieldsNames[$viewName]['id']))
|
if (!isset($this->fieldsNames[$viewName]['id']))
|
||||||
{
|
{
|
||||||
$attributes = array(
|
$attributes = array(
|
||||||
'type'=>'text',
|
'type' => 'text',
|
||||||
'class'=>'readonly',
|
'class' => 'readonly',
|
||||||
'label'=>'JGLOBAL_FIELD_ID_LABEL',
|
'label' => 'JGLOBAL_FIELD_ID_LABEL',
|
||||||
'description'=>'JGLOBAL_FIELD_ID_DESC',
|
'description' => 'JGLOBAL_FIELD_ID_DESC',
|
||||||
'size'=>10,
|
'size' => 10,
|
||||||
'default'=>0
|
'default' => 0
|
||||||
);
|
);
|
||||||
$fieldXML = $fieldSetXML->addChild('field');
|
$fieldXML = $fieldSetXML->addChild('field');
|
||||||
$this->xmlAddAttributes($fieldXML,$attributes);
|
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||||
}
|
}
|
||||||
// if created is not set
|
// if created is not set
|
||||||
if (!isset($this->fieldsNames[$viewName]['created']))
|
if (!isset($this->fieldsNames[$viewName]['created']))
|
||||||
{
|
{
|
||||||
$attributes = array(
|
$attributes = array(
|
||||||
'name'=>'created',
|
'name' => 'created',
|
||||||
'type'=>'calendar',
|
'type' => 'calendar',
|
||||||
'label'=>$langView . '_CREATED_DATE_LABEL',
|
'label' => $langView . '_CREATED_DATE_LABEL',
|
||||||
'description'=>$langView . '_CREATED_DATE_DESC',
|
'description' => $langView . '_CREATED_DATE_DESC',
|
||||||
'size'=>22,
|
'size' => 22,
|
||||||
'format'=>'%Y-%m-%d %H:%M:%S',
|
'format' => '%Y-%m-%d %H:%M:%S',
|
||||||
'filter'=>'user_utc'
|
'filter' => 'user_utc'
|
||||||
);
|
);
|
||||||
$attributes = array_merge($attributes,$readOnlyXML);
|
$attributes = array_merge($attributes, $readOnlyXML);
|
||||||
$this->xmlComment($fieldSetXML,$this->setLine(__LINE__) . " Date Created Field. Type: Calendar (joomla)");
|
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Date Created Field. Type: Calendar (joomla)");
|
||||||
$fieldXML = $fieldSetXML->addChild('field');
|
$fieldXML = $fieldSetXML->addChild('field');
|
||||||
$this->xmlAddAttributes($fieldXML,$attributes);
|
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||||
}
|
}
|
||||||
// if created_by is not set
|
// if created_by is not set
|
||||||
if (!isset($this->fieldsNames[$viewName]['created_by']))
|
if (!isset($this->fieldsNames[$viewName]['created_by']))
|
||||||
{
|
{
|
||||||
$attributes = array(
|
$attributes = array(
|
||||||
'name'=>'created_by',
|
'name' => 'created_by',
|
||||||
'type'=>'user',
|
'type' => 'user',
|
||||||
'label'=>$langView . '_CREATED_BY_LABEL',
|
'label' => $langView . '_CREATED_BY_LABEL',
|
||||||
'description'=>$langView . '_CREATED_BY_DESC',
|
'description' => $langView . '_CREATED_BY_DESC',
|
||||||
);
|
);
|
||||||
$attributes = array_merge($attributes,$readOnlyXML);
|
$attributes = array_merge($attributes, $readOnlyXML);
|
||||||
$this->xmlComment($fieldSetXML,$this->setLine(__LINE__) . " User Created Field. Type: User (joomla)");
|
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " User Created Field. Type: User (joomla)");
|
||||||
$fieldXML = $fieldSetXML->addChild('field');
|
$fieldXML = $fieldSetXML->addChild('field');
|
||||||
$this->xmlAddAttributes($fieldXML,$attributes);
|
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||||
}
|
}
|
||||||
// if published is not set
|
// if published is not set
|
||||||
if (!isset($this->fieldsNames[$viewName]['published']))
|
if (!isset($this->fieldsNames[$viewName]['published']))
|
||||||
{
|
{
|
||||||
$attributes = array(
|
$attributes = array(
|
||||||
'name'=>'published',
|
'name' => 'published',
|
||||||
'type'=>'list',
|
'type' => 'list',
|
||||||
'label'=>'JSTATUS'
|
'label' => 'JSTATUS'
|
||||||
);
|
);
|
||||||
$attributes = array_merge($attributes,$readOnlyXML);
|
$attributes = array_merge($attributes, $readOnlyXML);
|
||||||
$this->xmlComment($fieldSetXML,$this->setLine(__LINE__) . " Published Field. Type: List (joomla)");
|
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Published Field. Type: List (joomla)");
|
||||||
$fieldXML = $fieldSetXML->addChild('field');
|
$fieldXML = $fieldSetXML->addChild('field');
|
||||||
$this->xmlAddAttributes($fieldXML,$attributes);
|
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||||
foreach(array('JPUBLISHED'=>1,'JUNPUBLISHED'=>0,'JARCHIVED'=>2,'JTRASHED'=>-2) as $text=>$value) {
|
foreach (array('JPUBLISHED' => 1, 'JUNPUBLISHED' => 0, 'JARCHIVED' => 2, 'JTRASHED' => -2) as $text => $value)
|
||||||
|
{
|
||||||
$optionXML = $fieldXML->addChild('option');
|
$optionXML = $fieldXML->addChild('option');
|
||||||
$optionXML->addAttribute('value',$value);
|
$optionXML->addAttribute('value', $value);
|
||||||
$optionXML[] = $text;
|
$optionXML[] = $text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -548,180 +551,182 @@ class Fields extends Structure {
|
|||||||
if (!isset($this->fieldsNames[$viewName]['modified']))
|
if (!isset($this->fieldsNames[$viewName]['modified']))
|
||||||
{
|
{
|
||||||
$attributes = array(
|
$attributes = array(
|
||||||
'name'=>'modified',
|
'name' => 'modified',
|
||||||
'type'=>'calendar',
|
'type' => 'calendar',
|
||||||
'class'=>'readonly',
|
'class' => 'readonly',
|
||||||
'label'=>$langView . '_MODIFIED_DATE_LABEL',
|
'label' => $langView . '_MODIFIED_DATE_LABEL',
|
||||||
'description'=>$langView . '_MODIFIED_DATE_DESC',
|
'description' => $langView . '_MODIFIED_DATE_DESC',
|
||||||
'size'=>22,
|
'size' => 22,
|
||||||
'readonly'=>"true",
|
'readonly' => "true",
|
||||||
'format'=>'%Y-%m-%d %H:%M:%S',
|
'format' => '%Y-%m-%d %H:%M:%S',
|
||||||
'filter'=>'user_utc'
|
'filter' => 'user_utc'
|
||||||
);
|
);
|
||||||
$this->xmlComment($fieldSetXML,$this->setLine(__LINE__) . " Date Modified Field. Type: Calendar (joomla)");
|
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Date Modified Field. Type: Calendar (joomla)");
|
||||||
$fieldXML = $fieldSetXML->addChild('field');
|
$fieldXML = $fieldSetXML->addChild('field');
|
||||||
$this->xmlAddAttributes($fieldXML,$attributes);
|
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||||
}
|
}
|
||||||
// if modified_by is not set
|
// if modified_by is not set
|
||||||
if (!isset($this->fieldsNames[$viewName]['modified_by']))
|
if (!isset($this->fieldsNames[$viewName]['modified_by']))
|
||||||
{
|
{
|
||||||
$attributes = array(
|
$attributes = array(
|
||||||
'name'=>'modified_by',
|
'name' => 'modified_by',
|
||||||
'type'=>'user',
|
'type' => 'user',
|
||||||
'label'=>$langView . '_MODIFIED_BY_LABEL',
|
'label' => $langView . '_MODIFIED_BY_LABEL',
|
||||||
'description'=>$langView . '_MODIFIED_BY_DESC',
|
'description' => $langView . '_MODIFIED_BY_DESC',
|
||||||
'class'=>'readonly',
|
'class' => 'readonly',
|
||||||
'readonly'=>'true',
|
'readonly' => 'true',
|
||||||
'filter'=>'unset'
|
'filter' => 'unset'
|
||||||
);
|
);
|
||||||
$this->xmlComment($fieldSetXML,$this->setLine(__LINE__) . " User Modified Field. Type: User (joomla)");
|
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " User Modified Field. Type: User (joomla)");
|
||||||
$fieldXML = $fieldSetXML->addChild('field');
|
$fieldXML = $fieldSetXML->addChild('field');
|
||||||
$this->xmlAddAttributes($fieldXML,$attributes);
|
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||||
}
|
}
|
||||||
// check if view has access
|
// check if view has access
|
||||||
if (isset($this->accessBuilder[$viewName]) && ComponentbuilderHelper::checkString($this->accessBuilder[$viewName]) && !isset($this->fieldsNames[$viewName]['access']))
|
if (isset($this->accessBuilder[$viewName]) && ComponentbuilderHelper::checkString($this->accessBuilder[$viewName]) && !isset($this->fieldsNames[$viewName]['access']))
|
||||||
{
|
{
|
||||||
$attributes = array(
|
$attributes = array(
|
||||||
'name'=>'access',
|
'name' => 'access',
|
||||||
'type'=>'accesslevel',
|
'type' => 'accesslevel',
|
||||||
'label'=>'JFIELD_ACCESS_LABEL',
|
'label' => 'JFIELD_ACCESS_LABEL',
|
||||||
'description'=>'JFIELD_ACCESS_DESC',
|
'description' => 'JFIELD_ACCESS_DESC',
|
||||||
'default'=>1,
|
'default' => 1,
|
||||||
'required'=>"false"
|
'required' => "false"
|
||||||
);
|
);
|
||||||
$attributes = array_merge($attributes,$readOnlyXML);
|
$attributes = array_merge($attributes, $readOnlyXML);
|
||||||
$this->xmlComment($fieldSetXML,$this->setLine(__LINE__) . " Access Field. Type: Accesslevel (joomla)");
|
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Access Field. Type: Accesslevel (joomla)");
|
||||||
$fieldXML = $fieldSetXML->addChild('field');
|
$fieldXML = $fieldSetXML->addChild('field');
|
||||||
$this->xmlAddAttributes($fieldXML,$attributes);
|
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||||
}
|
}
|
||||||
// if ordering is not set
|
// if ordering is not set
|
||||||
if (!isset($this->fieldsNames[$viewName]['ordering']))
|
if (!isset($this->fieldsNames[$viewName]['ordering']))
|
||||||
{
|
{
|
||||||
$attributes = array(
|
$attributes = array(
|
||||||
'name'=>'ordering',
|
'name' => 'ordering',
|
||||||
'type'=>'number',
|
'type' => 'number',
|
||||||
'class'=>'inputbox validate-ordering',
|
'class' => 'inputbox validate-ordering',
|
||||||
'label'=>$langView . '_ORDERING_LABEL',
|
'label' => $langView . '_ORDERING_LABEL',
|
||||||
'description'=>'',
|
'description' => '',
|
||||||
'default'=>0,
|
'default' => 0,
|
||||||
'size'=>6,
|
'size' => 6,
|
||||||
'required'=>"false"
|
'required' => "false"
|
||||||
);
|
);
|
||||||
$attributes = array_merge($attributes,$readOnlyXML);
|
$attributes = array_merge($attributes, $readOnlyXML);
|
||||||
$this->xmlComment($fieldSetXML,$this->setLine(__LINE__) . " Ordering Field. Type: Numbers (joomla)");
|
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Ordering Field. Type: Numbers (joomla)");
|
||||||
$fieldXML = $fieldSetXML->addChild('field');
|
$fieldXML = $fieldSetXML->addChild('field');
|
||||||
$this->xmlAddAttributes($fieldXML,$attributes);
|
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||||
}
|
}
|
||||||
// if version is not set
|
// if version is not set
|
||||||
if (!isset($this->fieldsNames[$viewName]['version']))
|
if (!isset($this->fieldsNames[$viewName]['version']))
|
||||||
{
|
{
|
||||||
$attributes = array(
|
$attributes = array(
|
||||||
'name'=>'version',
|
'name' => 'version',
|
||||||
'type'=>'text',
|
'type' => 'text',
|
||||||
'class'=>'readonly',
|
'class' => 'readonly',
|
||||||
'label'=>$langView . '_VERSION_LABEL',
|
'label' => $langView . '_VERSION_LABEL',
|
||||||
'description'=>$langView . '_VERSION_DESC',
|
'description' => $langView . '_VERSION_DESC',
|
||||||
'size'=>6,
|
'size' => 6,
|
||||||
'readonly'=>"true",
|
'readonly' => "true",
|
||||||
'filter'=>'unset'
|
'filter' => 'unset'
|
||||||
);
|
);
|
||||||
$this->xmlComment($fieldSetXML,$this->setLine(__LINE__) . " Version Field. Type: Text (joomla)");
|
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Version Field. Type: Text (joomla)");
|
||||||
$fieldXML = $fieldSetXML->addChild('field');
|
$fieldXML = $fieldSetXML->addChild('field');
|
||||||
$this->xmlAddAttributes($fieldXML,$attributes);
|
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||||
}
|
}
|
||||||
// check if metadata is added to this view
|
// check if metadata is added to this view
|
||||||
if (isset($this->metadataBuilder[$viewName]) && ComponentbuilderHelper::checkString($this->metadataBuilder[$viewName]))
|
if (isset($this->metadataBuilder[$viewName]) && ComponentbuilderHelper::checkString($this->metadataBuilder[$viewName]))
|
||||||
{
|
{
|
||||||
// metakey
|
// metakey
|
||||||
$attributes = array(
|
$attributes = array(
|
||||||
'name'=>'metakey',
|
'name' => 'metakey',
|
||||||
'type'=>'textarea',
|
'type' => 'textarea',
|
||||||
'label'=>'JFIELD_META_KEYWORDS_LABEL',
|
'label' => 'JFIELD_META_KEYWORDS_LABEL',
|
||||||
'description'=>'JFIELD_META_KEYWORDS_DESC',
|
'description' => 'JFIELD_META_KEYWORDS_DESC',
|
||||||
'rows'=>3,
|
'rows' => 3,
|
||||||
'cols'=>30
|
'cols' => 30
|
||||||
);
|
);
|
||||||
$this->xmlComment($fieldSetXML,$this->setLine(__LINE__) . " Metakey Field. Type: Textarea (joomla)");
|
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Metakey Field. Type: Textarea (joomla)");
|
||||||
$fieldXML = $fieldSetXML->addChild('field');
|
$fieldXML = $fieldSetXML->addChild('field');
|
||||||
$this->xmlAddAttributes($fieldXML,$attributes);
|
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||||
// metadesc
|
// metadesc
|
||||||
$attributes['name'] = 'metadesc';
|
$attributes['name'] = 'metadesc';
|
||||||
$attributes['label'] = 'JFIELD_META_DESCRIPTION_LABEL';
|
$attributes['label'] = 'JFIELD_META_DESCRIPTION_LABEL';
|
||||||
$attributes['description'] = 'JFIELD_META_DESCRIPTION_DESC';
|
$attributes['description'] = 'JFIELD_META_DESCRIPTION_DESC';
|
||||||
$this->xmlComment($fieldSetXML,$this->setLine(__LINE__) . " Metadesc Field. Type: Textarea (joomla)");
|
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Metadesc Field. Type: Textarea (joomla)");
|
||||||
$fieldXML = $fieldSetXML->addChild('field');
|
$fieldXML = $fieldSetXML->addChild('field');
|
||||||
$this->xmlAddAttributes($fieldXML,$attributes);
|
$this->xmlAddAttributes($fieldXML, $attributes);
|
||||||
}
|
}
|
||||||
// load the dynamic fields now
|
// load the dynamic fields now
|
||||||
if (count($dynamicFieldsXML))
|
if (count($dynamicFieldsXML))
|
||||||
{
|
{
|
||||||
$this->xmlComment($fieldSetXML,$this->setLine(__LINE__) . " Dynamic Fields.");
|
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Dynamic Fields.");
|
||||||
foreach($dynamicFieldsXML as $dynamicfield) {
|
foreach ($dynamicFieldsXML as $dynamicfield)
|
||||||
$this->xmlAppend($fieldSetXML,$dynamicfield);
|
{
|
||||||
|
$this->xmlAppend($fieldSetXML, $dynamicfield);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check if metadata is added to this view
|
// check if metadata is added to this view
|
||||||
if (isset($this->metadataBuilder[$viewName]) && ComponentbuilderHelper::checkString($this->metadataBuilder[$viewName]))
|
if (isset($this->metadataBuilder[$viewName]) && ComponentbuilderHelper::checkString($this->metadataBuilder[$viewName]))
|
||||||
{
|
{
|
||||||
$this->xmlComment($fieldSetXML,$this->setLine(__LINE__) . " Metadata Fields");
|
$this->xmlComment($fieldSetXML, $this->setLine(__LINE__) . " Metadata Fields");
|
||||||
$fieldsXML = $fieldSetXML->addChild('fields');
|
$fieldsXML = $fieldSetXML->addChild('fields');
|
||||||
$fieldsXML->addAttribute('name','metadata');
|
$fieldsXML->addAttribute('name', 'metadata');
|
||||||
$fieldsXML->addAttribute('label','JGLOBAL_FIELDSET_METADATA_OPTIONS');
|
$fieldsXML->addAttribute('label', 'JGLOBAL_FIELDSET_METADATA_OPTIONS');
|
||||||
$fieldsFieldSetXML = $fieldsXML->addChild('fieldset');
|
$fieldsFieldSetXML = $fieldsXML->addChild('fieldset');
|
||||||
$fieldsFieldSetXML->addAttribute('name','vdmmetadata');
|
$fieldsFieldSetXML->addAttribute('name', 'vdmmetadata');
|
||||||
$fieldsFieldSetXML->addAttribute('label','JGLOBAL_FIELDSET_METADATA_OPTIONS');
|
$fieldsFieldSetXML->addAttribute('label', 'JGLOBAL_FIELDSET_METADATA_OPTIONS');
|
||||||
// robots
|
// robots
|
||||||
$this->xmlComment($fieldsFieldSetXML,$this->setLine(__LINE__) . " Robots Field. Type: List (joomla)");
|
$this->xmlComment($fieldsFieldSetXML, $this->setLine(__LINE__) . " Robots Field. Type: List (joomla)");
|
||||||
$robots = $fieldsFieldSetXML->addChild('field');
|
$robots = $fieldsFieldSetXML->addChild('field');
|
||||||
$attributes = array(
|
$attributes = array(
|
||||||
'name'=>'robots',
|
'name' => 'robots',
|
||||||
'type'=>'list',
|
'type' => 'list',
|
||||||
'label'=>'JFIELD_METADATA_ROBOTS_LABEL',
|
'label' => 'JFIELD_METADATA_ROBOTS_LABEL',
|
||||||
'description'=>'JFIELD_METADATA_ROBOTS_DESC'
|
'description' => 'JFIELD_METADATA_ROBOTS_DESC'
|
||||||
);
|
);
|
||||||
$this->xmlAddAttributes($robots,$attributes);
|
$this->xmlAddAttributes($robots, $attributes);
|
||||||
$options = array(
|
$options = array(
|
||||||
'JGLOBAL_USE_GLOBAL'=>'',
|
'JGLOBAL_USE_GLOBAL' => '',
|
||||||
'JGLOBAL_INDEX_FOLLOW'=>'index, follow',
|
'JGLOBAL_INDEX_FOLLOW' => 'index, follow',
|
||||||
'JGLOBAL_NOINDEX_FOLLOW'=>'noindex, follow',
|
'JGLOBAL_NOINDEX_FOLLOW' => 'noindex, follow',
|
||||||
'JGLOBAL_INDEX_NOFOLLOW'=>'index, nofollow',
|
'JGLOBAL_INDEX_NOFOLLOW' => 'index, nofollow',
|
||||||
'JGLOBAL_NOINDEX_NOFOLLOW'=>'noindex, nofollow',
|
'JGLOBAL_NOINDEX_NOFOLLOW' => 'noindex, nofollow',
|
||||||
);
|
);
|
||||||
foreach($options as $text=>$value) {
|
foreach ($options as $text => $value)
|
||||||
|
{
|
||||||
$option = $robots->addChild('option');
|
$option = $robots->addChild('option');
|
||||||
$option->addAttribute('value',$value);
|
$option->addAttribute('value', $value);
|
||||||
$option[] = $text;
|
$option[] = $text;
|
||||||
}
|
}
|
||||||
// author
|
// author
|
||||||
$this->xmlComment($fieldsFieldSetXML,$this->setLine(__LINE__) . " Author Field. Type: Text (joomla)");
|
$this->xmlComment($fieldsFieldSetXML, $this->setLine(__LINE__) . " Author Field. Type: Text (joomla)");
|
||||||
$author = $fieldsFieldSetXML->addChild('field');
|
$author = $fieldsFieldSetXML->addChild('field');
|
||||||
$attributes = array(
|
$attributes = array(
|
||||||
'name'=>'author',
|
'name' => 'author',
|
||||||
'type'=>'text',
|
'type' => 'text',
|
||||||
'label'=>'JAUTHOR',
|
'label' => 'JAUTHOR',
|
||||||
'description'=>'JFIELD_METADATA_AUTHOR_DESC',
|
'description' => 'JFIELD_METADATA_AUTHOR_DESC',
|
||||||
'size'=>20
|
'size' => 20
|
||||||
);
|
);
|
||||||
$this->xmlAddAttributes($author,$attributes);
|
$this->xmlAddAttributes($author, $attributes);
|
||||||
// rights
|
// rights
|
||||||
$this->xmlComment($fieldsFieldSetXML,$this->setLine(__LINE__) . " Rights Field. Type: Textarea (joomla)");
|
$this->xmlComment($fieldsFieldSetXML, $this->setLine(__LINE__) . " Rights Field. Type: Textarea (joomla)");
|
||||||
$rights = $fieldsFieldSetXML->addChild('field');
|
$rights = $fieldsFieldSetXML->addChild('field');
|
||||||
$attributes = array(
|
$attributes = array(
|
||||||
'name'=>'rights',
|
'name' => 'rights',
|
||||||
'type'=>'textarea',
|
'type' => 'textarea',
|
||||||
'label'=>'JFIELD_META_RIGHTS_LABEL',
|
'label' => 'JFIELD_META_RIGHTS_LABEL',
|
||||||
'description'=>'JFIELD_META_RIGHTS_DESC',
|
'description' => 'JFIELD_META_RIGHTS_DESC',
|
||||||
'required'=>'false',
|
'required' => 'false',
|
||||||
'filter'=>'string',
|
'filter' => 'string',
|
||||||
'cols'=>30,
|
'cols' => 30,
|
||||||
'rows'=>2
|
'rows' => 2
|
||||||
);
|
);
|
||||||
$this->xmlAddAttributes($rights,$attributes);
|
$this->xmlAddAttributes($rights, $attributes);
|
||||||
}
|
}
|
||||||
// just to be safe, lets clear the view placeholders
|
// just to be safe, lets clear the view placeholders
|
||||||
$this->clearFromPlaceHolders('view');
|
$this->clearFromPlaceHolders('view');
|
||||||
// return the set
|
// return the set
|
||||||
return $this->xmlPrettyPrint($XML,'fieldset');
|
return $this->xmlPrettyPrint($XML, 'fieldset');
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@ -734,7 +739,8 @@ class Fields extends Structure {
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function setFieldsNames(&$view, &$name) {
|
public function setFieldsNames(&$view, &$name)
|
||||||
|
{
|
||||||
$this->fieldsNames[$view][$name] = $name;
|
$this->fieldsNames[$view][$name] = $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -752,10 +758,11 @@ class Fields extends Structure {
|
|||||||
* @param string $dbkey The the custom table key
|
* @param string $dbkey The the custom table key
|
||||||
* @param boolean $build The switch to set the build option
|
* @param boolean $build The switch to set the build option
|
||||||
*
|
*
|
||||||
* @return string The complete field in xml
|
* @return SimpleXMLElement The complete field in xml
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function setDynamicField(&$field, &$view, &$viewType, &$langView, &$viewName, &$listViewName, &$spacerCounter, &$placeholders, &$dbkey, $build) {
|
public function setDynamicField(&$field, &$view, &$viewType, &$langView, &$viewName, &$listViewName, &$spacerCounter, &$placeholders, &$dbkey, $build)
|
||||||
|
{
|
||||||
if (isset($field['settings']) && ComponentbuilderHelper::checkObject($field['settings']))
|
if (isset($field['settings']) && ComponentbuilderHelper::checkObject($field['settings']))
|
||||||
{
|
{
|
||||||
// reset some values
|
// reset some values
|
||||||
@ -771,13 +778,13 @@ class Fields extends Structure {
|
|||||||
if (ComponentbuilderHelper::checkArray($fieldAttributes))
|
if (ComponentbuilderHelper::checkArray($fieldAttributes))
|
||||||
{
|
{
|
||||||
// set the array of field names
|
// set the array of field names
|
||||||
$this->setFieldsNames($viewName, $fieldAttributes['name']);
|
$this->setFieldsNames($viewName,$fieldAttributes['name']);
|
||||||
|
|
||||||
if ($this->defaultField($typeName, 'option'))
|
if ($this->defaultField($typeName, 'option'))
|
||||||
{
|
{
|
||||||
//reset options array
|
//reset options array
|
||||||
$optionArray = array();
|
$optionArray = array();
|
||||||
// now add to the field set
|
// now add to the field set
|
||||||
|
|
||||||
$xmlElement = $this->setField('option', $fieldAttributes, $name, $typeName, $langView, $viewName, $listViewName, $placeholders, $optionArray);
|
$xmlElement = $this->setField('option', $fieldAttributes, $name, $typeName, $langView, $viewName, $listViewName, $placeholders, $optionArray);
|
||||||
if ($build)
|
if ($build)
|
||||||
{
|
{
|
||||||
@ -793,7 +800,6 @@ class Fields extends Structure {
|
|||||||
$this->setBuilders($langLabel, $langView, $viewName, $listViewName, $name, $view, $field, $typeName, $multiple);
|
$this->setBuilders($langLabel, $langView, $viewName, $listViewName, $name, $view, $field, $typeName, $multiple);
|
||||||
}
|
}
|
||||||
// now add to the field set
|
// now add to the field set
|
||||||
|
|
||||||
$xmlElement = $this->setField('plain', $fieldAttributes, $name, $typeName, $langView, $viewName, $listViewName, $placeholders, $optionArray);
|
$xmlElement = $this->setField('plain', $fieldAttributes, $name, $typeName, $langView, $viewName, $listViewName, $placeholders, $optionArray);
|
||||||
}
|
}
|
||||||
elseif ($this->defaultField($typeName, 'spacer'))
|
elseif ($this->defaultField($typeName, 'spacer'))
|
||||||
@ -872,11 +878,11 @@ class Fields extends Structure {
|
|||||||
* @param string $optionArray The option bucket array used to set the field options if needed.
|
* @param string $optionArray The option bucket array used to set the field options if needed.
|
||||||
* @param arra $custom Used when field is from config
|
* @param arra $custom Used when field is from config
|
||||||
*
|
*
|
||||||
* @return SimpleXMLElement The field as a SimpleXMLEflement
|
* @return SimpleXMLElement The field in xml
|
||||||
* @return string The field in xml
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private function setField($setType, &$fieldAttributes, &$name, &$typeName, &$langView, &$viewName, &$listViewName, $placeholders, &$optionArray, $custom = null) {
|
private function setField($setType, &$fieldAttributes, &$name, &$typeName, &$langView, &$viewName, &$listViewName, $placeholders, &$optionArray, $custom = null)
|
||||||
|
{
|
||||||
$r = new stdClass();
|
$r = new stdClass();
|
||||||
if ($setType === 'option')
|
if ($setType === 'option')
|
||||||
{
|
{
|
||||||
@ -888,11 +894,11 @@ class Fields extends Structure {
|
|||||||
{
|
{
|
||||||
if ($property != 'option')
|
if ($property != 'option')
|
||||||
{
|
{
|
||||||
$r->fieldXML->addAttribute($property,$value);
|
$r->fieldXML->addAttribute($property, $value);
|
||||||
}
|
}
|
||||||
elseif ($property === 'option')
|
elseif ($property === 'option')
|
||||||
{
|
{
|
||||||
$this->xmlComment($r->fieldXML,$this->setLine(__LINE__) . " Option Set.");
|
$this->xmlComment($r->fieldXML, $this->setLine(__LINE__) . " Option Set.");
|
||||||
if (strpos($value, ',') !== false)
|
if (strpos($value, ',') !== false)
|
||||||
{
|
{
|
||||||
// mulitpal options
|
// mulitpal options
|
||||||
@ -908,7 +914,7 @@ class Fields extends Structure {
|
|||||||
// add to lang array
|
// add to lang array
|
||||||
$this->langContent[$this->lang][$langValue] = $t;
|
$this->langContent[$this->lang][$langValue] = $t;
|
||||||
// no add to option set
|
// no add to option set
|
||||||
$optionXML->addAttribute('value',$v);
|
$optionXML->addAttribute('value', $v);
|
||||||
$optionArray[$v] = $langValue;
|
$optionArray[$v] = $langValue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -918,7 +924,7 @@ class Fields extends Structure {
|
|||||||
// add to lang array
|
// add to lang array
|
||||||
$this->langContent[$this->lang][$langValue] = $option;
|
$this->langContent[$this->lang][$langValue] = $option;
|
||||||
// no add to option set
|
// no add to option set
|
||||||
$optionXML->addAttribute('value',$option);
|
$optionXML->addAttribute('value', $option);
|
||||||
$optionArray[$option] = $langValue;
|
$optionArray[$option] = $langValue;
|
||||||
}
|
}
|
||||||
$optionXML[] = $langValue;
|
$optionXML[] = $langValue;
|
||||||
@ -936,7 +942,7 @@ class Fields extends Structure {
|
|||||||
// add to lang array
|
// add to lang array
|
||||||
$this->langContent[$this->lang][$langValue] = $t;
|
$this->langContent[$this->lang][$langValue] = $t;
|
||||||
// no add to option set
|
// no add to option set
|
||||||
$optionXML->addAttribute('value',$v);
|
$optionXML->addAttribute('value', $v);
|
||||||
$optionArray[$v] = $langValue;
|
$optionArray[$v] = $langValue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -946,15 +952,16 @@ class Fields extends Structure {
|
|||||||
// add to lang array
|
// add to lang array
|
||||||
$this->langContent[$this->lang][$langValue] = $value;
|
$this->langContent[$this->lang][$langValue] = $value;
|
||||||
// no add to option set
|
// no add to option set
|
||||||
$optionXML->addAttribute('value',$value);
|
$optionXML->addAttribute('value', $value);
|
||||||
$optionArray[$value] = $langValue;
|
$optionArray[$value] = $langValue;
|
||||||
}
|
}
|
||||||
$optionXML[] = $langValue;
|
$optionXML[] = $langValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!$r->fieldXML->count()) {
|
if (!$r->fieldXML->count())
|
||||||
$this->xmlComment($r->fieldXML,$this->setLine(__LINE__) . " No Manual Options Were Added In Field Settings.");
|
{
|
||||||
|
$this->xmlComment($r->fieldXML, $this->setLine(__LINE__) . " No Manual Options Were Added In Field Settings.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($setType === 'plain')
|
elseif ($setType === 'plain')
|
||||||
@ -967,7 +974,7 @@ class Fields extends Structure {
|
|||||||
{
|
{
|
||||||
if ($property != 'option')
|
if ($property != 'option')
|
||||||
{
|
{
|
||||||
$r->fieldXML->addAttribute($property,$value);
|
$r->fieldXML->addAttribute($property, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -981,7 +988,7 @@ class Fields extends Structure {
|
|||||||
{
|
{
|
||||||
if ($property != 'option')
|
if ($property != 'option')
|
||||||
{
|
{
|
||||||
$r->fieldXML->addAttribute($property,$value);
|
$r->fieldXML->addAttribute($property, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -998,16 +1005,16 @@ class Fields extends Structure {
|
|||||||
{
|
{
|
||||||
if ($property != 'fields')
|
if ($property != 'fields')
|
||||||
{
|
{
|
||||||
$r->fieldXML->addAttribute($property,$value);
|
$r->fieldXML->addAttribute($property, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$fieldsXML = $r->fieldXML->addChild('fields');
|
$fieldsXML = $r->fieldXML->addChild('fields');
|
||||||
$fieldsXML->addAttribute('name',$fieldAttributes['name'].'_fields');
|
$fieldsXML->addAttribute('name', $fieldAttributes['name'] . '_fields');
|
||||||
$fieldsXML->addAttribute('label','');
|
$fieldsXML->addAttribute('label', '');
|
||||||
$fieldSetXML = $fieldsXML->addChild('fieldset');
|
$fieldSetXML = $fieldsXML->addChild('fieldset');
|
||||||
$fieldSetXML->addAttribute('hidden','true');
|
$fieldSetXML->addAttribute('hidden', 'true');
|
||||||
$fieldSetXML->addAttribute('name',$fieldAttributes['name'] . '_modal');
|
$fieldSetXML->addAttribute('name', $fieldAttributes['name'] . '_modal');
|
||||||
$fieldSetXML->addAttribute('repeat','true');
|
$fieldSetXML->addAttribute('repeat', 'true');
|
||||||
|
|
||||||
if (strpos($fieldAttributes['fields'], ',') !== false)
|
if (strpos($fieldAttributes['fields'], ',') !== false)
|
||||||
{
|
{
|
||||||
@ -1043,12 +1050,12 @@ class Fields extends Structure {
|
|||||||
if ($this->defaultField($r_typeName, 'option'))
|
if ($this->defaultField($r_typeName, 'option'))
|
||||||
{
|
{
|
||||||
// now add to the field set
|
// now add to the field set
|
||||||
$this->xmlAppend($fieldSetXML,$this->setField('option', $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray));
|
$this->xmlAppend($fieldSetXML, $this->setField('option', $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray));
|
||||||
}
|
}
|
||||||
elseif ($this->defaultField($r_typeName, 'plain'))
|
elseif ($this->defaultField($r_typeName, 'plain'))
|
||||||
{
|
{
|
||||||
// now add to the field set
|
// now add to the field set
|
||||||
$this->xmlAppend($fieldSetXML,$this->setField('plain', $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray));
|
$this->xmlAppend($fieldSetXML, $this->setField('plain', $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray));
|
||||||
}
|
}
|
||||||
elseif (ComponentbuilderHelper::checkArray($r_fieldValues['custom']))
|
elseif (ComponentbuilderHelper::checkArray($r_fieldValues['custom']))
|
||||||
{
|
{
|
||||||
@ -1056,7 +1063,7 @@ class Fields extends Structure {
|
|||||||
$custom = $r_fieldValues['custom'];
|
$custom = $r_fieldValues['custom'];
|
||||||
unset($r_fieldValues['custom']);
|
unset($r_fieldValues['custom']);
|
||||||
// now add to the field set
|
// now add to the field set
|
||||||
$this->xmlAppend($fieldSetXML,$this->setField('custom', $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray));
|
$this->xmlAppend($fieldSetXML, $this->setField('custom', $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray));
|
||||||
// set lang (just incase)
|
// set lang (just incase)
|
||||||
$r_listLangName = $langView . '_' . ComponentbuilderHelper::safeString($r_name, 'U');
|
$r_listLangName = $langView . '_' . ComponentbuilderHelper::safeString($r_name, 'U');
|
||||||
// add to lang array
|
// add to lang array
|
||||||
@ -1087,7 +1094,7 @@ class Fields extends Structure {
|
|||||||
{
|
{
|
||||||
if ($property != 'fields')
|
if ($property != 'fields')
|
||||||
{
|
{
|
||||||
$r->fieldXML->addAttribute($property,$value);
|
$r->fieldXML->addAttribute($property, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if we do not detect formsource we add the form
|
// if we do not detect formsource we add the form
|
||||||
@ -1095,11 +1102,11 @@ class Fields extends Structure {
|
|||||||
{
|
{
|
||||||
$form = $r->fieldXML->addChild('form');
|
$form = $r->fieldXML->addChild('form');
|
||||||
$attributes = array(
|
$attributes = array(
|
||||||
'hidden'=>'true',
|
'hidden' => 'true',
|
||||||
'name'=>'list_' . $fieldAttributes['name'] . '_modal',
|
'name' => 'list_' . $fieldAttributes['name'] . '_modal',
|
||||||
'repeat'=>'true'
|
'repeat' => 'true'
|
||||||
);
|
);
|
||||||
$this->xmlAddAttributes($form,$attributes);
|
$this->xmlAddAttributes($form, $attributes);
|
||||||
|
|
||||||
if (strpos($fieldAttributes['fields'], ',') !== false)
|
if (strpos($fieldAttributes['fields'], ',') !== false)
|
||||||
{
|
{
|
||||||
@ -1135,12 +1142,12 @@ class Fields extends Structure {
|
|||||||
if ($this->defaultField($r_typeName, 'option'))
|
if ($this->defaultField($r_typeName, 'option'))
|
||||||
{
|
{
|
||||||
// now add to the field set
|
// now add to the field set
|
||||||
$this->xmlAppend($form,$this->setField('option', $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray));
|
$this->xmlAppend($form, $this->setField('option', $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray));
|
||||||
}
|
}
|
||||||
elseif ($this->defaultField($r_typeName, 'plain'))
|
elseif ($this->defaultField($r_typeName, 'plain'))
|
||||||
{
|
{
|
||||||
// now add to the field set
|
// now add to the field set
|
||||||
$this->xmlAppend($form,$this->setField('plain', $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray));
|
$this->xmlAppend($form, $this->setField('plain', $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray));
|
||||||
}
|
}
|
||||||
elseif (ComponentbuilderHelper::checkArray($r_fieldValues['custom']))
|
elseif (ComponentbuilderHelper::checkArray($r_fieldValues['custom']))
|
||||||
{
|
{
|
||||||
@ -1148,7 +1155,7 @@ class Fields extends Structure {
|
|||||||
$custom = $r_fieldValues['custom'];
|
$custom = $r_fieldValues['custom'];
|
||||||
unset($r_fieldValues['custom']);
|
unset($r_fieldValues['custom']);
|
||||||
// now add to the field set
|
// now add to the field set
|
||||||
$this->xmlAppend($form,$this->setField('custom', $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray));
|
$this->xmlAppend($form, $this->setField('custom', $r_fieldValues, $r_name, $r_typeName, $langView, $viewName, $listViewName, $placeholders, $r_optionArray));
|
||||||
// set lang (just incase)
|
// set lang (just incase)
|
||||||
$r_listLangName = $langView . '_' . ComponentbuilderHelper::safeString($r_name, 'U');
|
$r_listLangName = $langView . '_' . ComponentbuilderHelper::safeString($r_name, 'U');
|
||||||
// add to lang array
|
// add to lang array
|
||||||
@ -1175,15 +1182,13 @@ class Fields extends Structure {
|
|||||||
// now add to the field set
|
// now add to the field set
|
||||||
$r->fieldXML = new SimpleXMLElement('<field/>');
|
$r->fieldXML = new SimpleXMLElement('<field/>');
|
||||||
$r->comment = $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". (custom)";
|
$r->comment = $this->setLine(__LINE__) . " " . ComponentbuilderHelper::safeString($name, 'F') . " Field. Type: " . ComponentbuilderHelper::safeString($typeName, 'F') . ". (custom)";
|
||||||
|
|
||||||
foreach ($fieldAttributes as $property => $value)
|
foreach ($fieldAttributes as $property => $value)
|
||||||
{
|
{
|
||||||
if ($property != 'option')
|
if ($property != 'option')
|
||||||
{
|
{
|
||||||
$r->fieldXML->addAttribute($property,$value);
|
$r->fieldXML->addAttribute($property, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// incase the field is in the config and has not been set
|
// incase the field is in the config and has not been set
|
||||||
if ('config' === $viewName && 'configs' === $listViewName)
|
if ('config' === $viewName && 'configs' === $listViewName)
|
||||||
{
|
{
|
||||||
@ -1209,7 +1214,8 @@ class Fields extends Structure {
|
|||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function setLayoutBuilder(&$viewName, &$tabName, &$name, &$field) {
|
public function setLayoutBuilder(&$viewName,&$tabName,&$name,&$field)
|
||||||
|
{
|
||||||
// first fix the zero order
|
// first fix the zero order
|
||||||
// to insure it lands before all the other fields
|
// to insure it lands before all the other fields
|
||||||
// as zero is expected to behave
|
// as zero is expected to behave
|
||||||
@ -1296,15 +1302,16 @@ class Fields extends Structure {
|
|||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function buildSiteFieldData($view, $field, $set, $type) {
|
public function buildSiteFieldData($view, $field, $set, $type)
|
||||||
$decode = array('json', 'base64', 'basic_encryption', 'advance_encryption');
|
{
|
||||||
$uikit = array('textarea', 'editor');
|
$decode = array('json','base64','basic_encryption','advance_encryption');
|
||||||
|
$uikit = array('textarea','editor');
|
||||||
if (isset($this->siteFields[$view][$field]) && ComponentbuilderHelper::checkArray($this->siteFields[$view][$field]))
|
if (isset($this->siteFields[$view][$field]) && ComponentbuilderHelper::checkArray($this->siteFields[$view][$field]))
|
||||||
{
|
{
|
||||||
foreach ($this->siteFields[$view][$field] as $code => $array)
|
foreach ($this->siteFields[$view][$field] as $code => $array)
|
||||||
{
|
{
|
||||||
// set the decoding methods
|
// set the decoding methods
|
||||||
if (in_array($set, $decode))
|
if (in_array($set,$decode))
|
||||||
{
|
{
|
||||||
$this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']] = array('decode' => $set, 'type' => $type);
|
$this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']] = array('decode' => $set, 'type' => $type);
|
||||||
}
|
}
|
||||||
@ -1336,7 +1343,8 @@ class Fields extends Structure {
|
|||||||
* @return array The field attributes
|
* @return array The field attributes
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private function setFieldAttributes(&$field, &$viewType, &$name, &$typeName, &$multiple, &$langLabel, $langView, &$spacerCounter, $listViewName, $viewName, $placeholders, $repeatable = false) {
|
private function setFieldAttributes(&$field, &$viewType, &$name, &$typeName, &$multiple, &$langLabel, $langView, &$spacerCounter, $listViewName, $viewName, $placeholders, $repeatable = false)
|
||||||
|
{
|
||||||
// reset array`
|
// reset array`
|
||||||
$fieldAttributes = array();
|
$fieldAttributes = array();
|
||||||
$setCustom = false;
|
$setCustom = false;
|
||||||
@ -1673,7 +1681,8 @@ class Fields extends Structure {
|
|||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected function setUniqueNameKeeper(&$field, &$typeName, &$name, $viewName) {
|
protected function setUniqueNameKeeper(&$field, &$typeName, &$name, $viewName)
|
||||||
|
{
|
||||||
// setup a default field
|
// setup a default field
|
||||||
$xml = new SimpleXMLElement($field['settings']->xml);
|
$xml = new SimpleXMLElement($field['settings']->xml);
|
||||||
if (ComponentbuilderHelper::checkArray($field['settings']->properties))
|
if (ComponentbuilderHelper::checkArray($field['settings']->properties))
|
||||||
@ -1733,7 +1742,8 @@ class Fields extends Structure {
|
|||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected function setUniqueNameCounter($name, $view) {
|
protected function setUniqueNameCounter($name, $view)
|
||||||
|
{
|
||||||
if (!isset($this->uniqueNames[$view]))
|
if (!isset($this->uniqueNames[$view]))
|
||||||
{
|
{
|
||||||
$this->uniqueNames[$view] = array();
|
$this->uniqueNames[$view] = array();
|
||||||
@ -1746,7 +1756,7 @@ class Fields extends Structure {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// count how many times the field is used
|
// count how many times the field is used
|
||||||
$this->uniqueNames[$view]['counter'][$name] ++;
|
$this->uniqueNames[$view]['counter'][$name]++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1759,7 +1769,8 @@ class Fields extends Structure {
|
|||||||
* @return string the name
|
* @return string the name
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected function uniqueName($name, $view) {
|
protected function uniqueName($name, $view)
|
||||||
|
{
|
||||||
// only increment if the field name is used multiple times
|
// only increment if the field name is used multiple times
|
||||||
if (isset($this->uniqueNames[$view]['counter'][$name]) && $this->uniqueNames[$view]['counter'][$name] > 1)
|
if (isset($this->uniqueNames[$view]['counter'][$name]) && $this->uniqueNames[$view]['counter'][$name] > 1)
|
||||||
{
|
{
|
||||||
@ -1777,6 +1788,7 @@ class Fields extends Structure {
|
|||||||
return $name;
|
return $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set Builders
|
* set Builders
|
||||||
*
|
*
|
||||||
@ -1795,7 +1807,8 @@ class Fields extends Structure {
|
|||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function setBuilders($langLabel, $langView, $viewName, $listViewName, $name, $view, $field, $typeName, $multiple, $custom = false, $options = false) {
|
public function setBuilders($langLabel, $langView, $viewName, $listViewName, $name, $view, $field, $typeName, $multiple, $custom = false, $options = false)
|
||||||
|
{
|
||||||
if ($typeName === 'tag')
|
if ($typeName === 'tag')
|
||||||
{
|
{
|
||||||
// set tags for this view but don't load to DB
|
// set tags for this view but don't load to DB
|
||||||
@ -2103,13 +2116,14 @@ class Fields extends Structure {
|
|||||||
$this->setLayoutBuilder($viewName, $tabName, $name, $field);
|
$this->setLayoutBuilder($viewName, $tabName, $name, $field);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setCustomFieldTypeFile($data, $viewName_list, $viewName_single) {
|
public function setCustomFieldTypeFile($data, $viewName_list, $viewName_single)
|
||||||
|
{
|
||||||
// make sure it is not already been build
|
// make sure it is not already been build
|
||||||
if (!isset($this->fileContentDynamic['customfield_' . $data['type']]) || !ComponentbuilderHelper::checkArray($this->fileContentDynamic['customfield_' . $data['type']]))
|
if (!isset($this->fileContentDynamic['customfield_'.$data['type']]) || !ComponentbuilderHelper::checkArray($this->fileContentDynamic['customfield_'.$data['type']]))
|
||||||
{
|
{
|
||||||
// first build the custom field type file
|
// first build the custom field type file
|
||||||
$target = array('admin' => 'customfield');
|
$target = array('admin' => 'customfield');
|
||||||
$this->buildDynamique($target, 'field' . $data['custom']['extends'], $data['custom']['type']);
|
$this->buildDynamique($target,'field'.$data['custom']['extends'], $data['custom']['type']);
|
||||||
// set tab and break replacements
|
// set tab and break replacements
|
||||||
$tabBreak = array(
|
$tabBreak = array(
|
||||||
'\t' => "\t",
|
'\t' => "\t",
|
||||||
@ -2120,11 +2134,11 @@ class Fields extends Structure {
|
|||||||
'###TABLE###' => $data['custom']['table'],
|
'###TABLE###' => $data['custom']['table'],
|
||||||
'###ID###' => $data['custom']['id'],
|
'###ID###' => $data['custom']['id'],
|
||||||
'###TEXT###' => $data['custom']['text'],
|
'###TEXT###' => $data['custom']['text'],
|
||||||
'###CODE_TEXT###' => $data['code'] . '_' . $data['custom']['text'],
|
'###CODE_TEXT###' => $data['code'].'_'.$data['custom']['text'],
|
||||||
'###CODE###' => $data['code'],
|
'###CODE###' => $data['code'],
|
||||||
'###component###' => $this->fileContentStatic['###component###'],
|
'###component###' => $this->fileContentStatic['###component###'],
|
||||||
'###Component###' => $this->fileContentStatic['###Component###'],
|
'###Component###' => $this->fileContentStatic['###Component###'],
|
||||||
'###view_type###' => $viewName_single . '_' . $data['type'],
|
'###view_type###' => $viewName_single.'_'.$data['type'],
|
||||||
'###type###' => $data['type'],
|
'###type###' => $data['type'],
|
||||||
'###view###' => $viewName_single,
|
'###view###' => $viewName_single,
|
||||||
'###views###' => $viewName_list
|
'###views###' => $viewName_list
|
||||||
@ -2144,7 +2158,7 @@ class Fields extends Structure {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$phpCode .= PHP_EOL . "\t\t" . $this->setPlaceholders($code, $tabBreak);
|
$phpCode .= PHP_EOL."\t\t".$this->setPlaceholders($code, $tabBreak);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2193,30 +2207,30 @@ class Fields extends Structure {
|
|||||||
$phpxCode = 'return null;';
|
$phpxCode = 'return null;';
|
||||||
}
|
}
|
||||||
// temp holder for name
|
// temp holder for name
|
||||||
$tempName = $data['custom']['label'] . ' Group';
|
$tempName = $data['custom']['label'].' Group';
|
||||||
// set lang
|
// set lang
|
||||||
$groupLangName = $this->langPrefix . '_' . ComponentbuilderHelper::safeString($tempName, 'U');
|
$groupLangName = $this->langPrefix.'_'.ComponentbuilderHelper::safeString($tempName,'U');
|
||||||
// add to lang array
|
// add to lang array
|
||||||
$this->langContent[$this->lang][$groupLangName] = ComponentbuilderHelper::safeString($tempName, 'W');
|
$this->langContent[$this->lang][$groupLangName] = ComponentbuilderHelper::safeString($tempName,'W');
|
||||||
// build the Group Control
|
// build the Group Control
|
||||||
$this->setGroupControl[$data['type']] = $groupLangName;
|
$this->setGroupControl[$data['type']] = $groupLangName;
|
||||||
// ###JFORM_GETGROUPS_PHP### <<<DYNAMIC>>>
|
// ###JFORM_GETGROUPS_PHP### <<<DYNAMIC>>>
|
||||||
$this->fileContentDynamic['customfield_' . $data['type']]['###JFORM_GETGROUPS_PHP###'] = $phpCode;
|
$this->fileContentDynamic['customfield_'.$data['type']]['###JFORM_GETGROUPS_PHP###'] = $phpCode;
|
||||||
|
|
||||||
// ###JFORM_GETEXCLUDED_PHP### <<<DYNAMIC>>>
|
// ###JFORM_GETEXCLUDED_PHP### <<<DYNAMIC>>>
|
||||||
$this->fileContentDynamic['customfield_' . $data['type']]['###JFORM_GETEXCLUDED_PHP###'] = $phpxCode;
|
$this->fileContentDynamic['customfield_'.$data['type']]['###JFORM_GETEXCLUDED_PHP###'] = $phpxCode;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// ###JFORM_GETOPTIONS_PHP### <<<DYNAMIC>>>
|
// ###JFORM_GETOPTIONS_PHP### <<<DYNAMIC>>>
|
||||||
$this->fileContentDynamic['customfield_' . $data['type']]['###JFORM_GETOPTIONS_PHP###'] = $phpCode;
|
$this->fileContentDynamic['customfield_'.$data['type']]['###JFORM_GETOPTIONS_PHP###'] = $phpCode;
|
||||||
}
|
}
|
||||||
// ###Type### <<<DYNAMIC>>>
|
// ###Type### <<<DYNAMIC>>>
|
||||||
$this->fileContentDynamic['customfield_' . $data['type']]['###Type###'] = ComponentbuilderHelper::safeString($data['custom']['type'], 'F');
|
$this->fileContentDynamic['customfield_'.$data['type']]['###Type###'] = ComponentbuilderHelper::safeString($data['custom']['type'],'F');
|
||||||
// ###type### <<<DYNAMIC>>>
|
// ###type### <<<DYNAMIC>>>
|
||||||
$this->fileContentDynamic['customfield_' . $data['type']]['###type###'] = $data['custom']['type'];
|
$this->fileContentDynamic['customfield_'.$data['type']]['###type###'] = $data['custom']['type'];
|
||||||
// ###type### <<<DYNAMIC>>>
|
// ###type### <<<DYNAMIC>>>
|
||||||
$this->fileContentDynamic['customfield_' . $data['type']]['###ADD_BUTTON###'] = $this->setAddButttonToListField($data['custom']['view'], $data['custom']['views']);
|
$this->fileContentDynamic['customfield_'.$data['type']]['###ADD_BUTTON###'] = $this->setAddButttonToListField($data['custom']['view'],$data['custom']['views']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2229,7 +2243,8 @@ class Fields extends Structure {
|
|||||||
* @return boolean if the field was found
|
* @return boolean if the field was found
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function defaultField($type, $option = 'default') {
|
public function defaultField($type, $option = 'default')
|
||||||
|
{
|
||||||
// list of default fields
|
// list of default fields
|
||||||
// https://docs.joomla.org/Form_field
|
// https://docs.joomla.org/Form_field
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
@ -2271,45 +2286,55 @@ class Fields extends Structure {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function xmlComment(&$xml,$comment) {
|
public function xmlComment(&$xml, $comment)
|
||||||
|
{
|
||||||
$domXML = dom_import_simplexml($xml);
|
$domXML = dom_import_simplexml($xml);
|
||||||
$domComment = new DOMComment($comment);
|
$domComment = new DOMComment($comment);
|
||||||
$nodeTarget = $domXML->ownerDocument->importNode($domComment,true);
|
$nodeTarget = $domXML->ownerDocument->importNode($domComment, true);
|
||||||
$domXML->appendChild($nodeTarget);
|
$domXML->appendChild($nodeTarget);
|
||||||
$xml = simplexml_import_dom($domXML);
|
$xml = simplexml_import_dom($domXML);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function xmlAddAttributes(&$xml,$attributes=array()) {
|
public function xmlAddAttributes(&$xml, $attributes = array())
|
||||||
foreach($attributes as $key=>$value) {
|
{
|
||||||
$xml->addAttribute($key,$value);
|
foreach ($attributes as $key => $value)
|
||||||
|
{
|
||||||
|
$xml->addAttribute($key, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function xmlAppend(&$xml,$node) {
|
public function xmlAppend(&$xml, $node)
|
||||||
if(!$node) { // element was not returned
|
{
|
||||||
|
if (!$node)
|
||||||
|
{ // element was not returned
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch(get_class($node)) {
|
switch (get_class($node))
|
||||||
|
{
|
||||||
case 'stdClass':
|
case 'stdClass':
|
||||||
if(property_exists($node,'comment')) {
|
if (property_exists($node, 'comment'))
|
||||||
$this->xmlComment($xml,$node->comment);
|
{
|
||||||
|
$this->xmlComment($xml, $node->comment);
|
||||||
}
|
}
|
||||||
if(property_exists($node,'fieldXML')) {
|
if (property_exists($node, 'fieldXML'))
|
||||||
$this->xmlAppend($xml,$node->fieldXML);
|
{
|
||||||
|
$this->xmlAppend($xml, $node->fieldXML);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'SimpleXMLElement':
|
case 'SimpleXMLElement':
|
||||||
$domXML = dom_import_simplexml($xml);
|
$domXML = dom_import_simplexml($xml);
|
||||||
$domNode = dom_import_simplexml($node);
|
$domNode = dom_import_simplexml($node);
|
||||||
$domXML->appendChild($domXML->ownerDocument->importNode($domNode,true));
|
$domXML->appendChild($domXML->ownerDocument->importNode($domNode, true));
|
||||||
$xml = simplexml_import_dom($domXML);
|
$xml = simplexml_import_dom($domXML);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function xmlPrettyPrint($xml,$nodename) {
|
public function xmlPrettyPrint($xml, $nodename)
|
||||||
|
{
|
||||||
$dom = dom_import_simplexml($xml)->ownerDocument;
|
$dom = dom_import_simplexml($xml)->ownerDocument;
|
||||||
$dom->formatOutput = true;
|
$dom->formatOutput = true;
|
||||||
return $dom->saveXML($dom->getElementsByTagName($nodename)->item(0));
|
return $dom->saveXML($dom->getElementsByTagName($nodename)->item(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user