Exemplo n.º 1
0
}
// Display experiment
?>
    <section class="item" style='padding:15px;border-left: 6px solid #<?php 
echo $data['color'];
?>
'>
    <span class='top_right_status'><img src='img/status.png'><?php 
echo $data['name'];
?>
<img src='img/eye.png' alt='eye' /><?php 
echo $visibility;
?>
</span>
<?php 
echo "<span class='date_view'><img src='img/calendar.png' class='bot5px' title='date' alt='Date :' /> " . Tools::formatDate($data['date']) . "</span><br />\n    <a href='experiments.php?mode=edit&id=" . $data['expid'] . "'><img src='img/pen-blue.png' title='edit' alt='edit' /></a>\n<a href='app/duplicate_item.php?id=" . $data['expid'] . "&type=exp'><img src='img/duplicate.png' title='duplicate experiment' alt='duplicate' /></a>\n<a href='make.php?what=pdf&id=" . $data['expid'] . "&type=experiments'><img src='img/pdf.png' title='make a pdf' alt='pdf' /></a>\n<a href='make.php?what=zip&id=" . $data['expid'] . "&type=experiments'><img src='img/zip.png' title='make a zip archive' alt='zip' /></a> ";
// lock
if ($data['locked'] == 0) {
    echo "<a href='app/lock.php?id=" . $data['expid'] . "&action=lock&type=experiments'><img src='img/unlock.png' title='lock experiment' alt='lock' /></a>";
} else {
    // experiment is locked
    echo "<a href='app/lock.php?id=" . $data['expid'] . "&action=unlock&type=experiments'><img src='img/lock-gray.png' title='unlock experiment' alt='unlock' /></a>";
    // show timestamp button if it's not timestamped already
    if ($data['timestamped'] == 0) {
        echo "<a onClick=\"return confirmStamp()\" href='app/timestamp.php?id=" . $data['expid'] . "'><img src='img/stamp.png' title='timestamp experiment' alt='timestamp' /></a>";
    }
}
// TAGS
show_tags($id, 'experiments_tags');
// TITLE : click on it to go to edit mode only if we are not in read only mode
echo "<div ";
Exemplo 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>";
    }
}
Exemplo n.º 3
0
$req->bindParam(':id', $id, PDO::PARAM_INT);
$req->execute();
// got results ?
$row_count = $req->rowCount();
if ($row_count === 0) {
    display_message('error', _('Nothing to show with this ID.'));
    require_once 'inc/footer.php';
    exit;
}
$data = $req->fetch();
?>
<!-- begin item view -->
<section class="box">

<span class='date_view'><img src='img/calendar.png' title='date' alt='Date :' /> <?php 
echo Tools::formatDate($data['date']);
?>
</span><br>
<?php 
show_stars($data['rating']);
// buttons
echo "<a href='database.php?mode=edit&id=" . $data['itemid'] . "'><img src='img/pen-blue.png' title='edit' alt='edit' /></a> \n<a href='app/duplicate_item.php?id=" . $data['itemid'] . "&type=db'><img src='img/duplicate.png' title='duplicate item' alt='duplicate' /></a> \n<a href='make.php?what=pdf&id=" . $data['itemid'] . "&type=items'><img src='img/pdf.png' title='make a pdf' alt='pdf' /></a> \n<a href='make.php?what=zip&id=" . $data['itemid'] . "&type=items'><img src='img/zip.png' title='make a zip archive' alt='zip' /></a>\n<a href='experiments.php?mode=show&related=" . $data['itemid'] . "'><img src='img/link.png' alt='Linked experiments' title='Linked experiments' /></a> ";
// lock
if ($data['locked'] == 0) {
    echo "<a href='app/lock.php?id=" . $data['itemid'] . "&action=lock&type=items'><img src='img/unlock.png' title='lock item' alt='lock' /></a>";
} else {
    // item is locked
    echo "<a href='app/lock.php?id=" . $data['itemid'] . "&action=unlock&type=items'><img src='img/lock-gray.png' title='unlock item' alt='unlock' /></a>";
}
// TAGS
show_tags($id, 'items_tags');
Exemplo n.º 4
0
 public function testFormatDate()
 {
     $this->assertEquals('1969.07.21', \Elabftw\Elabftw\Tools::formatDate('19690721'));
     $this->assertEquals('1969-07-21', \Elabftw\Elabftw\Tools::formatDate('19690721', '-'));
     $this->assertFalse(\Elabftw\Elabftw\Tools::formatDate('196907211'));
 }
Exemplo n.º 5
0
 /**
  * Build HTML content that will be fed to mpdf->WriteHTML()
  */
 private function buildContent()
 {
     $this->addCss();
     $this->content .= "<h1 style='margin-bottom:5px'>" . stripslashes($this->data['title']) . "</h1>\n            Date : " . Tools::formatDate($this->data['date']) . "<br />\n            Tags : <em>" . $this->tags . "</em><br />\n            Made by : " . $this->author . "\n            <hr>" . stripslashes($this->body);
     $this->addLinkedItems();
     $this->addAttachedFiles();
     $this->addComments();
     $this->addElabid();
     $this->addLockinfo();
     $this->addUrl();
     $this->content .= "<footer>PDF generated with <a href='http://www.elabftw.net'>elabftw</a>, a free and open source lab notebook</footer>";
 }