Пример #1
0
 function __construct($user, $type)
 {
     $sqltool = new SQLTool();
     $this->type = $type;
     $user_mail = $sqltool->dbQuery("select email from t_user where user_name='{$user}'");
     $this->user_email = $user_mail[0][0];
 }
Пример #2
0
        //上季度的起止日期
        $season = ceil(date('n') / 3) - 1;
        //上季度是第几季度
        $start_date = date('Y-m-d H:i:s', mktime(0, 0, 0, $season * 3 - 3 + 1, 1, date('Y')));
        $end_date = date('Y-m-d H:i:s', mktime(23, 59, 59, $season * 3, date('t', mktime(0, 0, 0, $season * 3, 1, date("Y"))), date('Y')));
        $title = date('Y/m/d', strtotime($start_date)) . "—" . date('Y/m/d', strtotime($end_date)) . "日 ";
        break;
    case 8:
        $start_date = date('Y-m-d H:i:s', strtotime($_GET['date1']));
        $end_date = date('Y-m-d H:i:s', mktime(23, 59, 59, date('m', strtotime($_GET['date2'])), date('d', strtotime($_GET['date2'])), date('Y', strtotime($_GET['date2']))));
        $title = date('Y/m/d', strtotime($_GET['date1'])) . "—" . date('Y/m/d', strtotime($_GET['date2'])) . "日 ";
        break;
}
$title .= " 请求分类统计";
$sql = " and (req_time >'{$start_date}' and req_time<'{$end_date}')";
$sqltool = new SQLTool();
$res = $sqltool->dbQuery("select sort_name,(select count(*) from t_req where req_sort like  CONCAT('%',t_req_sort.sort_name,'%') {$sql} ) num from t_req_sort where sort_parent_id!='' order by num desc");
for ($i = 0; $i < count($res); $i++) {
    $datay[$i] = $res[$i][1];
    $datax[$i] = $res[$i][0];
}
// Size of graph
$width = 870;
$height = count($res) * 40 + 20;
// Set the basic parameters of the graph
$graph = new Graph($width, $height, 'auto');
$graph->SetScale('textlin');
$graph->setcolor('white');
// Rotate graph 90 degrees and set margin
$graph->Set90AndMargin(120, 20, 30, 10);
// Setup title
Пример #3
0
<?php

/**
 * Created by PhpStorm.
 * User: huzhiming
 * Date: 2015/9/15
 * Time: 19:35
 */
session_start();
date_default_timezone_set('prc');
require_once "../../smarty_include.php";
require_once "../../tools/SQLTool.class.php";
require_once "../../tools/PageTool.class.php";
$user_name = $_SESSION['user_name'];
$sqltool = new SQLTool();
$sql = "select t_req.req_num,req_title,req_author,req_time,assign_time,req_priority,req_effect,req_time_limit from t_req,t_req_assign where req_engineer='{$user_name}' and finish_flag=1 and t_req.req_num = t_req_assign.req_num order by req_priority,req_effect ";
//任务列表
$res = $sqltool->dbQuery($sql);
//计算任务剩余时间
for ($i = 0; $i < count($res); $i++) {
    $t1 = date('Y-m-d H:i:s', time());
    $t1 = strtotime($t1);
    $t2 = strtotime($res[$i]['assign_time']);
    $time = $res[$i]['req_time_limit'] * 3600 - ($t1 - $t2);
    if ($time < 0) {
        $res[$i]['flag'] = 1;
    }
    $time = abs($time);
    $res[$i]['hour'] = floor($time / 3600);
    $res[$i]['minute'] = floor($time % 3600 / 60);
}
Пример #4
0
<?php

/**
 * Created by PhpStorm.
 * User: huzhiming
 * Date: 2015/7/9
 * Time: 16:56
 */
require_once "../../smarty_include.php";
require_once "../../tools/SQLTool.class.php";
require_once "../../model/DepartTree.class.php";
$sqltool = new SQLTool();
$tree = new Tree();
$sql = "select depart_id id,depart_name name,depart_parent_id parent_id from t_depart";
$depart = $sqltool->dbQuery($sql);
$html_tree = $tree->DepartprocHtml($tree->getTree($depart, ''));
$smarty->assign("tree", $html_tree);
$smarty->display("admin/config_depart.html");
Пример #5
0
        //上季度的起止日期
        $season = ceil(date('n') / 3) - 1;
        //上季度是第几季度
        $start_date = date('Y-m-d H:i:s', mktime(0, 0, 0, $season * 3 - 3 + 1, 1, date('Y')));
        $end_date = date('Y-m-d H:i:s', mktime(23, 59, 59, $season * 3, date('t', mktime(0, 0, 0, $season * 3, 1, date("Y"))), date('Y')));
        $title = date('Y/m/d', strtotime($start_date)) . "—" . date('Y/m/d', strtotime($end_date)) . "日 ";
        break;
    case 8:
        $start_date = date('Y-m-d H:i:s', strtotime($_GET['date1']));
        $end_date = date('Y-m-d H:i:s', mktime(23, 59, 59, date('m', strtotime($_GET['date2'])), date('d', strtotime($_GET['date2'])), date('Y', strtotime($_GET['date2']))));
        $title = date('Y/m/d', strtotime($_GET['date1'])) . "—" . date('Y/m/d', strtotime($_GET['date2'])) . "日 ";
        break;
}
$title .= " 工程师工作量排行榜";
$sql = " and (req_finish_time >'{$start_date}' and req_finish_time<'{$end_date}')";
$sqltool = new SQLTool();
$res = $sqltool->dbQuery("select user_name,(select sum(req_complex*0.2+1) from t_req where req_finish_engineer=t_user.user_name {$sql}) num from t_user where user_role=2 order by num desc");
for ($i = 0; $i < count($res); $i++) {
    $datay[$i] = $res[$i][1];
    $datax[$i] = $res[$i][0];
}
// Size of graph
$width = 870;
$height = count($res) * 40 + 20;
// Set the basic parameters of the graph
$graph = new Graph($width, $height, 'auto');
$graph->SetScale('textlin');
$graph->setcolor('white');
// Rotate graph 90 degrees and set margin
$graph->Set90AndMargin(100, 20, 30, 10);
// Setup title
Пример #6
0
<?php

/**
 * Created by PhpStorm.
 * User: huzhiming
 * Date: 2015/9/23
 * Time: 9:51
 */
session_start();
require_once "../smarty_include.php";
require_once "../tools/SQLTool.class.php";
require_once "../tools/FileUtils.php";
$sqltool = new SQLTool();
$fileutil = new FileUtil();
//发布通知
if (isset($_POST['add_news'])) {
    $news_title = $_POST['news_title'];
    $news_content = $_POST['news_content'];
    $attach_id = $_POST['attach_id'];
    $news_author = $_SESSION['user_name'];
    $sql = "insert into t_news(news_title,news_content,attach_id,news_time,news_author) values('{$news_title}','{$news_content}','{$attach_id}',NOW(),'{$news_author}')";
    $res = $sqltool->dbUpdate($sql);
    $res1 = 1;
    if (file_exists(PROJECT_DIR . "/uploadfile/temp/" . $attach_id)) {
        $res1 = $fileutil->moveDir(PROJECT_DIR . "/uploadfile/temp/" . $attach_id, PROJECT_DIR . "/uploadfile/files/news/" . $attach_id);
    }
    if ($res and $res1) {
        echo "<script>alert('通知发布成功!')</script>";
    } else {
        echo "<script>alert('通知发布失败!')</script>";
    }
Пример #7
0
<?php

/**
 * Created by PhpStorm.
 * User: huzhiming
 * Date: 2015/7/1
 * Time: 17:16
 */
require_once "SQLTool.class.php";
require_once "PageTool.class.php";
$sqlTool = new SQLTool();
$res = $sqlTool->dbQuery("select count(*)from emp");
$pageTool = new PageTool($res[0][0], 2);
$pageTool->url = "./pagetest.php";
echo "用户列表:<br><br><br>";
$sql = "select *from emp ";
$pageTool->sql = $sql;
$pageNow = 1;
if ($_GET['pageNow']) {
    $pageNow = $_GET['pageNow'];
}
$res = $pageTool->getPageResource($pageNow);
for ($i = 0; $i < count($res); $i++) {
    echo $res[$i][emp_id] . "--" . $res[$i][emp_name] . "--" . $res[$i][emp_pwd] . "<br>";
}
echo "<br>";
echo $pageTool->getNavigate();
Пример #8
0
<?php

/**
 * Created by PhpStorm.
 * User: huzhiming
 * Date: 2015/9/13
 * Time: 14:17
 */
require_once "../../smarty_include.php";
require_once "../../tools/SQLTool.class.php";
$kno_num = $_GET['kno_num'];
$sqltool = new SQLTool();
$sql = "select *from t_kno where kno_num='{$kno_num}'";
$res = $sqltool->dbQuery($sql);
$sql = "select sort_id,sort_name from t_req_sort where sort_parent_id is NULL ";
$parent_sort = $sqltool->dbQuery($sql);
$sql = "select sort_id,sort_name,sort_parent_id from t_req_sort where sort_parent_id is not NULL";
$child_sort = $sqltool->dbQuery($sql);
$req = $sqltool->dbQuery("select req_num,req_title from t_req where req_state='4'");
$sqltool->dbCloseConnection();
$smarty->assign("parent_sort", $parent_sort);
$smarty->assign("child_sort", $child_sort);
$smarty->assign("reqlist", $req);
$smarty->assign("kno", $res[0]);
$smarty->configLoad("config.ini", "uploadfile");
$smarty->display("admin/know_edit.html");
Пример #9
0
<?php

/**
 * Created by PhpStorm.
 * User: huzhiming
 * Date: 2015/7/9
 * Time: 20:57
 */
session_start();
require_once "../../smarty_include.php";
require_once "../../tools/SQLTool.class.php";
date_default_timezone_set('prc');
date_default_timezone_set('prc');
$user_name = $_SESSION['user_name'];
$sqltool = new SQLTool();
$sql = "select *from t_req where req_state=1";
$undo_res = $sqltool->dbQuery($sql);
$sql = "select t_req.req_num,req_title,req_author,req_time,req_engineer,change_time from t_req,t_req_change where t_req.req_num=t_req_change.req_num and flag=1";
$change_req = $sqltool->dbQuery("{$sql}");
$sql = "select t_req.req_num,req_title,req_author,req_time,req_engineer,assign_time, (TIME_TO_SEC(TIMEDIFF(NOW(),assign_time))-req_time_limit*3600) as time_left,finish_flag  from t_req,t_req_assign where t_req.req_num=t_req_assign.req_num and finish_flag=1 and (TIME_TO_SEC(TIMEDIFF(NOW(),assign_time))-req_time_limit *3600)>0";
$over_time_req = $sqltool->dbQuery($sql);
//请求追踪
$sql = "select t_req.req_num,req_title,req_author,req_time,assign_time,req_priority,req_effect,req_time_limit from t_req,t_req_assign where assign_admin='{$user_name}' and finish_flag=1 and t_req.req_num = t_req_assign.req_num";
$res = $sqltool->dbQuery($sql);
//计算任务剩余时间
for ($i = 0; $i < count($res); $i++) {
    $t1 = date('Y-m-d H:i:s', time());
    $t1 = strtotime($t1);
    $t2 = strtotime($res[$i]['assign_time']);
    $time = $res[$i]['req_time_limit'] * 3600 - ($t1 - $t2);
    if ($time < 0) {
Пример #10
0
        //上季度的起止日期
        $season = ceil(date('n') / 3) - 1;
        //上季度是第几季度
        $start_date = date('Y-m-d H:i:s', mktime(0, 0, 0, $season * 3 - 3 + 1, 1, date('Y')));
        $end_date = date('Y-m-d H:i:s', mktime(23, 59, 59, $season * 3, date('t', mktime(0, 0, 0, $season * 3, 1, date("Y"))), date('Y')));
        $title = date('Y/m/d', strtotime($start_date)) . "—" . date('Y/m/d', strtotime($end_date)) . "日 ";
        break;
    case 8:
        $start_date = date('Y-m-d H:i:s', strtotime($_GET['date1']));
        $end_date = date('Y-m-d H:i:s', mktime(23, 59, 59, date('m', strtotime($_GET['date2'])), date('d', strtotime($_GET['date2'])), date('Y', strtotime($_GET['date2']))));
        $title = date('Y/m/d', strtotime($_GET['date1'])) . "—" . date('Y/m/d', strtotime($_GET['date2'])) . "日 ";
        break;
}
$title .= " 请求方式统计";
$sql = "where req_time >'{$start_date}' and req_time<'{$end_date}'";
$sqltool = new SQLTool();
$datax = array("网页请求", "邮件请求", "电话请求");
$datay = array(0, 0, 0);
$res = $sqltool->dbQuery("select req_source,count(*) num from t_req {$sql} group by req_source;");
for ($i = 0; $i < count($res); $i++) {
    $datay[$res[$i]['req_source'] - 1] = $res[$i]['num'];
}
// Size of graph
$width = 870;
$height = 3 * 40 + 20;
// Set the basic parameters of the graph
$graph = new Graph($width, $height, 'auto');
$graph->SetScale('textlin');
$graph->setcolor('white');
// Rotate graph 90 degrees and set margin
$graph->Set90AndMargin(120, 20, 30, 10);
Пример #11
0
<?php

/**
 * Created by PhpStorm.
 * User: huzhiming
 * Date: 2015/9/8
 * Time: 19:51
 */
require_once "../../tools/SQLTool.class.php";
$sqltool = new SQLTool();
if ($_GET['flag'] == 1) {
    $req_num = $_GET['req_num'];
    $sql = "select req_content from t_req where req_num='{$req_num}'";
    $res = $sqltool->dbQuery($sql);
    echo $res[0][0];
}
if ($_GET['flag'] == 2) {
    $req_num = $_GET['req_num'];
    $sql = "select attach_id,attach_name from t_attachment,t_req where req_num='{$req_num}' and attach_id = req_attach_id";
    $res = $sqltool->dbQuery($sql);
    $n = count($res);
    for ($i = 0; $i < $n; $i++) {
        echo "<a href='/itildemo/uploadfile/files/" . $res[$i][0] . "/" . $res[$i][1] . "'>" . $res[$i][1] . "</a><br>";
    }
    if (!$n) {
        echo "<a>无</a>";
    }
}
$sqltool->dbCloseConnection();
Пример #12
0
        $end_date = date('Y-m-d H:i:s', mktime(23, 59, 59, $season * 3, date('t', mktime(0, 0, 0, $season * 3, 1, date("Y"))), date('Y')));
        $title = date('Y/m/d', strtotime($start_date)) . "—" . date('Y/m/d', strtotime($end_date)) . "日 ";
        break;
    case 8:
        $start_date = date('Y-m-d H:i:s', strtotime($_GET['date1']));
        $end_date = date('Y-m-d H:i:s', mktime(23, 59, 59, date('m', strtotime($_GET['date2'])), date('d', strtotime($_GET['date2'])), date('Y', strtotime($_GET['date2']))));
        $title = date('Y/m/d', strtotime($_GET['date1'])) . "—" . date('Y/m/d', strtotime($_GET['date2'])) . "日 ";
        break;
}
$title .= " 请求量统计";
if ($id == 9) {
    $sql = "";
} else {
    $sql = " and (req_time >'{$start_date}' and req_time<'{$end_date}')";
}
$sqltool = new SQLTool();
$res = $sqltool->dbQuery("select user_name,(select count(req_num)from t_req where req_author=t_user.user_name {$sql}) num from t_user where depart_id='{$depart_id}';");
for ($i = 0; $i < count($res); $i++) {
    $datay[$i] = $res[$i][1];
    $datax[$i] = $res[$i][0];
}
if (!count($res)) {
    $datax[0] = "NULL";
    $datay[0] = 0;
    $title = "该单位还未添加人员";
}
// Size of graph
$width = 870;
$height = count($datax) * 40 + 20;
// Set the basic parameters of the graph
$graph = new Graph($width, $height, 'auto');
Пример #13
0
<?php

/**
 * Created by PhpStorm.
 * User: huzhiming
 * Date: 2015/10/8
 * Time: 10:23
 */
session_start();
require_once "../../smarty_include.php";
require_once "../../tools/SQLTool.class.php";
$sqltool = new SQLTool();
$user_name = $_SESSION['user_name'];
$res = $sqltool->dbQuery("select t_user.*,depart_name from t_user,t_depart where t_user.depart_id=t_depart.depart_id and user_name='{$user_name}'");
$smarty->assign("user", $res[0]);
$smarty->display("share/info.html");
Пример #14
0
<?php

/**
 * Created by PhpStorm.
 * User: huzhiming
 * Date: 2015/9/29
 * Time: 11:18
 */
require_once "../../smarty_include.php";
require_once "../../tools/SQLTool.class.php";
$sqltool = new SQLTool();
$res = $sqltool->dbQuery("select depart_name,depart_id from t_depart");
$smarty->assign("res", $res);
$smarty->display("admin/graph_user_req.html");
Пример #15
0
<?php

/**
 * Created by PhpStorm.
 * User: huzhiming
 * Date: 2015/9/8
 * Time: 9:07
 */
session_start();
require_once "../../smarty_include.php";
require_once "../../tools/SQLTool.class.php";
$sqltool = new SQLTool();
$kno_num = $_GET['kno_num'];
//删除附件
if (isset($_GET['flag']) and $_GET['flag'] == 'del') {
    $attach_id = $_GET['attach_id'];
    $attach_name = $_GET['file_name'];
    //echo $attach_md5_name;
    $res = $sqltool->dbUpdate("delete from t_attachment where attach_id='{$attach_id}' and attach_name='{$attach_name}'");
    //删除文件
    $res1 = 1;
    $file_name = iconv('UTF-8', 'GB2312', $attach_name);
    if (file_exists(PROJECT_DIR . "\\uploadfile\\files\\" . $attach_id . "\\" . $file_name)) {
        $res1 = unlink(PROJECT_DIR . "\\uploadfile\\files\\" . $attach_id . "\\" . $file_name);
    }
    if ($res and $res1) {
        echo "<script>alert('附件删除成功!')</script>";
    } else {
        echo "<script>alert('附件删除失败!')</script>";
    }
}
Пример #16
0
        //上季度的起止日期
        $season = ceil(date('n') / 3) - 1;
        //上季度是第几季度
        $start_date = date('Y-m-d H:i:s', mktime(0, 0, 0, $season * 3 - 3 + 1, 1, date('Y')));
        $end_date = date('Y-m-d H:i:s', mktime(23, 59, 59, $season * 3, date('t', mktime(0, 0, 0, $season * 3, 1, date("Y"))), date('Y')));
        $title = date('Y/m/d', strtotime($start_date)) . "—" . date('Y/m/d', strtotime($end_date)) . "日 ";
        break;
    case 8:
        $start_date = date('Y-m-d H:i:s', strtotime($_GET['date1']));
        $end_date = date('Y-m-d H:i:s', mktime(23, 59, 59, date('m', strtotime($_GET['date2'])), date('d', strtotime($_GET['date2'])), date('Y', strtotime($_GET['date2']))));
        $title = date('Y/m/d', strtotime($_GET['date1'])) . "—" . date('Y/m/d', strtotime($_GET['date2'])) . "日 ";
        break;
}
$title .= " 工程师解决请求数量排行榜";
$sql = " and (req_finish_time >'{$start_date}' and req_finish_time<'{$end_date}')";
$sqltool = new SQLTool();
$res = $sqltool->dbQuery("select user_name,(select count(*) from t_req where req_finish_engineer=t_user.user_name {$sql}) num from t_user where user_role=2 order by num desc");
for ($i = 0; $i < count($res); $i++) {
    $datay[$i] = $res[$i][1];
    $datax[$i] = $res[$i][0];
}
// Size of graph
$width = 880;
$height = count($res) * 40 + 20;
// Set the basic parameters of the graph
$graph = new Graph($width, $height, 'auto');
$graph->SetScale('textlin');
$graph->setcolor('white');
// Rotate graph 90 degrees and set margin
$graph->Set90AndMargin(100, 20, 30, 10);
// Setup title
Пример #17
0
<?php

/**
 * Created by PhpStorm.
 * User: huzhiming
 * Date: 2015/9/16
 * Time: 15:08
 */
require_once "../../smarty_include.php";
require_once "../../tools/SQLTool.class.php";
$sqltool = new SQLTool();
$req_num = $_GET['req_num'];
$sql = "select *from t_req where req_num = '{$req_num}'";
$res = $sqltool->dbQuery($sql);
//附件信息
$attachment = $sqltool->dbQuery("select attach_name,attach_id from t_attachment,t_req where req_attach_id=attach_id and req_num='{$req_num}'");
//指派信息
$res2 = $sqltool->dbQuery("select * from t_req_assign where req_num='{$req_num}' and finish_flag=1");
//流程信息
$assign = $sqltool->dbQuery("select * from t_req_assign where req_num='{$req_num}' order by assign_time");
$change = $sqltool->dbQuery("select change_time,req_engineer,change_reason from t_req_change where req_num='{$req_num}' order by change_time");
$process = array();
//重组数组
for ($i = 0; $i < count($assign); $i++) {
    $process[$i]['title'] = $assign[$i]['assign_time'] . "  " . $assign[$i]['assign_admin'] . "  指派  " . $assign[$i]['req_engineer'] . "  解决该请求.";
    $process[$i]['req_priority'] = $assign[$i]['req_priority'];
    $process[$i]['req_effect'] = $assign[$i]['req_effect'];
    $process[$i]['req_time_limit'] = $assign[$i]['req_time_limit'];
    $process[$i]['add_description'] = $assign[$i]['req_add_description'];
    $process[$i]['req_complex'] = $assign[$i]['req_complex'];
    $process[$i]['time'] = $assign[$i]['assign_time'];
Пример #18
0
<?php

/**
 * Created by PhpStorm.
 * User: huzhiming
 * Date: 2015/9/1
 * Time: 19:05
 */
require_once "../../smarty_include.php";
require_once "../../tools/SQLTool.class.php";
$depart_id = $_GET['depart_id'];
$sqltool = new SQLTool();
if ($_GET['flag'] == 1) {
    $user_id = $_GET['user_id'];
    $sql = "delete from t_user where user_id='{$user_id}'";
    if ($sqltool->dbUpdate($sql)) {
        echo "<script>alert('删除成功!')</script>";
    } else {
        echo "<script>alert('删除失败!')</script>";
    }
}
if ($_GET['flag'] == 2) {
    $keyword = $_GET['keyword'];
    $sql = "select *from t_user,t_depart where t_user.depart_id=t_depart.depart_id and (name like '%{$keyword}%' or position like '%{$keyword}%' or depart_name like '%{$keyword}%' or staff_id like '%{$keyword}%')";
} else {
    $sql = "select *from t_user,t_depart where t_user.depart_id ='{$depart_id}' and t_user.depart_id=t_depart.depart_id";
}
if ($_GET['flag'] == "" or $depart_id == "" and $_GET['flag'] != 2) {
    //查询所有结果
    $sql = "select *from t_user,t_depart where t_user.depart_id=t_depart.depart_id";
}
Пример #19
0
<?php

/**
 * Created by PhpStorm.
 * User: huzhiming
 * Date: 2015/7/10
 * Time: 9:45
 */
require_once "../../smarty_include.php";
require_once "../../tools/PageTool.class.php";
require_once "../../tools/SQLTool.class.php";
$sqltool = new SQLTool();
$sql = "";
$options = 7;
if ($_GET['options']) {
    $options = $_GET['options'];
}
$date1 = $_GET['date1'];
$date2 = $_GET['date2'];
$user = $_GET['user'];
$engineer = $_GET['engineer'];
$state = $_GET['state'];
$keyword = $_GET['keyword'];
switch ($options) {
    case 1:
        $start_date = date("Y-m-d H:i:s", mktime(0, 0, 0, date("m"), 1, date("Y")));
        $end_date = date("Y-m-d H:i:s", mktime(23, 59, 59, date("m"), date("t"), date("Y")));
        break;
    case 2:
        //上个月的起止时间
        $start_date = date("Y-m-d H:i:s", mktime(0, 0, 0, date("m") - 1, 1, date("Y")));
Пример #20
0
<?php

/**
 * Created by PhpStorm.
 * User: huzhiming
 * Date: 2015/9/10
 * Time: 17:04
 */
session_start();
require_once "../smarty_include.php";
require_once "../tools/SQLTool.class.php";
require_once "../tools/FileUtils.php";
$sqltool = new SQLTool();
$fileutil = new FileUtil();
//添加知识库
if (isset($_POST['add_kno'])) {
    $kno_title = $_POST['kno_title'];
    $kno_author = $_SESSION['user_name'];
    $kno_sort = $_POST['kno_sort'];
    $kno_keyword = $_POST['kno_keyword'];
    $kno_req_num = $_POST['req_num'];
    $kno_attach_id = $_POST['attach_id'];
    $kno_content = $_POST['kno_content'];
    if ($kno_req_num == "") {
        $kno_req_num = NULL;
    }
    $sql = "INSERT INTO t_kno (kno_num,kno_title,kno_sort,kno_author,kno_attach_id,kno_content,kno_sub_time,kno_keyword,kno_req_num) VALUES\r\n            (\r\n                (SELECT CONCAT('KNO',DATE_FORMAT(NOW(),'%Y%m%d'),id)  FROM\r\n                (\r\n                            SELECT\r\n                            CASE\r\n                                WHEN kno_num IS NULL THEN '00001'\r\n                                ELSE LPAD(RIGHT(MAX(kno_num),5)+1,5,'0')\r\n                                END id FROM  t_kno\r\n                            WHERE kno_num LIKE CONCAT('KNO',DATE_FORMAT(NOW(),'%Y%m%d'),'%')\r\n                ) kno_num),'{$kno_title}','{$kno_sort}','{$kno_author}','{$kno_attach_id}','{$kno_content}',Now(),'{$kno_keyword}','{$kno_req_num}'\r\n            )";
    //将上传的文件从temp文件夹下移到files
    $res = 1;
    if (file_exists(PROJECT_DIR . "/uploadfile/temp/" . $kno_attach_id)) {
        $res = $fileutil->moveDir(PROJECT_DIR . "/uploadfile/temp/" . $kno_attach_id, PROJECT_DIR . "/uploadfile/files/know/" . $kno_attach_id);
Пример #21
0
        //上季度的起止日期
        $season = ceil(date('n') / 3) - 1;
        //上季度是第几季度
        $start_date = date('Y-m-d H:i:s', mktime(0, 0, 0, $season * 3 - 3 + 1, 1, date('Y')));
        $end_date = date('Y-m-d H:i:s', mktime(23, 59, 59, $season * 3, date('t', mktime(0, 0, 0, $season * 3, 1, date("Y"))), date('Y')));
        $title = date('Y/m/d', strtotime($start_date)) . "—" . date('Y/m/d', strtotime($end_date)) . "日 ";
        break;
    case 8:
        $start_date = date('Y-m-d H:i:s', strtotime($_GET['date1']));
        $end_date = date('Y-m-d H:i:s', mktime(23, 59, 59, date('m', strtotime($_GET['date2'])), date('d', strtotime($_GET['date2'])), date('Y', strtotime($_GET['date2']))));
        $title = date('Y/m/d', strtotime($_GET['date1'])) . "—" . date('Y/m/d', strtotime($_GET['date2'])) . "日 ";
        break;
}
$title .= " 工程师逾期未解决请求量统计";
$sql = " and (assign_time >'{$start_date}' and assign_time<'{$end_date}')";
$sqltool = new SQLTool();
$res = $sqltool->dbQuery("select user_name,(select count(*) from t_req_assign where req_time_left < 0 and  req_engineer=t_user.user_name {$sql} ) num from t_user where user_role=2");
for ($i = 0; $i < count($res); $i++) {
    $datay[$i] = $res[$i][1];
    $datax[$i] = $res[$i][0];
}
// Size of graph
$width = 870;
$height = count($res) * 40 + 20;
// Set the basic parameters of the graph
$graph = new Graph($width, $height, 'auto');
$graph->SetScale('textlin');
$graph->setcolor('white');
// Rotate graph 90 degrees and set margin
$graph->Set90AndMargin(100, 20, 30, 10);
// Setup title
Пример #22
0
<?php

/**
 * Created by PhpStorm.
 * User: huzhiming
 * Date: 2015/9/23
 * Time: 10:45
 */
session_start();
require_once "../../smarty_include.php";
require_once "../../tools/SQLTool.class.php";
$news_id = $_GET['news_id'];
$sqltool = new SQLTool();
$sqltool->dbUpdate("update t_news set news_read=news_read+1 where news_id='{$news_id}'");
$sql = "select *from t_news where news_id = '{$news_id}'";
$res = $sqltool->dbQuery($sql);
$attachment = $sqltool->dbQuery("select attach_name,t_attachment.attach_id from t_attachment,t_news where t_news.attach_id=t_attachment.attach_id and news_id='{$news_id}'");
$smarty->assign("res", $res[0]);
$smarty->assign("attach", $attachment);
$smarty->display("share/news_detail.html");
Пример #23
0
        $end_date = date('Y-m-d H:i:s', mktime(23, 59, 59, $season * 3, date('t', mktime(0, 0, 0, $season * 3, 1, date("Y"))), date('Y')));
        $title = date('Y/m/d', strtotime($start_date)) . "—" . date('Y/m/d', strtotime($end_date)) . "日 ";
        break;
    case 8:
        $start_date = date('Y-m-d H:i:s', strtotime($_GET['date1']));
        $end_date = date('Y-m-d H:i:s', mktime(23, 59, 59, date('m', strtotime($_GET['date2'])), date('d', strtotime($_GET['date2'])), date('Y', strtotime($_GET['date2']))));
        $title = date('Y/m/d', strtotime($_GET['date1'])) . "—" . date('Y/m/d', strtotime($_GET['date2'])) . "日 ";
        break;
}
$title .= " 请求量统计";
if ($id == 9) {
    $sql = "";
} else {
    $sql = " and (req_time >'{$start_date}' and req_time<'{$end_date}')";
}
$sqltool = new SQLTool();
$res = $sqltool->dbQuery("select depart_name,depart_id,(select count(req_num) from t_req,t_user where t_req.req_author=t_user.user_name and t_user.depart_id=t_depart.depart_id {$sql}) num from t_depart order by num desc");
for ($i = 0; $i < count($res); $i++) {
    $datay[$i] = $res[$i][2];
    $datax[$i] = $res[$i][0];
}
// Size of graph
$width = 870;
$height = count($res) * 40 + 20;
// Set the basic parameters of the graph
$graph = new Graph($width, $height, 'auto');
$graph->SetScale('textlin');
$graph->setcolor('white');
// Rotate graph 90 degrees and set margin
$graph->Set90AndMargin(100, 20, 30, 10);
// Setup title
Пример #24
0
<?php

/**
 * Created by PhpStorm.
 * User: huzhiming
 * Date: 2015/9/10
 * Time: 16:00
 */
require_once "../../smarty_include.php";
require_once "../../tools/SQLTool.class.php";
$sqltool = new SQLTool();
$sql = "select sort_id,sort_name from t_req_sort where sort_parent_id is NULL ";
$parent_sort = $sqltool->dbQuery($sql);
$sql = "select sort_id,sort_name,sort_parent_id from t_req_sort where sort_parent_id is not NULL";
$child_sort = $sqltool->dbQuery($sql);
$req = $sqltool->dbQuery("select req_num,req_title,req_author,t_user.name from t_req,t_user where req_state='4' and req_author=user_name");
$sqltool->dbCloseConnection();
//生成唯一的附件id标识符
$attach_id = md5(uniqid(md5(microtime(true)), true));
$smarty->configLoad("config.ini", "uploadfile");
$smarty->assign("attach_id", $attach_id);
$smarty->assign("parent_sort", $parent_sort);
$smarty->assign("child_sort", $child_sort);
$smarty->assign("reqlist", $req);
$smarty->display("share/know_create.html");
Пример #25
0
<?php

/**
 * Created by PhpStorm.
 * User: huzhiming
 * Date: 2015/9/22
 * Time: 20:20
 */
require_once "../../smarty_include.php";
require_once "../../tools/SQLTool.class.php";
require_once "../../tools/PageTool.class.php";
$sqltool = new SQLTool();
$sql = " from t_news";
if ($_GET['searchcontent']) {
    $searchcontent = $_GET['searchcontent'];
    $sql = " from t_news where news_title like '%{$searchcontent}%' or news_content like '%{$searchcontent}%'";
}
$res = $sqltool->dbQuery("select count(*) " . $sql);
$sql .= " order by news_time desc";
$pagetool = new PageTool($res[0][0]);
$pagetool->url = "news_list.php";
$pagetool->url_arg = "searchcontent={$searchcontent}";
$pagetool->sql = "select *" . $sql;
$pagetool->pageNow = 1;
if ($_GET['pageNow']) {
    $pagetool->pageNow = $_GET['pageNow'];
}
$smarty->assign("nav", $pagetool->getNavigate());
$smarty->assign("res", $pagetool->getPageResource());
$smarty->display("share/news_list.html");
$sqltool->dbCloseConnection();
Пример #26
0
<?php

/**
 * Created by PhpStorm.
 * User: huzhiming
 * Date: 2015/9/6
 * Time: 13:01
 */
session_start();
require_once "../smarty_include.php";
require_once "../tools/SQLTool.class.php";
require_once "../tools/FileUtils.php";
require_once "../tools/emailUtils.php";
$sqltool = new SQLTool();
$fileutil = new FileUtil();
//添加请求
if (isset($_POST['add_req'])) {
    $flag = $_GET['flag'];
    if ($flag == "admin") {
        $req_source = $_POST['req_source'];
        $req_author = $_POST['req_author'];
    } else {
        $req_author = $_SESSION['user_name'];
        $req_source = "1";
    }
    $req_title = $_POST['req_title'];
    $req_sort = $_POST['req_sort'];
    $req_attach_id = $_POST['attach_id'];
    $req_content = $_POST['req_content'];
    $req_keyword = $_POST['req_keyword'];
    $sql = "INSERT INTO t_req (req_num,req_title,req_sort,req_author,req_attach_id,req_content,req_time,req_keyword,req_source) VALUES\r\n            (\r\n                (SELECT CONCAT('REQ',DATE_FORMAT(NOW(),'%y%m%d'),id)  FROM\r\n                (\r\n                            SELECT\r\n                            CASE\r\n                                WHEN req_num IS NULL THEN '00001'\r\n                                ELSE LPAD(RIGHT(MAX(req_num),5)+1,5,'0')\r\n                                END id FROM  t_req\r\n                            WHERE req_num LIKE CONCAT('REQ',DATE_FORMAT(NOW(),'%y%m%d'),'%')\r\n                ) req_num),'{$req_title}','{$req_sort}','{$req_author}','{$req_attach_id}','{$req_content}',Now(),'{$req_keyword}','{$req_source}'\r\n            )";
Пример #27
0
<?php

/**
 * Created by PhpStorm.
 * User: huzhiming
 * Date: 2015/9/14
 * Time: 19:26
 */
require_once "../../smarty_include.php";
require_once "../../tools/SQLTool.class.php";
require_once "../../tools/PageTool.class.php";
$sqltool = new SQLTool();
$sql = "select * from t_kno where 1=1 ";
//输入搜索
$searchcontent = "";
if (isset($_GET['searchcontent']) and $_GET['searchcontent'] != "") {
    $searchcontent = $_GET['searchcontent'];
    $sql .= " and (kno_title like '%{$searchcontent}%' or kno_num like '%{$searchcontent}%' or kno_sort like '%{$searchcontent}%' or kno_keyword like '%{$searchcontent}%' or kno_content like '%{$searchcontent}%')";
}
//分类搜索
if (isset($_GET['kno_sort'])) {
    $sort = $_GET['kno_sort'];
    $sql .= " and kno_sort like '%{$sort}%' ";
}
$sql .= " and kno_state=3 order by kno_read desc";
$res = $sqltool->dbQuery($sql);
$pagetool = new PageTool(count($res));
$pagetool->url = "know_list.php";
$pagetool->sql = $sql;
$pagetool->url_arg = "searchcontent={$searchcontent}&kno_sort={$sort}";
$pageNow = 1;
Пример #28
0
<?php

/**
 * Created by PhpStorm.
 * User: huzhiming
 * Date: 2015/7/9
 * Time: 15:29
 */
require_once "../../smarty_include.php";
require_once "../../tools/SQLTool.class.php";
$sqltool = new SQLTool();
$sql = "select sort_id,sort_name from t_req_sort where sort_parent_id is NULL ";
$parent_sort = $sqltool->dbQuery($sql);
$sql = "select sort_id,sort_name,sort_parent_id from t_req_sort where sort_parent_id is not NULL";
$child_sort = $sqltool->dbQuery($sql);
$sqltool->dbCloseConnection();
$smarty->assign("parent_sort", $parent_sort);
$smarty->assign("child_sort", $child_sort);
$smarty->display("admin/config_sort.html");
Пример #29
0
<?php

/**
 * Created by PhpStorm.
 * User: huzhiming
 * Date: 2015/9/14
 * Time: 14:59
 */
require_once "../../smarty_include.php";
require_once "../../tools/SQLTool.class.php";
$sqltool = new SQLTool();
$sql = "SELECT sort_name,(select count(*) from t_kno where kno_sort  like CONCAT('%',t.sort_name,'%') and kno_state=3) times,sort_parent_id from t_req_sort t GROUP BY sort_name ORDER BY sort_parent_id";
$child_sort = $sqltool->dbQuery($sql);
$parent_sort = $sqltool->dbQuery("select sort_id,sort_name from t_req_sort where sort_parent_id is NULL ");
$kno = $sqltool->dbQuery("select kno_title,kno_num,kno_read from t_kno  where kno_state=3 order by kno_read desc limit 0,20");
$smarty->assign("child_sort", $child_sort);
$smarty->assign("parent_sort", $parent_sort);
$smarty->assign("kno", $kno);
$smarty->display("share/know_search.html");
Пример #30
0
<?php

/**
 * Created by PhpStorm.
 * User: huzhiming
 * Date: 2015/9/17
 * Time: 9:30
 */
header("Content-type: text/html; charset=utf-8");
require_once "../../smarty_include.php";
require_once "../../tools/SQLTool.class.php";
$req_num = $_GET['req_num'];
$flag = $_GET['flag'];
$sqltool = new SQLTool();
$sql = "select *from t_req where req_num = '{$req_num}'";
//请求信息
$res = $sqltool->dbQuery($sql);
//附件信息
$attachment = $sqltool->dbQuery("select attach_name,attach_id from t_attachment,t_req where req_attach_id=attach_id and req_num='{$req_num}'");
//工程师列表
$engineer = $sqltool->dbQuery("select user_name,name,(select count(finish_flag) from t_req_assign where req_engineer=t.user_name and finish_flag=1) task from t_user t where user_role=2 order by task");
//流程信息
$assign = $sqltool->dbQuery("select * from t_req_assign where req_num='{$req_num}' order by assign_time");
$change = $sqltool->dbQuery("select change_time,req_engineer,change_reason from t_req_change where req_num='{$req_num}' order by change_time");
$process = array();
//重组数组
$i = 0;
for ($i = 0; $i < count($assign); $i++) {
    $process[$i]['title'] = $assign[$i]['assign_time'] . "  " . $assign[$i]['assign_admin'] . "  指派  " . $assign[$i]['req_engineer'] . "  解决该请求.";
    $process[$i]['req_priority'] = $assign[$i]['req_priority'];
    $process[$i]['req_effect'] = $assign[$i]['req_effect'];