![]() |
|---|
| [ Index ] |
Source Code Reference for V1.00 |
[Summary view] [Print] [Text view]
1 <?php /* $Id: do_link_aed.php 40 2008-02-11 12:11:44Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/links/do_link_aed.php $ */ 2 if (!defined('W2P_BASE_DIR')) { 3 die('You should not access this file directly.'); 4 } 5 6 //addnote sql 7 $note_id = intval(w2PgetParam($_POST, 'note_id', 0)); 8 $del = intval(w2PgetParam($_POST, 'del', 0)); 9 10 $obj = new CNote(); 11 if ($note_id) { 12 $obj->_message = 'updated'; 13 } else { 14 $obj->_message = 'added'; 15 } 16 $now = new CDate(); 17 $obj->note_category = intval(w2PgetParam($_POST, 'note_category', 0)); 18 $note_body = stripslashes(w2PgetParam($_POST, 'note_body', 0)); 19 if (!$obj->bind($_POST)) { 20 $AppUI->setMsg($obj->getError(), UI_MSG_ERROR); 21 $AppUI->redirect(); 22 } 23 24 // prepare (and translate) the module name ready for the suffix 25 $AppUI->setMsg('Note'); 26 // delete the note 27 if ($del) { 28 $obj->load($note_id); 29 if (($msg = $obj->delete())) { 30 $AppUI->setMsg($msg, UI_MSG_ERROR); 31 $AppUI->redirect(); 32 } else { 33 $AppUI->setMsg('deleted', UI_MSG_ALERT, true); 34 $AppUI->redirect('m=notebook'); 35 } 36 } 37 38 if (!$note_id) { 39 $obj->note_creator = $AppUI->user_id; 40 $obj->note_created = $now->format(FMT_DATETIME_MYSQL); 41 } else { 42 $obj->note_modified_by = $AppUI->user_id; 43 $obj->note_modified = $now->format(FMT_DATETIME_MYSQL); 44 } 45 46 if ($obj->note_project) { 47 $q = new DBQuery; 48 $q->addTable('projects'); 49 $q->addQuery('project_company'); 50 $q->addWhere('project_id = ' . (int)$obj->note_project); 51 $obj->note_company = $q->loadResult(); 52 } elseif (!$obj->note_company) { 53 $obj->note_company = 0; 54 } 55 56 if (($msg = $obj->store())) { 57 $AppUI->setMsg($msg, UI_MSG_ERROR); 58 } else { 59 $q = new DBQuery; 60 $q->addTable('notes'); 61 $q->addUpdate('note_body', $note_body); 62 $q->addWhere('note_id = ' . $obj->note_id); 63 $q->exec(); 64 $AppUI->setMsg($note_id ? 'updated' : 'added', UI_MSG_OK, true); 65 } 66 67 $AppUI->redirect(); 68 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Fri Jan 9 03:00:02 2009 | Cross-referenced by PHPXref 0.7 |