public function edit($postArr) { if (empty($postArr['Id'])) { return array('msg' => '参数错误', 'status' => -1, 'href' => 2); } if (empty($postArr['name'])) { return array('msg' => '项目名称不能为空', 'status' => -1, 'href' => 2); } if (empty($postArr['principal_user_id'])) { return array('msg' => '请选择项目负责人', 'status' => -1, 'href' => 2); } if (empty($postArr['detail'])) { $postArr['detail'] = '暂无内容'; } $updateArr = array('name' => $postArr['name'], 'principal_user_id' => $postArr['principal_user_id'], 'detail' => $postArr['detail']); $this->update($updateArr, "Id={$postArr['Id']}"); $this->_modelUser = $this->_getGlobalData('Model_User', 'object'); $this->_modelUser->execute("update {$this->_modelUser->tName()} set project_id=0 where project_id = {$postArr['Id']}"); if (count($postArr['user_id'])) { $this->_modelUser->execute("update {$this->_modelUser->tName()} set project_id={$postArr['Id']} where Id in (" . implode(',', $postArr['user_id']) . ")"); } $this->_modelUser->createCache(); $this->createCache(); return array('msg' => '项目修改成功', 'status' => 1, 'href' => Tools::url('ProgramProject', 'Index', array('zp' => 'Program'))); }
/** * 用户列表 */ public function cIndex() { $this->_modelUser = $this->getGlobal('model/User', 'Model_User'); $requestClass = RegistryRequest::getInstance(); $requestClass->absInt($requestClass->get('page')); $sqlSearch = $this->_modelUser->getFindClass(); $sqlSearch->set_tableName($this->_modelUser->tName()); $sqlSearch->addConditions($requestClass->get('search_where')); $sqlSearch->setPageLimit($requestClass->get('page'), config('PAGE_SIZE')); $sqlSearch->set_orderBy('id desc'); $sql = $sqlSearch->createSql(); $dataList = $this->_modelUser->select($sql, 'id'); $conditions = $sqlSearch->get_conditions(); $this->assign('dataList', $dataList); loadCore('help/Page'); $page = new Page(array('total' => $this->_modelUser->findCount($conditions), 'perpage' => config('PAGE_SIZE'))); $this->assign('pageBox', $page->show()); $this->display(VIEW_PAGE); }
/** * 获取指定控制器或方法用户所拥有的 * @param string $actId */ public function getUserAct($actValue) { $this->_modelUser = $this->_getGlobalData('Model_User', 'object'); $users = $this->_modelUser->select("select * from {$this->_modelUser->tName()} where act like '%{$actValue}%'"); return $this->getTtwoArrConvertOneArr($users, 'Id', 'nick_name'); }
/** * 用户主界面 */ private function _userIndex() { $this->_loadCore('Help_SqlSearch'); $this->_loadCore('Help_Page'); $helpSqlSearch = new Help_SqlSearch(); $helpSqlSearch->set_tableName($this->_modelUser->tName()); if ($_GET['department_id']) { $helpSqlSearch->set_conditions("department_id={$_GET['department_id']}"); $this->_view->assign('selectedDepartmentId', $_GET['department_id']); } if ($_GET['org_id'] != '') { $helpSqlSearch->set_conditions("org_id={$_GET['org_id']}"); $this->_view->assign('selectedOrgId', $_GET['org_id']); } if ($_GET['user_name']) { $helpSqlSearch->set_conditions("user_name like '{$_GET['user_name']}%'"); $this->_view->assign('selectedUserName', $_GET['user_name']); } if ($_GET['nick_name']) { $nickName = urldecode($_GET['nick_name']); $helpSqlSearch->set_conditions("nick_name like '%{$nickName}%'"); $this->_view->assign('selectedNickName', $nickName); } $helpSqlSearch->set_orderBy('status desc,date_updated desc'); $helpSqlSearch->setPageLimit($_GET['page'], PAGE_SIZE); $conditions = $helpSqlSearch->get_conditions(); $sql = $helpSqlSearch->createSql(); $dataList = $this->_modelUser->select($sql); $helpPage = new Help_Page(array('total' => $this->_modelUser->findCount($conditions), 'perpage' => PAGE_SIZE)); $departmentList = $this->_getGlobalData('department'); $departmentList = Model::getTtwoArrConvertOneArr($departmentList, 'Id', 'name'); $orgList = $this->_getGlobalData('org'); $orgList = Model::getTtwoArrConvertOneArr($orgList, 'Id', 'name'); $rolesList = $this->_modelRoles->findAll(); $rolesList = $this->_modelRoles->getTtwoArrConvertOneArr($rolesList, 'role_value', 'role_name'); if ($dataList) { foreach ($dataList as &$value) { $value['word_department'] = $departmentList[$value['department_id']]; $value['word_org_id'] = $value['org_id'] ? $orgList[$value['org_id']] : '暂无组别'; //转换角色为中文显示 if ($value['roles']) { $value['roles'] = explode(',', $value['roles']); $value['word_roles'] = array(); foreach ($value['roles'] as $tmpRolesList) { array_push($value['word_roles'], $rolesList[$tmpRolesList]); } $value['word_roles'] = implode(',', $value['word_roles']); } else { $value['word_roles'] = '暂无角色'; } $value['date_created'] = date('Y-m-d H:i', $value['date_created']); $value['date_updated'] = date('Y-m-d H:i', $value['date_updated']); $value['url_operator_manage'] = Tools::url(CONTROL, 'UserSetup', array('Id' => $value['Id'], 'doaction' => 'managerOperator')); $value['url_edit'] = Tools::url(CONTROL, ACTION, array('Id' => $value['Id'], 'doaction' => 'edit')); $value['url_del'] = Tools::url(CONTROL, ACTION, array('Id' => $value['Id'], 'user_name' => $value['user_name'], 'doaction' => 'del')); $value['url_Initialize'] = Tools::url(CONTROL, ACTION, array('user_name' => $value['user_name'], 'doaction' => 'initialize')); $value['url_clear_order'] = Tools::url(CONTROL, 'UserClearOrder', array('user_id' => $value['Id'])); $value['url_clear_quality_check'] = Tools::url(CONTROL, 'ClearQualityCheck', array('user_id' => $value['Id'])); $value['url_close'] = Tools::url(CONTROL, ACTION, array('user_id' => $value['Id'], 'doaction' => 'close', 'status' => $value['status'])); $value['url_act'] = Tools::url(CONTROL, ACTION, array('user_id' => $value['Id'], 'doaction' => 'act')); $value['word_status'] = $value['status'] ? '<font color="#00CC00">启用</font>' : '<font color="#FF0000">停用</font>'; $actList = explode(',', $value['act']); $value['act_count'] = end($actList) ? count($actList) : 0; } $this->_view->assign('dataList', $dataList); } $orgList['0'] = '未分组'; $orgList[''] = '所有'; $this->_view->assign('selectOrgList', $orgList); $departmentList[''] = '所有'; $this->_view->assign('selectDepartmentList', $departmentList); $this->_view->assign('pageBox', $helpPage->show()); $this->_view->set_tpl(array('body' => 'User/UserIndex.html')); $this->_utilMsg->createNavBar(); $this->_view->display(); }