/** * Show a form for editing an entry * * @return void */ public function editTask() { // Check if they're logged in if (User::isGuest()) { $this->loginTask(); return; } // Check if admin $isAdmin = false; if (User::authorise('core.manage', $this->_option)) { $isAdmin = true; } // are we allowing user to add citation $allowImport = $this->config->get('citation_import', 1); if ($allowImport == 0 || $allowImport == 2 && User::get('usertype') == 'Super Administrator') { // Redirect App::redirect(Route::url('index.php?option=' . $this->_option, false), Lang::txt('COM_CITATION_EDIT_NOTALLOWED'), 'warning'); return; } // get the citation types $ct = new Type($this->database); $types = $ct->getType(); $fields = array(); foreach ($types as $type) { if (isset($type['fields'])) { $f = $type['fields']; if (strpos($f, ',') !== false) { $f = str_replace(',', "\n", $f); } $f = array_map('trim', explode("\n", $f)); $f = array_values(array_filter($f)); $fields[strtolower(str_replace(' ', '', $type['type_title']))] = $f; } } // add an empty value for the first type array_unshift($types, array('type' => '', 'type_title' => ' - Select a Type —')); // Incoming - expecting an array id[]=4232 $id = Request::getInt('id', 0); // Pub author $pubAuthor = false; // Load the associations object $assoc = new Association($this->database); // Get associations if ($id) { $this->view->assocs = $assoc->getRecords(array('cid' => $id), $isAdmin); $pubAuthor = $this->isPubAuthor($this->view->assocs); } // Is user authorized to edit citations? if (!$isAdmin && !$pubAuthor) { $id = 0; } // Load the object $this->view->row = new Citation($this->database); $this->view->row->load($id); //make sure title isnt too long $maxTitleLength = 30; $shortenedTitle = strlen($this->view->row->title) > $maxTitleLength ? substr($this->view->row->title, 0, $maxTitleLength) . '…' : $this->view->row->title; // Set the pathway Pathway::append(Lang::txt(strtoupper($this->_option)), 'index.php?option=' . $this->_option); if ($id && $id != 0) { Pathway::append($shortenedTitle, 'index.php?option=' . $this->_option . '&task=view&id=' . $this->view->row->id); } Pathway::append(Lang::txt('COM_CITATIONS_EDIT'), 'index.php?option=' . $this->_option . '&task=edit&id=' . $this->view->row->id); // Set the page title Document::setTitle(Lang::txt('COM_CITATIONS_CITATION') . $shortenedTitle); //push jquery to doc Document::addScriptDeclaration('var fields = ' . json_encode($fields) . ';'); // Instantiate a new view $this->view->title = Lang::txt(strtoupper($this->_option)) . ': ' . Lang::txt(strtoupper($this->_option) . '_' . strtoupper($this->_task)); $this->view->config = $this->config; // No ID, so we're creating a new entry // Set the ID of the creator if (!$id) { $this->view->row->uid = User::get('id'); // It's new - no associations to get $this->view->assocs = array(); //tags & badges $this->view->tags = array(); $this->view->badges = array(); } else { //tags & badges $this->view->tags = Format::citationTags($this->view->row, $this->database, false); $this->view->badges = Format::citationBadges($this->view->row, $this->database, false); } //get the citation types $ct = new Type($this->database); $this->view->types = $ct->getType(); // Output HTML foreach ($this->getErrors() as $error) { $this->view->setError($error); } $this->view->setLayout('edit')->display(); }
/** * Output a citation's OpenURL * * @param array $openurl OpenURL data * @param object $citation Citation * @return string HTML */ public static function citationOpenUrl($openurl, $citation) { $html = ""; $database = \App::get('db'); $text = $openurl['text']; $icon = $openurl['icon']; $link = $openurl['link']; $query = array(); // citation type $citation_type = new Type($database); $citation_type->load($citation->type); // do we have a title if (isset($citation->title) && $citation->title != '') { if ($citation_type->type == 'journal') { $query[] = 'atitle=' . str_replace(' ', '+', $citation->title); $query[] = 'title=' . str_replace(' ', '+', $citation->journal); } else { $query[] = 'title=' . str_replace(' ', '+', $citation->title); } } // do we have a doi to append? if (isset($citation->doi) && $citation->doi != '') { $query[] = 'doi=' . $citation->doi; } // do we have an issn or isbn to append? if (isset($citation->isbn) && trim($citation->isbn) != '') { // get the issn/isbn in db $issn_isbn = trim($citation->isbn); // check to see if we need to do any special processing to the issn/isbn before outputting if (strstr($issn_isbn, "\r\n")) { $issn_isbn = array_filter(array_values(explode("\r\n", $issn_isbn))); $issn_isbn = isset($issn_isbn[0]) ? preg_replace("/[^0-9\\-]/", '', $issn_isbn[0]) : ''; } elseif (strstr($issn_isbn, ' ')) { $issn_isbn = array_filter(array_values(explode(' ', $issn_isbn))); $issn_isbn = isset($issn_isbn[0]) ? preg_replace("/[^0-9\\-]/", '', $issn_isbn[0]) : ''; } // append to url as issn if journal otherwise as isbn if ($citation_type->type == 'journal') { $query[] = 'issn=' . $issn_isbn; } else { $query[] = 'isbn=' . $issn_isbn; } } // do we have a date/year to append? if (isset($citation->year) && $citation->year != '') { $query[] = 'date=' . $citation->year; } // to we have an issue/number to append? if (isset($citation->number) && $citation->number != '') { $query[] = 'issue=' . $citation->number; } // do we have a volume to append? if (isset($citation->volume) && $citation->volume != '') { $query[] = 'volume=' . $citation->volume; } // do we have pages to append? if (isset($citation->pages) && $citation->pages != '') { $query[] = 'pages=' . $citation->pages; } // do we have a link with some data to send to resolver? if (count($query) > 0) { // checks for already-appended ? if (substr($link, -1, 1) != "?") { $link .= "?"; } //add parts to url $link .= implode("&", $query); // do we have an icon or just using text as the link $link_text = $icon != '' ? '<img src="index.php?option=com_citations&controller=citations&task=downloadimage&image=' . $icon . '" />' : $text; // final link $html .= '<a rel="external nofollow" href="' . $link . '" title="' . $text . '">' . $link_text . '</a>'; } return $html; }
/** * Edit a citation * * @return void */ public function editTask() { //stop menu from working? Request::setVar('hidemainmenu', 1); //get request vars - expecting an array id[]=4232 $id = Request::getVar('id', array()); if (is_array($id)) { $id = !empty($id) ? $id[0] : 0; } //get all citations sponsors $cs = new Sponsor($this->database); $this->view->sponsors = $cs->getSponsor(); //get all citation types $ct = new Type($this->database); $this->view->types = $ct->getType(); //empty citation object $this->view->row = new Citation($this->database); //if we have an id load that citation data if (isset($id) && $id != '' && $id != 0) { // Load the citation object $this->view->row->load($id); // Get the associations $assoc = new Association($this->database); $this->view->assocs = $assoc->getRecords(array('cid' => $id)); //get sponsors for citation $this->view->row_sponsors = $cs->getCitationSponsor($this->view->row->id); //get the citations tags $this->view->tags = Format::citationTags($this->view->row, \App::get('db'), false); //get the badges $this->view->badges = Format::citationBadges($this->view->row, \App::get('db'), false); //parse citation params $this->view->params = new Registry($this->view->row->params); } else { //set the creator $this->view->row->uid = User::get('id'); // It's new - no associations to get $this->view->assocs = array(); //array of sponsors - empty $this->view->row_sponsors = array(); //empty tags and badges arrays $this->view->tags = array(); $this->view->badges = array(); //empty params object $this->view->params = new Registry(''); } //are we padding back the citation data if (isset($this->row)) { $this->view->row = $this->row; } //are we passing back the tags from edit if ($this->tags != '') { $this->tags = explode(',', $this->tags); foreach ($this->tags as $tag) { $this->view->tags[]['raw_tag'] = $tag; } } //are we passing back the tags from edit if ($this->badges != '') { $this->badges = explode(',', $this->badges); foreach ($this->badges as $badge) { $this->view->badges[]['raw_tag'] = $badge; } } // Set any errors if ($this->getError()) { $this->view->setError($this->getError()); } //set vars for view $this->view->config = $this->config; // Output the HTML $this->view->setLayout('edit')->display(); }
/** * Get a list of citations requiring attention * * @param array $action_attention * @param array $action_no_attention * @return array */ public function process($action_attention = array(), $action_no_attention = array()) { $results = array('saved' => array(), 'not_saved' => array(), 'error' => array()); $now = with(new Date('now'))->toSql(); $user = $this->get('user'); $scope = $this->get('scope'); $scope_id = $this->get('scope_id'); $published = $this->get('published', null); // loop through each citation that required attention from user if ($cites_require_attention = $this->readRequiresAttention()) { foreach ($cites_require_attention as $k => $cra) { $cc = new Tables\Citation($this->database); // add a couple of needed keys $cra['uid'] = $user; $cra['created'] = $now; // reset tags and badges $tags = ''; $badges = ''; // remove errors unset($cra['errors']); // if tags were sent over if (array_key_exists('tags', $cra)) { $tags = $cra['tags']; unset($cra['tags']); } // if badges were sent over if (array_key_exists('badges', $cra)) { $badges = $cra['badges']; unset($cra['badges']); } //take care fo type $ct = new Tables\Type($this->database); $types = $ct->getType(); $type = ''; foreach ($types as $t) { if (strtolower($t['type_title']) == strtolower($cra['type'])) { $type = $t['id']; } } $cra['type'] = $type ? $type : '1'; switch ($action_attention[$k]) { case 'overwrite': $cra['id'] = $cra['duplicate']; break; case 'both': break; case 'discard': $results['not_saved'][] = $cra; continue 2; break; } // remove duplicate flag unset($cra['duplicate']); //sets group if set if ($scope) { $cra['scope'] = $scope; } if ($scope_id) { $cra['scope_id'] = $scope_id; } if (!is_null($published)) { $cra['published'] = $published; } // save the citation if (!$cc->save($cra)) { $results['error'][] = $cra; } else { // tags if ($this->tags && isset($tags)) { $this->tag($user, $cc->id, $tags, ''); } // badges if ($this->badges && isset($badges)) { $this->tag($user, $cc->id, $badges, 'badge'); } // add the citattion to the saved $results['saved'][] = $cc->id; } } } if ($cites_require_no_attention = $this->readRequiresNoAttention()) { foreach ($cites_require_no_attention as $k => $crna) { // new citation object $cc = new Tables\Citation($this->database); // add a couple of needed keys $crna['uid'] = $user; $crna['created'] = $now; // reset tags and badges $tags = ''; $badges = ''; // remove errors unset($crna['errors']); // if tags were sent over if (array_key_exists('tags', $crna)) { $tags = $crna['tags']; unset($crna['tags']); } // if badges were sent over if (array_key_exists('badges', $crna)) { $badges = $crna['badges']; unset($crna['badges']); } // verify we haad this one checked to be submitted if ($action_no_attention[$k] != 1) { $results['not_saved'][] = $crna; continue; } // take care fo type $ct = new Tables\Type($this->database); $types = $ct->getType(); $type = ''; foreach ($types as $t) { // TODO: undefined index type? I just suppressed the error b/c I'm not sure what the logic is supposed to be /SS if (strtolower($t['type_title']) == strtolower($crna['type'])) { $type = $t['id']; } } $crna['type'] = $type ? $type : '1'; // remove duplicate flag unset($crna['duplicate']); // sets group if set if ($scope) { $crna['scope'] = $scope; } if ($scope_id) { $crna['scope_id'] = $scope_id; } if (!is_null($published)) { $crna['published'] = $published; } // save the citation if (!$cc->save($crna)) { $results['error'][] = $crna; } else { // tags if ($this->tags && isset($tags)) { $this->tag($user, $cc->id, $tags, ''); } // badges if ($this->badges && isset($badges)) { $this->tag($user, $cc->id, $badges, 'badge'); } // add the citattion to the saved $results['saved'][] = $cc->id; } } } $this->cleanup(); return $results; }
/** * Format the file * * @param object $row Record to format * @return string */ public function format($row) { //get fields to not include for all citations $config = \Component::params('com_citations'); $exclude = $config->get('citation_download_exclude', ''); if (strpos($exclude, ",") !== false) { $exclude = str_replace(',', "\n", $exclude); } $exclude = array_values(array_filter(array_map('trim', explode("\n", $exclude)))); //get fields to not include for specific citation $cparams = new \Hubzero\Config\Registry($row->params); $citation_exclude = $cparams->get('exclude', ''); if (strpos($citation_exclude, ',') !== false) { $citation_exclude = str_replace(',', "\n", $citation_exclude); } $citation_exclude = array_values(array_filter(array_map('trim', explode("\n", $citation_exclude)))); //merge overall exclude and specific exclude $exclude = array_values(array_unique(array_merge($exclude, $citation_exclude))); //var to hold document conetnt $doc = ''; //get all the citation types $db = \App::get('db'); $ct = new Type($db); $types = $ct->getType(); $type = ''; foreach ($types as $t) { if ($t['id'] == $row->type) { $type = $t['type_title']; } } //set the type to generic if we dont have one $type = $type != '' ? $type : 'Generic'; //set the type $doc .= "%0 {$type}" . "\r\n"; if ($row->booktitle && !in_array('booktitle', $exclude)) { $bt = html_entity_decode($row->booktitle); $bt = !preg_match('!\\S!u', $bt) ? utf8_encode($bt) : $bt; $doc .= "%B " . $bt . "\r\n"; } if ($row->journal && !in_array('journal', $exclude)) { $j = html_entity_decode($row->journal); $j = !preg_match('!\\S!u', $j) ? utf8_encode($j) : $j; $doc .= "%J " . $j . "\r\n"; } if ($row->year && !in_array('year', $exclude)) { $doc .= "%D " . trim($row->year) . "\r\n"; } if ($row->title && !in_array('title', $exclude)) { $t = html_entity_decode($row->title); $t = !preg_match('!\\S!u', $t) ? utf8_encode($t) : $t; $doc .= "%T " . $t . "\r\n"; } if (!in_array('authors', $exclude)) { $author = html_entity_decode($row->author); $author = !preg_match('!\\S!u', $author) ? utf8_encode($author) : $author; $author_array = explode(';', stripslashes($author)); foreach ($author_array as $auth) { $auth = preg_replace('/{{(.*?)}}/s', '', $auth); if (!strstr($auth, ',')) { $bits = explode(' ', $auth); $n = array_pop($bits) . ', '; $bits = array_map('trim', $bits); $auth = $n . trim(implode(' ', $bits)); } $doc .= "%A " . trim($auth) . "\r\n"; } } if ($row->address && !in_array('address', $exclude)) { $doc .= "%C " . htmlspecialchars_decode(trim(stripslashes($row->address))) . "\r\n"; } if ($row->editor && !in_array('editor', $exclude)) { $editor = html_entity_decode($row->editor); $editor = !preg_match('!\\S!u', $editor) ? utf8_encode($editor) : $editor; $author_array = explode(';', stripslashes($editor)); foreach ($author_array as $auth) { $doc .= "%E " . trim($auth) . "\r\n"; } } if ($row->publisher && !in_array('publisher', $exclude)) { $p = html_entity_decode($row->publisher); $p = !preg_match('!\\S!u', $p) ? utf8_encode($p) : $p; $doc .= "%I " . $p . "\r\n"; } if ($row->number && !in_array('number', $exclude)) { $doc .= "%N " . trim($row->number) . "\r\n"; } if ($row->pages && !in_array('pages', $exclude)) { $doc .= "%P " . trim($row->pages) . "\r\n"; } if ($row->url && !in_array('url', $exclude)) { $doc .= "%U " . trim($row->url) . "\r\n"; } if ($row->volume && !in_array('volume', $exclude)) { $doc .= "%V " . trim($row->volume) . "\r\n"; } if ($row->note && !in_array('note', $exclude)) { $n = html_entity_decode($row->note); $n = !preg_match('!\\S!u', $n) ? utf8_encode($n) : $n; $doc .= "%Z " . $n . "\r\n"; } if ($row->edition && !in_array('edition', $exclude)) { $doc .= "%7 " . trim($row->edition) . "\r\n"; } if ($row->month && !in_array('month', $exclude)) { $doc .= "%8 " . trim($row->month) . "\r\n"; } if ($row->isbn && !in_array('isbn', $exclude)) { $doc .= "%@ " . trim($row->isbn) . "\r\n"; } if ($row->doi && !in_array('doi', $exclude)) { $doc .= "%1 " . trim($row->doi) . "\r\n"; } if ($row->keywords && !in_array('keywords', $exclude)) { $k = html_entity_decode($row->keywords); $k = !preg_match('!\\S!u', $k) ? utf8_encode($k) : $k; $doc .= "%K " . $k . "\r\n"; } if ($row->research_notes && !in_array('research_notes', $exclude)) { $rn = html_entity_decode($row->research_notes); $rn = !preg_match('!\\S!u', $rn) ? utf8_encode($rn) : $rn; $doc .= "%< " . $rn . "\r\n"; } if ($row->abstract && !in_array('abstract', $exclude)) { $a = html_entity_decode($row->abstract); $a = !preg_match('!\\S!u', $a) ? utf8_encode($a) : $a; $doc .= "%X " . $a . "\r\n"; } if ($row->label && !in_array('label', $exclude)) { $l = html_entity_decode($row->label); $l = !preg_match('!\\S!u', $l) ? utf8_encode($l) : $l; $doc .= "%F " . $label . "\r\n"; } if ($row->language && !in_array('language', $exclude)) { $lan = html_entity_decode($row->language); $lan = !preg_match('!\\S!u', $lan) ? utf8_encode($lan) : $lan; $doc .= "%G " . $lan . "\r\n"; } if ($row->author_address && !in_array('author_address', $exclude)) { $aa = html_entity_decode($row->author_address); $aa = !preg_match('!\\S!u', $aa) ? utf8_encode($aa) : $aa; $doc .= "%+ " . $aa . "\r\n"; } if ($row->accession_number && !in_array('accession_number', $exclude)) { $an = html_entity_decode($row->accession_number); $an = !preg_match('!\\S!u', $an) ? utf8_encode($an) : $an; $doc .= "%M " . trim($an) . "\r\n"; } if ($row->call_number && !in_array('callnumber', $exclude)) { $doc .= "%L " . trim($row->call_number) . "\r\n"; } if ($row->short_title && !in_array('short_title', $exclude)) { $st = html_entity_decode($row->short_title); $st = !preg_match('!\\S!u', $st) ? utf8_encode($st) : $st; $doc .= "%! " . htmlspecialchars_decode(trim($st)) . "\r\n"; } //get the endnote import params //we want to get the endnote key used for importing badges to export them $endnote_import_plugin_params = \Hubzero\Plugin\Plugin::getParams('endnote', 'citation'); $custom_tags = explode("\n", $endnote_import_plugin_params->get('custom_tags')); $citation_endnote_tags = array(); $citation_badges_key = ""; foreach ($custom_tags as $ct) { $citation_endnote_tags[] = explode("-", trim($ct)); } foreach ($citation_endnote_tags as $cet) { if ($cet[0] == 'badges') { $citation_badges_key = $cet[1]; } } //if we found a key to export badges then add to export if (isset($row->badges) && $row->badges && !in_array('badges', $exclude) && $citation_badges_key != '') { $doc .= $citation_badges_key . ' ' . $row->badges; } $doc .= "\r\n"; return $doc; }
/** * Format the file * * @param object $row Record to format * @return string */ public function format($row) { // get fields to not include for all citations $config = \Component::params('com_citations'); $exclude = $config->get('citation_download_exclude', ''); if (strpos($exclude, ',') !== false) { $exclude = str_replace(',', "\n", $exclude); } $exclude = array_values(array_filter(array_map('trim', explode("\n", $exclude)))); //get fields to not include for specific citation $cparams = new \Hubzero\Config\Registry($row->params); $citation_exclude = $cparams->get('exclude', ''); if (strpos($citation_exclude, ',') !== false) { $citation_exclude = str_replace(',', "\n", $citation_exclude); } $citation_exclude = array_values(array_filter(array_map('trim', explode("\n", $citation_exclude)))); //merge overall exclude and specific exclude $exclude = array_values(array_unique(array_merge($exclude, $citation_exclude))); include_once dirname(__DIR__) . DS . 'helpers' . DS . 'BibTex.php'; $bibtex = new \Structures_BibTex(); $addarray = array(); //get all the citation types $db = \App::get('db'); $ct = new Type($db); $types = $ct->getType(); //find the right title $type = ''; foreach ($types as $t) { if ($t['id'] == $row->type) { $type = $t['type']; } } $type = $type != '' ? $type : 'Generic'; if (!$row->cite) { $au = new \Components\Citations\Tables\Author($db); $authors = $au->getRecords(array('cid' => $row->id, 'start' => 0, 'limit' => 1)); foreach ($authors as $author) { $row->cite .= strtolower($author->surname); } $row->cite .= $row->year; $t = preg_replace('/[^a-zA-Z0-9]/', '', strtolower($row->title)); $row->cite .= strlen($t) > 10 ? substr($t, 0, 10) : $t; } $addarray['type'] = $type; $addarray['cite'] = $row->cite; $addarray['title'] = $row->title; $addarray['address'] = $row->address; $auths = explode(';', $row->author); for ($i = 0, $n = count($auths); $i < $n; $i++) { $author = trim($auths[$i]); $author_arr = explode(',', $author); $author_arr = array_map('trim', $author_arr); $addarray['author'][$i]['first'] = isset($author_arr[1]) ? $author_arr[1] : ''; $addarray['author'][$i]['last'] = isset($author_arr[0]) ? $author_arr[0] : ''; $addarray['author'][$i]['first'] = preg_replace('/\\{\\{\\d+\\}\\}/', '', $addarray['author'][$i]['first']); $addarray['author'][$i]['last'] = preg_replace('/\\{\\{\\d+\\}\\}/', '', $addarray['author'][$i]['last']); } $addarray['booktitle'] = $row->booktitle; $addarray['chapter'] = $row->chapter; $addarray['edition'] = $row->edition; $addarray['editor'] = $row->editor; $addarray['eprint'] = $row->eprint; $addarray['howpublished'] = $row->howpublished; $addarray['institution'] = $row->institution; $addarray['journal'] = $row->journal; $addarray['key'] = $row->key; $addarray['location'] = $row->location; $addarray['month'] = $row->month != 0 || $row->month != '0' ? $row->month : ''; $addarray['note'] = $row->note; $addarray['number'] = $row->number; $addarray['organization'] = $row->organization; $addarray['pages'] = $row->pages != 0 || $row->pages != '0' ? $row->pages : ''; $addarray['publisher'] = $row->publisher; $addarray['series'] = $row->series; $addarray['school'] = $row->school; $addarray['url'] = $row->url; $addarray['volume'] = $row->volume; $addarray['year'] = $row->year; if ($row->journal != '') { $addarray['issn'] = $row->isbn; } else { $addarray['isbn'] = $row->isbn; } $addarray['doi'] = $row->doi; $addarray['language'] = $row->language; $addarray['accession_number'] = $row->accession_number; $addarray['short_title'] = html_entity_decode($row->short_title); $addarray['author_address'] = $row->author_address; $addarray['keywords'] = str_replace("\r\n", ', ', $row->keywords); $addarray['abstract'] = $row->abstract; $addarray['call_number'] = $row->call_number; $addarray['label'] = $row->label; $addarray['research_notes'] = $row->research_notes; foreach ($addarray as $k => $v) { if (in_array($k, $exclude)) { unset($addarray[$k]); } } $bibtex->addEntry($addarray); //$file = 'download_'.$id.'.bib'; //$mime = 'application/x-bibtex'; $doc = $bibtex->bibTex(); return $doc; }
/** * Show the results of the import * * @return void */ public function savedTask() { // Get the session object $session = App::get('session'); // Get the citations $citations_saved = $session->get('citations_saved'); $citations_not_saved = $session->get('citations_not_saved'); $citations_error = $session->get('citations_error'); // Check to make sure we have citations if (!$citations_saved && !$citations_not_saved) { App::redirect(Route::url('index.php?option=com_citations&task=import'), Lang::txt('COM_CITATIONS_IMPORT_MISSING_FILE_CONTINUE'), 'error'); return; } // Set the page title $this->_buildTitle(); // Set the pathway $this->_buildPathway(); // Filters for gettiung just previously uploaded $filters = array('start' => 0, 'search' => ''); // Instantiate a new view $this->view->title = Lang::txt(strtoupper($this->_option)) . ': ' . Lang::txt(strtoupper($this->_option) . '_' . strtoupper($this->_task)); $this->view->config = $this->config; $this->view->database = $this->database; $this->view->filters = $filters; $this->view->citations = array(); foreach ($citations_saved as $cs) { $cc = new Citation($this->database); $cc->load($cs); $this->view->citations[] = $cc; } $this->view->openurl['link'] = ''; $this->view->openurl['text'] = ''; $this->view->openurl['icon'] = ''; //take care fo type $ct = new Type($this->database); $this->view->types = $ct->getType(); //get any messages $this->view->messages = Notify::messages('citations'); //display view $this->view->display(); }
/** * Remove one or more types * * @return void */ public function removeTask() { // Check for request forgeries Request::checkToken(); // Incoming (expecting an array) $ids = Request::getVar('id', array()); $ids = !is_array($ids) ? array($ids) : $ids; // Ensure we have an ID to work with if (empty($ids)) { App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), Lang::txt('CITATION_NO_TYPE'), 'error'); return; } $ct = new Type($this->database); foreach ($ids as $id) { // Delete the type $ct->delete($id); } // Redirect App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), Lang::txt('CITATION_TYPE_REMOVED')); }