本文整理汇总了PHP中asset::delete_items方法的典型用法代码示例。如果您正苦于以下问题:PHP asset::delete_items方法的具体用法?PHP asset::delete_items怎么用?PHP asset::delete_items使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类asset
的用法示例。
在下文中一共展示了asset::delete_items方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: asset_delete
/**
* Deletes assets
*
* @param int|string $folder Folder ID or String (/Workspace/.../)
* @param string $view View name (e.g. display, details)
* @param array $items Asset-IDs
* @param string $mode delete, empty (complete folder), purge (no trash), purgeall (complete folder + no trash)
* @return int Folder ID
*/
static function asset_delete($folder, $view, $items, $mode)
{
self::_require_access($folder, "write");
asset::delete_items($folder, $view, $items, $mode);
return $folder;
}
示例2: _copy
//.........这里部分代码省略.........
$sgsml->patch_fields(array_slice($mapping[1], 1));
}
}
$mappings = array();
foreach (self::_get_mappings("|") as $mapping) {
if (strpos($mapping[0], "->")) {
continue;
}
$mapping1 = explode(".", $mapping[0]);
$mapping2 = explode(".", $mapping[1]);
$key = "simple_" . $mapping1[0] . ".simple_" . $mapping2[0];
$mappings[$key][$mapping2[1]] = $mapping1[1];
$key = "simple_" . $mapping2[0] . ".simple_" . $mapping1[0];
$mappings[$key][$mapping1[1]] = $mapping2[1];
}
$default_values = folder_get_default_values($folder);
$messages = array();
foreach ($rows as $row) {
if (empty($row["folder"]) or !db_get_right($row["folder"], "read")) {
continue;
}
if (isset($mappings[$ccp["tname"] . "." . $tname])) {
foreach ($mappings[$ccp["tname"] . "." . $tname] as $to => $from) {
$row[$to] = $row[$from];
}
}
$row = array_merge($row, $default_values);
foreach (array_keys($row) as $key) {
if (!isset($sgsml->fields[$key])) {
unset($row[$key]);
continue;
}
$field = $sgsml->fields[$key];
if ((isset($field["KEY"]) or isset($field["IS_UNIQUE"])) and !empty($row[$key]) and !isset($field["READONLYIN"])) {
$val = $row[$key];
$step = 1;
while ($step < 100 and validate::itemexists($tname, array($key => $val), -1) != "") {
$step++;
$val = $row[$key] . "_" . $step;
}
$row[$key] = $val;
}
if (isset($field["RESTORE"])) {
$row[$key] = self::_restore_value($row, $key, $field["RESTORE"]);
}
}
$id = $row["id"];
$row["id"] = -1;
$row["folder"] = $folder;
if (isset($row["syncid"])) {
$row["syncid"] = "";
}
$newfiles = array();
if (is_array($ccp["file_fields"]) and count($ccp["file_fields"]) > 0) {
foreach ($ccp["file_fields"] as $file_field) {
if (!empty($row[$file_field])) {
$data_files = explode("|", trim($row[$file_field], "|"));
$row[$file_field] = array();
foreach ($data_files as $file) {
if (!file_exists($file)) {
continue;
}
$target = self::_paste_item_copyfile($file, $row["id"], $tname);
$row[$file_field][] = $target;
$newfiles[] = $target;
}
$row[$file_field] = implode("|", $row[$file_field]);
}
}
}
if (!empty($sgsml->att["DISABLE_TRIGGER_CCP"])) {
unset($sgsml->att["TRIGGER_NEW"]);
}
$result = $sgsml->insert($row);
if (!is_numeric($result)) {
if (is_array($result) and count($result) > 0) {
$message = "{t}Error pasting asset{/t}:";
foreach ($result as $field => $errors) {
foreach ($errors as $error) {
$message .= "\n" . $error[0] . ": " . $error[1];
}
}
} else {
$message = $result;
}
$messages[] = $message;
} else {
if ($delete) {
asset::delete_items($ccp["folder"], "display", array($id), $ccp["delete_mode"]);
}
sys_log_stat("copied_records", 1);
}
foreach ($newfiles as $file) {
if (sys_strbegins($file, SIMPLE_CACHE . "/upload/")) {
@unlink($file);
}
}
}
return $messages;
}