Example #1
0
function paramToId($param)
{
    $str = '';
    foreach ($param as $key => $value) {
        if ($key > 0) {
            $str .= ' ';
        }
        $str .= $value->value;
    }
    return idWrapAdd($str);
}
<?php

$timeType_id = $param[1]->value;
$timeType_name = $param[1]->text;
$title = $timeType_name . ' Time';
$unit = null;
$datatype = 'datetime';
$filter_type = 'none';
$id = idWrapAdd($category . ' ' . $timeType_id);
switch ($timeType_id) {
    case 'tap':
        $field = 'tap_dt';
        $from = 'bop_ht';
        break;
    default:
        break;
}
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
$sql = "select c.child_name_id, c.html_class \n" . "from data_chart.param_input_child c \n" . "where c.option_value = '" . $name_id . "' \n" . "order by c.order_num \n";
if (!$conn->query($sql)) {
    $error_arr[] = $conn->error;
}
$result = $conn->query($sql);
while ($row = $result->fetch_assoc()) {
    $child_name_id = $row["child_name_id"];
    $html_class = $row["html_class"];
    $html .= formElemCreate($child_name_id, $html_class);
}
$id_second_part = idFromFirstOptions($html);
$id = idWrapAdd("{$id_first_part} {$id_second_part}");
$def = definitionCreate($id);
$filter_type = $def->info->filter_type;
if (count($error_arr) === 0) {
    $conn->commit();
    $status = "success";
} else {
    $conn->rollback();
    $status = "failure";
}
$output = new stdClass();
$output->html = $html;
$output->status = $status;
$output->errorArr = $error_arr;
// $output->debugSQL = $sql;
$output->id = $id;
<?php

$area_id = $param[1]->value;
$area_name = $param[1]->text;
$elem_id = strtoupper($param[2]->value);
$elem_name = $param[2]->text;
$title = "Yield: {$area_name} {$elem_name}";
$id = idWrapAdd("{$category} {$area_id} {$elem_id}");
$unit = '%';
switch ($area_id) {
    case 'bop':
        $field = '( ' . idWrapAdd("chem chem_diff ILAD BLAD {$elem_id}") . ' ) / ' . '( ' . idWrapAdd("bop_ladle_add bop_ladle_{$elem_id} total_cntd") . ' / 5000.0 )';
        $id_arr = idMultiStrToArr($field);
        break;
    default:
        break;
}
<?php

$equip_id = $param[1]->value;
$equip_name = $param[1]->text;
// $title = $timeType_name . ' Time';
$unit = null;
$datatype = 'text';
$filter_type = 'none';
$id = idWrapAdd($category . ' ' . $equip_id);
switch ($equip_id) {
    case 'stl_ldl':
        // $field = 'tap_dt';
        // $from = 'bop_ht';
        break;
    default:
        break;
}
<?php

$general_id = $param[1]->value;
$general_name = $param[1]->text;
$specific_id = $param[2]->value;
$specific_name = $param[2]->text;
$title = "BOP {$general_name} ({$specific_name})";
$unit = 'lbs';
$id = idWrapAdd("{$category} {$general_id} {$specific_id}");
$field = 'act_wt';
$from = 'bop_ht_mat_add';
$join = 'left outer';
$nullToZero = true;
switch ($general_id) {
    case 'bop_ladle_AL':
        switch ($specific_id) {
            case 'total_cntd':
                $where_local = "mat_cd = 'foo' ";
                break;
            case 'shred':
                $where_local = "mat_cd = '56' ";
                break;
            case 'cone':
                $where_local = "mat_cd = '55' ";
                break;
            case 'bar':
                $where_local = "mat_cd = '13' ";
                break;
            default:
                break;
        }
Example #7
0
function categoryHTML($area)
{
    require_once SERVER_ROOT . '/php/dist/extension.php';
    require_once SERVER_ROOT . '/module/definition/module.php';
    require_once SERVER_ROOT . '/module/form_elem/module.php';
    require_once SERVER_ROOT . '/module/category/dist/id_from_first_options.php';
    $html_class = "m-category";
    switch ($area) {
        case 'y-axis':
            $html_class .= " areatype-axis";
            break;
        case 'x-axis':
            $html_class .= " areatype-axis";
            break;
        case 'filters':
            $html_class .= " areatype-filters";
            break;
        default:
            break;
    }
    $category_html = formElemCreate("category", null, $area);
    $id = idFromFirstOptions($category_html);
    $id = idWrapAdd($id);
    $def = definitionCreate($id);
    $filter_type = $def->info->filter_type;
    $filter_wrap_html_class = 'filter-wrap row';
    if ($filter_type === 'none') {
        $filter_wrap_html_class .= ' hidden';
    }
    ob_start();
    //Function continues...
    ?>

		
		<div class="<?php 
    echo $html_class;
    ?>
">
		
			<div class="category-wrap">
				<?php 
    echo $category_html;
    ?>
			</div>
	

			<div class="<?php 
    echo $filter_wrap_html_class;
    ?>
">
				<div class="operator-wrap col-xs-4 halfPad-xs">
					<?php 
    echo formElemCreate("filter_operator", "operator");
    ?>
				</div>

				<div class="col-xs-8 noPad-xs">
					<div class="equal-wrap col-xs-6 halfPad-xs hidden">
						<?php 
    echo formElemCreate("filter_min", "equal");
    ?>
					</div>

					<div class="min-wrap col-xs-6 halfPad-xs hidden">
						<?php 
    echo formElemCreate("filter_min", "min");
    ?>
					</div>

					<div class="max-wrap col-xs-6 halfPad-xs hidden">
						<?php 
    echo formElemCreate("filter_max", "max");
    ?>
					</div>
				</div>
			</div>

		</div>
		  

<?php 
    //...function continues.
    $html = ob_get_clean();
    return $html;
}
<?php

$singleOrDiff = $param[1]->value;
$unit = '°F';
switch ($singleOrDiff) {
    case 'temp_single':
        $test_id = $param[2]->value;
        $test_name = $param[2]->text;
        $title = 'Temp ' . $test_name;
        $id = idWrapAdd("{$category} temp_single {$test_id}");
        switch ($test_id) {
            case 'hm_ladle':
                $field = 'hm_ldl_act_tp';
                $from = 'bop_ht';
                $where_realistic = "{$id} > 2000";
                break;
            case 'tap':
                $field = 'tap_tp';
                $from = 'bop_ht';
                $where_realistic = "{$id} > 2800";
                break;
            case 'tol':
                $field = 'TOL_tp';
                $from = 'bop_ht';
                $where_realistic = "{$id} > 2800";
                break;
            case 'ar_arrive':
                $field = 'samp_tp';
                $from = 'ms_chem_celox';
                $where_local = "  and fac_id = 'A' \n" . "  and samp_designation = 'ARV' ";
                $where_realistic = "{$id} > 2800";
<?php

$singleOrDiff = $param[1]->value;
$unit = '%';
switch ($singleOrDiff) {
    case 'chem_single':
        $test_id = $param[2]->value;
        $test_name = $param[2]->text;
        $elem_id = strtoupper($param[3]->value);
        $elem_name = $param[3]->text;
        $title = "Chem {$test_name} {$elem_name}";
        $id = idWrapAdd("{$category} {$test_id} {$elem_id}");
        switch ($test_id) {
            case 'BLAD':
                $field = 'elem_pct';
                $from = 'ms_ht_chem_samp_anal';
                $where_local = "test_id = 'BLAD' \n" . "and elem_cd = '{$elem_id}' ";
                break;
            case 'ILAD':
                $field = 'elem_pct';
                $from = 'ms_ht_chem_samp_anal';
                $where_local = "test_id = 'ILAD' \n" . "and elem_cd = '{$elem_id}' ";
                break;
            case 'dsf_start':
                $field = 'S_pct';
                $from = 'bop_ht_leco';
                $where_local = "test_typ = 'IS'";
                $where_realistic = "{$id} > 0";
                break;
            case 'dsf_init':
                $field = 'dslf_init_S';