本文整理汇总了PHP中Settings_Roles_Record_Model类的典型用法代码示例。如果您正苦于以下问题:PHP Settings_Roles_Record_Model类的具体用法?PHP Settings_Roles_Record_Model怎么用?PHP Settings_Roles_Record_Model使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Settings_Roles_Record_Model类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public function process(Vtiger_Request $request)
{
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$qualifiedModuleName = $request->getModule(false);
$record = $request->get('record');
$parentRoleId = $request->get('parent_roleid');
$roleDirectlyRelated = false;
if (!empty($record)) {
$recordModel = Settings_Roles_Record_Model::getInstanceById($record);
$viewer->assign('MODE', 'edit');
} else {
$recordModel = new Settings_Roles_Record_Model();
$recordModel->setParent(Settings_Roles_Record_Model::getInstanceById($parentRoleId));
$viewer->assign('MODE', '');
$roleDirectlyRelated = true;
}
$profileId = $recordModel->getDirectlyRelatedProfileId();
if ($profileId) {
$viewer->assign('PROFILE_ID', $profileId);
$roleDirectlyRelated = true;
}
$viewer->assign('PROFILE_DIRECTLY_RELATED_TO_ROLE', $roleDirectlyRelated);
$viewer->assign('ALL_PROFILES', Settings_Profiles_Record_Model::getAll());
$viewer->assign('ROLE_USERS', $recordModel->getUsers());
$viewer->assign('RECORD_MODEL', $recordModel);
$viewer->assign('RECORD_ID', $record);
$viewer->assign('MODULE', $moduleName);
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
$viewer->view('EditView.tpl', $qualifiedModuleName);
}
示例2: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$qualifiedModuleName = $request->getModule(false);
$recordId = $request->get('record');
$roleName = $request->get('rolename');
$allowassignedrecordsto = $request->get('allowassignedrecordsto');
$moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName);
if (!empty($recordId)) {
$recordModel = Settings_Roles_Record_Model::getInstanceById($recordId);
} else {
$recordModel = new Settings_Roles_Record_Model();
}
if ($request->get('profile_directly_related_to_role') == '1') {
$profileId = $request->get('profile_directly_related_to_role_id');
$profileName = $request->get('profilename');
if (empty($profileName)) {
$profileName = $roleName . '+' . vtranslate('LBL_PROFILE', $qualifiedModuleName);
}
if ($profileId) {
$profileRecordModel = Settings_Profiles_Record_Model::getInstanceById($profileId);
} else {
$profileRecordModel = Settings_Profiles_Record_Model::getInstanceByName($profileName, true);
if (empty($profileRecordModel)) {
$profileRecordModel = new Settings_Profiles_Record_Model();
}
}
$profileRecordModel->set('directly_related_to_role', '1');
$profileRecordModel->set('profilename', $profileName)->set('profile_permissions', $request->get('permissions'));
$profileRecordModel->set('viewall', $request->get('viewall'));
$profileRecordModel->set('editall', $request->get('editall'));
$savedProfileId = $profileRecordModel->save();
$roleProfiles = array($savedProfileId);
} else {
$roleProfiles = $request->get('profiles');
}
$parentRoleId = $request->get('parent_roleid');
if ($recordModel && !empty($parentRoleId)) {
$parentRole = Settings_Roles_Record_Model::getInstanceById($parentRoleId);
if (!empty($allowassignedrecordsto)) {
$recordModel->set('allowassignedrecordsto', $allowassignedrecordsto);
}
// set the value of assigned records to
if ($parentRole && !empty($roleName) && !empty($roleProfiles)) {
$recordModel->set('rolename', $roleName);
$recordModel->set('profileIds', $roleProfiles);
$parentRole->addChildRole($recordModel);
}
//After role updation recreating user privilege files
if ($roleProfiles) {
foreach ($roleProfiles as $profileId) {
$profileRecordModel = Settings_Profiles_Record_Model::getInstanceById($profileId);
$profileRecordModel->recalculate(array($recordId));
}
}
}
$redirectUrl = $moduleModel->getDefaultUrl();
header("Location: {$redirectUrl}");
}
示例3: getDisplayValue
/**
* Function to get display value
* @param <String> $value
* @param <Number> $recordId
* @return <String> display value
*/
public function getDisplayValue($value, $recordId)
{
$displayValue = $this->getEditViewDisplayValue($value);
$currentUserModel = Users_Record_Model::getCurrentUserModel();
if ($currentUserModel->isAdminUser()) {
$roleRecordModel = new Settings_Roles_Record_Model();
$roleRecordModel->set('roleid', $value);
return '<a href="' . $roleRecordModel->getEditViewUrl() . '">' . textlength_check($displayValue) . '</a>';
}
return $displayValue;
}
示例4: process
function process(Vtiger_Request $request)
{
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$qualifiedModuleName = $request->getModule(false);
$sourceRecord = $request->get('src_record');
$companyDetails = Vtiger_CompanyDetails_Model::getInstanceById();
$companyLogo = $companyDetails->getLogo();
$sourceRole = Settings_Roles_Record_Model::getInstanceById($sourceRecord);
$rootRole = Settings_Roles_Record_Model::getBaseRole();
$allRoles = Settings_Roles_Record_Model::getAll();
$viewer->assign('SOURCE_ROLE', $sourceRole);
$viewer->assign('ROOT_ROLE', $rootRole);
$viewer->assign('ROLES', $allRoles);
$viewer->assign('VIEW', $request->get('view'));
$viewer->assign('TYPE', $request->get('type'));
$viewer->assign('MODULE_NAME', $moduleName);
$viewer->assign('COMPANY_LOGO', $companyLogo);
$viewer->view('Popup.tpl', $qualifiedModuleName);
}
示例5: process
public function process(Vtiger_Request $request)
{
$viewer = $this->getViewer($request);
$qualifiedModuleName = $request->getModule(false);
$rootRole = Settings_Roles_Record_Model::getBaseRole();
$allRoles = Settings_Roles_Record_Model::getAll();
$viewer->assign('ROOT_ROLE', $rootRole);
$viewer->assign('ROLES', $allRoles);
$viewer->view('Index.tpl', $qualifiedModuleName);
}
示例6: process
public function process(Vtiger_Request $request)
{
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$qualifiedModuleName = $request->getModule(false);
$recordId = $request->get('record');
$recordModel = Settings_Roles_Record_Model::getInstanceById($recordId);
$viewer->assign('MODULE', $moduleName);
$viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
$viewer->assign('RECORD_MODEL', $recordModel);
echo $viewer->view('DeleteTransferForm.tpl', $qualifiedModuleName, true);
}
示例7: checkDuplicate
public function checkDuplicate(Vtiger_Request $request)
{
$roleName = $request->get('rolename');
$recordId = $request->get('record');
$recordModel = Settings_Roles_Record_Model::getInstanceByName($roleName, array($recordId));
$response = new Vtiger_Response();
if (!empty($recordModel)) {
$response->setResult(array('success' => true, 'message' => vtranslate('LBL_DUPLICATES_EXIST', $request->getModule(false))));
} else {
$response->setResult(array('success' => false));
}
$response->emit();
}
示例8: generateMenuAfterModuleDelete
/**
* A function to generating menu files after deleting the module
*/
static function generateMenuAfterModuleDelete()
{
self::log(__CLASS__ . '::' . __METHOD__ . ' | Start');
$menuRecordModel = new Settings_Menu_Record_Model();
$allRoles = Settings_Roles_Record_Model::getAll();
$menuRecordModel->generateFileMenu(0);
foreach ($allRoles as $role) {
$roleId = str_replace('H', '', $role->getId());
if (file_exists('user_privileges/menu_' . $roleId . '.php')) {
$menuRecordModel->generateFileMenu($roleId);
}
}
self::log(__CLASS__ . '::' . __METHOD__ . ' | End');
}
示例9: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$qualifiedModuleName = $request->getModule(false);
$recordId = $request->get('record');
$transferRecordId = $request->get('transfer_record');
$moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName);
$recordModel = Settings_Roles_Record_Model::getInstanceById($recordId);
$transferToRole = Settings_Roles_Record_Model::getInstanceById($transferRecordId);
if ($recordModel && $transferToRole) {
$recordModel->delete($transferToRole);
}
$redirectUrl = $moduleModel->getDefaultUrl();
header("Location: {$redirectUrl}");
}
示例10: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$recordId = $request->get('record');
$parentRoleId = $request->get('parent_roleid');
$parentRole = Settings_Roles_Record_Model::getInstanceById($parentRoleId);
$recordModel = Settings_Roles_Record_Model::getInstanceById($recordId);
$response = new Vtiger_Response();
$response->setEmitType(Vtiger_Response::$EMIT_JSON);
try {
$recordModel->moveTo($parentRole);
} catch (AppException $e) {
$response->setError('Move Role Failed');
}
$response->emit();
}
示例11: process
public function process(Vtiger_Request $request)
{
$log = vglobal('log');
$log->debug("Entering Settings_WidgetsManagement_Configuration_View::process() method ...");
$currentUser = Users_Record_Model::getCurrentUserModel();
$sourceModule = $request->get('sourceModule');
$dashboardModules = Settings_WidgetsManagement_Module_Model::getSelectableDashboard();
if (empty($sourceModule)) {
$sourceModule = 'Home';
}
$moduleName = $request->getModule();
$viewer = $this->getViewer($request);
// get widgets list
$widgets = $dashboardModules[$sourceModule];
$dashboardStored = Settings_WidgetsManagement_Module_Model::getDashboardForModule($sourceModule);
$defaultValues = Settings_WidgetsManagement_Module_Model::getDefaultValues();
$size = Settings_WidgetsManagement_Module_Model::getSize();
$widgetsWithLimit = Settings_WidgetsManagement_Module_Model::getWidgetsWithLimit();
$authorization = Settings_Roles_Record_Model::getAll();
$bloks = Settings_WidgetsManagement_Module_Model::getBlocksId();
$specialWidgets = Settings_WidgetsManagement_Module_Model::getSpecialWidgets($sourceModule);
$filterSelect = Settings_WidgetsManagement_Module_Model::getFilterSelect();
$filterSelectDefault = Settings_WidgetsManagement_Module_Model::getFilterSelectDefault();
$widgetsWithFilterUsers = Settings_WidgetsManagement_Module_Model::getWidgetsWithFilterUsers();
$restrictFilter = Settings_WidgetsManagement_Module_Model::getRestrictFilter();
$viewer->assign('FILTER_SELECT', $filterSelect);
$viewer->assign('FILTER_SELECT_DEFAULT', $filterSelectDefault);
$viewer->assign('WIDGETS_WITH_FILTER_USERS', $widgetsWithFilterUsers);
$viewer->assign('ALL_AUTHORIZATION', $authorization);
$viewer->assign('SELECTED_MODULE_NAME', $sourceModule);
$viewer->assign('SUPPORTED_MODULES', array_keys($dashboardModules));
$viewer->assign('DASHBOARD_AUTHORIZATION_BLOCKS', $bloks[$sourceModule]);
$viewer->assign('WIDGETS_AUTHORIZATION_INFO', $dashboardStored);
$viewer->assign('SPECIAL_WIDGETS', $specialWidgets);
$viewer->assign('CURRENTUSER', $currentUser);
$viewer->assign('WIDGETS', $widgets);
$viewer->assign('SIZE', $size);
$viewer->assign('DEFAULTVALUES', $defaultValues);
$viewer->assign('TITLE_OF_LIMIT', $widgetsWithLimit);
$viewer->assign('QUALIFIED_MODULE', $request->getModule(false));
$viewer->assign('RESTRICT_FILTER', $restrictFilter);
echo $viewer->view('Configuration.tpl', $request->getModule(false), true);
$log->debug("Exiting Settings_WidgetsManagement_Configuration_View::process() method ...");
}
示例12: getGroupsList
function getGroupsList(Vtiger_Request $request)
{
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$currentUser = Users_Record_Model::getCurrentUserModel();
$roleInstance = Settings_Roles_Record_Model::getInstanceById($currentUser->get('roleid'));
$clendarallorecords = $roleInstance->get('clendarallorecords');
switch ($clendarallorecords) {
case 1:
$groups = [];
break;
case 2:
case 3:
default:
$groups = $currentUser->getAccessibleGroups();
break;
}
$viewer->assign('MODULE', $moduleName);
$viewer->assign('ALL_ACTIVEGROUP_LIST', $groups);
$viewer->view('RightPanel.tpl', $moduleName);
}
示例13: process
public function process(Vtiger_Request $request)
{
$sourceModule = $request->get('source_module');
$pickListSupportedModules = Settings_Picklist_Module_Model::getPicklistSupportedModules();
if (empty($sourceModule)) {
//take the first module as the source module
$sourceModule = $pickListSupportedModules[0]->name;
}
$moduleModel = Settings_Picklist_Module_Model::getInstance($sourceModule);
$viewer = $this->getViewer($request);
$qualifiedName = $request->getModule(FALSE);
$viewer->assign('PICKLIST_MODULES', $pickListSupportedModules);
//TODO: see if you needs to optimize this , since its will gets all the fields and filter picklist fields
$pickListFields = $moduleModel->getFieldsByType(array('picklist', 'multipicklist'));
if (count($pickListFields) > 0) {
$selectedPickListFieldModel = reset($pickListFields);
$selectedFieldAllPickListValues = Vtiger_Util_Helper::getPickListValues($selectedPickListFieldModel->getName());
$viewer->assign('PICKLIST_FIELDS', $pickListFields);
$viewer->assign('SELECTED_PICKLIST_FIELDMODEL', $selectedPickListFieldModel);
$viewer->assign('SELECTED_PICKLISTFIELD_ALL_VALUES', $selectedFieldAllPickListValues);
$viewer->assign('ROLES_LIST', Settings_Roles_Record_Model::getAll());
} else {
$viewer->assign('NO_PICKLIST_FIELDS', true);
$createPicklistUrl = '';
$settingsLinks = $moduleModel->getSettingLinks();
foreach ($settingsLinks as $linkDetails) {
if ($linkDetails['linklabel'] == 'LBL_EDIT_FIELDS') {
$createPicklistUrl = $linkDetails['linkurl'];
break;
}
}
$viewer->assign('CREATE_PICKLIST_URL', $createPicklistUrl);
}
$viewer->assign('SELECTED_MODULE_NAME', $sourceModule);
$viewer->assign('QUALIFIED_NAME', $qualifiedName);
$viewer->view('Index.tpl', $qualifiedName);
}
示例14: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$qualifiedModuleName = $request->getModule(false);
$recordId = $request->get('record');
$roleName = $request->get('rolename');
$allowassignedrecordsto = $request->get('allowassignedrecordsto');
$moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName);
if (!empty($recordId)) {
$recordModel = Settings_Roles_Record_Model::getInstanceById($recordId);
} else {
$recordModel = new Settings_Roles_Record_Model();
}
$roleProfiles = $request->get('profiles');
$parentRoleId = $request->get('parent_roleid');
if ($recordModel && !empty($parentRoleId)) {
$parentRole = Settings_Roles_Record_Model::getInstanceById($parentRoleId);
$recordModel->set('change_owner', $request->get('change_owner'))->set('searchunpriv', $request->get('searchunpriv'))->set('listrelatedrecord', $request->get('listRelatedRecord'))->set('previewrelatedrecord', $request->get('previewRelatedRecord'))->set('editrelatedrecord', $request->get('editRelatedRecord'))->set('permissionsrelatedfield', $request->get('permissionsRelatedField'))->set('globalsearchadv', $request->get('globalSearchAdvanced'))->set('clendarallorecords', $request->get('clendarallorecords'));
if (!empty($allowassignedrecordsto)) {
$recordModel->set('allowassignedrecordsto', $allowassignedrecordsto);
}
// set the value of assigned records to
if ($parentRole && !empty($roleName) && !empty($roleProfiles)) {
$recordModel->set('rolename', $roleName);
$recordModel->set('profileIds', $roleProfiles);
$parentRole->addChildRole($recordModel);
}
//After role updation recreating user privilege files
if ($roleProfiles) {
foreach ($roleProfiles as $profileId) {
$profileRecordModel = Settings_Profiles_Record_Model::getInstanceById($profileId);
$profileRecordModel->recalculate(array($recordId));
}
}
}
$redirectUrl = $moduleModel->getDefaultUrl();
header("Location: {$redirectUrl}");
}
示例15: getAllRoles
/**
* Function returns all the User Roles
* @return
*/
public function getAllRoles()
{
$roleModels = Settings_Roles_Record_Model::getAll();
$roles = array();
foreach ($roleModels as $roleId => $roleModel) {
$roleName = $roleModel->getName();
$roles[$roleName] = $roleId;
}
return $roles;
}