/** * 插入面板与任务数据 * @param array $borad * @param array $task * @return string dwz */ public function insert_data($bname, $meeting) { $dwz = dwz(md5(uniqid())); $rldwz = dwz($dwz); //插入 $sql = "INSERT INTO `tools_meeting` (bname,dwz,rldwz)\n\t\t\t\tVALUES('" . $bname . "','" . $dwz . "','" . $rldwz . "')"; $this->db->query($sql); $fid = $this->db->insert_id(); $meeting['info'] = str_replace("\n", "<br/>", $meeting['info']); $meeting['memo'] = str_replace("\n", "<br/>", $meeting['memo']); //插入 $sql = "INSERT INTO `tools_meeting_list` (fid,mname,begintime,people,info,memo) VALUES "; for ($i = 1; $i < count($meeting['mname']); $i++) { $sql .= "('" . $fid . "','" . $meeting['mname'][$i] . "','" . $meeting['begintime'][$i] . "','" . $meeting['people'][$i] . "','" . $meeting['info'][$i] . "','" . $meeting['memo'][$i] . "'),"; } $sql = substr($sql, 0, -1); if (count($meeting['mname']) > 1) { $this->db->query($sql); } in_depot('meeting', $dwz, $bname); //------------------- in_log('tools', array('tid' => $fid, 'ttype' => 'meeting', 'title' => '新建会议工具', 'contents' => '新建会议夹(' . $bname . ')', 'old_data' => '')); //------------------- return $dwz; }
/** * 插入面板与任务数据 * @param array $borad * @param array $task * @return string dwz */ public function insert_data($borad, $task) { //插入borad $dwz = dwz(md5(uniqid())); $rldwz = dwz($dwz); $sql = "INSERT INTO `tools_tasks` (bname,begintime,endtime,exceptdays,dwz,rldwz) \n\t\t\t\tVALUES('" . $borad['bname'] . "','" . $borad['begintime'] . "','" . $borad['endtime'] . "','" . json_encode($borad['exceptdays']) . "','" . $dwz . "','" . $rldwz . "')"; $this->db->query($sql); $fid = $this->db->insert_id(); //插入task $sql = "INSERT INTO `tools_tasks_list` (fid,story,owner,expendt,workload) VALUES "; for ($tmp_time = date("Y-m-d", strtotime($borad['begintime'])); $tmp_time <= $borad['endtime']; $tmp_time = date("Y-m-d", strtotime("+1 day", strtotime($tmp_time)))) { if (!in_array($tmp_time, $borad['exceptdays'])) { $workload[date("m-d", strtotime($tmp_time))] = ""; } } $workload = json_encode($workload); for ($i = 1; $i < count($task['story']); $i++) { $sql .= "('" . $fid . "','" . $task['story'][$i] . "','" . $task['owner'][$i] . "','" . $task['expendt'][$i] . "','" . $workload . "'),"; } $sql = substr($sql, 0, -1); $this->db->query($sql); in_depot('tasks', $dwz, $borad['bname']); //-------------------- in_log('tools', array('tid' => $fid, 'ttype' => 'plan', 'title' => '新建', 'contents' => '新建任务工具(' . $borad['bname'] . ')', 'old_data' => '')); //-------------------- return $dwz; }
/** * 插入面板与任务数据 * @param array $borad * @param array $task * @return string dwz */ public function insert_data($plan, $task, $milestone) { $dwz = dwz(md5(uniqid())); $rldwz = dwz($dwz); //插入Plan $sql = "INSERT INTO `tools_plan` (bname,begintime,endtime,exceptdays,dwz,rldwz)\n\t\t\t\tVALUES('" . $plan['bname'] . "','" . $plan['begintime'] . "','" . $plan['endtime'] . "','" . json_encode($plan['exceptdays']) . "','" . $dwz . "','" . $rldwz . "')"; $this->db->query($sql); $fid = $this->db->insert_id(); //插入task $sql = "INSERT INTO `tools_plan_task` (fid,title,describ,owner,pdays,expstrt,expendt) VALUES "; for ($i = 1; $i < count($task['title']); $i++) { $sql .= "('" . $fid . "','" . $task['title'][$i] . "','" . $task['describ'][$i] . "','" . $task['owner'][$i] . "','" . $task['pdays'][$i] . "','" . $task['expstrt'][$i] . "','" . $task['expendt'][$i] . "'),"; } $sql = substr($sql, 0, -1); $this->db->query($sql); //插入milestone $sql = "INSERT INTO `tools_plan_milestone` (fid,title,describ,timepoint) VALUES "; for ($i = 1; $i < count($milestone['title']); $i++) { $sql .= "('" . $fid . "','" . $milestone['title'][$i] . "','" . $milestone['describ'][$i] . "','" . $milestone['timepoint'][$i] . "'),"; } $sql = substr($sql, 0, -1); $this->db->query($sql); in_depot('plan', $dwz, $plan['bname']); //-------------------- in_log('tools', array('tid' => $fid, 'ttype' => 'plan', 'title' => '新建', 'contents' => '新建计划工具(' . $plan['bname'] . ')', 'old_data' => '')); //-------------------- return $dwz; }
/** * 新建文件工具 * @param array * @param array $task * @return string dwz */ public function insert_data($info) { //插入 $dwz = dwz(md5(uniqid())); $rldwz = dwz($dwz); $sql = "INSERT INTO `tools_docs` (bname,dwz,rldwz) \n\t\t\t\tVALUES('" . $info['bname'] . "','" . $dwz . "','" . $rldwz . "')"; $this->db->query($sql); $fid = $this->db->insert_id(); in_depot('docs', $dwz, $info['bname']); //-------------------- in_log('tools', array('tid' => $fid, 'ttype' => 'docs', 'title' => '新建', 'contents' => '新建文件工具(' . $info['bname'] . ')', 'old_data' => '')); //-------------------- return $dwz; }
/** * 插入面板与任务数据 * @param array $borad * @param array $task * @return string dwz */ public function insert_data($info) { //插入borad $dwz = dwz(md5(uniqid())); $rldwz = dwz($dwz); unset($info['other']['name'][0]); unset($info['other']['value'][0]); $info['describ'] = str_replace("\n", "<br/>", $info['describ']); $info['background'] = str_replace("\n", "<br/>", $info['background']); $info['demand'] = str_replace("\n", "<br/>", $info['demand']); $info['meaning'] = str_replace("\n", "<br/>", $info['meaning']); $sql = "INSERT INTO `tools_setup` (bname,describ,background,demand,meaning,other,dwz,rldwz) \n\t\t\t\tVALUES('" . $info['bname'] . "','" . $info['describ'] . "','" . $info['background'] . "','" . $info['demand'] . "','" . $info['meaning'] . "','" . serialize($info['other']) . "','" . $dwz . "','" . $rldwz . "')"; $this->db->query($sql); $fid = $this->db->insert_id(); in_depot('setup', $dwz, $info['bname']); //-------------------- in_log('tools', array('tid' => $fid, 'ttype' => 'setup', 'title' => '新建', 'contents' => '新建立项工具(' . $info['bname'] . ')', 'old_data' => '')); //-------------------- return $dwz; }
/** * Ajax上传文档 */ public function upload() { $this->view_override = FALSE; if (!empty($_FILES)) { $dwz = dwz(md5(uniqid())); $file_name = $_FILES['file']['tmp_name']; $targetDirc = $this->dirc . md5($_GET['rldwz']) . "\\"; $targetFile = $targetDirc . md5($dwz); if (!file_exists($targetDirc)) { mkdir($targetDirc, 0777); } if (move_uploaded_file($file_name, $targetFile)) { $info['fname'] = $_FILES['file']['name']; $info['fsize'] = $_FILES['file']['size']; $info['ftype'] = $_FILES['file']['type']; $info['updatetime'] = date("Y-m-d H:i:s"); $this->tools_docs_model->upload_docs($info, $this->fid, $dwz); } } }