diff --git a/module/Admin/config/module.config.php b/module/Admin/config/module.config.php index e8f516d8..23921f41 100644 --- a/module/Admin/config/module.config.php +++ b/module/Admin/config/module.config.php @@ -1,78 +1,82 @@ - array( - 'services' => array( - //'Auth' => new Sookon\Authentication\AuthenticationService(), - ), - ), - - 'controllers' => array( - 'invokables' => array( - 'Admin\Controller\Index' => 'Admin\Controller\IndexController', - 'Admin\Controller\Article' => 'Admin\Controller\ArticleController', - 'Admin\Controller\Category' => 'Admin\Controller\CategoryController', - 'Admin\Controller\Metadata' => 'Admin\Controller\MetadataController', - ), - ), - - 'router' => array( - 'routes' => array( - 'admin' => array( - 'type' => 'Segment', - 'options' => array( - 'route' => '/admin[/:controller[/:action[/:ac][/page/:page][/id/:id]]]', - 'constraints' => array( - 'controller' => '[a-zA-Z][a-zA-Z0-9_-]*', - 'action' => '[a-zA-Z][a-zA-Z0-9_-]*', - 'ac' => '[a-zA-Z][a-zA-Z0-9_-]*', - 'page' => '[a-zA-Z][a-zA-Z0-9_-]*', - 'id' => '[a-zA-Z][a-zA-Z0-9_-]*', - ), - 'defaults' => array( - 'module' => 'Admin', - '__NAMESPACE__' => 'Admin\Controller', - 'controller' => 'Admin\Controller\Index', - 'action' => 'index', - ), - ), - 'may_terminate' => true, - 'child_routes' => array( - 'wildcard' => array( - 'type' => 'Wildcard' - ) - ) - ), - ), - ), - - 'view_manager' => array( - 'template_path_stack' => array( - 'admin' => __DIR__ . '/../view', - ), - 'template_map' => array( - 'layout/admin' => __DIR__ . '/../view/layout/admin.phtml', - 'layout/admin/header' => __DIR__ . '/../view/layout/header.phtml', - 'layout/admin/pagination' => __DIR__ . '/../view/layout/pagination.phtml', - - 'layout/admin/article/list' => __DIR__ . '/../view/admin/article/list.phtml', - 'layout/admin/article/nav' => __DIR__ . '/../view/admin/article/nav.phtml', - 'layout/admin/article/add' => __DIR__ . '/../view/admin/article/add.phtml', - - 'layout/admin/category/list' => __DIR__ . '/../view/admin/category/list.phtml', - 'layout/admin/category/nav' => __DIR__ . '/../view/admin/category/nav.phtml', - 'layout/admin/category/add' => __DIR__ . '/../view/admin/category/add.phtml', - 'layout/admin/category/moved' => __DIR__ . '/../view/admin/category/moved.phtml', - - 'layout/admin/metadata/list' => __DIR__ . '/../view/admin/metadata/list.phtml', - 'layout/admin/metadata/nav' => __DIR__ . '/../view/admin/metadata/nav.phtml', - ), - ), -); + array( + 'services' => array( + //'Auth' => new Sookon\Authentication\AuthenticationService(), + ), + ), + + 'controllers' => array( + 'invokables' => array( + 'Admin\Controller\Index' => 'Admin\Controller\IndexController', + 'Admin\Controller\Article' => 'Admin\Controller\ArticleController', + 'Admin\Controller\Category' => 'Admin\Controller\CategoryController', + 'Admin\Controller\Metadata' => 'Admin\Controller\MetadataController', + 'Admin\Controller\Users' => 'Admin\Controller\UsersController', + ), + ), + + 'router' => array( + 'routes' => array( + 'admin' => array( + 'type' => 'Segment', + 'options' => array( + 'route' => '/admin[/:controller[/:action[/:ac][/page/:page][/id/:id]]]', + 'constraints' => array( + 'controller' => '[a-zA-Z][a-zA-Z0-9_-]*', + 'action' => '[a-zA-Z][a-zA-Z0-9_-]*', + 'ac' => '[a-zA-Z][a-zA-Z0-9_-]*', + 'page' => '[a-zA-Z][a-zA-Z0-9_-]*', + 'id' => '[a-zA-Z][a-zA-Z0-9_-]*', + ), + 'defaults' => array( + 'module' => 'Admin', + '__NAMESPACE__' => 'Admin\Controller', + 'controller' => 'Admin\Controller\Index', + 'action' => 'index', + ), + ), + 'may_terminate' => true, + 'child_routes' => array( + 'wildcard' => array( + 'type' => 'Wildcard' + ) + ) + ), + ), + ), + + 'view_manager' => array( + 'template_path_stack' => array( + 'admin' => __DIR__ . '/../view', + ), + 'template_map' => array( + 'layout/admin' => __DIR__ . '/../view/layout/admin.phtml', + 'layout/admin/header' => __DIR__ . '/../view/layout/header.phtml', + 'layout/admin/pagination' => __DIR__ . '/../view/layout/pagination.phtml', + + 'layout/admin/article/list' => __DIR__ . '/../view/admin/article/list.phtml', + 'layout/admin/article/nav' => __DIR__ . '/../view/admin/article/nav.phtml', + 'layout/admin/article/add' => __DIR__ . '/../view/admin/article/add.phtml', + + 'layout/admin/category/list' => __DIR__ . '/../view/admin/category/list.phtml', + 'layout/admin/category/nav' => __DIR__ . '/../view/admin/category/nav.phtml', + 'layout/admin/category/add' => __DIR__ . '/../view/admin/category/add.phtml', + 'layout/admin/category/moved' => __DIR__ . '/../view/admin/category/moved.phtml', + + 'layout/admin/metadata/list' => __DIR__ . '/../view/admin/metadata/list.phtml', + 'layout/admin/metadata/nav' => __DIR__ . '/../view/admin/metadata/nav.phtml', + + 'layout/admin/users/list' => __DIR__ . '/../view/admin/users/list.phtml', + 'layout/admin/users/nav' => __DIR__ . '/../view/admin/users/nav.phtml', + ), + ), +); diff --git a/module/Admin/src/Admin/Controller/UsersController.php b/module/Admin/src/Admin/Controller/UsersController.php new file mode 100644 index 00000000..f5124a7a --- /dev/null +++ b/module/Admin/src/Admin/Controller/UsersController.php @@ -0,0 +1,98 @@ +ViewModel = new ViewModel(); + } + + public function indexAction() + { + $users = new \Westdc\Member\Member; + + $filter = new \Sookon\Search\Filter; + + $keyword = isset($_GET['q']) ? $filter->mixedKeyword($_GET['q']):""; + if(!empty($keyword)) + { + $this->ViewModel->setVariable('keyword',$keyword); + $users->opt->logic = "OR"; + + if(!is_numeric($keyword)) + { + $users->opt->where = array( + "m.username LIKE '%$keyword%'", + "m.realname LIKE '%$keyword%'", + "m.unit LIKE '%$keyword%'", + "m.project LIKE '%$keyword%'", + "m.email LIKE '%$keyword%'", + "m.project_leader LIKE '%$keyword%'", + "m.project_id LIKE '%$keyword%'", + "m.project_type LIKE '%$keyword%'", + "m.project_title LIKE '%$keyword%'", + "m.address LIKE '%$keyword%'", + "m.phone LIKE '%$keyword%'", + ); + } + else + $users->opt->where = array( + "m.id=$keyword", + ); + + } + + view::addPaginator($users->fetchAll(),$this,18); + + return $this->ViewModel; + } + + public function viewAction() + { + $id = $this->params()->fromRoute('id'); + + if(empty($id) || !is_numeric($id)) + { + return view::Post($this,"参数错误",-1); + } + + $users = new \Westdc\Member\Member; + + $this->ViewModel->setVariable("data",$users->fetch($id)); + + return $this->ViewModel; + } + + public function editAction() + { + $id = $this->params()->fromRoute('id'); + + if(empty($id) || !is_numeric($id)) + { + return view::Post($this,"参数错误",-1); + } + + $ac = $this->params()->fromRoute('ac'); + + if($ac == "reset") + { + + } + } +} diff --git a/module/Admin/view/admin/users/index.phtml b/module/Admin/view/admin/users/index.phtml new file mode 100644 index 00000000..cd1ae99a --- /dev/null +++ b/module/Admin/view/admin/users/index.phtml @@ -0,0 +1,84 @@ + +