Exemplo n.º 1
0
$req->execute(array('id' => $id));
$data = $req->fetch();
?>
<section class="item">
<a class='align_right' href='delete_item.php?id=<?php 
echo $data['id'];
?>
' onClick="return confirm('Delete this item ?');"><img src='themes/<?php 
echo $_SESSION['prefs']['theme'];
?>
/img/trash.png' title='delete' alt='delete' /></a>
<h3 style='color:#<?php 
echo get_item_info_from_id($data['type'], 'bgcolor');
?>
'><?php 
echo get_item_info_from_id($data['type'], 'name');
?>
 </h3>
<?php 
echo "<span class='date'><img src='themes/" . $_SESSION['prefs']['theme'] . "/img/calendar.png' title='date' alt='Date :' />" . $data['date'] . "</span><br />";
show_stars($data['rating']);
// buttons
echo "<a href='database.php?mode=edit&id=" . $data['id'] . "'><img src='themes/" . $_SESSION['prefs']['theme'] . "/img/edit.png' title='edit' alt='edit' /></a> \n<a href='duplicate_item.php?id=" . $data['id'] . "&type=db'><img src='themes/" . $_SESSION['prefs']['theme'] . "/img/duplicate.png' title='duplicate item' alt='duplicate' /></a> \n<a href='make_pdf.php?id=" . $data['id'] . "&type=items'><img src='themes/" . $_SESSION['prefs']['theme'] . "/img/pdf.png' title='make a pdf' alt='pdf' /></a> \n<a href='javascript:window.print()'><img src='themes/" . $_SESSION['prefs']['theme'] . "/img/print.png' title='Print this page' alt='Print' /></a> \n<a href='make_zip.php?id=" . $data['id'] . "&type=items'><img src='themes/" . $_SESSION['prefs']['theme'] . "/img/zip.gif' title='make a zip archive' alt='zip' /></a>\n<a href='experiments.php?mode=show&related=" . $data['id'] . "'><img src='img/related.png' alt='Linked experiments' title='Linked experiments' /></a>";
// TAGS
echo show_tags($id, 'items_tags');
// TITLE : click on it to go to edit mode
?>
<div OnClick="document.location='database.php?mode=edit&id=<?php 
echo $data['id'];
?>
'" class='title'>
Exemplo n.º 2
0
         $link_id[] = $link_data['link_id'];
     }
     $linknb = $link_req->rowCount();
     if ($linknb > 0) {
         $html .= "\n                            <section>\n                            <h3>Linked items :</h3>\n                            <ul>";
         // create url for database
         $url = str_replace('make_zip.php', 'database.php', $url);
         // put links in list with link to the url of item
         for ($j = 0; $j < $linknb; $j++) {
             // get title and type of the item linked
             $sql = "SELECT * FROM items WHERE id = :id";
             $req = $bdd->prepare($sql);
             $req->execute(array('id' => $link_id[$j]));
             $item_infos = $req->fetch();
             $link_title = $item_infos['title'];
             $link_type = get_item_info_from_id($item_infos['type'], 'name');
             $html .= "<li>[" . $link_type . "] - <a href='" . $url . "?mode=view&id=" . $link_id[$j] . "'>" . $link_title . "</a></li>";
         }
         $html .= "\n                            </ul>\n                            </section>";
     }
 }
 // FOOTER
 $html .= "~~~~<br />\n                    <footer>\n                File created with <strong>elabFTW</strong> -- Free open source lab manager<br />\n                <a href='http://www.elabftw.net'>eLabFTW.net</a>\n                    </footer>";
 $html .= "</section></body></html>";
 // CREATE TXT FILE
 // utf8 ftw
 $html = utf8_encode($html);
 // add header for utf-8
 $html = "" . $html;
 $txtfile = 'uploads/export/' . 'elabftw-' . uniqid();
 $tf = fopen($txtfile, 'w+');
Exemplo n.º 3
0
            return false;
        })
    } // end if key is enter
}
// LINKS AUTOCOMPLETE
$(function() {
		var availableLinks = [
<?php 
// get all links for autocomplete
$sql = "SELECT title, id, type FROM items";
$getalllinks = $bdd->prepare($sql);
$getalllinks->execute();
while ($link = $getalllinks->fetch()) {
    // html_entity_decode is needed to convert the quotes
    // str_replace to remove ' because it messes everything up
    $name = get_item_info_from_id($link['type'], 'name');
    echo "'" . $link['id'] . " - " . $name . " - " . str_replace("'", "", html_entity_decode(substr($link[0], 0, 60), ENT_QUOTES)) . "',";
}
?>
		];
		$( "#linkinput" ).autocomplete({
			source: availableLinks
		});
	});
// DELETE LINK
function delete_link(id, item_id) {
    var you_sure = confirm('Delete this link ?');
    if (you_sure == true) {
        var jqxhr = $.post('delete_link.php', {
            id: id,
            item_id : item_id
Exemplo n.º 4
0
function showDB($id, $display)
{
    // Show unique DB item
    global $bdd;
    // SQL to get everything from selected id
    $sql = "SELECT * FROM items WHERE id = :id";
    $req = $bdd->prepare($sql);
    $req->execute(array('id' => $id));
    $final_query = $req->fetch();
    if ($display === 'compact') {
        // COMPACT MODE //
        ?>
            <section class='item'>
            <h4 style='color:#<?php 
        echo get_item_info_from_id($final_query['type'], 'bgcolor');
        ?>
'><?php 
        echo get_item_info_from_id($final_query['type'], 'name');
        ?>
 </h4>
            <span class='date date_compact'><?php 
        echo $final_query['date'];
        ?>
</span>
            <span><?php 
        echo stripslashes($final_query['title']);
        // view link
        echo "<a href='database.php?mode=view&id=" . $final_query['id'] . "'>\n        <img class='align_right' style='margin-left:5px;' src='img/view_compact.png' alt='view' title='view item' /></a>";
        // STAR RATING read only
        show_stars($final_query['rating']);
        echo "</section>";
    } else {
        // NOT COMPACT
        echo "<section class='item'>";
        echo "<h4 style='color:#" . get_item_info_from_id($final_query['type'], 'bgcolor') . "'>" . get_item_info_from_id($final_query['type'], 'name') . " </h4>";
        // TAGS
        echo show_tags($id, 'items_tags');
        // view link
        echo "<a href='database.php?mode=view&id=" . $final_query['id'] . "'>\n        <img class='align_right' style='margin-left:5px;' src='img/view.png' alt='view' title='view item' /></a>";
        // STARS
        show_stars($final_query['rating']);
        // show attached if there is a file attached
        if (has_attachement($final_query['id'])) {
            echo "<img class='align_right' src='themes/" . $_SESSION['prefs']['theme'] . "/img/attached_file.png' alt='file attached' />";
        }
        echo "<p class='title'>" . stripslashes($final_query['title']) . "</p>";
        echo "</section>";
    }
}