예제 #1
0
 /**
 * If the user requested to save changes, make sure we do that before returning.
 */
 function onSaveEntry()
 {
     $req = $_REQUEST;
     // Did we get an edit request?
     if ($req['labbookEditCmd'] == "Save") {
         $labbook = openLabbook();
         if (isset($req['entryNumber'])) {
             $entryNum = $req['entryNumber'];
             $labbook[$entryNum] = $req['labbookEntry'];
             mpLog("notebook-edit:User modified existing lab notebook entry");
         } else {
             $entryNum = count($labbook);
             $labbook[$entryNum] = $req['labbookEntry'];
             mpLog("notebook-add:User added a new entry to the lab notebook");
         }
         saveLabbook($labbook);
     }
     pageReturn();
 }
예제 #2
0
/**
* Returns the entry number of the new entry.
*/
function addLabbookEntry($title, $text, $model = "", $keywords = "", $thumbnail = null)
{
    $labbook = openLabbook();
    $entry = newLabbookEntry($model, $keywords);
    $entry['title'] = $title;
    $entry['entry'] = $text;
    if ($thumbnail) {
        $entry['thumbnail'] = $thumbnail;
    }
    // else it stays the default
    $entryNum = count($labbook);
    $labbook[$entryNum] = $entry;
    saveLabbook($labbook);
    return $entryNum;
}