本文整理汇总了PHP中Current_User::isDeity方法的典型用法代码示例。如果您正苦于以下问题:PHP Current_User::isDeity方法的具体用法?PHP Current_User::isDeity怎么用?PHP Current_User::isDeity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Current_User
的用法示例。
在下文中一共展示了Current_User::isDeity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test
public static function test($value, $show_recursive = FALSE)
{
if (DEITY_ONLY_TEST && (!isset($_SESSION['User']) || !class_exists('Current_User') || !Current_User::isDeity())) {
return;
}
if (empty($value)) {
$value = PHPWS_Debug::emptyVal($value);
}
switch (1) {
case is_object($value):
return PHPWS_Debug::testObject($value, 1, $show_recursive);
break;
case is_array($value):
return 'Array' . PHPWS_Debug::testArray($value, 1, $show_recursive);
break;
case is_bool($value):
if ($value) {
return '<pre>bool(TRUE)</pre>';
} else {
return '<pre>bool(FALSE)</pre>';
}
case is_numeric($value):
return '<pre>' . $value . '</pre>';
case is_string($value):
return '<pre>' . preg_replace('/\\n|(\\r\\n)/', '\\n', htmlspecialchars($value)) . '</pre>';
break;
default:
return '<pre>' . $value . '</pre>';
}
}
示例2: checkRequiredFields
public function checkRequiredFields(Internship $i)
{
if (!$i->isSecondaryPart()) {
// Check the course subject
$courseSubj = $i->getSubject();
if (!isset($courseSubj) || $courseSubj == '' || $courseSubj->id == 0) {
throw new MissingDataException("Please select a course subject.");
}
// Check the course number
$courseNum = $i->getCourseNumber();
if (!isset($courseNum) || $courseNum == '') {
throw new MissingDataException("Please enter a course number.");
}
// Check the course section number
$sectionNum = $i->getCourseSection();
if (!isset($sectionNum) || $sectionNum == '') {
throw new MissingDataException("Please enter a course section number.");
}
// Check the course credit hours field
$creditHours = $i->getCreditHours();
if (!isset($creditHours) || $creditHours == '') {
throw new MissingDataException("Please enter the number of course credit hours.");
}
if (!\Current_User::isDeity() && $creditHours <= 0) {
throw new MissingDataException("The number of course credit hours should be greater than zero.");
}
}
}
示例3: execute
/**
* The main function for executing the command.
*/
public function execute()
{
$returnData = array('username' => \Current_User::getUsername(), 'deity' => \Current_User::isDeity(), 'view' => \Current_User::allow('appsync', 'view'), 'purge' => \Current_User::allow('appsync', 'purge'));
// Echo the values back to the front end after encoding them.
echo json_encode($returnData);
exit;
}
示例4: execute
/**
* The main function for executing the command.
*/
public function execute()
{
// Make sure the user has the appropriate permissions to make changes to the permissions settings.
// Basically only deities will have access to permissions.
if (!\Current_User::isDeity()) {
echo json_encode('user does not have permission to retrieve other user information');
exit;
}
// Retrieve the permissions from the database
$permissions = \AppSync\UmbrellaAdminFactory::getAllUmbrellaAdmins();
$userList = array();
$returnData = array();
// For each permission check to see if the username is in the userList array,
// if not then add it to the array
foreach ($permissions as $permission) {
$username = $permission->getUsername();
if (!in_array($username, $userList, true)) {
array_push($userList, $username);
}
}
// For each username add it to an associative array to be sent to the front end
foreach ($userList as $user) {
$node = array('username' => $user);
$returnData[] = $node;
}
echo json_encode($returnData);
exit;
}
示例5: post
public function post(\Request $request)
{
if (!$request->isVar('command')) {
throw new \Exception('Unknown Election command');
}
$command = $request->getVar('command');
switch ($command) {
case 'save':
Factory::post();
break;
case 'delete':
if (\Current_User::isDeity()) {
Factory::delete(Factory::pullPostInteger('electionId'));
} else {
throw new \Exception('Non-deity election deletion not allowed.');
}
break;
case 'saveTitle':
$this->saveTitle();
break;
case 'saveDates':
$this->saveDates();
break;
case 'resetVote':
\election\Factory\Vote::resetVote(Factory::pullPostInteger('electionId'), Factory::pullPostInteger('bannerId'));
break;
default:
throw new \Exception('Unknown Election command');
}
$view = new \View\JsonView(array('success' => true));
$response = new \Response($view);
return $response;
}
示例6: display
public function display()
{
// permissions...
if (!\Current_User::isDeity()) {
\NQ::simple('intern', NotifyUI::ERROR, 'You cannot edit administrators.');
return false;
}
// set up some stuff for the page template
$tpl = array();
// create the list of admins
$adminList = Admin::getAdminPager();
// get the list of departments
$depts = Department::getDepartmentsAssoc();
// make the form for adding a new admin
$form = new \PHPWS_Form('add_admin');
$form->addSelect('department_id', $depts);
$form->setLabel('department_id', 'Department');
$form->addText('username');
$form->setLabel('username', 'Username');
$form->addCheck('all');
$form->setLabel('all', 'All Departments');
$form->addSubmit('submit', 'Create Admin');
$form->setAction('index.php?module=intern&action=edit_admins');
$form->addHidden('add', 1);
// TODO: Add Javascript autocomplete for usernames.
javascript('jquery');
javascript('jquery_ui');
javascriptMod('intern', 'admin');
$tpl['PAGER'] = $adminList;
$form->mergeTemplate($tpl);
return \PHPWS_Template::process($form->getTemplate(), 'intern', 'edit_admin.tpl');
}
示例7: execute
/**
* The main function for executing the command.
*/
public function execute()
{
// Make sure the user has the appropriate permissions to make changes to the permissions settings.
// Basically only deities will have access to permissions.
if (!\Current_User::isDeity()) {
echo json_encode("user does not have permission to change permissions");
exit;
}
// Retrieve the input values from the request
$username = $_REQUEST['username'];
$umbrellaId = $_REQUEST['umbrella'];
// Retrieve the permissions from the database
$permissions = \AppSync\UmbrellaAdminFactory::getUmbrellaAdmin($username, $umbrellaId);
// If they already have permission to the given umbrella, then do nothing, otherwise
// add the permission to their account.
if (sizeof($permissions) == 0) {
$newAdmin = new \AppSync\UmbrellaAdmin(null, $username, $umbrellaId);
\AppSync\UmbrellaAdminFactory::save($newAdmin);
echo json_encode("success");
exit;
} else {
echo json_encode("already exists");
exit;
}
}
示例8: execute
public function execute(CommandContext $context)
{
if (!Current_User::isDeity()) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do not have permission to edit terms.');
}
PHPWS_Core::initModClass('hms', 'PulseEditView.php');
$pulse = new PulseEditView();
$context->setContent($pulse->show());
}
示例9: execute
/**
* The main function for executing the command.
*/
public function execute()
{
// Make sure the user has the appropriate permissions to make changes to the permissions settings.
// Basically only deities will have access to permissions.
if (!\Current_User::isDeity()) {
echo json_encode("user does not have permission to change permissions");
exit;
}
// Retrieve the input values from the request
$username = $_REQUEST['username'];
$umbrellaId = $_REQUEST['umbrella'];
// Remove the permission from the database
\AppSync\UmbrellaAdminFactory::removeUmbrellaAdmin($username, $umbrellaId);
// Echo the fact that it succeeded back to the front end
echo json_encode("success");
exit;
}
示例10: display
/**
* Main display method
*/
public function display()
{
javascript('jquery');
// housekeeping
if (isset($_SESSION['query'])) {
unset($_SESSION['query']);
}
$tags = array();
// Total number of internships for Diety users
if (\Current_User::isDeity()) {
$tags['GRAND_TOTAL_LABEL'] = _('Total Internships in Database: ');
$db = new \PHPWS_DB('intern_internship');
$gt = $db->select('count');
$tags['GRAND_TOTAL'] = $gt;
}
// Example form link
$tags['EXAMPLE_LINK'] = \PHPWS_Text::secureLink('Example form', 'intern', array('action' => 'example_form'));
return \PHPWS_Template::process($tags, 'intern', 'menu.tpl');
}
示例11: execute
/**
* The main function for executing the command.
*/
public function execute()
{
// Make sure the user has the appropriate permissions to access settings.
// Basically only deities will have access to settings.
if (!\Current_User::isDeity()) {
echo json_encode('user does not have permission to retrieve live state');
exit;
}
// Set the variables to base values
$liveUrl = '';
$testUrl = '';
$key = '';
$bannerUrl = '';
// Retrieve the settings from the database
$liveUrlSetting = \AppSync\SettingFactory::getSetting('orgsync_live_url');
$testUrlSetting = \AppSync\SettingFactory::getSetting('orgsync_test_url');
$keySetting = \AppSync\SettingFactory::getSetting('orgsync_key');
$bannerUrlSetting = \AppSync\SettingFactory::getSetting('banner_url');
// If the settings are non null then set the variables, otherwise leave them empty
if ($liveUrlSetting) {
$liveUrl = $liveUrlSetting->getValue();
}
if ($testUrlSetting) {
$testUrl = $testUrlSetting->getValue();
}
if ($keySetting) {
$key = $keySetting->getValue();
}
if ($bannerUrlSetting) {
$bannerUrl = $bannerUrlSetting->getValue();
}
// If the state is not set it, set it to LIVE and use that as the state,
// otherwise use the current state.
if ($_SESSION['state'] != null) {
$state = $_SESSION['state'];
} else {
$state = 'LIVE';
$_SESSION['state'] = 'LIVE';
}
// Echo the values back to the front end after encoding them.
echo json_encode(array('state' => $state, 'liveUrl' => $liveUrl, 'testUrl' => $testUrl, 'key' => $key, 'bannerUrl' => $bannerUrl));
exit;
}
示例12: execute
public function execute()
{
// Make sure the user has the appropriate permissions to make changes to the permissions settings.
// Basically only deities will have access to permissions.
if (!\Current_User::isDeity()) {
echo json_encode('user does not have permission to retrieve permissions');
exit;
}
// Retrieve the permissions from the database
$permissions = \AppSync\UmbrellaAdminFactory::getAllUmbrellaAdmins();
$userList = array();
$returnData = array();
// For each permission if the username is not in the userList array add them
foreach ($permissions as $permission) {
$username = $permission->getUsername();
if (!in_array($username, $userList, true)) {
array_push($userList, $username);
}
}
// For each user in the userList array create a permissionList that will be
// returned to the front end
foreach ($userList as $username) {
$permissionList = "";
$first = true;
foreach ($permissions as $permission) {
if ($permission->getUsername() == $username) {
$umbrella = \AppSync\UmbrellaFactory::getUmbrellaByOrgId($permission->getUmbrellaId());
if ($first) {
$permissionList = $umbrella->getName();
$first = false;
} else {
$permissionList .= ', ' . $umbrella->getName();
}
}
}
$node = array('username' => $username, 'permissions' => $permissionList);
array_push($returnData, $node);
}
// Echo the json encoded data back to the front end.
echo json_encode($returnData);
exit;
}
示例13: execute
/**
* The main function for executing the command.
*/
public function execute()
{
// Make sure the user has the appropriate permissions to make changes to the permissions settings.
// Basically only deities will have access to permissions.
if (!\Current_User::isDeity()) {
echo json_encode("user does not have permission to change permissions");
exit;
}
// Retrieve the umbrellas
$umbrellasResult = \AppSync\UmbrellaFactory::getUmbrellas();
$umbrellas = array();
$i = 0;
// For each umbrella add it to the umbrellas array as an id and a name
foreach ($umbrellasResult as $umbrella) {
$umbrellas[$i]['umbrella_id'] = $umbrella->getOrgSyncId();
$umbrellas[$i]['umbrella_name'] = $umbrella->getName();
$i++;
}
// Echo the json encoded array back to the front end.
echo json_encode($umbrellas);
exit;
}
示例14: getController
public function getController(\Request $request)
{
$cmd = $request->shiftCommand();
if ($cmd == 'admin' && \Current_User::isDeity()) {
$admin = new \pulse\PulseAdminController($this);
return $admin;
} else {
if (!\Settings::get('pulse', 'allow_web_access')) {
exit('Web access to pulse is not allowed.');
}
try {
PulseController::runSchedules($request);
} catch (Exception\PulseException $e) {
PulseFactory::logError($e->getMessage() . "\n" . $e->getFile() . ':' . $e->getLine());
exit('Error: ' . $e->getMessage());
} catch (\Exception $e) {
PulseFactory::logError($e->getMessage() . "\n" . $e->getFile() . ':' . $e->getLine());
exit('An error occurred outside the scope of Pulse.');
}
exit;
}
}
示例15: plug
public static function plug()
{
$tpl = array();
$tpl['HOME_LINK'] = PHPWS_Text::moduleLink('Menu', 'intern');
$tpl['ADD_LINK'] = PHPWS_Text::moduleLink('Add Student', 'intern', array('action' => 'edit_internship'));
$tpl['SEARCH_LINK'] = PHPWS_Text::moduleLink('Search', 'intern', array('action' => 'search'));
$auth = Current_User::getAuthorization();
$tpl['USER_FULL_NAME'] = Current_User::getDisplayName();
$tpl['LOGOUT_URI'] = $auth->logout_link;
$adminOptions = array();
// Edit list of majors
if (Current_User::allow('intern', 'edit_major')) {
$adminOptions['EDIT_MAJORS_LINK'] = PHPWS_Text::secureLink('Edit Undergraduate Majors', 'intern', array('action' => MAJOR_EDIT));
}
// Edit list grad programs
if (Current_User::allow('intern', 'edit_grad_prog')) {
$adminOptions['EDIT_GRAD_LINK'] = PHPWS_Text::secureLink('Edit Graduate Programs', 'intern', array('action' => GRAD_PROG_EDIT));
}
// Edit departments
if (Current_User::allow('intern', 'edit_dept')) {
$adminOptions['EDIT_DEPARTMENTS_LINK'] = PHPWS_Text::secureLink('Edit Departments', 'intern', array('action' => DEPT_EDIT));
}
// Edit list of states
if (Current_User::allow('intern', 'edit_states')) {
$adminOptions['EDIT_STATES_LINK'] = PHPWS_Text::secureLink('Edit States', 'intern', array('action' => STATE_EDIT));
}
if (Current_User::isDeity()) {
$adminOptions['CONTROL_PANEL'] = PHPWS_Text::secureLink('Control Panel', 'controlpanel');
$adminOptions['EDIT_ADMINS_LINK'] = PHPWS_Text::secureLink('Edit Administrators', 'intern', array('action' => 'edit_admins'));
}
// If any admin options were added, them show the dropdown and merge those
// links into the main set of template tags
if (sizeof($adminOptions) > 0) {
$tpl['ADMIN_OPTIONS'] = '';
// dummy var to show dropdown menu in template
$tpl = array_merge($tpl, $adminOptions);
}
Layout::plug(PHPWS_Template::process($tpl, 'intern', 'top.tpl'), 'NAV_LINKS');
}