コード例 #1
0
ファイル: OptionsTest.php プロジェクト: mindfeederllc/openemr
 public function test_disp_end_cell()
 {
     global $item_count;
     $item_count = 1;
     $expected = '</td>';
     ob_start();
     disp_end_cell();
     $captured = ob_get_clean();
     $this->assertEquals($expected, $captured);
 }
コード例 #2
0
ファイル: options.inc.php プロジェクト: johnnytang24/openemr
function display_layout_tabs_data_editable($formtype, $result1, $result2 = '')
{
    global $item_count, $cell_count, $last_group, $CPR;
    $fres = sqlStatement("SELECT distinct group_name FROM layout_options " . "WHERE form_id = ? AND uor > 0 " . "ORDER BY group_name, seq", array($formtype));
    $first = true;
    while ($frow = sqlFetchArray($fres)) {
        $this_group = $frow['group_name'];
        $group_name = substr($this_group, 1);
        $group_name_esc = htmlspecialchars($group_name, ENT_QUOTES);
        $titlecols = $frow['titlecols'];
        $datacols = $frow['datacols'];
        $data_type = $frow['data_type'];
        $field_id = $frow['field_id'];
        $list_id = $frow['list_id'];
        $currvalue = '';
        $group_fields_query = sqlStatement("SELECT * FROM layout_options " . "WHERE form_id = ? AND uor > 0 AND group_name = ? " . "ORDER BY seq", array($formtype, $this_group));
        ?>

		<div class="tab <?php 
        echo $first ? 'current' : '';
        ?>
" id="tab_<?php 
        echo $group_name_esc;
        ?>
" >
			<table border='0' cellpadding='0'>

			<?php 
        while ($group_fields = sqlFetchArray($group_fields_query)) {
            $titlecols = $group_fields['titlecols'];
            $datacols = $group_fields['datacols'];
            $data_type = $group_fields['data_type'];
            $field_id = $group_fields['field_id'];
            $list_id = $group_fields['list_id'];
            $currvalue = '';
            if ($formtype == 'DEM') {
                if ($GLOBALS['athletic_team']) {
                    // Skip fitness level and return-to-play date because those appear
                    // in a special display/update form on this page.
                    if ($field_id === 'fitness' || $field_id === 'userdate1') {
                        continue;
                    }
                }
                if (strpos($field_id, 'em_') === 0) {
                    // Skip employer related fields, if it's disabled.
                    if ($GLOBALS['omit_employers']) {
                        continue;
                    }
                    $tmp = substr($field_id, 3);
                    if (isset($result2[$tmp])) {
                        $currvalue = $result2[$tmp];
                    }
                } else {
                    if (isset($result1[$field_id])) {
                        $currvalue = $result1[$field_id];
                    }
                }
            } else {
                if (isset($result1[$field_id])) {
                    $currvalue = $result1[$field_id];
                }
            }
            // Handle a data category (group) change.
            if (strcmp($this_group, $last_group) != 0) {
                $group_name = substr($this_group, 1);
                // totally skip generating the employer category, if it's disabled.
                if ($group_name === 'Employer' && $GLOBALS['omit_employers']) {
                    continue;
                }
                $last_group = $this_group;
            }
            // Handle starting of a new row.
            if ($titlecols > 0 && $cell_count >= $CPR || $cell_count == 0) {
                disp_end_row();
                echo "<tr>";
            }
            if ($item_count == 0 && $titlecols == 0) {
                $titlecols = 1;
            }
            // Handle starting of a new label cell.
            if ($titlecols > 0) {
                disp_end_cell();
                $titlecols_esc = htmlspecialchars($titlecols, ENT_QUOTES);
                echo "<td class='label' colspan='{$titlecols_esc}' ";
                echo ">";
                $cell_count += $titlecols;
            }
            ++$item_count;
            // Added 5-09 by BM - Translate label if applicable
            if ($group_fields['title']) {
                echo htmlspecialchars(xl_layout_label($group_fields['title']), ENT_NOQUOTES) . ":";
            } else {
                echo "&nbsp;";
            }
            // Handle starting of a new data cell.
            if ($datacols > 0) {
                disp_end_cell();
                $datacols_esc = htmlspecialchars($datacols, ENT_QUOTES);
                echo "<td class='text data' colspan='{$datacols_esc}'";
                echo ">";
                $cell_count += $datacols;
            }
            ++$item_count;
            echo generate_form_field($group_fields, $currvalue);
        }
        ?>

			</table>
		</div>

 	 <?php 
        $first = false;
    }
}
コード例 #3
0
ファイル: options.inc.php プロジェクト: juggernautsei/openemr
function display_layout_tabs_data_editable($formtype, $result1, $result2='') {
  global $item_count, $cell_count, $last_group, $CPR,$condition_str;

  $fres = sqlStatement("SELECT distinct group_name FROM layout_options " .
    "WHERE form_id = ? AND uor > 0 " .
    "ORDER BY group_name, seq", array($formtype) );

	$first = true;
	while ($frow = sqlFetchArray($fres)) {
		$this_group = $frow['group_name'];
		$group_name = substr($this_group, 1);
	        $group_name_esc = htmlspecialchars( $group_name, ENT_QUOTES);
		$titlecols  = $frow['titlecols'];
		$datacols   = $frow['datacols'];
		$data_type  = $frow['data_type'];
		$field_id   = $frow['field_id'];
		$list_id    = $frow['list_id'];
		$currvalue  = '';

		if (substr($this_group,1,8) === 'Employer' && $GLOBALS['omit_employers']) continue;

		$group_fields_query = sqlStatement("SELECT * FROM layout_options " .
		"WHERE form_id = ? AND uor > 0 AND group_name = ? " .
		"ORDER BY seq", array($formtype,$this_group) );
	?>

		<div class="tab <?php echo $first ? 'current' : '' ?>" id="tab_<?php echo str_replace(' ', '_',$group_name_esc)?>" >
			<table border='0' cellpadding='0'>

			<?php
				while ($group_fields = sqlFetchArray($group_fields_query)) {

					$titlecols  = $group_fields['titlecols'];
					$datacols   = $group_fields['datacols'];
					$data_type  = $group_fields['data_type'];
					$field_id   = $group_fields['field_id'];
					$list_id    = $group_fields['list_id'];
					$backup_list = $group_fields['list_backup_id'];
                    $condition_str = get_conditions_str($condition_str,$group_fields);
					$currvalue  = '';

					if ($formtype == 'DEM') {
					  if (strpos($field_id, 'em_') === 0) {
					// Skip employer related fields, if it's disabled.
						if ($GLOBALS['omit_employers']) continue;
						$tmp = substr($field_id, 3);
						if (isset($result2[$tmp])) $currvalue = $result2[$tmp];
					  }
					  else {
						if (isset($result1[$field_id])) $currvalue = $result1[$field_id];
					  }
					}
					else {
					  if (isset($result1[$field_id])) $currvalue = $result1[$field_id];
					}

					// Handle a data category (group) change.
					if (strcmp($this_group, $last_group) != 0) {
					  $group_name = substr($this_group, 1);
					  // totally skip generating the employer category, if it's disabled.
					  if ($group_name === 'Employer' && $GLOBALS['omit_employers']) continue;
					  $last_group = $this_group;
					}

					// Handle starting of a new row.
					if (($titlecols > 0 && $cell_count >= $CPR) || $cell_count == 0) {
					  disp_end_row();
					  echo "<tr>";
					}

					if ($item_count == 0 && $titlecols == 0) {
						$titlecols = 1;
					}

					// Handle starting of a new label cell.
					if ($titlecols > 0) {
					  disp_end_cell();
					  $titlecols_esc = htmlspecialchars( $titlecols, ENT_QUOTES);
                      $field_id_label = 'label_'.$group_fields['field_id'];
					  echo "<td class='label' colspan='$titlecols_esc' id='$field_id_label' ";
					  echo ">";
					  $cell_count += $titlecols;
					}
					++$item_count;

					// Added 5-09 by BM - Translate label if applicable
					if ($group_fields['title']) echo (htmlspecialchars( xl_layout_label($group_fields['title']), ENT_NOQUOTES).":"); else echo "&nbsp;";

					// Handle starting of a new data cell.
					if ($datacols > 0) {
					  disp_end_cell();
					  $datacols_esc = htmlspecialchars( $datacols, ENT_QUOTES);
                      $field_id = 'text_'.$group_fields['field_id'];
					  echo "<td class='text data' colspan='$datacols_esc' id='$field_id'";
					  echo ">";
					  $cell_count += $datacols;
					}

					++$item_count;

					echo generate_form_field($group_fields, $currvalue);
				  }
			?>

			</table>
		</div>

 	 <?php

	$first = false;

	}
}