/**
  * delete deletes the given entry
  * 
  * @param int $cid entry-id for calendar
  * @return string html-string
  */
 private function delete()
 {
     // check rights
     if (Rights::check_rights($this->get('cid'), 'calendar')) {
         // check cid and pid given
         if ($this->get('cid') !== false && $this->get('pid') !== false) {
             // check cid and pid exists
             if (Calendar::check_id($this->get('cid')) && Preset::check_preset($this->get('pid'), 'calendar')) {
                 // pagecaption
                 $this->tpl->assign('pagecaption', parent::lang('class.AnnouncementView#page#caption#delete'));
                 // prepare return
                 $return = '';
                 // smarty-templates
                 $sConfirmation = new JudoIntranetSmarty();
                 $form = new HTML_QuickForm2('confirm', 'post', array('name' => 'confirm', 'action' => 'announcement.php?id=delete&cid=' . $this->get('cid') . '&pid=' . $this->get('pid')));
                 // add button
                 $form->addElement('submit', 'yes', array('value' => parent::lang('class.AnnouncementView#delete#form#yes')));
                 // smarty-link
                 $link = array('params' => '', 'href' => 'calendar.php?id=listall', 'title' => parent::lang('class.AnnouncementView#delete#title#cancel'), 'content' => parent::lang('class.AnnouncementView#delete#form#cancel'));
                 $sConfirmation->assign('link', $link);
                 $sConfirmation->assign('spanparams', 'id="cancel"');
                 $sConfirmation->assign('message', parent::lang('class.AnnouncementView#delete#message#confirm'));
                 $sConfirmation->assign('form', $form);
                 // validate
                 if ($form->validate()) {
                     // get calendar-object
                     $calendar = new Calendar($this->get('cid'));
                     // get preset
                     $preset = new Preset($this->get('pid'), 'calendar', $this->get('cid'));
                     // get fields
                     $fields = $preset->get_fields();
                     // delete values of the fields
                     if (Calendar::check_ann_value($calendar->get_id(), $calendar->get_preset_id()) === true) {
                         foreach ($fields as $field) {
                             // delete value
                             $field->delete_value();
                         }
                     }
                     // set preset to 0
                     $calendar->update(array('preset_id' => 0));
                     // smarty
                     $sConfirmation->assign('message', parent::lang('class.AnnouncementView#delete#message#done'));
                     $sConfirmation->assign('form', '');
                     // write entry
                     try {
                         $calendar->write_db('update');
                     } catch (Exception $e) {
                         $GLOBALS['Error']->handle_error($e);
                         $output = $GLOBALS['Error']->to_html($e);
                     }
                 }
                 // smarty return
                 return $sConfirmation->fetch('smarty.confirmation.tpl');
             } else {
                 // error
                 $errno = $GLOBALS['Error']->error_raised('WrongParams', 'entry:cid_or_pid', 'cid_or_pid');
                 $GLOBALS['Error']->handle_error($errno);
                 return $GLOBALS['Error']->to_html($errno);
             }
         } else {
             // error
             $errno = $GLOBALS['Error']->error_raised('MissingParams', 'entry:cid_or_pid', 'cid_or_pid');
             $GLOBALS['Error']->handle_error($errno);
             return $GLOBALS['Error']->to_html($errno);
         }
     } else {
         // error
         $errno = $GLOBALS['Error']->error_raised('NotAuthorized', 'entry:' . $this->get('id'), $this->get('id'));
         $GLOBALS['Error']->handle_error($errno);
         return $GLOBALS['Error']->to_html($errno);
     }
 }