本文整理汇总了PHP中BizSystem::getUserProfile方法的典型用法代码示例。如果您正苦于以下问题:PHP BizSystem::getUserProfile方法的具体用法?PHP BizSystem::getUserProfile怎么用?PHP BizSystem::getUserProfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BizSystem
的用法示例。
在下文中一共展示了BizSystem::getUserProfile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSystemUserData
public function getSystemUserData($sendContact = 1)
{
//sendContact = 0 ; don't send contact info
//sendContact = 1 ; send contact info
$contactRec = array();
if ($sendContact) {
$profileId = BizSystem::getUserProfile("profile_Id");
$recArr = BizSystem::getObject("contact.do.ContactDO")->fetchById($profileId);
$contactRec['name'] = $recArr['display_name'];
$contactRec['company'] = $recArr['company'];
$contactRec['email'] = $recArr['email'];
$contactRec['mobile'] = $recArr['mobile'];
$contactRec['phone'] = $recArr['phone'];
}
$system_uuid = $this->getSystemUUID();
$system_name = DEFAULT_SYSTEM_NAME;
$system_language = DEFAULT_LANGUAGE;
$system_url = SITE_URL;
$system_cubi_ver = $this->getVersion();
$system_openbiz_ver = BizSystem::getVersion();
$system_port = $_SERVER['SERVER_PORT'];
$system_admin = $_SERVER['SERVER_ADMIN'];
$internal_ip_address = $_SERVER['SERVER_ADDR'];
if (function_exists("ioncube_server_data")) {
$server_data = ioncube_server_data();
} else {
$server_data = "";
}
$systemRec = array("internal_ipaddr" => $internal_ip_address, "language" => $system_language, "system_name" => $system_name, "system_uuid" => $system_uuid, "system_url" => $system_url, "system_admin" => $system_admin, "system_port" => $system_port, "system_cubi_ver" => $system_cubi_ver, "system_openbiz_ver" => $system_openbiz_ver, "system_server_data" => $server_data);
$params = array("contact_data" => $contactRec, "system_data" => $systemRec);
return $params;
}
示例2: validateInputs
protected function validateInputs($inputRecord)
{
$errors = null;
if (strlen($inputRecord->password_old) < 4) {
$errors["password_old"] = "Old password needs to longer than 4 characters";
}
if (strlen($inputRecord->password_new) < 4) {
$errors["password_new"] = "New password needs to longer than 4 characters";
}
if (strlen($inputRecord->password_repeat) < 4) {
$errors["password_repeat"] = "Repeat password needs to longer than 4 characters";
}
if ($errors) {
throw new ValidationException($errors);
}
$profile = BizSystem::getUserProfile();
$userId = $profile['Id'];
$username = $profile['username'];
//check old password
$old_password = $inputRecord->password_old;
$svcobj = BizSystem::getService(AUTH_SERVICE);
$result = $svcobj->authenticateUser($username, $old_password);
if (!$result) {
$errors = array("password_old" => "Input password does not match user current password");
throw new ValidationException($errors);
}
// check repeat password
$password_new = $inputRecord->password_new;
$password_repeat = $inputRecord->password_repeat;
if ($password_new != $password_repeat) {
$errors = array("password_repeat" => "Repeat password is not same as the password");
throw new ValidationException($errors);
}
return true;
}
示例3: outputAttrs
public function outputAttrs()
{
$profile = BizSystem::getUserProfile();
$userId = $profile['Id'];
$output = parent::outputAttrs();
$output['queryString'] = "Id=" . $userId;
return $output;
}
示例4: fetchData
public function fetchData()
{
$url = $_SERVER['REQUEST_URI'];
$roleStartpages = BizSystem::getUserProfile("roleStartpage");
$default_url = APP_INDEX . $roleStartpages[0];
if ($url == $default_url) {
$this->m_isDefaultPage = 1;
} else {
$this->m_isDefaultPage = 0;
}
return parent::fetchData();
}
示例5: group
public static function group($groupIdField)
{
// get current user's group list
$userProfile = BizSystem::getUserProfile();
//print_r($userProfile);
if (!$userProfile || !$userProfile['groups']) {
return "[" . $groupIdField . "] is null";
}
$userId = $userProfile['Id'];
$groupList = implode(",", $userProfile['groups']);
return "[" . $groupIdField . "] in (" . $groupList . ")";
}
示例6: getStatus
public function getStatus()
{
$result = array();
$userId = BizSystem::getUserProfile("Id");
if ($userId) {
$result['login_status'] = 1;
$result['display_name'] = BizSystem::getUserProfile("profile_display_name");
$result['email'] = BizSystem::getUserProfile("email");
} else {
$result['login_status'] = 0;
}
return $result;
}
示例7: reorderWidgets
public function reorderWidgets()
{
$sortorder = BizSystem::clientProxy()->getFormInputs('_widgets');
// get the widgets ordering of columns
parse_str($sortorder, $output);
$columns = array();
$columnCounts = array();
$n = 0;
foreach ($output as $k => $val) {
if (strpos($k, 'column') === 0) {
$columns[$n] = explode(",", $val);
$columnCounts[$n] = count($columns[$n]);
$n++;
}
}
//print_r($columns);
// update ordering of all user_widget records
$userWidgetDo = BizSystem::getObject($this->userWidgetDOName);
$userWidgetTable = $userWidgetDo->m_MainTable;
$db = $userWidgetDo->getDbConnection();
$myProfile = BizSystem::getUserProfile();
$myUserId = $myProfile['Id'];
$currentView = BizSystem::instance()->getCurrentViewName();
$m = 1;
foreach ($columns as $column) {
$n = 1;
foreach ($column as $widgetName) {
if (empty($widgetName)) {
continue;
}
// remove "_widget" from the widget name
$widgetName = str_replace("_widget", "", $widgetName);
// find the widget by name in the current view, set the new order
$searchRule = "[user_id]={$myUserId} and [widget]='{$widgetName}' and [view]='{$currentView}'";
$record = $userWidgetDo->fetchOne($searchRule);
$ordering = $n * 10;
if ($record) {
// update the order
$data = array('column' => $m, 'ordering' => $ordering);
$db->update($userWidgetTable, $data, "id=" . $record['Id']);
} else {
// insert a record with the order
$data = array('user_id' => $myUserId, 'widget' => $widgetName, 'view' => $currentView, 'column' => $m, 'ordering' => $ordering);
$db->insert($userWidgetTable, $data);
}
$n++;
}
$m++;
}
}
示例8: 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();
}
示例9: processUserInit
public function processUserInit()
{
$prefService = BizSystem::getService(PREFERENCE_SERVICE);
$userId = BizSystem::getUserProfile("Id");
$currentView = $this->getViewObject()->m_Name;
if ($currentView != 'myaccount.view.ResetPasswordView' && !isset($_GET['force']) && (int) $prefService->getPreference("force_change_passwd") == 1) {
BizSystem::clientProxy()->redirectPage(APP_INDEX . '/myaccount/reset_password/force');
return true;
}
if ($currentView != 'myaccount.view.MyProfileView' && !isset($_GET['force']) && (int) $prefService->getPreference("force_complete_profile") == 1) {
BizSystem::clientProxy()->redirectPage(APP_INDEX . '/myaccount/my_profile/force');
return true;
}
return false;
}
示例10: allowAccess
public static function allowAccess($res_action)
{
if (!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;
}
// user not login
// get the user role id
$roleIds = $profile['roles'];
if (!$roleIds) {
$roleIds[0] = 0;
}
// guest
$roleId_query = implode(",", $roleIds);
// generate the access matrix
/* @var $do BizDataObj */
$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;
}
}
示例11: getSelectFrom
protected function getSelectFrom()
{
$formobj = $this->getFormObj();
if (!BizSystem::allowUserAccess("data_assign.assign_to_other")) {
$groups = BizSystem::getUserProfile("groups");
if ($groups) {
$ids = implode(",", $groups);
$selectFrom = $this->m_SelectFrom . ",[Id] IN ({$ids})";
} else {
$selectFrom = $this->m_SelectFrom;
}
} else {
$selectFrom = $this->m_SelectFrom;
}
return Expression::evaluateExpression($selectFrom, $formobj);
}
示例12: addWidget
protected function addWidget($widgetName)
{
// add widget to user_widget table
$userWidgetDo = BizSystem::getObject($this->userWidgetDOName);
$userWidgetTable = $userWidgetDo->m_MainTable;
$db = $userWidgetDo->getDbConnection();
$myProfile = BizSystem::getUserProfile();
$myUserId = $myProfile['Id'];
$currentView = BizSystem::instance()->getCurrentViewName();
$searchRule = "[user_id]={$myUserId} and [widget]='{$widgetName}' and [view]='{$currentView}'";
$record = $userWidgetDo->fetchOne($searchRule);
if ($record) {
BizSystem::clientProxy()->showClientAlert("The widget {$widgetName} is already on the page.");
} else {
$data = array('user_id' => $myUserId, 'widget' => $widgetName, 'view' => $currentView, 'ordering' => 0);
$db->insert($userWidgetTable, $data);
}
}
示例13: audit
/**
* Audit DataObj
*
* @param string $dataObjName
* @return boolean
* @todo all return false? really?
*/
public function audit($dataObjName)
{
// get audit dataobj
$auditDataObj = BizSystem::getObject($this->m_AuditDataObj);
if (!$auditDataObj) {
return false;
}
// get the source dataobj
$srcDataObj = BizSystem::getObject($dataObjName);
if (!$srcDataObj) {
return false;
}
// for each onaudit field, add a record in audit dataobj
$auditFields = $srcDataObj->getOnAuditFields();
foreach ($auditFields as $field) {
if ($field->m_OldValue == $field->m_Value) {
continue;
}
$recArr = $auditDataObj->newRecord();
if ($recArr == false) {
BizSystem::log(LOG_ERR, "DATAOBJ", $auditDataObj->getErrorMessage());
return false;
}
$profile = BizSystem::getUserProfile();
$recArr['DataObjName'] = $dataObjName;
$recArr['ObjectId'] = $srcDataObj->getFieldValue("Id");
$recArr['FieldName'] = $field->m_Name;
$recArr['OldValue'] = $field->m_OldValue;
$recArr['NewValue'] = $field->m_Value;
$recArr['ChangeTime'] = date("Y-m-d H:i:s");
$recArr['ChangeBy'] = $profile["USERID"];
$recArr['ChangeFrom'] = $_SERVER['REMOTE_ADDR'];
$recArr['RequestURI'] = $_SERVER['REQUEST_URI'];
$recArr['Timestamp'] = date("Y-m-d H:i:s");
$ok = $auditDataObj->insertRecord($recArr);
if ($ok == false) {
BizSystem::log(LOG_ERR, "DATAOBJ", $auditDataObj->getErrorMessage());
return false;
}
}
}
示例14: getSearchRule
public function getSearchRule()
{
$value = BizSystem::clientProxy()->getFormInputs($this->m_Name);
$searchRule = "";
$my_user_id = BizSystem::getUserProfile("Id");
$user_groups = BizSystem::GetUserProfile('groups');
if (count($user_groups)) {
$group_id_range = implode(",", $user_groups);
$group_where = " ( [group_id] IN ({$group_id_range} ) )";
}
if (count($user_groups)) {
$group_id_range = implode(",", $user_groups);
$other_where = " ( [group_id] NOT IN ({$group_id_range} ) )";
}
switch ((int) $value) {
case 1:
if ($this->hasOwnerField()) {
$searchRule = "([create_by]= '{$my_user_id}' OR [owner_id]='{$my_user_id}')";
} else {
$searchRule = "([create_by]= '{$my_user_id}')";
}
break;
case 2:
$searchRule = "({$group_where} and [create_by]!= '{$my_user_id}')";
break;
case 3:
$searchRule = "({$other_where} and [create_by] != '{$my_user_id}' )";
break;
case 4:
$searchRule = "([create_by]= '{$my_user_id}')";
break;
case 5:
$searchRule = "([create_by] != '{$my_user_id}' AND [owner_id] = '{$my_user_id}' )";
break;
case 6:
$searchRule = "([create_by] = '{$my_user_id}' AND [owner_id] != '{$my_user_id}' )";
break;
}
return $searchRule;
}
示例15: allowDisplay
protected function allowDisplay($user_id)
{
if (BizSystem::allowUserAccess("data_manage.manage")) {
return true;
}
//get user acl info
$actionRec = BizSystem::getObject("system.do.AclActionDO")->fetchOne("[module]='common' AND [resource]='data_assign' AND [action]='accept_other_assigned'");
$actionId = $actionRec['Id'];
if (!$actionId) {
//the system doesnt support accept_other_assigned feature then return true;
return true;
}
//get list of all roles which enabled this action
$roleList = BizSystem::getObject("system.do.AclRoleActionDO")->directFetch("[action_id]='{$actionId}' AND ([access_level]='1' OR [access_level]='2')");
foreach ($roleList as $roleRec) {
$roleId = $roleRec['role_id'];
//check if target user has this role
$AssocRecs = BizSystem::getObject("system.do.UserRoleDO")->directFetch("[role_id]='{$roleId}' AND [user_id]='{$user_id}'");
if ($AssocRecs->count()) {
return true;
}
}
//if we are in same group return true
//get user groups info
$user_id = (int) $user_id;
$groups = BizSystem::getUserProfile("groups");
$groupset = BizSystem::getObject("system.do.UserGroupDO")->directFetch("[user_id]='{$user_id}'");
foreach ($groupset as $groupRec) {
$user_group_id = $groupRec['group_id'];
foreach ($groups as $group_id) {
if ($group_id == $user_group_id) {
return true;
}
}
}
return false;
}