Exemplo n.º 1
0
    tpl_set_var('language4js', $lang);
    if (isset($_REQUEST['ptSelector'])) {
        $powerTrail = new PowerTrail(array('id' => $_REQUEST['ptSelector']));
        $_SESSION['ptRmByCog'] = 1;
        $ptData = powerTrailBase::getPtDbRow($_REQUEST['ptSelector']);
        $ptStatus = \lib\Controllers\PowerTrailController::getPowerTrailStatus();
        $ptType = powerTrailBase::getPowerTrailTypes();
        tpl_set_var("ptCaches", preparePtCaches($powerTrail));
        tpl_set_var("ptStatSelect", generateStatusSelector($powerTrail->getStatus()));
        tpl_set_var("ptId", $powerTrail->getId());
        tpl_set_var("ptName", $powerTrail->getName());
        tpl_set_var("ptType", tr($ptType[$ptData['type']]['translate']));
        tpl_set_var("ptStatus", tr($ptStatus[$ptData['status']]['translate']));
        tpl_set_var("PtDetailsDiv", 'block');
    } else {
        tpl_set_var("ptSelector", makePtSelector(powerTrailBase::getAllPt('AND status != 2'), 'ptSelector'));
        tpl_set_var("selPtDiv", 'block');
    }
}
tpl_BuildTemplate();
function makePtSelector($ptAll, $id)
{
    $selector = '<select id=' . $id . ' name=' . $id . '>';
    foreach ($ptAll as $pt) {
        $selector .= '<option value=' . $pt['id'] . '>' . $pt['name'] . '</option>';
    }
    $selector .= '</select>';
    return $selector;
}
function preparePtCaches(PowerTrail $powerTrail)
{