/** * 打印任务汇报 * 更新对应任务的状态 * @param $data * @return array */ function biz_Print_TaskReport($data, $module) { $task = db_getPrintTask($data['key']); if ($task['moduleid'] == $module['id'] && empty($task['complate'])) { $update = array('status' => $data['status'], 'updatetime' => TIMESTAMP); if ($data['status'] == '完成') { $update['complate'] = 1; } pdo_update('printtask', $update, array('id' => $task['id'])); return true; } else { return false; } }
public function doWebTask() { global $_W, $_GPC; $table = 'printtask'; $op = !empty($_GPC['op']) ? $_GPC['op'] : 'list'; if ($op == 'list') { $status = array('完成', '等待', '出错'); $enable = $this->CheckRight('deltask', false); $condition = " `projguid`=:projguid "; $params = array(':projguid' => $_W['project']['projguid']); $selstatus = ''; if (isset($_GPC['status'])) { $selstatus = $_GPC['status']; } if (!empty($selstatus)) { $condition .= ' and status=:status'; $params[':status'] = $selstatus; } if (isset($_GPC['keyword'])) { $keyword = trim($_GPC['keyword']); $condition .= " AND `printname` LIKE :keyword"; $params[':keyword'] = "%{$keyword}%"; } // 删除所有已完成的打印任务 if ($_GPC['submit'] == '删除') { pdo_delete('printtask', array('complate' => 1)); message('删除数据成功!', $this->createWebUrl('task')); } $printtype = biz_getDictionary('printtype'); $pindex = max(1, intval($_GPC['page'])); $psize = 20; $sql = "SELECT * FROM " . tablename($table) . " WHERE {$condition}" . ' order by createtime desc,updatetime '; $list = pdo_fetchall($sql . " limit " . ($pindex - 1) * $psize . "," . $psize, $params); $total = pdo_fetchcolumn(" select count(*) from " . tablename($table) . " WHERE {$condition}", $params); $pager = pagination($total, $pindex, $psize); foreach ($list as &$item) { $item['delete'] = $enable ? true : $item['createid'] == $_W['uid']; } unset($item); include $this->template('task_list'); exit; } if ($op == 'delete') { $id = $_GPC['id']; $task = db_getPrintTask($id); if (!empty($task)) { $enable = $this->CheckRight('deltask', false); if ($enable || $task['createid'] == $_W['uid']) { pdo_delete('printtask', array('id' => $task['id'])); //message('删除成功!',$this->createWebUrl('task')); exit('success'); } else { exit('无权删除该数据!'); } } else { exit('无效数据'); } } // 查看打印数据 if ($op == 'disp') { $id = $_GPC['id']; $task = db_getPrintTask($id); $printdata = iunserializer($task['printdata']); if ($_W['isajax']) { include $this->template('printdata_disp'); exit; } } }