' . fxMs1UiEsc($strLabel) . '';
}
/**
* P5 — Orientation / choix exclusif (segmented pills, mockup A).
* options[] : value, label, checked
*/
function fxMs1UiRenderSegmented($tabCfg = []) {
$strName = (string)($tabCfg['name'] ?? 'ms1_ui_seg');
$strLegend = (string)($tabCfg['legend'] ?? '');
$strLegendHtml = (string)($tabCfg['legend_html'] ?? '');
$strHint = (string)($tabCfg['hint'] ?? '');
$strRadioClass = trim((string)($tabCfg['radio_class'] ?? ''));
$tabOptions = is_array($tabCfg['options'] ?? null) ? $tabCfg['options'] : [];
ob_start();
?>
0) ? (int)min(100, round(100 * $intUsed / $intBudget)) : 0;
ob_start();
?>
data-item-side=""
data-fixed="1"
0) { ?>data-item-width="">
, 'keys'=>[...]], … ] pour sous-titres chips
* side_options optionnel (MSIN-4515) : [ ['value'=>'face','label'=>'Face'], … ]
*/
function fxMs1UiRenderDualPanel($tabCfg = []) {
$strSectionId = (string)($tabCfg['section_id'] ?? '');
$strAvailTitle = (string)($tabCfg['available_title'] ?? '');
$strSelectedTitle = (string)($tabCfg['selected_title'] ?? '');
$strSearchPh = (string)($tabCfg['search_placeholder'] ?? '');
$strEmpty = (string)($tabCfg['empty_label'] ?? '');
$strRemove = (string)($tabCfg['label_remove'] ?? '');
$strInputNameTpl = (string)($tabCfg['input_name_tpl'] ?? 'items[%s][]');
$strInputName = $strInputNameTpl !== '' ? sprintf($strInputNameTpl, $strSectionId) : '';
$tabAvailable = is_array($tabCfg['available'] ?? null) ? $tabCfg['available'] : [];
$tabSelected = is_array($tabCfg['selected'] ?? null) ? $tabCfg['selected'] : [];
$tabFixed = is_array($tabCfg['fixed'] ?? null) ? $tabCfg['fixed'] : [];
$tabGroups = is_array($tabCfg['groups'] ?? null) ? $tabCfg['groups'] : [];
$tabSideOptions = is_array($tabCfg['side_options'] ?? null) ? $tabCfg['side_options'] : [];
$blnSideLocked = !empty($tabCfg['side_locked']);
$blnHideRemove = !empty($tabCfg['hide_remove']);
$strSidePickLabel = (string)($tabCfg['side_pick_label'] ?? '');
$tabSelectedKeys = [];
foreach ($tabSelected as $opt) {
$strK = (string)($opt['key'] ?? '');
if ($strK !== '') {
$tabSelectedKeys[$strK] = true;
}
}
// Index available by key for chip render
$tabAvailByKey = [];
foreach ($tabAvailable as $opt) {
$strK = (string)($opt['key'] ?? '');
if ($strK !== '') {
$tabAvailByKey[$strK] = $opt;
}
}
ob_start();
?>
' . fxMs1UiEsc($strGLabel) . '
';
}
foreach ($tabKeys as $strK) {
$strK = (string)$strK;
if (!isset($tabAvailByKey[$strK])) {
continue;
}
$opt = $tabAvailByKey[$strK];
$blnUsed = !empty($tabSelectedKeys[$strK]);
$intW = (int)($opt['width'] ?? 0);
$strLab = (string)($opt['label'] ?? $strK);
?>
$strK,
'label' => (string)($opt['label'] ?? $strK),
'width' => 0,
'fixed' => true,
'input_name' => $strInputName,
'side' => (string)($opt['side'] ?? ''),
'side_options' => $tabSideOptions,
'side_locked' => $blnSideLocked,
'hide_remove' => $blnHideRemove,
]);
}
foreach ($tabSelected as $opt) {
$strK = (string)($opt['key'] ?? '');
if ($strK === '') {
continue;
}
$blnFixedItem = !empty($opt['fixed']);
if (!$blnFixedItem) {
$blnAnyOptional = true;
}
echo fxMs1UiRenderDualSelectedItem([
'key' => $strK,
'label' => (string)($opt['label'] ?? $strK),
'width' => $blnFixedItem ? 0 : (int)($opt['width'] ?? 0),
'input_name' => $strInputName,
'label_remove' => $strRemove,
'fixed' => $blnFixedItem,
'side' => (string)($opt['side'] ?? ''),
'side_options' => $tabSideOptions,
'side_locked' => $blnSideLocked,
'hide_remove' => $blnHideRemove || $blnFixedItem,
]);
}
?>
>