diff --git a/application/admin/controllers/DataController.php b/application/admin/controllers/DataController.php index 7e28c946..def41e44 100755 --- a/application/admin/controllers/DataController.php +++ b/application/admin/controllers/DataController.php @@ -854,7 +854,7 @@ class Admin_DataController extends Zend_Controller_Action $sql = "update source set title='$title',uuid='$uuid',code='$code',description='$description',has_pages='$has_pages',has_agreement='$has_agreement' where id='$id'"; - if($this->db->exec($sql)>1) + if($this->db->exec($sql)) { $this->messenger->addMessage('修改来源信息成功'); $this->_redirect("/admin/data/source/do/edit/id/$id"); @@ -876,6 +876,87 @@ class Admin_DataController extends Zend_Controller_Action }// 编辑单条信息 + else if($do == 'datasource' && !empty($uuid)) + { + $redirect = "/admin/data/source/do/datasource/uuid/$uuid"; + + $this->view->uuid = $uuid; + $sql = "select md.title,ds.id,ds.sourceid,s.title as stitle,s.code from metadata md + left join datasource ds on ds.uuid=md.uuid + left join source s on s.id=ds.sourceid + where md.uuid='$uuid'"; + $rs = $this->db->query($sql); + $row = $rs->fetch(); + + $this->view->info = $row; + + if(!empty($_POST['submit'])) + { + $sourceid = $this->_request->getParam('sourceid'); + if(empty($sourceid)) + { + $this->messenger->addMessage('请选择项目来源'); + $this->_redirect($redirect); + } + + $sql=""; + if(empty($row['id'])) + { + $sql = "insert into datasource (uuid,sourceid) values ('$uuid','$sourceid')"; + }else + { + $sql = "update datasource set uuid='$uuid',sourceid='$sourceid' where id='{$row['id']}'"; + } + try{ + if($this->db->exec($sql)) + { + $this->messenger->addMessage('修改项目来源成功'); + $this->_redirect($redirect); + } + else + { + $this->messenger->addMessage('修改项目来源失败'); + $this->_redirect($redirect); + } + }catch (Exception $e){ + $this->messenger->addMessage('修改项目来源失败:'.$e->getMessage()); + $this->_redirect($redirect); + } + + } + + + + $wheresql = array(); + + if(!empty($q) && !empty($search)) + { + $this->view->q = $q; + $wheresql[] = " title like '%$q%' "; + } + + if(count($wheresql>0))$wheresql = join(' and ',$wheresql); + else $wheresql=''; + + if($wheresql!='') + { + $wheresql = 'where '.$wheresql; + } + + $sql = "select * from source $wheresql order by id desc"; + $rs = $this->db->query($sql); + $rows = $rs->fetchAll(); + + $paginator = Zend_Paginator::factory($rows); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage(30); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); + $this->view->paginator=$paginator; + + $this->_helper->viewRenderer('sourceselect'); + } + else { $wheresql = array(); diff --git a/application/admin/views/scripts/data/sourceselect.phtml b/application/admin/views/scripts/data/sourceselect.phtml new file mode 100644 index 00000000..09844ba0 --- /dev/null +++ b/application/admin/views/scripts/data/sourceselect.phtml @@ -0,0 +1,76 @@ +headTitle($this->config->title->site); + $this->headTitle('后台管理'); + $this->headTitle()->setSeparator(' - '); + $this->headLink()->appendStylesheet('/css/admin.css'); + $this->headScript()->appendFile('/js/jquery-1.6.4.min.js'); + $this->breadcrumb('首页'); + $this->breadcrumb('后台首页'); + $this->breadcrumb('数据管理'); + $this->breadcrumb('项目来源管理'); + $this->breadcrumb()->setSeparator(' > '); +?> +
msg; ?>
+messages): foreach($this->messages as $msg): ?> + + +