insert_submit_name; $submitvalue = "e n t e r d e s i g n e r"; break; case 'edit': $submitname = $this->edit_submit_name; $submitvalue = "s u b m i t c h a n g e s"; break; } // switch $this->fields = array( 'name' => array( 'label' => 'Name', 'label_css' => 'black_11_bold', 'type' => array( 'tag'=> 'input_text', 'input_size' => 30, 'char_max' => 255 ), 'validation' => array('required') ), 'status_web' => array( 'label' => 'Web Status', 'label_css' => 'black_11_bold', 'type' => array( 'tag' => 'select', 'options' => array('active'=>'active','inactive'=>'inactive'), 'top_option' => array(), ), 'validation' => array('required'), 'default' => 'inactive' ), 'status_store' => array( 'label' => 'Store Status', 'label_css' => 'black_11_bold', 'type' => array( 'tag' => 'select', 'options' => array('active'=>'active','inactive'=>'inactive'), 'top_option' => array(), ), 'validation' => array('required'), 'default' => 'active' ), 'catalog_name_image' => array( 'label' => 'Vertical Name Image', 'label_css' => 'black_11_bold', 'type' => array( 'tag' => 'input_file' ) ), 'keywords' => array( 'label' => 'Keywords', 'label_css' => 'black_11_bold', 'type' => array( 'tag'=> 'input_text', 'input_size' => 50, 'char_max' => 255 ), 'html_after' => ' [used in meta tags, separated by a ,]' ), 'description' => array( 'label' => 'Description', 'label_css' => 'black_11_bold', 'type' => array( 'tag'=> 'textarea', 'cols' => 40, 'rows' => 10 ), 'html_after' => ' [used in meta tags]' ), 'notes' => array( 'label' => 'Notes', 'label_css' => 'black_11_bold', 'type' => array( 'tag'=> 'textarea', 'cols' => 40, 'rows' => 10 ) ), $submitname => array( 'type' => array( 'tag'=> 'input_submit', ), 'input_css' => 'blue_submit', 'default' => $submitvalue, ) ); if($form_type == 'edit' && isset($db_fields['catalog_name_image']) && $db_fields['catalog_name_image'] != '') { // show the pic $this->fields['catalog_name_image']['html_before'] = '
replace: '; } if($db_default) { foreach($this->fields as $fieldName=>$fieldInfo) { $exclude_fields = array(); if(!in_array($fieldName, $exclude_fields) && $fieldInfo['type']['tag'] != 'input_submit' && $fieldInfo['type']['tag'] != 'input_hidden') { $default = $db_fields[$fieldName]; $this->fields[$fieldName]['default'] = $default; } } } } function _validate($DesignerForm, $designer_id='') { // unique validation for this page // designer name must be unique $name = trim($DesignerForm->get_field_value('name')); if($name != '') { $name_sel = "SELECT * FROM $this->dbTableName WHERE name = '".addslashes($name)."'"; if($designer_id != '') { // for edits don't validate against itself for uniqueness $name_sel .= "AND id != '".$designer_id."'"; } if(Database::ado_get_row($name_sel)) { $DesignerForm->set_field_error('name', 'already exists'); $DesignerForm->set_error(TRUE); return(FALSE); } } } function _delete($designer_id) { Database::ado_execute_query("DELETE FROM $this->db_table WHERE id='$designer_id' LIMIT 1"); } } // class ?>