本文整理汇总了PHP中BizSystem::sessionContext方法的典型用法代码示例。如果您正苦于以下问题:PHP BizSystem::sessionContext方法的具体用法?PHP BizSystem::sessionContext怎么用?PHP BizSystem::sessionContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BizSystem
的用法示例。
在下文中一共展示了BizSystem::sessionContext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Validate
public function Validate()
{
$formobj = $this->GetFormObj();
BizSystem::sessionContext()->getObjVar($formobj->m_Name, $this->m_Name, $orgValue);
$inputValue = strtoupper($this->getValue());
if ($inputValue == $orgValue) {
return true;
} else {
return false;
}
}
示例2: UpdateRecord
public function UpdateRecord($recArr, $oldRec = null)
{
$l_Profile = BizSystem::sessionContext()->getVar("_USER_PROFILE");
if (!$l_Profile) {
return false;
}
$recArr['username'] = $l_Profile['username'];
$recArr['ha1'] = md5($recArr['username'] . ':' . $recArr['domain'] . ':' . $recArr['password']);
$recArr['ha1b'] = md5($recArr['username'] . '@' . $recArr['domain'] . ':' . $recArr['domain'] . ':' . $recArr['password']);
return parent::UpdateRecord($recArr, $oldRec);
}
示例3: setValue
public function setValue($value)
{
BizSystem::sessionContext()->getObjVar($this->getFormObj()->m_Name, $this->m_Name, $this->m_Value);
$valueArr = $_POST[$this->m_Name];
if (is_array($valueArr)) {
foreach ($valueArr as $key => $value) {
$this->m_Value[$key] = $value;
}
}
BizSystem::sessionContext()->setObjVar($this->getFormObj()->m_Name, $this->m_Name, $this->m_Value);
}
示例4: setPreference
/**
* Set user preference
*
* @param <type> $preference
*/
public function setPreference($attribute, $value = null)
{
$this->m_Preference[$attribute] = $value;
BizSystem::sessionContext()->setVar("_USER_PREFERENCE", $this->m_Preference);
//update user preference to DB
$do = BizSystem::getObject($this->m_PreferenceObj);
if (!$do) {
return false;
}
$user_id = BizSystem::getUserProfile("Id");
$prefRec = $do->fetchOne("[user_id]='{$user_id}' AND [name]='{$attribute}'");
$prefRec['value'] = (string) $value;
return $prefRec->save();
}
示例5: getObject
/**
* Get a metadata based object instance.
* It returns the instance the internal object map or create a new one and save it in the map.
*
* @param string $objName name of object that want to get
* @return object
*/
public function getObject($objName, $new = 0)
{
if (array_key_exists($objName, $this->_objsRefMap) && $new == 0) {
return $this->_objsRefMap[$objName];
}
$obj = $this->constructObject($objName);
if ($obj) {
$this->_objsRefMap[$objName] = $obj;
}
// save object to cache
if (method_exists($obj, "GetSessionVars")) {
$obj->getSessionVars(BizSystem::sessionContext());
}
return $obj;
}
示例6: getProfile
public function getProfile($attr = null)
{
if (!$this->m_Profile) {
$this->m_Profile = BizSystem::sessionContext()->getVar("_USER_PROFILE");
}
if (!$this->m_Profile) {
$this->getProfileByCookie();
if (!$this->m_Profile) {
return null;
}
}
if ($attr && isset($this->m_Profile[$attr])) {
return $this->m_Profile[$attr];
}
return $this->m_Profile;
}
示例7: allowAccess
public static function allowAccess($res_action)
{
//if (aclService::$_accessMatrix)
// return aclService::$_accessMatrix;
// get the access matrix from session
aclService::$_accessMatrix = BizSystem::sessionContext()->getVar("_ACCESS_MATRIX");
if (!aclService::$_accessMatrix || count(aclService::$_accessMatrix) == 0) {
// get user profile
$profile = BizSystem::getUserProfile();
if (!$profile) {
return false;
}
// get the user role id
$roleIds = $profile['roles'];
if (!$roleIds) {
$roleIds[0] = 0;
}
// guest
$roleId_query = implode(",", $roleIds);
// generate the access matrix
$do = BizSystem::getObject(aclService::$role_actionDataObj);
$rs = $do->directFetch("[role_id] in ({$roleId_query})");
if (count($rs) == 0) {
return false;
}
aclService::$_accessMatrix = aclService::GenerateAccessMatrix($rs);
BizSystem::sessionContext()->setVar("_ACCESS_MATRIX", aclService::$_accessMatrix);
}
$accessLevel = self::$_defaultAccess;
// default is deny
if (isset(aclService::$_accessMatrix[$res_action])) {
$accessLevel = aclService::$_accessMatrix[$res_action];
}
switch ($accessLevel) {
case DENY:
// if access level is DENY, return false
return false;
case ALLOW:
// if access level is ALLOW or empty, return true
return true;
case ALLOW_OWNER:
// if access level is ALLOW_OWNER, check the OwnerField and OwnerValue.
// if ownerField's value == ownerValue, return true.
return true;
}
}
示例8: 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>");
}
示例9: render
/**
* BizForm::render() - render this form (return html content), called by bizview's render method (called when form is loaded).
* Query is issued before returning the html content.
*
* @return string - HTML text of this form's read mode
*/
public function render()
{
// when in NEW mode or when parent form in NEW mode, do nothing
global $g_BizSystem;
$prtMode = "";
if ($this->m_ParentFormName) {
$prtForm = BizSystem::getObject($this->m_ParentFormName);
$prtMode = $prtForm->GetDisplayMode()->GetMode();
}
if ($this->m_Mode != MODE_N && $prtMode != MODE_N) {
// get view history
if (!$this->m_NoHistoryInfo) {
$this->SetHistoryInfo(BizSystem::sessionContext()->getViewHistory($this->m_Name));
}
}
if ($this->m_Mode == MODE_N) {
//$this->UpdateActiveRecord($this->getDataObj()->newRecord());
$this->UpdateActiveRecord($this->getNewRecord());
$this->m_QueryONRender = false;
}
//Moved the renderHTML function infront of declaring subforms
$renderedHTML = $this->renderHTML();
global $g_BizSystem;
// prepare the subforms' dataobjs, since the subform relates to parent form by dataobj association
if ($this->m_SubForms) {
foreach ($this->m_SubForms as $subForm) {
$formObj = BizSystem::getObject($subForm);
$dataObj = $this->getDataObj()->getRefObject($formObj->m_DataObjName);
if ($dataObj) {
$formObj->setDataObj($dataObj);
}
}
}
$this->setClientScripts();
return $renderedHTML;
}
示例10: switchUserProfile
/**
*
* @param type $userId
*/
public function switchUserProfile($userId)
{
//get previously profile
if (!BizSystem::sessionContext()->getVar("_PREV_USER_PROFILE")) {
$prevProfile = BizSystem::sessionContext()->getVar("_USER_PROFILE");
BizSystem::sessionContext()->clearVar("_USER_PROFILE");
BizSystem::sessionContext()->setVar("_PREV_USER_PROFILE", $prevProfile);
}
BizSystem::initUserProfile($userId);
}
示例11: getUserProfile
/**
* Get user profile
*
* @param string $attribute user attribute
* @return array user profile array
*/
public static function getUserProfile($attribute = null)
{
$serviceObj = BizSystem::getService(PROFILE_SERVICE);
if (method_exists($serviceObj, 'getProfile')) {
return $serviceObj->getProfile($attribute);
} else {
$profile = BizSystem::sessionContext()->getVar("_USER_PROFILE");
return isset($profile[$attribute]) ? $profile[$attribute] : "";
}
}
示例12: getCurrentTheme
public static function getCurrentTheme()
{
if (Resource::$_currentTheme != null) {
return Resource::$_currentTheme;
}
$currentTheme = "";
if (isset($_GET['theme'])) {
$currentTheme = $_GET['theme'];
}
if ($currentTheme == "") {
$currentTheme = BizSystem::sessionContext()->getVar("THEME");
}
if ($currentTheme == "") {
$currentTheme = BizSystem::getUserPreference("theme");
}
if ($currentTheme == "" && defined('THEME_NAME')) {
$currentTheme = THEME_NAME;
}
if ($currentTheme == "") {
$currentTheme = Resource::DEFAULT_THEME;
}
// TODO: user pereference has language setting
BizSystem::sessionContext()->setVar("THEME", $currentTheme);
Resource::$_currentTheme = $currentTheme;
return $currentTheme;
}
示例13: renderView
/**
* Render a bizview
*
* @param string $viewName name of bizview
* @param string $rule the search rule of a bizform who is not depent on (a subctrl of) another bizform
* @return void
*/
public function renderView($viewName, $form = "", $rule = "", $params = null, $hist = "")
{
global $g_BizSystem;
/* @var $viewObj EasyView */
if ($viewName == "__DynPopup") {
$viewObj = BizSystem::getObject($viewName);
$viewObj->render();
return;
}
// if previous view is different with the to-be-loaded view, clear the previous session objects
$prevViewName = $g_BizSystem->getCurrentViewName();
$prevViewSet = $g_BizSystem->getCurrentViewSet();
// need to set current view before get view object
$g_BizSystem->setCurrentViewName($viewName);
$viewObj = BizSystem::getObject($viewName);
if (!$viewObj) {
return;
}
$viewSet = $viewObj->getViewSet();
$g_BizSystem->setCurrentViewSet($viewSet);
if ($prevViewSet && $viewSet && $prevViewSet == $viewSet) {
// keep prev view session objects if they have same viewset
BizSystem::sessionContext()->clearSessionObjects(true);
} else {
BizSystem::sessionContext()->clearSessionObjects(false);
}
if ($hist == "N") {
// clean view history
$viewObj->CleanViewHistory();
}
if ($form != "" && $rule != "") {
$viewObj->processRule($form, $rule, TRUE);
}
if ($params) {
$viewObj->setParameters($params);
}
if (isset($_GET['mode'])) {
// can specify mode of form
$viewObj->SetFormMode($form, $_GET['mode']);
}
$viewObj->render();
//BizController::hidePageLoading();
}
示例14: function
* @license http://code.google.com/p/openbiz-cubi/wiki/CubiLicense
* @link http://code.google.com/p/openbiz-cubi/
* @version $Id: index.php 5513 2014-06-04 04:34:06Z rockyswen@gmail.com $
*/
/* cubi rest web service entry point
request example:
url
http://host/cubi/rest.php/system/users?start=10&limit=10
*/
include_once 'bin/app_init.php';
include_once OPENBIZ_HOME . "/bin/ErrorHandler.php";
require 'bin/Slim/Slim.php';
\Slim\Slim::registerAutoloader();
$app = new \Slim\Slim();
// start session context object
BizSystem::sessionContext();
// GET form
$app->get('/f/:module/:form(/:id)', function ($module, $form, $id = null) {
$app = \Slim\Slim::getInstance();
// get real form name module.form.formnameView
$realFormName = getFormName($form, $module);
// render view
$formObj = BizSystem::getObject($realFormName);
if (!$formObj) {
// render NOTFOUND_FORM
return;
}
if ($id) {
$formObj->setRequestParams(array('Id' => $id));
}
print $formObj->render();
示例15: ImageColorallocate
$graycolor = ImageColorallocate($im, 102, 102, 102);
switch ($CodeLevel) {
default:
case "1":
for ($i = 0; $i < $CodeLength; $i++) {
//$font = ImageColorAllocate($im, rand(100,255),rand(0,100),rand(100,255));
$authnum = rand(1, 9);
$vcodes .= $authnum;
imagestring($im, 5, 2 + $i * 10, 3, $authnum, $graycolor);
}
break;
case "2":
for ($i = 0; $i < $CodeLength; $i++) {
//$font = ImageColorAllocate($im, rand(100,255),rand(0,100),rand(100,255));
$codebase = "123456789ABCDEFGHIJKLMNPQRSTUVWXYZ";
$codepos = rand(1, strlen($codebase));
$authnum = substr($codebase, $codepos - 1, 1);
$vcodes .= $authnum;
imagestring($im, 5, 2 + $i * 10, 3, $authnum, $graycolor);
}
break;
}
for ($i = 0; $i < 100; $i++) {
//$randcolor = ImageColorallocate($im,rand(0,255),rand(0,255),rand(0,255));
imagesetpixel($im, rand() % 70, rand() % 30, $graycolor);
}
ImagePNG($im);
ImageDestroy($im);
$vcodes = strtoupper($vcodes);
BizSystem::sessionContext()->setObjVar($_GET['form'], $_GET['name'], $vcodes);