public/wordpress/wp-content/plugins/wp-courseware/includes/legacy/admin/functions.php
/**
 * Create a dropdown box using the list of values provided and select a value if $selected is specified.
 *
 * @since 1.0.0
 *
 * @param string $name The name of the drop down box.
 * @param string $values The values to use for the drop down box.
 * @param string $selected If specified, the value of the drop down box to mark as selected.
 * @param string $cssid The CSS ID of the drop down list.
 * @param string $cssclass The CSS class for the drop down list.
 *
 * @return string The HTML for the select box.
 */
Create a dropdown box using the list of values provided and select a value if $selected is specified.

@param string $name The name of the drop down box.
@param string $values The values to use for the drop down box.
@param string $selected If specified, the value of the drop down box to mark as selected.
@param string $cssid The CSS ID of the drop down list.
@param string $cssclass The CSS class for the drop down list.

@return string The HTML for the select box.
Create a dropdown box using the list of values provided and select a value if $selected is specified . @param string $name The name of the drop down box . @param string $values The values to use for the drop down box . @param string $selected If specified the value of the drop down box to mark as selected . @param string $cssid The CSS ID of the drop down list . @param string $cssclass The CSS class for the drop down list . @return string The HTML for the select box .
function WPCW_forms_createDropdown( $name, $values, $selected, $cssid = false, $cssclass = false ) {
	if ( ! $values ) {
		return false;
	}
	$selectedhtml = 'selected="selected" ';
	$css_attrib = false;
	if ( $cssid ) {
		$css_attrib = "id=\"$cssid\" ";
	}
	if ( $cssclass ) {
		$css_attrib .= "class=\"$cssclass\" ";
	}
	$html = sprintf( '<select name="%s" %s>', $name, $css_attrib );
	foreach ( $values as $key => $details ) {
		if ( is_array( $details ) ) {
			$html .= sprintf( '<option value="%s" data-content="%s" data-content-two="%s" %s>%s&nbsp;&nbsp;</option>',
				$key, $details['data'], $details['data2'], ( $key == $selected ? $selectedhtml : '' ), $details['label']
			);
		} 
		else {
			$html .= sprintf( '<option value="%s" %s>%s&nbsp;&nbsp;</option>', $key, ( $key == $selected ? $selectedhtml : '' ), $details );
		}
	}
	return $html . '</select>';
}
function WPCW_forms_createDropdown ( $ name , $ values , $ selected , $ cssid = false , $ cssclass = false ) { if ( ! $ values ) { return false ; } $ selectedhtml = 'selected="selected" ' ; $ css_attrib = false ; if ( $ cssid ) { $ css_attrib = " id= \" $ cssid \" " ; } if ( $ cssclass ) { $ css_attrib .= " class= \" $ cssclass \" " ; } $ html = sprintf ( '<select name="%s" %s>' , $ name , $ css_attrib ) ; foreach ( $ values as $ key => $ details ) { if ( is_array ( $ details ) ) { $ html .= sprintf ( '<option value="%s" data-content="%s" data-content-two="%s" %s>%s&nbsp;&nbsp;</option>' , $ key , $ details [ 'data' ] , $ details [ 'data2' ] , ( $ key == $ selected ? $ selectedhtml : '' ) , $ details [ 'label' ] ) ; } else { $ html .= sprintf ( '<option value="%s" %s>%s&nbsp;&nbsp;</option>' , $ key , ( $ key == $ selected ? $ selectedhtml : '' ) , $ details ) ; } } return $ html . '</select>' ; }
Create a dropdown box using the list of values provided and select a value if $selected is specified.
Create a dropdown box using the list of values provided and select a value if $selected is specified .
// CSS Attributes // Handle value => array('label' => '', 'data' => '', 'data2' => '') // This adds extra HTML5 data. // Handle value => data