getTarget('part'); $action = $system->getTarget('action'); ob_start(); include (__DIR__ . __DS__ . 'page.' . $part . '.' . $action . '.php'); $response->setFragment('CONTENT', ob_get_clean()); } public function runList(Response $response) { $system = System::getInstance(); $part = $system->getTarget('part'); $action = $system->getTarget('action'); ob_start(); include (__DIR__ . __DS__ . 'page.' . $part . '.' . $action . '.php'); $response->setFragment('CONTENT', ob_get_clean()); } public function runCreate(Response $response) { $system = System::getInstance(); $part = $system->getTarget('part'); $action = $system->getTarget('action'); ob_start(); include (__DIR__ . __DS__ . 'page.' . $part . '.' . $action . '.php'); $response->setFragment('CONTENT', ob_get_clean()); } public function runCreateUser(Response $response) { $system = System::getInstance(); $db = $system->getDB(); $param = $system->getRequest()->getParam(); $usrSvc = $system->getUserSvc(); $db->isTransactionSupported() and $db->startTransaction(); $usr = new UserDefault(); $usr->login = $param['login']; $usr->email = $param['email']; $usr->masteradmin = isset($param['masteradmin']) && $param['masteradmin'] == 'y' ? true : false; $usr->password = $param['password']; $usrSvc->createUser($usr); $db->isTransactionSupported() and $db->commit(); $response->setRedirectURL(_SELF_ . '?cat=' . $this->getMyRef() . '&action=list'); } public function runEdit(Response $response) { $system = System::getInstance(); $part = $system->getTarget('part'); $action = $system->getTarget('action'); $response->addons[Response::ADDON_JSLIB][] = JQUERY_JS_LIB; $response->addons[Response::ADDON_JSLIB][] = JQUERY_UI_BASE_URL.'jquery-ui.js'; $response->addons[Response::ADDON_CSS][] = JQUERY_UI_BASE_THEMES_URL.'base/jquery-ui.css'; $response->addons[Response::ADDON_CSS][] = JQUERY_UI_BASE_THEMES_URL.'base/jquery.ui.tabs.css'; $response->addons[Response::ADDON_CSS][] = JQUERY_UI_BASE_THEMES_URL.'base/jquery.ui.theme.css'; ob_start(); include (__DIR__ . __DS__ . 'page.' . $part . '.' . $action . '.php'); $response->setFragment('CONTENT', ob_get_clean()); } public function runUpdateUser(Response $response) { $system = System::getInstance(); $db = $system->getDB(); $param = $system->getRequest()->getParam(); $usrSvc = $system->getUserSvc(); $db->isTransactionSupported() and $db->startTransaction(); $id = (int) $param['user']; $usr = $usrSvc->getUser($id); $data = array(); $data['email'] = $param['email']; $data['masteradmin'] = isset($param['masteradmin']) && $param['masteradmin'] == 'y' ? true : false; if(!empty($param['password'])) { if(method_exists($usrSvc, 'genHashedPasswd')) $data['password'] = $usrSvc->genHashedPasswd($param['password'], $usr->seed); else $data['password'] = sha1($param['password']); } $db->table('accounts')->update($data, array('id' => $id)); $acl = (isset($param['acl']) && is_array($param['acl'])) ? $param['acl'] : false; $usrSvc->userClearPriv($usr); if($acl) { foreach($acl as $site=>$instances) { foreach($instances as $inst=>$privs) { foreach($privs as $priv=>$val) $usrSvc->userGrantPriv($usr, $site, $inst, $priv, $val); } } } $db->isTransactionSupported() and $db->commit(); $response->setRedirectURL(_SELF_ . '?cat=' . $this->getMyRef() . '&action=list'); } }