本文整理汇总了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());
}
示例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>";
示例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>
';
示例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;
示例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();
示例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();