本文整理汇总了PHP中Region::GetOwnerId方法的典型用法代码示例。如果您正苦于以下问题:PHP Region::GetOwnerId方法的具体用法?PHP Region::GetOwnerId怎么用?PHP Region::GetOwnerId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Region
的用法示例。
在下文中一共展示了Region::GetOwnerId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: LayoutRegionTimelineList
/**
* List the items on a region timeline
* @return <XiboAPIResponse>
*/
public function LayoutRegionTimelineList()
{
if (!$this->user->PageAuth('layout')) {
return $this->Error(1, 'Access Denied');
}
$layoutId = $this->GetParam('layoutId', _INT);
$regionId = $this->GetParam('regionId', _STRING);
// Does the user have permissions to view this region?
if (!$this->user->LayoutAuth($layoutId)) {
return $this->Error(1, 'Access Denied');
}
// Create a region object
Kit::ClassLoader('region');
$region = new Region();
// Region Assignment needs the Owner Id
$ownerId = $region->GetOwnerId($layoutId, $regionId);
$regionAuth = $this->user->RegionAssignmentAuth($ownerId, $layoutId, $regionId, true);
if (!$regionAuth->edit) {
return $this->Error(1, 'Access Denied');
}
// We have permission to be here.
// Return a list of media items
if (!($items = $region->GetMediaNodeList($layoutId, $regionId))) {
return false;
}
$regionItems = array();
foreach ($items as $mediaNode) {
// Get the Type, ID, duration, etc (the generic information)
$mediaItem['mediaid'] = $mediaNode->getAttribute('id');
$mediaItem['lkid'] = $mediaNode->getAttribute('lkid');
$mediaItem['mediatype'] = $mediaNode->getAttribute('type');
$mediaItem['mediaduration'] = $mediaNode->getAttribute('duration');
$mediaItem['mediaownerid'] = $mediaNode->getAttribute('userId');
// Permissions for this assignment
$auth = $this->user->MediaAssignmentAuth($mediaItem['mediaownerid'], $layoutId, $regionId, $mediaItem['mediaid'], true);
// Skip over media assignments that we do not have permission to see
if (!$auth->view) {
continue;
}
$mediaItem['permission_edit'] = (int) $auth->edit;
$mediaItem['permissions_del'] = (int) $auth->del;
$mediaItem['permissions_update_duration'] = (int) $auth->modifyPermissions;
$mediaItem['permissions_update_permissions'] = (int) $auth->modifyPermissions;
// Add these items to an array
$regionItems[] = $mediaItem;
}
return $this->Respond($this->NodeListFromArray($regionItems, 'media'));
}
示例2: TimelineGridView
public function TimelineGridView()
{
$user =& $this->user;
$response = new ResponseManager();
$layoutId = Kit::GetParam('layoutid', _POST, _INT);
$regionId = Kit::GetParam('regionid', _POST, _STRING);
// Make sure we have permission to edit this region
Kit::ClassLoader('region');
$region = new Region();
$ownerId = $region->GetOwnerId($layoutId, $regionId);
$regionAuth = $this->user->RegionAssignmentAuth($ownerId, $layoutId, $regionId, true);
if (!$regionAuth->edit) {
trigger_error(__('You do not have permissions to edit this region'), E_USER_ERROR);
}
// Load the XML for this layout and region, we need to get the media nodes.
$region = new Region();
$cols = array(array('name' => 'order', 'title' => __('Order')), array('name' => 'name', 'title' => __('Name')), array('name' => 'type', 'title' => __('Type')), array('name' => 'duration', 'title' => __('Duration')), array('name' => 'transition', 'title' => __('Transition')));
Theme::Set('table_cols', $cols);
$rows = array();
$i = 0;
foreach ($region->GetMediaNodeList($layoutId, $regionId) as $mediaNode) {
// Construct an object containing all the layouts, and pass to the theme
$row = array();
// Put this node vertically in the region time line
$mediaId = $mediaNode->getAttribute('id');
$lkId = $mediaNode->getAttribute('lkid');
$mediaType = $mediaNode->getAttribute('type');
$mediaDuration = $mediaNode->getAttribute('duration');
$ownerId = $mediaNode->getAttribute('userId');
// Permissions for this assignment
$auth = $user->MediaAssignmentAuth($ownerId, $layoutId, $regionId, $mediaId, true);
// Skip over media assignments that we do not have permission to see
if (!$auth->view) {
continue;
}
$i++;
// Create a media module to handle all the complex stuff
$tmpModule = ModuleFactory::load($mediaType, $layoutId, $regionId, $mediaId, $lkId, $this->db, $this->user);
$mediaName = $tmpModule->GetName();
$row['order'] = $i;
$row['name'] = $mediaName == '' ? __($tmpModule->displayType) : $mediaName;
$row['type'] = __($tmpModule->displayType);
$row['duration'] = sprintf('%d seconds', $mediaDuration);
$row['transition'] = sprintf('%s / %s', $tmpModule->GetTransition('in'), $tmpModule->GetTransition('out'));
if ($auth->edit) {
$row['buttons'][] = array('id' => 'timeline_button_edit', 'url' => 'index.php?p=module&mod=' . $mediaType . '&q=Exec&method=EditForm&layoutid=' . $layoutId . '®ionid=' . $regionId . '&mediaid=' . $mediaId . '&lkid=' . $lkId . '"', 'text' => __('Edit'));
}
if ($auth->del) {
$row['buttons'][] = array('id' => 'timeline_button_delete', 'url' => 'index.php?p=module&mod=' . $mediaType . '&q=Exec&method=DeleteForm&layoutid=' . $layoutId . '®ionid=' . $regionId . '&mediaid=' . $mediaId . '&lkid=' . $lkId . '"', 'text' => __('Remove'), 'multi-select' => true, 'dataAttributes' => array(array('name' => 'multiselectlink', 'value' => 'index.php?p=module&mod=' . $mediaType . '&q=Exec&method=DeleteMedia'), array('name' => 'rowtitle', 'value' => $row['name']), array('name' => 'layoutid', 'value' => $layoutId), array('name' => 'regionid', 'value' => $regionId), array('name' => 'mediaid', 'value' => $mediaId), array('name' => 'lkid', 'value' => $lkId), array('name' => 'options', 'value' => 'unassign')));
}
if ($auth->modifyPermissions) {
$row['buttons'][] = array('id' => 'timeline_button_permissions', 'url' => 'index.php?p=module&mod=' . $mediaType . '&q=Exec&method=PermissionsForm&layoutid=' . $layoutId . '®ionid=' . $regionId . '&mediaid=' . $mediaId . '&lkid=' . $lkId . '"', 'text' => __('Permissions'));
}
if (count($this->user->TransitionAuth('in')) > 0) {
$row['buttons'][] = array('id' => 'timeline_button_trans_in', 'url' => 'index.php?p=module&mod=' . $mediaType . '&q=Exec&method=TransitionEditForm&type=in&layoutid=' . $layoutId . '®ionid=' . $regionId . '&mediaid=' . $mediaId . '&lkid=' . $lkId . '"', 'text' => __('In Transition'));
}
if (count($this->user->TransitionAuth('out')) > 0) {
$row['buttons'][] = array('id' => 'timeline_button_trans_in', 'url' => 'index.php?p=module&mod=' . $mediaType . '&q=Exec&method=TransitionEditForm&type=out&layoutid=' . $layoutId . '®ionid=' . $regionId . '&mediaid=' . $mediaId . '&lkid=' . $lkId . '"', 'text' => __('Out Transition'));
}
$rows[] = $row;
}
// Store the table rows
Theme::Set('table_rows', $rows);
Theme::Set('gridId', Kit::GetParam('gridId', _REQUEST, _STRING));
// Initialise the theme and capture the output
$output = Theme::RenderReturn('table_render');
$response->SetGridResponse($output);
$response->initialSortColumn = 1;
$response->Respond();
}