Пример #1
0
        } else {
            $cbt_name = '';
            $cab_color = 'd3d3d3';
        }
    }
}
echo '<div class="container">' . K_NEWLINE;
echo '<div class="tceformbox">' . K_NEWLINE;
echo '<form action="' . $_SERVER['SCRIPT_NAME'] . '" method="post" enctype="multipart/form-data" id="form_editor">' . K_NEWLINE;
echo F_connection_selector($sel_a_obj_id, $sel_b_obj_id, $sel_cbt_id);
echo getFormNoscriptSelect('selectrecord');
echo '<div class="row"><hr /></div>' . K_NEWLINE;
if (isset($cab_ids) and !empty($cab_ids)) {
    echo getFormDescriptionLine($l['w_object'] . ' (A)', '', F_get_object_path($cab_a_obj_id, true));
    echo getFormDescriptionLine($l['w_object'] . ' (B)', '', F_get_object_path($cab_b_obj_id, true));
    echo getFormDescriptionLine($l['w_connection_type'], '', $cbt_name);
} else {
    echo F_object_selector($cab_a_obj_id, 'cab_a_obj_id', $l['w_object'] . ' (A)', false, false);
    echo F_object_selector($cab_b_obj_id, 'cab_b_obj_id', $l['w_object'] . ' (B)', false, false);
    echo F_select_connection_type($cab_cbt_id);
}
echo F_select_color($cab_color, 'cab_color', $l['w_color'], $l['h_cable_color']);
echo '<div class="row">' . K_NEWLINE;
// show buttons by case
if (isset($cab_ids) and !empty($cab_ids)) {
    echo '<span style="background-color:#999999;">';
    echo '<input type="checkbox" name="confirmupdate" id="confirmupdate" value="1" title="confirm &rarr; update" />';
    F_submit_button('update', $l['w_update'], $l['h_update']);
    echo '</span>';
    F_submit_button('delete', $l['w_delete'], $l['h_delete']);
} else {
Пример #2
0
/**
 * Returns an HTML description of a single object array.
 * @param $obj_id (int) Object ID.
 * @param $objdata (array) Object data array.
 * @param $tempfields (array) Array of template fields.
 * @param $tfkeys (array) Array of template fields keys.
 * @param $level (int) Count nesting level of child objects.
 * @return string Object data.
 */
function F_get_object_info($obj_id, $objdata, $tempfields, $tfkeys, $level = 0)
{
    global $l, $db;
    require_once '../config/tce_config.php';
    require_once 'tce_functions_group_permissions.php';
    $ret = '';
    // list parent objects of virtual object
    if (isset($objdata['obj_parents']) and !empty($objdata['obj_parents'])) {
        $ret .= getFormDescriptionLine($l['w_child_of'], '', $objdata['obj_parents']);
    }
    // manufacturer
    if (isset($objdata['obj_mnf']) and !empty($objdata['obj_mnf'])) {
        $ret .= getFormDescriptionLine($l['w_manufacturer'], '', htmlspecialchars($objdata['obj_mnf'], ENT_COMPAT, $l['a_meta_charset']));
    }
    // owner
    if (isset($objdata['obj_owner']) and !empty($objdata['obj_owner'])) {
        $ret .= getFormDescriptionLine($l['w_owner'], '', htmlspecialchars($objdata['obj_owner'], ENT_COMPAT, $l['a_meta_charset']));
    }
    // tenant
    if (isset($objdata['obj_tenant']) and !empty($objdata['obj_tenant'])) {
        $ret .= getFormDescriptionLine($l['w_tenant'], '', htmlspecialchars($objdata['obj_tenant'], ENT_COMPAT, $l['a_meta_charset']));
    }
    // label
    if (isset($objdata['obj_label']) and !empty($objdata['obj_label'])) {
        $ret .= getFormDescriptionLine($l['w_label'], $l['h_ojbect_label'], htmlspecialchars($objdata['obj_label'], ENT_COMPAT, $l['a_meta_charset']));
    }
    // tag
    if (isset($objdata['obj_tag']) and !empty($objdata['obj_tag'])) {
        $ret .= getFormDescriptionLine($l['w_tag'], $l['h_ojbect_tag'], htmlspecialchars($objdata['obj_tag'], ENT_COMPAT, $l['a_meta_charset']));
    }
    // description
    if (isset($objdata['obj_description']) and !empty($objdata['obj_description'])) {
        $ret .= getFormDescriptionLine($l['w_description'], $l['h_object_description'], htmlspecialchars($objdata['obj_description'], ENT_COMPAT, $l['a_meta_charset']));
    }
    // attributes
    if (isset($objdata['attribute']) and !empty($objdata['attribute'])) {
        foreach ($objdata['attribute'] as $atb_name => $atb_value) {
            if (!empty($atb_value)) {
                $val = htmlspecialchars($atb_value, ENT_COMPAT, $l['a_meta_charset']);
                if ($atb_name == 'IP' or $atb_name == 'IPv4' or $atb_name == 'IPv6') {
                    $ret .= getFormDescriptionLine($atb_name, '', '<a href="http://' . $val . '" title="IP" onclick="pdfWindow=window.open(\'http://' . $val . '\',\'pdfWindow\',\'dependent,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes\'); return false;">' . $val . '</a>');
                } else {
                    // replace template tokens on attribute value (if any)
                    $tmpval = $val;
                    // search #~...~# pattern on $val
                    preg_match_all('/([#][~][^~]+[~][#])/U', $val, $matches, PREG_SET_ORDER);
                    foreach ($matches as $v) {
                        if (isset($v[1])) {
                            $pattern = str_replace('*', '[A-Z0-9]', $v[1]);
                            if (preg_match('/' . $pattern . '/U', $tfkeys, $mk) > 0) {
                                if (isset($mk[0]) and !empty($mk[0]) and isset($tempfields[$mk[0]])) {
                                    $tmpval = str_replace($v[1], $tempfields[$mk[0]], $tmpval);
                                }
                            }
                        }
                    }
                    $val = $tmpval;
                    // check for link type
                    if (F_isURL($val)) {
                        // the attribute is a link
                        $val = '<a href="' . $val . '" title="' . $atb_name . '">' . $val . '</a>';
                    }
                    $ret .= getFormDescriptionLine($atb_name, '', $val);
                }
            }
        }
    }
    // Permissions
    if ($level == 0) {
        // print permissions only for parent objects
        $ret .= '<div class="row">' . K_NEWLINE;
        $ret .= '<span class="label">' . K_NEWLINE;
        $ret .= $l['w_permissions'] . ':' . K_NEWLINE;
        $ret .= '</span>' . K_NEWLINE;
        $ret .= '<div class="value">';
        $ret .= F_groupsPermsSelector($objdata['permissions'], true, true);
        $ret .= '</div>' . K_NEWLINE;
        $ret .= '</div>' . K_NEWLINE;
    }
    // list connections
    $connections = F_get_object_connections($obj_id);
    if (!empty($connections)) {
        $ret .= getFormDescriptionLine($l['w_connected_to'], '', $connections);
    }
    // *** list child ojbects (if any)
    if (isset($objdata['child']) and !empty($objdata['child'])) {
        $ret .= '<div class="row">' . K_NEWLINE;
        $ret .= '<span class="label">' . K_NEWLINE;
        $ret .= $l['w_child_objects'] . ':' . K_NEWLINE;
        $ret .= '</span>' . K_NEWLINE;
        $ret .= '<br /><div class="value">';
        foreach ($objdata['child'] as $name => $data) {
            $ret .= '<div style="background-color:#ffff99;font-weight:bold;">';
            $ret .= '<a href="tce_edit_objects.php?obj_id=' . $data['obj_id'] . '" title="' . $l['t_object_editor'] . ': ' . $data['obj_name'] . '">';
            if ($data['obj_obt_virtual']) {
                $ret .= '&otimes; ';
            }
            $ret .= htmlspecialchars($data['obj_name'], ENT_NOQUOTES, $l['a_meta_charset']);
            $ret .= '</a>';
            $ret .= '</div>';
            $ret .= F_get_object_info($data['obj_id'], $data, $tempfields, $tfkeys, ++$level);
        }
        $ret .= '</div>' . K_NEWLINE;
        $ret .= '</div>' . K_NEWLINE;
    }
    $ret .= '<div style="clear:both;margin:0;padding:0;height:0;font-size:0;">&nbsp;</div>' . K_NEWLINE;
    return $ret;
}
Пример #3
0
        $dcn_id = 0;
    }
} else {
    $dcn_id = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
echo '<div class="container">' . K_NEWLINE;
echo F_select_datacenter($dcn_id, $data, false);
echo '<div class="tceformbox">' . K_NEWLINE;
if (isset($data['dcn_name'])) {
    echo '<form action="' . $_SERVER['SCRIPT_NAME'] . '" method="post" enctype="multipart/form-data" id="form_editor">' . K_NEWLINE;
    echo '<div class="row" style="margin-bottom:10px;"><hr /></div>' . K_NEWLINE;
    echo getFormDescriptionLine($l['w_name'], $l['h_datacenter_name'], '<strong>' . htmlspecialchars($data['dcn_name'], ENT_COMPAT, $l['a_meta_charset']) . '</strong>');
    echo getFormDescriptionLine($l['w_website'], $l['h_website_url'], '<a href="' . htmlspecialchars($data['dcn_website_url'], ENT_COMPAT, $l['a_meta_charset']) . '" onclick="pdfWindow=window.open(\'' . htmlspecialchars($data['dcn_website_url'], ENT_COMPAT, $l['a_meta_charset']) . '\',\'pdfWindow\',\'dependent,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes\'); return false;" title="' . htmlspecialchars($data['dcn_name'], ENT_COMPAT, $l['a_meta_charset']) . '">' . htmlspecialchars($data['dcn_website_url'], ENT_COMPAT, $l['a_meta_charset']) . '</a>');
    echo getFormDescriptionLine($l['w_map'], $l['w_map'], '<a href="' . htmlspecialchars($data['dcn_map_url'], ENT_COMPAT, $l['a_meta_charset']) . '"onclick="pdfWindow=window.open(\'' . htmlspecialchars($data['dcn_map_url'], ENT_COMPAT, $l['a_meta_charset']) . '\',\'pdfWindow\',\'dependent,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes\'); return false;" title="' . htmlspecialchars($l['w_map'], ENT_COMPAT, $l['a_meta_charset']) . '">' . htmlspecialchars($data['dcn_map_url'], ENT_COMPAT, $l['a_meta_charset']) . '</a>');
    echo getFormDescriptionLine($l['w_description'], $l['h_datacenter_description'], str_replace("\n", '<br />', htmlspecialchars($data['dcn_description'], ENT_COMPAT, $l['a_meta_charset'])));
    // list of suites
    echo '<div class="row">' . K_NEWLINE;
    echo '<span class="label">' . $l['w_suites'] . '</span>' . K_NEWLINE;
    echo '<br /><div class="value">' . K_NEWLINE;
    $sql = 'SELECT * FROM ' . K_TABLE_SUITES . ' WHERE sts_dcn_id=' . $dcn_id . ' ORDER BY sts_name ASC';
    if ($r = F_db_query($sql, $db)) {
        echo '<ul>' . K_NEWLINE;
        while ($m = F_db_fetch_array($r)) {
            $sts_permission = F_getUserPermission($user_id, K_TABLE_SUITE_GROUPS, $m['sts_id']);
            if ($sts_permission > 0) {
                echo '<li><a href="tce_view_suite.php?dcn_id=' . $dcn_id . '&amp;sts_id=' . $m['sts_id'] . '" title="' . $l['w_view'] . ': ' . $m['sts_name'] . '">' . htmlspecialchars($m['sts_name'], ENT_NOQUOTES, $l['a_meta_charset']) . '</a></li>' . K_NEWLINE;
            }
        }
        echo '</ul>' . K_NEWLINE;
    } else {
    }
    $time_diff = gmdate('H:i:s', $time_diff);
    echo getFormDescriptionLine($l['w_test_time'] . ':', $l['w_test_time'], $time_diff);
    $passmsg = '';
    if ($usrtestdata['score_threshold'] > 0) {
        if ($usrtestdata['score'] >= $usrtestdata['score_threshold']) {
            $passmsg = ' - ' . $l['w_passed'];
        } else {
            $passmsg = ' - ' . $l['w_not_passed'];
        }
    }
    $score_all = $usrtestdata['score'] . ' / ' . $usrtestdata['max_score'] . ' (' . round(100 * $usrtestdata['score'] / $usrtestdata['max_score']) . '%)' . $passmsg;
    echo getFormDescriptionLine($l['w_score'] . ':', $l['h_score_total'], $score_all);
    $score_right_all = $usrtestdata['right'] . ' / ' . $usrtestdata['all'] . ' (' . round(100 * $usrtestdata['right'] / $usrtestdata['all']) . '%)';
    echo getFormDescriptionLine($l['w_answers_right'] . ':', $l['h_answers_right'], $score_right_all);
    echo getFormDescriptionLine($l['w_comment'] . ':', $l['h_testcomment'], F_decode_tcecode($usrtestdata['comment']));
    echo '<div class="rowl">' . K_NEWLINE;
    $topicresults = array();
    // per-topic results
    if (isset($testuser_id) and !empty($testuser_id)) {
        // display user questions
        $sql = 'SELECT *
			FROM ' . K_TABLE_QUESTIONS . ', ' . K_TABLE_TESTS_LOGS . ', ' . K_TABLE_SUBJECTS . ', ' . K_TABLE_MODULES . '
			WHERE question_id=testlog_question_id
				AND testlog_testuser_id=' . $testuser_id . '
				AND question_subject_id=subject_id
				AND subject_module_id=module_id
			ORDER BY testlog_id';
        if ($r = F_db_query($sql, $db)) {
            echo '<ol class="question">' . K_NEWLINE;
            while ($m = F_db_fetch_array($r)) {
Пример #5
0
if ($teststat['testinfo']['test_score_threshold'] > 0) {
    if (isset($teststat['testinfo']['user_score']) and $teststat['testinfo']['user_score'] >= $teststat['testinfo']['test_score_threshold']) {
        $passmsg = ' - ' . $l['w_passed'];
    } else {
        $passmsg = ' - ' . $l['w_not_passed'];
    }
}
if ($teststat['testinfo']['test_max_score'] > 0) {
    $score_all = $teststat['testinfo']['user_score'] . ' / ' . $teststat['testinfo']['test_max_score'] . ' (' . round(100 * $teststat['testinfo']['user_score'] / $teststat['testinfo']['test_max_score']) . '%)' . $passmsg;
} else {
    $score_all = $teststat['testinfo']['user_score'] . $passmsg;
}
echo getFormDescriptionLine($l['w_score'] . ':', $l['h_score_total'], $score_all);
$score_right_all = $teststat['qstats']['right'] . ' / ' . $teststat['qstats']['recurrence'] . ' (' . $teststat['qstats']['right_perc'] . '%)';
echo getFormDescriptionLine($l['w_answers_right'] . ':', $l['h_answers_right'], $score_right_all);
echo getFormDescriptionLine($l['w_comment'] . ':', $l['h_testcomment'], F_decode_tcecode($teststat['testinfo']['user_comment']));
if (F_getBoolean($teststat['testinfo']['test_report_to_users'])) {
    echo '<div class="rowl">' . K_NEWLINE;
    echo F_printUserTestStat($testuser_id);
    echo '</div>' . K_NEWLINE;
    // print statistics for modules and subjects
    echo '<div class="rowl">' . K_NEWLINE;
    echo '<hr />' . K_NEWLINE;
    echo '<h2>' . $l['w_stats'] . '</h2>';
    echo F_printTestStat($test_id, 0, $user_id, 0, 0, $testuser_id, $teststat, 1, true);
    echo '<hr />' . K_NEWLINE;
    echo '</div>' . K_NEWLINE;
    if (K_ENABLE_PUBLIC_PDF) {
        echo '<div class="row">' . K_NEWLINE;
        // PDF button
        echo '<a href="tce_pdf_results.php?mode=3&amp;test_id=' . $test_id . '&amp;user_id=' . $user_id . '&amp;testuser_id=' . $testuser_id . '" class="xmlbutton" title="' . $l['h_pdf'] . '">' . $l['w_pdf'] . '</a> ';