Пример #1
0
 public static function outputFormTable($tbl = "hired", $records = array())
 {
     $stdout = "";
     $showEditLinks = !$GLOBALS["edit"] && !$GLOBALS["delete"];
     $tblFields = reset($records);
     if (isset($tblFields["_data"])) {
         $tblFields = array_keys($tblFields["_data"]);
     }
     //KEEP: $GLOBALS["positionsClass"]->getFieldList($tbl)
     // --------------------
     if (empty($records)) {
         return $stdout . functions::boxMessage("warning", "No records have yet been defined");
     }
     // --------------------
     $stdout .= "    <input type='hidden' name='table' value='" . $tbl . "'>\r\n" . "    <input type='input' name='" . HONEYTRAP_ID . "' class='osynl'>\r\n" . ($showEditLinks ? "    <p><em>NB: Only records that are not in use can be removed.</em></p>\r\n" : "");
     $stdout .= "      <table" . ($showEditLinks ? "" : " style='color:#999'") . ">\r\n" . "        <tr>" . ($showEditLinks ? "<th></th><th></th>" : "");
     foreach ($tblFields as $fieldname) {
         $stdout .= "<th style='padding-right:1em;padding-left:0.5em;border-bottom:1px solid black'>" . ucfirst($fieldname) . "</th>";
     }
     $stdout .= "</tr>\r\n";
     $i = 1;
     foreach ($records as $arr) {
         $stdout .= "        <tr>\r\n";
         // Optionally output EDIT and DELETE links
         if ($showEditLinks && !empty($arr["_qstring"])) {
             $stdout .= "          <td>" . "<a href='" . $_SERVER["PHP_SELF"] . "?" . "table=" . $tbl . "&amp;edit=1" . "&amp;" . $arr["_qstring"] . "' class='bold'>[Edit]</a></td>\r\n" . "          <td style='padding-right:1em'>" . (isset($arr["_delete"]) && $arr["_delete"] ? "<a href='" . $_SERVER["PHP_SELF"] . "?" . "table=" . $tbl . "&amp;delete=1" . "&amp;" . $arr["_qstring"] . "' class='bold'>[Delete]</a>" : "<span style='color:#ccc'>[Delete]</span>") . "</td>\r\n";
         }
         // Output table content
         if (isset($arr["_data"])) {
             foreach ($arr["_data"] as $fieldname => $value) {
                 $stdout .= "          <td class='b_zebra" . (!$showEditLinks ? "" : "green") . $i . "' style='padding-right:1em;padding-left:0.5em;'> " . $value . "</td>\r\n";
             }
         }
         $stdout .= "        </tr>\r\n";
         $i = 3 - $i;
     }
     // end foreach
     $stdout .= "      </table>\r\n";
     // --------------------
     return $stdout;
 }
Пример #2
0
 private static function drawSubscriptionsList($table = "subscriber", $dbData = array(), $numberOfSubscribers = 0, $enableEditing = true)
 {
     if (!in_array($table, array("subscriber", "invitee", "mailman"))) {
         return "";
     }
     $stdout = "";
     $news_url = isInPath("/" . PATH_NEWSEDITTEST . "/") ? PATH_NEWSTEST : PATH_NEWS;
     switch ($table) {
         case "subscriber":
             $stdout .= "<p style='font-size:1.2em'>A <strong>subscriber</strong> is someone who has " . "agreed to get newsletter announcement mails, either by " . "<a href='" . $news_url . "/about/subscribe/index.php'><strong>subscribing online</strong></a> " . "or by <strong>clicking on a subscription link in an</strong> " . "<a href='" . SUBSITE . "/subscriptions/invite_send/index.php'><strong>invitation letter</strong></a> " . "sent by Nordita.</p>\r\n" . "<p style='font-size:1.2em'>A subscriber can choose to " . "<a href='" . $news_url . "/about/unsubscribe/index.php'><strong>unsubscribe online</strong></a>, " . "or <strong>click an unsubscription link at the bottom of a newsletter announcement mail</strong>. " . "Below you can also <strong>manually remove a subscriber</strong> from the mailing list " . "<span class='nowrap'>(click on <img src='img/_icons/i-drop.png' alt='delete' " . "style='vertical-align:middle'> icon)</span>. You can undo manual unsubscriptions, but if a person " . "has chosen to unsubscribe, you are not allowed to override that decision.</span></p>\r\n" . PADDED_HR;
             if (empty($dbData)) {
                 return $stdout .= functions::boxMessage("error", "There are currently <strong>no subscriptions</strong>.");
             }
             $stdout .= "<h3 class='bottommargin'>List of current " . "<strong> " . $numberOfSubscribers . "</strong> " . "active subscribers:</h3>\r\n" . "\r\n";
             break;
         case "invitee":
             $stdout .= "<p style='font-size:1.2em'>Newsletter announcements should only be sent to people who " . "have agreed to receive them. In practice this means <strong>the announcement will only be " . "sent to subscribers</strong>.</p>" . "<p style='font-size:1.2em'><strong>You can send a one-time invitation mail</strong> to people on an " . "<em>invitation list</em>, which you put together below. In the invitaion mail are instructions " . "on how to <a href='" . $news_url . "/about/subscribe/index.php'><strong>subscribe</strong></a> " . "to the announcement mails. Only if the invitees choose to subscribe will they receive future " . "newsletter announcements.</p>\r\n" . PADDED_HR . "<div  style='margin-bottom:2em'>\r\n" . "  <form method='post' action='" . $_SERVER["PHP_SELF"] . "' style='display:inline;margin-right:3em'>\r\n" . "    <input type='submit' value='Add New People to the Invitation List'>\r\n" . "    <input type='hidden' name='add' value='1'>\r\n" . "  </form>\r\n" . "  <form method='post' action='" . $_SERVER["PHP_SELF"] . "' style='display:inline'>\r\n" . "    <input type='submit' value='Add/Update Current Nordita Staff, Board and Committees'>\r\n" . "    <input type='hidden' name='staff' value='1'>\r\n" . "  </form>\r\n" . "</div>\r\n" . PADDED_HR;
             if (empty($dbData)) {
                 return $stdout . functions::boxMessage("error", "There are currently <strong>no people</strong> on the invitation list.");
             }
             $stdout .= "<h3 class='bottommargin'>List of the " . "<strong> " . $numberOfSubscribers . "</strong> " . "people in the list that have not yet been invited:</h3>\r\n" . "\r\n";
             break;
         case "mailman":
             if (!NEWS_DEBUG) {
                 $stdout .= "<div  style='margin-bottom:2em'>\r\n" . "  <form method='post' action='" . $_SERVER["PHP_SELF"] . "' style='display:inline;margin-right:3em'>\r\n" . "    <input type='submit' value='Add New People to the Mailing List'>\r\n" . "    <input type='hidden' name='add' value='1'>\r\n" . "  </form>\r\n" . "</div>\r\n" . PADDED_HR;
             }
             $stdout .= "<h3 class='bottommargin'>List of current " . "<strong> " . $numberOfSubscribers . "</strong> " . "active list members:</h3>\r\n" . "\r\n";
             break;
     }
     // end switch
     // Rearrange $dbData as array $data
     // Assemble $_SESSION["plaintext"]
     $_SESSION["plaintext"] = "";
     foreach ($dbData as $item) {
         $data[$item["email"][0]][] = $item;
         if (isset($item["status_id"]) && $item["status_id"] == NEWS_ACTIVE) {
             $_SESSION["plaintext"] .= $item["email"] . "\n";
         }
     }
     $stdout .= "<div id='jtabs' class='notabs'>\r\n" . "    <ul>\r\n";
     $i = 0;
     foreach ($data as $initial => $items) {
         $allinitials[$initial] = $i++;
         $stdout .= "      <li><a href='" . $_SERVER["PHP_SELF"] . "#jtabs-" . $initial . "'>" . strtoupper($initial) . "</a></li>\r\n";
     }
     $stdout .= "    </ul>\r\n";
     if (in_array($table, array("subscriber", "mailman"))) {
         foreach ($data as $initial => $items) {
             $stdout .= "  <div id='jtabs-" . $initial . "'>\r\n" . "    <form id='edit' method='post' action='" . $_SERVER["PHP_SELF"] . "' style='margin-bottom:2em'>\r\n" . "      <table style='width:100%'>\r\n" . "        <tr>\r\n" . "          <th></th>\r\n" . "          <th class='b_zebra0' style='width:30%'>E-Mail</th>\r\n" . "          <th class='b_zebra0' style='width:20%'>Name/Comment</th>\r\n" . "          <th class='b_zebra0'>Date&nbsp;Joined</th>\r\n" . "          <th class='b_zebra0'>Source</th>\r\n" . "          <th class='b_zebra0'>Status</th>\r\n";
             if ($enableEditing) {
                 $stdout .= "          <th style='width:1em'></th>\r\n" . "          <th></th>\r\n" . "          <th></th>\r\n";
             }
             $stdout .= "        </tr>\r\n";
             $i = $k = 1;
             foreach ($items as $item) {
                 $u = $item["status_id"] != NEWS_ACTIVE ? " deleted italic" : "";
                 $stdout .= "        <tr>\r\n" . "          <td>" . $k . "</td>\r\n" . "          <td class='b_zebra" . $i . $u . "'>" . functions::obscurify_email($item["email"]) . "</td>\r\n" . "          <td class='b_zebra" . $i . $u . "'>" . $item["comment"] . "</td>\r\n" . "          <td class='b_zebra" . $i . $u . "'>" . $item["date_created"] . "</td>\r\n" . "          <td class='b_zebra" . $i . $u . "'>" . $item["source"] . "</td>\r\n" . "          <td class='b_zebra" . $i . "'>" . $item["status"] . "</td>\r\n";
                 //"          <td class='b_zebra".$i.$u."'>" . $item["source"]["subscribersource"] . "</td>\r\n" .
                 //"          <td class='b_zebra".$i."'>" . $item["status"]["subscriberstatus"] . "</td>\r\n";
                 if ($enableEditing) {
                     $stdout .= "          <td></td>\r\n" . "          <td><button class='plain' type='submit' name='edit' " . "value='" . $item["email"] . "' title='Edit this record'>" . "<img src='img/_icons/i-edit-black.png' alt='Edit' title='Edit this record'>" . "</button></td>\r\n" . ($item["status_id"] == NEWS_ACTIVE || $table == "mailman" ? "          <td><button class='plain' type='submit' name='delete' " . "value='" . $item["email"] . "' title='Remove this record'>" . "<img src='img/_icons/i-drop.png' alt='Delete' title='Remove this record'>" . "</button></td>\r\n" : "");
                 }
                 $stdout .= "        </tr>\r\n";
                 $i = 3 - $i;
                 $k++;
             }
             $stdout .= "      </table>\r\n" . "    </form>\r\n" . "    <form method='post' action='" . $_SERVER["PHP_SELF"] . "' " . "style='margin-top:-1em'>\r\n" . "      [<input type='submit' value='Reload this page' " . "class='fakelink' style='font-size:1em'>]\r\n" . "      <input type='hidden' name='initial' value='" . $item["email"][0] . "'>\r\n" . "      <input type='hidden' name='reload' value='1'>\r\n" . "    </form>\r\n" . "  </div>\r\n";
         }
     } elseif (in_array($table, array("invitee"))) {
         foreach ($data as $initial => $items) {
             $stdout .= "  <div id='jtabs-" . $initial . "'>\r\n" . "    <form id='edit' method='post' action='" . $_SERVER["PHP_SELF"] . "' style='margin-bottom:2em'>\r\n" . "      <table style='width:100%'>\r\n" . "        <tr>\r\n" . "          <th class='b_zebra0 nowrap' style='width:25%'>E-Mail</th>\r\n" . "          <th class='b_zebra0' style='width:20%'>Name</th>\r\n" . "          <th class='b_zebra0' style='width:20%'>Comment</th>\r\n" . "          <th class='b_zebra0'>Source</th>\r\n" . "          <th class='b_zebra0'>Date&nbsp;Added</th>\r\n" . "          <th class='b_zebra0 nowrap' style='width:20%'>Invitation Sent</th>\r\n";
             if ($enableEditing) {
                 $stdout .= "          <th style='width:1em'></th>\r\n" . "          <th></th>\r\n" . "          <th></th>\r\n";
             }
             $stdout .= "        </tr>\r\n";
             $i = 1;
             foreach ($items as $item) {
                 if ($item["sent"]) {
                     $u = " deleted italic";
                     $status = $item["date_invited"];
                 } elseif ($item["status_id"] != NEWS_ACTIVE) {
                     $u = " deleted italic";
                     $status = "Not yet";
                 } else {
                     $u = "";
                     $status = "Not yet";
                 }
                 $stdout .= "        <tr>\r\n" . "          <td class='b_zebra" . $i . $u . " nowrap'>" . functions::obscurify_email($item["email"]) . "</td>\r\n" . "          <td class='b_zebra" . $i . $u . "'>" . $item["firstname"] . " " . $item["lastname"] . "</td>\r\n" . "          <td class='b_zebra" . $i . $u . "'>" . $item["comment"] . "</td>\r\n" . "          <td class='b_zebra" . $i . $u . "'>" . $item["source"] . "</td>\r\n" . "          <td class='b_zebra" . $i . $u . "'>" . $item["date_created"] . "</td>\r\n" . "          <td class='b_zebra" . $i . $u . "'>" . $status . "</td>\r\n";
                 if ($enableEditing) {
                     $stdout .= "          <td></td>\r\n" . "          <td><button class='plain' type='submit' name='edit' " . "value='" . $item["email"] . "' title='Edit this record'>" . "<img src='img/_icons/i-edit-black.png' alt='Edit' title='Edit this record'>" . "</button></td>\r\n" . (empty($u) ? "          <td><button class='plain' type='submit' name='delete' " . "value='" . $item["email"] . "' title='Remove this record'>" . "<img src='img/_icons/i-drop.png' alt='Delete' title='Remove this record'>" . "</button></td>\r\n" : "");
                 }
                 $stdout .= "        </tr>\r\n";
                 $i = 3 - $i;
             }
             $stdout .= "      </table>\r\n" . "    </form>\r\n" . "    <form method='post' action='" . $_SERVER["PHP_SELF"] . "' " . "style='margin-top:-1em'>\r\n" . "      [<input type='submit' value='Reload this page' " . "class='fakelink' style='font-size:1em'>]\r\n" . "      <input type='hidden' name='reload' value='1'>\r\n" . "      <input type='hidden' name='initial' value='" . $item["email"][0] . "'>\r\n" . "    </form>\r\n" . "  </div>\r\n";
         }
     }
     $stdout .= "</div>\r\n" . "<form method='post' action='" . SUBSITE . "/subscriptions/plaintext/index.php'>\r\n" . "  [<input type='submit' value='Plaintext list of all active e-mail addresses' " . "class='fakelink' style='font-size:1em'>]\r\n" . "</form>\r\n" . "\r\n";
     // Add jQuery script
     functions::gpc_declare_input("initial", "", false);
     if (strlen($GLOBALS["initial"]) == 1) {
         $in = isset($allinitials[$GLOBALS["initial"]]) ? $allinitials[$GLOBALS["initial"]] : key($allinitials);
         $GLOBALS[SUBSITE]["scripts"]["code"][] = "      \$(function(){\$('#jtabs').tabs('option','active'," . $in . ");});\r\n";
     }
     return $stdout;
 }
Пример #3
0
 public static function outputQrcodeForm($founderror = array(), $error = array(), $warning = array())
 {
     $stdout = "";
     if (!empty($error)) {
         $stdout .= functions::boxMessage("error", $error);
     }
     if (!empty($warning)) {
         $stdout .= functions::boxMessage("warning", $warning);
     }
     if (!empty($error) || !empty($error)) {
         $stdout .= PADDED_HR;
     }
     $stdout .= "<form action='" . $_SERVER["PHP_SELF"] . "' method='post'>\r\n" . "  <p>\r\n" . "    <strong>URL or text to be embedded in the QR code</strong>:<br>\r\n" . "    <textarea name='qr-text' style='height:50px;width:350px;'\r\n" . (!empty($founderror["qr-text"]) ? " class='error'" : "") . ">" . (!empty($GLOBALS["qr-text"]) ? $GLOBALS["qr-text"] : "") . "</textarea>\r\n" . "  </p>\r\n";
     $stdout .= "  <p><strong>Zoom factor</strong> (default 4): \r\n" . "    <br><input type='text' name='qr-zoom'" . (!empty($founderror["qr-zoom"]) ? " class='error'" : "") . (!empty($GLOBALS["qr-zoom"]) ? " value='" . $GLOBALS["qr-zoom"] . "'" : "") . " size='10'></p>\r\n";
     /* -- KEEP FOR REFERENCE -- */
     /*
     	$stdout .=
     	  "  <p><strong>QR Code image size</strong>:\r\n" .
     	  "    <br><select name='qr-width'" .
     	  ( !empty($founderror["qr-width"]) ? " class='error'" : "" ) .
     	  ">\r\n";
     	foreach (array(100,150,200,250,300,350,400,450,500) as $imagewidth) {
     	  $stdout .=
     	    "  	  <option value='".$imagewidth."'" .
     	    ( ((!empty($founderror) && !empty($GLOBALS["qr-width"]) && ($GLOBALS["qr-width"]==$imagewidth))
     	       || ($imagewidth==300))
     	         ? " selected"
     	         : "" ) .
     	    ">".$imagewidth."x".$imagewidth."</option>\r\n";
     	}
     	$stdout .=
     	  "    </select>\r\n" .
     	  "    pixels</p>\r\n";
     */
     $stdout .= "  <p><strong>QR Code error correction level</strong>: \r\n" . "    <br><select name='qr-level'" . (!empty($founderror["qr-level"]) ? " class='error'" : "") . ">\r\n";
     foreach (array("H", "Q", "M", "L") as $level) {
         if (isset(self::$errorlevels[$level])) {
             $stdout .= "  \t  <option value='" . $level . "'" . (!empty($GLOBALS["qr-level"]) && $GLOBALS["qr-level"] == $level ? " selected" : "") . ">" . self::$errorlevels[$level] . "</option>\r\n";
         }
     }
     $stdout .= "    </select></p>\r\n" . "  <p><input type='submit' name='doit' value='Create QR Code'></p>\r\n" . "</form>\r\n" . "\r\n";
     return $stdout;
 }
Пример #4
0
 public static function OutputMockagendaUpdate($updateCurrentEvents = FALSE, $updateFutureEvents = FALSE, $showOnlyAgendaOptions = FALSE)
 {
     $stdout = "";
     $options = $headers = $allConfids = $allConfidsUpdated = array();
     $eventTitle = $updatedRecords = array();
     $numberOfUpdatedRecords = 0;
     // ----------------------------------------------
     // -- GPC and initiations
     // ----------------------------------------------
     // UPDATE manually kept fields from legacy file - ALL events:
     functions::gpc_declare_input("uf", false, true);
     // UPDATE VM fields [disabled]:
     functions::gpc_declare_input("uv", false, true);
     // UPDATE Agenda fields - ALL events:
     functions::gpc_declare_input("ua", false, true);
     // UPDATE Agenda fields - CURRENT events:
     functions::gpc_declare_input("uc", $updateCurrentEvents && !$updateFutureEvents, true);
     // UPDATE Agenda fields - CURRENT and FUTURE events:
     functions::gpc_declare_input("un", $updateCurrentEvents && $updateFutureEvents, true);
     // Recreate 'menulookup' cache:
     functions::gpc_declare_input("um", false, true);
     if (!class_exists("fromdb_nwevents", FALSE)) {
         require_once PATH_CLASSES . "/fromdb/nwevents.php";
     }
     if (!isset($dbEv) || !is_object($dbEv)) {
         $dbEv = new fromdb_nwevents();
     }
     $allConfids = $dbEv->getAgendaConferenceIdsForNorditaEvents();
     $noRecordsInDB = (bool) (!is_array($allConfids) || empty($allConfids));
     if ($noRecordsInDB) {
         $GLOBALS["uv"] = $GLOBALS["ua"] = $GLOBALS["un"] = false;
     }
     // ----------------------------------------------
     // -- Act on selected option
     // ----------------------------------------------
     // UPDATE manually kept fields from legacy file - ALL events
     if ($GLOBALS["uf"]) {
         $numberOfUpdatedRecords = $dbEv->updateEventsFromLocalFile();
         if ($numberOfUpdatedRecords) {
             $noRecordsInDB = false;
         }
     } elseif ($GLOBALS["uv"]) {
         //if (!class_exists("fromdb_vm",FALSE)) require_once PATH_CLASSES . "/fromdb/vm.php";
         //$dbEv = new fromdb_vm();
         //$numberOfUpdatedRecords = ...();
     } elseif ($GLOBALS["ua"]) {
         $updatedRecords = $dbEv->updateEventsFromAgenda("");
         $numberOfUpdatedRecords = is_array($updatedRecords) ? count($updatedRecords) : $updatedRecords;
     } elseif ($GLOBALS["uc"]) {
         $updatedRecords = $dbEv->updateCurrentEventsFromAgenda();
         $numberOfUpdatedRecords = is_array($updatedRecords) ? count($updatedRecords) : $updatedRecords;
         document::recreateMenulookupCache();
         // also recreate menu cache, to make sure
     } elseif ($GLOBALS["un"]) {
         $updatedRecords = $dbEv->updateEventsFromAgenda(date("Y-m-d", strtotime("-50 days")));
         $numberOfUpdatedRecords = is_array($updatedRecords) ? count($updatedRecords) : $updatedRecords;
         document::recreateMenulookupCache();
         // also recreate menu cache, to make sure
     } elseif ($GLOBALS["um"]) {
         if (document::recreateMenulookupCache()) {
             $stdout .= "\r\n" . functions::boxMessage("confirm", "<strong>Cache 'menulookup'</strong> was successfully recreated.") . "\r\n";
         } else {
             $stdout .= "\r\n" . functions::boxMessage("error", "<strong>Cache 'menulookup'</strong> could not be recreated") . "\r\n";
         }
     }
     // -----------------------
     $allConfidsUpdated = $numberOfUpdatedRecords ? $dbEv->getAgendaConferenceIdsForNorditaEvents() : $allConfids;
     // ----------------------------------------------
     // -- Output
     // ----------------------------------------------
     $stdout .= "  <p class='largefont'>There are currently <strong>" . count($allConfidsUpdated) . " events</strong> in the local 'nw_events' database.</p>\r\n";
     // -----------------------
     $stdout .= "<div class='col c1of2'>\r\n";
     $stdout .= "  <p><strong>The local database 'nw_events'</strong> collects information of Nordita events (programs, workshops, conferences, meetings, schools) from several sources: most data comes from the <strong>AlbaNova Agenda database</strong>; some fields are fetched from the <strong>VM database</strong>; and some metadata fields are <strong>manually kept only in the 'nw_events' database</strong>.</p>\r\n";
     if (!$showOnlyAgendaOptions) {
         $headers["manual"] = "Manually Kept Files";
         $options["manual"][] = "<a href='" . $_SERVER["PHP_SELF"] . "?uf=1'>UPDATE manually kept fields from legacy file - ALL events</a>";
         if (!$noRecordsInDB) {
             $options["manual"][] = "<a href='" . str_replace("nw_events_update", "nw_events_edit", $_SERVER["PHP_SELF"]) . "'>" . "EDIT manually kept fields - SINGLE event</a> " . "<span style='padding-left:1em;font-weight:normal;white-space:nowrap'>(use [Edit] links)</span>";
         }
     }
     $headers["agenda"] = "Agenda Fields";
     if (!$showOnlyAgendaOptions) {
         $options["agenda"][] = "<a href='" . $_SERVER["PHP_SELF"] . "?ua=1'>UPDATE Agenda fields - ALL events</a> " . "<span style='padding-left:1em;font-weight:normal;white-space:nowrap'>(going back to 2007)</span>";
     }
     if (!$noRecordsInDB) {
         $options["agenda"][] = "<a href='" . $_SERVER["PHP_SELF"] . "?uc=1'>UPDATE Agenda fields - CURRENT events</a>";
     }
     if (!$noRecordsInDB) {
         $options["agenda"][] = "<a href='" . $_SERVER["PHP_SELF"] . "?un=1'>UPDATE Agenda fields - CURRENT and FUTURE events</a>";
     }
     if (!$showOnlyAgendaOptions) {
         if (!$noRecordsInDB) {
             $options["agenda"][] = "<a href='" . str_replace("nw_events_update", "nw_events_edit", $_SERVER["PHP_SELF"]) . "'>UPDATE Agenda fields - SINGLE event</a> <span style='padding-left:1em;font-weight:normal;white-space:nowrap'>(use [Update] links)</span>";
         }
         $options["agenda"][] = "<a href='" . AGENDA_URI . "/'>EDIT Agenda events</a> " . EXTERNAL_LINK;
     }
     if (!$showOnlyAgendaOptions) {
         $headers["vm"] = "VM Fields";
         $options["vm"][] = "[UPDATE VM fields - disabled]";
         //$options["vm"][] = "<a href='".$_SERVER["PHP_SELF"]."?uv=1'>UPDATE VM fields</a>";
     }
     if (!$showOnlyAgendaOptions) {
         $headers["varia"] = "Varia";
         $options["varia"][] = "<a href='" . $_SERVER["PHP_SELF"] . "?um=1'>Recreate 'menulookup' cache</a>";
     }
     //$stdout .= "<p><strong>&#187; Update event records in database 'nw_events'...</strong></p>\r\n";
     foreach (array("manual", "agenda", "vm", "varia") as $db) {
         if (!empty($options[$db])) {
             $stdout .= (!empty($headers[$db]) ? "<h4>" . $headers[$db] . "</h4>\r\n" : "") . "<ul class='bold tightlist'>\r\n" . "  <li>" . implode($options[$db], "</li>\r\n  <li>") . "</li>\r\n" . "</ul>\r\n";
         }
     }
     // -----------------------
     $stdout .= "</div> <div class='col c2of2'>\r\n";
     if (!empty($_REQUEST) && !$GLOBALS["um"] && !$noRecordsInDB && isset($numberOfUpdatedRecords)) {
         $stdout .= $numberOfUpdatedRecords > 0 ? "  <p class='box padding confirm background'>Successfully updated " . "<strong>" . $numberOfUpdatedRecords . "</strong> records in the database 'nw_events'.</p>\r\n" : "  <p class='box padding error background'><strong>Could not update any records</strong> " . "in the database 'nw_events'." . (!$noRecordsInDB && $numberOfUpdatedRecords == ERROR_NO_EVENTS_REQUESTED ? " [No events requested]" : "") . (!$noRecordsInDB && $numberOfUpdatedRecords == 0 ? " [No events updated]" : "") . "</p>\r\n";
         if (count($updatedRecords)) {
             $stdout .= "  <ul>\r\n";
             foreach ($updatedRecords as $confId) {
                 $stdout .= "    <li><a href='http://agenda.albanova.se/conferenceDisplay.py?confId=" . $confId . "'>" . $dbEv->getEventTitle($confId) . "</a></li>\r\n";
             }
             $stdout .= "  </ul>\r\n";
         }
     }
     // -----------------------
     $stdout .= "</div><div style='clear:both'><br></div>\r\n";
     // -----------------------
     return $stdout;
 }
Пример #5
0
 public static function drawReservePreprintForm($founderror = FALSE, $error = array(), $warning = array(), $confirm = array())
 {
     $stdout = "";
     // --------------------------------
     // -- OUTPUT DATA
     // --------------------------------
     /* case NOR_PP_MODE_RESERVE:
        startPage("Reservation of new Preprint Number");
        $row = array("Year"  => $year,
     		"Report"=> PP_UNDEFINED);
        $t = new table("","<form action='reserve_ppn.php' method='post'>".
     		  "<input type='hidden' name='nor_pp_period' value='".$nor_pp_period."'>");
        $t->tro();   $t->th("","submitter");   $t->td("",make_user_selection());   $t->trc();
     	$cs = " colspan='4'";
     	echo "<input type='hidden' name='year' value='$row[Year]'>\n";
     	echo "<input type='hidden' name='report' value='$row[Report]'>\n";
     	echo "<input type='hidden' name='rowId'  value='$rowId'>";
     	echo "<input type='hidden' name='location' value='$row[Location]'>\n";
     	echo "<input type='hidden' name='MAX_FILE_SIZE' value='5000000'>\n";
     	echo "<tr align='left'><th>preprint #</th><td$cs>".pp_preprintID($row["Year"],$row["Report"]).($row["Status"]?" ($row[Status])":"")."</td></tr>\n";
     	echo "<tr align='left'><th>field</th><td$cs>".show_field_selection("field",$field)."</td></tr>\n";
     	echo "<tr align='left'><th>authors</th><td$cs><input name='authors' size='70' value='$row[Authors]'></td></tr>\n";
     	echo "<tr align='left'><th>title</th><td$cs><input name='title' size='70' value='$row[Title]'></td></tr>\n";
        $t->tro();$t->td();
        $t->td("","<input type='submit' value='allocate the preprint number'> ".pp_getLink("cancel","."));
        $t->trc();
        $t->close("</form>");
        break;
     */
     $stdout .= "    <h3 class='bottommargin'>Reserve a Preprint Number</h3>\r\n" . "\r\n";
     /*
         if (!self::getRowEditRights($GLOBALS["pp_rowid"],auth::getUsername())) {
           return $stdout . BLURB_SORRY_PREPRINT_NOTOWNER . "  </div> <!-- medwide-box -->\r\n";
         }
     */
     if (!empty($error)) {
         $stdout .= functions::boxMessage("error", $error);
         $showform = 1;
     }
     if (!empty($warning)) {
         $stdout .= functions::boxMessage("warning", $warning);
         $showform = 1;
     }
     if (!empty($confirm)) {
         $stdout .= functions::boxMessage("confirm", $confirm);
         $showform = 1;
     }
     $stdout .= "    <div class='box warning background padding'>\r\n" . "      <form action='" . $_SERVER["PHP_SELF"] . "' enctype='multipart/form-data' method='post'" . " style='display:inline'" . ">\r\n" . "        <table class='edit' style='border:1px!important'>\r\n" . "          <tr>\r\n" . "            <th class='required'>Submitter:</th>\r\n" . "            <td>" . self::drawManagePreprintsOwnerSelectionField($GLOBALS["pp_owneruid"], "Submitter", isset($founderror["pp_owneruid"]) ? 1 : 0) . "            </td>\r\n" . "          </tr>\r\n" . "          <tr>\r\n" . "            <th>Preprint nr:</th>\r\n" . "            <td>[to be allocated]</td>\r\n" . "          </tr>\r\n" . "          <tr>\r\n" . "            <th class='required'>Field:</th>\r\n" . "            <td>\r\n" . "              <select name='pp_field'" . (isset($founderror["pp_field"]) ? " class='error'" : "") . ">\r\n" . "                <option value='0'>&mdash; Select Research Field &mdash;</option>\r\n";
     foreach (self::$researchFields as $group => $label) {
         $stdout .= "                <option value='" . $group . "'" . ($group == $GLOBALS["pp_field"] ? " selected='selected'" : "") . ">" . $label . "</option>\r\n";
     }
     $stdout .= "              </select>\r\n" . "            </td>\r\n" . "          </tr>\r\n" . "          <tr>\r\n" . "            <th class='required'>Authors:</th>\r\n" . "            <td><input type='text' name='pp_authors' size='60'" . (isset($GLOBALS["pp_authors"]) ? " value='" . $GLOBALS["pp_authors"] . "'" : "") . (isset($founderror["pp_authors"]) ? " class='error'" : "") . "></td>\r\n" . "          </tr>\r\n" . "          <tr>\r\n" . "            <th class='required'>Title:</th>\r\n" . "            <td><input type='text' name='pp_title' size='60'" . (isset($GLOBALS["pp_title"]) ? " value='" . $GLOBALS["pp_title"] . "'" : "") . (isset($founderror["pp_title"]) ? " class='error'" : "") . "></td>\r\n" . "          </tr>\r\n" . "        </table>\r\n" . "        <input type='submit' value='Allocate a Preprint Number'" . " style='margin-top:2em!important'" . ">\r\n" . "        <input type='hidden' name='bt' value='1'>\r\n";
     foreach (array("pp_period", "pp_managemode", "pp_currentmode", "pp_editmode") as $gps) {
         if (isset($GLOBALS[$gps])) {
             $stdout .= "        <input type='hidden' name='" . $gps . "' value='" . $GLOBALS[$gps] . "'>\r\n";
         }
     }
     $stdout .= "      </form>\r\n" . "      &nbsp;\r\n" . self::drawFakeButton(functions::pathUpOneLevel($_SERVER["PHP_SELF"]), "Cancel") . "    </div>\r\n" . "    \r\n";
     // --------------------------------
     return $stdout;
 }
Пример #6
0
 public static function OutputRoomsEditor()
 {
     return "<div class='box error background bold padding'>UNDER CONSTRUCTION</div>";
     $stdout = "";
     $showform["list"] = 1;
     $showform["edit"] = $showCacheUpdateLink = 0;
     $error = $warning = $founderror = array();
     functions::gpc_declare_input("edit", false, true);
     functions::gpc_declare_input("delete", false, true);
     functions::gpc_declare_input("c", "", false);
     // $confId
     functions::gpc_declare_input("e", false, true);
     functions::gpc_declare_input("u", false, true);
     functions::gpc_declare_input("d", false, true);
     functions::gpc_declare_input("menulookup", false, true);
     // ----------------------------------------------------------------
     // -- If 'recreate menulookup cache' requested
     // ----------------------------------------------------------------
     if ($GLOBALS["menulookup"]) {
         if (document::recreateMenulookupCache()) {
             $stdout .= "\r\n" . functions::boxMessage("confirm", "<strong>Cache 'menulookup'</strong> was successfully recreated.") . "\r\n";
         } else {
             $stdout .= "\r\n" . functions::boxMessage("error", "<strong>Cache 'menulookup'</strong> could not be recreated") . "\r\n";
         }
     }
     // ----------------------------------------------------------------
     // -- If 'edit' requested
     // ----------------------------------------------------------------
     if ($GLOBALS["edit"]) {
         $showform["list"] = 0;
         // --------------------------------
         // -- GPC handling
         // --------------------------------
         functions::gpc_declare_input("title", "", false);
         functions::gpc_declare_input("eventtype", "0", false);
         functions::gpc_declare_input("subpath", "", false);
         functions::gpc_declare_input("venue", "", false);
         functions::gpc_declare_input("surveyid", "0", false);
         functions::gpc_declare_input("surveyresponse", "", false);
         functions::gpc_declare_input("youtube", "", false);
         functions::gpc_declare_input("blurb", "", false);
         // --------------------------------
         // -- Check for errors in input
         // --------------------------------
         ///debug::rrr();
         if (!in_array($GLOBALS["eventtype"], event::$eventTypeId)) {
             $founderror["eventtype"] = 1;
             $error[] = "Please select an event type.";
         }
         if (empty($GLOBALS["subpath"])) {
             $founderror["subpath"] = 1;
             $error[] = "Please write a non-empty subpath.";
         }
         // --------------------------------
         // -- If errors found, display form with error messages and warnings
         // --------------------------------
         if (!empty($error)) {
             $stdout .= functions::boxMessage("error", $error);
             $GLOBALS["e"] = 1;
         }
         if (!empty($warning)) {
             $stdout .= functions::boxMessage("warning", $warning);
             $GLOBALS["e"] = 1;
         }
         // --------------------------------
         // -- If no errors, update database with submitted data
         // --------------------------------
         if (empty($error)) {
             $record = array("confid" => $GLOBALS["c"], "title" => $GLOBALS["title"], "eventtype" => $GLOBALS["eventtype"], "subpath" => $GLOBALS["subpath"], "venue" => $GLOBALS["venue"], "surveyid" => $GLOBALS["surveyid"], "surveyresponse" => $GLOBALS["surveyresponse"], "youtube" => $GLOBALS["youtube"], "blurb" => $GLOBALS["blurb"]);
             $res = false;
             //TODO
             /*
                     $res = $this->updateEventManualData($record);
             */
             if (!$res) {
                 $stdout .= "\r\n" . functions::boxMessage("error", "Could not update the event") . "\r\n";
                 $GLOBALS["e"] = 1;
                 $showCacheUpdateLink = 0;
             } else {
                 $stdout .= "\r\n" . functions::boxMessage("confirm", "The event was successfully updated.") . "\r\n";
                 $GLOBALS["e"] = 1;
                 $showCacheUpdateLink = 1;
             }
         }
         // end if ($error)
     }
     // end if
     if ($GLOBALS["e"]) {
         $showform["list"] = 0;
         $stdout .= self::outputRoomsEditorForm($GLOBALS["c"], $founderror, $error, $showCacheUpdateLink);
     }
     // end if ($GLOBALS["e"])
     // ----------------------------------------------------------------
     // -- If 'update from Agenda' requested
     // ----------------------------------------------------------------
     if ($GLOBALS["u"]) {
         $showform["list"] = 0;
         // --------------------------------
         // -- GPC handling
         // --------------------------------
         // --------------------------------
         // -- Check for errors in input
         // --------------------------------
         if (!is_numeric($GLOBALS["c"]) || $GLOBALS["c"] <= 0) {
             $founderror["confid"] = 1;
             $error[] = "There is some problem with the ID of the event you selected.";
         }
         // --------------------------------
         // -- If errors found, display form with error messages and warnings
         // --------------------------------
         if (!empty($error)) {
             $stdout .= functions::boxMessage("error", $error);
             $GLOBALS["u"] = 1;
         }
         if (!empty($warning)) {
             $stdout .= functions::boxMessage("warning", $warning);
             $GLOBALS["u"] = 1;
         }
         // --------------------------------
         // -- If no errors, update database with submitted data
         // --------------------------------
         if (empty($error)) {
             //TODO: keep 01-01 events when updating from Agenda
             $res = false;
             //TODO:
             /*
                     $res = $this->updateOneEventFromAgenda($GLOBALS["c"],TRUE);
             */
             if (!$res) {
                 $stdout .= "\r\n" . functions::boxMessage("error", "Could not update the event with ID=" . $GLOBALS["c"]) . "\r\n";
                 $GLOBALS["u"] = 1;
             } else {
                 $stdout .= "\r\n" . functions::boxMessage("confirm", "The event with <strong>ID=" . $GLOBALS["c"] . "</strong> was successfully updated.") . "\r\n";
                 $GLOBALS["u"] = 1;
             }
         }
         // end if ($error)
         $showform["list"] = 1;
     }
     // end if ($GLOBALS["u"])
     // ----------------------------------------------------------------
     // -- If 'delete' requested
     // ----------------------------------------------------------------
     if ($GLOBALS["delete"]) {
         $showform["list"] = 0;
         // --------------------------------
         // -- GPC handling
         // --------------------------------
         functions::gpc_declare_input("xxx", "", false);
         // --------------------------------
         // -- Check for errors in input
         // --------------------------------
         // --------------------------------
         // -- If errors found, display form with error messages and warnings
         // --------------------------------
         if (!empty($error)) {
             $stdout .= functions::boxMessage("error", $error);
             $GLOBALS["d"] = 1;
         }
         if (!empty($warning)) {
             $stdout .= functions::boxMessage("warning", $warning);
             $GLOBALS["d"] = 1;
         }
         // --------------------------------
         // -- If no errors, update database with submitted data
         // --------------------------------
         if (empty($error)) {
         }
         // end if ($error)
     }
     // end if
     if ($GLOBALS["d"]) {
         $showform["list"] = 0;
         //      $stdout .= self::outputRoomsEditorForm($GLOBALS["c"],$founderror,$error);
         $stdout .= "DELETE" . "  <p class='largefont'><strong>&#171; <a href='" . $_SERVER["PHP_SELF"] . "'>Edit other events</a></strong></p>\r\n";
     }
     // end if ($GLOBALS["d"])
     // --------------------------------
     // -- Output form, if requested
     // --------------------------------
     if ($showform["list"]) {
         $stdout .= self::outputRoomsEditorList();
     }
     // --------------------------------
     return $stdout;
 }