本文整理汇总了PHP中Vtiger_Module_Model::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Module_Model::getAll方法的具体用法?PHP Vtiger_Module_Model::getAll怎么用?PHP Vtiger_Module_Model::getAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Module_Model
的用法示例。
在下文中一共展示了Vtiger_Module_Model::getAll方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAll
/**
* Static Function to get all the accessible menu models with/without ordering them by sequence
* @param <Boolean> $sequenced - true/false
* @return <Array> - List of Vtiger_Menu_Model instances
*/
public static function getAll($sequenced = false)
{
global $log;
$log->debug("Entering ./models/Menu.php::staticgetAll");
$currentUser = Users_Record_Model::getCurrentUserModel();
$userPrivModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
$restrictedModulesList = array('Emails', 'ProjectMilestone', 'ProjectTask', 'ModComments', 'ExtensionStore', 'ExtensionStorePro', 'Integration', 'Dashboard', 'Home', 'vtmessages', 'vttwitter');
$allModules = parent::getAll(array('0', '2'));
$menuModels = array();
$moduleSeqs = array();
$moduleNonSeqs = array();
foreach ($allModules as $module) {
if ($module->get('tabsequence') != -1) {
$moduleSeqs[$module->get('tabsequence')] = $module;
} else {
$moduleNonSeqs[] = $module;
}
}
ksort($moduleSeqs);
$modules = array_merge($moduleSeqs, $moduleNonSeqs);
foreach ($modules as $module) {
if (($userPrivModel->isAdminUser() || $userPrivModel->hasGlobalReadPermission() || $userPrivModel->hasModulePermission($module->getId())) & !in_array($module->getName(), $restrictedModulesList) && $module->get('parent') != '') {
$menuModels[$module->getName()] = $module;
}
}
return $menuModels;
}
示例2: modulesValues
/**
* Getting value to display
* @return array
*/
public function modulesValues()
{
$modules = Vtiger_Module_Model::getAll([0], [], true);
foreach ($modules as $module) {
$modulesNames[] = ['module' => $module->getName(), 'name' => $module->getName(), 'id' => $module->getName()];
}
return $modulesNames;
}
示例3: getSupportedModules
public static function getSupportedModules() {
$moduleModels = Vtiger_Module_Model::getAll(array(0,2));
$supportedModuleModels = array();
foreach($moduleModels as $tabId => $moduleModel) {
if($moduleModel->isEntityModule() && $moduleModel->getName() != 'Webmails') {
$supportedModuleModels[$tabId] = $moduleModel;
}
}
return $supportedModuleModels;
}
示例4: getSupportedModules
public static function getSupportedModules()
{
$moduleModels = Vtiger_Module_Model::getAll(array(0, 2));
$supportedModuleModels = array();
foreach ($moduleModels as $tabId => $moduleModel) {
if ($moduleModel->isWorkflowSupported()) {
$supportedModuleModels[$tabId] = $moduleModel;
}
}
return $supportedModuleModels;
}
示例5: getSupportedModules
public static function getSupportedModules()
{
$moduleModels = Vtiger_Module_Model::getAll([0, 2]);
$supportedModuleModels = [];
foreach ($moduleModels as $tabId => $moduleModel) {
if ($moduleModel->isEntityModule()) {
$supportedModuleModels[$tabId] = $moduleModel;
}
}
return $supportedModuleModels;
}
示例6: getSupportedModules
public static function getSupportedModules()
{
$restrictedModules = ['OSSMailView'];
$moduleModels = Vtiger_Module_Model::getAll([0, 2]);
$supportedModuleModels = [];
foreach ($moduleModels as $tabId => $moduleModel) {
if ($moduleModel->isEntityModule() && !in_array($moduleModel->getName(), $restrictedModules)) {
$supportedModuleModels[$tabId] = $moduleModel;
}
}
return $supportedModuleModels;
}
示例7: getListTpl
public function getListTpl($moduleName, $parentId = 0, $forTpl = false)
{
$db = PearDatabase::getInstance();
$sql = "SELECT * FROM vtiger_oss_project_templates WHERE module = ? AND parent = ?";
$result = $db->pquery($sql, array($moduleName, $parentId), true);
$output = array();
for ($i = 0; $i < $db->num_rows($result); $i++) {
$record = $db->raw_query_result_rowdata($result, $i);
$idTpl = $record['id_tpl'];
$fldName = $record['fld_name'];
$output[$idTpl][$fldName] = $record['fld_val'];
}
$userProfileList = $this->getCurrentUserProfile();
if (count($output) && $forTpl) {
foreach ($output as $key => $value) {
$profile = json_decode($output[$key]['oss_project_visibility']);
if (!is_array($profile)) {
if (!in_array($profile, $userProfileList)) {
unset($output[$key]);
}
} else {
$state = array();
for ($i = 0; $i < count($profile); $i++) {
if (in_array($profile[$i], $userProfileList)) {
$state[] = true;
} else {
$state[] = false;
}
}
if (!in_array(true, $state)) {
unset($output[$key]);
}
}
}
}
$menuModelsList = Vtiger_Module_Model::getAll([1]);
if (array_key_exists(getTabid('Project'), $menuModelsList)) {
unset($output);
}
return $output;
}
示例8: save
public function save()
{
$db = PearDatabase::getInstance();
$modulePermissions = $this->getModulePermissions();
$profileName = $this->get('profilename');
$description = $this->get('description');
$profilePermissions = $this->get('profile_permissions');
$calendarModule = Vtiger_Module_Model::getInstance('Calendar');
$eventModule = Vtiger_Module_Model::getInstance('Events');
$eventFieldsPermissions = $profilePermissions[$eventModule->getId()]['fields'];
$profilePermissions[$eventModule->getId()] = $profilePermissions[$calendarModule->getId()];
$profilePermissions[$eventModule->getId()]['fields'] = $eventFieldsPermissions;
$isProfileDirectlyRelatedToRole = 0;
$isNewProfile = false;
if ($this->has('directly_related_to_role')) {
$isProfileDirectlyRelatedToRole = $this->get('directly_related_to_role');
}
$profileId = $this->getId();
if (!$profileId) {
$profileId = $db->getUniqueId('vtiger_profile');
$this->setId($profileId);
$sql = 'INSERT INTO vtiger_profile(profileid, profilename, description, directly_related_to_role) VALUES (?,?,?,?)';
$params = array($profileId, $profileName, $description, $isProfileDirectlyRelatedToRole);
$isNewProfile = true;
} else {
$sql = 'UPDATE vtiger_profile SET profilename=?, description=?, directly_related_to_role=? WHERE profileid=?';
$params = array($profileName, $description, $isProfileDirectlyRelatedToRole, $profileId);
$db->pquery('DELETE FROM vtiger_profile2globalpermissions WHERE profileid=?', array($profileId));
}
$db->pquery($sql, $params);
$sql = 'INSERT INTO vtiger_profile2globalpermissions(profileid, globalactionid, globalactionpermission) VALUES (?,?,?)';
$params = array($profileId, Settings_Profiles_Module_Model::GLOBAL_ACTION_VIEW, $this->tranformInputPermissionValue($this->get('viewall')));
$db->pquery($sql, $params);
$sql = 'INSERT INTO vtiger_profile2globalpermissions(profileid, globalactionid, globalactionpermission) VALUES (?,?,?)';
$params = array($profileId, Settings_Profiles_Module_Model::GLOBAL_ACTION_EDIT, $this->tranformInputPermissionValue($this->get('editall')));
$db->pquery($sql, $params);
$allModuleModules = Vtiger_Module_Model::getAll(array(0), Settings_Profiles_Module_Model::getNonVisibleModulesList());
$allModuleModules[$eventModule->getId()] = $eventModule;
if (count($allModuleModules) > 0) {
$actionModels = Vtiger_Action_Model::getAll(true);
foreach ($allModuleModules as $tabId => $moduleModel) {
if ($moduleModel->isActive()) {
$this->saveModulePermissions($moduleModel, $profilePermissions[$moduleModel->getId()]);
} else {
$permissions = array();
$permissions['is_permitted'] = Settings_Profiles_Module_Model::IS_PERMITTED_VALUE;
if ($moduleModel->isEntityModule()) {
$permissions['actions'] = array();
foreach ($actionModels as $actionModel) {
if ($actionModel->isModuleEnabled($moduleModel)) {
$permissions['actions'][$actionModel->getId()] = Settings_Profiles_Module_Model::IS_PERMITTED_VALUE;
}
}
$permissions['fields'] = array();
$moduleFields = $moduleModel->getFields();
foreach ($moduleFields as $fieldModel) {
if ($fieldModel->isEditEnabled()) {
$permissions['fields'][$fieldModel->getId()] = Settings_Profiles_Record_Model::PROFILE_FIELD_READWRITE;
} elseif ($fieldModel->isViewEnabled()) {
$permissions['fields'][$fieldModel->getId()] = Settings_Profiles_Record_Model::PROFILE_FIELD_READONLY;
} else {
$permissions['fields'][$fieldModel->getId()] = Settings_Profiles_Record_Model::PROFILE_FIELD_INACTIVE;
}
}
}
$this->saveModulePermissions($moduleModel, $permissions);
}
}
}
if ($isNewProfile) {
$this->saveUserAccessbleFieldsIntoProfile2Field();
}
$this->recalculate();
return $profileId;
}
示例9: getCustomViewList
public function getCustomViewList()
{
$db = PearDatabase::getInstance();
$list = $db->query('SELECT cvid,viewname,entitytype,vtiger_tab.tabid FROM vtiger_customview LEFT JOIN vtiger_tab ON vtiger_tab.name = vtiger_customview.entitytype');
$filters = $db->getArray($list);
foreach (Vtiger_Module_Model::getAll() as $module) {
$filterDir = 'modules' . DIRECTORY_SEPARATOR . $module->get('name') . DIRECTORY_SEPARATOR . 'filters';
if (file_exists($filterDir)) {
$fileFilters = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($filterDir, FilesystemIterator::SKIP_DOTS));
foreach ($fileFilters as $filter) {
$name = str_replace('.php', '', $filter->getFilename());
$handlerClass = Vtiger_Loader::getComponentClassName('Filter', $name, $module->get('name'));
if (class_exists($handlerClass)) {
$filters[] = [
'viewname' => $handler->getViewName(),
'cvid' => $name,
'entitytype' => $module->get('name'),
'tabid' => $module->getId(),
];
}
}
}
}
return $filters;
}
示例10: getSupportedModules
public static function getSupportedModules()
{
$supportedModuleModels = Vtiger_Module_Model::getAll(array(0, 2));
return $supportedModuleModels;
}
示例11: getAll
/**
* Static Function to get the instance of Vtiger Module Model for all the modules
* @return <Array> - List of Vtiger Module Model or sub class instances
*/
public static function getAll()
{
return parent::getAll(array(0, 1), self::getNonVisibleModulesList());
}
示例12: getAll
/**
* Static Function to get the instance of Vtiger Module Model for all the modules
* @return <Array> - List of Vtiger Module Model or sub class instances
*/
public static function getAll($presence = [], $restrictedModulesList = [], $isEntityType = false)
{
return parent::getAll(array(0, 1), self::getNonVisibleModulesList());
}