Exemplo n.º 1
0
 function generateTreeWithPath(LogiksData $ld, $searchQ = "", $paramTags = null, $pathCol = "path", $titleCol = "title")
 {
     $html = "";
     if ($paramTags !== null) {
         $html .= "<ul " . parseTagParams($paramTags) . ">";
     }
     if ($paramTags !== null) {
         $html .= "</ul>";
     }
     return $html;
 }
Exemplo n.º 2
0
 function createForm($data, $layoutType = "table", $printTopLevels = true, $middleSeparator = "::", $withHelp = false, $params = array("border" => "0", "cellspacing" => "0", "cellpadding" => "0", "width" => "100%", "height" => "100%", "style" => "", "class" => "formTable"))
 {
     $s = "";
     if ($layoutType != "table" && $layoutType != "list") {
         $layoutType = "table";
     }
     if ($layoutType == "table") {
         if ($printTopLevels) {
             $s .= "<table " . parseTagParams($params) . ">";
         }
         if (is_array($data)) {
             $i = 0;
             foreach ($data as $nm => $d) {
                 if ($i % 2 == 0) {
                     $tr_class = "rowEven";
                 } else {
                     $tr_class = "rowOdd";
                 }
                 if (is_array($d)) {
                     $fs = "<tr class='{$tr_class}'><th width=150px align=left class='columnName'>%s</th><td width=20px align=center class='columnEqual'>{$middleSeparator}</td><td class='columnInput'>%s</td><td class='columnHelp' width=40px align=left>%s</td></tr>";
                     if (!$withHelp) {
                         $fs = "<tr class='{$tr_class}'><th width=150px align=left class='columnName'>%s</th><td width=20px align=center class='columnEqual'>{$middleSeparator}</td><td class='columnInput'>%s</td></tr>";
                     }
                     $title = "";
                     $help = "";
                     $fld = parseFieldParams($d);
                     if (isset($d['title'])) {
                         $title = $d['title'];
                     } else {
                         $title = toTitle($nm);
                     }
                     if (isset($d['help'])) {
                         $help = parseFieldHelp($d['help']);
                     }
                     if ($withHelp) {
                         $s .= sprintf($fs, $title, $fld, $help);
                     } else {
                         $s .= sprintf($fs, $title, $fld);
                     }
                 } else {
                     if ($d == "" || $d == null) {
                         $s .= "<tr class='{$tr_class} blankrow'><th align=left colspan=10></th></tr>";
                     } elseif ($d == "hbar") {
                         $s .= "<tr class='{$tr_class} hbar'><th align=left colspan=10><hr/></th></tr>";
                     } else {
                         $s .= "<tr class='subheader'><th align=left colspan=10>{$d}</th></tr>";
                     }
                 }
                 $i++;
             }
         }
         if ($printTopLevels) {
             $s .= "</table>";
         }
     } elseif ($layoutType == "list") {
         if ($printTopLevels) {
             $s .= "<ul " . parseTagParams($params) . ">";
         }
         if (is_array($data)) {
             foreach ($data as $nm => $d) {
                 if (is_array($d)) {
                     $fs = "<li for='{$nm}' class='nameLI'>%s</li><li for='{$nm}' class='inputLI'>%s</li><li for='{$nm}' class='helpLI'>%s</li>";
                     if (!$withHelp) {
                         $fs = "<li for='{$nm}' class='nameLI'>%s</li><li for='{$nm}' class='inputLI'>%s</li>";
                     }
                     $title = "";
                     $help = "";
                     $fld = parseFieldParams($d);
                     if (isset($d['title'])) {
                         $title = $d['title'];
                     } else {
                         $title = toTitle($nm);
                     }
                     if (isset($d['help'])) {
                         $help = parseFieldHelp($d['help']);
                     }
                     if ($withHelp) {
                         $s .= sprintf($fs, $title, $fld, $help);
                     } else {
                         $s .= sprintf($fs, $title, $fld);
                     }
                 } else {
                     if ($d == "" || $d == null) {
                         $s .= "<li>&nbsp;</li>";
                     } elseif ($d == "hbar") {
                         $s .= "<hr/>";
                     } else {
                         $s .= "<li class='subheader'>{$d}</li>";
                     }
                 }
             }
         }
         if ($printTopLevels) {
             $s .= "</ul>";
         }
     } else {
         $s = "Form Layout Not Supported";
     }
     return $s;
 }