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


PHP Media::GetErrorMessage方法代码示例

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


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

示例1: EditLibraryMedia

 protected function EditLibraryMedia()
 {
     $this->response = new ResponseManager();
     $db =& $this->db;
     $user =& $this->user;
     $layoutid = $this->layoutid;
     $regionid = $this->regionid;
     $mediaid = $this->mediaid;
     $userid = $this->user->userid;
     if (!$this->auth->edit) {
         $this->response->SetError('You do not have permission to edit this media.');
         $this->response->keepOpen = false;
         return $this->response;
     }
     // Hand off to the media module
     $mediaObject = new Media($db);
     // Stored As from the XML
     $storedAs = $this->GetOption('uri');
     // File data
     $tmpName = Kit::GetParam('hidFileID', _POST, _STRING);
     $name = Kit::GetParam('name', _POST, _STRING);
     $tags = Kit::GetParam('tags', _POST, _STRING);
     if ($this->auth->modifyPermissions) {
         $this->duration = Kit::GetParam('duration', _POST, _INT, 0, false);
     }
     // Revise this file?
     if ($tmpName != '') {
         Debug::LogEntry('audit', 'Uploading a new revision', 'module', 'EditLibraryMedia');
         // File name and extension (orignial name)
         $fileName = Kit::GetParam('txtFileName', _POST, _STRING);
         if ($name == '') {
             $name = $fileName;
         }
         if (!($new_mediaid = $mediaObject->FileRevise($mediaid, $tmpName, $fileName, $userid))) {
             $this->response->SetError($mediaObject->GetErrorMessage());
             $this->response->keepOpen = true;
             return $this->response;
         }
         // Are we on a region
         if ($regionid != '') {
             $security = new LayoutMediaGroupSecurity($db);
             $security->Copy($layoutid, $regionid, $mediaid, $new_mediaid);
         }
         // Required Attributes
         $this->mediaid = $new_mediaid;
         // Find out what we stored this item as
         try {
             $dbh = PDOConnect::init();
             $sth = $dbh->prepare('SELECT StoredAs FROM `media` WHERE mediaid = :mediaId');
             $sth->execute(array('mediaId' => $new_mediaid));
             $storedAs = Kit::ValidateParam($sth->fetchColumn(0), _FILENAME);
             $this->SetOption('uri', $storedAs);
         } catch (Exception $e) {
             Debug::LogEntry('error', $e->getMessage(), get_class(), __FUNCTION__);
             trigger_error(__('Unable to find uploaded file.'), E_USER_ERROR);
         }
         Debug::LogEntry('audit', 'New revision uploaded: ' . $storedAs, 'module', 'EditLibraryMedia');
     }
     // Edit the media record
     if (!$mediaObject->Edit($this->mediaid, $name, $this->duration, $userid, $tags)) {
         $this->response->SetError($mediaObject->GetErrorMessage());
         $this->response->keepOpen = true;
         return $this->response;
     }
     // Should have built the media object entirely by this time
     if ($regionid != '' && $this->showRegionOptions) {
         // This saves the Media Object to the Region
         $this->UpdateRegion();
         $this->response->loadForm = true;
         $this->response->loadFormUri = "index.php?p=timeline&layoutid={$layoutid}&regionid={$regionid}&q=RegionOptions";
     } elseif ($regionid != '' && !$this->showRegionOptions) {
         $this->UpdateRegion();
         $this->response->loadForm = false;
     } else {
         $this->response->message = 'Edited the ' . $this->displayType;
     }
     // Edit from the library - check to see if we are replacing this media in *all* layouts.
     $replaceInLayouts = Kit::GetParam('replaceInLayouts', _POST, _CHECKBOX) == 1;
     $replaceBackgroundImages = Kit::GetParam('replaceBackgroundImages', _POST, _CHECKBOX) == 1;
     if ($mediaid != $this->mediaid && ($replaceInLayouts || $replaceBackgroundImages)) {
         $this->ReplaceMediaInAllLayouts($replaceInLayouts, $replaceBackgroundImages, $mediaid, $this->mediaid, $this->duration);
     }
     // Do we need to delete the old media item?
     if ($tmpName != '' && Kit::GetParam('deleteOldVersion', _POST, _CHECKBOX) == 1) {
         // We pass in the newMediaId as the second parameter so that we can correctly link a prior revision if one exists.
         if (!$mediaObject->Delete($mediaid, $this->mediaid)) {
             $this->response->message .= ' ' . __('Failed to remove old media');
         }
     }
     return $this->response;
 }
开发者ID:rovak73,项目名称:xibo-cms,代码行数:91,代码来源:module.class.php

示例2: ModuleList

 /**
  * Lists enabled modules
  * @return <XiboAPIResponse>
  */
 public function ModuleList()
 {
     // Does this user have permission to call this webservice method?
     if (!$this->user->PageAuth('content')) {
         return $this->Error(1, 'Access Denied');
     }
     Kit::ClassLoader('Media');
     // Create a media object and gather the required parameters.
     $media = new Media();
     if (!($modules = $media->ModuleList())) {
         return $this->Error($media->GetErrorNumber(), $media->GetErrorMessage());
     }
     return $this->Respond($this->NodeListFromArray($modules, 'module'));
 }
开发者ID:fignew,项目名称:xibo-cms,代码行数:18,代码来源:rest.class.php

示例3: tidyLibrary

 /**
  * Tidies up the library
  */
 public function tidyLibrary()
 {
     $response = new ResponseManager();
     if (Config::GetSetting('SETTING_LIBRARY_TIDY_ENABLED') != 1) {
         trigger_error(__('Sorry this function is disabled.'), E_USER_ERROR);
     }
     $media = new Media();
     if (!$media->deleteUnusedForUser($this->user->userid)) {
         trigger_error($media->GetErrorMessage(), E_USER_ERROR);
     }
     $response->SetFormSubmitResponse(__('Library Tidy Complete'));
     $response->Respond();
 }
开发者ID:fignew,项目名称:xibo-cms,代码行数:16,代码来源:content.class.php

示例4: Import

 function Import($zipFile, $layout, $userId, $template, $replaceExisting, $importTags, $delete = true)
 {
     // I think I might add a layout and then import
     if (!file_exists($zipFile)) {
         return $this->SetError(__('File does not exist'));
     }
     // Open the Zip file
     $zip = new ZipArchive();
     if (!$zip->open($zipFile)) {
         return $this->SetError(__('Unable to open ZIP'));
     }
     try {
         $dbh = PDOConnect::init();
         $sth = $dbh->prepare('SELECT mediaid, storedAs FROM `media` WHERE name = :name AND IsEdited = 0');
         // Get the layout details
         $layoutDetails = json_decode($zip->getFromName('layout.json'), true);
         // Set the layout name
         $layout = $layout != '' ? $layout : $layoutDetails['layout'];
         $description = isset($layoutDetails['description']) ? $layoutDetails['description'] : '';
         // Get the layout xml
         $xml = $zip->getFromName('layout.xml');
         // Add the layout
         if (!($layoutId = $this->Add($layout, $description, NULL, $userId, NULL, NULL, $xml))) {
             return false;
         }
         // Either remove out the tags, or add them to the DB
         if ($importTags) {
             // Pull the tags out of the XML
             $xmlDoc = new DOMDocument();
             $xmlDoc->loadXML($xml);
             $xpath = new DOMXPath($xmlDoc);
             $tagsNode = $xpath->query("//tags");
             foreach ($tagsNode as $tag) {
                 $this->tag($tag->nodeValue, $layoutId);
             }
         } else {
             $this->EditTags($layoutId, array());
         }
         // Are we a template?
         if ($template) {
             $this->tag('template', $layoutId);
         }
         // Tag as imported
         $this->tag('imported', $layoutId);
         // Set the DOM XML
         $this->SetDomXml($layoutId);
         // Set the user on each region
         foreach ($this->DomXml->getElementsByTagName('region') as $region) {
             $region->setAttribute('userId', $userId);
         }
         // Set the user on each media node
         foreach ($this->DomXml->getElementsByTagName('media') as $media) {
             $media->setAttribute('userId', $userId);
         }
         // We will need a file object and a media object
         $fileObject = new File();
         $mediaObject = new Media();
         $currentType = '';
         // Go through each region and add the media (updating the media ids)
         $mappings = json_decode($zip->getFromName('mapping.json'), true);
         foreach ($mappings as $file) {
             Debug::LogEntry('audit', 'Found file ' . json_encode($file));
             // Do we need to recharge our media object
             if ($currentType != '' && $file['type'] != $currentType) {
                 $mediaObject = new Media();
             }
             // Set the current type
             $currentType = $file['type'];
             // Does a media item with this name already exist?
             $sth->execute(array('name' => $file['name']));
             $rows = $sth->fetchAll();
             if (count($rows) > 0) {
                 if ($replaceExisting) {
                     // Alter the name of the file and add it
                     $file['name'] = 'import_' . $layout . '_' . uniqid();
                     // Add the file
                     if (!($fileId = $fileObject->NewFile($zip->getFromName('library/' . $file['file']), $userId))) {
                         return $this->SetError(__('Unable to add a media item'));
                     }
                     // Add this media to the library
                     if (!($mediaId = $mediaObject->Add($fileId, $file['type'], $file['name'], $file['duration'], $file['file'], $userId))) {
                         return $this->SetError($mediaObject->GetErrorMessage());
                     }
                     // Tag it
                     $mediaObject->tag('imported', $mediaId);
                 } else {
                     // Don't add the file, use the one that already exists
                     $mediaObject->mediaId = $rows[0]['mediaid'];
                     $mediaObject->storedAs = $rows[0]['storedAs'];
                 }
             } else {
                 // Add the file
                 if (!($fileId = $fileObject->NewFile($zip->getFromName('library/' . $file['file']), $userId))) {
                     return $this->SetError(__('Unable to add a media item'));
                 }
                 // Add this media to the library
                 if (!($mediaId = $mediaObject->Add($fileId, $file['type'], $file['name'], $file['duration'], $file['file'], $userId))) {
                     return $this->SetError($mediaObject->GetErrorMessage());
                 }
                 // Tag it
//.........这里部分代码省略.........
开发者ID:taphier,项目名称:xibo-cms,代码行数:101,代码来源:layout.data.class.php

示例5: EditLibraryMedia

 protected function EditLibraryMedia()
 {
     $db =& $this->db;
     $user =& $this->user;
     $layoutid = $this->layoutid;
     $regionid = $this->regionid;
     $mediaid = $this->mediaid;
     $userid = $this->user->userid;
     if (!$this->auth->edit) {
         $this->response->SetError('You do not have permission to edit this media.');
         $this->response->keepOpen = false;
         return $this->response;
     }
     // Hand off to the media module
     Kit::ClassLoader('media');
     $mediaObject = new Media($db);
     // Stored As from the XML
     $storedAs = $this->GetOption('uri');
     // File data
     $tmpName = Kit::GetParam('hidFileID', _POST, _STRING);
     $name = Kit::GetParam('name', _POST, _STRING);
     if ($this->auth->modifyPermissions) {
         $this->duration = Kit::GetParam('duration', _POST, _INT, 0);
     }
     // Revise this file?
     if ($tmpName != '') {
         Debug::LogEntry('audit', 'Uploading a new revision', 'module', 'EditLibraryMedia');
         // File name and extension (orignial name)
         $fileName = Kit::GetParam('txtFileName', _POST, _STRING);
         if ($name == '') {
             $name = $fileName;
         }
         if (!($new_mediaid = $mediaObject->FileRevise($mediaid, $tmpName, $fileName))) {
             $this->response->SetError($mediaObject->GetErrorMessage());
             $this->response->keepOpen = true;
             return $this->response;
         }
         // Are we on a region
         if ($regionid != '') {
             Kit::ClassLoader('layoutmediagroupsecurity');
             $security = new LayoutMediaGroupSecurity($db);
             $security->Copy($layoutid, $regionid, $mediaid, $new_mediaid);
         }
         // Required Attributes
         $this->mediaid = $new_mediaid;
         // Find out what we stored this item as
         $storedAs = $db->GetSingleValue(sprintf("SELECT StoredAs FROM `media` WHERE mediaid = %d", $new_mediaid), 'StoredAs', _STRING);
         $this->SetOption('uri', $storedAs);
         Debug::LogEntry('audit', 'New revision uploaded: ' . $storedAs, 'module', 'EditLibraryMedia');
     }
     // Edit the media record
     if (!$mediaObject->Edit($this->mediaid, $name, $this->duration, $userid)) {
         $this->response->SetError($mediaObject->GetErrorMessage());
         $this->response->keepOpen = true;
         return $this->response;
     }
     // Should have built the media object entirely by this time
     if ($regionid != '' && $this->showRegionOptions) {
         // This saves the Media Object to the Region
         $this->UpdateRegion();
         $this->response->loadForm = true;
         $this->response->loadFormUri = "index.php?p=timeline&layoutid={$layoutid}&regionid={$regionid}&q=RegionOptions";
     } elseif ($regionid != '' && !$this->showRegionOptions) {
         $this->UpdateRegion();
         $this->response->loadForm = false;
     } else {
         $this->response->message = 'Edited the ' . $this->displayType;
     }
     // Edit from the library - check to see if we are replacing this media in *all* layouts.
     if (Kit::GetParam('replaceInLayouts', _POST, _CHECKBOX) == 1) {
         $this->ReplaceMediaInAllLayouts($mediaid, $this->mediaid, $this->duration);
     }
     return $this->response;
 }
开发者ID:abbeet,项目名称:server39,代码行数:74,代码来源:module.class.php

示例6: Delete

 /**
  * Delete User
  * @return bool
  */
 public function Delete()
 {
     if (!isset($this->userId) || $this->userId == 0) {
         return $this->SetError(__('Missing userId'));
     }
     try {
         $dbh = PDOConnect::init();
         // Delete all layouts
         $layout = new Layout();
         if (!$layout->deleteAllForUser($this->userId)) {
             return $this->SetError($layout->GetErrorMessage());
         }
         // Delete all Campaigns
         $campaign = new Campaign();
         if (!$campaign->deleteAllForUser($this->userId)) {
             return $this->SetError($campaign->GetErrorMessage());
         }
         // Delete all media
         $media = new Media();
         if (!$media->deleteAllForUser($this->userId)) {
             return $this->SetError($media->GetErrorMessage());
         }
         // Delete all schedules that have not been caught by deleting layouts and campaigns
         // These would be schedules for other peoples layouts
         $schedule = new Schedule();
         if (!$schedule->deleteAllForUser($this->userId)) {
         }
         // Delete the user itself
         $sth = $dbh->prepare('DELETE FROM `user` WHERE userid = :userid');
         $sth->execute(array('userid' => $this->userId));
         // Delete from the session table
         $sth = $dbh->prepare('DELETE FROM `session` WHERE userid = :userid');
         $sth->execute(array('userid' => $this->userId));
         return true;
     } catch (Exception $e) {
         Debug::LogEntry('error', $e->getMessage(), get_class(), __FUNCTION__);
         if (!$this->IsError()) {
             $this->SetError(1, __('Unknown Error'));
         }
         return false;
     }
 }
开发者ID:fignew,项目名称:xibo-cms,代码行数:46,代码来源:userdata.data.class.php


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