function save_service_file($service_id, $title) { $release_info = $this->_std_obj->_release_info; if ($release_info['file_ids']) { $file_obj = new Keke_witkey_file_class(); $file_arr = array_filter(explode(',', $release_info['file_ids'])); foreach ($file_arr as $v) { $file_obj->setFile_id($v); $file_obj->setUid($this->_uid); $file_obj->setUsername($this->_username); $file_obj->setObj_id($service_id); $file_obj->setTask_title($title); $file_obj->edit_keke_witkey_file(); } } }
public function wap_upload($f = 'uploadedfile', $work_id = 0) { $work_id and $type = "work" or $type = "task"; $path = keke_file_class::upload_file($f); $file_obj = new Keke_witkey_file_class(); $file_obj->setFile_name($_FILES[$f][name]); $file_obj->setTask_id($this->_task_id); $file_obj->setObj_type($type); $file_obj->setSave_name($path); $file_obj->setOn_time(time()); $file_obj->setUid($this->_uid); $file_obj->setUsername($this->_username); $file_obj->create_keke_witkey_file(); if ($path) { $fid = db_factory::get_count(sprintf(" select file_id from %switkey_file where save_name='%s'", TABLEPRE, $path)); if ($work_id) { db_factory::execute(sprintf("update %switkey_task_work set work_file='%d' where task_id='%d' and work_id='%d'", TABLEPRE, $fid, $this->_task_id, $work_id)); db_factory::execute(sprintf(" update %switkey_file set obj_type='work',task_id='%d',obj_id='%d' where file_id='%d'", TABLEPRE, $this->_task_id, $work_id, $fid)); } else { db_factory::execute(sprintf("update %switkey_task set task_file='%d' where task_id='%d'", TABLEPRE, $fid, $this->_task_id)); db_factory::execute(sprintf(" update %switkey_file set obj_type='task',task_id='%d' where file_id='%d'", TABLEPRE, $this->_task_id, $fid)); } kekezu::echojson('', 1); } else { kekezu::echojson(array('r' => 'Upload failed'), 0); } die; }