Esempio n. 1
0
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'>
    <?php 
echo stripslashes($data['title']);
?>
</div>
<?php 
Esempio n. 2
0
/**
 * Display a DB item (in mode=show).
 *
 * @param int $id The ID of the item to show
 * @param string $display Can be 'compact' or 'default'
 * @return string|null HTML of the single item
 */
function showDB($id, $display = 'default')
{
    global $pdo;
    $sql = "SELECT items.*,\n        items_types.bgcolor,\n        items_types.name\n        FROM items\n        LEFT JOIN items_types ON (items.type = items_types.id)\n        WHERE items.id = :id";
    $req = $pdo->prepare($sql);
    $req->execute(array('id' => $id));
    $item = $req->fetch();
    if ($display === 'compact') {
        // COMPACT MODE //
        ?>
            <section class='item_compact' style='border-left: 6px solid #<?php 
        echo $item['bgcolor'];
        ?>
'>
            <a href='database.php?mode=view&id=<?php 
        echo $item['id'];
        ?>
'>
            <span class='date date_compact'><?php 
        echo $item['date'];
        ?>
</span>
            <h4 style='padding-left:10px;border-right:1px dotted #ccd;color:#<?php 
        echo $item['bgcolor'];
        ?>
'><?php 
        echo $item['name'];
        ?>
 </h4>
            <span style='margin-left:7px'><?php 
        echo stripslashes($item['title']);
        ?>
</span>
        <?php 
        // STAR RATING read only
        show_stars($item['rating']);
        echo "</a></section>";
    } else {
        // NOT COMPACT
        echo "<section class='item' style='border-left: 6px solid #" . $item['bgcolor'] . "'>";
        echo "<a href='database.php?mode=view&id=" . $item['id'] . "'>";
        // show attached if there is a file attached
        if (has_attachement($item['id'], 'items')) {
            echo "<img style='clear:both' class='align_right' src='img/attached.png' alt='file attached' />";
        }
        // STARS
        show_stars($item['rating']);
        echo "<p class='title'>";
        // show lock if item is locked on viewDB
        if ($item['locked'] == 1) {
            echo "<img style='padding-bottom:3px;' src='img/lock-blue.png' alt='lock' />";
        }
        // TITLE
        echo stripslashes($item['title']) . "</p></a>";
        // ITEM TYPE
        echo "<span style='text-transform:uppercase;font-size:80%;padding-left:20px;color:#" . $item['bgcolor'] . "'>" . $item['name'] . " </span>";
        // DATE
        echo "<span class='date' style='padding:0 5px;'><img class='image' src='img/calendar.png' /> " . Tools::formatDate($item['date']) . "</span> ";
        // TAGS
        echo show_tags($id, 'items_tags');
        echo "</section>";
    }
}
Esempio n. 3
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>";
    }
}