diff --git a/application/admin/controllers/UserController.php b/application/admin/controllers/UserController.php index 9106f7c7..49817eb4 100755 --- a/application/admin/controllers/UserController.php +++ b/application/admin/controllers/UserController.php @@ -1,4 +1,6 @@ from('users') ->where('usertype = ?', 'administrator') ->order('users.id desc'); + + $paginator = Zend_Paginator::factory($select); $paginator->setCurrentPageNumber($this->_getParam('page')); $paginator->setItemCountPerPage(30); $paginator->setView($this->view); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml'); $this->view->paginator=$paginator; + + $ac = $this->_getParam('ac'); + + if($ac == 'sync') + { + $sql = "SELECT id FROM users WHERE usertype='administrator'"; + $rs = $this->db->query($sql); + $ids = $rs->fetchAll(); + + $data = array(); + foreach($ids as $v) + { + $data[] = $v['id']; + } + unset($ids); + + $ids = join(",",$data); + + $gn_sql = "update users set profile='Administrator' where id in ($ids)"; + $gn_db = new PDO(array( + 'host'=> $this->view->config->geonetwork->params->host, + 'port' => 5432, + 'user' => $this->view->config->geonetwork->params->username, + 'pwd' => $this->view->config->geonetwork->params->password , + 'db' => $this->view->config->geonetwork->params->dbname + )); + + $gn_db->exec($gn_sql); + + view::Post($this,"同步成功!",-1); + } } function showAction() diff --git a/application/admin/views/scripts/user/adminlist.phtml b/application/admin/views/scripts/user/adminlist.phtml index 115fc724..3606ba74 100755 --- a/application/admin/views/scripts/user/adminlist.phtml +++ b/application/admin/views/scripts/user/adminlist.phtml @@ -1,46 +1,47 @@ -headTitle($this->config->title->site); - $this->headTitle('后台管理'); - $this->headTitle()->setSeparator(' - '); - $this->headLink()->appendStylesheet('/css/admin.css'); - $this->breadcrumb('首页'); - $this->breadcrumb('后台首页'); - $this->breadcrumb('用户管理'); - $this->breadcrumb()->setSeparator(' > '); -?> -
-partial('user/left.phtml'); ?> -
- -
-
管理员列表
- - - - - - - - - - - -paginator)): ?> - -paginator as $item): ?> - - - - - - - - - - - -
用户名电子邮箱用户类型真实姓名电话操作
-'>查看详细 -
- +headTitle($this->config->title->site); + $this->headTitle('后台管理'); + $this->headTitle()->setSeparator(' - '); + $this->headLink()->appendStylesheet('/css/admin.css'); + $this->breadcrumb('首页'); + $this->breadcrumb('后台首页'); + $this->breadcrumb('用户管理'); + $this->breadcrumb()->setSeparator(' > '); +?> +
+partial('user/left.phtml'); ?> +
+ +
+
管理员列表
+
同步管理员到geonetwork
+ + + + + + + + + + + +paginator)): ?> + +paginator as $item): ?> + + + + + + + + + + + +
用户名电子邮箱用户类型真实姓名电话操作
+'>查看详细 +
+
\ No newline at end of file diff --git a/application/module/Helpers/PDO.php b/application/module/Helpers/PDO.php new file mode 100644 index 00000000..d41733c4 --- /dev/null +++ b/application/module/Helpers/PDO.php @@ -0,0 +1,45 @@ +config_local_path); + $dsn = "pgsql:host={$config_local->db->hostname};" + ."port=5432;" + ."dbname={$config_local->db->database};" + ."user={$config_local->db->username};" + ."password={$config_local->db->password}"; + parent::__construct($dsn); + } + + else{ + + if(is_string($DSN)) + { + parent::__construct($DSN); + } + + else{ + $dsn = "pgsql:host={$DSN['host']};" + ."port={$DSN['port']};" + ."dbname={$DSN['db']};" + ."user={$DSN['user']};" + ."password={$DSN['pwd']}"; + parent::__construct($dsn); + } + + } + } + +} \ No newline at end of file