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


PHP Layout::LayoutInformation方法代码示例

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


在下文中一共展示了Layout::LayoutInformation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Permissions


//.........这里部分代码省略.........
                 trigger_error(__('Unable to set permissions'));
             }
             // Store
             $permissions[] = array('groupId' => $lastGroupId, 'view' => $view, 'edit' => $edit, 'del' => $del);
             // Reset
             $lastGroupId = $groupId;
             $view = 0;
             $edit = 0;
             $del = 0;
         }
         switch ($groupPermission[1]) {
             case 'view':
                 $view = 1;
                 break;
             case 'edit':
                 $edit = 1;
                 break;
             case 'del':
                 $del = 1;
                 break;
         }
     }
     // Need to do the last one
     if (!$first) {
         if (!$security->Link($campaignId, $lastGroupId, $view, $edit, $del)) {
             trigger_error(__('Unable to set permissions'));
         }
         $permissions[] = array('groupId' => $lastGroupId, 'view' => $view, 'edit' => $edit, 'del' => $del);
     }
     $replaceInLayouts = Kit::GetParam('replaceInLayouts', _POST, _CHECKBOX);
     if ($replaceInLayouts) {
         Debug::LogEntry('audit', 'Permissions to push down: ' . json_encode($permissions), get_class(), __FUNCTION__);
         // Layout object to deal with layout information
         Kit::ClassLoader('layout');
         $layoutObject = new Layout($db);
         // Get all layouts for this Campaign
         foreach ($this->user->LayoutList(NULL, array('campaignId' => $campaignId)) as $layout) {
             // Set for ease of use
             $layoutId = $layout['layoutid'];
             Debug::LogEntry('audit', 'Processing permissions for layout id' . $layoutId, get_class(), __FUNCTION__);
             // Set the permissions on this layout (if its not the same one!)
             if ($layout['campaignid'] != $campaignId) {
                 // Set permissions on this Layout
                 $auth = $this->user->CampaignAuth($layout['campaignid'], true);
                 if ($auth->modifyPermissions) {
                     if (!$security->UnlinkAll($layout['campaignid'])) {
                         continue;
                     }
                     foreach ($permissions as $permission) {
                         $security->Link($layout['campaignid'], $permission['groupId'], $permission['view'], $permission['edit'], $permission['del']);
                     }
                 }
             }
             // Get all regions and media and set permissions on those too
             $layoutInformation = $layoutObject->LayoutInformation($layoutId);
             // Region and Media Security Class
             Kit::ClassLoader('layoutregiongroupsecurity');
             Kit::ClassLoader('layoutmediagroupsecurity');
             $layoutSecurity = new LayoutRegionGroupSecurity($this->db);
             $layoutMediaSecurity = new LayoutMediaGroupSecurity($this->db);
             foreach ($layoutInformation['regions'] as $region) {
                 // Make sure we have permission
                 $regionAuth = $this->user->RegionAssignmentAuth($region['ownerid'], $layoutId, $region['regionid'], true);
                 if (!$regionAuth->modifyPermissions) {
                     continue;
                 }
                 // Set the permissions on the region
                 // Unlink all
                 if (!$layoutSecurity->UnlinkAll($layoutId, $region['regionid'])) {
                     continue;
                 }
                 foreach ($permissions as $permission) {
                     if (!$layoutSecurity->Link($layoutId, $region['regionid'], $permission['groupId'], $permission['view'], $permission['edit'], $permission['del'])) {
                         trigger_error($layoutSecurity->GetErrorMessage(), E_USER_ERROR);
                     }
                 }
                 // Find all media nodes
                 foreach ($region['media'] as $media) {
                     $originalUserId = $media['userid'] == '' ? $layout['ownerid'] : $media['userid'];
                     // Make sure we have permission
                     $mediaAuth = $this->user->MediaAssignmentAuth($originalUserId, $layoutId, $region['regionid'], $media['mediaid'], true);
                     if (!$mediaAuth->modifyPermissions) {
                         continue;
                     }
                     // Set the permissions on the media node
                     if (!$layoutMediaSecurity->UnlinkAll($layoutId, $region['regionid'], $media['mediaid'])) {
                         continue;
                     }
                     foreach ($permissions as $permission) {
                         if (!$layoutMediaSecurity->Link($layoutId, $region['regionid'], $media['mediaid'], $permission['groupId'], $permission['view'], $permission['edit'], $permission['del'])) {
                             trigger_error($layoutMediaSecurity->GetErrorMessage(), E_USER_ERROR);
                         }
                     }
                 }
             }
         }
     }
     $response->SetFormSubmitResponse(__('Permissions Changed'));
     $response->Respond();
 }
开发者ID:fignew,项目名称:xibo-cms,代码行数:101,代码来源:campaign.class.php

示例2: RequiredFiles


//.........这里部分代码省略.........
         $path = Kit::ValidateParam($row['path'], _STRING);
         $id = Kit::ValidateParam($row['id'], _STRING);
         $md5 = Kit::ValidateParam($row['MD5'], _HTMLSTRING);
         $fileSize = Kit::ValidateParam($row['FileSize'], _INT);
         $background = Kit::ValidateParam($row['background'], _STRING);
         $xml = Kit::ValidateParam($row['xml'], _HTMLSTRING);
         if ($recordType == 'layout') {
             // For layouts the MD5 column is the layout xml
             $fileSize = strlen($xml);
             if ($this->isAuditing == 1) {
                 Debug::LogEntry("audit", 'MD5 for layoutid ' . $id . ' is: [' . $md5 . ']', "xmds", "RequiredFiles");
             }
         } else {
             if ($recordType == 'media') {
                 // If they are empty calculate them and save them back to the media.
                 if ($md5 == '' || $fileSize == 0) {
                     $md5 = md5_file($libraryLocation . $path);
                     $fileSize = filesize($libraryLocation . $path);
                     // Update the media record with this information
                     $SQL = sprintf("UPDATE media SET `MD5` = '%s', FileSize = %d WHERE MediaID = %d", $md5, $fileSize, $id);
                     if (!$db->query($SQL)) {
                         trigger_error($db->error());
                     }
                 }
             } else {
                 continue;
             }
         }
         // Add the file node
         $file = $requiredFilesXml->createElement("file");
         $file->setAttribute("type", $recordType);
         $file->setAttribute("path", $path);
         $file->setAttribute("id", $id);
         $file->setAttribute("size", $fileSize);
         $file->setAttribute("md5", $md5);
         $fileElements->appendChild($file);
         // If this is a layout type and there is a background then add the background node
         // TODO: We need to alter the layout table to have a background ID rather than a path
         // TODO: We need to alter the background edit method to create a lklayoutmedia link for
         // background images (and maintain it when they change)
         if ($recordType == 'layout' && $background != '') {
             // Also append another file node for the background image (if there is one)
             $file = $requiredFilesXml->createElement("file");
             $file->setAttribute("type", "media");
             $file->setAttribute("path", $background);
             $file->setAttribute("md5", md5_file($libraryLocation . $background));
             $file->setAttribute("size", filesize($libraryLocation . $background));
             $fileElements->appendChild($file);
         }
     }
     Kit::ClassLoader('layout');
     // Go through each layout and see if we need to supply any resource nodes.
     foreach ($layouts as $layoutId) {
         // Load the layout XML and work out if we have any ticker / text / dataset media items
         $layout = new Layout($db);
         $layoutInformation = $layout->LayoutInformation($layoutId);
         foreach ($layoutInformation['regions'] as $region) {
             foreach ($region['media'] as $media) {
                 if ($media['mediatype'] == 'ticker' || $media['mediatype'] == 'text' || $media['mediatype'] == 'datasetview') {
                     // Append this item to required files
                     $file = $requiredFilesXml->createElement("file");
                     $file->setAttribute('type', 'resource');
                     $file->setAttribute('id', rand());
                     $file->setAttribute('layoutid', $layoutId);
                     $file->setAttribute('regionid', $region['regionid']);
                     $file->setAttribute('mediaid', $media['mediaid']);
                     $fileElements->appendChild($file);
                 }
             }
         }
     }
     // Add a blacklist node
     $blackList = $requiredFilesXml->createElement("file");
     $blackList->setAttribute("type", "blacklist");
     $fileElements->appendChild($blackList);
     // Populate
     $SQL = "SELECT MediaID\r\n                FROM blacklist\r\n                WHERE DisplayID = " . $this->displayId . "\r\n                AND isIgnored = 0";
     if (!($results = $db->query($SQL))) {
         trigger_error($db->error());
         return new SoapFault('Sender', 'Unable to get a list of blacklisted files');
     }
     // Add a black list element for each file
     while ($row = $db->get_row($results)) {
         $file = $requiredFilesXml->createElement("file");
         $file->setAttribute("id", $row[0]);
         $blackList->appendChild($file);
     }
     // Phone Home?
     $this->PhoneHome();
     if ($this->isAuditing == 1) {
         Debug::LogEntry("audit", $requiredFilesXml->saveXML(), "xmds", "RequiredFiles");
         Debug::LogEntry("audit", "[OUT]", "xmds", "RequiredFiles");
     }
     // Return the results of requiredFiles()
     $requiredFilesXml->formatOutput = true;
     $output = $requiredFilesXml->saveXML();
     // Log Bandwidth
     $this->LogBandwidth($this->displayId, 2, strlen($output));
     return $output;
 }
开发者ID:abbeet,项目名称:server39,代码行数:101,代码来源:xmdssoap.class.php

示例3: RequiredFiles


//.........这里部分代码省略.........
                 $fileSize = strlen($xml);
                 if ($this->isAuditing == 1) {
                     Debug::Audit('MD5 for layoutId ' . $id . ' is: [' . $md5 . ']', $this->displayId);
                 }
                 // Add nonce
                 $nonce->AddXmdsNonce('layout', $this->displayId, NULL, $fileSize, NULL, $id);
                 $pathsAdded[] = 'layout_' . $id;
             } else {
                 if ($recordType == 'media') {
                     // Check we haven't added this before
                     if (in_array('media_' . $path, $pathsAdded)) {
                         continue;
                     }
                     // If they are empty calculate them and save them back to the media.
                     if ($md5 == '' || $fileSize == 0) {
                         $md5 = md5_file($libraryLocation . $path);
                         $fileSize = filesize($libraryLocation . $path);
                         // Update the media record with this information
                         $mediaSth->execute(array('md5' => $md5, 'size' => $fileSize, 'mediaid' => $id));
                     }
                     // Add nonce
                     $mediaNonce = $nonce->AddXmdsNonce('file', $this->displayId, $id, $fileSize, $path);
                     $pathsAdded[] = 'media_' . $path;
                 } else {
                     continue;
                 }
             }
             // Add the file node
             $file = $requiredFilesXml->createElement("file");
             $file->setAttribute("type", $recordType);
             $file->setAttribute("id", $id);
             $file->setAttribute("size", $fileSize);
             $file->setAttribute("md5", $md5);
             if ($recordType == 'media' && $sendFileMode != 'Off') {
                 // Serve a link instead (standard HTTP link)
                 $file->setAttribute("path", Kit::GetXiboRoot() . '?file=' . $mediaNonce);
                 $file->setAttribute("saveAs", $path);
                 $file->setAttribute("download", 'http');
             } else {
                 $file->setAttribute("download", 'xmds');
                 $file->setAttribute("path", $path);
             }
             $fileElements->appendChild($file);
         }
     } catch (Exception $e) {
         Debug::Error('Unable to get a list of required files. ' . $e->getMessage(), $this->displayId);
         return new SoapFault('Sender', 'Unable to get a list of files');
     }
     // Go through each layout and see if we need to supply any resource nodes.
     foreach ($layouts as $layoutId) {
         // Load the layout XML and work out if we have any ticker / text / data set media items
         $layout = new Layout();
         $layoutInformation = $layout->LayoutInformation($layoutId);
         foreach ($layoutInformation['regions'] as $region) {
             foreach ($region['media'] as $media) {
                 if ($media['render'] == 'html' || $media['mediatype'] == 'ticker' || $media['mediatype'] == 'text' || $media['mediatype'] == 'datasetview' || $media['mediatype'] == 'webpage' || $media['mediatype'] == 'embedded') {
                     // Append this item to required files
                     $file = $requiredFilesXml->createElement("file");
                     $file->setAttribute('type', 'resource');
                     $file->setAttribute('id', rand());
                     $file->setAttribute('layoutid', $layoutId);
                     $file->setAttribute('regionid', $region['regionid']);
                     $file->setAttribute('mediaid', $media['mediaid']);
                     $file->setAttribute('updated', isset($media['updated']) ? $media['updated'] : 0);
                     $fileElements->appendChild($file);
                     $nonce->AddXmdsNonce('resource', $this->displayId, NULL, NULL, NULL, $layoutId, $region['regionid'], $media['mediaid']);
                 }
             }
         }
     }
     // Add a blacklist node
     $blackList = $requiredFilesXml->createElement("file");
     $blackList->setAttribute("type", "blacklist");
     $fileElements->appendChild($blackList);
     try {
         $dbh = PDOConnect::init();
         $sth = $dbh->prepare('SELECT MediaID FROM blacklist WHERE DisplayID = :displayid AND isIgnored = 0');
         $sth->execute(array('displayid' => $this->displayId));
         // Add a black list element for each file
         foreach ($sth->fetchAll() as $row) {
             $file = $requiredFilesXml->createElement("file");
             $file->setAttribute("id", $row['MediaID']);
             $blackList->appendChild($file);
         }
     } catch (Exception $e) {
         Debug::Error('Unable to get a list of blacklisted files. ' . $e->getMessage(), $this->displayId);
         return new SoapFault('Sender', 'Unable to get a list of blacklisted files');
     }
     // Phone Home?
     $this->PhoneHome();
     if ($this->isAuditing == 1) {
         Debug::Audit($requiredFilesXml->saveXML(), $this->displayId);
     }
     // Return the results of requiredFiles()
     $requiredFilesXml->formatOutput = true;
     $output = $requiredFilesXml->saveXML();
     // Log Bandwidth
     $this->LogBandwidth($this->displayId, Bandwidth::$RF, strlen($output));
     return $output;
 }
开发者ID:rovak73,项目名称:xibo-cms,代码行数:101,代码来源:xmdssoap4.class.php

示例4: ManualRegionPositionForm

 function ManualRegionPositionForm()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $regionid = Kit::GetParam('regionid', _GET, _STRING);
     $layoutid = Kit::GetParam('layoutid', _GET, _INT);
     $scale = Kit::GetParam('scale', _GET, _DOUBLE);
     $zoom = Kit::GetParam('zoom', _GET, _DOUBLE);
     // Load the region and get the dimensions, applying the scale factor if necessary (only v1 layouts will have a scale factor != 1)
     $region = new region($db);
     $regionNode = $region->getRegion($layoutid, $regionid);
     $top = round($regionNode->getAttribute('top') * $scale, 0);
     $left = round($regionNode->getAttribute('left') * $scale, 0);
     $width = round($regionNode->getAttribute('width') * $scale, 0);
     $height = round($regionNode->getAttribute('height') * $scale, 0);
     $zindex = $regionNode->getAttribute('zindex');
     $ownerId = $region->GetOwnerId($layoutid, $regionid);
     $regionName = $regionNode->getAttribute('name');
     $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);
     }
     // Set some information about the form
     Theme::Set('form_id', 'RegionProperties');
     Theme::Set('form_action', 'index.php?p=timeline&q=ManualRegionPosition');
     Theme::Set('form_meta', '<input type="hidden" name="layoutid" value="' . $layoutid . '"><input type="hidden" name="regionid" value="' . $regionid . '"><input type="hidden" name="scale" value="' . $scale . '"><input type="hidden" name="zoom" value="' . $zoom . '">');
     $formFields = array();
     $formFields[] = FormManager::AddText('name', __('Name'), $regionName, __('Name of the Region'), 'n', 'maxlength="50"');
     $formFields[] = FormManager::AddNumber('top', __('Top'), $top, __('Offset from the Top Corner'), 't');
     $formFields[] = FormManager::AddNumber('left', __('Left'), $left, __('Offset from the Left Corner'), 'l');
     $formFields[] = FormManager::AddNumber('width', __('Width'), $width, __('Width of the Region'), 'w');
     $formFields[] = FormManager::AddNumber('height', __('Height'), $height, __('Height of the Region'), 'h');
     // Transitions
     if (count($this->user->TransitionAuth('out')) > 0) {
         // Add none to the list
         $transitions = $this->user->TransitionAuth('out');
         $transitions[] = array('code' => '', 'transition' => 'None', 'class' => '');
         $formFields[] = FormManager::AddCombo('transitionType', __('Exit Transition'), $region->GetOption($layoutid, $regionid, 'transOut', ''), $transitions, 'code', 'transition', __('What transition should be applied when this region is finished?'), 't');
         $formFields[] = FormManager::AddNumber('transitionDuration', __('Duration'), $region->GetOption($layoutid, $regionid, 'transOutDuration', 0), __('The duration for this transition, in milliseconds.'), 'l', '', 'transition-group');
         // Compass points for direction
         $compassPoints = array(array('id' => 'N', 'name' => __('North')), array('id' => 'NE', 'name' => __('North East')), array('id' => 'E', 'name' => __('East')), array('id' => 'SE', 'name' => __('South East')), array('id' => 'S', 'name' => __('South')), array('id' => 'SW', 'name' => __('South West')), array('id' => 'W', 'name' => __('West')), array('id' => 'NW', 'name' => __('North West')));
         $formFields[] = FormManager::AddCombo('transitionDirection', __('Direction'), $region->GetOption($layoutid, $regionid, 'transOutDirection', ''), $compassPoints, 'id', 'name', __('The direction for this transition. Only appropriate for transitions that move, such as Fly.'), 'd', 'transition-group transition-direction');
         // Add some dependencies
         $response->AddFieldAction('transitionType', 'init', '', array('.transition-group' => array('display' => 'none')));
         $response->AddFieldAction('transitionType', 'init', '', array('.transition-group' => array('display' => 'block')), 'not');
         $response->AddFieldAction('transitionType', 'change', '', array('.transition-group' => array('display' => 'none')));
         $response->AddFieldAction('transitionType', 'change', '', array('.transition-group' => array('display' => 'block')), 'not');
     }
     $formFields[] = FormManager::AddCheckbox('loop', __('Loop?'), $region->GetOption($layoutid, $regionid, 'loop', 0), __('If there is only one item in this region should it loop? Not currently available for Windows Players.'), 'l');
     $formFields[] = FormManager::AddNumber('zindex', __('Layer'), $zindex == 0 ? NULL : $zindex, __('The layering order of this region (z-index). Advanced use only. '), 'z');
     Theme::Set('form_fields', $formFields);
     // Add some information about the whole layout to this request.
     $layout = new Layout();
     $layoutInformation = $layout->LayoutInformation($layoutid);
     $response->extra['layoutInformation'] = array('width' => $layoutInformation['width'], 'height' => $layoutInformation['height']);
     $response->SetFormRequestResponse(NULL, __('Region Options'), '350px', '275px');
     $response->AddButton(__('Cancel'), 'XiboDialogClose()');
     $response->AddButton(__('Save'), '$("#RegionProperties").submit()');
     $response->AddButton(__('Set Full Screen'), 'setFullScreenLayout()');
     $response->Respond();
 }
开发者ID:fignew,项目名称:xibo-cms,代码行数:62,代码来源:timeline.class.php


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