Exemple #1
0
function do_lit_import()
{
    global $_range_id;
    $cmd = Request::option('cmd');
    $xmlfile = $_FILES['xmlfile']['tmp_name'];
    $xmlfile_name = $_FILES['xmlfile']['name'];
    $xmlfile_size = $_FILES['xmlfile']['size'];
    $plugin_name = Request::get('plugin_name');
    if ($cmd == "import_lit_list" && $xmlfile) {
        StudipLitImportPluginAbstract::use_lit_import_plugins($xmlfile, $xmlfile_size, $xmlfile_name, $plugin_name, $_range_id);
        //header("Location: $PHP_SELF?_range_id=$_range_id&username=$username&_msg=".urlencode($_msg));
        //wozu dieses???
    }
}
 function StudipLitImportPluginStudipLitList()
 {
     // immer erst den parent-contructor aufrufen!
     parent::StudipLitImportPluginAbstract();
 }
Exemple #3
0
 /**
  * Displays a page for literature list administration.
  */
 public function edit_list_action()
 {
     global $_msg;
     if (Request::option('_range_id') == "self") {
         $this->_range_id = $GLOBALS['user']->id;
     } else {
         if (Request::option('_range_id')) {
             $this->_range_id = Request::option('_range_id');
         } else {
             if (Request::get('admin_inst_id')) {
                 $this->view = 'lit_inst';
                 $this->_range_id = Request::option('admin_inst_id');
             } else {
                 $this->_range_id = $_SESSION['_lit_range'];
             }
         }
     }
     if (!$this->_range_id) {
         $this->_range_id = $GLOBALS['user']->id;
     }
     $_SESSION['_lit_range'] = $this->_range_id;
     require_once "lib/classes/lit_import_plugins/StudipLitImportPluginAbstract.class.php";
     PageLayout::setHelpKeyword("Basis.LiteraturListen");
     PageLayout::setTitle(_("Verwaltung von Literaturlisten"));
     if (Request::option('list') || Request::option('view') || Request::option('view_mode') || $this->_range_id != $GLOBALS['user']->id) {
         Navigation::activateItem('/course/literature/edit');
         $this->_range_id = $_SESSION['SessSemName'][1] ? $_SESSION['SessSemName'][1] : $this->_range_id;
     } else {
         Navigation::activateItem('/tools/literature/edit_list');
         closeObject();
     }
     $_the_treeview = new StudipLitListViewAdmin($this->_range_id);
     $_the_tree =& $_the_treeview->tree;
     //Literaturlisten-Import
     $cmd = Request::option('cmd');
     $xmlfile = $_FILES['xmlfile']['tmp_name'];
     $xmlfile_name = $_FILES['xmlfile']['name'];
     $xmlfile_size = $_FILES['xmlfile']['size'];
     $this->plugin_name = Request::option('plugin_name');
     if ($cmd == "import_lit_list" && $xmlfile) {
         StudipLitImportPluginAbstract::use_lit_import_plugins($xmlfile, $xmlfile_size, $xmlfile_name, $this->plugin_name, $this->_range_id);
     }
     $this->msg = $_msg;
     PageLayout::setTitle($_the_tree->root_name . " - " . PageLayout::getTitle());
     //checking rights
     if ($_the_tree->range_type == "sem" && !$GLOBALS['perm']->have_studip_perm("tutor", $this->_range_id) || ($_the_tree->range_type == "inst" || $_the_tree->range_type == "fak") && !$GLOBALS['perm']->have_studip_perm("autor", $this->_range_id)) {
         throw new AccessDeniedException(_('Keine Berechtigung für diese Literaturliste.'));
     }
     $_the_treeview->parseCommand();
     //always show existing lists
     $_the_treeview->open_ranges['root'] = true;
     //if there are no lists always open root element
     if (!$_the_tree->hasKids('root')) {
         $_the_treeview->open_items['root'] = true;
     }
     $_the_clipboard = StudipLitClipBoard::GetInstance();
     $_the_clip_form =& $_the_clipboard->getFormObject();
     if ($_the_clip_form->isClicked("clip_ok")) {
         $clip_cmd = explode("_", $_the_clip_form->getFormFieldValue("clip_cmd"));
         if ($clip_cmd[0] == "ins") {
             if (is_array($_the_clip_form->getFormFieldValue("clip_content"))) {
                 $inserted = $_the_tree->insertElementBulk($_the_clip_form->getFormFieldValue("clip_content"), $clip_cmd[1]);
                 if ($inserted) {
                     $_the_tree->init();
                     $_the_treeview->open_ranges[$clip_cmd[1]] = true;
                     PageLayout::postMessage(MessageBox::success(sprintf(_("%s Einträge aus Ihrer Merkliste wurden in <b>%s</b> eingetragen."), $inserted, htmlReady($_the_tree->tree_data[$clip_cmd[1]]['name']))));
                 }
             } else {
                 PageLayout::postMessage(MessageBox::info(_("Sie haben keinen Eintrag in Ihrer Merkliste ausgewählt!")));
             }
         }
         $_the_clipboard->doClipCmd();
     }
     if (($this->lists = $_the_tree->getListIds()) && $_the_clipboard->getNumElements()) {
         for ($i = 0; $i < count($this->lists); ++$i) {
             $_the_clip_form->form_fields['clip_cmd']['options'][] = array('name' => my_substr(sprintf(_("In \"%s\" eintragen"), $_the_tree->tree_data[$this->lists[$i]]['name']), 0, 50), 'value' => 'ins_' . $this->lists[$i]);
         }
     }
     $this->msg .= $_the_clipboard->msg;
     if (is_array($_the_treeview->msg)) {
         foreach ($_the_treeview->msg as $t_msg) {
             if (!$this->msg || $this->msg && strpos($t_msg, $this->msg) === false) {
                 $this->msg .= $t_msg . "§";
             }
         }
     }
     $this->lists = $_the_tree->getKids('root');
     if ($this->lists) {
         $this->list_count['visible'] = 0;
         $this->list_count['visible_entries'] = 0;
         $this->list_count['invisible'] = 0;
         $this->list_count['invisible_entries'] = 0;
         for ($i = 0; $i < count($this->lists); ++$i) {
             if ($_the_tree->tree_data[$this->lists[$i]]['visibility']) {
                 ++$this->list_count['visible'];
                 $this->list_count['visible_entries'] += $_the_tree->getNumKids($this->lists[$i]);
             } else {
                 ++$this->list_count['invisible'];
                 $this->list_count['invisible_entries'] += $_the_tree->getNumKids($this->lists[$i]);
             }
         }
     }
     $this->treeview = $_the_treeview;
     $this->tree = $_the_tree;
     $this->clipboard = $_the_clipboard;
     $this->clip_form = $_the_clip_form;
 }