add_help_tab( array( 'id' => 'tp_add_publication_help', 'title' => __('Create a new publication','teachpress'), 'content' => '

' . __('Required fields','teachpress') . '

' . __('The required fields for a new publication:','teachpress') . ' ' . __('title, author, bibtex key, tags','teachpress') . '

' . __('URL/Files','teachpress') . '

' . __('You can add one URL or file per line. Insert the name of the URL/file behind the address and separate it by a comma and a space. Example:', 'teachpress') . '
http://mywebsite.com/docs/readme.pdf, Basic Instructions

' ) ); } /** * New publication / edit publication * from show_publications.php (GET): * @param int $pub_id publication ID * @since 5.0.0 */ function tp_add_publication_page() { // WordPress current unser info $current_user = wp_get_current_user(); $user = $current_user->ID; $fields = get_tp_options('teachpress_pub','`setting_id` ASC', ARRAY_A); // form variables from add_publication.php $data = tp_get_default_structure(); $data['bibtex'] = isset( $_POST['bibtex'] ) ? htmlspecialchars($_POST['bibtex']) : ''; $data['type'] = isset( $_POST['type'] ) ? htmlspecialchars($_POST['type']) : ''; $data['award'] = isset( $_POST['award'] ) ? htmlspecialchars($_POST['award']) : ''; $data['title'] = isset( $_POST['tp_post_title'] ) ? htmlspecialchars($_POST['tp_post_title']) : ''; $data['author'] = isset( $_POST['author'] ) ? htmlspecialchars($_POST['author']) : ''; $data['editor'] = isset( $_POST['editor'] ) ? htmlspecialchars($_POST['editor']) : ''; $data['isbn'] = isset( $_POST['isbn'] ) ? htmlspecialchars($_POST['isbn']) : ''; $data['url'] = isset( $_POST['url'] ) ? htmlspecialchars($_POST['url']) : ''; $data['date'] = isset( $_POST['pubdate'] ) ? htmlspecialchars($_POST['pubdate']) : ''; $data['status'] = isset( $_POST['forthcoming'] ) ? 'forthcoming' : 'published'; $data['urldate'] = isset( $_POST['urldate'] ) ? htmlspecialchars($_POST['urldate']) : ''; $data['booktitle'] = isset( $_POST['booktitle'] ) ? htmlspecialchars($_POST['booktitle']) : ''; $data['issuetitle'] = isset( $_POST['issuetitle'] ) ? htmlspecialchars($_POST['issuetitle']) : ''; $data['journal'] = isset( $_POST['journal'] ) ? htmlspecialchars($_POST['journal']) : ''; $data['issue'] = isset( $_POST['issue'] ) ? htmlspecialchars($_POST['issue']) : ''; $data['volume'] = isset( $_POST['volume'] ) ? htmlspecialchars($_POST['volume']) : ''; $data['number'] = isset( $_POST['number'] ) ? htmlspecialchars($_POST['number']) : ''; $data['pages'] = isset( $_POST['pages'] ) ? htmlspecialchars($_POST['pages']) : ''; $data['publisher'] = isset( $_POST['publisher'] ) ? htmlspecialchars($_POST['publisher']) : ''; $data['address'] = isset( $_POST['address'] ) ? htmlspecialchars($_POST['address']) : ''; $data['edition'] = isset( $_POST['edition'] ) ? htmlspecialchars($_POST['edition']) : ''; $data['chapter'] = isset( $_POST['chapter'] ) ? htmlspecialchars($_POST['chapter']) : ''; $data['institution'] = isset( $_POST['institution'] ) ? htmlspecialchars($_POST['institution']) : ''; $data['organization'] = isset( $_POST['organization'] ) ? htmlspecialchars($_POST['organization']) : ''; $data['school'] = isset( $_POST['school'] ) ? htmlspecialchars($_POST['school']) : ''; $data['series'] = isset( $_POST['series'] ) ? htmlspecialchars($_POST['series']) : ''; $data['crossref'] = isset( $_POST['crossref'] ) ? htmlspecialchars($_POST['crossref']) : ''; $data['abstract'] = isset( $_POST['abstract'] ) ? htmlspecialchars($_POST['abstract']) : ''; $data['howpublished'] = isset( $_POST['howpublished'] ) ? htmlspecialchars($_POST['howpublished']) : ''; $data['key'] = isset( $_POST['key'] ) ? htmlspecialchars($_POST['key']) : ''; $data['techtype'] = isset( $_POST['techtype'] ) ? htmlspecialchars($_POST['techtype']) : ''; $data['comment'] = isset( $_POST['comment'] ) ? htmlspecialchars($_POST['comment']) : ''; $data['note'] = isset( $_POST['note'] ) ? htmlspecialchars($_POST['note']) : ''; $data['image_url'] = isset( $_POST['image_url'] ) ? htmlspecialchars($_POST['image_url']) : ''; $data['image_target'] = isset( $_POST['image_target'] ) ? htmlspecialchars($_POST['image_target']) : ''; $data['image_ext'] = isset( $_POST['image_ext'] ) ? htmlspecialchars($_POST['image_ext']) : ''; $data['doi'] = isset( $_POST['doi'] ) ? htmlspecialchars($_POST['doi']) : ''; $data['rel_page'] = isset( $_POST['rel_page'] ) ? intval($_POST['rel_page']) : ''; $data['is_isbn'] = isset( $_POST['is_isbn'] ) ? intval($_POST['is_isbn']) : ''; $tags = isset( $_POST['tags'] ) ? TP_Publication_Page::prepare_tags($_POST['tags']) : ''; $delbox = isset( $_POST['delbox'] ) ? $_POST['delbox'] : ''; $new_bookmarks = isset( $_POST['new_bookmarks'] ) ? $_POST['new_bookmarks'] : ''; $del_bookmarks = isset( $_POST['del_bookmarks'] ) ? $_POST['del_bookmarks'] : ''; // from show_publications.php $pub_id = isset( $_REQUEST['pub_id'] ) ? intval($_REQUEST['pub_id']) : 0; echo '
'; // headline if ( $pub_id === 0 ) { echo '

' . __('Add a new publication','teachpress') . '

'; } else { echo '

' . __('Edit publication','teachpress') . ' ' . __('Create','teachpress') . '

'; } echo '
'; echo wp_nonce_field( 'verify_teachpress_pub_edit', 'tp_nonce', true, false ); // create related content (post/page/...) if ( isset($_POST['create_rel_content']) ) { TP_Publication_Page::check_nonce_field(); $data['rel_page'] = tp_add_publication_as_post( $data['title'], $data['bibtex'], $data['date'], get_tp_option('rel_page_publications'), $tags, array(get_tp_option('rel_content_category')) ); } // create publication and related page if ( isset($_POST['create_pub']) ) { TP_Publication_Page::check_nonce_field(); $pub_id = TP_Publications::add_publication($data, $tags, $new_bookmarks); TP_DB_Helpers::prepare_meta_data($pub_id, $fields, $_POST, 'publications'); $message = __('Publication added','teachpress') . ' ' . __('Add new','teachpress') . ''; get_tp_message($message); } // save publication if ( isset($_POST['speichern']) ) { TP_Publication_Page::check_nonce_field(); TP_Publications::delete_pub_meta($pub_id); TP_Publications::change_publication($pub_id, $data, $tags, $delbox, $new_bookmarks, $del_bookmarks); TP_DB_Helpers::prepare_meta_data($pub_id, $fields, $_POST, 'publications'); get_tp_message( __('Saved') ); } // Default values if ( $pub_id != 0 ) { $pub_data = TP_Publications::get_publication($pub_id, ARRAY_A); $pub_meta = TP_Publications::get_pub_meta($pub_id); } else { $pub_data = tp_get_default_structure(); $pub_meta = array ( array('meta_key' => '', 'meta_value' => '') ); } // Check format of author/editor field if ( $pub_id != 0 && !isset($_POST['create_pub']) ) { $check = ( strpos($pub_data['author'], ',') !== false || strpos($pub_data['editor'], ',') !== false) ? true : false; if ( $check === true ) { get_tp_message( __('Please check the format of author/editor information and correct it to the following format: firstname1 lastname1 and firstname2 lastname 2. Example: Adam Smith and John M. Keynes','teachpress') , 'orange'); } } // input fields echo ''; if ($pub_id != 0) { echo ''; } echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; TP_Publication_Page::get_general_box ($pub_id, $pub_data); TP_Publication_Page::get_main_box ($pub_id, $pub_data); TP_Publication_Page::get_comments_box ($pub_data); if ( count($fields) !== 0 ) { TP_Admin::display_meta_data($fields, $pub_meta); } echo '
'; echo '
'; echo '
'; TP_HTML::div_open('tp_postcontent_right'); TP_Publication_Page::get_publication_box($pub_id); TP_Publication_Page::get_bookmarks_box ($pub_id, $user); TP_Publication_Page::get_tags_box ($pub_id); TP_Publication_Page::get_image_box ($pub_data); TP_Publication_Page::get_rel_page_box ($pub_data); TP_HTML::div_close('tp_postcontent_right'); echo ''; TP_Publication_Page::print_scripts(); echo '
'; } /** * This class contains all funcitons for the add_publication_page * @package teachpress\admin\publications * @since 5.0.0 */ class TP_Publication_Page { public static function get_publication_box($pub_id) { TP_HTML::div_open('postbox'); TP_HTML::line('

' . __('Publications','teachpress') . '

'); // Add, Save, Reset buttons TP_HTML::line('
'); TP_HTML::line('
'); if ( $pub_id === 0 ) { TP_HTML::line(''); TP_HTML::line(''); } else { TP_HTML::line(''); } TP_HTML::line('
'); TP_HTML::line('
'); TP_HTML::div_close('postbox'); } /** * Gets the bookmarks box * @param int $pub_id The ID of the publication * @param int $user The ID of the current user * @since 5.0.0 */ public static function get_bookmarks_box ($pub_id, $user) { TP_HTML::div_open('postbox'); TP_HTML::line('

' . __('Bookmarks','teachpress') . '

'); TP_HTML::div_open('inside'); // Current Bookmarks self::get_current_bookmarks($pub_id, $user); // Add Bookmarks TP_HTML::line('

' . __('New','teachpress') . '

'); TP_HTML::line(''); TP_HTML::div_close('inside'); TP_HTML::div_close('postbox'); } /** * Gets the comment box * @param array $pub_data An associative array with publication data * @since 5.0.0 */ public static function get_comments_box ($pub_data) { TP_HTML::div_open('postbox'); TP_HTML::line('

' . __('Comments','teachpress') . '

'); TP_HTML::div_open('inside'); // comment echo TP_Admin::get_form_field( array( 'name' => 'comment', 'title' => __('A not vissible private comment','teachpress'), 'label' => __('Private comment','teachpress'), 'type' => 'textarea', 'value' => $pub_data['comment'], 'tabindex' => 31, 'display' => 'block', 'style' => 'width:95%; height: 75px;') ); // note echo TP_Admin::get_form_field( array( 'name' => 'note', 'title' => __('Additional information','teachpress'), 'label' => __('Note','teachpress'), 'type' => 'textarea', 'value' => $pub_data['note'], 'tabindex' => 32, 'display' => 'block', 'style' => 'width:95%; height: 75px;') ); TP_HTML::div_close('inside'); TP_HTML::div_close('postbox'); } /** * Gets the current tags of a publication * @param int $pub_id The ID of the publication * @since 5.0.0 * @access private */ private static function get_current_tags ( $pub_id ) { $current_tags = TP_Tags::get_tags( array('pub_id' => $pub_id) ); if ( count ($current_tags) === 0 ) { return; } TP_HTML::line('

' . __('Current','teachpress') . '

'); foreach ($current_tags as $row){ $id = $row->con_id; $label = stripslashes($row->name); $onclick = "teachpress_change_label_color('delbox_" . $id . "', 'delbox_label_" . $id . "')"; TP_HTML::line('
'); } } /** * Prints the current bookmarks list * @param int $pub_id * @param int $current_user_id * @since 8.1.0 * @access private */ private static function get_current_bookmarks ( $pub_id, $current_user_id ) { if ( $pub_id === 0 ) { return; } $bookmarks = TP_Bookmarks::get_bookmarks( array( 'pub_id' => $pub_id, 'output_type' => ARRAY_A ) ); TP_HTML::line('

' . __('Current','teachpress') . '

'); foreach ( $bookmarks as $row ) { $user_info = get_userdata($row['user']); // if there is no data if ($user_info === false) { continue; } // Print use name with checkbox $id = $row['bookmark_id']; $user_id = $user_info->ID; $name = $user_info->display_name; $icon = ( $user_id === $current_user_id ) ? ' ' : ''; $onclick = "teachpress_change_label_color('bookmark_" . $id . "', 'bookmark_label_" . $id . "')"; TP_HTML::line('
'); } } /** * Gets the general box * @param int $pub_id The ID of the publication * @param array $pub_data An associative array with publication data * @since 5.0.0 */ public static function get_general_box ($pub_id, $pub_data){ TP_HTML::div_open('postbox'); TP_HTML::line('

' . __('General information','teachpress') . '

'); TP_HTML::div_open('inside'); TP_HTML::line(''); TP_HTML::line(''); $tabindex = 1; // Publication type TP_HTML::line(''); // BibTex key TP_HTML::line(''); // Award of publication TP_HTML::line(''); TP_HTML::line(''); TP_HTML::line('
'); $title = __('The type of publication','teachpress'); TP_HTML::line('

'); $tabindex++; TP_HTML::line(''); TP_HTML::line('
'); $title = __('A simple unique key without spaces','teachpress'); TP_HTML::line('

'); $tabindex++; TP_HTML::line(''); TP_HTML::line(''); TP_HTML::line('
'); $title = __('Award','teachpress'); TP_HTML::line('

'); $tabindex++; TP_HTML::line(''); TP_HTML::line('
'); // author $tabindex++; echo TP_Admin::get_form_field( array( 'name' => 'author', 'title' => __('The names of the authors, separate by `and`. Example: Mark Twain and Albert Einstein','teachpress'), 'label' => __('Author(s)','teachpress'), 'type' => 'textarea', 'value' => $pub_data['author'], 'tabindex' => $tabindex, 'display' => 'block', 'style' => 'width:95%; height: 65px;') ); // editor $tabindex++; echo TP_Admin::get_form_field( array( 'name' => 'editor', 'title' => __('The names of the editors, separate by `and`. Example: Mark Twain and Albert Einstein','teachpress'), 'label' => __('Editor(s)','teachpress'), 'type' => 'textarea', 'value' => $pub_data['editor'], 'tabindex' => $tabindex, 'display' => 'block', 'style' => 'width:95%; height: 65px;') ); // pubdate $title = __('Date of publishing','teachpress'); $placeholder = __('YYYY-MM-DD','teachpress'); $value = ($pub_id != 0) ? $pub_data["date"] : $placeholder; $checked = ( $pub_data['status'] === 'forthcoming' ) ? 'checked="checked"' : ''; TP_HTML::line('

'); $tabindex++; TP_HTML::line(''); TP_HTML::line(''); TP_HTML::line(''); TP_HTML::div_close('inside'); TP_HTML::div_close('postbox'); } /** * Gets the image box * @param array $pub_data An associative array with publication data * @since 5.0.0 */ public static function get_image_box ($pub_data) { TP_HTML::div_open('postbox'); TP_HTML::line('

' . __('Image','teachpress') . '

'); TP_HTML::div_open('inside'); // Image URL if ( $pub_data["image_url"] != '' ) { TP_HTML::line('

' . $pub_data[

'); } $title = __('With the image field you can add an image to a publication. You can display images in all publication lists','teachpress'); TP_HTML::line('

'); TP_HTML::line(''); TP_HTML::line(''); // Image Link Target TP_HTML::line( '

'); TP_HTML::line( ''); // External Image Link echo TP_Admin::get_form_field( array( 'name' => 'image_ext', 'title' => __('If you choice an external link target for the image, then you can define the URL of this target here.','teachpress'), 'label' => __('External Image Link','teachpress'), 'type' => 'input', 'value' => $pub_data['image_ext'], 'tabindex' => 36, 'display' => 'block', 'style' => 'width:90%;') ); TP_HTML::div_close('inside'); TP_HTML::div_close('postbox'); } /** * Gets the related page box * @param array $pub_data An associative array with publication data * @since 7.1.0 */ public static function get_rel_page_box ($pub_data) { TP_HTML::div_open('postbox'); TP_HTML::line('

' . __('Related content','teachpress') . '

'); TP_HTML::div_open('inside'); TP_HTML::line('

'); TP_HTML::line('
'); // SELECT field TP_HTML::line(''); // New related content link TP_HTML::line('

'); $value = ( get_tp_option('rel_content_auto') == '1' ) ? '1' : '0'; echo TP_Admin::get_checkbox('create_rel_content', __('Create related content','teachpress'), $value); TP_HTML::line('

'); TP_HTML::div_close(); TP_HTML::div_close('inside'); TP_HTML::div_close('postbox'); } /** * Gets the main box * @param int $pub_id The ID of the publication * @param array $pub_data An associative array with publication data * @since 5.0.0 */ public static function get_main_box ($pub_id, $pub_data) { // teachPress Publication Types global $tp_publication_types; $publication_types = $tp_publication_types->get(); if ( isset( $publication_types[ $pub_data['type'] ]['default_fields'] ) ) { $default_fields = $publication_types[ $pub_data['type'] ]['default_fields']; } else { $default_fields = $publication_types['article']['default_fields']; } TP_HTML::div_open('postbox'); TP_HTML::line('

' . __('Detailed information','teachpress') . ' | ' . __('Show all fields','teachpress') . '

'); TP_HTML::div_open('inside'); $tabindex = 8; // booktitle echo TP_Admin::get_form_field( array( 'name' => 'booktitle', 'title' => __('The title of a book','teachpress'), 'label' => __('Booktitle','teachpress'), 'type' => 'textarea', 'value' => $pub_data['booktitle'], 'tabindex' => $tabindex, 'display' => ( in_array('booktitle', $default_fields) ) ? 'block' : 'none', 'style' => 'width:95%; height: 58px;') ); // issuetitle $tabindex++; echo TP_Admin::get_form_field( array( 'name' => 'issuetitle', 'title' => __('The subtitle of a periodical publication','teachpress'), 'label' => __('Issuetitle','teachpress'), 'type' => 'textarea', 'value' => $pub_data['issuetitle'], 'tabindex' => $tabindex, 'display' => ( in_array('issuetitle', $default_fields) ) ? 'block' : 'none', 'style' => 'width:95%; height: 58px;') ); // journal $tabindex++; echo TP_Admin::get_form_field( array( 'name' => 'journal', 'title' => __('The title of a journal','teachpress'), 'label' => __('Journal','teachpress'), 'type' => 'input', 'value' => $pub_data['journal'], 'tabindex' => $tabindex, 'display' => ( in_array('journal', $default_fields) ) ? 'block' : 'none', 'style' => 'width:95%;') ); // volume $tabindex++; echo TP_Admin::get_form_field( array( 'name' => 'volume', 'title' => __('The volume of a journal or book','teachpress'), 'label' => __('Volume','teachpress'), 'type' => 'input', 'value' => $pub_data['volume'], 'tabindex' => $tabindex, 'display' => ( in_array('volume', $default_fields) ) ? 'block' : 'none') ); // volume $tabindex++; echo TP_Admin::get_form_field( array( 'name' => 'issue', 'title' => __('The issue of a journal','teachpress'), 'label' => __('Issue','teachpress'), 'type' => 'input', 'value' => $pub_data['issue'], 'tabindex' => $tabindex, 'display' => ( in_array('issue', $default_fields) ) ? 'block' : 'none') ); // number $tabindex++; echo TP_Admin::get_form_field( array( 'name' => 'number', 'title' => __('The number of a book, journal or work in a series','teachpress'), 'label' => __('Number','teachpress'), 'type' => 'input', 'value' => $pub_data['number'], 'tabindex' => $tabindex, 'display' => ( in_array('number', $default_fields) ) ? 'block' : 'none') ); // pages $tabindex++; echo TP_Admin::get_form_field( array( 'name' => 'pages', 'title' => __('The page you are referring to.','teachpress'), 'label' => __('Pages','teachpress'), 'type' => 'input', 'value' => $pub_data['pages'], 'tabindex' => $tabindex, 'display' => ( in_array('pages', $default_fields) ) ? 'block' : 'none') ); // publisher $tabindex++; echo TP_Admin::get_form_field( array( 'name' => 'publisher', 'title' => __('The names of publisher','teachpress'), 'label' => __('Publisher','teachpress'), 'type' => 'input', 'value' => $pub_data['publisher'], 'tabindex' => $tabindex, 'display' => ( in_array('publisher', $default_fields) ) ? 'block' : 'none', 'style' => 'width:95%;') ); // address $tabindex++; echo TP_Admin::get_form_field( array( 'name' => 'address', 'title' => __('The address of the publisher or the place of confernece','teachpress'), 'label' => __('Address','teachpress'), 'type' => 'input', 'value' => $pub_data['address'], 'tabindex' => $tabindex, 'display' => ( in_array('address', $default_fields) ) ? 'block' : 'none', 'style' => 'width:95%;') ); // edition $tabindex++; echo TP_Admin::get_form_field( array( 'name' => 'edition', 'title' => __('The edition of a book','teachpress'), 'label' => __('Edition','teachpress'), 'type' => 'input', 'value' => $pub_data['edition'], 'tabindex' => $tabindex, 'display' => ( in_array('edition', $default_fields) ) ? 'block' : 'none', 'style' => 'width:95%;') ); // chapter $tabindex++; echo TP_Admin::get_form_field( array( 'name' => 'chapter', 'title' => __('The chapter or the section number','teachpress'), 'label' => __('Chapter','teachpress'), 'type' => 'input', 'value' => $pub_data['chapter'], 'tabindex' => $tabindex, 'display' => ( in_array('chapter', $default_fields) ) ? 'block' : 'none', 'style' => 'width:95%;') ); // institution $tabindex++; echo TP_Admin::get_form_field( array( 'name' => 'institution', 'title' => __('The name of a sponsoring institution','teachpress'), 'label' => __('Institution','teachpress'), 'type' => 'input', 'value' => $pub_data['institution'], 'tabindex' => $tabindex, 'display' => ( in_array('institution', $default_fields) ) ? 'block' : 'none', 'style' => 'width:95%;') ); // organization $tabindex++; echo TP_Admin::get_form_field( array( 'name' => 'organization', 'title' => __('The names of a sponsoring organization','teachpress'), 'label' => __('Organization','teachpress'), 'type' => 'input', 'value' => $pub_data['organization'], 'tabindex' => $tabindex, 'display' => ( in_array('organization', $default_fields) ) ? 'block' : 'none', 'style' => 'width:95%;') ); // school $tabindex++; echo TP_Admin::get_form_field( array( 'name' => 'school', 'title' => __('The names of the academic instituion where a thesis was written','teachpress'), 'label' => __('School','teachpress'), 'type' => 'input', 'value' => $pub_data['school'], 'tabindex' => $tabindex, 'display' => ( in_array('school', $default_fields) ) ? 'block' : 'none', 'style' => 'width:95%;') ); // series $tabindex++; echo TP_Admin::get_form_field( array( 'name' => 'series', 'title' => __('The name of a series','teachpress'), 'label' => __('Series','teachpress'), 'type' => 'input', 'value' => $pub_data['series'], 'tabindex' => $tabindex, 'display' => ( in_array('series', $default_fields) ) ? 'block' : 'none', 'style' => 'width:95%;' ) ); // crossref $tabindex++; echo TP_Admin::get_form_field( array( 'name' => 'crossref', 'title' => __('The BibTeX key this work is referring to','teachpress'), 'label' => __('Crossref','teachpress'), 'type' => 'input', 'value' => $pub_data['crossref'], 'tabindex' => $tabindex, 'display' => ( in_array('crossref', $default_fields) ) ? 'block' : 'none', 'style' => 'width:95%;' ) ); // abstract $tabindex++; echo TP_Admin::get_form_field( array( 'name' => 'abstract', 'title' => __('A short summary of the publication','teachpress'), 'label' => __('Abstract','teachpress'), 'type' => 'textarea', 'value' => $pub_data['abstract'], 'tabindex' => $tabindex, 'display' => 'block', 'style' => 'width:95%; height: 150px;') ); // howpublished $tabindex++; echo TP_Admin::get_form_field( array( 'name' => 'howpublished', 'title' => __('An unusual method for publishing','teachpress'), 'label' => __('Howpublished','teachpress'), 'type' => 'input', 'value' => $pub_data['howpublished'], 'tabindex' => $tabindex, 'display' => ( in_array('howpublished', $default_fields) ) ? 'block' : 'none', 'style' => 'width:95%;') ); // key $tabindex++; echo TP_Admin::get_form_field( array( 'name' => 'key', 'title' => __('If there is no author or editor given, so this field is used for the sorting.','teachpress'), 'label' => __('Key','teachpress'), 'type' => 'input', 'value' => $pub_data['key'], 'tabindex' => $tabindex, 'display' => 'block', 'style' => '') ); // techtype $tabindex++; echo TP_Admin::get_form_field( array( 'name' => 'techtype', 'title' => __('The type of a technical report, thesis, incollection or inbook.','teachpress'), 'label' => __('Type'), 'type' => 'input', 'value' => $pub_data['techtype'], 'tabindex' => $tabindex, 'display' => ( in_array('techtype', $default_fields) ) ? 'block' : 'none', 'style' => '') ); // isbn $checked_1 = ( $pub_data["is_isbn"] == '1' || $pub_id === 0 ) ? 'checked="checked"' : ''; $checked_2 = ($pub_data["is_isbn"] == '0') ? 'checked="checked"' : ''; TP_HTML::div_open('div_isbn'); TP_HTML::line('

'); $tabindex++; TP_HTML::line(''); TP_HTML::line(''); $tabindex++; TP_HTML::line(''); $tabindex++; TP_HTML::line(''); TP_HTML::line(''); TP_HTML::div_close('div_isbn'); // doi $tabindex++; echo TP_Admin::get_form_field( array( 'name' => 'doi', 'title' => __('DOI number','teachpress'), 'label' => __('DOI number','teachpress'), 'type' => 'input', 'value' => $pub_data['doi'], 'tabindex' => $tabindex, 'display' => 'block', 'style' => 'width:95%;') ); // urldate $display = ($pub_data["type"] === 'online' || $pub_data["type"] === 'periodical') ? 'style="display:block;"' : 'style="display:none;"'; $title = __('The date you have visited the online resource','teachpress'); $placeholder = __('YYYY-MM-DD','teachpress'); $value = ($pub_id != 0) ? $pub_data["date"] : $placeholder; TP_HTML::line('
'); TP_HTML::line('

'); $tabindex++; TP_HTML::line(''); TP_HTML::div_close('div_urldate'); // url TP_HTML::div_open('div_url'); TP_HTML::line('

| '); TP_HTML::line(' ' . __('Add/Upload','teachpress') . '

'); TP_HTML::line(''); $tabindex++; TP_HTML::line(''); TP_HTML::div_close('div_url'); TP_HTML::div_close('inside'); TP_HTML::div_close('postbox'); } /** * Gets the tags box * @param int $pub_id The ID of the publication * @since 5.0.0 */ public static function get_tags_box ($pub_id) { TP_HTML::div_open('postbox'); TP_HTML::line('

' . __('Tags') . '

'); TP_HTML::div_open('inside'); if ($pub_id != 0) { TP_Publication_Page::get_current_tags ( $pub_id ); } // New tags field TP_HTML::line('

'); TP_HTML::line(''); TP_HTML::div_close('inside'); TP_HTML::div_close('postbox'); } /** * Convert $tags array to a comma separate string * @param array $tags * @return string */ public static function prepare_tags($tags) { $end = ''; foreach ( $tags as $element ) { $end = ( $end === '' ) ? $element : $end . ',' . $element; } return $end; } /** * Checks the nonce field of the form. If the check fails wp_die() will be executed * @since 9.0.5 */ public static function check_nonce_field () { if ( ! isset( $_POST['tp_nonce'] ) || ! wp_verify_nonce( $_POST['tp_nonce'], 'verify_teachpress_pub_edit' ) ) { wp_die('teachPress error: This request could not be verified!'); exit; } } /** * Gets the javascripts for this page * @since 5.0.0 */ public static function print_scripts () { global $tp_publication_types; $publication_types = $tp_publication_types->get(); ?>