Ejemplo n.º 1
0
function page_message()
{
    $message_id = $_GET['message'];
    $message = db_easy("SELECT * FROM `intr_message` WHERE `id`={$message_id}");
    $q_comm = db_query("SELECT * FROM `intr_comments` WHERE `message_id`={$message_id} ORDER BY `date` DESC");
    $user = db_easy("SELECT * FROM `users` WHERE `id`=" . $message['user_id']);
    $edit_del_comment_html = "";
    if (check_group("writer") || $user['name'] == get_user()) {
        $edit_del_message_html .= "<br/><a href='" . uri_make_v1(array("UriScript" => 'intranet.php', 'page' => 'message', 'message' => $message_id, 'edit_message' => 'yes', 'message' => $message['id'])) . "' style='font-size:8pt;'>Редактировать</a>";
        $edit_del_message_html .= "<a href='" . uri_make_v1(array("UriScript" => 'intranet.php', 'page' => 'message', 'message' => $message_id, 'delete_message' => 'yes', 'message' => $message['id'])) . "' style='padding-left:10px;font-size:8pt;' onClick=\"if(!confirm('Удалить?')) return false;\">Удалить</a>";
    }
    $comments_html = "";
    while ($comment = db_fetch($q_comm)) {
        $user = db_easy("SELECT * FROM `users` WHERE `id`={$comment['user_id']}");
        $comments_html .= "<div style='margin:15px 0 0 0;padding:0 0 0 10px;border-left:2px solid #AAA;'>";
        $comments_html .= "<span style='font-size:8pt;font-style:italic;'><b>" . $user['name_rus'] . ",</b> " . date("d.m.Y H:i", strtotime($comment['date'])) . "</span><br/>" . $comment['text'] . "</div>";
        if (check_group("writer") || $user['name'] == get_user()) {
            $comments_html .= "<a href='" . uri_make_v1(array("UriScript" => 'intranet.php', 'page' => 'message', 'message' => $message_id, 'edit_comment' => 'yes', 'comment' => $comment['id'])) . "' style='font-size:8pt;'>Редактировать</a>";
            $comments_html .= "<a href='" . uri_make_v1(array("UriScript" => 'intranet.php', 'page' => 'message', 'message' => $message_id, 'delete_comment' => 'yes', 'comment' => $comment['id'])) . "' style='padding-left:10px;font-size:8pt;' onClick=\"if(!confirm('Удалить?')) return false;\">Удалить</a>";
        }
    }
    $html .= template_get('message/message', array("user" => $user['name_rus'], "date" => date("d.m.Y", strtotime($message['date'])), "title" => $message['title'], "edit_del_message" => $edit_del_message_html, "text" => $message['text'], "uri_back" => uri_make_v1(array("UriScript" => "intranet.php")), "uri_comment" => uri_make_v1(array("UriScript" => "intranet.php", "page" => "message", "message" => $message_id, "add_comment" => "yes")), "comments" => $comments_html));
    //Подключаем подвал
    $html .= template_get('footer');
    return $html;
}
Ejemplo n.º 2
0
function page_index()
{
    $q = db_query("SELECT * FROM `intr_message`");
    $message_html = "";
    if (get_user_group() == "writer") {
        $add_message_html = "<a href='" . uri_make_v1(array("UriScript" => "intranet.php", "add_message" => "yes")) . "' style='padding:0 0 0 10px;'><img src='/_content/img/add-icon.png'/></a>";
    } else {
        $add_message_html = "";
    }
    while ($message = db_fetch($q)) {
        $message_html .= "<a href='" . uri_make_v1(array("UriScript" => "intranet.php", "page" => "message", "message" => $message['id'])) . "'>" . trim($message['title']) . "</a>";
        if (check_group("writer") || $user['name'] == get_user()) {
            //$message_html.="<br/><a href='".uri_make_v1(array("UriScript"=>'intranet.php', 'edit_message'=>'yes', 'message'=>$message['id']))."' style='font-size:8pt;'>Редактировать</a>";
            //$message_html.="<a href='".uri_make_v1(array("UriScript"=>'intranet.php', 'delete_message'=>'yes', 'message'=>$message['id']))."' style='padding-left:10px;font-size:8pt;' onClick=\"if(!confirm('Удалить?')) return false;\">Удалить</a>";
            //$message_html.="<br/><br/>";
            /*$comments_html.="<a href='".uri_make_v1(array("UriScript"=>'intranet.php', 'page'=>'message', 'message'=>$message['id'], 'edit_comment'=>'yes', 'comment'=>$comment['id']))."' style='font-size:8pt;'>Редактировать</a>";
            		$comments_html.="<a href='".uri_make_v1(array("UriScript"=>'intranet.php', 'page'=>'message', 'message'=>$message['id'], 'delete_comment'=>'yes', 'comment'=>$comment['id']))."' style='padding-left:10px;font-size:8pt;' onClick=\"if(!confirm('Удалить?')) return false;\">Удалить</a>";
            		*/
            $message_html .= "<a href='" . uri_make_v1(array("UriScript" => "intranet.php", "edit_message" => "yes", "message" => $message['id'])) . "' style='padding:0 0 0 10px;'><img src='/_content/img/edit-icon.png'/></a>";
            $message_html .= "<a href='" . uri_make_v1(array("UriScript" => "intranet.php", "delete_message" => "yes", "message" => $message['id'])) . "' style='padding:0 0 0 10px;' onClick=\"if(!confirm('Удалить?')) return false;\"><img src='/_content/img/remove-icon.png'/></a>" . "<br/>";
        }
    }
    $contacts_html = "";
    $q = db_query("SELECT * FROM `users`");
    while ($user = db_fetch($q)) {
        $contacts_html .= "<a href='" . uri_make_v1(array("UriScript" => "intranet.php", "page" => "contact", "name" => $user['name'])) . "'>" . $user['name_rus'] . "</a>" . "<br/>";
    }
    $html .= template_get('intranet/intranet', array("add_message" => $add_message_html, "message" => $message_html, "contacts" => $contacts_html));
    //Подключаем подвал
    $html .= template_get('footer');
    return $html;
}