Added number base
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
class Voicenumber extends mfBaseModel {
|
||||
|
||||
}
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user