Unique function to show input or output of extrafields datas
This commit is contained in:
parent
6e66922a6b
commit
ec52f54a52
@ -2194,17 +2194,22 @@ abstract class CommonObject
|
|||||||
* Function to show lines of extrafields with output datas
|
* Function to show lines of extrafields with output datas
|
||||||
*
|
*
|
||||||
* @param object $extrafields extrafield Object
|
* @param object $extrafields extrafield Object
|
||||||
|
* @param string $mode Show output (view) or input (edit) for extrafield
|
||||||
*
|
*
|
||||||
* return string
|
* return string
|
||||||
*/
|
*/
|
||||||
function showOptionals($extrafields)
|
function showOptionals($extrafields,$mode='view')
|
||||||
{
|
{
|
||||||
global $_POST;
|
global $_POST;
|
||||||
|
|
||||||
$out = '';
|
$out = '';
|
||||||
|
|
||||||
if (! empty($this->array_options))
|
if(count($extrafields->attribute_label) > 0)
|
||||||
{
|
{
|
||||||
|
$out .= "\n";
|
||||||
|
$out .= '<!-- showOptionalsInput --> ';
|
||||||
|
$out .= "\n";
|
||||||
|
|
||||||
$e = 0;
|
$e = 0;
|
||||||
foreach($extrafields->attribute_label as $key=>$label)
|
foreach($extrafields->attribute_label as $key=>$label)
|
||||||
{
|
{
|
||||||
@ -2212,7 +2217,7 @@ abstract class CommonObject
|
|||||||
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$this->array_options["options_".$key]);
|
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$this->array_options["options_".$key]);
|
||||||
if ($extrafields->attribute_type[$key] == 'separate')
|
if ($extrafields->attribute_type[$key] == 'separate')
|
||||||
{
|
{
|
||||||
$out = $extrafields->showSeparator($key);
|
$out .= $extrafields->showSeparator($key);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2232,7 +2237,16 @@ abstract class CommonObject
|
|||||||
}
|
}
|
||||||
$out .= '<td>'.$label.'</td>';
|
$out .= '<td>'.$label.'</td>';
|
||||||
$out .='<td colspan="'.$colspan.'">';
|
$out .='<td colspan="'.$colspan.'">';
|
||||||
|
|
||||||
|
switch($mode) {
|
||||||
|
case "view":
|
||||||
$out .= $extrafields->showOutputField($key,$value);
|
$out .= $extrafields->showOutputField($key,$value);
|
||||||
|
break;
|
||||||
|
case "edit":
|
||||||
|
$out .= $extrafields->showInputField($key,$value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$out .= '</td>'."\n";
|
$out .= '</td>'."\n";
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) $out .= '</tr>';
|
if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) $out .= '</tr>';
|
||||||
@ -2240,6 +2254,8 @@ abstract class CommonObject
|
|||||||
$e++;
|
$e++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$out .= "\n";
|
||||||
|
$out .= '<!-- /showOptionalsInput --> ';
|
||||||
}
|
}
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user