コード例 #1
0
 public function getEntries($proxy_id = NULL)
 {
     $entries = Models_Eportfolio_Entry::fetchAll($this->pfartifact_id, $proxy_id);
     return $entries;
 }
コード例 #2
0
     add_error("No file");
 }
 if (!$ERROR) {
     $PROCESSED["proxy_id"] = $ENTRADA_USER->getID();
     // @todo: this needs to be fixed
     $PROCESSED["submitted_date"] = time();
     $PROCESSED["reviewed_date"] = "0";
     $PROCESSED["flag"] = "0";
     $PROCESSED["flagged_by"] = "0";
     $PROCESSED["flagged_date"] = "0";
     $PROCESSED["order"] = "0";
     $PROCESSED["updated_date"] = date(time());
     $PROCESSED["updated_by"] = $ENTRADA_USER->getID();
     $PROCESSED["_edata"] = serialize(array("description" => $PROCESSED["description"], "filename" => $filename));
     $PROCESSED["type"] = "FILE";
     $pentry = new Models_Eportfolio_Entry();
     if ($pentry->fromArray($PROCESSED)->insert()) {
         echo "inserted";
         $pfartifact = $pentry->getPfartifact();
         $pfolder = $pfartifact->getFolder();
         $portfolio = $pfolder->getPortfolio();
         $file_realpath = EPORTFOLIO_STORAGE_PATH . "/portfolio-" . $portfolio->getID() . "/folder-" . $pfolder->getID() . "/artifact-" . $pfartifact->getID() . "/user-" . $pentry->getProxyID() . "/" . $pentry->getID();
         if (!copy($_FILES["file"]["tmp_name"], $file_realpath)) {
             add_error("Failed to copy file.");
         } else {
             echo "copied";
         }
     }
 } else {
     echo display_error();
 }
コード例 #3
0
 $_edata["description"] = $PROCESSED["description"];
 $_edata["title"] = $PROCESSED["title"];
 if ($PROCESSED["filename"]) {
     $_edata["filename"] = $PROCESSED["filename"];
 }
 $PROCESSED["_edata"] = serialize($_edata);
 if (isset($PROCESSED["pentry_id"])) {
     $pentry = Models_Eportfolio_Entry::fetchRow($PROCESSED["pentry_id"]);
     if ($pentry->fromArray($PROCESSED)->update()) {
         $PROCESSED["_edata"] = unserialize($PROCESSED["_edata"]);
         echo json_encode(array("status" => "success", "data" => array("pentry_id" => $pentry->getID(), "type" => $pentry->getType(), "edata" => $pentry->getEdataDecoded(), "submitted_date" => $PROCESSED["submitted_date"])));
     } else {
         echo json_encode(array("status" => "error", "data" => "fail"));
     }
 } else {
     $pentry = new Models_Eportfolio_Entry();
     if ($pentry->fromArray($PROCESSED)->insert()) {
         if ($PROCESSED["filename"]) {
             if ($pentry->saveFile($_FILES["file"]["tmp_name"])) {
                 if (isset($_POST["isie"]) && $_POST["isie"] == "isie") {
                     header('Location: ' . ENTRADA_URL . '/profile/eportfolio#' . $pfolder->getID());
                 } else {
                     echo json_encode(array("status" => "success", "data" => array("pentry_id" => $pentry->getID(), "type" => $pentry->getType(), "edata" => $pentry->getEdataDecoded(), "submitted_date" => $PROCESSED["submitted_date"])));
                 }
             } else {
                 if (isset($_POST["isie"]) && $_POST["isie"] == "isie") {
                     header('Location: ' . ENTRADA_URL . '/profile/eportfolio#' . $pfolder->getID());
                 } else {
                     echo json_encode(array("status" => "error", "data" => "Failed to save file"));
                 }
             }
コード例 #4
0
 public function getEntry()
 {
     $entry = Models_Eportfolio_Entry::fetchRow($this->pentry_id);
     return $entry;
 }
コード例 #5
0
 * @author Organisation: Queen's University
 * @author Unit: School of Medicine
 * @author Developer: Matt Simpson <*****@*****.**>
 * @copyright Copyright 2010 Queen's University. All Rights Reserved.
 * 
 * @version $Id: serve-polls.php 1171 2010-05-01 14:39:27Z ad29 $
 * 
 */
@set_include_path(implode(PATH_SEPARATOR, array(dirname(__FILE__) . "/core", dirname(__FILE__) . "/core/includes", dirname(__FILE__) . "/core/library", get_include_path())));
/**
 * Include the Entrada init code.
 */
require_once "init.inc.php";
if (isset($_SESSION["isAuthorized"]) && $_SESSION["isAuthorized"]) {
    $pentry_id = clean_input($_GET["entry_id"], "int");
    $pentry = Models_Eportfolio_Entry::fetchRow($pentry_id);
    $pfartifact = $pentry->getPfartifact();
    $pfolder = $pfartifact->getFolder();
    $portfolio = $pfolder->getPortfolio();
    $file_realpath = EPORTFOLIO_STORAGE_PATH . "/portfolio-" . $portfolio->getID() . "/folder-" . $pfolder->getID() . "/artifact-" . $pfartifact->getID() . "/user-" . $pentry->getProxyID() . "/" . $pentry->getID();
    if (file_exists($file_realpath)) {
        $finfo = $finfo = new finfo(FILEINFO_MIME);
        $edata = $pentry->getEdataDecoded();
        $filename = preg_replace('/[^a-zA-Z0-9-_\\.]/', '', str_replace(" ", "-", trim($edata["filename"])));
        header('Content-Description: File Transfer');
        header('Content-Type: ' . $finfo->file($file_realpath));
        header('Content-Disposition: attachment; filename=' . strtolower($filename));
        header('Content-Transfer-Encoding: binary');
        header('Expires: 0');
        header('Cache-Control: must-revalidate');
        header('Pragma: public');