Added number base

This commit is contained in:
Frank Schubert
2021-12-21 22:59:29 +01:00
parent 9413110d5c
commit dfb33e1989
4 changed files with 28 additions and 0 deletions

View File

@@ -116,6 +116,7 @@
<th>Name</th>
<th>Landeskennzahl</th>
<th>Ortskennzahl</th>
<th>Nummernbasis</th>
<th>Anfang</th>
<th>Ende</th>
<th>Kommentar</th>
@@ -126,6 +127,7 @@
<td><?=$block->name?></td>
<td><?=$block->countrycode?></td>
<td><?=$block->areacode?></td>
<td><?=$block->base?></td>
<td><?=$block->getFirst()?></td>
<td><?=$block->getLast()?></td>
<td><?=$block->comment?></td>

View File

@@ -0,0 +1,5 @@
<?php
class Voicenumber extends mfBaseModel {
}

View File

@@ -0,0 +1,8 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

View File

@@ -4,6 +4,7 @@ class Voicenumberblock extends mfBaseModel {
protected $forcestr = ['comment'];
private $number_first;
private $number_last;
private $base;
private $files;
private $numbers;
@@ -31,6 +32,14 @@ class Voicenumberblock extends mfBaseModel {
return $this->last;
}
public function getBaseNumber() {
$base = floor($this->first / pow(10, ceil(log10($this->last - $this->first))));
if($this->number_prepend_zero) {
return "0".$base;
}
return $base;
}
public function getProperty($name) {
if($this->$name == null) {
@@ -53,6 +62,10 @@ class Voicenumberblock extends mfBaseModel {
return $this->getFullNumber(true);
}
if($name == "base") {
return $this->getBaseNumber();
}
$classname = ucfirst($name);
$idfield = $name."_id";
$this->$name = new $classname($this->$idfield);