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


PHP asset::delete_items方法代码示例

本文整理汇总了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;
 }
开发者ID:drognisep,项目名称:Simple-Groupware,代码行数:15,代码来源:ajax.php

示例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;
 }
开发者ID:drognisep,项目名称:Simple-Groupware,代码行数:101,代码来源:asset_ccp.php


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