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


PHP Kit::ClassLoader方法代码示例

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


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

示例1: Delete

 /**
  * Delete Campaign
  * @param <type> $campaignId
  */
 public function Delete($campaignId)
 {
     Debug::LogEntry('audit', 'IN', 'Campaign', 'Delete');
     // Delete the Campaign record
     try {
         $dbh = PDOConnect::init();
         // Unlink all Layouts
         if (!$this->UnlinkAll($campaignId)) {
             throw new Exception(__('Unable to Unlink'));
         }
         // Remove all permissions
         Kit::ClassLoader('campaignsecurity');
         $security = new CampaignSecurity($this->db);
         if (!$security->UnlinkAll($campaignId)) {
             throw new Exception(__('Unable to set permissions'));
         }
         // Delete from the Campaign
         $sth = $dbh->prepare('DELETE FROM `campaign` WHERE CampaignID = :campaignid');
         $sth->execute(array('campaignid' => $campaignId));
         return true;
     } catch (Exception $e) {
         Debug::LogEntry('error', $e->getMessage());
         if (!$this->IsError()) {
             $this->SetError(25500, __('Unable to delete Campaign'));
         }
         return false;
     }
 }
开发者ID:abbeet,项目名称:server39,代码行数:32,代码来源:campaign.data.class.php

示例2: Permissions

 public function Permissions()
 {
     // Check the token
     if (!Kit::CheckToken()) {
         trigger_error(__('Sorry the form has expired. Please refresh.'), E_USER_ERROR);
     }
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     Kit::ClassLoader('datasetgroupsecurity');
     $dataSetId = Kit::GetParam('datasetid', _POST, _INT);
     $groupIds = Kit::GetParam('groupids', _POST, _ARRAY);
     $auth = $this->user->DataSetAuth($dataSetId, true);
     if (!$auth->modifyPermissions) {
         trigger_error(__('You do not have permissions to edit this dataset'), E_USER_ERROR);
     }
     // Unlink all
     $security = new DataSetGroupSecurity($db);
     if (!$security->UnlinkAll($dataSetId)) {
         trigger_error(__('Unable to set permissions'));
     }
     // Some assignments for the loop
     $lastGroupId = 0;
     $first = true;
     $view = 0;
     $edit = 0;
     $del = 0;
     // List of groupIds with view, edit and del assignments
     foreach ($groupIds as $groupPermission) {
         $groupPermission = explode('_', $groupPermission);
         $groupId = $groupPermission[0];
         if ($first) {
             // First time through
             $first = false;
             $lastGroupId = $groupId;
         }
         if ($groupId != $lastGroupId) {
             // The groupId has changed, so we need to write the current settings to the db.
             // Link new permissions
             if (!$security->Link($dataSetId, $lastGroupId, $view, $edit, $del)) {
                 trigger_error(__('Unable to set permissions'), E_USER_ERROR);
             }
             // 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($dataSetId, $lastGroupId, $view, $edit, $del)) {
             trigger_error(__('Unable to set permissions'), E_USER_ERROR);
         }
     }
     $response->SetFormSubmitResponse(__('Permissions Changed'));
     $response->Respond();
 }
开发者ID:fignew,项目名称:xibo-cms,代码行数:69,代码来源:dataset.class.php

示例3: GetDataSetItems

 private function GetDataSetItems($displayId, $text)
 {
     $db =& $this->db;
     // Extra fields for data sets
     $dataSetId = $this->GetOption('datasetid');
     $upperLimit = $this->GetOption('upperLimit');
     $lowerLimit = $this->GetOption('lowerLimit');
     $filter = $this->GetOption('filter');
     $ordering = $this->GetOption('ordering');
     Debug::LogEntry('audit', 'Then template for each row is: ' . $text);
     // Combine the column id's with the dataset data
     $matches = '';
     preg_match_all('/\\[(.*?)\\]/', $text, $matches);
     $columnIds = array();
     foreach ($matches[1] as $match) {
         // Get the column id's we are interested in
         Debug::LogEntry('audit', 'Matched column: ' . $match);
         $col = explode('|', $match);
         $columnIds[] = $col[1];
     }
     // Get the dataset results
     Kit::ClassLoader('dataset');
     $dataSet = new DataSet($db);
     $dataSetResults = $dataSet->DataSetResults($dataSetId, implode(',', $columnIds), $filter, $ordering, $lowerLimit, $upperLimit, $displayId, true);
     $items = array();
     foreach ($dataSetResults['Rows'] as $row) {
         // For each row, substitute into our template
         $rowString = $text;
         foreach ($matches[1] as $sub) {
             // Pick the appropriate column out
             $subs = explode('|', $sub);
             $rowString = str_replace('[' . $sub . ']', $row[$subs[0]], $rowString);
         }
         $items[] = $rowString;
     }
     return $items;
 }
开发者ID:abbeet,项目名称:server39,代码行数:37,代码来源:ticker.module.php

示例4: SetMemberOf

 /**
  * Sets the Members of a group
  * @return
  */
 public function SetMemberOf()
 {
     $db =& $this->db;
     $response = new ResponseManager();
     Kit::ClassLoader('displaygroup');
     $displayGroupObject = new DisplayGroup($db);
     $displayID = Kit::GetParam('DisplayID', _REQUEST, _INT);
     $displayGroups = Kit::GetParam('DisplayGroupID', _POST, _ARRAY, array());
     $members = array();
     // Get a list of current members
     $SQL = "";
     $SQL .= "SELECT displaygroup.DisplayGroupID ";
     $SQL .= "FROM   displaygroup ";
     $SQL .= "   INNER JOIN lkdisplaydg ON lkdisplaydg.DisplayGroupID = displaygroup.DisplayGroupID ";
     $SQL .= sprintf("WHERE  lkdisplaydg.DisplayID   = %d ", $displayID);
     $SQL .= " AND displaygroup.IsDisplaySpecific = 0 ";
     if (!($resultIn = $db->query($SQL))) {
         trigger_error($db->error());
         trigger_error(__('Error getting Display Groups'), E_USER_ERROR);
     }
     while ($row = $db->get_assoc_row($resultIn)) {
         // Test whether this ID is in the array or not
         $displayGroupID = Kit::ValidateParam($row['DisplayGroupID'], _INT);
         if (!in_array($displayGroupID, $displayGroups)) {
             // Its currently assigned but not in the $displays array
             //  so we unassign
             if (!$displayGroupObject->Unlink($displayGroupID, $displayID)) {
                 trigger_error($displayGroupObject->GetErrorMessage(), E_USER_ERROR);
             }
         } else {
             $members[] = $displayGroupID;
         }
     }
     foreach ($displayGroups as $displayGroupID) {
         // Add any that are missing
         if (!in_array($displayGroupID, $members)) {
             if (!$displayGroupObject->Link($displayGroupID, $displayID)) {
                 trigger_error($displayGroupObject->GetErrorMessage(), E_USER_ERROR);
             }
         }
     }
     $response->SetFormSubmitResponse(__('Group membership set'), false);
     $response->Respond();
 }
开发者ID:fignew,项目名称:xibo-cms,代码行数:48,代码来源:display.class.php

示例5: Permissions

 /**
  * Permissions Edit
  */
 public function Permissions()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     Kit::ClassLoader('mediagroupsecurity');
     Kit::ClassLoader('layoutmediagroupsecurity');
     $layoutId = Kit::GetParam('layoutid', _POST, _INT);
     $regionId = Kit::GetParam('regionid', _POST, _STRING);
     $mediaId = Kit::GetParam('mediaid', _POST, _STRING);
     $groupIds = Kit::GetParam('groupids', _POST, _ARRAY);
     if (!$this->auth->modifyPermissions) {
         trigger_error(__('You do not have permissions to edit this layout'), E_USER_ERROR);
     }
     // Unlink all
     if ($this->assignedMedia) {
         $layoutMediaSecurity = new LayoutMediaGroupSecurity($db);
         if (!$layoutMediaSecurity->UnlinkAll($layoutId, $regionId, $mediaId)) {
             trigger_error(__('Unable to set permissions'));
         }
     } else {
         $mediaSecurity = new MediaGroupSecurity($db);
         if (!$mediaSecurity->UnlinkAll($mediaId)) {
             trigger_error(__('Unable to set permissions'));
         }
     }
     // Some assignments for the loop
     $lastGroupId = 0;
     $first = true;
     $view = 0;
     $edit = 0;
     $del = 0;
     // List of groupIds with view, edit and del assignments
     foreach ($groupIds as $groupPermission) {
         $groupPermission = explode('_', $groupPermission);
         $groupId = $groupPermission[0];
         if ($first) {
             // First time through
             $first = false;
             $lastGroupId = $groupId;
         }
         if ($groupId != $lastGroupId) {
             // The groupId has changed, so we need to write the current settings to the db.
             // Link new permissions
             if ($this->assignedMedia) {
                 if (!$layoutMediaSecurity->Link($layoutId, $regionId, $mediaId, $lastGroupId, $view, $edit, $del)) {
                     trigger_error(__('Unable to set permissions'));
                 }
             } else {
                 if (!$mediaSecurity->Link($mediaId, $lastGroupId, $view, $edit, $del)) {
                     trigger_error(__('Unable to set permissions'));
                 }
             }
             // 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 ($this->assignedMedia) {
             if (!$layoutMediaSecurity->Link($layoutId, $regionId, $mediaId, $lastGroupId, $view, $edit, $del)) {
                 trigger_error(__('Unable to set permissions'));
             }
         } else {
             if (!$mediaSecurity->Link($mediaId, $lastGroupId, $view, $edit, $del)) {
                 trigger_error(__('Unable to set permissions'));
             }
         }
     }
     $response->SetFormSubmitResponse(__('Permissions Changed'));
     return $response;
 }
开发者ID:rovak73,项目名称:xibo-cms,代码行数:89,代码来源:module.class.php

示例6: switch

             }
         } else {
             // Only signed requests allowed.
             $serviceResponse->ErrorServerError('Not signed.');
         }
         Debug::LogEntry('audit', 'Authenticated API call for [' . $method . '] with a [' . $response . '] response. Issued by UserId: ' . $user->userid, 'Services');
         // Authenticated with OAuth.
         Kit::ClassLoader('Rest');
         // Detect response type requested.
         switch ($response) {
             case 'json':
                 Kit::ClassLoader('RestJson');
                 $rest = new RestJson($db, $user, $_REQUEST);
                 break;
             case 'xml':
                 Kit::ClassLoader('RestXml');
                 $rest = new RestXml($db, $user, $_REQUEST);
                 break;
             default:
                 $serviceResponse->ErrorServerError('Unknown response type');
         }
         // Run the method requested.
         if (method_exists($rest, $method)) {
             $serviceResponse->Success($rest->{$method}());
         } else {
             $serviceResponse->ErrorServerError('Unknown Method');
         }
         break;
     default:
         $serviceResponse->ErrorServerError('Not implemented.');
 }
开发者ID:abbeet,项目名称:server39,代码行数:31,代码来源:services.php

示例7: Import

 public function Import()
 {
     $db =& $this->db;
     $response = new ResponseManager();
     // What are we importing?
     $template = Kit::GetParam('template', _POST, _STRING, 'false');
     $template = $template == 'true';
     $layout = Kit::GetParam('layout', _POST, _STRING);
     $replaceExisting = Kit::GetParam('replaceExisting', _POST, _CHECKBOX);
     $importTags = Kit::GetParam('importTags', _POST, _CHECKBOX, !$template);
     // File data
     $tmpName = Kit::GetParam('hidFileID', _POST, _STRING);
     if ($tmpName == '') {
         trigger_error(__('Please ensure you have picked a file and it has finished uploading'), E_USER_ERROR);
     }
     // File name and extension (orignial name)
     $fileName = Kit::GetParam('txtFileName', _POST, _STRING);
     $fileName = basename($fileName);
     $ext = strtolower(substr(strrchr($fileName, "."), 1));
     // File upload directory.. get this from the settings object
     $fileLocation = Config::GetSetting('LIBRARY_LOCATION') . 'temp/' . $tmpName;
     Kit::ClassLoader('layout');
     $layoutObject = new Layout($this->db);
     if (!$layoutObject->Import($fileLocation, $layout, $this->user->userid, $template, $replaceExisting, $importTags)) {
         trigger_error($layoutObject->GetErrorMessage(), E_USER_ERROR);
     }
     $response->SetFormSubmitResponse(__('Layout Imported'));
     $response->Respond();
 }
开发者ID:rovak73,项目名称:xibo-cms,代码行数:29,代码来源:layout.class.php

示例8: FileRevise

 /**
  * Revises the file for this media id
  * @param int $mediaId
  * @param int $fileId
  * @param string $fileName
  * @param int $userId
  * @return bool|int
  */
 public function FileRevise($mediaId, $fileId, $fileName, $userId)
 {
     Debug::LogEntry('audit', 'IN', 'Media', 'FileRevise');
     try {
         $dbh = PDOConnect::init();
         // Check we have room in the library
         $libraryLimit = Config::GetSetting('LIBRARY_SIZE_LIMIT_KB');
         if ($libraryLimit > 0) {
             $sth = $dbh->prepare('SELECT IFNULL(SUM(FileSize), 0) AS SumSize FROM media');
             $sth->execute();
             if (!($row = $sth->fetch())) {
                 throw new Exception("Error Processing Request", 1);
             }
             $fileSize = Kit::ValidateParam($row['SumSize'], _INT);
             if ($fileSize / 1024 > $libraryLimit) {
                 $this->ThrowError(sprintf(__('Your library is full. Library Limit: %s K'), $libraryLimit));
             }
         }
         // Check this user doesn't have a quota
         if (!UserGroup::isQuotaFullByUser($userId)) {
             $this->ThrowError(__('You have exceeded your library quota.'));
         }
         // Call add with this file Id and then update the existing mediaId with the returned mediaId
         // from the add call.
         // Will need to get some information about the existing media record first.
         $sth = $dbh->prepare('SELECT name, duration, UserID, type FROM media WHERE MediaID = :mediaid');
         $sth->execute(array('mediaid' => $mediaId));
         if (!($row = $sth->fetch())) {
             $this->ThrowError(31, 'Unable to get information about existing media record.');
         }
         // Pass in the old media id ($mediaid) so that we don't validate against it during the name check
         if (!($newMediaId = $this->Add($fileId, $row['type'], $row['name'], $row['duration'], $fileName, $row['UserID'], $mediaId))) {
             throw new Exception("Error Processing Request", 1);
         }
         // We need to assign all permissions for the old media id to the new media id
         Kit::ClassLoader('mediagroupsecurity');
         $security = new MediaGroupSecurity($this->db);
         $security->Copy($mediaId, $newMediaId);
         // Update the existing record with the new record's id
         $sth = $dbh->prepare('UPDATE media SET isEdited = 1, editedMediaID = :newmediaid WHERE IFNULL(editedMediaID, 0) <> :newmediaid AND MediaID = :mediaid');
         $sth->execute(array('mediaid' => $mediaId, 'newmediaid' => $newMediaId));
         return $newMediaId;
     } catch (Exception $e) {
         Debug::LogEntry('error', $e->getMessage());
         if (!$this->IsError()) {
             $this->SetError(32, 'Unable to update existing media record');
         }
         return false;
     }
 }
开发者ID:taphier,项目名称:xibo-cms,代码行数:58,代码来源:media.data.class.php

示例9: RestoreDatabase

 /**
  * Restore the Database
  */
 public function RestoreDatabase()
 {
     $db =& $this->db;
     if (Config::GetSetting('SETTING_IMPORT_ENABLED') != 1) {
         trigger_error(__('Sorry this function is disabled.'), E_USER_ERROR);
     }
     include 'install/header.inc';
     echo '<div class="info">';
     // Expect a file upload
     // Check we got a valid file
     if (isset($_FILES['dumpFile']) && is_uploaded_file($_FILES['dumpFile']['tmp_name']) && $_FILES['dumpFile']['error'] == 0) {
         echo 'Restoring Database</br>';
         Debug::LogEntry('audit', 'Valid Upload', 'Backup', 'RestoreDatabase');
         // Directory location
         $fileName = Kit::ValidateParam($_FILES['dumpFile']['tmp_name'], _STRING);
         if (is_uploaded_file($fileName)) {
             // Move the uploaded file to a temporary location in the library
             $destination = tempnam(Config::GetSetting('LIBRARY_LOCATION'), 'dmp');
             move_uploaded_file($fileName, $destination);
             Kit::ClassLoader('maintenance');
             $maintenance = new Maintenance($this->db);
             // Use the maintenance class to restore the database
             if (!$maintenance->RestoreDatabase($destination)) {
                 trigger_error($maintenance->GetErrorMessage(), E_USER_ERROR);
             }
             unlink($destination);
         } else {
             trigger_error(__('Not a valid uploaded file'), E_USER_ERROR);
         }
     } else {
         trigger_error(__('Unable to upload file'), E_USER_ERROR);
     }
     echo '</div>';
     echo '<a href="index.php?p=admin">' . __('Database Restored. Click here to continue.') . '</a>';
     include 'install/footer.inc';
     die;
 }
开发者ID:fignew,项目名称:xibo-cms,代码行数:40,代码来源:admin.class.php

示例10: DeleteMedia

 public function DeleteMedia()
 {
     $dataSetId = $this->GetOption('datasetid');
     Kit::ClassLoader('dataset');
     $dataSet = new DataSet($this->db);
     $dataSet->UnlinkLayout($dataSetId, $this->layoutid, $this->regionid, $this->mediaid);
     return parent::DeleteMedia();
 }
开发者ID:fignew,项目名称:xibo-cms,代码行数:8,代码来源:ticker.module.php

示例11: Delete

 /**
  * Delete DataSet
  * @param <type> $dataSetId
  */
 public function Delete($dataSetId)
 {
     try {
         $dbh = PDOConnect::init();
         // First check to see if we have any data
         $sth = $dbh->prepare('SELECT * FROM `datasetdata` INNER JOIN `datasetcolumn` ON datasetcolumn.DataSetColumnID = datasetdata.DataSetColumnID WHERE datasetcolumn.DataSetID = :datasetid');
         $sth->execute(array('datasetid' => $dataSetId));
         if ($row = $sth->fetch()) {
             return $this->SetError(25005, __('There is data assigned to this data set, cannot delete.'));
         }
         // Delete security
         Kit::ClassLoader('datasetgroupsecurity');
         $security = new DataSetGroupSecurity($this->db);
         $security->UnlinkAll($dataSetId);
         // Delete columns
         $dataSetObject = new DataSetColumn($this->db);
         if (!$dataSetObject->DeleteAll($dataSetId)) {
             return $this->SetError(25005, __('Cannot delete dataset, columns could not be deleted.'));
         }
         // Delete data set
         $sth = $dbh->prepare('DELETE FROM dataset WHERE DataSetID = :datasetid');
         $sth->execute(array('datasetid' => $dataSetId));
         return true;
     } catch (Exception $e) {
         Debug::LogEntry('error', $e->getMessage());
         if (!$this->IsError()) {
             $this->SetError(25005, sprintf(__('Cannot edit dataset %s'), $dataSet));
         }
         return false;
     }
 }
开发者ID:abbeet,项目名称:server39,代码行数:35,代码来源:dataset.data.class.php

示例12: VersionInstructions

 public function VersionInstructions()
 {
     $response = new ResponseManager();
     Kit::ClassLoader('media');
     Kit::ClassLoader('display');
     Kit::ClassLoader('lkmediadisplaygroup');
     $displayGroupId = Kit::GetParam('displaygroupid', _POST, _INT);
     $mediaId = Kit::GetParam('mediaid', _POST, _INT);
     // Make sure we have permission to do this to this display
     $auth = $this->user->DisplayGroupAuth($displayGroupId, true);
     if (!$auth->edit) {
         trigger_error(__('You do not have permission to edit this display group'), E_USER_ERROR);
     }
     // Make sure we have permission to use this file
     $mediaAuth = $this->user->MediaAuth($mediaId, true);
     if (!$mediaAuth->view) {
         trigger_error(__('You have selected media that you no longer have permission to use. Please reload the form.'), E_USER_ERROR);
     }
     // Make sure this file is assigned to this display group
     $link = new LkMediaDisplayGroup($this->db);
     if (!$link->Link($displayGroupId, $mediaId)) {
         trigger_error($display->GetErrorMessage(), E_USER_ERROR);
     }
     // Get the "StoredAs" for this media item
     $media = new Media($this->db);
     $storedAs = $media->GetStoredAs($mediaId);
     // Get a list of displays for this group
     $displays = $this->user->DisplayList(array('displayid'), array('displaygroupid' => $displayGroupId));
     foreach ($displays as $display) {
         // Update the Display with the new instructions
         $displayObject = new Display($this->db);
         if (!$displayObject->SetVersionInstructions($display['displayid'], $mediaId, $storedAs)) {
             trigger_error($displayObject->GetErrorMessage(), E_USER_ERROR);
         }
     }
     $response->SetFormSubmitResponse(__('Version Instructions Set'));
     $response->Respond();
 }
开发者ID:abbeet,项目名称:server39,代码行数:38,代码来源:displaygroup.class.php

示例13: DeleteMedia

 public function DeleteMedia()
 {
     $dataSetId = $this->GetOption('datasetid');
     Debug::LogEntry('audit', sprintf('Deleting Media with DataSetId %d', $dataSetId), 'datasetview', 'DeleteMedia');
     Kit::ClassLoader('dataset');
     $dataSet = new DataSet($this->db);
     $dataSet->UnlinkLayout($dataSetId, $this->layoutid, $this->regionid, $this->mediaid);
     return parent::DeleteMedia();
 }
开发者ID:fignew,项目名称:xibo-cms,代码行数:9,代码来源:datasetview.module.php

示例14: ReorderTimeline

 /**
  * Reorder the timeline according to the media list provided
  * @param <type> $layoutId
  * @param <type> $regionId
  * @param <type> $mediaList
  */
 public function ReorderTimeline($layoutId, $regionId, $mediaList)
 {
     // Load the XML for this layout
     $xml = new DOMDocument("1.0");
     $xml->loadXML($this->GetLayoutXml($layoutId));
     //Get the Media Node in question in a DOMNode using Xpath
     $xpath = new DOMXPath($xml);
     $sequence = 0;
     $numberofMediaItems = count($mediaList);
     Debug::LogEntry('audit', 'There are ' . $numberofMediaItems . ' media items to reorder', 'region', 'ReorderTimeline');
     foreach ($mediaList as $mediaItem) {
         // Look for mediaid and lkid
         $mediaId = $mediaItem['mediaid'];
         $lkId = $mediaItem['lkid'];
         Debug::LogEntry('audit', 'RegionId: ' . $regionId . '. MediaId: ' . $mediaId . '. LkId: ' . $lkId, 'region', 'ReorderTimeline');
         if ($lkId == '') {
             $mediaNodeList = $xpath->query("//region[@id='{$regionId}']/media[@id='{$mediaId}']");
         } else {
             $mediaNodeList = $xpath->query("//region[@id='{$regionId}']/media[@lkid='{$lkId}']");
         }
         $mediaNode = $mediaNodeList->item(0);
         // Remove this node from its parent
         $mediaNode->parentNode->removeChild($mediaNode);
         // Get a NodeList of the Region specified (using XPath again)
         $regionNodeList = $xpath->query("//region[@id='{$regionId}']/media");
         // Insert the Media Node in question before this $sequence node
         if ($sequence == $numberofMediaItems - 1) {
             // Get the region node, and append the child node to the end
             $regionNode = $regionNodeList = $xpath->query("//region[@id='{$regionId}']")->item(0);
             $regionNode->appendChild($mediaNode);
         } else {
             // Get the $sequence node from the list
             $mediaSeq = $regionNodeList->item($sequence);
             $mediaSeq->parentNode->insertBefore($mediaNode, $mediaSeq);
         }
         // Increment the sequence
         $sequence++;
     }
     // Save it
     if (!$this->SetLayoutXml($layoutId, $xml->saveXML())) {
         return false;
     }
     // Update layout status
     Kit::ClassLoader('Layout');
     $layout = new Layout($this->db);
     $layout->SetValid($layoutId, true);
     return true;
 }
开发者ID:fignew,项目名称:xibo-cms,代码行数:54,代码来源:region.data.class.php

示例15: TimelineReorder

 /**
  * Re-orders a medias regions
  * @return
  */
 function TimelineReorder()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     // Vars
     $layoutId = Kit::GetParam('layoutid', _REQUEST, _INT);
     $regionId = Kit::GetParam('regionid', _POST, _STRING);
     $mediaList = Kit::GetParam('medialist', _POST, _STRING);
     // Check the user has permission
     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);
     }
     // Create a list of media
     if ($mediaList == '') {
         trigger_error(__('No media to reorder'));
     }
     // Trim the last | if there is one
     $mediaList = rtrim($mediaList, '|');
     // Explode into an array
     $mediaList = explode('|', $mediaList);
     // Store in an array
     $resolvedMedia = array();
     foreach ($mediaList as $mediaNode) {
         // Explode the second part of the array
         $mediaNode = explode(',', $mediaNode);
         $resolvedMedia[] = array('mediaid' => $mediaNode[0], 'lkid' => $mediaNode[1]);
     }
     // Hand off to the region object to do the actual reorder
     if (!$region->ReorderTimeline($layoutId, $regionId, $resolvedMedia)) {
         trigger_error($region->GetErrorMessage(), E_USER_ERROR);
     }
     $response->SetFormSubmitResponse(__('Order Changed'));
     $response->keepOpen = true;
     $response->Respond();
 }
开发者ID:abbeet,项目名称:server39,代码行数:44,代码来源:timeline.class.php


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