本文整理汇总了PHP中Note::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Note::add方法的具体用法?PHP Note::add怎么用?PHP Note::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Note
的用法示例。
在下文中一共展示了Note::add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_note
public function add_note()
{
if (!Visitor::current()->group->can("add_note")) {
show_403(__("Access Denied"), __("You do not have sufficient privileges to add notes.", "extend"));
}
$version = new Version($_POST['version_id']);
if (empty($_POST['body'])) {
Flash::warning(__("Please enter a message.", "extend"), $version->url());
}
$note = Note::add($_POST['body'], $_POST['version_id']);
$files = array();
foreach ($_FILES['attachment'] as $key => $val) {
foreach ($val as $file => $attr) {
$files[$file][$key] = $attr;
}
}
foreach ($files as $attachment) {
if ($attachment['error'] != 4) {
$path = upload($attachment, null, "attachments");
Attachment::add(basename($path), $path, "note", $note->id);
}
}
Flash::notice(__("Note added.", "extend"), $note->url(true));
}
示例2: retrieve
<?php
define('NO_SESSION_LOCATION', true);
require_once '../kernel/begin.php';
require_once 'media_begin.php';
require_once '../kernel/header_no_display.php';
if (!empty($_GET['note']) && $User->check_level(MEMBER_LEVEL)) {
$id = retrieve(POST, 'id', 0);
$note = retrieve(POST, 'note', 0);
import('content/note');
$Note = new Note('media', $id, '', $MEDIA_CONFIG['note_max'], '', NOTE_DISPLAY_NOTE);
if (!empty($note) && !empty($id)) {
echo $Note->add($note);
}
}
示例3: add
/**
* Overload the add() method to the contact activity
*/
function add()
{
if (strlen($this->date_added) == 0) {
$this->date_added = date("Y-m-d");
}
$Parsedown = new Parsedown();
$this->note = $Parsedown->text($this->note);
parent::add();
// This below was a try that didn't worked as to global. Created the eventFormatNoteInsert eventaction instead.
// $this->note = $this->quote(htmlentities($this->note));
// $this->query("INSERT INTO ".$this->getTable()." (`idcontact`, `note`, `date_added`, `document`, `idcompany`, `iduser`)
// VALUES ('".$this->idcontact."','".$this->note."','".$this->date_added."','".$this->document."','".$this->company."','".$this->iduser."')");
// $this->setPrimaryKeyValue($this->getInsertId($this->getTable(), $this->getPrimaryKey()));
if ($this->getPrimaryKeyValue() > 0) {
$contact = $this->getParentContact();
$contact->setActivity();
}
}