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


PHP Kit::uniqueId方法代码示例

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


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

示例1: displayPage

 /**
  * Stats page
  */
 function displayPage()
 {
     // Render a Bandwidth Widget
     $id = Kit::uniqueId();
     Theme::Set('id', $id);
     Theme::Set('form_meta', '<input type="hidden" name="p" value="stats"><input type="hidden" name="q" value="BandwidthGrid">');
     $formFields = array();
     $formFields[] = FormManager::AddDatePicker('fromdt', __('From Date'), DateManager::getLocalDate(time() - 86400 * 35, 'Y-m-d'), NULL, 'f');
     $formFields[] = FormManager::AddDatePicker('todt', __('To Date'), DateManager::getLocalDate(null, 'Y-m-d'), NULL, 't');
     // List of Displays this user has permission for
     $displays = $this->user->DisplayGroupList(1);
     array_unshift($displays, array('displayid' => 0, 'displaygroup' => 'All'));
     $formFields[] = FormManager::AddCombo('displayid', __('Display'), NULL, $displays, 'displayid', 'displaygroup', NULL, 'd');
     Theme::Set('header_text', __('Bandwidth'));
     Theme::Set('form_fields', $formFields);
     Theme::Render('grid_render');
     // Render an Availability Widget
     $id = Kit::uniqueId();
     Theme::Set('id', $id);
     Theme::Set('form_meta', '<input type="hidden" name="p" value="stats"><input type="hidden" name="q" value="AvailabilityGrid">');
     $formFields = array();
     $formFields[] = FormManager::AddDatePicker('fromdt', __('From Date'), DateManager::getLocalDate(time() - 86400 * 35, 'Y-m-d'), NULL, 'f');
     $formFields[] = FormManager::AddDatePicker('todt', __('To Date'), DateManager::getLocalDate(null, 'Y-m-d'), NULL, 't');
     // List of Displays this user has permission for
     $displays = $this->user->DisplayGroupList(1);
     array_unshift($displays, array('displayid' => 0, 'displaygroup' => 'All'));
     $formFields[] = FormManager::AddCombo('displayid', __('Display'), NULL, $displays, 'displayid', 'displaygroup', NULL, 'd');
     Theme::Set('header_text', __('Availability'));
     Theme::Set('form_fields', $formFields);
     Theme::Render('grid_render');
     // Proof of Play stats widget
     $id = Kit::uniqueId();
     Theme::Set('id', $id);
     Theme::Set('form_meta', '<input type="hidden" name="p" value="stats"><input type="hidden" name="q" value="StatsGrid">');
     $formFields = array();
     $formFields[] = FormManager::AddDatePicker('fromdt', __('From Date'), DateManager::getLocalDate(time() - 86400, 'Y-m-d'), NULL, 'f');
     $formFields[] = FormManager::AddDatePicker('todt', __('To Date'), DateManager::getLocalDate(null, 'Y-m-d'), NULL, 't');
     // List of Displays this user has permission for
     $displays = $this->user->DisplayGroupList(1);
     array_unshift($displays, array('displayid' => 0, 'displaygroup' => 'All'));
     $formFields[] = FormManager::AddCombo('displayid', __('Display'), NULL, $displays, 'displayid', 'displaygroup', NULL, 'd');
     // List of Media this user has permission for
     $media = $this->user->MediaList();
     array_unshift($media, array('mediaid' => 0, 'media' => 'All'));
     $formFields[] = FormManager::AddCombo('mediaid', __('Media'), NULL, $media, 'mediaid', 'media', NULL, 'm');
     // Call to render the template
     Theme::Set('header_text', __('Statistics'));
     Theme::Set('form_fields', $formFields);
     Theme::Render('grid_render');
 }
开发者ID:fignew,项目名称:xibo-cms,代码行数:53,代码来源:stats.class.php

示例2: AddRegion

 /**
  * Adds a region to the specified layoutid
  * @param $layoutid Object
  * @param $regionid Object[optional]
  * @return string The region id
  */
 public function AddRegion($layoutid, $userid, $regionid = "", $width = 250, $height = 250, $top = 50, $left = 50, $name = '')
 {
     Debug::LogEntry('audit', 'LayoutId: ' . $layoutid . ', Width: ' . $width . ', Height: ' . $height . ', Top: ' . $top . ', Left: ' . $left . ', Name: ' . $name . '.', 'region', 'AddRegion');
     //Load the XML for this layout
     $xml = new DOMDocument("1.0");
     $xml->loadXML($this->GetLayoutXml($layoutid));
     //Do we have a region ID provided?
     if ($regionid == '') {
         $regionid = Kit::uniqueId();
     }
     // Validation
     if (!is_numeric($width) || !is_numeric($height) || !is_numeric($top) || !is_numeric($left)) {
         return $this->SetError(__('Size and coordinates must be generic'));
     }
     if ($width <= 0) {
         return $this->SetError(__('Width must be greater than 0'));
     }
     if ($height <= 0) {
         return $this->SetError(__('Height must be greater than 0'));
     }
     // make a new region node
     $newRegion = $xml->createElement("region");
     if ($name != '') {
         $newRegion->setAttribute('name', $name);
     }
     $newRegion->setAttribute('id', $regionid);
     $newRegion->setAttribute('userId', $userid);
     $newRegion->setAttribute('width', $width);
     $newRegion->setAttribute('height', $height);
     $newRegion->setAttribute('top', $top);
     $newRegion->setAttribute('left', $left);
     $xml->firstChild->appendChild($newRegion);
     if (!$this->SetLayoutXml($layoutid, $xml->saveXML())) {
         return false;
     }
     // What permissions should we create this with?
     if (Config::GetSetting('LAYOUT_DEFAULT') == 'public') {
         Kit::ClassLoader('layoutregiongroupsecurity');
         $security = new LayoutRegionGroupSecurity($this->db);
         $security->LinkEveryone($layoutid, $regionid, 1, 0, 0);
     }
     // Update layout status
     Kit::ClassLoader('Layout');
     $layout = new Layout($this->db);
     $layout->SetValid($layoutid, true);
     return $regionid;
 }
开发者ID:fignew,项目名称:xibo-cms,代码行数:53,代码来源:region.data.class.php

示例3: DisplayGrid

 /**
  * Grid of Displays
  * @return
  */
 function DisplayGrid()
 {
     // validate displays so we get a realistic view of the table
     Display::ValidateDisplays();
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     // Filter by Name
     $filter_display = Kit::GetParam('filter_display', _POST, _STRING);
     setSession('display', 'filter_display', $filter_display);
     // Filter by Name
     $filterMacAddress = Kit::GetParam('filterMacAddress', _POST, _STRING);
     setSession('display', 'filterMacAddress', $filterMacAddress);
     // Display Group
     $filter_displaygroupid = Kit::GetParam('filter_displaygroup', _POST, _INT);
     setSession('display', 'filter_displaygroup', $filter_displaygroupid);
     // Thumbnail?
     $filter_showView = Kit::GetParam('filter_showView', _REQUEST, _INT);
     setSession('display', 'filter_showView', $filter_showView);
     $filterVersion = Kit::GetParam('filterVersion', _REQUEST, _STRING);
     setSession('display', 'filterVersion', $filterVersion);
     // filter_autoRefresh?
     $filter_autoRefresh = Kit::GetParam('filter_autoRefresh', _REQUEST, _INT, 0);
     setSession('display', 'filter_autoRefresh', $filter_autoRefresh);
     // Pinned option?
     setSession('display', 'DisplayFilter', Kit::GetParam('XiboFilterPinned', _REQUEST, _CHECKBOX, 'off'));
     $displays = $user->DisplayList(array('displayid'), array('displaygroupid' => $filter_displaygroupid, 'display' => $filter_display, 'macAddress' => $filterMacAddress, 'clientVersion' => $filterVersion));
     if (!is_array($displays)) {
         trigger_error($db->error());
         trigger_error(__('Unable to get list of displays'), E_USER_ERROR);
     }
     // Do we want to make a VNC link out of the display name?
     $vncTemplate = Config::GetSetting('SHOW_DISPLAY_AS_VNCLINK');
     $linkTarget = Kit::ValidateParam(Config::GetSetting('SHOW_DISPLAY_AS_VNC_TGT'), _STRING);
     $cols = array(array('name' => 'displayid', 'title' => __('ID')), array('name' => 'displayWithLink', 'title' => __('Display')), array('name' => 'status', 'title' => __('Status'), 'icons' => true, 'iconDescription' => 'statusDescription'), array('name' => 'licensed', 'title' => __('License'), 'icons' => true), array('name' => 'currentLayout', 'title' => __('Current Layout'), 'hidden' => $filter_showView != 3), array('name' => 'storageAvailableSpaceFormatted', 'title' => __('Storage Available'), 'hidden' => $filter_showView != 3), array('name' => 'storageTotalSpaceFormatted', 'title' => __('Storage Total'), 'hidden' => $filter_showView != 3), array('name' => 'storagePercentage', 'title' => __('Storage Free %'), 'hidden' => $filter_showView != 3), array('name' => 'description', 'title' => __('Description'), 'hidden' => $filter_showView != 4), array('name' => 'layout', 'title' => __('Default Layout'), 'hidden' => $filter_showView != 0), array('name' => 'inc_schedule', 'title' => __('Interleave Default'), 'icons' => true, 'hidden' => $filter_showView == 1 || $filter_showView == 2), array('name' => 'email_alert', 'title' => __('Email Alert'), 'icons' => true, 'hidden' => $filter_showView != 0), array('name' => 'loggedin', 'title' => __('Logged In'), 'icons' => true), array('name' => 'lastaccessed', 'title' => __('Last Accessed')), array('name' => 'clientVersionCombined', 'title' => __('Version'), 'hidden' => $filter_showView != 3), array('name' => 'clientaddress', 'title' => __('IP Address'), 'hidden' => $filter_showView == 1), array('name' => 'macaddress', 'title' => __('Mac Address'), 'hidden' => $filter_showView == 1), array('name' => 'screenShotRequested', 'title' => __('Screen shot?'), 'icons' => true, 'hidden' => $filter_showView != 1 && $filter_showView != 2), array('name' => 'thumbnail', 'title' => __('Thumbnail'), 'hidden' => $filter_showView != 1 && $filter_showView != 2));
     Theme::Set('table_cols', $cols);
     Theme::Set('rowClass', 'rowColor');
     $rows = array();
     foreach ($displays as $row) {
         // VNC Template as display name?
         if ($vncTemplate != '' && $row['clientaddress'] != '') {
             if ($linkTarget == '') {
                 $linkTarget = '_top';
             }
             $row['displayWithLink'] = sprintf('<a href="' . $vncTemplate . '" title="VNC to ' . $row['display'] . '" target="' . $linkTarget . '">' . Theme::Prepare($row['display']) . '</a>', $row['clientaddress']);
         } else {
             $row['displayWithLink'] = $row['display'];
         }
         // Format last accessed
         $row['lastaccessed'] = DateManager::getLocalDate($row['lastaccessed']);
         // Create some login lights
         $row['rowColor'] = $row['mediainventorystatus'] == 1 ? 'success' : ($row['mediainventorystatus'] == 2 ? 'danger' : 'warning');
         // Set some text for the display status
         switch ($row['mediainventorystatus']) {
             case 1:
                 $row['statusDescription'] = __('Display is up to date');
                 break;
             case 2:
                 $row['statusDescription'] = __('Display is downloading new files');
                 break;
             case 3:
                 $row['statusDescription'] = __('Display is out of date but has not yet checked in with the server');
                 break;
             default:
                 $row['statusDescription'] = __('Unknown Display Status');
         }
         $row['status'] = $row['mediainventorystatus'] == 1 ? 1 : ($row['mediainventorystatus'] == 2 ? 0 : -1);
         // Thumbnail
         $row['thumbnail'] = '';
         // If we aren't logged in, and we are showThumbnail == 2, then show a circle
         if ($filter_showView == 2 && $row['loggedin'] == 0) {
             $row['thumbnail'] = '<i class="fa fa-times-circle"></i>';
         } else {
             if ($filter_showView != 0 && file_exists(Config::GetSetting('LIBRARY_LOCATION') . 'screenshots/' . $row['displayid'] . '_screenshot.jpg')) {
                 $row['thumbnail'] = '<a data-toggle="lightbox" data-type="image" href="index.php?p=display&q=ScreenShot&DisplayId=' . $row['displayid'] . '"><img class="display-screenshot" src="index.php?p=display&q=ScreenShot&DisplayId=' . $row['displayid'] . '&' . Kit::uniqueId() . '" /></a>';
             }
         }
         // Version
         $row['clientVersionCombined'] = $row['client_type'] . ' / ' . $row['client_version'];
         // Format the storage available / total space
         $row['storageAvailableSpaceFormatted'] = Kit::formatBytes($row['storageAvailableSpace']);
         $row['storageTotalSpaceFormatted'] = Kit::formatBytes($row['storageTotalSpace']);
         $row['storagePercentage'] = $row['storageTotalSpace'] == 0 ? 100 : round($row['storageAvailableSpace'] / $row['storageTotalSpace'] * 100.0, 2);
         // Edit and Delete buttons first
         if ($row['edit'] == 1) {
             // Edit
             $row['buttons'][] = array('id' => 'display_button_edit', 'url' => 'index.php?p=display&q=displayForm&displayid=' . $row['displayid'], 'text' => __('Edit'));
         }
         // Delete
         if ($row['del'] == 1) {
             $row['buttons'][] = array('id' => 'display_button_delete', 'url' => 'index.php?p=display&q=DeleteForm&displayid=' . $row['displayid'], 'text' => __('Delete'));
         }
         if ($row['edit'] == 1 || $row['del'] == 1) {
             $row['buttons'][] = array('linkType' => 'divider');
         }
         // Schedule Now
//.........这里部分代码省略.........
开发者ID:fignew,项目名称:xibo-cms,代码行数:101,代码来源:display.class.php

示例4: Copy

 /**
  * Copys a Layout
  * @param <int> $oldLayoutId
  * @param <string> $newLayoutName
  * @param <int> $userId
  * @param <bool> $copyMedia Make copies of this layouts media
  * @return <int> 
  */
 public function Copy($oldLayoutId, $newLayoutName, $newDescription, $userId, $copyMedia = false)
 {
     try {
         $dbh = PDOConnect::init();
         $currentdate = date("Y-m-d H:i:s");
         $campaign = new Campaign($this->db);
         // Include to media data class?
         if ($copyMedia) {
             $mediaObject = new Media($this->db);
             $mediaSecurity = new MediaGroupSecurity($this->db);
         }
         // We need the old campaignid
         $oldCampaignId = $campaign->GetCampaignId($oldLayoutId);
         // The Layout ID is the old layout
         $SQL = "";
         $SQL .= " INSERT INTO layout (layout, xml, userID, description, retired, duration, backgroundImageId, createdDT, modifiedDT, status) ";
         $SQL .= " SELECT :layout, xml, :userid, :description, retired, duration, backgroundImageId, :createddt, :modifieddt, status ";
         $SQL .= "  FROM layout ";
         $SQL .= " WHERE layoutid = :layoutid";
         $sth = $dbh->prepare($SQL);
         $sth->execute(array('layout' => $newLayoutName, 'description' => $newDescription, 'userid' => $userId, 'createddt' => $currentdate, 'modifieddt' => $currentdate, 'layoutid' => $oldLayoutId));
         $newLayoutId = $dbh->lastInsertId();
         // Create a campaign
         $newCampaignId = $campaign->Add($newLayoutName, 1, $userId);
         // Link them
         $campaign->Link($newCampaignId, $newLayoutId, 0);
         // Open the layout XML and parse for media nodes
         if (!$this->SetDomXml($newLayoutId)) {
             $this->ThrowError(25000, __('Unable to copy layout'));
         }
         // Handle the Background
         $sth = $dbh->prepare('SELECT mediaId FROM lklayoutmedia WHERE layoutId = :layoutId AND regionId = :regionId');
         $sth->execute(array('layoutId' => $oldLayoutId, 'regionId' => 'background'));
         if ($row = $sth->fetch()) {
             // This layout does have a background image
             // Link it to the new one
             if (!($newLkId = $this->AddLk($newLayoutId, 'background', $row['mediaId']))) {
                 throw new Exception(__('Unable to link background'));
             }
         }
         // Get all media nodes
         $xpath = new DOMXpath($this->DomXml);
         // Create an XPath to get all media nodes
         $mediaNodes = $xpath->query("//media");
         Debug::LogEntry('audit', 'About to loop through media nodes', 'layout', 'Copy');
         $copiesMade = array();
         // On each media node, take the existing LKID and MediaID and create a new LK record in the database
         $sth = $dbh->prepare('SELECT StoredAs FROM media WHERE MediaID = :mediaid');
         foreach ($mediaNodes as $mediaNode) {
             $mediaId = $mediaNode->getAttribute('id');
             $type = $mediaNode->getAttribute('type');
             // Store the old media id
             $oldMediaId = $mediaId;
             Debug::LogEntry('audit', sprintf('Media %s node found with id %d', $type, $mediaId), 'layout', 'Copy');
             // If this is a non region specific type, then move on
             if ($this->IsRegionSpecific($type)) {
                 // Generate a new media id
                 $newMediaId = md5(Kit::uniqueId());
                 $mediaNode->setAttribute('id', $newMediaId);
                 // Copy media security
                 $security = new LayoutMediaGroupSecurity($this->db);
                 $security->CopyAllForMedia($oldLayoutId, $newLayoutId, $mediaId, $newMediaId);
                 continue;
             }
             // Library media assigned to the layout, it will have a lkid
             $lkId = $mediaNode->getAttribute('lkid');
             // Get the regionId
             $regionNode = $mediaNode->parentNode;
             $regionId = $regionNode->getAttribute('id');
             // Do we need to copy this media record?
             if ($copyMedia) {
                 // Take this media item and make a hard copy of it.
                 if (!($mediaId = $mediaObject->Copy($mediaId, $newLayoutName))) {
                     throw new Exception("Error Processing Request", 1);
                 }
                 // Update the permissions for the new media record
                 $mediaSecurity->Copy($oldMediaId, $mediaId);
                 // Copied the media node, so set the ID
                 $mediaNode->setAttribute('id', $mediaId);
                 // Also need to set the options node
                 // Get the stored as value of the new node
                 $sth->execute(array('mediaid' => $mediaId));
                 if (!($row = $sth->fetch())) {
                     $this->ThrowError(25000, __('Unable to find stored value of newly copied media'));
                 }
                 $fileName = Kit::ValidateParam($row['StoredAs'], _STRING);
                 $newNode = $this->DomXml->createElement('uri', $fileName);
                 // Find the old node
                 $uriNodes = $mediaNode->getElementsByTagName('uri');
                 $uriNode = $uriNodes->item(0);
                 // Replace it
                 $uriNode->parentNode->replaceChild($newNode, $uriNode);
//.........这里部分代码省略.........
开发者ID:taphier,项目名称:xibo-cms,代码行数:101,代码来源:layout.data.class.php

示例5: AddMedia

 /**
  * Add Media to the Database
  * @return
  */
 public function AddMedia()
 {
     $this->response = new ResponseManager();
     // Same member variables as the Form call, except with POST variables for your form fields.
     $layoutid = $this->layoutid;
     $regionid = $this->regionid;
     $mediaid = $this->mediaid;
     // You are required to set a media id, which should be unique.
     $this->mediaid = md5(Kit::uniqueId());
     // You must also provide a duration (all media items must provide this field)
     $this->duration = Kit::GetParam('duration', _POST, _INT, 0, false);
     // You should validate all form input using the Kit::GetParam helper classes
     if (Kit::GetParam('searchTerm', _POST, _STRING) == '') {
         $this->response->SetError(__('Please enter a search term'));
         $this->response->keepOpen = true;
         return $this->response;
     }
     $this->SetOption('name', Kit::GetParam('name', _POST, _STRING));
     $this->SetOption('searchTerm', Kit::GetParam('searchTerm', _POST, _STRING));
     $this->SetOption('effect', Kit::GetParam('effect', _POST, _STRING));
     $this->SetOption('speed', Kit::GetParam('speed', _POST, _INT));
     $this->SetOption('backgroundColor', Kit::GetParam('backgroundColor', _POST, _STRING));
     $this->SetOption('noTweetsMessage', Kit::GetParam('noTweetsMessage', _POST, _STRING));
     $this->SetOption('dateFormat', Kit::GetParam('dateFormat', _POST, _STRING));
     $this->SetOption('resultType', Kit::GetParam('resultType', _POST, _STRING));
     $this->SetOption('tweetDistance', Kit::GetParam('tweetDistance', _POST, _INT));
     $this->SetOption('tweetCount', Kit::GetParam('tweetCount', _POST, _INT));
     $this->SetRaw('<template><![CDATA[' . Kit::GetParam('ta_text', _POST, _HTMLSTRING) . ']]></template><styleSheet><![CDATA[' . Kit::GetParam('ta_css', _POST, _HTMLSTRING) . ']]></styleSheet>');
     $this->SetOption('overrideTemplate', Kit::GetParam('overrideTemplate', _POST, _CHECKBOX));
     $this->SetOption('templateId', Kit::GetParam('templateId', _POST, _WORD));
     $this->SetOption('updateInterval', Kit::GetParam('updateInterval', _POST, _INT, 60));
     // Should have built the media object entirely by this time
     // This saves the Media Object to the Region
     $this->UpdateRegion();
     // Usually you will want to load the region options form again once you have added your module.
     // In some cases you will want to load the edit form for that module
     $this->response->loadForm = true;
     $this->response->loadFormUri = "index.php?p=timeline&layoutid={$this->layoutid}&regionid={$this->regionid}&q=RegionOptions";
     return $this->response;
 }
开发者ID:rovak73,项目名称:xibo-cms,代码行数:44,代码来源:twitter.module.php

示例6: EventFormDisplayFilter

    private function EventFormDisplayFilter($displayGroupIds)
    {
        $msgName = __('Display');
        // Default values?
        if (Kit::IsFilterPinned('scheduleEvent', 'EventFormDisplayFilter')) {
            $filterPinned = 'checked';
            $filterName = Session::Get('scheduleEvent', 'DisplayName');
        } else {
            $filterPinned = '';
            $filterName = '';
        }
        // Serialize the list of display group ids
        $displayGroupIdsSerialized = "";
        foreach ($displayGroupIds as $displayGroupId) {
            $displayGroupIdsSerialized .= '<input type="hidden" name="DisplayGroupIDs[]" value="' . $displayGroupId . '">';
        }
        $form = <<<HTML
        <div class="XiboFilterInner">     
            <div class="scheduleFormCheckAll pull-right"><label for"checkAll"><input type="checkbox" name="checkAll">Check All</label></div>
            <form onsubmit="return false">
                <input type="hidden" name="p" value="schedule">
                <input type="hidden" name="q" value="EventFormDisplay">
                {$displayGroupIdsSerialized}
                <table>
                    <tr>
                        <td>{$msgName}</td>
                        <td><input type="text" name="name" value="{$filterName}"></td>
                        <td>
                            <label for="XiboFilterPinned">Pin?</label>
                            <input id="XiboFilterPinned" name="XiboFilterPinned" type="checkbox" class="XiboFilter" {$filterPinned} />
                        </td>
                    </tr>
                </table>
            </form>
        </div>
HTML;
        $id = Kit::uniqueId();
        $pager = ResponseManager::Pager($id);
        $xiboGrid = <<<HTML
        <div class="XiboGrid" id="{$id}">
            <div class="XiboFilter">
                {$form}
            </div>
            <div class="XiboData"></div>
            {$pager}
        </div>
HTML;
        return $xiboGrid;
    }
开发者ID:abbeet,项目名称:server39,代码行数:49,代码来源:schedule.class.php


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