Custom Module stuck installing


#1

Hello,

I’m trying to develop a custom module. First I’d like to make a simple Test Module and go on form there.
But when I want to install my module in the cms, it just installs forever and never finishes.
I can’t find what’s wrong with the code.
Any help would be appreciated.

cippools.json:

{
  "title": "CIP Pools",
  "author": "Thomas F.",
  "description": "Zeigt freie Cip Pools.",
  "name": "cippools",
  "class": "Xibo\\Custom\\CipPools\\CipPools"
}

CipPools/CipPools.php:

<?php

namespace Xibo\Custom\CipPools;

class CipPools extends \Xibo\Widget\ModuleWidget {

public $codeSchemaVersion = 1;

public function init() {

}

public function installOrUpdate($moduleFactory) {
	// Install
	if ($this->module == null) {
		$module = $moduleFactory->createEmpty();
		$module->name = 'CipPools';
		$module->type = 'cippools';
		$module->viewPath = '../custom/CipPools';
		$module->class = 'Xibo\Custom\CipPools\CipPools';
		$module->description = 'Zeigt freie CIP Pools an';
		$module->imageUri = 'forms/library.gif';
		$module->enabled = 1;
		$module->previewEnabled = 1;
		$module->assignable = 1;
		$module->regionSpecific = 1;
		$module->renderAs = 'html';
		$module->schemaVersion = $this->codeSchemaVersion;
		$module->defaultDuration = 60;
		$module->settings = [];

		$this->setModule($module);
		$this->installModule();
	}

	$this->installFiles();
}

public function installFiles() {

}

public function settingsForm() {
	return 'cippools-form-settings';
}

public function settings() {
	return $this->module->settings;
}


public function add() {
	$this->saveWidget();
}

public function edit() {
	$this->saveWidget();
}

public function preview($width, $height, $scaleOverride = 0) {
	return $this->previewAsClient($width, $height, $scaleOverride);
}

public function getResource($displayId = 0) {
	$this
    ->initialiseGetResource()
    ->appendViewPortWidth($this->region->width)
    ->appendFontCss())
    ->appendBody('<h1>My HTML</h1>')
    ->appendJavaScript('$(document).ready(function() { $("h1").html("My Altered HTML"); } ');

return $this->finaliseGetResource();
}

public function IsValid() {
	return 1;
}
}

CipPools/cippools-form-add.twig:

{% extends "form-base.twig" %}
{% import "forms.twig" as forms %}

{% block formTitle %}
    {% trans "Test" %}
{% endblock %}

{% block formButtons %}
    {% trans "Cancel" %}, XiboDialogClose()
    {% trans "Save" %}, $("#rgraphAddForm").submit()
{% endblock %}

CipPools/cippools-form-edit.twig:

{% extends "form-base.twig" %}
{% import "forms.twig" as forms %}

{% block formTitle %}
    {% trans "Edit Test" %}
{% endblock %}

{% block formButtons %}
    {% trans "Cancel" %}, XiboDialogClose()
    {% trans "Save" %}, $("#rgraphEditForm").submit()
{% endblock %}

CipPools/cippools-form-settings.twig:

{% extends "module-form-settings.twig" %}
{% import "forms.twig" as forms %}

{% block moduleFormFields %}

    {% set title %}{% trans "Test" %}{% endset %}

{% endblock %}