本文整理汇总了PHP中Note类的典型用法代码示例。如果您正苦于以下问题:PHP Note类的具体用法?PHP Note怎么用?PHP Note使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Note类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: eventAddUpdateDraft
function eventAddUpdateDraft(EventControler $evtcl)
{
$id = $evtcl->id;
$type = $evtcl->id_type;
$text = $evtcl->text;
if ($text != '') {
$do_note = new Note();
$text = $do_note->htmlCleanUp($text);
$q = new sqlQuery($this->getDbCon());
$q->query("SET CHARACTER SET utf8");
$q->query("select * from " . $this->table . " Where id= " . $id . " AND id_type = '" . $type . "' \n AND iduser = " . $_SESSION['do_User']->iduser);
if ($q->getNumRows()) {
// Update
while ($q->fetch()) {
$idnote_draft = $q->getData("idnote_draft");
}
$this->getId($idnote_draft);
$this->note_content = $text;
$this->timestamp = time();
$this->update();
} else {
//Insert
$this->id = $id;
$this->id_type = $type;
$this->iduser = $_SESSION['do_User']->iduser;
$this->note_content = $text;
$this->timestamp = time();
$this->add();
}
}
}
示例2: saveFile
function saveFile($note, $portal = false)
{
global $sugar_config;
$focus = new Note();
if (!empty($note['id'])) {
$focus->retrieve($note['id']);
} else {
return '-1';
}
if (!empty($note['file'])) {
$decodedFile = base64_decode($note['file']);
$this->upload_file->set_for_soap($note['filename'], $decodedFile);
$ext_pos = strrpos($this->upload_file->stored_file_name, ".");
$this->upload_file->file_ext = substr($this->upload_file->stored_file_name, $ext_pos + 1);
if (in_array($this->upload_file->file_ext, $sugar_config['upload_badext'])) {
$this->upload_file->stored_file_name .= ".txt";
$this->upload_file->file_ext = "txt";
}
$focus->filename = $this->upload_file->get_stored_file_name();
$focus->file_mime_type = $this->upload_file->getMimeSoap($focus->filename);
$focus->id = $note['id'];
$return_id = $focus->save();
$this->upload_file->final_move($focus->id);
} else {
return '-1';
}
return $return_id;
}
示例3: registerUser
/**
* This function will create a new user object and return the newly created user object.
*
* @param array $userInfo This should have the properties: username, firstname, lastname, password, ui_language
*
* @return mixed
*/
public function registerUser(array $userInfo, $userLanguage)
{
$user = \User::create($userInfo);
//make the first user an admin
if (\User::all()->count() <= 1) {
$user->is_admin = 1;
}
// Trim trailing whitespace from user first and last name.
$user->firstname = trim($user->firstname);
$user->lastname = trim($user->lastname);
$user->save();
\Setting::create(['ui_language' => $userLanguage, 'user_id' => $user->id]);
/* Add welcome note to user - create notebook, tag and note */
//$notebookCreate = Notebook::create(array('title' => Lang::get('notebooks.welcome_notebook_title')));
$notebookCreate = new \Notebook();
$notebookCreate->title = Lang::get('notebooks.welcome_notebook_title');
$notebookCreate->save();
$notebookCreate->users()->attach($user->id, ['umask' => \PaperworkHelpers::UMASK_OWNER]);
//$tagCreate = Tag::create(array('title' => Lang::get('notebooks.welcome_note_tag'), 'visibility' => 0));
$tagCreate = new \Tag();
$tagCreate->title = Lang::get('notebooks.welcome_note_tag');
$tagCreate->visibility = 0;
$tagCreate->user_id = $user->id;
$tagCreate->save();
//$tagCreate->users()->attach($user->id);
$noteCreate = new \Note();
$versionCreate = new \Version(['title' => Lang::get('notebooks.welcome_note_title'), 'content' => Lang::get('notebooks.welcome_note_content'), 'content_preview' => mb_substr(strip_tags(Lang::get('notebooks.welcome_note_content')), 0, 255), 'user_id' => $user->id]);
$versionCreate->save();
$noteCreate->version()->associate($versionCreate);
$noteCreate->notebook_id = $notebookCreate->id;
$noteCreate->save();
$noteCreate->users()->attach($user->id, ['umask' => \PaperworkHelpers::UMASK_OWNER]);
$noteCreate->tags()->sync([$tagCreate->id]);
return $user;
}
示例4: action_AddNote
function action_AddNote()
{
global $sugar_config;
// $this->view = 'AddNote';
// Creamos una nota
require_once "modules/Notes/Note.php";
$nota = new Note();
$nota->name = "Signed Invoice " . date();
$nota->parent_type = "reg_invoices";
$nota->parent_id = $_POST['record'];
// Guardamos la nota y obtenemos el id
$id = $nota->save();
// Guardamos el archivo ($_POST['doc'])
if ($_POST['type'] == 'XML') {
file_put_contents(trim($sugar_config['upload_dir'], " /") . "/{$id}", trim(html_entity_decode($_POST['doc'])));
$nota->file_mime_type = "text/xml";
$nota->filename = "Factura.xml";
$nota->save();
} else {
if ($_POST['type'] == 'PDF') {
file_put_contents(trim($sugar_config['upload_dir'], " /") . "/{$id}", base64_decode($_POST['doc']));
$nota->file_mime_type = "application/pdf";
$nota->filename = "Factura.pdf";
$nota->save();
}
}
die;
}
示例5: create
public function create($data, $save = true)
{
$note = new Note($this, $data);
if ($save) {
$note->save();
}
return $note;
}
示例6: hasSharesDebt
public function hasSharesDebt($id = null)
{
$options = array('conditions' => array('Condo.' . $this->primaryKey => $id));
$this->contain('Fraction');
$condo = $this->find('first', $options);
$fractions = Set::extract('/Fraction/id', $condo);
$Note = new Note();
return $hasSharesDebt = $Note->find('count', array('conditions' => array('Note.fraction_id' => $fractions, 'Note.note_type_id =' => 2, 'Note.note_status_id <' => 3, 'Note.document_date < NOW()')));
}
示例7: send_email
function send_email($module, $module_type, $printable, $file_name, $attach)
{
require_once 'modules/Emails/Email.php';
global $current_user, $mod_strings, $sugar_config;
//First Create e-mail draft
$email = new Email();
// set the id for relationships
$email->id = create_guid();
$email->new_with_id = true;
//subject
$email->name = $mod_strings['LBL_EMAIL_NAME'] . ' ' . $module->name;
//body
$email->description_html = $printable;
//type is draft
$email->type = "draft";
$email->status = "draft";
if (!empty($module->billing_contact_id) && $module->billing_contact_id != "") {
require_once 'modules/Contacts/Contact.php';
$contact = new Contact();
$contact->retrieve($module->billing_contact_id);
$email->parent_type = 'Contacts';
$email->parent_id = $contact->id;
if (!empty($contact->email1)) {
$email->to_addrs_emails = $contact->email1 . ";";
$email->to_addrs = $module->billing_contact_name . " <" . $contact->email1 . ">";
}
}
//team id
$email->team_id = $current_user->default_team;
//assigned_user_id
$email->assigned_user_id = $current_user->id;
//Save the email object
global $timedate;
$email->date_start = $timedate->to_display_date_time(gmdate($GLOBALS['timedate']->get_db_date_time_format()));
$email->save(FALSE);
$email_id = $email->id;
if ($attach) {
$note = new Note();
$note->modified_user_id = $current_user->id;
$note->created_by = $current_user->id;
$note->name = $file_name;
$note->parent_type = 'Emails';
$note->parent_id = $email_id;
$note->file_mime_type = 'application/pdf';
$note->filename = $file_name;
$note->save();
rename($sugar_config['upload_dir'] . 'attachfile.pdf', $sugar_config['upload_dir'] . $note->id);
}
//redirect
if ($email_id == "") {
echo "Unable to initiate Email Client";
exit;
} else {
header("Location: index.php?action=Compose&module=Emails&return_module=" . $module_type . "&return_action=DetailView&return_id=" . $_REQUEST['record'] . "&recordId=" . $email_id);
}
}
示例8: createNoteWithOwnerAndRelatedAccount
public static function createNoteWithOwnerAndRelatedAccount($name, $owner, $account)
{
$occurredOnStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
$note = new Note();
$note->owner = $owner;
$note->occurredOnDateTime = $occurredOnStamp;
$note->description = $name;
$note->activityItems->add($account);
$saved = $note->save();
assert('$saved');
return $note;
}
示例9: getNotesByLead
function getNotesByLead($lid)
{
$db = Database::obtain();
//check if Lead already exist
$sql = "SELECT * FROM `" . TBL_NOTES . "` WHERE `lid` = '{$lid}'";
$results = $db->query($sql);
$notes = array();
while ($row = mysql_fetch_assoc($results)) {
$note = new Note();
$note->noteFromArray($row);
$notes[] = $note;
}
return $notes;
}
示例10: set_recovery_post
public function set_recovery_post()
{
$NoteList = new ObjList(['db_where_Arr' => ['status' => -1], 'db_where_deletenull_Bln' => TRUE, 'model_name_Str' => 'Note', 'limitstart_Num' => 0, 'limitcount_Num' => 100]);
foreach ($NoteList->obj_Arr as $key => $value_note) {
$Note = new Note(['noteid_Num' => $value_note->noteid_Num]);
$Note->recovery();
}
if (!empty($NoteList->obj_Arr)) {
$this->load->model('Message');
$this->Message->show(['message' => '復原成功', 'url' => 'admin/base/note/set/set']);
} else {
$this->load->model('Message');
$this->Message->show(['message' => '已無可復原的項目', 'url' => 'admin/base/note/set/set']);
}
}
示例11: dashboard
public function dashboard()
{
$user = Auth::user();
$publicnotes = Note::where('user_id', '=', Auth::user()->id)->where('public_or_private', '=', 'public')->get();
$privatenotes = Note::where('user_id', '=', Auth::user()->id)->where('public_or_private', '=', 'private')->get();
$publicsheets = Sheet::where('user_id', '=', Auth::user()->id)->where('public_or_private', '=', 'public')->get();
$privatesheets = Sheet::where('user_id', '=', Auth::user()->id)->where('public_or_private', '=', 'private')->get();
$publicmeetups = Meetup::where('admin_id', '=', Auth::user()->id)->get();
$yournotes = Note::where('user_id', '=', Auth::user()->id)->take(5)->get();
$yoursheets = Sheet::where('user_id', '=', Auth::user()->id)->take(5)->get();
$yourmeetups = Meetup::where('admin_id', '=', Auth::user()->id)->take(5)->get();
$userlists = DB::table('sheets')->where('user_id', Auth::user()->id)->orderBy('created_at', 'desc')->paginate(5);
$usernotes = DB::table('notes')->where('user_id', Auth::user()->id)->orderBy('created_at', 'desc')->paginate(5);
$alladmin = DB::table('meetups')->where('admin_id', Auth::user()->id)->orderBy('created_at', 'desc')->paginate(5);
$allmeetups = DB::table('attendees')->where('attendee_id', Auth::user()->id)->orderBy('created_at', 'desc')->paginate(5);
$meetupsyouarepartof = [];
if ($allmeetups != null) {
foreach ($allmeetups as $individualmeetups) {
$meetup = Meetup::find($individualmeetups->meetup_id);
array_push($meetupsyouarepartof, $meetup->title);
}
} else {
array_push($meetupsyouarepartof, 'You are not attending any meetups, or you are admin of all of them!');
}
return View::make('/users/dashboard')->with('user', $user)->with('userlists', $userlists)->with('usernotes', $usernotes)->with('alladmin', $alladmin)->with('meetupsyouarepartof', $meetupsyouarepartof)->with('publicnotes', $publicnotes)->with('privatenotes', $privatenotes)->with('publicsheets', $publicsheets)->with('privatesheets', $privatesheets)->with('publicmeetups', $publicmeetups)->with('yournotes', $yournotes)->with('yoursheets', $yoursheets)->with('yourmeetups', $yourmeetups);
}
示例12: testLoad
public function testLoad()
{
$this->assertEquals(2, Group::getCount());
$this->assertEquals(0, Role::getCount());
$this->assertEquals(0, Account::getCount());
$this->assertEquals(0, Contact::getCount());
$this->assertEquals(0, Opportunity::getCount());
$this->assertEquals(0, Meeting::getCount());
$this->assertEquals(0, Note::getCount());
$this->assertEquals(0, Task::getCount());
$this->assertEquals(1, User::getCount());
$this->assertEquals(0, ProductCatalog::getCount());
$this->assertEquals(0, ProductCategory::getCount());
$this->assertEquals(0, ProductTemplate::getCount());
$this->assertEquals(0, Product::getCount());
$messageLogger = new MessageLogger();
DemoDataUtil::unsetLoadedModules();
DemoDataUtil::load($messageLogger, 3);
$this->assertEquals(8, Group::getCount());
$this->assertEquals(3, Role::getCount());
$this->assertEquals(3, Account::getCount());
$this->assertEquals(16, Contact::getCount());
$this->assertEquals(6, Opportunity::getCount());
$this->assertEquals(18, Meeting::getCount());
$this->assertEquals(12, Note::getCount());
$this->assertEquals(9, Task::getCount());
$this->assertEquals(10, User::getCount());
$this->assertEquals(1, ProductCatalog::getCount());
$this->assertEquals(6, ProductCategory::getCount());
$this->assertEquals(32, ProductTemplate::getCount());
$this->assertEquals(59, Product::getCount());
}
示例13: __construct
/**
* This is construct base of the class.
*
* A public constructor; initializes the variable $instanceDataBase.
*
*/
public function __construct($instanceDataBase)
{
parent::__construct($instanceDataBase);
Note::setDataOperationBusiness($instanceDataBase);
Note::getBusiness();
Note::getDescriptionBusiness();
}
示例14: createNote
/**
* Create Note and Version instances
*
* $created_at and $updated_at values we have from parsed xml
*
* @param $title
* @param $content
* @param $created_at
* @param $updated_at
* @return \Note
*/
protected function createNote($title, $content, $created_at, $updated_at)
{
$noteCreate = new \Note();
$noteCreate->created_at = $created_at;
$noteCreate->updated_at = $updated_at;
// Add spaces for strip_tags
$contentPreview = preg_replace('/(<[^>]+>)/', '$1 ', $content);
$contentPreview = strip_tags($contentPreview);
$versionCreate = new \Version(['title' => $title, 'content' => $content, 'content_preview' => mb_substr($contentPreview, 0, 255), 'created_at' => $created_at, 'updated_at' => $updated_at, 'user_id' => \Auth::user()->id]);
$versionCreate->save();
$noteCreate->version()->associate($versionCreate);
$noteCreate->notebook_id = $this->notebook->id;
$noteCreate->save();
$noteCreate->users()->attach(\Auth::user()->id, array('umask' => \PaperworkHelpers::UMASK_OWNER));
return $noteCreate;
}
示例15: ArticleNote
/**
* Constructor.
*/
function ArticleNote()
{
if (Config::getVar('debug', 'deprecation_warnings')) {
trigger_error('Deprecated class ArticleNote. Use Note instead');
}
parent::Note();
}