Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 3.135.185.207
<?php
class userSchemaElements
{
public $login_ctr;
public $user_id;
public $aobj_context;
//Start : Constructor
function __construct($aobj_context)
{
session_start();
$this->aobj_context=$aobj_context;
$this->aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
}
function AssignDatavalues()
{
$this->internal_code=$this->aobj_context->mobj_data["internal_code"];
$this->ref_s_user_schema_code =$this->aobj_context->mobj_data["elemenmt_user_schema"];
$this->name =addslashes(stripslashes($this->aobj_context->mobj_data["user_schema_element_name"]));
$this->system_name =$this->aobj_context->mobj_data["user_schema_system_name"];
$this->data_type =$this->aobj_context->mobj_data["user_schema_element_type"];
$this->decimals =$this->aobj_context->mobj_data["decimal"];
$this->decimal_value =$this->aobj_context->mobj_data["decimal"]+12;
$this->list_of_values =$this->aobj_context->mobj_data["lov"];
$this->sequence =$this->aobj_context->mobj_data["user_schema_element_sequence"];
$this->field_position =$this->aobj_context->mobj_data["user_schema_element_field_position"];
$this->ref_s_user_schema_group_code =$this->aobj_context->mobj_data["elemenmt_user_schema_group"];
$this->description =addslashes(stripslashes($this->aobj_context->mobj_data["user_schema_element_description"]));
$this->default_value =addslashes(stripslashes($this->aobj_context->mobj_data["user_schema_element_default_value"]));
$this->optional =$this->aobj_context->mobj_data["is_user_schema_element_optional"];
$this->ref_module_code =$this->aobj_context->mobj_data["ref_module_code"];
$this->ref_module_code_ref_field =$this->aobj_context->mobj_data["ref_module_code_ref_field"];
$this->ref_module_code_ref_field_on =$this->aobj_context->mobj_data["ref_module_code_ref_field_on"];
$this->ref_module_code_ref_field_const =$this->aobj_context->mobj_data["ref_module_code_ref_field_const"];
$this->is_ref_module_code_lov =$this->aobj_context->mobj_data["is_lov"];
$this->s_ref_type_meta =$this->aobj_context->mobj_data["meta_type"];
$get_meta_type="select value as meta_type from s_ref_type where internal_code={$this->s_ref_type_meta}";
$lobj_get_meta_type = $this->aobj_context->mobj_db->GetRow($get_meta_type);
$this->meta_type=$lobj_get_meta_type[meta_type];
$this->linked_field =$this->aobj_context->mobj_data["linked_field"];
$this->source_field =$this->aobj_context->mobj_data["source_fields"];
$this->suffix =$this->aobj_context->mobj_data["suffix"];
$this->width =$this->aobj_context->mobj_data["width"];
$this->padding =$this->aobj_context->mobj_data["padding"];
$this->is_visible =$this->aobj_context->mobj_data["is_visible"];
$this->is_read_only =$this->aobj_context->mobj_data["is_read_only"];
$this->is_unique =$this->aobj_context->mobj_data["is_unique"];
$this->include_in_pop_up =$this->aobj_context->mobj_data["include_in_pop_up"];
$this->include_in_grid = ($this->aobj_context->mobj_data["include_in_grid"]);
$this->include_group_element_in_header = ($this->aobj_context->mobj_data["include_group_element_in_header"]);
$this->is_key_field = ($this->aobj_context->mobj_data["is_key_field"]);
$this->on_enter =addslashes(stripslashes($this->aobj_context->mobj_data["on_enter"]));
$this->on_exit =addslashes(stripslashes($this->aobj_context->mobj_data["on_exit"]));
$this->conditional_display =addslashes(stripslashes($this->aobj_context->mobj_data["user_schema_element_conditional_display"]));
$this->grid_width = ($this->aobj_context->mobj_data["user_schema_element_grid_width"]);
$this->grid_width = (empty($this->grid_width))?0:$this->grid_width;
$this->is_lov = ($this->aobj_context->mobj_data["is_lov"]);
$this->populate_lov = ($this->aobj_context->mobj_data["is_populate_lov"]);
$this->text_area_rows = ($this->aobj_context->mobj_data["user_schema_element_text_area_rows"]);
$this->text_area_rows=empty($this->text_area_rows)?2:$this->text_area_rows;
$get_multiple_group="select multiple from s_user_schema_group
where internal_code={$this->ref_s_user_schema_group_code}";
$lobj_multiple_group = $this->aobj_context->mobj_db->GetRow($get_multiple_group);
if(!empty($lobj_multiple_group))
$this->is_multiple_group=$lobj_multiple_group[multiple];
else
$this->is_multiple_group=0;
$insert_linked_table="select ref_module_code from s_user_schema_elements
where internal_code={$this->ref_s_user_schema_code} ";
$lobj_inked_table = $this->aobj_context->mobj_db->GetRow($insert_linked_table);
if(!empty($lobj_inked_table))
$this->lobj_inked_table_id=$lobj_inked_table[ref_module_code];
else
$this->lobj_inked_table_id='0';
$this->system_module_table_name="module_{$this->ref_s_user_schema_code}";
}
function GetExstingUserSchemaElementValues()
{
$get_exsting_values="select * from s_user_schema_elements where
internal_code={$this->internal_code}";
$lobj_get_exsting_values = $this->aobj_context->mobj_db->GetRow($get_exsting_values);
$this->e_internal_code=$lobj_get_exsting_values["internal_code"];
$this->e_ref_s_user_schema_code =$lobj_get_exsting_values["ref_s_user_schema_code"];
$this->e_name =$lobj_get_exsting_values["name"];
$this->e_db_field =$lobj_get_exsting_values["db_field"];
$this->e_data_type =$lobj_get_exsting_values["data_type"];
$this->e_decimals =$lobj_get_exsting_values["decimals"];
$this->e_decimal_value =$lobj_get_exsting_values["decimal"]+12;
$this->e_list_of_values =$lobj_get_exsting_values["list_of_values"];
$this->e_sequence =$lobj_get_exsting_values["sequence"];
$this->e_field_position =$lobj_get_exsting_values["field_position"];
$this->e_ref_s_user_schema_group_code =$lobj_get_exsting_values["ref_s_user_schema_group_code"];
$this->e_description =$lobj_get_exsting_values["description"];
$this->e_default_value =$lobj_get_exsting_values["default_value"];
$this->e_optional =$lobj_get_exsting_values["optional"];
$this->e_ref_module_code =$lobj_get_exsting_values["ref_module_code"];
$this->e_ref_module_code_ref_field =$lobj_get_exsting_values["ref_module_code_ref_field"];
$this->e_ref_module_code_ref_field_on =$lobj_get_exsting_values["ref_module_code_ref_field_on"];
$this->e_ref_module_code_ref_field_const =$lobj_get_exsting_values["ref_module_code_ref_field_const"];
$this->e_is_ref_module_code_lov =$lobj_get_exsting_values["is_ref_module_code_lov"];
$this->e_s_ref_type_meta =$lobj_get_exsting_values["s_ref_type_meta"];
$get_meta_type="select value as meta_type from s_ref_type where internal_code={$this->e_s_ref_type_meta}";
$lobj_get_meta_type = $this->aobj_context->mobj_db->GetRow($get_meta_type);
$this->e_meta_type=$lobj_get_meta_type[meta_type];
$this->e_suffix =$lobj_get_exsting_values["suffix"];
$this->e_width =$lobj_get_exsting_values["width"];
$this->e_padding =$lobj_get_exsting_values["padding"];
$this->e_is_visible =$lobj_get_exsting_values["is_visible"];
$this->e_is_read_only =$lobj_get_exsting_values["is_read_only"];
$this->e_is_unique =$lobj_get_exsting_values["is_unique"];
$this->e_include_in_pop_up =$lobj_get_exsting_values["include_in_pop_up"];
$this->e_include_in_grid =$lobj_get_exsting_values["include_in_grid"];
$this->e_include_group_element_in_header =$lobj_get_exsting_values["include_group_element_in_header"];
$this->e_is_key_field = $lobj_get_exsting_values["is_key_field"];
$this->e_on_enter =$lobj_get_exsting_values["on_enter"];
$this->e_on_exit =$lobj_get_exsting_values["on_exit"];
$this->e_conditional_display =$lobj_get_exsting_values["conditional_display"];
$this->e_grid_width = $lobj_get_exsting_values["grid_width"];
$this->e_grid_width = (empty($this->e_grid_width))?0:$this->e_grid_width;
$this->e_is_lov = $lobj_get_exsting_values["is_lov"];
$this->e_populate_lov = $lobj_get_exsting_values["populate_lov"];
$this->e_text_area_rows = $lobj_get_exsting_values["text_area_rows"];
$this->e_text_area_rows=empty($this->e_text_area_rows)?2:$this->e_text_area_rows;
$get_multiple_group="select multiple from s_user_schema_group
where internal_code={$this->e_ref_s_user_schema_group_code}";
$lobj_multiple_group = $this->aobj_context->mobj_db->GetRow($get_multiple_group);
if(!empty($lobj_multiple_group))
$this->e_is_multiple_group=$lobj_multiple_group[is_multiple_group];
else
$this->e_is_multiple_group=0;
$insert_linked_table="select ref_module_code from s_user_schema_elements
where internal_code={$this->e_ref_s_user_schema_code} ";
$lobj_inked_table = $this->aobj_context->mobj_db->GetRow($insert_linked_table);
if(!empty($lobj_inked_table))
$this->lobj_inked_table_id=$lobj_inked_table[ref_module_code];
else
$this->lobj_inked_table_id='0';
}
function UpdateExstingUserSchemaElements()
{
$lstr_qry = "update s_user_schema_elements set
ref_s_user_schema_code='{$this->ref_s_user_schema_code}',
name='{$this->name}',
system_name='{$this->system_name}',
db_field='{$this->system_name}',
data_type='{$this->data_type}',
sequence='{$this->sequence}',
field_position='{$this->field_position}',
ref_s_user_schema_group_code='{$this->ref_s_user_schema_group_code}',
description='{$this->description}',
default_value='{$this->default_value}',
optional='{$this->optional}',
list_of_values='{$this->list_of_values}',
linked_field='{$this->linked_field}',
source_field='{$this->source_field}',
suffix='{$this->suffix}',
width='{$this->width}',
padding='{$this->padding}',
is_read_only='{$this->is_read_only}',
is_unique={$this->is_unique},
include_in_popup='{$this->include_in_pop_up}',
linked_field_table='{$this->lobj_inked_table_id}',
is_visible='{$this->is_visible}',
is_ref_module_code_lov='{$this->is_ref_module_code_lov}',
populate_lov='{$this->populate_lov}',
conditional_display='{$this->conditional_display}',
on_enter='{$this->on_enter}',
on_exit='{$this->on_exit}',
is_key_field={$this->is_key_field},
include_in_grid={$this->include_in_grid},
include_group_ele_in_header={$this->include_group_element_in_header},
ref_module_code_ref_field='{$this->ref_module_code_ref_field}',
ref_module_code_ref_field_on='{$this->ref_module_code_ref_field_on}',
ref_module_code_ref_field_const='{$this->ref_module_code_ref_field_const}',
decimals ='{$this->decimals}',
ref_module_code='{$this->ref_module_code}',
s_ref_type_meta='{$this->s_ref_type_meta}',
is_multiple_group='{$this->is_multiple_group}',
grid_width='{$this->grid_width}',
text_area_rows='{$this->text_area_rows}' where internal_code ={$this->internal_code}";
//echo $lstr_qry; die();
$lobj_rs = $this->aobj_context->mobj_db->Execute($lstr_qry);
}
function GetIsElementIsMultiGroup()
{
$is_group_details=" select count(*) as counts from
s_user_schema_elements suse
inner join s_user_schema_group susg
on susg.internal_code=suse.ref_s_user_schema_group_code
inner join s_user_schema sus on sus.internal_code=susg.ref_s_user_schema_code
inner join s_ref_type s1 on s1.internal_code=suse.s_ref_type_meta
and s1.value='Meta'
left join s_ref_type s on s.internal_code=suse.data_type
where suse.internal_code={$this->last_inserted_id}
and ((multiple=1) or (multiple=0 and parent_group_code<>0) )";
$this->lobj_is_group_details = $this->aobj_context->mobj_db->GetRow($is_group_details);
// echo $is_group_details;
}
function InsertUserSchemaElementsDetails()
{
$insert_qry="insert into s_user_schema_elements (
ref_s_user_schema_code,
name,
system_name,
data_type,
decimals,
list_of_values,
sequence,
field_position,
ref_s_user_schema_group_code,
description,
default_value,
optional,
ref_module_code,
ref_module_code_ref_field,
ref_module_code_ref_field_on,
ref_module_code_ref_field_const,
is_ref_module_code_lov,
s_ref_type_meta,
is_multiple_group,
linked_field,
linked_field_table,
source_field,
suffix,
width,
padding,
is_visible,
is_read_only,
is_unique,
db_field,
include_in_popup,
include_in_grid,
include_group_ele_in_header,
is_key_field,
on_enter,
on_exit,
conditional_display,
grid_width,
populate_lov,
text_area_rows)
values (
'{$this->ref_s_user_schema_code}',
'{$this->name}',
'{$this->system_name}',
'{$this->data_type}',
'{$this->decimals}',
'{$this->list_of_values}',
'{$this->sequence}',
'{$this->field_position}',
'{$this->ref_s_user_schema_group_code}',
'{$this->description}',
'{$this->default_value}',
'{$this->optional}',
'{$this->ref_module_code}',
'{$this->ref_module_code_ref_field}',
'{$this->ref_module_code_ref_field_on}',
'{$this->ref_module_code_ref_field_const}',
'{$this->is_ref_module_code_lov}',
'{$this->s_ref_type_meta}',
'{$this->is_multiple_group}',
'{$this->linked_field}',
'{$this->lobj_inked_table_id}',
'{$this->source_field}',
'{$this->suffix}',
'{$this->width}',
'{$this->padding}',
'{$this->is_visible}',
'{$this->is_read_only}',
'{$this->is_unique}',
'{$this->system_name}',
'{$this->include_in_pop_up}',
'{$this->include_in_grid}',
'{$this->include_group_element_in_header}',
'{$this->is_key_field}',
'{$this->on_enter}',
'{$this->on_exit}',
'{$this->conditional_display}',
'{$this->grid_width}',
'{$this->populate_lov}',
'{$this->text_area_rows}'
)";
//echo $insert_qry; die();
$lobj_rs = $this->aobj_context->mobj_db->Execute($insert_qry);
$this->last_inserted_id = $this->aobj_context->mobj_db->Insert_ID();
if(!$lobj_rs)
{
$rdata[0] = "Element Itselef is not inserted!";
$rdata[1] = $this->sequence;
print_r($this->aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
return $rdata;
}
}
function UpdateDbField()
{
$update_db_value=" update s_user_schema_elements suse,
(select suse.internal_code as db_field_ic_code,
case when t.value in('User','Meta') and ref_s_user_schema_group_code>0 and
(is_multiple_group=1 or ug.parent_group_code<>0)
then
if(suse.is_multiple_group=1,
concat('u_',suse.ref_s_user_schema_code,'_g_',ref_s_user_schema_group_code,'_ele_',suse.internal_code),
concat('u_',suse.ref_s_user_schema_code,'_g_',ug.parent_group_code,'_ele_',suse.internal_code)
)
when t.value='Meta' and ref_s_user_schema_group_code=0
then
concat('m_',suse.ref_s_user_schema_code,'_ele_',suse.internal_code)
when t.value='Meta' and ref_s_user_schema_group_code>0 and is_multiple_group=0
then
concat('m_',suse.ref_s_user_schema_code,'_ele_',suse.internal_code)
else ''
end as db_fields_s_user_schema_elements
from s_user_schema_elements suse
left join s_user_schema_group ug on ug.internal_code=ref_s_user_schema_group_code
inner join s_ref_type t on t.internal_code=s_ref_type_meta
where suse.ref_s_user_schema_code={$this->ref_s_user_schema_code}
) a
set db_field=db_fields_s_user_schema_elements
where db_field_ic_code=suse.internal_code";
$lobj_rs_update_db_value = $this->aobj_context->mobj_db->Execute($update_db_value);
}
function getAlterDbFieldName()
{
$select="select db_field from s_user_schema_elements
where internal_code={$this->last_inserted_id}";
$select_obj = $this->aobj_context->mobj_db->GetRow($select);
$this->alter_table_field=$select_obj[db_field];
}
function GetGroupTableNames()
{
$get_table="select CONCAT('user_schema_',ms.INTERNAL_CODE,'_group_',msg.internal_code) as group_table_name,
CONCAT('user_schema_',ms.INTERNAL_CODE,'_entry_',msg.internal_code) as entry_table_name
from s_user_schema_group msg inner join s_user_schema ms on ms.internal_code=msg.ref_s_user_schema_code
where msg.internal_code={$this->ref_s_user_schema_group_code}";
$lobj_get_table = $this->aobj_context->mobj_db->GetRow($get_table);
if(empty($lobj_get_table['group_table_name']))
{
$rdata[0] = "Element is inserted,but group_table_name is Empty!Please Insert the group_table_name";
$rdata[1] = $this->sequence;
print_r($this->aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
return $rdata;
}
else
{
$this->group_table_name=$lobj_get_table['group_table_name'];
$this->entry_table_name=$lobj_get_table['entry_table_name'];
}
}
function GetDataTypedetails()
{
$get_type="select case when s.value='Text' then 'varchar(500)'
when s.value='List Of Values' then 'varchar(50)'
when s.value='Reference Data' then 'int(11)'
when s.value ='Number' and {$this->decimal_value}>12 then 'decimal({$this->decimal_value},{$this->decimals})'
when s.value ='Number' and {$this->decimal_value}=12 then 'int(11)'
when s.value ='Date' then 'date'
when s.value='Month' then 'int(6)'
when s.value='Image' then 'varchar(250)'
else 'text' end as data_type
from
s_user_schema_elements suse
left join s_ref_type s on s.internal_code=suse.data_type
where suse.internal_code={$this->last_inserted_id}";
$lobj_get_type = $this->aobj_context->mobj_db->GetRow($get_type);
$this->data_type=$lobj_get_type[data_type];
}
function InsertElementInModuleSystemTable()
{
$desc_qry="desc {$this->system_module_table_name}";
$obj_desc=$this->aobj_context->mobj_db->GetAll($desc_qry);
for($i=0;$i<count($obj_desc);$i++)
{
if($obj_desc[$i+1]['Field']=='created_by') {
$after_field_id=$obj_desc[$i]['Field']; break;} // To get the Last Field
}
$add_field="alter table {$this->system_module_table_name} add
{$this->alter_table_field} {$this->data_type} after {$after_field_id}";
$lobj_add_field = $this->aobj_context->mobj_db->Execute($add_field);
if($lobj_add_field)
{
if($this->is_unique)
$this->AddIndexToTable($this->system_module_table_name,$this->alter_table_field);
$rdata[0] = "Element is inserted,and field has been added in {$this->system_module_table_name} table";
$rdata[1] = $this->max_sequence;
print_r($this->aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
return $rdata;
}
else
{
$rdata[0] = "Element is inserted,but falied to insert the element in {$this->system_module_table_name}";
$rdata[1] = $this->max_sequence;
print_r($this->aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
return $rdata;
}
}
function AlterElementInModuleSystemTable()
{
$alter_field="alter table {$this->system_module_table_name} change
{$this->e_db_field} {$this->alter_table_field} {$this->data_type} ";
$lobj_alter_field = $this->aobj_context->mobj_db->Execute($alter_field);
if($lobj_alter_field)
{
if($this->is_unique)
$this->AddIndexToTable($this->system_module_table_name,$this->alter_table_field);
$this->ProcessSystemFiles();
$rdata[0] = "Element is Updated,and field has been updated in {$this->system_module_table_name} table";
$rdata[1] = $this->max_sequence;
print_r($this->aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
return $rdata;
}
else
{
$rdata[0] = "Element is Updated,but falied to Update the element in {$this->system_module_table_name}";
$rdata[1] = $this->max_sequence;
print_r($this->aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
return $rdata;
}
}
function InsertElementInMultipleGroup()
{
$desc_qry="desc {$this->group_table_name}";
$obj_desc=$this->aobj_context->mobj_db->GetAll($desc_qry);
for($i=0;$i<count($obj_desc);$i++)
{
if($obj_desc[$i+1]['Field']=='created_by') {
$after_field_id=$obj_desc[$i]['Field']; break;} // To get the Last Field
}
$add_group_field="alter table {$this->group_table_name} add
{$this->alter_table_field} {$this->data_type} after {$after_field_id}";
$lobj_add_field = $this->aobj_context->mobj_db->Execute($add_group_field);
$add_entry_field="alter table {$this->entry_table_name} add
{$this->alter_table_field} {$this->data_type} after {$after_field_id}";
$lobj_add_field = $this->aobj_context->mobj_db->Execute($add_entry_field);
if($lobj_add_field)
{
if($this->is_unique)
$this->AddIndexToTable($this->group_table_name,$this->alter_table_field);
$rdata[0] = "Element is inserted,and field has been added in {$this->group_table_name} table";
$rdata[1] = $this->max_sequence;
print_r($this->aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
return $rdata;
}
else
{
$rdata[0] = "Element is inserted,but falied to insert the element in {$this->group_table_name}";
$rdata[1] = $this->max_sequence;
print_r($this->aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
return $rdata;
}
}
function AlterElementInMultipleGroup()
{
$alter_group_field="alter table {$this->group_table_name} change
{$this->e_db_field} {$this->alter_table_field} {$this->data_type} ";
$lobj_alter_group_field = $this->aobj_context->mobj_db->Execute($alter_group_field);
$alter_entry_field="alter table {$this->entry_table_name} change
{$this->e_db_field} {$this->alter_table_field} {$this->data_type} ";
$lobj_alter_entry_field = $this->aobj_context->mobj_db->Execute($alter_entry_field);
if($lobj_alter_group_field)
{
if($this->is_unique)
$this->AddIndexToTable($this->group_table_name,$this->alter_table_field);
$rdata[0] = "Element is Updated,and field has been updated in {$this->group_table_name} table";
$rdata[1] = $this->max_sequence;
print_r($this->aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
return $rdata;
}
else
{
$rdata[0] = "Element is Updated,but falied to update the element in {$this->group_table_name}";
$rdata[1] = $this->max_sequence;
print_r($this->aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
return $rdata;
}
}
function getMaxSequence()
{
$select_max_seq="select round(ifnull(max(sequence),0)+1) as sequence from s_user_schema_elements
where ref_s_user_schema_code={$this->ref_s_user_schema_code}
and ref_s_user_schema_group_code= {$this->ref_s_user_schema_group_code}";
$lobj_select_max_seq = $this->aobj_context->mobj_db->GetRow($select_max_seq);
$this->max_sequence=$lobj_select_max_seq["sequence"];
}
function AddIndexToTable($table,$field)
{
$add_index="CREATE UNIQUE INDEX indx_{$field} ON {$table} ({$field})";
$lobj_add_index = $this->aobj_context->mobj_db->Execute($add_index);
}
function ProcessSystemFiles()
{
$this->aobj_context->mobj_data["schema_id"]=$this->ref_s_user_schema_code;
require_once($this->aobj_context->main_src."/src/create_all_grid_files.php");
populateAllGridFiles($this->aobj_context);
require_once($this->aobj_context->main_src."/src/create_module_meta_columns.php");
createModuleMetaColumns($this->aobj_context);
require_once($this->aobj_context->main_src."/src/create_all_grid_group_files.php");
populateAllGridGroupFiles($this->aobj_context);
require_once($this->aobj_context->main_src."/src/create_html_files.php");
CreateModuleHtmlFiles($this->aobj_context);
require_once($this->aobj_context->main_src."/src/create_all_popup_files.php");
populateAllPopupGridFiles($this->aobj_context);
require_once($this->aobj_context->main_src."/src/create_all_views.php");
CreateView($this->aobj_context);
require_once($this->aobj_context->main_src."/src/update_defined_flag.php");
UpdateDefinedFlag($this->aobj_context);
require_once($this->aobj_context->main_src."/src/create_all_schema_files.php");
CreateAllSchemaFiles($this->aobj_context);
}
}
// CLASS ENDS
function insertUserSchemaElements($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$obj=new userSchemaElements($aobj_context);
$obj->AssignDatavalues();
if($obj->internal_code=='0')
{
$get_dup_data="select count(*) as element_count from s_user_schema_elements
where ref_s_user_schema_code={$obj->ref_s_user_schema_code}
and system_name='{$obj->system_name}'";
$lobj_rs = $aobj_context->mobj_db->GetRow($get_dup_data);
if($lobj_rs['element_count']==0)
{
$obj->InsertUserSchemaElementsDetails();
$obj->UpdateDbField();
$obj->ProcessSystemFiles();
$obj->getAlterDbFieldName();
$obj->getMaxSequence();
$obj->GetDataTypedetails();
if($obj->meta_type=='Meta')
{
$obj->GetIsElementIsMultiGroup();//Check whether Elements Belongs to Multi Group
if($obj->lobj_is_group_details[counts]>0)
{
$obj->GetGroupTableNames();
$obj->InsertElementInMultipleGroup();
}
else
{
$obj->InsertelementInModuleSystemTable();
}
}
}
else
{
$rdata[0] = "System Name Already Exstis!";
$rdata[1] = $max_seq;
print_r($aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
return $rdata;
}
}
else
{
$obj->last_inserted_id=$obj->internal_code;
$obj->GetExstingUserSchemaElementValues();
$obj->UpdateExstingUserSchemaElements();
$obj->UpdateDbField();
$obj->ProcessSystemFiles();
$obj->getAlterDbFieldName();
$obj->getMaxSequence();
$obj->GetDataTypedetails();
if($obj->meta_type=='Meta')
{
$obj->GetIsElementIsMultiGroup();//Check whether Elements Belongs to Multi Group
if($obj->lobj_is_group_details[counts]>0)
{
$obj->GetGroupTableNames();
$obj->AlterElementInMultipleGroup();
}
else
{
$obj->AlterElementInModuleSystemTable();
}
}
}
}
?>
|