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


PHP asset::build_notification方法代码示例

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


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

示例1: _move

 private static function _move($ccp, $folder, $sgsml)
 {
     if (empty($sgsml->att["DISABLE_TRIGGER_CCP"]) and (!empty($sgsml->att["TRIGGER_NEW"]) or !empty($sgsml->att["TRIGGER_DELETE"]))) {
         $ccp["data_fields"] = array("*");
     } else {
         if (in_array("notification", $ccp["data_fields"])) {
             $ccp["data_fields"] = array("id", "folder", "notification");
             foreach ($sgsml->fields as $key => $field) {
                 if (isset($field["REQUIRED"]) and !in_array($key, $ccp["data_fields"])) {
                     $ccp["data_fields"][] = $key;
                 }
             }
         } else {
             $ccp["data_fields"] = array("id", "folder");
         }
     }
     $vars = array("handler" => $ccp["handler"], "sqlvarsnoquote" => $ccp["vars_noquote"], "custom_name" => $ccp["custom_name"], "default_sql" => $ccp["default_sql"]);
     $rows = db_select($ccp["tname"], $ccp["data_fields"], $ccp["where"], "", "", array("item" => $ccp["items"], "folder" => $ccp["folder"], "folders" => $ccp["folders"]), $vars);
     if (is_array($rows) and count($rows) < count($ccp["items"])) {
         exit("{t}Item(s) not found or access denied.{/t}");
     }
     $default_values = folder_get_default_values($folder);
     $messages = array();
     foreach ($rows as $row) {
         $folder_source = $row["folder"];
         if (empty($folder_source) or $folder_source == $folder or !db_get_right($folder_source, "write")) {
             continue;
         }
         $sgsml->vars["id"] = array($row["id"]);
         $sgsml->vars["folders"] = array($folder_source);
         if (!empty($sgsml->att["DISABLE_TRIGGER_CCP"])) {
             unset($sgsml->att["TRIGGER_EDIT"]);
         }
         $result = 0;
         if (!is_numeric($folder)) {
             $sgsml->vars["id"] = $row["id"];
             $sgsml->vars["folder_source"] = $folder_source;
             $sql_data = array_merge($default_values, array("folder" => $folder));
             $sql_data["history"] = sprintf("{t}Item edited (%s) by %s at %s{/t}\n", "@fields@", $_SESSION["username"], sys_date("{t}m/d/y g:i:s a{/t}"));
             $sql_data = $sgsml->build_history($sql_data, $row);
             $error_sql = db_update($sgsml->tname, $sql_data, array("id=@id@"), $sgsml->vars, array("handler" => $sgsml->handler));
             if ($error_sql != "") {
                 $messages[] = "{t}SQL failed.{/t} " . $error_sql;
             }
             if (!empty($sgsml->att["TRIGGER_EDIT"]) and empty($sgsml->att["DISABLE_TRIGGER_CCP"])) {
                 $return = asset_process_trigger($sgsml->att["TRIGGER_EDIT"], $row["id"], $row, $sgsml->tname);
                 if ($return != "") {
                     $messages[] = "{t}Trigger failed{/t}: " . $return;
                 }
             }
             if (!empty($row["notification"])) {
                 $row["folder"] = $folder;
                 $smtp_data = asset::build_notification($sgsml->tname, $sgsml->fields, $row, $sql_data, $row["id"]);
                 $return = asset_process_trigger("sendmail", $row["id"], $smtp_data);
                 if ($return != "") {
                     $messages[] = "{t}Trigger failed{/t}: " . $return;
                 }
             }
         } else {
             $sql_data = array_merge($default_values, array("folder" => $folder));
             $result = $sgsml->update($sql_data, $row["id"]);
         }
         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 {
             sys_log_stat("moved_records", 1);
         }
     }
     return $messages;
 }
开发者ID:drognisep,项目名称:Simple-Groupware,代码行数:80,代码来源:asset_ccp.php

示例2: _save


//.........这里部分代码省略.........
             $addfield = false;
         }
         if (isset($field["READONLYIN"]) and (in_array($this->view, $field["READONLYIN"]) or in_array("all", $field["READONLYIN"]))) {
             $addfield = false;
         }
         if (isset($field["ONLYIN"])) {
             if (in_array($this->view, $field["ONLYIN"])) {
                 $addfield = true;
             } else {
                 $addfield = false;
             }
         }
         if (!$addfield) {
             unset($sql_data[$data_key]);
         }
     }
     // build history
     $sql_data = $this->build_history($sql_data, $data_row);
     if (!array_diff(array_keys($sql_data), array("history", "seen"))) {
         $sql_data = array();
     }
     // save in db
     if ($insert) {
         $error_sql = db_insert($this->tname, $sql_data, array("handler" => $this->handler));
         if ($error_sql != "") {
             return self::_error("{t}SQL failed.{/t}", $error_sql);
         }
         if ($this->notification) {
             sys_notification("{t}Item successfully created.{/t} (" . $id . ")");
         }
     } else {
         if (count($sql_data) == 0) {
             return $id;
         }
         $error_sql = db_update($this->tname, $sql_data, array("id=@id@"), array("id" => $id, "folder" => $this->folder), array("handler" => $this->handler));
         if ($error_sql != "") {
             return self::_error("{t}SQL failed.{/t}", $error_sql);
         }
         if ($this->notification) {
             sys_notification("{t}Item successfully updated.{/t} (" . (is_numeric($id) ? $id : 1) . ")");
         }
     }
     if (empty($this->handler)) {
         db_update("simple_sys_tree", array("history" => "[" . $id . "/details] " . $sql_data["history"]), array("id=@id@"), array("id" => $this->folder));
         db_update_treesize($this->tname, $this->folder);
         if (!$insert and $this->folder != $data_row["folder"]) {
             db_update("simple_sys_tree", array("history" => "[" . $id . "/details] " . $sql_data["history"]), array("id=@id@"), array("id" => $data_row["folder"]));
             db_update_treesize($this->tname, $data_row["folder"]);
             db_search_delete($this->tname, $id, $data_row["folder"]);
         }
         if (empty($this->att["NO_SEARCH_INDEX"])) {
             db_search_update($this->tname, $id, $this->fields);
         }
         sys_log_stat($insert ? "new_records" : "changed_records", 1);
     }
     // call triggers
     $trigger = "";
     if ($insert and !empty($this->att["TRIGGER_NEW"])) {
         $trigger = $this->att["TRIGGER_NEW"];
     }
     if (!$insert and !empty($this->att["TRIGGER_EDIT"])) {
         $trigger = $this->att["TRIGGER_EDIT"];
     }
     if ($trigger and $result = asset_process_trigger($trigger, $id, $rdata, $this->tname)) {
         return self::_error("{t}Trigger failed{/t}", $result);
     }
     // send notification
     $tree_notification = db_select_value("simple_sys_tree", "notification", "id=@id@", array("id" => $this->folder));
     if ($tree_notification != "") {
         $rdata["notification"] .= "," . $tree_notification;
     }
     if (!$insert and $this->folder != $data_row["folder"]) {
         $tree_notification = db_select_value("simple_sys_tree", "notification", "id=@id@", array("id" => $data_row["folder"]));
         if ($tree_notification != "") {
             $rdata["notification"] .= "," . $tree_notification;
         }
     }
     if (!empty($rdata["notification"])) {
         $rdata["notification"] = trim($rdata["notification"], ",");
         $smtp_data = asset::build_notification($this->att["NAME"], $this->current_fields, $rdata, $sql_data, $id, $data_row);
         if ($result = asset_process_trigger("sendmail", $id, $smtp_data)) {
             return self::_error("{t}Trigger failed{/t}", $result);
         }
     }
     // update stats
     if (!empty($this->handler)) {
         foreach ($sql_data as $data_key => $data_value) {
             $field = $this->fields[$data_key];
             if ($field["SIMPLE_TYPE"] != "files") {
                 continue;
             }
             foreach (explode("|", $data_value) as $file) {
                 if (sys_strbegins($file, SIMPLE_CACHE . "/upload/")) {
                     @unlink($file);
                 }
             }
         }
     }
     return $id;
 }
开发者ID:drognisep,项目名称:Simple-Groupware,代码行数:101,代码来源:sgsml.php


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