added pagination to Voicenumberblock
This commit is contained in:
@@ -55,7 +55,7 @@
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="first">Erste Nummer *</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" class="form-control" name="first" id="first" value="<?=$block->first?>" />
|
||||
<input type="text" class="form-control" name="first" id="first" value="<?=$block->getFirst()?>" />
|
||||
<small>4080010</small>
|
||||
</div>
|
||||
</div>
|
||||
@@ -63,7 +63,7 @@
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="last">Letzte Nummer *</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" class="form-control" name="last" id="last" value="<?=$block->last?>" />
|
||||
<input type="text" class="form-control" name="last" id="last" value="<?=$block->getLast()?>" />
|
||||
<small>4080099</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -18,14 +18,14 @@ class Voicenumberblock extends mfBaseModel {
|
||||
}
|
||||
|
||||
public function getFirst() {
|
||||
if($this->number_add_zero) {
|
||||
if($this->number_prepend_zero) {
|
||||
return "0".$this->first;
|
||||
}
|
||||
return $this->first;
|
||||
}
|
||||
|
||||
public function getLast() {
|
||||
if($this->number_add_zero) {
|
||||
if($this->number_prepend_zero) {
|
||||
return "0".$this->last;
|
||||
}
|
||||
return $this->last;
|
||||
|
||||
@@ -99,9 +99,9 @@ class VoicenumberblockController extends mfBaseController {
|
||||
$data['areacode'] = $r->areacode;
|
||||
|
||||
if(substr($r->first,0,1) === "0") {
|
||||
$data['number_add_zero'] = 1;
|
||||
$data['number_prepend_zero'] = 1;
|
||||
} else {
|
||||
$data['number_add_zero'] = 0;
|
||||
$data['number_prepend_zero'] = 0;
|
||||
}
|
||||
$data['first'] = $r->first;
|
||||
$data['last'] = $r->last;
|
||||
|
||||
@@ -6,7 +6,7 @@ class VoicenumberblockModel {
|
||||
public $areacode;
|
||||
public $first;
|
||||
public $last;
|
||||
public $number_add_zero;
|
||||
public $number_prepend_zero;
|
||||
public $comment;
|
||||
|
||||
public $create_by;
|
||||
@@ -93,6 +93,15 @@ class VoicenumberblockModel {
|
||||
mfLoghandler::singleton()->debug($where);
|
||||
//mfLoghandler::singleton()->log->debug($where);
|
||||
$res = $db->select("Voicenumberblock", "*", "$where ORDER BY countrycode, areacode, first, last");
|
||||
|
||||
if(is_array($limit) && count($limit)) {
|
||||
if(is_numeric($limit['start']) && is_numeric($limit['count'])) {
|
||||
$sql .= " LIMIT ".$limit['start'].", ".$limit['count'];
|
||||
} elseif(is_numeric($count)) {
|
||||
$sql .= " LIMIT ".$limit['count'];
|
||||
}
|
||||
}
|
||||
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new Voicenumberblock($data);
|
||||
@@ -138,7 +147,7 @@ class VoicenumberblockModel {
|
||||
if(is_numeric($first)) {
|
||||
$where .= " AND first like '%$first%'";
|
||||
if($add_zero) {
|
||||
$where .= " AND number_add_zero = 1";
|
||||
$where .= " AND number_prepend_zero = 1";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -173,7 +182,7 @@ class VoicenumberblockModel {
|
||||
$where .= " AND first <= $number AND last >= $number";
|
||||
|
||||
if($add_zero) {
|
||||
$where .= " AND number_add_zero = 1";
|
||||
$where .= " AND number_prepend_zero = 1";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user