public function __construct() { parent::__construct('bibtex', null, false); if ($this->loginError) { return; } $this->loadHttpVars(); if (!isset($this->pub_ids)) { $this->pageError = true; return; } $pubs = explode(',', $this->pub_ids); if (!is_array($pubs) || count($pubs) == 0) { $this->pageError = true; return; } $pub_list = pdPubList::create($this->db, array('pub_ids' => $pubs)); if (!is_array($pub_list) || count($pub_list) == 0) { $this->pageError = true; return; } $table = new HTML_Table(array('width' => '100%', 'border' => '0', 'cellpadding' => '0', 'cellspacing' => '0')); $table->setAutoGrow(true); $pub_count = 0; foreach ($pub_list as $pub) { $pub_count++; $result = $pub->dbLoad($this->db, $pub->pub_id); if ($result === false) { $this->pageError = true; return; } $table->addRow(array('<pre>' . $pub->getBibtex() . '</pre>')); } // now assign table attributes including highlighting for even and odd // rows for ($i = 0; $i < $table->getRowCount(); $i++) { if ($i & 1) { $table->updateRowAttributes($i, array('class' => 'even'), true); } else { $table->updateRowAttributes($i, array('class' => 'odd'), true); } } $table->updateColAttributes(0, array('class' => 'publist'), true); echo $table->toHtml(); }
} //} } ######################################################## # Center columns 2,4,5and 6. Columns start with 0 index ######################################################## $table->updateColAttributes(1, "align=center"); $table->updateColAttributes(4, "align=center"); $table->updateColAttributes(5, "align=center"); $table->updateColAttributes(3, "align=center"); ######################################################## # Dump the table HTML into a variable ######################################################## $table_html = $table->toHTML(); #echo($table_html); $message = "<HTML>\n<BODY>\nThese licenses will expire within " . $lead_time . " days. Licenses \nwill expire at 23:59 on the day of expiration.<p>"; $message .= $table_html; ######################################################################## # If the table has more than one row (header row will be one) there # are expiring licenses ########################################################################( if ($table->getRowCount() > 1) { if ($notify_to && !isset($_GET['nomail'])) { $message .= "<p>URL: <a href=\"" . $URL . "\">" . $URL . "</a></p>"; $message .= "</HTML>"; echo "Emailing to {$notify_to}<p>\n"; mail($notify_to, "ALERT: License expiration within " . $lead_time . " days", $message, "From: License Robot <" . $notify_from . ">\nContent-Type: text/html\nMime-Version: 1.0"); } } $message .= "</HTML>"; echo $message;
$colHeaders = array("License Server", "Description", "Status", "Current Usage", "Available features/license", "Master", "Version"); $table->addRow($colHeaders, $headerStyle, "TH"); # set width on description col $table->setColAttributes(1, "width=\"180\""); # grab all the different server types foreach ($server as $host) { $type[] = $host['type']; } # return only unique types $types = array_unique($type); # loop thru each unique type and make up status table foreach ($types as $type) { $servers = findServers($type, "type"); if (sizeof($servers) > 0) { $table->addRow(array(strtoupper($type) . " Servers"), $headerStyle, "TH"); $table->setCellAttributes($table->getRowCount() - 1, 0, "colspan='" . $table->getColCount() . "'"); for ($i = 0; $i < sizeof($servers); $i++) { $cur = current($servers); $status_array = getDetails($cur); # does this host contain a webui? # currently only RLM offers webui if (isset($cur["webui"])) { $host = "<a href=\"" . $cur["webui"] . "\">" . $cur["hostname"] . "</a>"; } else { $host = $cur["hostname"]; } $table->AddRow(array($host, $cur["desc"], strtoupper($status_array["status"]["service"]), $status_array["status"]["clients"], $status_array["status"]["listing"], $status_array["status"]["master"], $status_array["status"]["version"])); # Set the background color of status cell $table->updateCellAttributes($table->getRowCount() - 1, 2, "class='" . $status_array["status"]["service"] . "'"); $table->updateCellAttributes(1, 0, ""); # fetch status
} if (sizeof($sub_links) >= $max_sub_links) { $sub_links = implode(', ', $sub_links) . ' ' . make_image("caret-r.gif", "[more]"); } else { $sub_links = implode(', ', $sub_links); } settype($npackages, 'string'); settype($ncategories, 'string'); $data = '<font size="+1"><b><a href="' . $script_name . '?catpid=' . $id . '&catname=' . urlencode($name) . '">' . $name . '</a></b></font> (' . $npackages . ')<br />'; //$name; //array($name, $npackages, $ncategories, $summary); $data .= $sub_links . '<br />'; $catdata[] = $data; $totalpackages += $npackages; if ($nrow++ % 2 == 1) { $table->addRow(array($catdata[0], $catdata[1])); $table->setCellAttributes($table->getRowCount() - 1, 0, 'width="50%"'); $table->setCellAttributes($table->getRowCount() - 1, 1, 'width="50%"'); $catdata = array(); } } // End while // Any left over (odd number of categories). if (count($catdata) > 0) { $table->addRow(array($catdata[0])); $table->setCellAttributes($table->getRowCount() - 1, 0, 'width="50%"'); $table->setCellAttributes($table->getRowCount() - 1, 1, 'width="50%"'); } /** * Begin code for showing packages if we * aren't at the top level. */
if ($t->hours > 0) { $time_difference .= " " . $t->hours . " hour(s), "; } $time_difference .= $t->minutes . " minute(s)"; # Only allow removal for FlexLM server if ((!isset($disable_license_removal) || $disable_license_removal == 0) && $host['type'] == "flexlm") { $removal_dialog = "<a class=\"btn btn-default\" href='' onclick='if (confirm(\"Are you sure you want to remove this license ?\")) this.href=\"lmremove.php\\?server=" . $hostno . "&feature=" . $key . "&arg=" . urlencode(trim($users[$key][$k]["line"])) . "\";'>Remove</a>"; } else { $removal_dialog = " "; } # Output the user line $table->addRow(array($removal_dialog, " ", "", $users[$key][$k]["line"], $time_difference), "style=\"background:{$color[$x]};\""); } # bump color code $x++; } } # Display the table if ($table->getRowCount() > 2) { $table->display(); } } else { echo "<p style=\"color: red;\">No licenses are currently being used on " . $host['hostname'] . " ( " . $host['desc'] . " )</p>"; } } include_once './version.php'; ?> </div> </body> </html>