Fixed the javascript in the new relation area. Fixed gh-294 that hade count not array errors. Added the option to over-ride the column name in the new relation area.
This commit is contained in:
@ -501,6 +501,13 @@ class Get
|
||||
*/
|
||||
public $listJoinBuilder = array();
|
||||
|
||||
/**
|
||||
* The list head over ride
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $listHeadOverRide = array();
|
||||
|
||||
/**
|
||||
* The linked admin view tabs
|
||||
*
|
||||
@ -1683,6 +1690,7 @@ class Get
|
||||
// prep the buckets
|
||||
$this->fieldRelations[$name_list] = array();
|
||||
$this->listJoinBuilder[$name_list] = array();
|
||||
$this->listHeadOverRide[$name_list] = array();
|
||||
// set the relations
|
||||
$view->addrelations = (isset($view->addrelations) && ComponentbuilderHelper::checkJson($view->addrelations)) ? json_decode($view->addrelations, true) : null;
|
||||
if (ComponentbuilderHelper::checkArray($view->addrelations))
|
||||
@ -1708,6 +1716,18 @@ class Get
|
||||
{
|
||||
$this->listJoinBuilder[$name_list][(int) $join] = (int) $join;
|
||||
}
|
||||
// set header over-ride
|
||||
if (isset($relationsValue['column_name']) && ComponentbuilderHelper::checkString($relationsValue['column_name']))
|
||||
{
|
||||
$check_column_name = trim(strtolower($relationsValue['column_name']));
|
||||
// confirm it should really make the over ride
|
||||
if ('default' !== $check_column_name)
|
||||
{
|
||||
$column_name_lang = ComponentbuilderHelper::safeString($name_list, 'U') . '_' . ComponentbuilderHelper::safeString($relationsValue['column_name'], 'U');
|
||||
$this->langContent['admin'][$column_name_lang] = trim($relationsValue['column_name']);
|
||||
$this->listHeadOverRide[$name_list][(int) $relationsValue['listfield']] = $column_name_lang;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6886,6 +6886,12 @@ class Interpretation extends Fields
|
||||
// build the dynamic fields
|
||||
foreach ($this->listBuilder[$viewName_list] as $item)
|
||||
{
|
||||
// check if we have an over-ride
|
||||
if (isset($this->listHeadOverRide[$viewName_list]) && ComponentbuilderHelper::checkArray($this->listHeadOverRide[$viewName_list]) && isset($this->listHeadOverRide[$viewName_list][$item['id']]))
|
||||
{
|
||||
$item['lang'] = $this->listHeadOverRide[$viewName_list][$item['id']];
|
||||
}
|
||||
// set the custom code
|
||||
if (ComponentbuilderHelper::checkArray($item['custom']))
|
||||
{
|
||||
$item['code'] = $item['code'] . '_' . $item['custom']['text'];
|
||||
@ -7953,6 +7959,11 @@ class Interpretation extends Fields
|
||||
// build the dynamic fields
|
||||
foreach ($this->listBuilder[$viewName_list] as $item)
|
||||
{
|
||||
// check if we have an over-ride
|
||||
if (isset($this->listHeadOverRide[$viewName_list]) && ComponentbuilderHelper::checkArray($this->listHeadOverRide[$viewName_list]) && isset($this->listHeadOverRide[$viewName_list][$item['id']]))
|
||||
{
|
||||
$item['lang'] = $this->listHeadOverRide[$viewName_list][$item['id']];
|
||||
}
|
||||
$setin = (2 == $this->footableVersion) ? ' data-hide="phone"' : ' data-breakpoints="xs sm"';
|
||||
if ($controller > 3)
|
||||
{
|
||||
|
@ -4625,7 +4625,7 @@ abstract class ComponentbuilderHelper
|
||||
}
|
||||
}
|
||||
// check if there are any view values remaining
|
||||
if (count($_result))
|
||||
if (count((array)$_result))
|
||||
{
|
||||
$_result = json_encode($_result);
|
||||
$_result = array($_result);
|
||||
@ -4819,7 +4819,7 @@ abstract class ComponentbuilderHelper
|
||||
**/
|
||||
public static function checkArray($array, $removeEmptyString = false)
|
||||
{
|
||||
if (isset($array) && is_array($array) && count($array) > 0)
|
||||
if (isset($array) && is_array($array) && count((array)$array) > 0)
|
||||
{
|
||||
// also make sure the empty strings are removed
|
||||
if ($removeEmptyString)
|
||||
@ -4922,7 +4922,7 @@ abstract class ComponentbuilderHelper
|
||||
{
|
||||
$initial = strlen($string);
|
||||
$words = preg_split('/([\s\n\r]+)/', $string, null, PREG_SPLIT_DELIM_CAPTURE);
|
||||
$words_count = count($words);
|
||||
$words_count = count((array)$words);
|
||||
|
||||
$word_length = 0;
|
||||
$last_word = 0;
|
||||
|
@ -215,7 +215,7 @@ abstract class ComponentbuilderEmail
|
||||
if (is_array($mailreply))
|
||||
{
|
||||
$mail->ClearReplyTos();
|
||||
$numReplyTo = count($mailreply);
|
||||
$numReplyTo = count((array)$mailreply);
|
||||
for ($i=0; $i < $numReplyTo; $i++)
|
||||
{
|
||||
$mail->addReplyTo($mailreply[$i], $replyname[$i]);
|
||||
|
Reference in New Issue
Block a user