芝麻web文件管理V1.00
编辑当前文件:/home/mgatv524/atvcmsTRASH.com.br/maisqtv/lib/Widget/VideoIn.php
. */ namespace Xibo\Widget; use InvalidArgumentException; use Respect\Validation\Validator as v; class VideoIn extends ModuleWidget { /** * Install or Update this module * @param ModuleFactory $moduleFactory */ public function installOrUpdate($moduleFactory) { if ($this->module == null) { // Install $module = $moduleFactory->createEmpty(); $module->name = 'Video In'; $module->type = 'videoin'; $module->class = 'Xibo\Widget\VideoIn'; $module->description = 'A module for displaying Video and Audio from an external source'; $module->imageUri = 'forms/video.gif'; $module->enabled = 1; $module->previewEnabled = 0; $module->assignable = 1; $module->regionSpecific = 1; $module->renderAs = 'native'; $module->schemaVersion = $this->codeSchemaVersion; $module->defaultDuration = 60; $module->settings = []; $this->setModule($module); $this->installModule(); } // Check we are all installed $this->installFiles(); } /** * Validate */ public function validate() { // Validate if (!v::stringType()->notEmpty()->validate($this->getOption('sourceId'))) throw new InvalidArgumentException(__('Please Select the sourceId')); if ($this->getUseDuration() == 1 && !v::intType()->min(1)->validate($this->getDuration())) throw new InvalidArgumentException(__('You must enter a duration.')); } public function add() { // Set some options $this->setDuration($this->getSanitizer()->getInt('duration', $this->getDuration())); $this->setUseDuration($this->getSanitizer()->getCheckbox('useDuration')); $this->setOption('sourceId', $this->getSanitizer()->getString('sourceId' , 'hdmi')); $this->validate(); // Save the widget $this->saveWidget(); } /** */ public function edit() { // Set some options $this->setDuration($this->getSanitizer()->getInt('duration', $this->getDuration())); $this->setUseDuration($this->getSanitizer()->getCheckbox('useDuration')); $this->setOption('sourceId', $this->getSanitizer()->getString('sourceId' ,'hdmi')); $this->validate(); // Save the widget $this->saveWidget(); } public function isValid() { // Client dependant return 2; } /** * Default code for the hover preview * @return string */ public function hoverPreview() { // Default Hover window contains a thumbnail, media type and duration $output = '
'; $output .= '
'; $output .= '
'; $output .= '
'; $output .= '
' . __('Type') . ': ' . $this->module->name . '
'; $output .= '
' . __('Name') . ': ' . $this->getName() . '
'; $output .= '
' . __('Input') . ': ' . $this->getOption('sourceId') . '
'; if ($this->getUseDuration() == 1) $output .= '
' . __('Duration') . ': ' . $this->widget->duration . ' ' . __('seconds') . '
'; $output .= '
'; $output .= '
'; $output .= '
'; return $output; } /** @inheritdoc */ public function getResource($displayId) { // Get resource isn't required for this module return null; } }