Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save gunnicom/f2f1f006ed859b636decd852a59daa59 to your computer and use it in GitHub Desktop.
Save gunnicom/f2f1f006ed859b636decd852a59daa59 to your computer and use it in GitHub Desktop.
<?php
require_once('modules/DynamicFields/templates/Fields/TemplateText.php');
class TemplateAutoincrement extends TemplateText{
var $type = 'autoincrement';
function get_field_def(){
$def = parent::get_field_def();
$def['studio'] = 'visible';
$def['type'] = 'autoincrement';
$def['dbType'] = 'int';
if( isset($this->ext1) ) $def[ 'startindex' ] = $this->ext1 ;
if( isset($this->ext2) ) $def[ 'interval' ] = $this->ext2 ;
return $def;
}
function __construct() {
$this->vardef_map['startindex'] = 'ext1';
$this->vardef_map['interval'] = 'ext2';
}
function set($values){
parent::set($values);
if(!empty($this->ext1)){
$this->startindex = $this->ext1;
}
if(!empty($this->ext2)){
$this->interval = $this->ext2;
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment