Exemplo n.º 1
0
 protected function handle_form_data($file, $index)
 {
     // Handle form data, e.g. $_REQUEST['description'][$index]
     // Link the file to the module
     $name = $_REQUEST['name'][$index];
     $duration = $_REQUEST['duration'][$index];
     $layoutId = Kit::GetParam('layoutid', _REQUEST, _INT);
     $type = Kit::GetParam('type', _REQUEST, _WORD);
     Debug::LogEntry('audit', 'Upload complete for Type: ' . $type . ' and file name: ' . $file->name . '. Name: ' . $name . '. Duration:' . $duration);
     // We want to create a module for each of the uploaded files.
     // Do not pass in the region ID so that we only assign to the library and not to the layout
     try {
         $module = ModuleFactory::createForLibrary($type, $layoutId, $this->options['db'], $this->options['user']);
     } catch (Exception $e) {
         $file->error = $e->getMessage();
         exit;
     }
     // We want to add this item to our library
     if (!($storedAs = $module->AddLibraryMedia($file->name, $name, $duration, $file->name))) {
         $file->error = $module->GetErrorMessage();
     }
     // Set new file details
     $file->storedas = $storedAs;
     // Delete the file
     @unlink($this->get_upload_path($file->name));
 }
 /**
  * Processes an incoming request, executes it and builds a response.
  *
  * @since 5.1
  * @param ModuleServerRequest $request Incoming request.
  * @param ModuleServerResponse $response Outcoming response.
  * @return void
  */
 public function process(ModuleServerRequest $request, ModuleServerResponse $response)
 {
     $command = explode(' ', $request->getCommand());
     $module_location = $command[1];
     if (!strlen($module_location)) {
         $response->sendWarning(ModuleServerResponse::SC_NOT_FOUND, 'Module location not defined.', ModuleServerRsponse::ERROR_CLASSNAME_MISSING);
         return;
     }
     try {
         $locator = new ModuleLocator('module://' . $request->getHeader('User') . ':' . $request->getHeader('Password') . '@/' . $module_location);
         $sessionId = $request->getHeader('Session');
         if ($sessionId) {
             $this->module = ModuleFactory::getSessionModule($locator, $sessionId);
         } else {
             $this->module = ModuleFactory::getModule($locator);
         }
     } catch (ModuleException $e) {
         $response->sendWarning(ModuleServerResponse::SC_INTERNAL_SERVER_ERROR, $e->__toString());
         return;
     } catch (\Exception $e) {
         $response->sendWarning(ModuleServerResponse::SC_INTERNAL_SERVER_ERROR, $e->__toString());
         return;
     }
     if (!($xmlrpc_server = xmlrpc_server_create())) {
         $response->sendWarning(ModuleServerResponse::SC_INTERNAL_SERVER_ERROR, 'Internal error: Could not create an XML-RPC server.', ModuleServerResponse::ERROR_XMLRPC_ERROR);
         return;
     }
     $theClass = new \ReflectionObject($this->module);
     $methods = $theClass->getMethods();
     foreach ($methods as $method) {
         // Ignore private methods
         $theMethod = new \ReflectionMethod($theClass->getName(), $method->getName());
         if (!$theMethod->isPublic()) {
             continue;
         }
         // Expose only methods beginning with "module" prefix
         if (!(substr($method->getName(), 0, 6) == 'module')) {
             continue;
         }
         xmlrpc_server_register_method($xmlrpc_server, strtolower($method->getName()), array($this, 'xmlrpcGateway'));
     }
     xmlrpc_server_register_introspection_callback($xmlrpc_server, array($this, 'introspectionGateway'));
     try {
         $buffer = xmlrpc_server_call_method($xmlrpc_server, $request->getPayload(), '', array('output_type' => 'xml'));
         $response->addHeader('Module/1.0 ' . ModuleServerResponse::SC_OK);
         $response->setBuffer($buffer);
     } catch (\Exception $e) {
         $response->addHeader('Module/1.0 ' . ModuleServerResponse::SC_INTERNAL_ERROR);
         $response->setBuffer($buffer);
     }
     xmlrpc_server_destroy($xmlrpc_server);
     $context = new ModuleContext($module_location);
     $session = new \Innomatic\Module\Session\ModuleSession($context, $sessionId);
     $session->save($this->module);
     $response->addHeader('Session: ' . $session->getId());
 }
Exemplo n.º 3
0
 /**
  * Replace media in all layouts.
  * @param <type> $oldMediaId
  * @param <type> $newMediaId
  */
 private function ReplaceMediaInAllLayouts($replaceInLayouts, $replaceBackgroundImages, $oldMediaId, $newMediaId)
 {
     $count = 0;
     Debug::LogEntry('audit', sprintf('Replacing mediaid %s with mediaid %s in all layouts', $oldMediaId, $newMediaId), 'module', 'ReplaceMediaInAllLayouts');
     try {
         $dbh = PDOConnect::init();
         // Some update statements to use
         $sth = $dbh->prepare('SELECT lklayoutmediaid, regionid FROM lklayoutmedia WHERE mediaid = :media_id AND layoutid = :layout_id');
         $sth_update = $dbh->prepare('UPDATE lklayoutmedia SET mediaid = :media_id WHERE lklayoutmediaid = :lklayoutmediaid');
         // Loop through a list of layouts this user has access to
         foreach ($this->user->LayoutList() as $layout) {
             $layoutId = $layout['layoutid'];
             // Does this layout use the old media id?
             $sth->execute(array('media_id' => $oldMediaId, 'layout_id' => $layoutId));
             $results = $sth->fetchAll();
             if (count($results) <= 0) {
                 continue;
             }
             Debug::LogEntry('audit', sprintf('%d linked media items for layoutid %d', count($results), $layoutId), 'module', 'ReplaceMediaInAllLayouts');
             // Create a region object for later use (new one each time)
             $layout = new Layout();
             $region = new region($this->db);
             // Loop through each media link for this layout
             foreach ($results as $row) {
                 // Get the LKID of the link between this layout and this media.. could be more than one?
                 $lkId = $row['lklayoutmediaid'];
                 $regionId = $row['regionid'];
                 if ($regionId == 'background') {
                     Debug::Audit('Replacing background image');
                     if (!$replaceBackgroundImages) {
                         continue;
                     }
                     // Straight swap this background image node.
                     if (!$layout->EditBackgroundImage($layoutId, $newMediaId)) {
                         return false;
                     }
                 } else {
                     if (!$replaceInLayouts) {
                         continue;
                     }
                     // Get the Type of this media
                     if (!($type = $region->GetMediaNodeType($layoutId, '', '', $lkId))) {
                         continue;
                     }
                     // Create a new media node use it to swap the nodes over
                     Debug::LogEntry('audit', 'Creating new module with MediaID: ' . $newMediaId . ' LayoutID: ' . $layoutId . ' and RegionID: ' . $regionId, 'region', 'ReplaceMediaInAllLayouts');
                     try {
                         $module = ModuleFactory::createForMedia($type, $newMediaId, $this->db, $this->user);
                     } catch (Exception $e) {
                         Debug::Error($e->getMessage());
                         return false;
                     }
                     // Sets the URI field
                     if (!$module->SetRegionInformation($layoutId, $regionId)) {
                         return false;
                     }
                     // Get the media xml string to use in the swap.
                     $mediaXmlString = $module->AsXml();
                     // Swap the nodes
                     if (!$region->SwapMedia($layoutId, $regionId, $lkId, $oldMediaId, $newMediaId, $mediaXmlString)) {
                         return false;
                     }
                 }
                 // Update the LKID with the new media id
                 $sth_update->execute(array('media_id' => $newMediaId, 'lklayoutmediaid' => $row['lklayoutmediaid']));
                 $count++;
             }
         }
     } catch (Exception $e) {
         Debug::LogEntry('error', $e->getMessage());
         if (!$this->IsError()) {
             $this->SetError(1, __('Unknown Error'));
         }
         return false;
     }
     Debug::LogEntry('audit', sprintf('Replaced media in %d layouts', $count), 'module', 'ReplaceMediaInAllLayouts');
 }
Exemplo n.º 4
0
 /**
  * Delete media from a region
  * @return <XiboAPIResponse>
  */
 public function LayoutRegionMediaDelete()
 {
     if (!$this->user->PageAuth('layout')) {
         return $this->Error(1, 'Access Denied');
     }
     $layoutId = $this->GetParam('layoutId', _INT);
     $regionId = $this->GetParam('regionId', _STRING);
     $mediaId = $this->GetParam('mediaId', _STRING);
     $lkId = $this->GetParam('lkId', _INT);
     // Does the user have permissions to view this region?
     if (!$this->user->LayoutAuth($layoutId)) {
         return $this->Error(1, 'Access Denied');
     }
     // Check the user has permission
     Kit::ClassLoader('region');
     $region = new region();
     $ownerId = $region->GetOwnerId($layoutId, $regionId);
     $regionAuth = $this->user->RegionAssignmentAuth($ownerId, $layoutId, $regionId, true);
     if (!$regionAuth->edit) {
         return $this->Error(1, 'Access Denied');
     }
     // Load the media information from the provided ids
     // Get the type from this media
     $entry = Media::Entries(null, array('mediaId' => $mediaId));
     if (count($entry) <= 0) {
         return $this->SetError(__('Error getting type from a media item.'));
     }
     // Create a module
     try {
         $module = ModuleFactory::load($entry[0]->mediaType, $layoutId, $regionId, $mediaId, $lkId, null, $this->user);
     } catch (Exception $e) {
         return $this->Error($e->getMessage());
     }
     if (!$module->auth->del) {
         return $this->Error(1, 'Access Denied');
     }
     // Delete the assignment from the region
     if (!$module->ApiDeleteRegionMedia($layoutId, $regionId, $mediaId)) {
         return $this->Error($module->errorMessage);
     }
     return $this->Respond($this->ReturnId('success', true));
 }
Exemplo n.º 5
0
 public function Install()
 {
     // Module file name
     $file = Kit::GetParam('module', _GET, _STRING);
     if ($file == '') {
         trigger_error(__('Unable to install module'), E_USER_ERROR);
     }
     Debug::LogEntry('audit', 'Request to install Module: ' . $file, 'module', 'Install');
     // Check that the file exists
     if (!file_exists($file)) {
         trigger_error(__('File does not exist'), E_USER_ERROR);
     }
     // Make sure the file is in our list of expected module files
     $files = glob('modules/*.module.php');
     if (!in_array($file, $files)) {
         trigger_error(__('Not a module file'), E_USER_ERROR);
     }
     // Load the file
     include_once $file;
     $type = str_replace('modules/', '', $file);
     $type = str_replace('.module.php', '', $type);
     // Load the module object inside the file
     if (!class_exists($type)) {
         trigger_error(__('Module file does not contain a class of the correct name'), E_USER_ERROR);
     }
     try {
         Debug::LogEntry('audit', 'Validation passed, installing module.', 'module', 'Install');
         $moduleObject = ModuleFactory::create($type, $this->db, $this->user);
         $moduleObject->InstallOrUpdate();
     } catch (Exception $e) {
         trigger_error(__('Unable to install module'), E_USER_ERROR);
     }
     Debug::LogEntry('audit', 'Module Installed: ' . $file, 'module', 'Install');
     // Excellent... capital... success
     $response = new ResponseManager();
     $response->refresh = true;
     $response->refreshLocation = 'index.php?p=module';
     $response->Respond();
 }
Exemplo n.º 6
0
 /**
  * Installs all files related to the enabled modules
  */
 public static function installAllModuleFiles()
 {
     $media = new Media();
     // Do this for all enabled modules
     foreach ($media->ModuleList() as $module) {
         // Install Files for this module
         $moduleObject = ModuleFactory::create($module['module']);
         $moduleObject->InstallFiles();
     }
 }
Exemplo n.º 7
0
<?php

define('IN_EZRPG', true);
if (!file_exists('./config.php')) {
    header('Location: install/index.php');
    exit(1);
}
require_once 'init.php';
$default_mod = 'Index';
$module_name = isset($_GET['mod']) && ctype_alnum($_GET['mod']) ? $_GET['mod'] : $default_mod;
//Header hooks
$module_name = $hooks->run_hooks('header', $module_name);
//Begin module
$module = ModuleFactory::factory($db, $tpl, $player, $module_name);
$module->start();
//Footer hooks
$hooks->run_hooks('footer', $module_name);
Exemplo n.º 8
0
 /**
  * Upgrade a Layout between schema versions
  * @param int $layoutId
  * @param int $resolutionId
  * @param int $scaleContent
  * @return bool
  */
 public function upgrade($layoutId, $resolutionId, $scaleContent)
 {
     // Get the Layout XML
     $this->SetDomXml($layoutId);
     // Get the Schema Versions
     $layoutVersion = (int) $this->DomXml->documentElement->getAttribute('schemaVersion');
     $width = (int) $this->DomXml->documentElement->getAttribute('width');
     $height = (int) $this->DomXml->documentElement->getAttribute('height');
     $color = $this->DomXml->documentElement->getAttribute('bgcolor');
     $version = Config::Version('XlfVersion');
     // Get some more info about the layout
     try {
         $dbh = PDOConnect::init();
         $sth = $dbh->prepare('SELECT backgroundImageId FROM `layout` WHERE layoutId = :layoutId');
         $sth->execute(array('layoutId' => $layoutId));
         // Look up the bg image from the media id given
         if (!($row = $sth->fetch())) {
             $this->ThrowError(__('Unable to get the Layout information'));
         }
     } catch (Exception $e) {
         Debug::LogEntry('error', $e->getMessage());
         if (!$this->IsError()) {
             $this->SetError(1, __('Unknown Error'));
         }
         return false;
     }
     Debug::Audit('Updating layoutId: ' . $layoutId . ' from version: ' . $layoutVersion . ' to: ' . $version);
     // Upgrade
     $this->delayFinalise = true;
     // Set the background
     $this->SetBackground($layoutId, $resolutionId, $color, $row['backgroundImageId']);
     // Get the Layout XML again (now that we have set the background)
     $this->SetDomXml($layoutId);
     // Get the Width and Height back out
     $updatedWidth = (int) $this->DomXml->documentElement->getAttribute('width');
     $updatedHeight = (int) $this->DomXml->documentElement->getAttribute('height');
     // Work out the ratio
     $ratio = min($updatedWidth / $width, $updatedHeight / $height);
     // Get all the regions.
     foreach ($this->GetRegionList($layoutId) as $region) {
         // New region object each time, because the region stores the layout xml
         $regionObject = new Region();
         $regionObject->delayFinalise = $this->delayFinalise;
         // Work out a new width and height
         $newWidth = $region['width'] * $ratio;
         $newHeight = $region['height'] * $ratio;
         $newTop = $region['top'] * $ratio;
         $newLeft = $region['left'] * $ratio;
         $regionObject->EditRegion($layoutId, $region['regionid'], $newWidth, $newHeight, $newTop, $newLeft, $region['name']);
         if ($scaleContent == 1) {
             Debug::Audit('Updating the scale of media in regionId ' . $region['regionid']);
             // Also update the width, height and font-size on each media item
             foreach ($regionObject->GetMediaNodeList($layoutId, $region['regionid']) as $mediaNode) {
                 // Run some regular expressions over each, to adjust the values by the ratio we have calculated.
                 // widths
                 $mediaId = $mediaNode->getAttribute('id');
                 $lkId = $mediaNode->getAttribute('lkid');
                 $mediaType = $mediaNode->getAttribute('type');
                 // Create a media module to handle all the complex stuff
                 $tmpModule = ModuleFactory::load($mediaType, $layoutId, $region['regionid'], $mediaId, $lkId);
                 // Get the XML
                 $mediaXml = $tmpModule->asXml();
                 // Replace widths
                 $mediaXml = preg_replace_callback('/width:(.*?)/', function ($matches) use($ratio) {
                     return "width:" . $matches[1] * $ratio;
                 }, $mediaXml);
                 // Replace heights
                 $mediaXml = preg_replace_callback('/height:(.*?)/', function ($matches) use($ratio) {
                     return "height:" . $matches[1] * $ratio;
                 }, $mediaXml);
                 // Replace fonts
                 $mediaXml = preg_replace_callback('/font-size:(.*?)px;/', function ($matches) use($ratio) {
                     return "font-size:" . $matches[1] * $ratio . "px;";
                 }, $mediaXml);
                 // Save this new XML
                 $tmpModule->SetMediaXml($mediaXml);
             }
         }
     }
     $this->delayFinalise = false;
     $this->SetValid($layoutId);
     return true;
 }
Exemplo n.º 9
0
 /**
  * Gets additional resources for assigned media
  * @param string $serverKey
  * @param string $hardwareKey
  * @param int $layoutId
  * @param string $regionId
  * @param string $mediaId
  * @return mixed
  * @throws SoapFault
  */
 function GetResource($serverKey, $hardwareKey, $layoutId, $regionId, $mediaId)
 {
     // Sanitize
     $serverKey = Kit::ValidateParam($serverKey, _STRING);
     $hardwareKey = Kit::ValidateParam($hardwareKey, _STRING);
     $layoutId = Kit::ValidateParam($layoutId, _INT);
     $regionId = Kit::ValidateParam($regionId, _STRING);
     $mediaId = Kit::ValidateParam($mediaId, _STRING);
     // Check the serverKey matches
     if ($serverKey != Config::GetSetting('SERVER_KEY')) {
         throw new SoapFault('Sender', 'The Server key you entered does not match with the server key at this address');
     }
     // Make sure we are sticking to our bandwidth limit
     if (!$this->CheckBandwidth()) {
         throw new SoapFault('Receiver', "Bandwidth Limit exceeded");
     }
     // Auth this request...
     if (!$this->AuthDisplay($hardwareKey)) {
         throw new SoapFault('Receiver', "This display client is not licensed");
     }
     // Validate the nonce
     $nonce = new Nonce();
     if (!$nonce->AllowedFile('resource', $this->displayId, NULL, $layoutId, $regionId, $mediaId)) {
         throw new SoapFault('Receiver', 'Requested an invalid file.');
     }
     // What type of module is this?
     $region = new region();
     $type = $region->GetMediaNodeType($layoutId, $regionId, $mediaId);
     if ($type == '') {
         throw new SoapFault('Receiver', 'Unable to get the media node type');
     }
     // Dummy User Object
     $user = new User();
     $user->userid = 0;
     $user->usertypeid = 1;
     // Initialise the theme (for global styles in GetResource)
     new Theme($user);
     Theme::SetPagename('module');
     // Get the resource from the module
     try {
         $module = ModuleFactory::load($type, $layoutId, $regionId, $mediaId, null, null, $user);
     } catch (Exception $e) {
         Debug::Error($e->getMessage(), $this->displayId);
         throw new SoapFault('Receiver', 'Cannot create module. Check CMS Log');
     }
     $resource = $module->GetResource($this->displayId);
     if (!$resource || $resource == '') {
         throw new SoapFault('Receiver', 'Unable to get the media resource');
     }
     // Log Bandwidth
     $this->LogBandwidth($this->displayId, Bandwidth::$GETRESOURCE, strlen($resource));
     return $resource;
 }
Exemplo n.º 10
0
 /**
  * Add Existing Media from the Library
  * @param [int] $user [A user object for the currently logged in user]
  * @param [int] $layoutId  [The LayoutID to Add on]
  * @param [int] $regionId  [The RegionID to Add on]
  * @param [array] $mediaList [A list of media ids from the library that should be added to to supplied layout/region]
  */
 public function AddFromLibrary($user, $layoutId, $regionId, $mediaList)
 {
     Debug::LogEntry('audit', 'IN', 'Region', 'AddFromLibrary');
     try {
         $dbh = PDOConnect::init();
         // Check that some media assignments have been made
         if (count($mediaList) == 0) {
             return $this->SetError(25006, __('No media to assign'));
         }
         // Loop through all the media
         foreach ($mediaList as $mediaId) {
             Debug::LogEntry('audit', 'Assigning MediaID: ' . $mediaId);
             $mediaId = Kit::ValidateParam($mediaId, _INT);
             // Get the type from this media
             $sth = $dbh->prepare('SELECT type FROM media WHERE mediaID = :mediaid');
             $sth->execute(array('mediaid' => $mediaId));
             if (!($row = $sth->fetch())) {
                 $this->ThrowError(__('Error getting type from a media item.'));
             }
             $mod = Kit::ValidateParam($row['type'], _WORD);
             try {
                 // Create the media object without any region and layout information
                 $module = ModuleFactory::createForMedia($mod, $mediaId, null, $user);
             } catch (Exception $e) {
                 return $this->SetError($e->getMessage());
             }
             // Check we have permissions to use this media (we will use this to copy the media later)
             if (!$module->auth->view) {
                 return $this->SetError(__('You have selected media that you no longer have permission to use. Please reload Library form.'));
             }
             if (!$module->SetRegionInformation($layoutId, $regionId)) {
                 return $this->SetError($module->GetErrorMessage());
             }
             if (!$module->UpdateRegion()) {
                 return $this->SetError($module->GetErrorMessage());
             }
             // Need to copy over the permissions from this media item & also the delete permission
             $security = new LayoutMediaGroupSecurity($this->db);
             $security->Link($layoutId, $regionId, $mediaId, $user->getGroupFromID($user->userid, true), $module->auth->view, $module->auth->edit, 1);
         }
         // Update layout status
         $layout = new Layout($this->db);
         $layout->SetValid($layoutId, true);
         return true;
     } catch (Exception $e) {
         Debug::LogEntry('error', $e->getMessage());
         if (!$this->IsError()) {
             $this->SetError(1, __('Unknown Error'));
         }
         return false;
     }
 }
Exemplo n.º 11
0
			$tree = rebuild($tree);

			
			/* Update the Db based on this new tree */
			reconstruct($tree, '', 0, $_POST['step1']['tb_prefix']);
		}
	}

	/* deal with the extra modules: */
	/* for each module in the modules table check if that module still exists in the mod directory. */
	/* if that module does not exist then check the old directory and prompt to have it copied */
	/* or delete it from the modules table. or maybe disable it instead? */
	if (version_compare($_POST['step1']['old_version'], '1.5.1', '>')) {
		define('TABLE_PREFIX', $_POST['step1']['tb_prefix']);
		require(AT_INCLUDE_PATH . '../mods/_core/modules/classes/Module.class.php');
		$moduleFactory = new ModuleFactory(FALSE);
		$module_list =& $moduleFactory->getModules(AT_MODULE_STATUS_DISABLED | AT_MODULE_STATUS_ENABLED);
		$keys = array_keys($module_list);
		foreach($keys as $dir_name) {
			$module =& $module_list[$dir_name];
			$module->setIsMissing($module->isExtra());
		}
	}

	/* fixed the typo of "fuild" theme that was introduced in 1.6.1 : */
	if (version_compare($_POST['step1']['new_version'], '1.6.0', '>')) {
		$sql = "UPDATE ".$_POST['step1']['tb_prefix']."themes 
		           SET title='Fluid', dir_name='fluid'
		         WHERE dir_name='fuild'";
		mysql_query($sql, $db);
		
Exemplo n.º 12
0
 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();
 }
Exemplo n.º 13
0
 public function setView()
 {
     $this->router = RouteParser::Instance();
     $this->router->ParseRoute(isset($_GET['url']) ? $_GET['url'] : '');
     if (!isset($this->login_required)) {
         $this->login_required = FALSE;
     }
     $this->modules = ModuleFactory::Factory(null, $this->login_required);
     $this->pid = $this->router->Dispatch('pid');
     $this->view = new View();
     $this->setContext();
     $this->view->set('help_link', $this->access->setHelpContext($this->pid));
     $this->view->set('modules', $this->modules);
     if (count($this->modules) > 0) {
         $modtype = 'module';
         foreach ($this->modules as $module) {
             $this->view->set($modtype, strtolower($module));
             $modtype = 'sub' . $modtype;
         }
     }
     if (isset($_GET['ajax'])) {
         $this->ajax = TRUE;
     }
     if (isset($_GET['json'])) {
         $this->json = TRUE;
     }
     // echo 'system::setView modules=<pre>'.print_r($this->modules,TRUE).'</pre><br>';
 }