Ejemplo n.º 1
0
$params = parse_http_args($_POST, array('time', 'miles', 'route', 'date_month', 'date_day', 'date_year', 'publish_to_facebook'));
// If the user has added a run, then handle the form post
if (!empty($params['miles'])) {
    $run = new Run($user, $params);
    if (!$run->save()) {
        echo render_error('Something went wrong while saving the run.');
    } else {
        $success = 'Added a new run!';
        // This will only be true if the checkbox on the previous page was checked
        // The feed_loading div will be killed by JS that runs once the feed form
        // is generated  (since it can sometimes take a second or two)
        if ($params['publish_to_facebook']) {
            register_feed_form_js($run);
            $success .= '<div id="feed_loading">Publishing to Facebook... ' . '<img src="http://static.ak.fbcdn.net/images/upload_progress.gif?0:25923" /></div>';
        }
        echo render_success($success);
    }
}
// Show the basic add run form on the home page
echo '<div class="clearfix">';
echo '<div class="bluebox">';
echo render_add_run_table($user);
echo '</div>';
// Show any runs the user has already added
$runs = $user->getRuns();
if ($runs) {
    echo '<div id="showruns" class="bluebox">';
    $miles = 0;
    foreach ($runs as $run) {
        $miles += $run->miles;
    }
Ejemplo n.º 2
0
    $keywords = $_GET['keywords'];
}
$user_id = $_SESSION[id];
// Calculate pagination information
$cur_page = isset($_GET['page']) ? $_GET['page'] : 1;
$results_per_page = 10;
// number of results per page
$skip = ($cur_page - 1) * $results_per_page;
$total = get_total($keywords, $user_id, $dbc);
$num_pages = ceil($total / $results_per_page);
if (isset($_GET['deleted_file'])) {
    $deleted_file = get_title_by_id($dbc, $_GET['deleted_file']);
    delete_resource($dbc, $db_name, $_GET['deleted_file']);
    //echo '<div class="alert alert-success"><button type="button" class="close" data-dismiss="alert">&times;</button>';
    //echo '文献"' . $deleted_file . '"已被删除!</div>';
    render_success('文献"' . $deleted_file . '"已被删除!');
}
?>
<p></p>
<div class="container">
    <?php 
include_once 'resource_header.php';
?>
    <table class="table table-hover">
        <tbody>
            <tr class="info">
                <td>#</td>
                <td ><strong>创建者</strong></td>
                <td><strong>题名</strong></td>
                <td><strong>类型</strong></td>
                <td><strong>出处</strong></td>