controllers/commands/Zone.php
public function cmdDeleteZone()
    {
        $id = $this->getParam(0);
        $all = $this->getParam('all');

        if (empty($id) && empty($all)) {
            $this->errorAndExit($this->text('Invalid command'));
        }

        $result = false;

        if (!empty($id)) {
            $result = $this->zone->delete($id);
        } else if (!empty($all)) {

            $deleted = $count = 0;
            foreach ($this->zone->getList() as $zone) {
                $count++;
                $deleted += (int) $this->zone->delete($zone['zone_id']);
            }

            $result = $count && $count == $deleted;
        }

        if (empty($result)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        $this->output();
    }
public function cmdDeleteZone()
    {
        $id = $this->getParam(0);
        $all = $this->getParam('all');

        if (empty($id) && empty($all)) {
            $this->errorAndExit($this->text('Invalid command'));
        }

        $result = false;

        if (!empty($id)) {
            $result = $this->zone->delete($id);
        } else if (!empty($all)) {

            $deleted = $count = 0;
            foreach ($this->zone->getList() as $zone) {
                $count++;
                $deleted += (int) $this->zone->delete($zone['zone_id']);
            }

            $result = $count && $count == $deleted;
        }

        if (empty($result)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        $this->output();
    }
public function cmdDeleteZone ( ) { $ id = $ this -> getParam ( 0 ) ; $ all = $ this -> getParam ( 'all' ) ; if ( empty ( $ id ) && empty ( $ all ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } $ result = false ; if ( ! empty ( $ id ) ) { $ result = $ this -> zone -> delete ( $ id ) ; } else if ( ! empty ( $ all ) ) { $ deleted = $ count = 0 ; foreach ( $ this -> zone -> getList ( ) as $ zone ) { $ count ++ ; $ deleted += ( int ) $ this -> zone -> delete ( $ zone [ 'zone_id' ] ) ; } $ result = $ count && $ count == $ deleted ; } if ( empty ( $ result ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } $ this -> output ( ) ; }
Callback for "zone-delete" command
Callback for zone - delete command