Example #1
0
function task_display_user_tasks($user_id)
{
    echo "<h1>" . _("Tasks") . "</h1>";
    //Button to get to "add new task"-page
    task_display_add_button();
    //List all tasks we are allowed to edit, with edit-button
    $tasks = task_get($user_id);
    if (!empty($tasks)) {
        $category_id = $tasks[0]['task_category_id'];
        echo '<div class="category">';
        echo '<h2>' . $tasks[0]['category_name'] . " " . category_get_edit_button($category_id) . '</h2>';
        echo '<p>' . $tasks[0]['category_description'] . '</p>';
        echo '<div class="row">';
        $i = 0;
        foreach ($tasks as $key => $task) {
            if ($category_id !== $task['task_category_id']) {
                echo '</div>';
                echo '</div>';
                echo '<div class="category">';
                echo '<h2>' . $task['category_name'] . " " . category_get_edit_button($task['task_category_id']) . '</h2>';
                echo '<div class="row">';
                $category_id = $task['task_category_id'];
            }
            if ($i > 0 && $i % 4 == 0) {
                echo '</div><div class="row">';
            }
            echo '<div class="col-md-3 task well">
				<h3>' . $task['name'] . '</h3>
				<p class="author">' . sprintf(_("created by %s"), user_get_link($task['creator'])) . ' ' . date("Y-m-d H:i", strtotime($task['created'])) . '</p>
				<p>' . $task['description'] . '</p>
				<div>
					' . task_get_delete_button($task['id']) . '
					<a href="' . task_edit_url($task['id']) . '" class="btn small helpmarker" title="' . _("Edit this task") . '"><span class="glyphicon glyphicon-edit"></span></a>
				</div>
			</div>';
        }
        echo '</div>';
        echo '</div>';
    }
}
Example #2
0
function comment_display_author_text($comment_id)
{
    $sql = "SELECT user, nick, email, url, added FROM " . PREFIX . "comment WHERE id=" . sql_safe($comment_id) . ";";
    if ($cc = mysql_query($sql)) {
        if ($c = mysql_fetch_assoc($cc)) {
            $comment_time = date("Y-m-d H:i", strtotime($c['added']));
            $comment_link = comment_get_link($comment_id);
            $user_link = NULL;
            if ($c['user'] !== NULL) {
                $user_name = user_get_name($c['user']);
                $user_link = user_get_link($c['user']);
            } else {
                if ($c['nick'] !== NULL) {
                    $user_name = $c['nick'];
                    $user_link = "<a href=\"" . $c['url'] . "\">" . $user_name . "</a>";
                }
            }
            //Kolla om författaren är admin
            if (user_get_admin($c['user']) > 1) {
                $admin = " " . _("(Admin)");
            } else {
                $admin = "";
            }
            if (!isset($user_name)) {
                echo sprintf(_("Posted at <a href=\"%s\">%s</a>"), $comment_link, $comment_time);
            } else {
                if ($user_link == NULL) {
                    echo sprintf(_("Posted by %s%s at <a href=\"%s\">%s</a>"), $user_name, $admin, $comment_link, $comment_time);
                } else {
                    echo sprintf(_("Posted by %s%s at <a href=\"%s\">%s</a>"), $user_link, $admin, $comment_link, $comment_time);
                }
            }
        }
    }
}
Example #3
0
function feedback_get_author_link($feedback_id)
{
    $user_id = feedback_get_user($feedback_id);
    if ($user_id !== NULL) {
        return user_get_link($user_id);
    } else {
        $sql = "SELECT nick, url FROM " . PREFIX . "feedback WHERE id=" . sql_safe($feedback_id) . ";";
        if ($ff = mysql_query($sql)) {
            if ($f = mysql_fetch_array($ff)) {
                if ($f['url'] !== NULL) {
                    return '<a href="' . $f['url'] . '">' . $f['nick'] . '</a>';
                }
                return $f['nick'];
            }
        }
    }
    return NULL;
}
Example #4
0
function privmess_display_outbox($sender_id)
{
    echo '<div class="row">
		<div class="col-xs-12">
			<h1>' . _("Sent messages") . '</h1>';
    //Get all messages
    $sql = "SELECT id, reciever, sent, subject, opened\r\n\t\tFROM " . PREFIX . "privmess \r\n\t\tWHERE sender='" . sql_safe($sender_id) . "'\r\n\t\tORDER BY sent DESC;";
    // echo preprint($sql);
    if ($mm = mysql_query($sql)) {
        $nr = mysql_affected_rows();
        if ($nr > 0) {
            echo '<table class="table table-hover">
				<tr>
					<th>' . _("Receiver") . '</th>
					<th>' . _("Subject") . '</th>
					<th>' . _("Sent") . '</th>
					<th>' . _("Opened") . '</th>
				</tr>';
        } else {
            echo "<p>No messages</p>";
        }
        while ($m = mysql_fetch_array($mm)) {
            // $message_link=SITE_URL."/?p=user&amp;s=privmess&amp;message_id=".$m['id'];
            $message_link = '<a 
								href="#single" 
								aria-controls="single" 
								role="tab" 
								data-toggle="tab"
								onclick="return replace_html_div_inner(\'single\', \'' . SITE_URL . '/operation/privmess_single.php?message_id=' . $m['id'] . '\');">';
            if ($m['opened'] === NULL) {
                echo '<tr class="active">';
            } else {
                echo '<tr>';
            }
            echo '
					<td>' . user_get_link($m['reciever']) . '</td>
					<td>' . $message_link . $m['subject'] . '</a></td>
					<td>' . $message_link . $m['sent'] . '</a></td>
					<td>' . $m['opened'] . '</td>
				</tr>';
        }
        if ($nr > 0) {
            echo '</table>';
        }
    }
    echo '
		</div>
	</div>';
}
</th>
			<td><?php 
echo experiment_get_link($experiment);
?>
</td>
		</tr>
		<?php 
if ($leader) {
    ?>
		<tr>
			<th><?php 
    echo lang('leader');
    ?>
</th>
			<td><?php 
    echo user_get_link($leader);
    ?>
 
				<?php 
    echo ' (' . anchor('participation/edit_leader/' . $participation->id, strtolower(lang('edit'))) . ')';
    ?>
			</td>
		</tr>
		<?php 
}
?>
		<tr>
			<th><?php 
echo lang('risk_group');
?>
</th>
Example #6
0
function user_display_active_users($include_reputation = TRUE)
{
    //ta emot sortering
    if (isset($_GET['sortby'])) {
        if (!strcmp($_GET['sortby'], "name")) {
            $sort = "username";
        } else {
            if (!strcmp($_GET['sortby'], "registered")) {
                $sort = "regdate";
            } else {
                if (!strcmp($_GET['sortby'], "lastlogin")) {
                    $sort = "lastlogin";
                } else {
                    if (!strcmp($_GET['sortby'], "reputation")) {
                        $sort = "reputation";
                    }
                }
            }
        }
    }
    if (!isset($sort)) {
        $sort = "reputation";
    }
    //Sort order
    if (isset($_GET['sortorder'])) {
        if (!strcmp($_GET['sortorder'], "asc")) {
            $sort_order = "asc";
        } else {
            $sort_order = "desc";
        }
    }
    if (!isset($sort_order)) {
        $sort_order = "desc";
    }
    if ($sort_order == "asc") {
        $other_sort_order = "desc";
    } else {
        $other_sort_order = "asc";
    }
    //Visa användarna
    $sql = "select id, username, regdate, lastlogin, reputation from " . PREFIX . "user WHERE inactive IS NULL AND lastlogin IS NOT NULL order by " . $sort . " " . $sort_order . ";";
    // echo "<br />$sql";
    $users = mysql_query($sql);
    echo "<table class=\"table table-striped\">";
    //Rubriker
    echo "<tr>\n\t\t\t<th></th>\n\t\t\t<th><a href=\"" . add_get_to_URL("sortorder", strcmp($sort, "username") ? $sort_order : $other_sort_order, add_get_to_URL("sortby", "name")) . "\">" . _("Name") . "</a></th>";
    if ($include_reputation) {
        echo "\n\t\t\t<th><a href=\"" . add_get_to_URL("sortorder", strcmp($sort, "reputation") ? $sort_order : $other_sort_order, add_get_to_URL("sortby", "reputation")) . "\">" . _("Reputation points") . "</a></th>";
    }
    echo "\n\t\t\t<th><a href=\"" . add_get_to_URL("sortorder", strcmp($sort, "regdate") ? $sort_order : $other_sort_order, add_get_to_URL("sortby", "registered")) . "\">" . _("Registered") . "</a></th>\n\t\t\t<th><a href=\"" . add_get_to_URL("sortorder", strcmp($sort, "lastlogin") ? $sort_order : $other_sort_order, add_get_to_URL("sortby", "lastlogin")) . "\">" . _("Last logged in") . "</a></th>\n\t</tr>";
    for ($i = 1; $u = mysql_fetch_array($users); $i++) {
        echo "<tr>\n\t\t\t\t<td>{$i}</td>\n\t\t\t\t<td>" . user_get_link($u['id']) . "</td>";
        if ($include_reputation) {
            echo "\n\t\t\t\t<td>{$u['reputation']}</td>";
        }
        echo "\n\t\t\t\t<td>" . date("Y-m-d H:i", strtotime($u['regdate'])) . "</td>\n\t\t\t\t<td>" . date("Y-m-d H:i", strtotime($u['lastlogin'])) . "</td>\n\t\t\t</tr>";
    }
    echo "</table>";
}
 /** Returns the get link for a user */
 function user_get_link_by_id($user_id)
 {
     $CI =& get_instance();
     $user = $CI->userModel->get_user_by_id($user_id);
     return user_get_link($user);
 }