app = $app; include "name_map.php"; } public function view(GenadInstance $inst, $mode, $requestAppclass = null) { $this->printHeader(); $className = $inst->getName(); $appclass = $this->app." ".$inst->getClassId(); if (!$requestAppclass) $requestAppclass = $appclass; $id = $inst->getId(); $mod = $inst->getMod(); echo <<
DELETE_QUERY; echo "

$className

"; if ($mode == self::DV_NEW) echo '
'; elseif ($mode == self::DV_EDIT) echo ''; echo "\n"; $specialAttributeExists = false; $atts = $inst->getAttributeList(); foreach ($atts as $att) { if ($att->isList() || $att->isFK()) $specialAttributeExists = true; else { // it's a scalar attribute if ((($att->isEditable()) || ($mode == self::DV_NEW)) && (! $att->hasSystemInit())) { if ($mode == self::DV_READ_ONLY) { // attribute in principle editable, but no editing mode if ($att->isBool()) { if ($att->getValue() == "true") $checked = " checked "; else $checked = ""; echo "'; } else { echo "\n"; } } else { // check type class if ( ($typ_cl = $att->getTypeClass()) != null && $typ_cl->hasProperty("defd_vals")) { // a enum attribute $defd_vals = new ReflectionProperty($typ_cl->name, 'defd_vals'); echo "'; } else if ($att->isBool()) { if ($att->getValue() == "true") $checked = " checked "; else $checked = ""; echo "'; } else { echo "'; } } } else { // a not editable attribute and not CREATE mode if ($att->isBool()) { if ($att->getValue() == "true") $checked = " checked "; else $checked = ""; echo "'; } else echo "\n"; } } } echo "
".$this->getGuiString($att->getName()).'
".$this->getGuiString($att->getName()).''.$att."
".$this->getGuiString($att->getName()). '
".$this->getGuiString($att->getName()).'
".$this->getGuiString($att->getName()).'
".$this->getGuiString($att->getName()).'
".$this->getGuiString($att->getName())."".$att."
\n"; if ($specialAttributeExists) { // process simple relation attributes foreach ($atts as $att) { if ($att->isFK() && !$att->isList()) { $idList = array($att->getValue()); $rel_moc = $att->getRelatedClass(); $instList = new GenadInstanceList($this->app, $rel_moc, $idList); echo "

Related ".$att->getName()."

"; $listView = new ListView($this->app); if (($att->isEditable() && ($mode == self::DV_EDIT)) || ($mode == self::DV_NEW)) { $totalList = new GenadInstanceList($this->app, $rel_moc); $att_nam = $this->getGuiString($att->getName()); $listView->viewList($totalList, false, $instList, $att_nam, false); } else $listView->viewList($instList, false); } } // process simple lists foreach ($atts as $att) { if (!$att->isFK() && $att->isList()) { $att_nam = $this->getGuiString($att->getName()); echo "

$att_nam List

\n"; echo ""; $list = $att->getList(); foreach ($list as $elem) { echo "\n"; } echo "
$elem
"; } } // process foreign key lists foreach ($atts as $att) { if ($att->isFK() && $att->isList()) { $idList = $att->getList(); if ($idList === null) $idList = array(); // this happens in empty create $rel_moc = $att->getRelatedClass(); $instList = new GenadInstanceList($this->app, $rel_moc, $idList); echo "

Related ".$att->getName()." List

"; $listView = new ListView("AlarmManagement"); if (($att->isEditable() && ($mode == self::DV_EDIT)) || ($mode == self::DV_NEW)) { $totalList = new GenadInstanceList($this->app, $rel_moc); $att_nam = $this->getGuiString($att->getName()); $listView->viewList($totalList, false, $instList, $att_nam, true); } else $listView->viewList($instList, false); /* $att_nam = $this->getGuiString($att->getName()); echo "

Related $att_nam List

\n"; $idList = $att->getList(); $rel_moc = $att->getRelatedClass(); $instList = new GenadInstanceList($this->app, $rel_moc, $idList); $listView = new ListView($this->app); $listView->viewList($instList, false); if ($mode == self::DV_EDIT) { echo ""; } echo "

\n"; */ } } } if ($mode == self::DV_READ_ONLY) { echo << END; $classList = GenadClassList::getInstance($this->app); $classId = $inst->getClassId(); if ($classList->hasProperty($classId, new ClassProperty(ClassProperty::CP_SET))) echo "\"Edit\""; if ($classList->hasProperty($classId, new ClassProperty(ClassProperty::CP_CREATE))) echo "\"Copy\""; if ($classList->hasProperty($classId, new ClassProperty(ClassProperty::CP_DELETE))) echo "\"Delete\""; echo ""; /* Edit Copy Delete END; */ } else { if ( $mode == self::DV_NEW ) { $label = $this->getGuiString("Create"); $req = "create"; } else { $label = $this->getGuiString("Submit changes"); $req = "save"; } echo ''; echo "\n"; } $back = $this->getGuiString("Back"); echo<<
END1; } }