本文整理匯總了PHP中UserUtil::getPNGroup方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserUtil::getPNGroup方法的具體用法?PHP UserUtil::getPNGroup怎麽用?PHP UserUtil::getPNGroup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserUtil
的用法示例。
在下文中一共展示了UserUtil::getPNGroup方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: canDeleteEvent
/**
* Returns true if the current user can delete the event $event.
*
* @param TimeIt_Model_EventDate $eventDate Event.
*
* @return boolean
*/
public static function canDeleteEvent(TimeIt_Model_EventDate $eventDate)
{
$event = $eventDate['Event'];
// get group names
if ($event['group'] == 'all') {
$groupName = array('all');
// group irrelevant
} else {
$groupNames = array();
foreach (explode(',', $event['group']) as $grpId) {
$groupObj = UserUtil::getPNGroup((int) $grpId);
$groupNames[] = $groupObj['name'];
}
$groupName = $groupNames;
}
// get calendar
$calendar = $eventDate['Calendar'];
// check permissions
if (!SecurityUtil::checkPermission('TimeIt::', '::', ACCESS_DELETE)) {
if (!SecurityUtil::checkPermission('TimeIt:Calendar:', $calendar['id'] . '::', ACCESS_DELETE)) {
$access = false;
foreach ($groupName as $name) {
if (SecurityUtil::checkPermission('TimeIt:Group:', $name . '::', ACCESS_DELETE)) {
$access = true;
}
}
if (!$access) {
if ($calendar != null && $calendar['userCanEditHisEvents'] && $event['cr_uid'] == UserUtil::getVar('uid')) {
return true;
} else {
return false;
}
}
}
}
return true;
}
示例2: getEventPreformat
/**
* Formats an event.
*
* @param array $args Event.
*
* @return array
* @throws InvalidArgumentException In case of invalid parameters.
*/
function getEventPreformat($args)
{
if (!isset($args['obj']) || empty($args['obj'])) {
throw new InvalidArgumentException('$obj arg not set');
}
$obj =& $args['obj'];
//process text format
if (substr($obj['text'], 0, 11) == "#plaintext#") {
$obj['text'] = substr_replace($obj['text'], "", 0, 11);
$obj['text'] = nl2br($obj['text']);
}
// hooks
if (!isset($args['noHooks']) || $args['noHooks'] == false) {
$obj['text'] = ModUtil::callHooks('item', 'transform', '', array($obj['text']));
$obj['text'] = $obj['text'][0];
}
// repeats
if ($obj['repeatType'] == 2) {
$temp = explode(' ', $obj['repeatSpec']);
$obj['repeat21'] = $temp[0];
$obj['repeat22'] = $temp[1];
}
// split duration
$obj['allDayDur'] = explode(',', $obj['allDayDur']);
TimeIt_Util::convertAlldayStartToLocalTime($obj);
// set username
$obj['cr_name'] = UserUtil::getVar('uname', (int) $obj['cr_uid']);
$obj['cr_datetime'] = DateUtil::getDatetime(strtotime($obj['cr_date']), "datetimebrief");
// set group name
if ($obj['group'] == 'all') {
$obj['group_name'] = 'all';
} else {
$groupNames = array();
foreach (explode(',', $obj['group']) as $grpId) {
$groupObj = UserUtil::getPNGroup((int) $grpId);
$groupNames[] = $groupObj['name'];
}
$obj['group_name'] = $groupNames;
}
return $obj;
}