Skip to content

Commit 39f9d7c

Browse files
committed
changed the object generator to include class list of Parent and child objects.
1 parent 9ba38d3 commit 39f9d7c

File tree

15 files changed

+302
-111
lines changed

15 files changed

+302
-111
lines changed

images/body.jpg

849 Bytes
Loading

images/class.jpg

1.19 KB
Loading

images/customize.jpg

553 Bytes
Loading

images/tile.jpg

196 Bytes
Loading

index.php

Lines changed: 72 additions & 34 deletions
Large diffs are not rendered by default.

index2.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
$objectName = GetVariable('object');
2020
$attributeList=Array();
2121
$typeList=Array();
22+
$classList=Array();
2223
$z=0;
2324
for ($i=1; $i<100; $i++)
2425
{
@@ -43,6 +44,13 @@
4344
//attribute may have been removed. proceed to next row
4445
$z++;
4546
}
47+
48+
if (GetVariable(('type_'.$i)) == "BELONGSTO" || GetVariable(('type_'.$i)) == "HASMANY"){
49+
$classList[] = GetVariable(('tclass_'.$i));
50+
}
51+
else{
52+
$classList[] = '';
53+
}
4654
}
4755

4856
$_SESSION['objectName'] = $objectName;
@@ -74,7 +82,7 @@
7482
$client = new SoapClient('services/pog.wsdl', array('cache_wsdl' => 0));
7583
try
7684
{
77-
$object = base64_decode($client->GenerateObject($objectName, $attributeList, $typeList, $language, $wrapper, $pdoDriver));
85+
$object = base64_decode($client->GenerateObject($objectName, $attributeList, $typeList, $language, $wrapper, $pdoDriver, $classList));
7886
$_SESSION['objectString'] = $object;
7987
$_SESSION['attributeList'] = serialize($attributeList);
8088
$_SESSION['typeList'] = serialize($typeList);

jquery.js

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

local_46888.xml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,31 @@
11
<?xml version="1.0" ?>
22
<Links>
33
<Link>
4-
<URL>http://www.2mhost.com/php5-hosting.html</URL>
5-
<Text>PHP 5 web hosting</Text>
4+
<LinkID>OI87827</LinkID>
5+
<URL>http://www.forumla.de/archive/index.php/f-30.html</URL>
6+
<Text>PS3 Community - Forumla.de</Text>
67
<BeforeText> </BeforeText>
78
<AfterText> </AfterText>
89
</Link>
910
<Link>
11+
<LinkID>OI319561</LinkID>
1012
<URL>http://www.superwarehouse.com/Sony_Laptops/b/250/c/14</URL>
1113
<Text>Sony Laptops</Text>
1214
<BeforeText> </BeforeText>
1315
<AfterText> </AfterText>
1416
</Link>
17+
<Link>
18+
<LinkID>OI469063</LinkID>
19+
<URL>http://www.canadianwebhosting.com/domain_hosting.asp</URL>
20+
<Text>domain hosting</Text>
21+
<BeforeText> </BeforeText>
22+
<AfterText> </AfterText>
23+
</Link>
24+
<Link>
25+
<LinkID>OI576934</LinkID>
26+
<URL>http://www.facebook.com/FisherInvestmentsMarketMinder</URL>
27+
<Text>Market Minder on Facebook</Text>
28+
<BeforeText> </BeforeText>
29+
<AfterText> </AfterText>
30+
</Link>
1531
</Links>

object_factory/class.objectphp5.1pdomysql.php

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,24 @@ class Object
99
var $separator = "\n\t";
1010
var $pdoDriver = "";
1111
var $language = 'php5.1';
12+
var $classList;
13+
1214

1315
// -------------------------------------------------------------
14-
function Object($objectName, $attributeList = '', $typeList ='', $pdoDriver = '', $language = 'php5.1')
16+
function Object($objectName, $attributeList = '', $typeList ='', $pdoDriver = '', $language = 'php5.1', $classList)
1517
{
1618
$this->objectName = $objectName;
1719
$this->attributeList = $attributeList;
1820
$this->typeList = $typeList;
1921
$this->pdoDriver = $pdoDriver;
2022
$this->language = $language;
23+
$this->classList = $classList;
2124
}
2225

2326
// -------------------------------------------------------------
2427
function BeginObject()
2528
{
29+
$impArray = array();
2630
$misc = new Misc(array());
2731
$this->string = "<?php\n";
2832
$this->string .= $this->CreatePreface();
@@ -33,6 +37,13 @@ function BeginObject()
3337
{
3438
$this->string .= "\ninclude_once('class.".strtolower($misc->MappingName($this->objectName, $this->attributeList[$key])).".php');";
3539
}
40+
if ($type == "BELONGSTO" || $type == "HASMANY")
41+
{
42+
if(in_array(strtolower($this->classList[$key]), $impArray) == false)
43+
$this->string .= "\ninclude_once('class.".strtolower($this->classList[$key]).".php');";
44+
45+
array_push($impArray, strtolower($this->classList[$key])) ;
46+
}
3647
}
3748
$this->string .= "\nclass ".$this->objectName." extends POG_Base\n{\n\t";
3849
$this->string.="public \$".strtolower($this->objectName)."Id = '';\n\n\t";
@@ -67,7 +78,7 @@ function BeginObject()
6778
}
6879
// create attribute => type array map
6980
// needed for setup
70-
$this->string .= "private \$pog_attribute_type = array(\n\t\t";
81+
$this->string .= "public \$pog_attribute_type = array(\n\t\t";
7182
$this->string .= "\"".strtolower($this->objectName)."Id\" => array('db_attributes' => array(\"NUMERIC\", \"INT\")),\n\t\t";
7283
$x = 0;
7384
foreach ($this->attributeList as $attribute)
@@ -76,7 +87,7 @@ function BeginObject()
7687
$x++;
7788
}
7889
$this->string .= ");\n\t";
79-
$this->string .= "private \$pog_query;";
90+
$this->string .= "public \$pog_query;";
8091
}
8192

8293
// -------------------------------------------------------------
@@ -741,12 +752,12 @@ function CreateAddChildFunction($child)
741752
}
742753

743754
// -------------------------------------------------------------
744-
function CreateGetChildrenFunction($child)
755+
function CreateGetChildrenFunction($child, $class)
745756
{
746757
$this->string .= "\n\t$this->separator\n\t";
747758
$this->string .= $this->CreateComments("Gets a list of $child objects associated to this one", array("multidimensional array {(\"field\", \"comparator\", \"value\"), (\"field\", \"comparator\", \"value\"), ...}","string \$sortBy","boolean \$ascending","int limit"),"array of $child objects");
748759
$this->string .= "\tfunction Get".ucfirst(strtolower($child))."List(\$fcv_array = array(), \$sortBy='', \$ascending=true, \$limit='')\n\t{";
749-
$this->string .= "\n\t\t\$".strtolower($child)." = new ".$child."();";
760+
$this->string .= "\n\t\t\$".strtolower($child)." = new ".$class."();";
750761
$this->string .= "\n\t\t\$fcv_array[] = array(\"".strtolower($this->objectName)."Id\", \"=\", \$this->".strtolower($this->objectName)."Id);";
751762
$this->string .= "\n\t\t\$dbObjects = \$".strtolower($child)."->GetList(\$fcv_array, \$sortBy, \$ascending, \$limit);";
752763
$this->string .= "\n\t\treturn \$dbObjects;";
@@ -781,12 +792,12 @@ function CreateSetParentFunction($parent)
781792
}
782793

783794
// -------------------------------------------------------------
784-
function CreateGetParentFunction($parent)
795+
function CreateGetParentFunction($parent, $class)
785796
{
786797
$this->string .= "\n\t$this->separator\n\t";
787798
$this->string .= $this->CreateComments("Associates the $parent object to this one",'',"boolean");
788799
$this->string .= "\tfunction Get".ucfirst(strtolower($parent))."()\n\t{";
789-
$this->string .= "\n\t\t\$".strtolower($parent)." = new ".$parent."();";
800+
$this->string .= "\n\t\t\$".strtolower($parent)." = new ".$class."();";
790801
$this->string .= "\n\t\treturn $".strtolower($parent)."->Get(\$this->".strtolower($parent)."Id);";
791802
$this->string .= "\n\t}";
792803
}
@@ -934,4 +945,4 @@ function CreateSetAssociationsFunction($sibling)
934945
}
935946

936947
}
937-
?>
948+
?>

phpobjectgenerator.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
body {margin:0 auto;padding:0;color:#828282;background:#fff;font:bold 10px Verdana}
2-
.greybox {background:url('./images/tile.jpg') repeat-y;padding:10px 0 10px 45px;width:360px;font-size:9px;float:left;position:relative;z-index:100}
2+
.greybox {background:url('./images/tile.jpg') repeat-y;padding:10px 0 10px 45px;width:560px;font-size:9px;float:left;position:relative;z-index:100}
33
.greybox2 {background:url('./images/tile2.jpg') repeat-y;padding:5px 0 10px 60px;width:360px;font-size:9px;float:left;position:relative;z-index:100}
44
.header {width:425px;height:147px;float:left;background:url('./images/header.gif') top left no-repeat;position:relative}
5-
.objectname {float:left;position:relative;padding:45px 0 0 155px;background:url('./images/body.jpg') top left no-repeat;width:258px;height:79px;z-index:100}
5+
.objectname {float:left;position:relative;padding:45px 0 0 155px;background:url('./images/body.jpg') top left no-repeat;width:560px;height:79px;z-index:100}
66
.header2 {width:425px;height:147px;float:left;background:url('./images/header2.jpg') top left no-repeat;position:relative}
77
.result {float:left;position:relative;padding:90px 0 0;background:url('./images/body2.jpg') top left no-repeat;width:413px;height:151px;z-index:100}
8-
.generate {padding-left:235px;padding-top:10px;width:190px;height:56px;background:url('./images/customize.jpg') top left no-repeat;position:relative;float:left}
8+
.generate {padding-left:235px;padding-top:10px;width:560px;height:56px;background:url('./images/customize.jpg') top left no-repeat;position:relative;float:left}
99
.customize {padding-left:150px;padding-top:38px;width:258px;height:63px;background:url('./images/customize2.jpg') top left no-repeat;position:relative;z-index:99;float:left}
1010
.generate2 {padding-left:280px;padding-top:10px;width:145px;height:10px;background:url('./images/end2.jpg') top left no-repeat;float:left;position:relative}
1111
.restart {width:370px;height:100px;padding-top:30px;background-color:#333;background:url('./images/restart.gif') top left no-repeat;position:relative;float:left}
@@ -26,7 +26,7 @@ h1, h1 a{text-decoration:none;color:#828282;z-index:300;font:normal 10px Verdana
2626
a {text-decoration:none;color:#837E3C;z-index:300;}
2727
.left {width:170px;float:left;font-size:9px;line-height:14px;font-weight:normal;color:#848484;margin:93px auto 0 0;height:100%;position:absolute;z-index:300}
2828
.left2 {width:170px;float:left;font-size:9px;line-height:14px;font-weight:normal;color:#848484;margin:122px auto 0 0;height:100%;position:absolute;z-index:300}
29-
.right {width:170px;float:left;margin:93px auto 0 600px;position:absolute;z-index:300;font-weight:normal;font-size:9px}
29+
.right {width:170px;float:left;/*margin:93px auto 0 600px;*/right: 120px; top: 93px; position:absolute;z-index:300;font-weight:normal;font-size:9px}
3030
.right2 {width:170px;float:left;margin:122px auto 0 540px;position:absolute;z-index:300;font-weight:normal;font-size:9px}
3131
.middle {position:absolute;float:left;padding-left:175px;width:500px}
3232
textarea {width:267px;height:379px;color:#333;font-weight:bold;font-size:9px}

0 commit comments

Comments
 (0)