ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.arBuilder.php
Go to the documentation of this file.
1<?php
2require_once(dirname(__FILE__) . '/../../Connector/class.arConnectorDB.php');
3
10class arBuilder {
11
15 protected $ar;
19 protected $step;
20
21
26 public function __construct(ActiveRecord $ar, $step = 1) {
27 $this->setAr($ar);
28 $this->setStep($step);
29 }
30
31
33 $tpl = new ilTemplate(dirname(__FILE__) . '/templates/dbupdate.txt', true, true);
34 $ar = $this->getAr();
35
36 $tpl->setVariable('TABLE_NAME', $ar->getConnectorContainerName());
37 $tpl->setVariable('TABLE_NAME2', $ar->getConnectorContainerName());
38 $tpl->setVariable('TABLE_NAME3', $ar->getConnectorContainerName());
39 $tpl->setVariable('STEP', $this->getStep());
40 $tpl->setVariable('PRIMARY', $this->getAr()->getArFieldList()->getPrimaryFieldName());
41
42 foreach ($this->getAr()->getArFieldList()->getFields() as $field) {
43 $tpl->touchBlock('field');
44 $tpl->setVariable('FIELD_NAME', $field->getName());
45 foreach ($field->getAttributesForConnector() as $name => $value) {
46 $tpl->setCurrentBlock('attribute');
47 $tpl->setVariable('NAME', arFieldList::mapKey($name));
48 $tpl->setVariable('VALUE', $value);
49 $tpl->parseCurrentBlock();
50 }
51 }
52
53 if ($this->getAr()->getArFieldList()->getPrimaryField()->getFieldType() == arField::FIELD_TYPE_INTEGER) {
54 $tpl->setCurrentBlock('attribute');
55 $tpl->setVariable('TABLE_NAME4', $ar->getConnectorContainerName());
56 $tpl->parseCurrentBlock();
57 }
58
59 header('Content-type: application/x-httpd-php');
60 header("Content-Disposition: attachment; filename=\"dbupdate.php\"");
61 echo $tpl->get();
62 exit;
63 }
64
65
69 public function setAr($ar) {
70 $this->ar = $ar;
71 }
72
73
77 public function getAr() {
78 return $this->ar;
79 }
80
81
85 public function setStep($step) {
86 $this->step = $step;
87 }
88
89
93 public function getStep() {
94 return $this->step;
95 }
96}
97
98?>
global $tpl
Definition: ilias.php:8
Class ActiveRecord.
Class arBuilder.
generateDBUpdateForInstallation()
__construct(ActiveRecord $ar, $step=1)
setStep($step)
static mapKey($key)
const FIELD_TYPE_INTEGER
special template class to simplify handling of ITX/PEAR
exit
Definition: login.php:54