00001 <?php 00002 require_once TM_PATH . 'constants.php'; 00003 require_once TM_PATH . 'juelich/JuelichGlobals.php'; 00004 00014 class JuelichPath { 00015 00016 var $pageMode = M_TEXT; 00017 var $data; 00019 function JuelichPath() { 00020 $this->init(); 00021 } 00022 00030 function init() { 00031 $this->data =& getDataInstance(); 00032 00033 if ($this->data->getAppData('module') == 'index_fake') { 00034 return; 00035 } 00036 00037 $allPara = array(); 00038 $pathPara = array(); 00039 $stop = false; 00040 $depend = false; 00041 $pTmp = explode('/', $this->data->getPathInfo()); 00042 00043 foreach ($pTmp as $path) { 00044 array_push($allPara, $path); 00045 if (!$depend) { 00046 $depend = preg_match('/^~\w+/', $path); 00047 if ($depend) { 00048 $stop = true; 00049 } 00050 } 00051 if (!$stop) { 00052 $stop = preg_match('/^z?\d{1,3}(_en)?/', $path); 00053 } 00054 if (!$stop) { 00055 array_push($pathPara, $path); 00056 } 00057 } 00058 00059 $s1 = count($allPara); 00060 $s2 = count($pathPara); 00061 $equal = ($s1 == $s2); 00062 $pathId = implode("-", $pathPara); 00063 00064 if (!$equal) { 00065 # Das vorletzte Element ist die Produkt-Id 00066 $en = $allPara[$s1 - 2]; 00067 if (strpos($en, "_en") > 0) { 00068 $pathId .= "-index_en.html"; 00069 } 00070 } 00071 00072 $db =& getDbReaderInstance(); 00073 $row = array(); 00074 00075 $sqlPrep = "SELECT l10n_id, p_group0, p_group1, " 00076 . "p_group2, p_group3, p_modus, template_id, " 00077 . "p_modell_ids, p_modul, p_title " 00078 . "FROM pfad " 00079 . "WHERE pfad_id = '%s'"; 00080 $sql = sprintf($sqlPrep, 00081 $pathId 00082 ); 00083 $db->getOneRow($sql, $row); 00084 if (empty($row)) { 00085 include_once TM_PATH . 'juelich/web/JuelichError.php'; 00086 $error = new JuelichError; 00087 $error->printError(5, 00088 'Kein gültiger Pfad: ' 00089 . $pathId); 00090 exit(); 00091 } 00092 00093 $cont =& $this->data->getAppDataContainer(); 00094 $cont['parameter'] = $allPara; 00095 $cont['l10n'] = $row['l10n_id']; 00096 $cont['group0'] = $row['p_group0']; 00097 $cont['group1'] = $row['p_group1']; 00098 $cont['group2'] = $row['p_group2']; 00099 $cont['group3'] = $row['p_group3']; 00100 $cont['mode'] = $row['p_modus']; 00101 $cont['tplName'] = $row['template_id']; 00102 $cont['modelIds'] = $row['p_modell_ids']; 00103 $cont['moduleString'] = $row['p_modul']; 00104 $cont['title'] = $row['p_title']; 00105 00106 if (!$equal) { 00107 if ($row['p_modus'] == M_MODEL) { 00108 $cont['mode'] = M_DETAIL; 00109 $cont['detailId'] = $allPara[$s1 - 2]; 00110 } 00111 elseif ($row['p_modus'] == M_DETAIL2) { 00112 $cont['detailId'] = $allPara[2]; 00113 } 00114 } 00115 $this->pageMode = $cont['mode']; 00116 $module = ''; 00117 if ($this->pageMode == M_MODEL || 00118 $this->pageMode == M_DETAIL || 00119 $this->pageMode == M_DETAIL2 || 00120 $this->pageMode == M_LIST 00121 ) { 00122 if ($depend) { 00123 $mTmp = ''; 00124 getModule($row['p_modul'], $mTmp); 00125 $names = $mTmp->depend['name']; 00126 $name = substr($allPara[$s1 - 4], 1); 00127 if ($key = array_search($name, $names)) { 00128 getModule($mTmp->depend['secondary'], 00129 $cont['module']); 00130 $cont['dependDetail'] = true; 00131 $cont['dependId'] = $allPara[$s1 - 3]; 00132 $cont['l10n'] = $key; 00133 } 00134 else { 00135 include_once TM_PATH . 'juelich/web/JuelichError.php'; 00136 $error = new JuelichError; 00137 $error->printError(5, 00138 'Kein gültiger Depend-Pfad: ' 00139 . $pathId . '-' . $allPara[$s1 - 4]); 00140 exit(); 00141 } 00142 } 00143 else { 00144 getModule($row['p_modul'], $cont['module']); 00145 } 00146 $this->data->setModuledbData(); 00147 } 00148 return; 00149 } 00150 00156 function getPageMode() { 00157 return $this->pageMode; 00158 } 00159 00160 } 00161 00162 ?>