/**
  * Takes care of deletion and storage of the notes
  *
  * @param	array		$cmdArr: An array of submitted commands (through GET/POST) and their values
  * @param	object		&$reference: Reference to the page module
  * @return	void
  * @access private
  */
 function internal_doProcessing($cmdArr, &$reference)
 {
     global $LANG;
     // Delete a note?
     if (intval($cmdArr['deleteNote'])) {
         if ($this->internal_checkWriteAccess(intval($cmdArr['deleteNote']), $reference)) {
             $cmdArray = array();
             $cmdArray['tx_rlmptvnotes_notes'][intval($cmdArr['deleteNote'])]['delete'] = 1;
             // Store:
             $TCEmain = t3lib_div::makeInstance('t3lib_TCEmain');
             $TCEmain->stripslashes_values = 0;
             $TCEmain->start(array(), $cmdArray);
             $TCEmain->process_cmdmap();
         }
     }
     // Create a new note?
     if (intval($cmdArr['newNote'])) {
         $pageInfoArr = t3lib_BEfunc::readPageAccess($reference->id, $reference->perms_clause);
         if ($pageInfoArr['uid'] > 0) {
             // Make sure that no other note exists for this page:
             $noteRecords = t3lib_beFunc::getRecordsByField('tx_rlmptvnotes_notes', 'pid', $reference->id);
             if (count($noteRecords) == 0) {
                 // Configure the TCEmain command array:
                 $dataArr = array();
                 $dataArr['tx_rlmptvnotes_notes']['NEW'] = array('pid' => $reference->id, 'title' => $LANG->getLL('untitled', 0), 'note' => '');
                 // Create the new note:
                 $TCEmain = t3lib_div::makeInstance('t3lib_TCEmain');
                 $TCEmain->stripslashes_values = 0;
                 $TCEmain->start($dataArr, array());
                 $TCEmain->process_datamap();
             }
         }
     }
     // Save a modified note?
     if (intval($cmdArr['saveNote'])) {
         if ($this->internal_checkWriteAccess(intval($cmdArr['saveNote']), $reference)) {
             $postDataArr = t3lib_div::GPvar('tx_rlmptvnotes_data');
             // Configure the TCEmain command array:
             $dataArr = array();
             $dataArr['tx_rlmptvnotes_notes'][intval($cmdArr['saveNote'])] = array('title' => $postDataArr['title'], 'note' => $postDataArr['note']);
             // Update the note:
             $TCEmain = t3lib_div::makeInstance('t3lib_TCEmain');
             $TCEmain->stripslashes_values = 0;
             $TCEmain->start($dataArr, array());
             $TCEmain->process_datamap();
         }
     }
     // Set status to 'read' for specified backend user?
     if (intval($cmdArr['setRead'])) {
         $pageInfoArr = t3lib_BEfunc::readPageAccess($reference->id, $reference->perms_clause);
         if ($pageInfoArr['uid'] > 0) {
             // Read note record and add be user
             $noteRecords = t3lib_beFunc::getRecordsByField('tx_rlmptvnotes_notes', 'pid', $reference->id);
             $beUsersRead = $noteRecords[0]['beusersread'];
             if (is_array($noteRecords) && !t3lib_div::inList($beUsersRead, intval($cmdArr['setRead']))) {
                 // Configure the TCEmain command array:
                 $dataArr = array();
                 $dataArr['tx_rlmptvnotes_notes'][$noteRecords[0]['uid']] = array('beusersread' => (strlen($beUsersRead) ? $beUsersRead . ',' : '') . intval($cmdArr['setRead']));
                 // Create the new note:
                 $TCEmain = t3lib_div::makeInstance('t3lib_TCEmain');
                 $TCEmain->stripslashes_values = 0;
                 $TCEmain->start($dataArr, array());
                 $TCEmain->process_datamap();
             }
         }
     }
 }