예제 #1
0
 /**
  * This is a stub for {@link select_input_options()} which builds the required list
  * of <option> elements from a given list of options ($field_options) and
  * the selected value ($field_value).
  *
  * @uses select_input_options()
  * @param string field name
  * @param mixed Initial value
  * @param array Options. If an associative key (string) is used, this gets the value attribute.
  *              NOTE: numeric strings get converted to integers by PHP!
  * @param string Field label to be display before the field
  * @param string Note
  * @param array Optional params. Additionally to {@link $_common_params} you can use:
  *              - 'force_keys_as_values': Use the key of $field_options for "value" attrib always.
  *              - Plus all of {@link select_input_options()}.
  * @return mixed true (if output) or the generated HTML if not outputting
  */
 function select_input_array($field_name, $field_value, $field_options, $field_label, $field_note = NULL, $field_params = array())
 {
     if (isset($field_params['force_keys_as_values'])) {
         $force_keys_as_values = $field_params['force_keys_as_values'];
         unset($field_params['force_keys_as_values']);
         // not an attribute to <select>
     } else {
         $force_keys_as_values = false;
     }
     if (isset($field_params['background_color'])) {
         $color_array = $field_params['background_color'];
         unset($field_params['background_color']);
         // not an attribute to <select>
     } else {
         $color_array = false;
     }
     // Build $options_list
     $options_list = Form::get_select_options_string($field_options, $field_value, $force_keys_as_values, $color_array);
     return $this->select_input_options($field_name, $options_list, $field_label, $field_note, $field_params);
 }
예제 #2
0
/**
 * Display link position edit action
 * 
 * @param $row
 */
function display_link_position(&$row)
{
    global $LinkOwner, $htsrv_url;
    // TODO: fp>dh: can you please implement cumbs in here? I don't clearly understand your code.
    // TODO: dh> only handle images
    $id = 'display_position_' . $row->link_ID;
    // NOTE: dh> using method=get so that we can use regenerate_url (for non-JS).
    $r = '<form action="" method="post">
		<select id="' . $id . '" name="link_position">' . Form::get_select_options_string($LinkOwner->get_positions(), $row->link_position, true) . '</select>' . '<script type="text/javascript">jQuery("#' . $id . '").change( { url: "' . $htsrv_url . '", crumb: "' . get_crumb('link') . '" }, function( event ) {
			evo_display_position_onchange( this, event.data.url, event.data.crumb ) } );</script>';
    $r .= '<noscript>';
    // Add hidden fields for non-JS
    $url = regenerate_url('p,itm_ID,action', 'link_ID=' . $row->link_ID . '&action=set_link_position&' . url_crumb('link'), '', '&');
    $params = explode('&', substr($url, strpos($url, '?') + 1));
    foreach ($params as $param) {
        list($k, $v) = explode('=', $param);
        $r .= '<input type="hidden" name="' . htmlspecialchars($k) . '" value="' . htmlspecialchars($v) . '" />';
    }
    $r .= '<input class="SaveButton" type="submit" value="&raquo;" />';
    $r .= '</noscript>';
    $r .= '</form>';
    return $r;
}