Source for file UIUtil.php
Documentation is available at UIUtil.php
* User Interface Util Class
* @copyright Copyright (c) 2003, 2007 Mirchev Ideas Ltd. All rights reserved.
* Offer same often used user interface functions
* @copyright Copyright (c) 2003-2007 Mirchev Ideas Ltd. All rights reserved.
* Returns HTML code for a dropdown menu ("select" element) from the specified array
* @param string $name name of the select element
* @param int $selected which key is selected
* @param array $optionsArray array whit the dropdown menu elements values
$html =
'<select name="' .
$name .
'" id="' .
$name .
'">' .
"\n";
$selected = (string)
$selected;
foreach ($optionsArray as $key =>
$value)
$html .=
'<option value="' .
miI18N::htmlEscape($key) .
'"' .
((string)
$key ===
$selected?
' selected="selected"':
'') .
'>' .
miI18N::htmlEscape($value) .
'</option>' .
"\n";
$html .=
'</select>' .
"\n";
* Creates drop-down filter
* The filter is applied to the $table
* @param miTable $table the table to apply the filter to
* @param string $field the field name
* @param array $values associative array with the values of the filter
* @param string $condition the filter condition
public static function createDropdownFilter(miView $view, miTable $table, $field, $values, $condition)
$filterObj =
$view->getTableFilterObj();
$filterValues =
$filterObj->getFilterValues();
$defaultValue = isset
($filterValues[$field]) ?
$filterValues[$field] :
'';
// Make sure that the filter is applied
if (!isset
($_REQUEST[$field .
'Filter']))
$filterObj->addAdditionalFilter($field, $defaultValue, $condition);
$table->assign('%%HTML_' .
strtoupper($field) .
'_FILTER%%', $dropdown .
$condition);
* Transposes the $rows array from array of hashes into a hash of
* arrays. All values will have the &, ", < and > escaped, except
* the values for keys starting with HTML_
* @param array $rows readed rows from the database
* @return array array with the new transposed rows
foreach ($rows[0] as $key =>
$row) {
for ($i=
0; $i <
$count; $i++
)
$newArray[$key][] =
$rows[$i][$key];
for ($i=
0; $i <
$count; $i++
)
$newArray[$key][] =
$rows[$i][$key];
* Makes the hash of arrays $rows suitable for the miTemplateParserSectionInfo values
* @param array $rows transposed rows read from the database
foreach ($rows as $key =>
$row) {
* Makes the hash of arrays $rows suitable for the miTemplateParserSectionInfo values
* @param array $rows transposed rows read from the database
foreach ($rows as $key =>
$row) {
Documentation generated on Thu, 08 May 2008 16:57:51 +0300 by phpDocumentor 1.4.1