Example #1
0
 function getShowMask()
 {
     $tNames = $this->COLNAMES;
     if (count($this->LABELS) == count($this->COLNAMES)) {
         $tNames = $this->LABELS;
     }
     $table = new Table($tNames);
     $table->setAlignments($this->getAlignments());
     $table->setBorder($this->BORDER);
     $table->setHeadEnabled($this->HEAD_ENABLED);
     $table->setBackgroundColorChange(true);
     if ($this->WIDTH > 0) {
         $table->setWidth($this->WIDTH);
     }
     if ($this->HEIGHT > 0) {
         $table->setHeight($this->HEIGHT);
     }
     if ($this->BORDER >= 0) {
         $table->setBorder($this->BORDER);
     }
     if ($this->PADDING >= 0) {
         $table->setPadding($this->PADDING);
     } else {
         $table->setPadding(0);
     }
     if ($this->SPACING >= 0) {
         $table->setSpacing($this->SPACING);
     } else {
         $table->setSpacing(0);
     }
     if ($this->XPOS > 0 && $this->YPOS > 0) {
         $table->setXPos($this->XPOS);
         $table->setYPos($this->YPOS);
     }
     //---------------------------------------------------
     // ROWS in Table aufnehmen
     //---------------------------------------------------
     $bgCtr = 1;
     for ($ir = 1; $ir <= count($this->ROWS); $ir++) {
         $r = $table->createRow();
         for ($ia = 0; $ia < count($this->COLNAMES); $ia++) {
             $row = $this->ROWS[$ir];
             $val = "";
             $t = "";
             if (!$this->isInvisibleCol($this->COLNAMES[$ia])) {
                 if (strlen($row->getAttribute($ia)) > 0) {
                     $val = getDbComboValue($this->TABLENAME, $this->COLNAMES[$ia], $row->getAttribute($ia));
                 }
                 // Wenn DbCombo definiert wurde wird der passende Text zum Code der Spalte angezeigt
                 if (strlen($val) > 0) {
                     $t = $val;
                 } else {
                     $t = $row->getAttribute($ia);
                 }
                 if (strtolower($this->COLNAMES[$ia]) == "email") {
                     $txt = $row->getAttribute($ia);
                     $tmp = new Text($txt);
                     $tmp->setFilter(false);
                     $r->setAttribute($ia, new Link("mailto:" . $txt, $tmp));
                 } else {
                     $r->setAttribute($ia, new Text($t));
                 }
             } else {
                 $r->setAttribute($ia, " ");
             }
         }
         $table->addRow($r);
     }
     return $table;
 }
 function show()
 {
     if ($this->isIconViewActive()) {
         $this->showAsIcon();
         return;
     }
     $active = true;
     if (time() - 24 * 60 * 60 * 1000 > $this->LASTSIGNAL) {
         $active = false;
     }
     $tbl = new Table(array("Name", "ID", "letztes Signal", "letzter Wert"));
     $tbl->setBackgroundColorChange(false);
     $tbl->setHeadEnabled($this->isWithHeader());
     $tbl->setColSizes(array(null, 100, 150, 120));
     $tbl->setStyle("padding-left", "5px");
     $tbl->setStyle("padding-right", "25px");
     $tbl->setStyle("padding-top", "5px");
     $tbl->setStyle("padding-bottom", "5px");
     $tbl->setBackgroundColor($_SESSION['config']->COLORS['Tabelle_Hintergrund_' . ($this->BGID % 2 == 0 ? "1" : "2")]);
     $r = $tbl->createRow();
     $r->setAlignments(array("left", "left", "left", "right"));
     $r->setAttribute(0, new Text($this->SENSORNAME, 3));
     $r->setAttribute(1, new Text($this->ID, 3));
     $r->setAttribute(2, $active ? new Text(date("D d.m.Y H:i:s", $this->LASTSIGNAL), 3) : "-");
     $r->setAttribute(3, $active ? new Text($this->LASTVALUE, 3) : "-");
     $tbl->addRow($r);
     $tbl->show();
 }
 //  Bearbeiten-Maske
 // --------------------------------------------------
 $tDel = $scDbTable->doDeleteFromUpdatemask();
 if (method_exists($tDel, "show")) {
     $fDel = new Form();
     $fDel->add($tDel);
     $fDel->show();
 }
 if (isset($_REQUEST["DbTableUpdate" . $scDbTable->TABLENAME])) {
     $scDbTable->doUpdate();
 }
 $tblEtagen = new Table(array("Name", "Raumplan", "hochladen", "entfernen"));
 $tblEtagen->setHeadEnabled(true);
 $tblEtagen->setVAlign("middle");
 $tblEtagen->setAlignments(array("left", "center", "center", "right"));
 $tblEtagen->setBackgroundColorChange(true);
 foreach ($scDbTable->ROWS as $etagenRow) {
     $rowId = $etagenRow->getNamedAttribute("rowid");
     $txfName = new Textfield("name" . $rowId, $etagenRow->getNamedAttribute("name"));
     $btnRaumplan = new Button("uploadImage" . $rowId, "Raumplan hochladen");
     $btnDelete = new Button("delete" . $rowId . "homecontrol_etagen", "entfernen");
     $imgRaumplan = "";
     if (isset($_REQUEST["uploadImage" . $rowId]) && $_REQUEST["uploadImage" . $rowId] == "Raumplan hochladen") {
         $hdnImg = new Hiddenfield("uploadImage" . $rowId, $_REQUEST["uploadImage" . $rowId]);
         $imgUploader = new ImageUploader("/pics/raumplan", "RP_", "homecontrol_etagen", "pic", $rowId, $hdnImg, $rowId . ".jpg");
         $imgUploader->show();
         $imgRaumplan = new Image(getDbValue("homecontrol_etagen", "pic", "id=" . $rowId));
     } else {
         $imgRaumplan = new Image(getEtagenImagePath($rowId));
     }
     $imgRaumplan->setGenerated(false);
$o = "if( ((tagnr=" . $dayOfWeek . " AND ((stunde >= " . date("H") . " AND minute > " . date("i") . " ) OR (stunde > " . date("H") . "))) OR (tagnr!=" . $dayOfWeek . ") ) AND tagnr-" . $dayOfWeek . ">=0 ,tagnr-" . $dayOfWeek . ", tagnr+(7-" . $dayOfWeek . ")), stunde, minute";
if ($timelineDuration > 1) {
    for ($tmpDays = 1; $tmpDays < $timelineDuration; $tmpDays++) {
        $dayOfWeek = $dayOfWeek < 6 ? $dayOfWeek + 1 : 0;
        $w .= "tagnr=" . $dayOfWeek . " OR ";
    }
}
$nextDayOfWeek = $dayOfWeek < 6 ? $dayOfWeek + 1 : 0;
//Where (Aktueller und nächster Wochentag)
$w .= " (tagnr=" . $nextDayOfWeek . " AND ((stunde <= " . date("H") . " AND minute <= " . date("i") . " ) OR " . "(stunde < " . date("H") . ")))";
$scDbTable = new DbTable($_SESSION['config']->DBCONNECT, 'homecontrol_cronview', array("wochentag", "tagnr", "name", "montag", "dienstag", "mittwoch", "donnerstag", "freitag", "samstag", "sonntag", "stunde", "minute", "id"), "Wochentag, Tag Nr, Name,  Mo, Di, Mi, Do, Fr, Sa, So, Std, Min", "", $o, $w);
// --------------------------------------------
$t = new Title("Timeline");
$t->show();
$tbl = new Table(array("", "", ""));
$tbl->setBackgroundColorChange(true);
foreach ($scDbTable->ROWS as $row) {
    $cron = new HomeControlCron($row);
    $cron->checkPauseLink();
    $r = $tbl->createRow();
    $r->setAlignments(array("left", "left", "right"));
    $r->setStyle("padding-left", "5px");
    $r->setStyle("padding-right", "25px");
    $r->setStyle("padding-top", "12px");
    $r->setStyle("padding-bottom", "7px");
    $executionTime = new Text($cron->getNextExecutionTimeAsString(), 3);
    $name = new Text($cron->getName(), 3);
    if ($cron->isCronPaused()) {
        $ft = $executionTime->getFonttype();
        $ft->setColor("red");
        $executionTime->setFonttype($ft);