Exemplo n.º 1
0
function render_single_member_selector(Dimension $dimension, $genid = null, $selected_member_ids = null, $options = array()) {
	if (is_null($genid)) $genid = gen_id();
	
	$dimension_options = $dimension->getOptions(true);
	$dim_info = array(
		'dimension_id' => $dimension->getId(),
		'dimension_code' => $dimension->getCode(),
		'dimension_options' => $dimension_options,
		'is_manageable' => $dimension->getIsManageable(),
		'is_required' => array_var($options, 'is_required'),
		'is_multiple' => array_var($options, 'is_multiple'),
	);
	if($dimension_options && isset($dimension_options->useLangs) && $dimension_options->useLangs ) {
		$dim_info['dimension_name'] = lang($dimension->getCode());
	}
	
	$dimensions = array($dim_info);
	
	
	if (is_null($selected_member_ids)) $selected_member_ids = array();
			
	// Set view variables
	$selected_members = count($selected_member_ids) > 0 ? Members::findAll(array('conditions' => 'id IN ('.implode(',', $selected_member_ids).')')) : array();
	$selected_members_json = "[".implode(',', $selected_member_ids)."]";
	$component_id = "$genid-member-selectors-panel-$content_object_type_id";
	
	$listeners = array_var($options, 'listeners', array());
	$allowed_member_type_ids = array_var($options, 'allowedMemberTypes', null);
	
	// Render view
	include get_template_path("components/multiple_dimension_selector", "dimension");
}