本文整理汇总了PHP中BizSystem::getService方法的典型用法代码示例。如果您正苦于以下问题:PHP BizSystem::getService方法的具体用法?PHP BizSystem::getService怎么用?PHP BizSystem::getService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BizSystem
的用法示例。
在下文中一共展示了BizSystem::getService方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insertRecord
public function insertRecord()
{
$recArr = $this->readInputRecord();
$this->setActiveRecord($recArr);
if (count($recArr) == 0) {
return;
}
//generate fast_index
$svcobj = BizSystem::getService("service.chineseService");
if ($svcobj->isChinese($recArr['first_name'])) {
$fast_index = $svcobj->Chinese2Pinyin($recArr['first_name']);
} else {
$fast_index = $recArr['first_name'];
}
$recArr['fast_index'] = substr($fast_index, 0, 1);
try {
$this->ValidateForm();
} catch (ValidationException $e) {
$this->processFormObjError($e->m_Errors);
return;
}
$this->_doInsert($recArr);
// in case of popup form, close it, then rerender the parent form
if ($this->m_ParentFormName) {
$this->close();
$this->renderParent();
}
$this->processPostAction();
}
示例2: _remoteCall
protected function _remoteCall($method, $params = null)
{
$uri = $this->m_ReportServer;
$cache_id = md5($this->m_Name . $uri . $method . serialize($params));
$cacheSvc = BizSystem::getService(CACHE_SERVICE, 1);
$cacheSvc->init($this->m_Name, $this->m_CacheLifeTime);
if (substr($uri, strlen($uri) - 1, 1) != '/') {
$uri .= '/';
}
$uri .= "ws.php/udc/CollectService";
if ($cacheSvc->test($cache_id) && (int) $this->m_CacheLifeTime > 0) {
$resultSetArray = $cacheSvc->load($cache_id);
} else {
try {
$argsJson = urlencode(json_encode($params));
$query = array("method={$method}", "format=json", "argsJson={$argsJson}");
$httpClient = new HttpClient('POST');
foreach ($query as $q) {
$httpClient->addQuery($q);
}
$headerList = array();
$out = $httpClient->fetchContents($uri, $headerList);
$cats = json_decode($out, true);
$resultSetArray = $cats['data'];
$cacheSvc->save($resultSetArray, $cache_id);
} catch (Exception $e) {
$resultSetArray = array();
}
}
return $resultSetArray;
}
示例3: ExportCSV
public function ExportCSV()
{
$eventlogSvc = BizSystem::getService(EVENTLOG_SERVICE);
$eventlogSvc->ExportCSV();
$this->runEventLog();
return true;
}
示例4: resetPassword
/**
* Reset the password
*
* @return void
*/
public function resetPassword()
{
global $g_BizSystem;
$recArr = $this->readInputs();
$this->setActiveRecord($recArr);
if (count($recArr) == 0) {
return;
}
try {
$this->ValidateForm();
if ($this->ValidateEmail($recArr['username'], $recArr['email'])) {
//Init user profile for event logging
$profile = $g_BizSystem->InituserProfile($recArr['username']);
} else {
return;
}
//generate pass_token
$token = $this->GenerateToken($profile);
if ($token) {
//event log
$eventlog = BizSystem::getService(EVENTLOG_SERIVCE);
$logComment = array($username, $_SERVER['REMOTE_ADDR']);
$eventlog->log("USER_MANAGEMENT", "MSG_GET_PASSWORD_TOKEN", $logComment);
//send user email
$emailObj = BizSystem::getService(USER_EMAIL_SERIVCE);
$emailObj->UserResetPassword($token['Id']);
BizSystem::SessionContext()->destroy();
//goto URL
$this->processPostAction();
}
} catch (ValidationException $e) {
$this->processFormObjError($e->m_Errors);
return;
}
}
示例5: resetPassword
public function resetPassword()
{
$currentRec = $this->fetchData();
$recArr = $this->readInputRecord();
$this->setActiveRecord($recArr);
try {
$this->ValidateForm();
} catch (ValidationException $e) {
$this->processFormObjError($e->m_Errors);
return;
}
if (count($recArr) == 0) {
return;
}
$this->_doUpdate($recArr, $currentRec);
$this->rerender();
// if 'notify email' option is checked, send confirmation email to user email address
// ...
// init profile
global $g_BizSystem;
$profile = $g_BizSystem->InitUserProfile($currentRec['username']);
//run eventlog
$eventlog = BizSystem::getService(EVENTLOG_SERIVCE);
$logComment = array($currentRec['username']);
$eventlog->log("USER_MANAGEMENT", "MSG_RESET_PASSWORD_BY_TOKEN", $logComment);
$this->m_Notices[] = $this->GetMessage("USER_DATA_UPDATED");
$this->processPostAction();
}
示例6: _doCreateUser
protected function _doCreateUser()
{
$recArr = $this->readInputRecord();
$this->setActiveRecord($recArr);
if (count($recArr) == 0) {
return;
}
if ($this->_checkDupUsername()) {
$errorMessage = $this->GetMessage("USERNAME_USED");
$errors['fld_username'] = $errorMessage;
$this->processFormObjError($errors);
return;
}
if ($this->_checkDupEmail()) {
$errorMessage = $this->GetMessage("EMAIL_USED");
$errors['fld_email'] = $errorMessage;
$this->processFormObjError($errors);
return;
}
try {
$this->ValidateForm();
} catch (ValidationException $e) {
$this->processFormObjError($e->m_Errors);
return;
}
$recArr['create_by'] = "0";
$recArr['update_by'] = "0";
$password = BizSystem::ClientProxy()->GetFormInputs("fld_password");
$recArr['password'] = hash(HASH_ALG, $password);
$this->_doInsert($recArr);
//set default user role to member
$userinfo = $this->getActiveRecord();
$userRoleObj = BizSystem::getObject('system.do.UserRoleDO');
foreach (BizSystem::getObject('system.do.RoleDO')->directfetch("[default]='1'") as $roleRec) {
$roleId = $roleRec['Id'];
$uesrRoleArr = array("user_id" => $userinfo['Id'], "role_id" => $roleId);
$userRoleObj->insertRecord($uesrRoleArr);
}
//set default group to member
$userGroupObj = BizSystem::getObject('system.do.UserGroupDO');
foreach (BizSystem::getObject('system.do.GroupDO')->directfetch("[default]='1'") as $groupRec) {
$groupId = $groupRec['Id'];
$uesrGroupArr = array("user_id" => $userinfo['Id'], "group_id" => $groupId);
$userGroupObj->insertRecord($uesrGroupArr);
}
//record event log
global $g_BizSystem;
$eventlog = BizSystem::getService(EVENTLOG_SERVICE);
$logComment = array($userinfo['username'], $_SERVER['REMOTE_ADDR']);
$eventlog->log("USER_MANAGEMENT", "MSG_USER_REGISTERED", $logComment);
//send user email
$emailObj = BizSystem::getService(USER_EMAIL_SERVICE);
$emailObj->UserWelcomeEmail($userinfo['Id']);
//init profile for future use like redirect to my account view
$profile = $g_BizSystem->InituserProfile($userinfo['username']);
return $userinfo;
}
示例7: Report
public function Report()
{
//send an email to admin includes error messages;
$system_uuid = BizSystem::getService("system.lib.CubiService")->getSystemUUID();
$report = array("system_uuid" => $system_uuid, "error_info" => $this->m_Errors["system"], "server_info" => $_SERVER, "php_version" => phpversion(), "php_extension" => get_loaded_extensions());
$reportId = BizSystem::getObject("common.lib.ErrorReportService")->report($report);
$this->m_Notices = array("status" => "REPORTED", "report_id" => $reportId);
$this->ReRender();
}
示例8: Report
public function Report()
{
//send an email to admin includes error messages;
$recipient['email'] = $this->m_AdminEmail;
$recipient['name'] = $this->m_AdminName;
$emailObj = BizSystem::getService(USER_EMAIL_SERIVCE);
$emailObj->SystemInternalErrorEmail($recipient, $this->m_Errors["system"]);
$this->m_Notices = array("status" => "REPORTED");
$this->ReRender();
}
示例9: CreateUser
/**
* Create a user record
*
* @return void
*/
public function CreateUser()
{
if ($cfg_siremis_public_registrations == false) {
$errorMessage = "Public registration is not enabled!";
$errors['fld_username'] = $errorMessage;
$this->processFormObjError($errors);
return;
}
$recArr = $this->readInputRecord();
$this->setActiveRecord($recArr);
if (count($recArr) == 0) {
return;
}
if ($this->_checkDupUsername()) {
$errorMessage = $this->GetMessage("USERNAME_USED");
$errors['fld_username'] = $errorMessage;
$this->processFormObjError($errors);
return;
}
if ($this->_checkDupEmail()) {
$errorMessage = $this->GetMessage("EMAIL_USED");
$errors['fld_email'] = $errorMessage;
$this->processFormObjError($errors);
return;
}
try {
$this->ValidateForm();
} catch (ValidationException $e) {
$this->processFormObjError($e->m_Errors);
return;
}
$recArr['create_by'] = "0";
$recArr['update_by'] = "0";
$this->_doInsert($recArr);
//set default user role to sip user
$userinfo = $this->getActiveRecord();
$userRoleObj = BizSystem::getObject('system.do.UserRoleDO');
$uesrRoloArr = array("user_id" => $userinfo['Id'], "role_id" => "3");
$userRoleObj->insertRecord($uesrRoloArr);
//record event log
global $g_BizSystem;
$eventlog = BizSystem::getService(EVENTLOG_SERIVCE);
$logComment = array($userinfo['username'], $_SERVER['REMOTE_ADDR']);
$eventlog->log("USER_MANAGEMENT", "MSG_USER_REGISTERED", $logComment);
//send user email
//$emailObj = BizSystem::getService(USER_EMAIL_SERIVCE);
//$emailObj->UserWelcomeEmail($userinfo['Id']);
//init profile for future use like redirect to my account view
$profile = $g_BizSystem->InituserProfile($userinfo['username']);
$serUserObj = BizSystem::getObject('ser.sbs.authdb.do.SubscriberDO');
$serUserArr = array("username" => $recArr['username'], "domain" => $recArr['domain'], "password" => $recArr['password'], "email_address" => $recArr['email']);
$serUserObj->InsertRecord($serUserArr);
$this->processPostAction();
}
示例10: Login
/**
* login action
*
* @return void
*/
public function Login()
{
$recArr = $this->readInputRecord();
try {
$this->ValidateForm();
} catch (ValidationException $e) {
$this->processFormObjError($e->m_Errors);
return;
}
// get the username and password
$this->username = BizSystem::ClientProxy()->getFormInputs("username");
$this->password = BizSystem::ClientProxy()->getFormInputs("password");
global $g_BizSystem;
$svcobj = BizSystem::getService(AUTH_SERVICE);
$eventlog = BizSystem::getService(EVENTLOG_SERIVCE);
try {
if ($svcobj->authenticateUser($this->username, $this->password)) {
// after authenticate user: 1. init profile
$profile = $g_BizSystem->InitUserProfile($this->username);
// after authenticate user: 2. insert login event
$logComment = array($this->username, $_SERVER['REMOTE_ADDR']);
$eventlog->log("LOGIN", "MSG_LOGIN_SUCCESSFUL", $logComment);
// after authenticate user: 3. update login time in user record
if (!$this->UpdateloginTime()) {
return false;
}
$redirectPage = APP_INDEX . $profile['roleStartpage'][0];
$cookies = BizSystem::ClientProxy()->getFormInputs("session_timeout");
if ($cookies) {
$password = $this->password;
$password = md5(md5($password . $this->username) . md5($profile['create_time']));
setcookie("SYSTEM_SESSION_USERNAME", $this->username, time() + (int) $cookies, "/");
setcookie("SYSTEM_SESSION_PASSWORD", $password, time() + (int) $cookies, "/");
}
if ($profile['roleStartpage'][0]) {
BizSystem::clientProxy()->ReDirectPage($redirectPage);
} else {
parent::processPostAction();
}
return true;
} else {
$logComment = array($this->username, $_SERVER['REMOTE_ADDR'], $this->password);
$eventlog->log("LOGIN", "MSG_LOGIN_FAILED", $logComment);
$errorMessage['password'] = $this->getMessage("PASSWORD_INCORRECT");
$errorMessage['login_status'] = $this->getMessage("LOGIN_FAILED");
$this->processFormObjError($errorMessage);
}
} catch (Exception $e) {
BizSystem::ClientProxy()->showErrorMessage($e->getMessage());
}
}
示例11: getProfileByCookie
protected function getProfileByCookie()
{
if (isset($_COOKIE["SYSTEM_SESSION_USERNAME"]) && isset($_COOKIE["SYSTEM_SESSION_PASSWORD"])) {
$username = $_COOKIE["SYSTEM_SESSION_USERNAME"];
$password = $_COOKIE["SYSTEM_SESSION_PASSWORD"];
$svcobj = BizSystem::getService(AUTH_SERVICE);
if ($svcobj->authenticateUserByCookies($username, $password)) {
$this->InitProfile($username);
} else {
setcookie("SYSTEM_SESSION_USERNAME", null, time() - 100, "/");
setcookie("SYSTEM_SESSION_PASSWORD", null, time() - 100, "/");
}
}
return null;
}
示例12: SwitchSession
public function SwitchSession()
{
if (!BizSystem::allowUserAccess('Session.Switch_Session')) {
if (!BizSystem::sessionContext()->getVar("_PREV_USER_PROFILE")) {
return;
}
}
$data = $this->readInputRecord();
$username = $data['username'];
if (!$username) {
return;
}
$serviceObj = BizSystem::getService(PROFILE_SERVICE);
if (method_exists($serviceObj, 'SwitchUserProfile')) {
$serviceObj->SwitchUserProfile($username);
}
BizSystem::clientProxy()->runClientScript("<script>window.location.reload();</script>");
}
示例13: getSearchRule
public function getSearchRule()
{
$value = BizSystem::clientProxy()->getFormInputs($this->m_Name);
$value = addslashes($value);
//escape sql strings
if ($value != '') {
$searchStr = " [{$this->m_FieldName}] LIKE '%{$value}%' ";
} else {
return "";
}
if ($this->m_SearchFields) {
$fields = $lovService = BizSystem::getService(LOV_SERVICE)->getList($this->m_SearchFields);
foreach ($fields as $opt) {
$field = $opt['val'];
$searchStr .= " OR [{$field}] LIKE '%{$value}%' ";
}
}
$searchStr = "( {$searchStr} )";
return $searchStr;
}
示例14: login
public function login()
{
$username = $_GET['username'];
$password = $_GET['password'];
$svcobj = BizSystem::getService(AUTH_SERVICE);
if ($svcobj->authenticateUser($username, $password)) {
// after authenticate user: 1. init profile
$profile = BizSystem::instance()->InitUserProfile($username);
// after authenticate user: 2. insert login event
$eventlog = BizSystem::getService(EVENTLOG_SERVICE);
$logComment = array($username, $_SERVER['REMOTE_ADDR']);
$eventlog->log("LOGIN", "MSG_LOGIN_SUCCESSFUL", $logComment);
// after authenticate user: 3. update login time in user record
$userObj = BizSystem::getObject('system.do.UserDO');
$userRec = $userObj->fetchOne("[username]='{$username}'");
$userRec['lastlogin'] = date("Y-m-d H:i:s");
$userId = $userRec['Id'];
$userRec->save();
}
$result = array("user_id" => $userId);
return $result;
}
示例15: renderSingleMenuItem
/**
* Render single menu item
* @param array $menuItem menu item metadata xml array
* @return string html content of each menu item
*/
protected function renderSingleMenuItem(&$menuItem)
{
global $g_BizSystem;
$profile = $g_BizSystem->getUserProfile();
$svcobj = BizSystem::getService("accessService");
$role = isset($profile["ROLE"]) ? $profile["ROLE"] : null;
if (array_key_exists('URL', $menuItem["ATTRIBUTES"])) {
$url = $menuItem["ATTRIBUTES"]["URL"];
} elseif (array_key_exists('VIEW', $menuItem["ATTRIBUTES"])) {
$view = $menuItem["ATTRIBUTES"]["VIEW"];
// menuitem's containing VIEW attribute is renderd if access is granted in accessservice.xml
// menuitem's are rendered if no definition is found in accessservice.xml (default)
if ($svcobj->allowViewAccess($view, $role)) {
$url = "javascript:GoToView('" . $view . "')";
} else {
return '';
}
}
$caption = I18n::getInstance()->translate($menuItem["ATTRIBUTES"]["CAPTION"]);
$target = $menuItem["ATTRIBUTES"]["TARGET"];
$icon = $menuItem["ATTRIBUTES"]["ICON"];
$img = $icon ? "<img src='" . Resource::getImageUrl() . "/{$icon}' class=menu_img> " : "";
if ($view) {
$url = "javascript:GoToView('" . $view . "')";
}
if ($target) {
$sHTML .= "<li><a href=\"" . $url . "\" target='{$target}'>{$img}" . $caption . "</a>";
} else {
$sHTML .= "<li><a href=\"" . $url . "\">{$img}" . $caption . "</a>";
}
if ($menuItem["MENUITEM"]) {
$sHTML .= "\n<ul>\n";
$sHTML .= $this->renderMenuItems($menuItem["MENUITEM"]);
$sHTML .= "</ul>";
}
$sHTML .= "</li>\n";
return $sHTML;
}