ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.arBuilder.php
Go to the documentation of this file.
1 <?php
2 require_once(dirname(__FILE__) . '/../../Connector/class.arConnectorDB.php');
3 
10 class arBuilder
11 {
12 
16  protected $ar;
20  protected $step;
21 
22 
27  public function __construct(ActiveRecord $ar, $step = 1)
28  {
29  $this->setAr($ar);
30  $this->setStep($step);
31  }
32 
33 
35  {
36  $tpl = new ilTemplate(dirname(__FILE__) . '/templates/dbupdate.txt', true, true);
37  $ar = $this->getAr();
38 
39  $tpl->setVariable('TABLE_NAME', $ar->getConnectorContainerName());
40  $tpl->setVariable('TABLE_NAME2', $ar->getConnectorContainerName());
41  $tpl->setVariable('TABLE_NAME3', $ar->getConnectorContainerName());
42  $tpl->setVariable('STEP', $this->getStep());
43  $tpl->setVariable('PRIMARY', $this->getAr()->getArFieldList()->getPrimaryFieldName());
44 
45  foreach ($this->getAr()->getArFieldList()->getFields() as $field) {
46  $tpl->touchBlock('field');
47  $tpl->setVariable('FIELD_NAME', $field->getName());
48  foreach ($field->getAttributesForConnector() as $name => $value) {
49  $tpl->setCurrentBlock('attribute');
50  $tpl->setVariable('NAME', arFieldList::mapKey($name));
51  $tpl->setVariable('VALUE', $value);
52  $tpl->parseCurrentBlock();
53  }
54  }
55 
56  if ($this->getAr()->getArFieldList()->getPrimaryField()->getFieldType() == arField::FIELD_TYPE_INTEGER) {
57  $tpl->setCurrentBlock('attribute');
58  $tpl->setVariable('TABLE_NAME4', $ar->getConnectorContainerName());
59  $tpl->parseCurrentBlock();
60  }
61 
62  header('Content-type: application/x-httpd-php');
63  header("Content-Disposition: attachment; filename=\"dbupdate.php\"");
64  echo $tpl->get();
65  exit;
66  }
67 
68 
72  public function setAr($ar)
73  {
74  $this->ar = $ar;
75  }
76 
77 
81  public function getAr()
82  {
83  return $this->ar;
84  }
85 
86 
90  public function setStep($step)
91  {
92  $this->step = $step;
93  }
94 
95 
99  public function getStep()
100  {
101  return $this->step;
102  }
103 }
Class ActiveRecord.
$tpl
Definition: ilias.php:10
static mapKey($key)
Class arBuilder.
const FIELD_TYPE_INTEGER
__construct(ActiveRecord $ar, $step=1)
special template class to simplify handling of ITX/PEAR
setStep($step)
exit
Definition: backend.php:16
generateDBUpdateForInstallation()