<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">notice.php</span>
<?php
include_once "load/load_exon.php";
?>
<html>
<head>
<meta charset="utf-8"/>
<title>标题</title>
<link rel="stylesheet" href="css/exon.css"/>
<link rel="stylesheet" href="css/notice.css"/>
<script src="javascript/jquery-1.11.1.min.js"></script>
<script src="javascript/exon.js"></script>
<script src="javascript/notice.js"></script>
</head>
<body>
<?php
exon_load_header();
include_once "load/load_notice.php";
?>
<div id="notice_main" >
<?php load_add_button();?>
<div id="notice_add_page" style="display:none">
<?php load_notice_add_interface();?>
</div>
<div id="notice_show_all">
<div id="notice_left">
<?php load_notice_left();?>
</div>
<div id="notice_right">
<div id="notice_right_line"></div>
<div id="notice_content" style="display:">
<?php print_right_page("first"); ?>
</div>
</div>
</div>
<div>
<a id="notice_page_back_top" href="#"></a>
</div>
</div>
</body>
</html>
load_notice.php
<?php
session_start();
include_once "cgi.php";
include_once "load_exon.php";
if($_POST["function"] == "print_right_page"){
print_right_page($_POST["ID"]);
} else if(options("insert_notice")){
notice_insert($_POST["Content"],$_POST["Title"],$_POST["Project_ID"]);
}else if($_POST["load_notice_right"] == "load_notice_right"){
print_right_page("first");
}
/*DISCRIPTION
* insert notice
* ARGUMENTS
* $Content notice content
* $Title notice title
* $Project_ID notice project id
* RETURN
* NOTES
*/
function notice_insert($Content, $Title, $Project_ID)
{
// get SQL
$fun_insert_notice = ("insert_notice"
."&Title=".$Title
."&Content=".$Content
."&Project_ID=".$Project_ID);
// insert the recoder
$data_insert = array_cgi($fun_insert_notice);
}
/* DESCRIPTION
* show the button
* ARGUMENTS
* RETURN
* NOTES
*/
function load_add_button()
{
// show the button to currrent user
$Staff_ID = $_SESSION['current_staff_ID'];
$fun_cgi = "staff_project_info&Staff_ID=".$Staff_ID;
$data_project = array_cgi($fun_cgi);
// judge the user is Project Manager
$i = count($data_project);
if($i!=0){
echo " <div id='notice_button_size'>";
echo " <button id='notice_button_add' onclick='add_button()'>+</button>";
echo " </div>";
}
}
/* DESCRIPTION
* Cancel task insert dialog
* ARGUMENTS
* $notice_ID title ID
* RETURN
* NOTES
*/
function print_right_page($notice_ID)
{
// show the first right Content
if($notice_ID == "first"){
// get login person info and notice info
$login_info = array_cgi("login_person_info");
$notice_info = array_cgi("notice_info");
$number = 0;
// get the first notice title content
for($j= count($notice_info)-1;$j>=0;$j--){
$cgi_id = "project_staff_info_by_ID&Project_ID=".$notice_info[$j]["Project_ID"];
// show the first notice info Project_ID = 0
if($notice_info[$j]["Project_ID"] == 0){
$number++;
if($number == 1){
echo " <table id='notice_content_table'>";
echo " <tr><td id='notice_content_title'>{$notice_info[$j]['Title']}</td></tr><tr><td id='notice_content_distance'></td></tr>";
echo " <tr ><td id='notice_content_style'>{$notice_info[$j]['Content']}</td></tr>";
echo " </table>";
return ;
}
}else{
// get login magement person
$staff_ID = array_cgi($cgi_id);
for($i=0; $i< count($staff_ID); $i++){
if($staff_ID[$i]["ID"] == $login_info[0]["ID"]){
$number++;
if($number == 1){
echo " <table id='notice_content_table'>";
echo " <tr><td id='notice_content_title'>{$notice_info[$j]['Title']}</td></tr><tr><td id='notice_content_distance'></td></tr>";
echo " <tr><td id='notice_content_style'>{$notice_info[$j]['Content']}</td></tr> ";
echo " </table>";
return ;
}
}
}
}
}
}
// get click the right content
$fun_notice_info = "notice_content_by_ID&Notice_ID=".$notice_ID;
$data_content = array_cgi($fun_notice_info);
echo " <table id='notice_content_table'>";
echo " <tr ><td id='notice_content_title'>{$data_content[0]['Title']}</td></tr><tr><td id='notice_content_distance'></td><tr>";
echo " <tr><td id='notice_content_style'>{$data_content[0]['Content']}</td></tr> ";
echo " </table>";
return ;
}
/*DISCRIPTION
* load the add interface
* ARGUMENTS
* RETURN
* NOTES
*/
function load_notice_add_interface()
{
// get the data from database
$data = array_cgi("login_person_info");
$Staff_ID = $_SESSION['current_staff_ID'];
$fun_cgi = "staff_project_info&Staff_ID=".$Staff_ID;
$data_project = array_cgi($fun_cgi);
// show the add interface
echo " <table id='notice_add_table_title_content'>
<tr>
<td>公告标题</td>
<td><textarea type='text'placeholder='公告标题,必填' id='notice_add_table_title_block'></textarea></td>
</tr>";
echo " <tr>
<td width='82'>公司公告</td>
<td><textarea type='text'placeholder='公告内容,必填' id='notice_add_table_content_block'></textarea></td>
</tr> ";
echo " </table>";
echo " <table id='notice_add_table_project'>";
echo " <tr>";
echo " <td id='notice_select_project'>选择项目</td> ";
echo " <td ><select id='notice_add_project_td'>";
for($i=0;$i<count($data_project);$i++){
echo " <option value='{$data_project[$i]['ID']}'>{$data_project[$i]['Code']}</option>";
}
echo " </select></td>";
echo " </tr>";
echo " </table>";
echo " <table id='notice_submit'>";
echo " <tr>
<td><input id='notice_sure_button' value='确定' type='button'onclick='notice_insert_click()'></td>
<td width='350'></td>
<td><input id='notice_cancle_button' value='取消' type='button'onclick='add_button()'></td>
</tr>";
echo " </table>";
}
/*DISCIPTION
* load the notice left interface
* ARGUMENTS
* RETURN
* NOTES
*/
function load_notice_left()
{
// get projetct_id find the notice people
$cgi_data = "login_person_info";
$login_info = array_cgi($cgi_data);
$func_cgi = "notice_info";
$notice_info = array_cgi($func_cgi);
$Staff_ID = $_SESSION['current_staff_ID'];
$fun_cgi_id = "staff_project_info&Staff_ID=".$Staff_ID;
$data_project = array_cgi($fun_cgi_id);
$select = count($data_project);
// show the notice title and time
echo " <table id='notice_left_table'>";
for($j=count($notice_info)-1;$j>=0;$j--){
$cgi_id = "project_staff_info_by_ID&Project_ID=".$notice_info[$j]["Project_ID"];
if($notice_info[$j]["Project_ID"]==0){
echo " <tr class='notice_title' id={$notice_info[$j]['ID']} onclick='notice_title_click(this,$select)'onmouseover='onmouseover_fun(this.id)'onmouseout='onmouseout_fun(this.id)'>
<td id='noitce_left_title_td'>".$notice_info[$j]['Title']."</td>";
echo " <td id='noitce_left_time_td'>".strtr($notice_info[$j]['Timestamp'],"T"," ")."</td></tr>";
} else {
$staff_ID = array_cgi($cgi_id);
for($i=0;$i< count($staff_ID);$i++){
if($staff_ID[$i]["ID"]==$login_info[0]["ID"]){
echo" <tr onmouseover='onmouseover_fun(this.id)'onmouseout='onmouseout_fun(this.id)' class='notice_title' id={$notice_info[$j]['ID']} onclick='notice_title_click(this,$select)'>
<td id='noitce_left_title_td'>".$notice_info[$j]['Title']."</td>
<td id='noitce_left_time_td'>".strtr($notice_info[$j]['Timestamp'],"T"," ")."</td></tr>";
}
}
}
}
echo" </table>";
}
?>
notice.js
$(function(){
// Exon header click callback
exon_header_initial();
})
/* DESCRIPTION
* windows scrollbars action callback
* ARGUMENTS
* RETURN
* NOTE
*/
window.onscroll=function()
{
var scalltop = document.body.scrollTop || document.documentElement.scrollTop;
if(scalltop>10){
document.getElementById("notice_page_back_top").style.display = "block";
}else {
document.getElementById("notice_page_back_top").style.display = "none";
}
}
/*DISCRIPTION
* mouseover chang title and time background-color
* ARGUMENTS
* obj get title id
* RETURN
* NOTES
*/
function onmouseover_fun(obj)
{
$("#"+obj).css("background-color","rgb(253,245,230)");
}
/*DISCRIPTION
* onmouseout chang title and time background-color
* ARGUMENTS
* obj get title id
* RETURN
* NOTES
*/
function onmouseout_fun(obj)
{
$("#"+obj).css("background-color","#FFFFFF");
}
/*DISCRIPTION
* show the add interface
* ARGUMENTS
* RETURN
* NOTES
*/
function add_button()
{
$("#notice_add_page").slideToggle(600);
}
/*DISCRIPTION
* update notice content
* ARGUMENTS
* RETURN
* NOTES
*/
function update_notice_content()
{
$("#notice_content").load("load/load_notice.php",{"load_notice_right":"load_notice_right"},function(){location.reload();});
}
/*DISCRIPTION
* insert notice
* ARGUMENTS
* RETURN
* NOTES
*/
function notice_insert_click()
{
// check the input
if($("#notice_add_table_title_block").val()==""){
alert("Please input notice title!");
return;
}
else if($("#notice_add_table_content_block").val()==""){
alert("Please input notice content!");
return;
}
// get the input data
var Project_ID = document.getElementById("notice_add_project_td").value;
var notice_title = exon_replace_url_char($("#notice_add_table_title_block").val());
var notice_content = exon_replace_url_char($("#notice_add_table_content_block").val());
// deliver the data
$.ajax({
url:"load/load_notice.php",
type:"POST",
dataType:"html",
async:false,
data:{"label":"insert_notice", "Content":notice_content, "Title":notice_title,"Project_ID":Project_ID},
error: function(xhr, data, error){
alert(error+data);
add_button();
},
success: function(data){
// hide page and update data
add_button();
update_notice_content();
}
});
}
/*DISCRIPTION
* show notice content
* obj get title id
* select get different page
* RETURN
* NOTES
*/
function notice_title_click(obj, select)
{
// get the condition
var notice_height = 0;
var css_display = $("#notice_add_page").css("display");
// get the right line top
if(css_display == "none"){
if(select == 0)
notice_height = $(obj).offset().top-132;
else
notice_height = $(obj).offset().top-194;
} else
notice_height = $(obj).offset().top-568;
// show the right interface
$("#notice_right").css({top:notice_height});
$("#notice_content").load("load/load_notice.php", {"function":"print_right_page", "ID":obj.id});
}
notice.css
#notice_main{
width : 1100px;
min-height :600px;
margin-left : auto;
margin-right : auto;
font-family : Arizl;
}
#notice_button_add{
position : relative;
margin-top : 14px;
left : auto;
background-color : rgba(65,139,202,0.7);
height : 45px;
width : 55px;
left :0px;
color : rgba(255,255,255,1);
border-radius : 6px;
font-size : 50px;
text-align : center;
line-height : 45px;
}
/* add page style
*/
#notice_add_page{
width : 650px;
height : 350px;
position : relative;
margin-top : 20px;
border-style : solid;
border-width : 2px;
border-color : #CAE1FF;
}
#notice_add_table_title_content{
margin-top : 5px;
margin-left : 25px;
margin-right : 25px;
width : 600px;
min-height : 200px;
}
#notice_add_table_project{
position : relative;
float : left;
margin-left : 25px;
min-width : 100px;
min-height : 20px;
}
#notice_add_project_td{
width : 110px;
height : 20px
}
#notice_select_project{
width : 80px;
height : 30px;
}
#notice_add_table_title_block{
border-radius : 3px;
width : 500px;
height : 20px;
border-style : solid;
border-width : 1px;
border-color : #0000ff;
}
#notice_add_table_content_block{
border-radius : 5px;
width : 500px;
height : 100px;
border-style : solid;
border-width : 1px;
border-color : #0000ff;
}
#notice_submit{
margin-top : 60px;
position : relative;
margin-left : 10px;
width : 620px;
}
#notice_sure_button{
margin-top : 8px;
margin-left : 10px;
width : 48px;
height : 33px;
background-color : rgb(66,139,202);
border-radius : 5px;
}
#notice_cancle_button{
margin-top : 8px;
border-radius : 4px;
width : 48px;
height : 33px;
margin-right : 0px;
background-color : rgb(255,48,48);
}
#notice_show_all{
position : relative;
width : 1100px;
margin-top : 10px;
min-height : 800px;
border-top-width : 2px;
border-top-style : solid;
border-color : #CAE1FF;
}
/* left id css
*/
#notice_left{
float : left;
padding-top : 10px;
position : relative;
left : auto;
width : 450px;
min-height : 850px;
margin-top : 0px;
margin-right : 0px;
border-right-width : 3px;
border-right-style : solid;
border-color : #CAE1FF;
}
#notice_left_table{
width : 450px;
cursor : pointer;
border-spacing : 0px;
}
#noitce_left_title_td{
text-indent : 0.9em;
min-width : 273px;
text-align : left;
font-size : 1.1em;
color : #5B5B5B;
border-bottom : 1px dashed #8DB6CD;
}
.notice_title{
width : 450px;
height : 35px;
}
#noitce_left_time_td{
border-left-style : none;
width : 170px;
font-size : 1.0em;
text-align : right;
color : #4D4D4D;
border-bottom : 1px dashed #8DB6CD;
}
/* notice right style
*/
#notice_right{
float : left;
margin-top : 0px;
position : relative;
min-height : 400px;
width : 630px;
display : inline;
}
#notice_right_line{
width : 646px;
margin-top : 10px;
margin-left : 0px;
border-top-width : 3px;
border-top-style : solid;
border-color : #CAE1FF;
}
#notice_content{
width : 631px;
margin-top : 5px;
margin-left : 15px;
position : relative;
min-height : 40px;
border-width : 1px;
border-style : solid;
border-color : rgba(208,206,206,0.3);
color : rgb(89,89,89);
}
#notice_content_table{
width : 631px;
min-height : 30px;
}
#notice_content_title{
min-height : 5px;
font-size : 1.2em;
width : 615px;
text-align : center;
color : #363636;
}
#notice_content_distance{
height : 10px;
}
#notice_content_style{
margin-top : 1px;
font-size : 1em;
width : 610px;
color : #3B3B3B;
}
#notice_button_size{
position : relative;
margin-top: : 1px;
width : 1100px;
min-height : 60px;
margin-left : 0px;
margin-top : 2px;
}
/*notice back top style
*/
#notice_page_back_top{
display : none;
position : fixed;
bottom : 25px;
right : 250px;
width : 66px;
height : 50px;
background-image : url(../image/exon_comeback_top.png);
cursor : pointer;
}