/**
  * imports a bookmark file into database
  * display status information or report errors messages
  * in case of error
  * @access    public
  */
 function importFile()
 {
     if (!$this->tree->isInTree($this->id)) {
         $this->ctrl->setParameter($this, 'bmf_id', '');
         $this->ctrl->redirect($this);
     }
     if ($_FILES["bkmfile"]["error"] > UPLOAD_ERR_OK) {
         ilUtil::sendFailure($this->lng->txt("import_file_not_valid"));
         $this->newFormBookmark();
         return;
     }
     require_once "./Services/Bookmarks/classes/class.ilBookmarkImportExport.php";
     $objects = ilBookmarkImportExport::_parseFile($_FILES["bkmfile"]['tmp_name']);
     if ($objects === false) {
         ilUtil::sendFailure($this->lng->txt("import_file_not_valid"));
         $this->newFormBookmark();
         return;
     }
     // holds the number of created objects
     $num_create = array('bm' => 0, 'bmf' => 0);
     $this->__importBookmarks($objects, $num_create, $this->id, 0);
     ilUtil::sendSuccess(sprintf($this->lng->txt("bkm_import_ok"), $num_create['bm'], $num_create['bmf']));
     $this->view();
 }
 /**
  * recursive methode generates bookmark output for export
  *
  * @param	array	node date
  * @param	int		depth of recursion
  * @param	bool	true for recursive export
  * @access	private
  */
 function __parseExport($object, $depth = 1, $recursive = true)
 {
     switch ($object['type']) {
         case 'bm':
             $result .= str_repeat("\t", $depth);
             $result .= '<DT><A HREF="' . ilUtil::prepareFormOutput($object['target']) . '" ';
             $result .= 'ADD_DATE="' . intval(0) . '" ';
             $result .= 'LAST_VISIT="' . intval(0) . '" ';
             $result .= 'LAST_MODIFIED="' . intval(0) . '">';
             $result .= ilUtil::prepareFormOutput($object['title']) . '</A>' . "\n";
             if ($object['description']) {
                 $result .= '<DD>' . ilUtil::prepareFormOutput($object['description']) . "\n";
             }
             break;
         case 'bmf':
             $result .= str_repeat("\t", $depth) . '<DT><H3 ADD_DATE="0">' . ilUtil::prepareFormOutput($object['title']) . '</H3>' . "\n";
             if ($object['description']) {
                 $result .= '<DD>' . ilUtil::prepareFormOutput($object['description']) . "\n";
             }
             $result .= str_repeat("\t", $depth) . '<DL><p>' . "\n";
             if ($recursive) {
                 $depth++;
                 $sub_objects = ilBookmarkFolder::getObjects($object['child']);
                 foreach ($sub_objects as $sub_object) {
                     $result .= ilBookmarkImportExport::__parseExport($sub_object, $depth, $recursive);
                 }
                 $depth--;
             }
             $result .= str_repeat("\t", $depth) . '</DL><p>' . "\n";
             break;
     }
     return $result;
 }