Diff of /mambo/branches/4.6/includes/mambofunc.php
Parent Directory
|
Revision Log
|
Patch
| revision 96, Mon Jan 2 17:35:43 2006 UTC | revision 99, Wed Jan 4 12:56:10 2006 UTC | |
|---|---|---|
| # | Line 406 | Line 406 |
| 406 | } | } |
| 407 | } | } |
| 408 | ||
| 409 | /** | |
| 410 | * @param string SQL with ordering As value and 'name field' AS text | |
| 411 | * @param integer The length of the truncated headline | |
| 412 | */ | |
| 413 | function mosGetOrderingList( $sql, $chop='30' ) { | |
| 414 | global $database; | |
| 415 | ||
| 416 | $order = array(); | |
| 417 | $database->setQuery( $sql ); | |
| 418 | if (!($orders = $database->loadObjectList())) { | |
| 419 | if ($database->getErrorNum()) { | |
| 420 | echo $database->stderr(); | |
| 421 | return false; | |
| 422 | } else { | |
| 423 | $order[] = mosHTML::makeOption( 1, 'first' ); | |
| 424 | return $order; | |
| 425 | } | |
| 426 | } | |
| 427 | $order[] = mosHTML::makeOption( 0, '0 first' ); | |
| 428 | for ($i=0, $n=count( $orders ); $i < $n; $i++) { | |
| 429 | ||
| 430 | if (strlen($orders[$i]->text) > $chop) { | |
| 431 | $text = substr($orders[$i]->text,0,$chop)."..."; | |
| 432 | } else { | |
| 433 | $text = $orders[$i]->text; | |
| 434 | } | |
| 435 | ||
| 436 | $order[] = mosHTML::makeOption( $orders[$i]->value, $orders[$i]->value.' ('.$text.')' ); | |
| 437 | } | |
| 438 | $order[] = mosHTML::makeOption( $orders[$i-1]->value+1, ($orders[$i-1]->value+1).' last' ); | |
| 439 | ||
| 440 | return $order; | |
| 441 | } | |
| 442 | ||
| 443 | ||
| 444 | ?> | ?> |
|
||||||||
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |
Web Hosting provided by Network Redux.

