本文整理汇总了PHP中PHPWS_Core::getModules方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPWS_Core::getModules方法的具体用法?PHP PHPWS_Core::getModules怎么用?PHP PHPWS_Core::getModules使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPWS_Core
的用法示例。
在下文中一共展示了PHPWS_Core::getModules方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: forwardInfo
private static function forwardInfo()
{
$url = PHPWS_Core::getCurrentUrl();
if ($url == 'index.php' || $url == '') {
return;
}
if (UTF8_MODE) {
$preg = '/[^\\w\\-\\pL]/u';
} else {
$preg = '/[^\\w\\-]/';
}
// Should ignore the ? and everything after it
$qpos = strpos($url, '?');
if ($qpos !== FALSE) {
$url = substr($url, 0, $qpos);
}
$aUrl = explode('/', preg_replace('|/+$|', '', $url));
$module = array_shift($aUrl);
$mods = PHPWS_Core::getModules(true, true);
if (!in_array($module, $mods)) {
$GLOBALS['Forward'] = $module;
return;
}
if (preg_match('/[^\\w\\-]/', $module)) {
return;
}
$_REQUEST['module'] = $_GET['module'] =& $module;
$count = 1;
$continue = 1;
$i = 0;
// Try and save some old links references
if (count($aUrl) == 1) {
$_GET['id'] = $_REQUEST['id'] = $aUrl[0];
return;
}
while (isset($aUrl[$i])) {
$key = $aUrl[$i];
if (!$i && is_numeric($key)) {
$_GET['id'] = $key;
return;
}
$i++;
if (isset($aUrl[$i])) {
$value = $aUrl[$i];
if (preg_match('/&/', $value)) {
$remain = explode('&', $value);
$j = 1;
$value = $remain[0];
while (isset($remain[$j])) {
$sub = explode('=', $remain[$j]);
$_REQUEST[$sub[0]] = $_GET[$sub[0]] = $sub[1];
$j++;
}
}
$_GET[$key] = $_REQUEST[$key] = $value;
}
$i++;
}
}
示例2: removeAssociations
/**
* Looks for the user.php in an installed module's inc folder.
* If found, it runs the public function within.
*/
public function removeAssociations()
{
$modules = PHPWS_Core::getModules(true, true);
foreach ($modules as $mod) {
$file = sprintf('%smod/%s/inc/remove_user.php', PHPWS_SOURCE_DIR, $mod);
if (is_file($file)) {
require_once $file;
$function_name = $mod . '_remove_user';
if (function_exists($function_name)) {
$function_name($this->id);
}
}
}
}
示例3: setPermissions
public static function setPermissions($id)
{
$group = new PHPWS_Group($id, FALSE);
$modules = PHPWS_Core::getModules();
foreach ($modules as $mod) {
$preorder[$mod['title']] = $mod;
}
ksort($preorder);
$modules = $preorder;
$tpl = new PHPWS_Template('users');
$tpl->setFile('forms/permissions.tpl');
$group->loadPermissions(FALSE);
foreach ($modules as $mod) {
$mod_template = User_Form::modulePermission($mod, $group);
if ($mod_template == false) {
continue;
}
$tpl->setCurrentBlock('module');
$tpl->setData($mod_template);
$tpl->parseCurrentBlock('module');
}
$form = new PHPWS_Form();
$form->addHidden('module', 'users');
$form->addHidden('action', 'admin');
$form->addHidden('command', 'postPermission');
$form->addHidden('group_id', $id);
$form->addSubmit('update', dgettext('users', 'Update'));
$form->addCssClass('update', 'btn btn-primary');
$template = $form->getTemplate();
$vars['action'] = 'admin';
if (!$group->user_id) {
$vars['group_id'] = $group->id;
$vars['command'] = 'manageMembers';
$links[] = PHPWS_Text::secureLink(dgettext('users', 'Members'), 'users', $vars);
$vars['command'] = 'edit_group';
$links[] = PHPWS_Text::secureLink(dgettext('users', 'Edit'), 'users', $vars);
} else {
$vars['user_id'] = $group->user_id;
$vars['command'] = 'editUser';
$links[] = PHPWS_Text::secureLink('<i class="fa fa-edit"></i> ' . dgettext('users', 'Edit'), 'users', $vars, null, dgettext('users', 'Edit user'), 'btn btn-success');
}
$template['LINKS'] = implode(' ', $links);
$template['CHECK_ALL'] = javascriptMod('users', 'check_all', $vars);
$tpl->setData($template);
$content = $tpl->get();
return $content;
}
示例4: dropPermissions
public function dropPermissions()
{
$modules = PHPWS_Core::getModules(true, true);
if (empty($modules)) {
return false;
}
foreach ($modules as $mod) {
$permTable = Users_Permission::getPermissionTableName($mod);
$db = new PHPWS_DB($permTable);
if (!$db->isTable($permTable)) {
continue;
}
$db->addWhere('group_id', $this->id);
PHPWS_Error::logIfError($db->delete());
$db = new PHPWS_DB('phpws_key_edit');
$db->addWhere('group_id', $this->id);
PHPWS_Error::logIfError($db->delete());
$db = new PHPWS_DB('phpws_key_view');
$db->addWhere('group_id', $this->id);
PHPWS_Error::logIfError($db->delete());
}
return true;
}