function getSearchResult($num_hit) { if (!isset($this->search_result[$num_hit - 1])) { $this->addError("error", _("Suchergebnis existiert nicht.")); return false; } else { $cat_element = new StudipLitCatElement($this->search_result[$num_hit - 1]); if ($cat_element->isNewEntry()) { array_splice($this->search_result, $num_hit - 1, 1); return false; } else { return $cat_element; } } }
function &GetClonedElement($catalog_id) { $clone = new StudipLitCatElement($catalog_id); $clone->getElementData('new_entry'); return $clone; }
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ require '../lib/bootstrap.php'; ob_start(); page_open(array("sess" => "Seminar_Session", "auth" => "Seminar_Auth", "perm" => "Seminar_Perm", "user" => "Seminar_User")); $perm->check('admin'); include 'lib/seminar_open.php'; // initialise Stud.IP-Session $element = new StudipLitCatElement(); if (Request::quotedArray('_lit_data')) { $_SESSION['_lit_data'] = Request::quotedArray('_lit_data'); } $header = get_object_name($_inst_id, 'inst'); ?> <h1> <?php echo htmlReady(sprintf(_("Literaturliste %s"), $header['type'] . ": " . $header['name'])); ?> </h1> <? if (is_array($_SESSION['_lit_data'])){ foreach ($_SESSION['_lit_data'] as $cid => $data){ $element->setValues($data); if ($element->getValue('catalog_id')){
function importEntries($field_arr, $range_id) { if (is_array($field_arr)) { $catalog_ids = array(); foreach ($field_arr as $fields) { if ($fields["dc_title"] != "") { $litCatElement = new StudipLitCatElement(); $litCatElement->setValues($fields); if ($litCatElement->insertData() > 0) { $cat_element_id = $litCatElement->fields['catalog_id']['value']; array_push($catalog_ids, $cat_element_id); } } } if (count($catalog_ids) > 0) { $lit_list = TreeAbstract::GetInstance("StudipLitList", $range_id); $lit_list_id = md5(uniqid("sdlfhaldfhuizhsdhg", 1)); $fields = array(); $fields["list_id"] = $lit_list_id; $fields["name"] = _("Neue importierte Liste vom") . " " . strftime("%x %X"); $fields["user_id"] = $GLOBALS['user']->id; if ($lit_list->insertList($fields)) { $num_elements = $lit_list->insertElementBulk($catalog_ids, $lit_list_id); if ($num_elements > 0) { $lit_list->init(); $this->num_entries = $num_elements; $this->addError("msg", sprintf(_("Neue Liste mit %s neuen Element(en) erzeugt"), $num_elements)); return TRUE; } else { $this->addError("error", _("Konnte keine Elemente anlegen")); return FALSE; } } else { $this->addError("error", _("Konnte Liste nicht erzeugen")); return FALSE; } } else { $this->addError("error", _("Keine Listeneinträge gefunden")); return FALSE; } } return FALSE; }
function getSearchResult($num_hit) { if (!isset($this->search_result[$num_hit]) && $num_hit <= $this->z_hits) { $this->z_start_range = (int) floor($num_hit / 5) * 5 + 1; $this->doSearch(); } $catalog_id = $this->search_result[$num_hit]['catalog_id'][0] != "_" ? $this->search_result[$num_hit]['catalog_id'] : false; $cat_element = new StudipLitCatElement($catalog_id); if ($cat_element->isNewEntry()) { $cat_element->setValues($this->search_result[$num_hit]); $cat_element->setValue("catalog_id", $this->sess_var_name . "__" . $num_hit); } if ($this->z_id != NULL) { yaz_close($this->z_id); $this->z_id = NULL; } return $cat_element; }
/** * Displays page to add new or edit existing literature element */ public function edit_element_action() { if (Request::option('reload')) { $this->reload = true; } if (Request::option('cmd') == "new_entry") { $_catalog_id = "new_entry"; } else { $_catalog_id = Request::option('_catalog_id', "new_entry"); } if (Request::option('return_range')) { $this->return_range = Request::option('return_range'); URLHelper::addLinkParam('return_range', $this->return_range); } if ($_catalog_id == "new_entry") { $title = _("Literatureintrag anlegen"); } else { $title = _("Literatureintrag bearbeiten"); } PageLayout::setTitle($title); Navigation::activateItem('/tools/literature'); //dump data into db if $_catalog_id points to a search result if ($_catalog_id[0] == "_") { $parts = explode("__", $_catalog_id); if ($fields = $_SESSION[$parts[0]][$parts[1]]) { $cat_element = new StudipLitCatElement(); $cat_element->setValues($fields); $cat_element->setValue("catalog_id", "new_entry"); $cat_element->setValue("user_id", "studip"); if ($existing_element = $cat_element->checkElement()) { $cat_element->setValue('catalog_id', $existing_element); } $cat_element->insertData(); $_catalog_id = $cat_element->getValue("catalog_id"); $_SESSION[$parts[0]][$parts[1]]['catalog_id'] = $_catalog_id; unset($cat_element); } } if (Request::option('cmd') == 'clone_entry') { $_the_element = StudipLitCatElement::GetClonedElement($_catalog_id); if ($_the_element->isNewEntry()) { $_msg = "msg§" . _("Der Eintrag wurde kopiert, Sie können die Daten jetzt ändern.") . "§"; $_msg .= "info§" . _("Der kopierte Eintrag wurde noch nicht gespeichert.") . "§"; //$old_cat_id = $_catalog_id; $_catalog_id = $_the_element->getValue('catalog_id'); } else { $_msg = "error§" . _("Der Eintrag konnte nicht kopiert werden!.") . "§"; } } if (!is_object($_the_element)) { $_the_element = new StudipLitCatElement($_catalog_id, true); } $_the_form = $_the_element->getFormObject(); $_the_clipboard = StudipLitClipBoard::GetInstance(); $_the_clip_form = $_the_clipboard->getFormObject(); if (isset($old_cat_id) && $_the_clipboard->isInClipboard($old_cat_id)) { $_the_clipboard->deleteElement($old_cat_id); $_the_clipboard->insertElement($_catalog_id); } $_the_clip_form->form_fields['clip_cmd']['options'][] = array('name' => _("In Merkliste eintragen"), 'value' => 'ins'); $_the_clip_form->form_fields['clip_cmd']['options'][] = array('name' => _("Markierten Eintrag bearbeiten"), 'value' => 'edit'); if ($_the_form->IsClicked("reset") || Request::option('cmd') == "new_entry") { $_the_form->doFormReset(); } if ($_the_form->IsClicked("delete") && $_catalog_id != "new_entry" && $_the_element->isChangeable()) { if ($_the_element->reference_count) { $_msg = "info§" . sprintf(_("Sie können diesen Eintrag nicht löschen, da er noch in %s Literaturlisten referenziert wird."), $_the_element->reference_count) . "§"; } else { $_msg = "info§" . _("Wollen Sie diesen Eintrag wirklich löschen?") . "<br>" . LinkButton::createAccept(_('Ja'), URLHelper::getURL('?cmd=delete_element&_catalog_id=' . $_catalog_id), array('title' => _('löschen'))) . " " . LinkButton::createCancel(_('Abbrechen'), URLHelper::getURL('?_catalog_id=' . $_catalog_id), array('title' => _('abbrechen'))) . "§"; } } if (Request::option('cmd') == "delete_element" && $_the_element->isChangeable() && !$_the_element->reference_count) { $_the_element->deleteElement(); $this->reload = true; } if (Request::option('cmd') == "in_clipboard" && $_catalog_id != "new_entry") { $_the_clipboard->insertElement($_catalog_id); $this->reload = true; } if (Request::option('cmd') == "check_entry") { $lit_plugin_value = $_the_element->getValue('lit_plugin'); $check_result = StudipLitSearch::CheckZ3950($_the_element->getValue('accession_number')); $content = "<div style=\"font-size:70%\"<b>" . _("Verfügbarkeit in externen Katalogen:") . "</b><br>"; if (is_array($check_result)) { foreach ($check_result as $plugin_name => $ret) { $content .= "<b> " . htmlReady(StudipLitSearch::GetPluginDisplayName($plugin_name)) . " </b>"; if ($ret['found']) { $content .= _("gefunden") . " "; $_the_element->setValue('lit_plugin', $plugin_name); if ($link = $_the_element->getValue("external_link")) { $content .= formatReady(" [" . $_the_element->getValue("lit_plugin_display_name") . "]" . $link); } else { $content .= _("(Kein Link zum Katalog vorhanden.)"); } } elseif (count($ret['error'])) { $content .= '<span style="color:red;">' . htmlReady($ret['error'][0]['msg']) . '</span>'; } else { $content .= _("<u>nicht</u> gefunden") . " "; } $content .= "<br>"; } } $content .= "</div>"; $_the_element->setValue('lit_plugin', $lit_plugin_value); $_msg = "info§" . $content . "§"; } if ($_the_form->IsClicked("send")) { $_the_element->setValuesFromForm(); if ($_the_element->checkValues()) { $_the_element->insertData(); $this->reload = true; } } if ($_the_clip_form->isClicked("clip_ok")) { if ($_the_clip_form->getFormFieldValue("clip_cmd") == "ins" && $_catalog_id != "new_entry") { $_the_clipboard->insertElement($_catalog_id); } if ($_the_clip_form->getFormFieldValue("clip_cmd") == "edit") { $marked = $_the_clip_form->getFormFieldValue("clip_content"); if (count($marked) && $marked[0]) { $_the_element->getElementData($marked[0]); } } $_the_clipboard->doClipCmd(); } $_catalog_id = $_the_element->getValue("catalog_id"); if (!$_the_element->isChangeable()) { PageLayout::postMessage(MessageBox::info(_('Sie haben diesen Eintrag nicht selbst vorgenommen, und dürfen ihn daher nicht verändern! Wenn Sie mit diesem Eintrag arbeiten wollen, können Sie sich eine persönliche Kopie erstellen.'))); } $_msg .= $_the_element->msg; $_msg .= $_the_clipboard->msg; $this->msg = $_msg; $this->catalog_id = $_catalog_id; $this->element = $_the_element; $this->treeview = $_the_treeview; $this->tree = $_the_tree; $this->clipboard = $_the_clipboard; $this->clip_form = $_the_clip_form; $this->form = $_the_form; }