当前位置: 首页>>代码示例>>PHP>>正文


PHP Region::GetMediaNodeList方法代码示例

本文整理汇总了PHP中Region::GetMediaNodeList方法的典型用法代码示例。如果您正苦于以下问题:PHP Region::GetMediaNodeList方法的具体用法?PHP Region::GetMediaNodeList怎么用?PHP Region::GetMediaNodeList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Region的用法示例。


在下文中一共展示了Region::GetMediaNodeList方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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'));
 }
开发者ID:fignew,项目名称:xibo-cms,代码行数:52,代码来源:rest.class.php

示例2: LayoutInformation

 /**
  * Returns an array containing all the layouts particulars
  * @param int $layoutId The layout ID
  */
 public function LayoutInformation($layoutId)
 {
     Debug::LogEntry('audit', '[IN]', 'layout', 'LayoutInformation');
     // The array to ultimately return
     $info = array();
     $info['regions'] = array();
     try {
         $dbh = PDOConnect::init();
         $sth = $dbh->prepare('SELECT * FROM `layout` WHERE layoutid = :layout_id');
         $sth->execute(array('layout_id' => $layoutId));
         $rows = $sth->fetchAll();
         if (count($rows) <= 0) {
             $this->ThrowError(__('Unable to find layout'));
         }
         $row = $rows[0];
         $info['layout'] = Kit::ValidateParam($row['layout'], _STRING);
         $modifiedDt = new DateTime($row['modifiedDT']);
         $info['updated'] = $modifiedDt->getTimestamp();
     } catch (Exception $e) {
         Debug::LogEntry('error', $e->getMessage());
         if (!$this->IsError()) {
             $this->SetError(1, __('Unknown Error'));
         }
         return false;
     }
     // Get the width and height
     $xml = new DOMDocument();
     $xml->loadXML($row['xml']);
     // get the width and the height
     $info['width'] = $xml->documentElement->getAttribute('width');
     $info['height'] = $xml->documentElement->getAttribute('height');
     // Use the Region class to help
     Kit::ClassLoader('region');
     // Dummy User Object
     $user = new User($this->db);
     $user->userid = 0;
     $user->usertypeid = 1;
     // Take the layout, loop through its regions, check them and call LayoutInformation on all media in them.
     $info['regions'] = $this->GetRegionList($layoutId);
     if (count($info['regions']) <= 0) {
         return $info;
     }
     // Loop through each and build an array
     foreach ($info['regions'] as &$region) {
         $region['media'] = array();
         Debug::LogEntry('audit', 'Assessing Region: ' . $region['regionid'], 'layout', 'LayoutInformation');
         // Create a layout object
         $regionObject = new Region($this->db);
         $mediaNodes = $regionObject->GetMediaNodeList($layoutId, $region['regionid']);
         // Create a data set to see if there are any requirements to serve an updated date time
         Kit::ClassLoader('dataset');
         $dataSetObject = new DataSet($this->db);
         foreach ($mediaNodes as $mediaNode) {
             $node = array('mediaid' => $mediaNode->getAttribute('id'), 'lkid' => $mediaNode->getAttribute('lkid'), 'mediatype' => $mediaNode->getAttribute('type'), 'render' => $mediaNode->getAttribute('render'), 'userid' => $mediaNode->getAttribute('userid'), 'updated' => $info['updated']);
             // DataSets are a special case. We want to get the last updated time from the dataset.
             $dataSet = $dataSetObject->GetDataSetFromLayout($layoutId, $region['regionid'], $mediaNode->getAttribute('id'));
             if (count($dataSet) == 1) {
                 $node['updated'] = $dataSet[0]['LastDataEdit'];
             }
             // Put this node vertically in the region time-line
             $region['media'][] = $node;
         }
         Debug::LogEntry('audit', 'Finished with Region', 'layout', 'LayoutInformation');
     }
     return $info;
 }
开发者ID:taphier,项目名称:xibo-cms,代码行数:70,代码来源:layout.data.class.php

示例3: 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 . '&regionid=' . $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 . '&regionid=' . $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 . '&regionid=' . $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 . '&regionid=' . $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 . '&regionid=' . $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();
 }
开发者ID:fignew,项目名称:xibo-cms,代码行数:70,代码来源:timeline.class.php

示例4: Timeline

 /**
  * Shows the TimeLine
  */
 public function Timeline()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $response->html = '';
     $layoutId = Kit::GetParam('layoutid', _GET, _INT);
     $regionId = Kit::GetParam('regionid', _REQUEST, _STRING);
     // Make sure we have permission to edit this region
     Kit::ClassLoader('region');
     $region = new region($db);
     $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);
     }
     // Library location
     $libraryLocation = Config::GetSetting('LIBRARY_LOCATION');
     // Present a canvas with 2 columns, left column for the media icons
     $buttons = array();
     // Always output a Library assignment button
     $buttons[] = array('id' => 'media_button_library', 'url' => 'index.php?p=content&q=LibraryAssignForm&layoutid=' . $layoutId . '&regionid=' . $regionId, 'text' => __('Library'));
     // Get a list of the enabled modules and then create buttons for them
     if (!($enabledModules = new ModuleManager($db, $user))) {
         trigger_error($enabledModules->message, E_USER_ERROR);
     }
     // Loop through the buttons we have and output each one
     while ($modulesItem = $enabledModules->GetNextModule()) {
         $mod = Kit::ValidateParam($modulesItem['Module'], _STRING);
         $caption = Kit::ValidateParam($modulesItem['Name'], _STRING);
         $mod = strtolower($mod);
         $title = Kit::ValidateParam($modulesItem['Description'], _STRING);
         $img = Kit::ValidateParam($modulesItem['ImageUri'], _STRING);
         $buttons[] = array('id' => 'media_button_' . $mod, 'url' => 'index.php?p=module&q=Exec&mod=' . $mod . '&method=AddForm&layoutid=' . $layoutId . '&regionid=' . $regionId, 'text' => __($caption));
     }
     Theme::Set('media_buttons', $buttons);
     $response->html .= '<div class="container-fluid">';
     $response->html .= '<div class="row-fluid">';
     $response->html .= Theme::RenderReturn('layout_designer_form_timeline');
     // Load the XML for this layout and region, we need to get the media nodes.
     // These form the timeline and go in the right column
     // Generate an ID for the list (this is passed into the reorder function)
     $timeListMediaListId = uniqid('timelineMediaList_');
     $response->html .= '<div class="span10">';
     $response->html .= '<div id="timelineControl" class="timelineColumn" layoutid="' . $layoutId . '" regionid="' . $regionId . '">';
     $response->html .= '    <div class="timelineMediaVerticalList">';
     $response->html .= '        <ul id="' . $timeListMediaListId . '" class="timelineSortableListOfMedia">';
     // How are we going to colour the bars, my media type or my permissions
     $timeBarColouring = Config::GetSetting('REGION_OPTIONS_COLOURING');
     // Create a layout object
     $region = new Region($db);
     foreach ($region->GetMediaNodeList($layoutId, $regionId) as $mediaNode) {
         // Put this node vertically in the region timeline
         $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;
         }
         Debug::LogEntry('audit', sprintf('Permission Granted to View MediaID: %s', $mediaId), 'layout', 'TimeLine');
         // Create a media module to handle all the complex stuff
         require_once "modules/{$mediaType}.module.php";
         $tmpModule = new $mediaType($db, $user, $mediaId, $layoutId, $regionId, $lkId);
         $mediaName = $tmpModule->GetName();
         $transitionIn = $tmpModule->GetTransition('in');
         $transitionOut = $tmpModule->GetTransition('out');
         // Colouring for the media block
         if ($timeBarColouring == 'Permissions') {
             $mediaBlockColouringClass = 'timelineMediaItemColouring_' . ($auth->edit ? 'enabled' : 'disabled');
         } else {
             $mediaBlockColouringClass = 'timelineMediaItemColouring_' . $mediaType;
         }
         // Create the list item
         $response->html .= '<li class="timelineMediaListItem" mediaid="' . $mediaId . '" lkid="' . $lkId . '">';
         // In transition
         $response->html .= '    <div class="timelineMediaInTransition">';
         if ($transitionIn != 'None') {
             $response->html .= '<span>' . $transitionIn . '</span>';
         }
         $response->html .= '    </div>';
         // Media Bar
         $response->html .= '    <div class="timelineMediaItem">';
         $response->html .= '        <ul class="timelineMediaItemLinks">';
         // Create some links
         if ($auth->edit) {
             $response->html .= '<li><a class="XiboFormButton timelineMediaBarLink" href="index.php?p=module&mod=' . $mediaType . '&q=Exec&method=EditForm&layoutid=' . $layoutId . '&regionid=' . $regionId . '&mediaid=' . $mediaId . '&lkid=' . $lkId . '" title="' . __('Click to edit this media') . '">' . __('Edit') . '</a></li>';
         }
         if ($auth->del) {
             $response->html .= '<li><a class="XiboFormButton timelineMediaBarLink" href="index.php?p=module&mod=' . $mediaType . '&q=Exec&method=DeleteForm&layoutid=' . $layoutId . '&regionid=' . $regionId . '&mediaid=' . $mediaId . '&lkid=' . $lkId . '" title="' . __('Click to delete this media') . '">' . __('Delete') . '</a></li>';
         }
         if ($auth->modifyPermissions) {
             $response->html .= '<li><a class="XiboFormButton timelineMediaBarLink" href="index.php?p=module&mod=' . $mediaType . '&q=Exec&method=PermissionsForm&layoutid=' . $layoutId . '&regionid=' . $regionId . '&mediaid=' . $mediaId . '&lkid=' . $lkId . '" title="Click to change permissions for this media">' . __('Permissions') . '</a></li>';
//.........这里部分代码省略.........
开发者ID:abbeet,项目名称:server39,代码行数:101,代码来源:timeline.class.php

示例5: LayoutInformation

 /**
  * Returns an array containing all the layouts particulars
  * @param int $layoutId The layout ID
  */
 public function LayoutInformation($layoutId)
 {
     Debug::LogEntry('audit', '[IN]', 'layout', 'LayoutInformation');
     // The array to ultimately return
     $info = array();
     $info['regions'] = array();
     // Use the Region class to help
     Kit::ClassLoader('region');
     // Dummy User Object
     $user = new User($this->db);
     $user->userid = 0;
     $user->usertypeid = 1;
     // Take the layout, loop through its regions, check them and call LayoutInformation on all media in them.
     $info['regions'] = $this->GetRegionList($layoutId);
     if (count($info['regions']) <= 0) {
         return $info;
     }
     // Loop through each and build an array
     foreach ($info['regions'] as &$region) {
         $region['media'] = array();
         Debug::LogEntry('audit', 'Assessing Region: ' . $region['regionid'], 'layout', 'LayoutInformation');
         // Create a layout object
         $regionObject = new Region($this->db);
         $mediaNodes = $regionObject->GetMediaNodeList($layoutId, $region['regionid']);
         foreach ($mediaNodes as $mediaNode) {
             // Put this node vertically in the region timeline
             $region['media'][] = array('mediaid' => $mediaNode->getAttribute('id'), 'lkid' => $mediaNode->getAttribute('lkid'), 'mediatype' => $mediaNode->getAttribute('type'));
         }
         Debug::LogEntry('audit', 'Finished with Region', 'layout', 'LayoutInformation');
     }
     return $info;
 }
开发者ID:abbeet,项目名称:server39,代码行数:36,代码来源:layout.data.class.php


注:本文中的Region::GetMediaNodeList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。