Changeset 504 for trunk/includes/global_function.php
- Timestamp:
- Feb 14, 2013, 7:51:59 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 2 2 aowow 3 3 nbproject 4 .settings 5 .project 6 .buildpath
-
- Property svn:ignore
-
trunk/includes/global_function.php
r499 r504 147 147 function FormatOutput($s) 148 148 { 149 $out = ''; 150 $nn = 0; 151 $n = 0; 152 while($s!='') 153 { 154 $start = strpos($s,'<'); 155 $end = strpos($s,'>'); 156 if($start != 0) 149 $out = ''; 150 $nn = 0; 151 $n = 0; 152 while($s != '') 153 { 154 $start = strpos($s, '<'); 155 $end = strpos($s, '>'); 156 if($start != 0) 157 { 158 $end = $start - 1; 159 $start = 0; 160 } 161 $line = trim(substr($s, $start, $end + 1)); 162 if(strlen($line) > 0) 163 if($line[0] == '<') 164 { 165 if($s[$start + 1] == '/') 157 166 { 158 $end = $start-1; 159 $start = 0; 160 } 161 $line = trim(substr($s,$start,$end+1)); 162 if(strlen($line)>0) 163 if($line[0] == '<') 167 $n = $n - 2; 168 $nn = $n; 169 } else 164 170 { 165 if($s[$start+1] == '/') 166 { 167 $n = $n - 2; 168 $nn = $n; 169 } else 170 { 171 if(strpos($line,' ')) $cmd = substr($line,1,strpos($line,' ')-1); 172 else $cmd = substr($line,1,strlen($line)-2); 173 //echo('['.$cmd.']'); 174 if(strpos($s,'</'.$cmd.'>')) $n = $n + 2; 175 } 176 }// else $line = '['.$line.']'; 177 //if($line != '') echo(htmlspecialchars(str_repeat(' ',$nn).$line."\n")); 178 if($line != '') $out .= (str_repeat(' ',$nn).$line."\n"); 179 $s = substr($s,$end+1,strlen($s)); 180 $nn = $n; 181 } 182 return($out); 171 if(strpos($line, ' ')) $cmd = substr($line, 1, strpos($line, ' ') - 1); 172 else $cmd = substr($line, 1, strlen($line) - 2); 173 //echo('['.$cmd.']'); 174 if(strpos($s, '</'.$cmd.'>')) $n = $n + 2; 175 } 176 }// else $line = '['.$line.']'; 177 //if($line != '') echo(htmlspecialchars(str_repeat(' ',$nn).$line."\n")); 178 if($line != '') $out .= (str_repeat(' ', $nn).$line."\n"); 179 $s = substr($s, $end + 1, strlen($s)); 180 $nn = $n; 181 } 182 return($out); 183 183 } 184 184 … … 187 187 global $LanguageList; 188 188 189 echo('<select name="Language">');189 $Output = '<select name="Language">'; 190 190 foreach($LanguageList as $Language) 191 191 if($Language['Enabled'] == 1) 192 192 { 193 echo('<option value="'.$Language['Id'].'"'); 194 if($Selected == $Language['Id']) echo(' selected="selected"'); echo('>'.$Language['Name'].'</option>'); 193 $Output .= '<option value="'.$Language['Id'].'"'; 194 if($Selected == $Language['Id']) 195 $Output .= ' selected="selected">'.$Language['Name'].'</option>'; 195 196 } 196 echo('</select>'); 197 $Output .= '</select>'; 198 return($Output); 197 199 } 198 200 … … 201 203 global $LanguageList; 202 204 205 $Output = ''; 203 206 foreach($LanguageList as $Language) 204 207 { 205 if($Selected == $Language['Id']) echo($Language['Name']); 206 } 208 if($Selected == $Language['Id']) $Output .= $Language['Name']; 209 } 210 return($Output); 207 211 } 208 212 … … 288 292 if($Next) 289 293 { 290 if($Prev) echo('<a href="form.php?group='.$GroupId.'&ID='.$Next['ID'].'">Předcházející '.$Next['ID'].'</a> ');291 else echo('<a href="form.php?group='.$GroupId.'&ID='.$Next['ID'].'">Následující '.$Next['ID'].'</a> ');294 if($Prev) $Output = '<a href="form.php?group='.$GroupId.'&ID='.$Next['ID'].'">Předcházející '.$Next['ID'].'</a> '; 295 else $Output = '<a href="form.php?group='.$GroupId.'&ID='.$Next['ID'].'">Následující '.$Next['ID'].'</a> '; 292 296 return('form.php?group='.$GroupId.'&ID='.$Next['ID']); 293 297 } … … 342 346 if(isset($LanguageList[$LanguageId]) == false) 343 347 { 344 ShowMessage('Jazyk dle zadaného Id neexistuje.', MESSAGE_CRITICAL); 345 ShowFooter(); 346 die(); 348 ErrorMessage(ShowMessage('Jazyk dle zadaného Id neexistuje.', MESSAGE_CRITICAL)); 347 349 } 348 350 return($LanguageId); … … 373 375 if(!array_key_exists('Tab', $_SESSION)) $_SESSION['Tab'] = 0; 374 376 if(($_SESSION['Tab'] < 0) or ($_SESSION['Tab'] > (count($Tabs) - 1))) $_SESSION['Tab'] = 0; 375 echo('<div id="header">');376 echo('<ul>');377 $Output = '<div id="header">'. 378 '<ul>'; 377 379 foreach($Tabs as $Index => $Tab) 378 380 { … … 380 382 if($Index == $_SESSION['Tab']) $Selected = ' id="selected"'; 381 383 else $Selected = ''; 382 echo('<li'.$Selected.'><a href="?'.SetQueryStringArray($QueryItems).'">'.$Tab.'</a></li>'); 383 } 384 echo('</ul></div>'); 384 $Output .= '<li'.$Selected.'><a href="?'.SetQueryStringArray($QueryItems).'">'.$Tab.'</a></li>'; 385 } 386 $Output .= '</ul></div>'; 387 return($Output); 385 388 } 386 389 … … 430 433 function ErrorMessage($Text) 431 434 { 432 echo($Text); 433 ShowFooter(); 435 ShowPage($Text); 434 436 die(); 435 437 } … … 589 591 global $System; 590 592 591 $IconName = array(MESSAGE_INFORMATION => 'information', MESSAGE_WARNING => 'warning', MESSAGE_CRITICAL => 'critical'); 592 $BackgroundColor = array(MESSAGE_INFORMATION => '#e0e0ff', MESSAGE_WARNING => '#ffffe0', MESSAGE_CRITICAL => '#ffe0e0'); 593 594 echo('<div class="message" style="background-color: '.$BackgroundColor[$Type].';"><table><tr><td class="icon"><img src="'.$System->Link('/images/message/'.$IconName[$Type].'.png').'" alt="'.$IconName[$Type].'"><td>'.$Text.'</td></tr></table></div>'); 593 $IconName = array( 594 MESSAGE_INFORMATION => 'information', 595 MESSAGE_WARNING => 'warning', 596 MESSAGE_CRITICAL => 'critical' 597 ); 598 $BackgroundColor = array( 599 MESSAGE_INFORMATION => '#e0e0ff', 600 MESSAGE_WARNING => '#ffffe0', 601 MESSAGE_CRITICAL => '#ffe0e0' 602 ); 603 604 return('<div class="message" style="background-color: '.$BackgroundColor[$Type]. 605 ';"><table><tr><td class="icon"><img src="'. 606 $System->Link('/images/message/'.$IconName[$Type].'.png').'" alt="'. 607 $IconName[$Type].'"><td>'.$Text.'</td></tr></table></div>'); 595 608 } 596 609
Note:
See TracChangeset
for help on using the changeset viewer.