本文整理汇总了PHP中Activity::showRoles方法的典型用法代码示例。如果您正苦于以下问题:PHP Activity::showRoles方法的具体用法?PHP Activity::showRoles怎么用?PHP Activity::showRoles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Activity
的用法示例。
在下文中一共展示了Activity::showRoles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
<?php
require "../php/init.php";
$actId = Input::get('id');
if (is_numeric($actId)) {
$outArray = array();
$act = new Activity();
$activityInfo = $act->getAllActivities($actId);
$activityInfo->roles = $act->showRoles($actId);
header("Content-type: application/json");
print json_encode($activityInfo);
}
示例2: User
<?php
require "../php/init.php";
$mainUser = new User();
if (!$mainUser->inRole(1)) {
die('nope. not allowed!');
}
$actId = Input::get('id');
$act = new Activity();
$oldRoles = $act->showRoles($actId);
if ($userData = Input::get('info')) {
$newRoles = $userData['roles'];
unset($userData['roles']);
if (Input::get('add')) {
Activity::addActivity($userData, $newRoles);
} else {
try {
Activity::updateActivity($actId, $userData);
} catch (Exception $e) {
echo $e;
$error = true;
}
if (!$error) {
foreach ($oldRoles as $key => $oldRole) {
if (!in_array($key, $newRoles)) {
Activity::removeRole($actId, $key);
}
}
foreach ($newRoles as $key => $newRole) {
if (!array_key_exists($newRole, $oldRoles)) {
Activity::addRole($actId, $newRole);