$output = handleupload($errors, $warnings, $messages); if ($output !== false) { list($xml, $metadata) = $output; if (validateQTI($xml, $errors, $warnings, $messages)) { $xml = simplexml_load_string($xml); // get data from QTI $identifier = (string) $xml["identifier"]; $title = (string) $xml["title"]; // see if an item with this identifier already exists in the // database $exists = itemexists($identifier); if ($exists && itemowner($identifier) != username()) { $errors[] = "The item you are trying to upload was already uploaded by a different user. You should clone it so it gets a new identifier and then try again."; } else { deposititem($xml, $metadata); if (!authoredineqiat($xml)) { $warnings[] = "This item was not authored in Eqiat. The item will still be playable but Eqiat may not be able to import it for editing."; } // collect any warnings and messages $thingstosay = array(); if (!empty($warnings)) { $thingstosay[] = "warnings"; } if (!empty($messages)) { $thingstosay[] = "messages"; } $title = "Item " . ($exists ? "updated" : "deposited"); include "htmlheader.php"; ?> <h2><?php echo htmlspecialchars($title);
?> <?php if ($item["user"] == username()) { ?> <li> <a href="<?php echo SITEROOT_WEB; ?> ?page=toEqiat&qtiid=<?php echo htmlspecialchars($item["identifier"]); ?> "> Edit </a> <?php if (!authoredineqiat($item["xml"])) { ?> <img src="<?php echo SITEROOT_WEB; ?> images/error.png" width="16" height="16" alt="warning sign" title="Item was not authored in Eqiat and so may not be editable"> <?php } ?> </li> <?php } ?> <?php if ($item["user"] == username() || userhasprivileges()) { ?>