示例#1
0
function showPanel($chart_id, $panel_id, $dashboard_id, $help_msg, $analysis_msg)
{
    $username = $_SESSION["email"];
    $panel_db = new PanelDB();
    $p = $panel_db->selectPanel($panel_id, $username);
    if ($p["ishide"] == 1) {
        return;
    }
    $panel = new Panel();
    $panel->data = $p;
    $panel->data["left"] = $p["x"] . "px";
    $panel->data["top"] = $p["y"] . "px";
    //截图不需要显示这些
    if (!isset($_GET["snap"])) {
        $permission = new Permission();
        $isEditable = $permission->checkBoardEditPermission($dashboard_id, $_SESSION["email"]);
        $panel->addOptionPraise($panel->data["praiseStatus"], $panel->data["totalPraise"]);
        $panel->addOptionHelp();
        if ($isEditable && isset($_GET["edit"])) {
            $panel->addOptionFresh();
            $panel->addOptionEdit();
            if ($panel->data["data_lock"] == "1") {
                $panel->addOptionDataLock(1);
            } else {
                $panel->addOptionDataLock();
            }
            if ($panel->data["analysis_show"] == "1") {
                $panel->addOptionAnalysis(1);
            } else {
                $panel->addOptionAnalysis();
            }
            //$panel->addOptionChangeSize();
            $panel->data["dragable"] = 'dragable';
        }
    }
    //data["analysis_show"]=="1" 表示显示分析数据 ,如果显示分析数据:chart宽度60%,图标为打开;否则:width默认,图标为折叠样式
    if ($panel->data["analysis_show"] == "1") {
        $panel->data["content"] = "<div class='ichart small' style='width:70%' id='chart{$chart_id}'></div>";
        $panel->data["content"] .= "<div class='ichart_analysis_msg showing'>{$analysis_msg}</div>";
        $panel->data["content"] .= "<div class='ichart_help_msg' style='width:70%'>{$help_msg}</div>";
    } else {
        $panel->data["content"] = "<div class='ichart large' id='chart{$chart_id}'></div>";
        $panel->data["content"] .= "<div class='ichart_analysis_msg' style='display:none;'>{$analysis_msg}</div>";
        $panel->data["content"] .= "<div class='ichart_help_msg'>{$help_msg}</div>";
    }
    $panel->show();
}