Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

ezisbngrouprange.php
Go to the documentation of this file.
1 <?php
25 class eZISBNGroupRange extends eZPersistentObject
26 {
30 static function definition()
31 {
32 return array( 'fields' => array( 'id' => array( 'name' => 'ID',
33 'datatype' => 'integer',
34 'default' => 0,
35 'required' => true ),
36 'from_number' => array( 'name' => 'FromNumber',
37 'datatype' => 'integer',
38 'default' => 0,
39 'required' => true ),
40 'to_number' => array( 'name' => 'ToNumber',
41 'datatype' => 'integer',
42 'default' => 0,
43 'required' => true ),
44 'group_from' => array( 'name' => 'GroupFrom',
45 'datatype' => 'string',
46 'default' => '',
47 'required' => true ),
48 'group_to' => array( 'name' => 'GroupTo',
49 'datatype' => 'string',
50 'default' => '',
51 'required' => true ),
52 'group_length' => array( 'name' => 'GroupLength',
53 'datatype' => 'integer',
54 'default' => 0,
55 'required' => true ),
56 ),
57 'keys' => array( 'id' ),
58 'increment_key' => 'id',
59 'class_name' => 'eZISBNGroupRange',
60 'name' => 'ezisbn_group_range' );
61 }
62
77 static function create( $fromNumber, $toNumber, $groupFrom, $groupTo, $length )
78 {
79 $row = array(
80 'id' => null,
81 'from_number' => $fromNumber,
82 'to_number' => $toNumber,
83 'group_from' => $groupFrom,
84 'group_to' => $groupTo,
85 'group_length' => $length );
86 return new eZISBNGroupRange( $row );
87 }
88
89
94 static function removeByID( $id )
95 {
96 eZPersistentObject::removeObject( eZISBNGroupRange::definition(),
97 array( 'id' => $id ) );
98 }
99
104 static function fetchList( $asObject = true )
105 {
106 $sortArray = array( 'from_number' => 'asc' );
107 return eZPersistentObject::fetchObjectList( eZISBNGroupRange::definition(),
108 null, null, $sortArray, null,
109 $asObject );
110 }
111
119 static function extractGroup( $isbnNr )
120 {
121 $groupRange = false;
122 $testSegment = substr( $isbnNr, 3, 5 );
123 if ( is_numeric( $testSegment ) )
124 {
125 $conditions = array( 'from_number' => array( '<=', $testSegment ),
126 'to_number' => array( '>=', $testSegment ) );
127 $groupRangeArray = eZPersistentObject::fetchObjectList( eZISBNGroupRange::definition(),
128 null, $conditions );
129 if ( count( $groupRangeArray ) == 1 )
130 {
131 $groupRange = $groupRangeArray[0];
132 }
133 }
134 return $groupRange;
135 }
136
141 static function cleanAll()
142 {
143 $db = eZDB::instance();
144 $definition = eZISBNGroupRange::definition();
145 $table = $definition['name'];
146 if ( $db->DatabaseName() == 'sqlite' )
147 $sql = "DELETE FROM " . $table;
148 else
149 {
150 $sql = "TRUNCATE TABLE " . $table;
151 }
152
153 $db->query( $sql );
154 }
155
156 }
157
158 ?>
eZDB\instance
static instance( $databaseImplementation=false, $databaseParameters=false, $forceNewInstance=false)
Definition: ezdb.php:117
eZISBNGroupRange
The class eZISBNGroupRange handle registration group ranges.
Definition: ezisbngrouprange.php:26
eZISBNGroupRange\fetchList
static fetchList( $asObject=true)
Definition: ezisbngrouprange.php:104
eZISBNGroupRange\cleanAll
static cleanAll()
Definition: ezisbngrouprange.php:141
eZISBNGroupRange\removeByID
static removeByID( $id)
Definition: ezisbngrouprange.php:94
eZISBNGroupRange\extractGroup
static extractGroup( $isbnNr)
Definition: ezisbngrouprange.php:119
eZISBNGroupRange\create
static create( $fromNumber, $toNumber, $groupFrom, $groupTo, $length)
Definition: ezisbngrouprange.php:77
eZISBNGroupRange\definition
static definition()
Definition: ezisbngrouprange.php:30
eZPersistentObject
Definition: ezpersistentobject.php:33
eZPersistentObject\removeObject
static removeObject( $def, $conditions=null, $extraConditions=null)
Definition: ezpersistentobject.php:271
eZPersistentObject\count
static count( $def, $conds=null, $field=null)
Definition: ezpersistentobject.php:187
eZPersistentObject\fetchObjectList
static fetchObjectList( $def, $field_filters=null, $conds=null, $sorts=null, $limit=null, $asObject=true, $grouping=false, $custom_fields=null, $custom_tables=null, $custom_conds=null)
Definition: ezpersistentobject.php:806
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.