예제 #1
0
function plugin_add($db, $tableid, $id)
{
    global $PHP_SELF, $system_settings;
    $table_desc = get_cell($db, "tableoftables", "table_desc_name", "id", $tableid);
    $tablename = get_cell($db, "tableoftables", "tablename", "id", $tableid);
    $real_tablename = get_cell($db, "tableoftables", "real_tablename", "id", $tableid);
    $journaltable = get_cell($db, $table_desc, "associated_table", "columnname", "journal");
    $r = $db->Execute("SELECT ownerid,title,journal,pubyear,volume,fpage,lpage,author FROM {$real_tablename} WHERE id={$id}");
    $fid = @fopen($system_settings['pdfs_file'], 'w');
    if ($fid) {
        $link = $system_settings['baseURL'] . getenv("SCRIPT_NAME") . "?tablename={$tablename}&showid={$id}";
        $journal = get_cell($db, $journaltable, 'type', 'id', $r->fields['journal']);
        $submitter = get_person_link($db, $r->fields['ownerid']);
        $text = "<a href='{$link}'><b>" . $r->fields['title'];
        $text .= "</b></a> {$journal} (" . $r->fields['pubyear'] . "), <b>" . $r->fields['volume'];
        $text .= "</b>:" . $r->fields['fpage'] . '-' . $r->fields['lpage'];
        $text .= '. ' . $r->fields['author'] . " Submitted by {$submitter}.";
        fwrite($fid, $text);
        fclose($fid);
    }
}
예제 #2
0
function plugin_add($db, $tableid, $id)
{
    global $system_settings;
    $table_desc = get_cell($db, "tableoftables", "table_desc_name", "id", $tableid);
    $tablename = get_cell($db, "tableoftables", "tablename", "id", $tableid);
    $real_tablename = get_cell($db, "tableoftables", "real_tablename", "table_desc_name", $table_desc);
    $authortable = get_cell($db, $table_desc, "associated_table", "columnname", "type2");
    if (!$system_settings["protocols_file"]) {
        return false;
    }
    $r = $db->Execute("SELECT ownerid,title,type1,type2 FROM {$real_tablename} WHERE id={$id}");
    $fid = fopen($system_settings["protocols_file"], w);
    if ($fid) {
        $link = $system_settings["baseURL"] . getenv("SCRIPT_NAME") . "?tablename={$tablename}&showid={$id}";
        $author = get_cell($db, $authortable, "type", "id", $r->fields["type2"]);
        $author .= " " . get_cell($db, $authortable, "typeshort", "id", $r->fields["type2"]);
        $submitter = get_person_link($db, $r->fields["ownerid"]);
        $text = "<a href='{$link}'><b>" . $r->fields["title"] . "</b></a>";
        $text .= ". Written by {$author}.<br> Submitted by {$submitter}.";
        fwrite($fid, $text);
        fclose($fid);
    }
}