| 1553 |
$parent_cont = $extra_array[1]; |
$parent_cont = $extra_array[1]; |
| 1554 |
} |
} |
| 1555 |
|
|
| 1556 |
$array = explode('||', $string); |
$array = activeselect_explode_values($string); |
|
foreach ($array as $key => $value) { |
|
|
$match = explode('|', $value); |
|
|
$array[$match[0]] = html_entity_decode($match[1]); |
|
|
unset($array[$key]); |
|
|
} |
|
| 1557 |
|
|
| 1558 |
$targets = explode(',', $targets); |
$targets = explode(',', $targets); |
| 1559 |
if (count($targets) == 1 && $targets[0] == 'parents') { |
if (count($targets) == 1 && $targets[0] == 'parents') { |
| 1571 |
$exclude[] = $node->nid; |
$exclude[] = $node->nid; |
| 1572 |
} |
} |
| 1573 |
$cont = category_get_container($cnid); |
$cont = category_get_container($cnid); |
| 1574 |
$multiple = ($cont->hierarchy == 2) ? 1 : 0; |
$multiple = ($cont->hierarchy == 2); |
| 1575 |
if ($parent_cont) { |
if ($parent_cont) { |
| 1576 |
$parents = array($parent_cont); |
$parents = array($parent_cont); |
| 1577 |
} |
} |
| 1578 |
|
|
| 1579 |
$options = _category_category_select_options($cnid, $multiple, '<'. t('root') .'>', $parents, $exclude); |
$options = _category_category_select_options($cnid, $multiple, '<'. t('root') .'>', $parents, $exclude); |
| 1580 |
foreach ($options as $key => $value) { |
foreach ($options as $key => $value) { |
| 1581 |
$options[$key] = str_replace('|', '|', $options[$key]); |
unset($options[$key]); |
| 1582 |
if (in_array($key, $parents)) { |
$options[$key]['value'] = $value; |
| 1583 |
$options[$key] .= '|selected'; |
$options[$key]['selected'] = in_array($key, $parents); |
|
} |
|
| 1584 |
} |
} |
|
$target_name = str_replace('|', '|', $targets[0]). ($multiple ? '|multiple' : ''); |
|
| 1585 |
|
|
| 1586 |
$output = array($target_name => activeselect_implode_array($options)); |
$output = array($targets[0] => array('options' => $options, 'multiple' => $multiple)); |
| 1587 |
print activeselect_implode_activeselect($output); |
activeselect_set_header_nocache(); |
| 1588 |
|
print drupal_to_js($output); |
| 1589 |
exit(); |
exit(); |
| 1590 |
} |
} |
| 1591 |
} |
} |
| 1656 |
} |
} |
| 1657 |
|
|
| 1658 |
foreach ($options as $key => $value) { |
foreach ($options as $key => $value) { |
| 1659 |
|
unset($options[$key]); |
| 1660 |
|
$options[$key]['value'] = $value; |
| 1661 |
|
$options[$key]['selected'] = in_array($key, $parents); |
| 1662 |
$options[$key] = str_replace('|', '|', $options[$key]); |
$options[$key] = str_replace('|', '|', $options[$key]); |
| 1663 |
if (is_array($node_cats)) { |
if (is_array($node_cats)) { |
| 1664 |
if (in_array($key, $node_cats)) { |
$options[$key]['selected'] = in_array($key, $node_cats); |
|
$options[$key] .= '|selected'; |
|
|
} |
|
| 1665 |
} |
} |
| 1666 |
else { |
else { |
| 1667 |
if ($key == $node_cats) { |
$options[$key]['selected'] = ($key == $node_cats); |
|
$options[$key] .= '|selected'; |
|
|
} |
|
| 1668 |
} |
} |
| 1669 |
} |
} |
| 1670 |
} |
} |
| 1671 |
|
|
| 1672 |
$multiple = $container->multiple ? 1 : 0; |
$multiple = ($container->multiple ? TRUE : FALSE); |
|
$target_name = str_replace('|', '|', $target). ($multiple ? '|multiple' : ''); |
|
| 1673 |
|
|
| 1674 |
$output[$target_name] = activeselect_implode_array($options); |
$output[$target] = array('options' => $options, 'multiple' => $multiple); |
| 1675 |
} |
} |
| 1676 |
|
|
| 1677 |
activeselect_set_header_nocache(); |
activeselect_set_header_nocache(); |
| 1678 |
|
|
| 1679 |
print activeselect_implode_activeselect($output); |
print drupal_to_js($output); |
| 1680 |
} |
} |
| 1681 |
|
|
| 1682 |
exit(); |
exit(); |