当前位置: 首页>>代码示例>>PHP>>正文


PHP Api::GetCollection方法代码示例

本文整理汇总了PHP中Api::GetCollection方法的典型用法代码示例。如果您正苦于以下问题:PHP Api::GetCollection方法的具体用法?PHP Api::GetCollection怎么用?PHP Api::GetCollection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Api的用法示例。


在下文中一共展示了Api::GetCollection方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Suicide

 public function Suicide()
 {
     if ($this->IsSnapshot) {
         $tmp = Api::GetCollection(Api::COLLECTIONPATH . $this->GetID());
         $this->list = $tmp->GetList();
         $this->IsSnapshot = false;
     }
     foreach ($this->list as $item) {
         if ($item instanceof Artifact) {
             $this->list[$item->GetID()]->Suicide();
             unset($this->list[$item->GetID()]);
         } elseif ($item instanceof Collection) {
             $item->Suicide();
         }
     }
     unlink(Api::COLLECTIONPATH . $this->GetID());
 }
开发者ID:ao222qc,项目名称:ApiProject,代码行数:17,代码来源:Collection.php

示例2: elseif

    <br>
    <form action="" method="GET">
        <input name="' . $ID . '">
        <button>Find</button>
    </form>
';
if (isset($_GET[$ID])) {
    $collection = Api::GetCollection($_GET[$ID]);
    if (isset($_GET['delete']) && isset($_GET["type"])) {
        if ($_GET["type"] == "artifact") {
            $artifact = $collection->GetArtifact($_GET['delete']);
            if ($artifact != NULL) {
                $collection->DeleteArtifact($artifact->GetID());
            }
        } elseif ($_GET["type"] == "collection") {
            $ctd = Api::GetCollection($_GET['delete']);
            if ($ctd != NULL) {
                $collection->DeleteCollection($ctd->GetID());
                header("Location: ?id=" . $collection->GetID());
                die;
            }
        }
    }
    echo "\n    <i>{$collection->GetID()}</i>\n    <h2>{$collection->GetName()}</h2>\n    <ul>\n    ";
    foreach ($collection->GetList() as $item) {
        echo '<li>';
        if ($item instanceof Artifact) {
            $path = Api::APIPATH . Api::ARTIFACTPATH . $item->GetID();
            echo "<a href='{$path}' download='{$item->GetFilename()}'><b>{$item->GetFilename()}</b></a> <i>({$item->GetID()})</i>";
            echo " <a href='share.php?id={$item->GetID()}&fcid={$collection->GetID()}'>Share</a>";
            echo " <a href='update.php?cid={$collection->GetID()}&id={$item->GetID()}'>Update</a>";
开发者ID:ao222qc,项目名称:ApiProject,代码行数:31,代码来源:find.php

示例3: error_reporting

<?php

error_reporting(E_ALL);
require_once "init.php";
$itemID = null;
$collectionID = null;
$extension = null;
if (isset($_GET["id"]) && isset($_GET["cid"])) {
    $itemID = $_GET["id"];
    $collectionID = $_GET["cid"];
    $originalCollection = Api::GetCollection($collectionID);
    if ($originalCollection != NULL) {
        $item = $originalCollection->GetArtifact($itemID);
        if ($item != null) {
            $extension = $item->GetExtension();
            if (isset($_FILES["file"])) {
                $item->Update($_FILES["file"]);
            }
        }
    }
}
echo '
     <br>
     <form enctype="multipart/form-data" action="?cid=' . $collectionID . '&id=' . $itemID . '" method="POST">
        Artifact <b>' . $itemID . '</b> from collection <b><a href="find.php?id=' . $collectionID . '">' . $collectionID . '</a></b>
        <br>
        <br>
        <input type="file" name="file" accept=".' . $extension . '">
        <button>Update</button>
    </form>
';
开发者ID:ao222qc,项目名称:ApiProject,代码行数:31,代码来源:update.php

示例4: error_reporting

<?php

error_reporting(E_ALL);
require_once "init.php";
$NAME = "name";
$PID = "pid";
$parentElement = "";
if (isset($_GET[$PID])) {
    $parentElement = "Adding to collection: <a href='find.php?id={$_GET[$PID]}'><b>{$_GET[$PID]}</b></a><input type=hidden name='{$PID}' value='{$_GET[$PID]}'>";
}
if (isset($_GET[$NAME])) {
    $collection = new Collection($_GET[$NAME]);
    if (isset($_GET[$PID])) {
        $parent = Api::GetCollection($_GET[$PID]);
        if ($parent != null) {
            $parent->AddCollection($collection);
        }
    }
    header("Location: find.php?id=" . $collection->GetID());
}
$body = '
    <br>
    <form action="" method="GET">
        Collection name: <input name="' . $NAME . '">
        <br>
        ' . $parentElement . '
        <br>
        <button>Create and open</button>
    </form>
';
echo $body;
开发者ID:ao222qc,项目名称:ApiProject,代码行数:31,代码来源:create.php

示例5: error_reporting

<?php

error_reporting(E_ALL);
require_once "init.php";
$itemID = null;
$collectionID = null;
if (isset($_GET["id"]) && isset($_GET["fcid"])) {
    $itemID = $_GET["id"];
    $collectionID = $_GET["fcid"];
    if (isset($_GET["cid"])) {
        $originalCollection = Api::GetCollection($collectionID);
        $targetCollection = Api::GetCollection($_GET["cid"]);
        if ($originalCollection != NULL && $targetCollection != NULL) {
            $item = $originalCollection->GetArtifact($itemID);
            $targetCollection->AddArtifact($item);
        }
    }
}
echo '
     <br>
     <form action="?" method="GET">
        <input type=hidden value="' . $collectionID . '" name="fcid">
        <input type=hidden value="' . $itemID . '" name="id">
        Artifact <b>' . $itemID . '</b> from collection <b><a href="find.php?id=' . $collectionID . '">' . $collectionID . '</a></b>
        <br>
        Collection ID <br>
        <input name="cid">
        <button>Share</button>
    </form>
';
Template::Render();
开发者ID:ao222qc,项目名称:ApiProject,代码行数:31,代码来源:share.php

示例6: error_reporting

error_reporting(E_ALL);
require_once "init.php";
$FILE = "file";
$CID = "CollectionID";
$preCollectionID = null;
if (isset($_GET[$CID])) {
    $preCollectionID = $_GET[$CID];
}
$body = '
    <br>
   <form enctype="multipart/form-data" action="?CollectionID=' . $preCollectionID . '" method="POST">
        Upload artifact to collection <b><a href="find.php?id=' . $preCollectionID . '">' . $preCollectionID . '</a></b>
        <br>
        <input type="file" name="' . $FILE . '">
        <br>
        <button>Upload</button>
    </form>
';
if (isset($_FILES[$FILE]) && isset($_GET[$CID])) {
    $collectionID = $_GET[$CID];
    $collection = Api::GetCollection($collectionID);
    if ($collection != null) {
        $collection->AddArtifact(new Artifact($_FILES[$FILE]));
        echo "Upload successfull!";
    } else {
        echo "Collection does not exist";
    }
}
echo $body;
Template::Render();
开发者ID:ao222qc,项目名称:ApiProject,代码行数:30,代码来源:upload.php


注:本文中的Api::GetCollection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。