value = $value;
$obj->text = trim( $text ) ? $text : $value;
return $obj;
}
function writableCell( $folder ) {
echo '
';
echo '' . $folder . '/ ';
echo '';
echo is_writable( "../$folder" ) ? ''.T_('Writeable').' ' : ''.T_('Unwriteable').' ' . ' ';
echo ' ';
}
/**
* Generates an HTML select list
* @param array An array of objects
* @param string The value of the HTML name attribute
* @param string Additional HTML attributes for the tag
* @param string The name of the object variable for the option value
* @param string The name of the object variable for the option text
* @param mixed The key that is selected
* @returns string HTML for the select list
*/
function selectList ( &$arr, $tag_name, $tag_attribs, $key, $text, $selected=NULL ) {
reset( $arr );
$html = "\n";
for ($i=0, $n=count( $arr ); $i < $n; $i++ ) {
$k = $arr[$i]->$key;
$t = $arr[$i]->$text;
$id = isset($arr[$i]->id) ? $arr[$i]->id : null;
$extra = '';
$extra .= $id ? " id=\"" . $arr[$i]->id . "\"" : '';
if (is_array( $selected )) {
foreach ($selected as $obj) {
$k2 = $obj->$key;
if ($k == $k2) {
$extra .= " selected=\"selected\"";
break;
}
}
} else {
$extra .= ($k == $selected ? " selected=\"selected\"" : '');
}
$html .= "\n\t" . $t . " ";
}
$html .= "\n \n";
return $html;
}
/**
* Writes a select list of integers
* @param int The start integer
* @param int The end integer
* @param int The increment
* @param string The value of the HTML name attribute
* @param string Additional HTML attributes for the tag
* @param mixed The key that is selected
* @param string The printf format to be applied to the number
* @returns string HTML for the select list
*/
function integerSelectList( $start, $end, $inc, $tag_name, $tag_attribs, $selected, $format="" ) {
$start = intval( $start );
$end = intval( $end );
$inc = intval( $inc );
$arr = array();
for ($i=$start; $i <= $end; $i+=$inc) {
$fi = $format ? sprintf( "$format", $i ) : "$i";
$arr[] = mosHTML::makeOption( $fi, $fi );
}
return mosHTML::selectList( $arr, $tag_name, $tag_attribs, 'value', 'text', $selected );
}
/**
* Writes a select list of month names based on Language settings
* @param string The value of the HTML name attribute
* @param string Additional HTML attributes for the tag
* @param mixed The key that is selected
* @returns string HTML for the select list values
*/
function monthSelectList( $tag_name, $tag_attribs, $selected ) {
$arr = array(
mosHTML::makeOption( '01', T_('January') ),
mosHTML::makeOption( '02', T_('February') ),
mosHTML::makeOption( '03', T_('March') ),
mosHTML::makeOption( '04', T_('April') ),
mosHTML::makeOption( '05', T_('May') ),
mosHTML::makeOption( '06', T_('June') ),
mosHTML::makeOption( '07', T_('July') ),
mosHTML::makeOption( '08', T_('August') ),
mosHTML::makeOption( '09', T_('September') ),
mosHTML::makeOption( '10', T_('October') ),
mosHTML::makeOption( '11', T_('November') ),
mosHTML::makeOption( '12', T_('December') )
);
return mosHTML::selectList( $arr, $tag_name, $tag_attribs, 'value', 'text', $selected );
}
/**
* Writes a yes/no select list
* @param string The value of the HTML name attribute
* @param string Additional HTML attributes for the tag
* @param mixed The key that is selected
* @returns string HTML for the select list values
*/
function yesnoSelectList( $tag_name, $tag_attribs, $selected, $yes=false, $no=false ) {
$arr = array(
mosHTML::makeOption( '0', $no ? $no : T_('Yes') ),
mosHTML::makeOption( '1', $yes ? $yes : T_('No') ),
);
return mosHTML::selectList( $arr, $tag_name, $tag_attribs, 'value', 'text', $selected );
}
/**
* Generates an HTML radio list
* @param array An array of objects
* @param string The value of the HTML name attribute
* @param string Additional HTML attributes for the tag
* @param mixed The key that is selected
* @param string The name of the object variable for the option value
* @param string The name of the object variable for the option text
* @returns string HTML for the select list
*/
function radioList( &$arr, $tag_name, $tag_attribs, $selected=null, $key='value', $text='text' ) {
reset( $arr );
$html = "";
foreach ($arr as $choice) {
$id = @$choice->id;
$extra = $id ? " id=\"" . $choice->id . "\"" : '';
if (is_array( $selected )) {
foreach ($selected as $obj) {
if ($choice->$key == $obj->$key) {
$extra .= ' selected="selected"';
break;
}
}
} else {
$extra .= ($choice->$key == $selected ? " checked=\"checked\"" : '');
}
$html .= "\n\t $key."\"$extra $tag_attribs />" . $choice->$text;
}
$html .= "\n";
return $html;
}
/**
* Writes a yes/no radio list
* @param string The value of the HTML name attribute
* @param string Additional HTML attributes for the tag
* @param mixed The key that is selected
* @returns string HTML for the radio list
*/
function yesnoRadioList( $tag_name, $tag_attribs, $selected, $yes=false, $no=false ) {
$arr = array(
mosHTML::makeOption( '0', $no ? $no : T_('No') ),
mosHTML::makeOption( '1', $yes ? $yes : T_('Yes') )
);
return mosHTML::radioList( $arr, $tag_name, $tag_attribs, $selected );
}
/**
* @param int The row index
* @param int The record id
* @param boolean
* @param string The name of the form element
* @return string
*/
function idBox( $rowNum, $recId, $checkedOut=false, $name='cid' ) {
if ( $checkedOut ) {
return '';
} else {
return ' ';
}
}
function sortIcon( $base_href, $field, $state='none' ) {
global $mosConfig_live_site;
$alts = array(
'none' => T_('No Sorting'),
'asc' => T_('Sort Ascending'),
'desc' => T_('Sort Descending'),
);
$next_state = 'asc';
if ($state == 'asc') {
$next_state = 'desc';
} else if ($state == 'desc') {
$next_state = 'none';
}
$html = ""
. " "
. " ";
return $html;
}
/**
* Writes Close Button
*/
function CloseButton ( &$params, $hide_js=NULL ) {
// displays close button in Pop-up window
if ( $params->get( 'popup' ) && !$hide_js ) {
?>
get( 'back_button' ) && !$params->get( 'popup' ) && !$hide_js) {
?>
]*>.*?'si", '', $text );
$text = preg_replace( '/]*>([^<]+)<\/a>/is', '\2 (\1)', $text );
$text = preg_replace( '//', '', $text );
$text = preg_replace( '/{.+?}/', '', $text );
$text = preg_replace( '/ /', ' ', $text );
$text = preg_replace( '/&/', ' ', $text );
$text = preg_replace( '/"/', ' ', $text );
$text = strip_tags( $text );
$text = htmlspecialchars( $text );
return $text;
}
/**
* Writes Print icon
*/
function PrintIcon( &$row, &$params, $hide_js, $link, $status=NULL ) {
global $mosConfig_live_site, $mosConfig_absolute_path, $cur_template, $Itemid;
if ( $params->get( 'print' ) && !$hide_js ) {
// use default settings if none declared
if ( !$status ) {
$status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no';
}
// checks template image directory for image, if non found default are loaded
if ( $params->get( 'icons' ) ) {
$mainframe = mosMainFrame::getInstance();
$image = $mainframe->ImageCheck( 'printButton.png', '/images/M_images/', NULL, NULL, T_('Print'));
} else {
$image = _ICON_SEP .' '. T_('Print'). ' '. _ICON_SEP;
}
if ( $params->get( 'popup' ) && !$hide_js ) {
// Print Preview button - used when viewing page
?>
\n";
$replacement .= " \n";
$replacement .= " \n";
$replacement .= " \n";
$replacement .= T_('This email address is being protected from spam bots, you need Javascript enabled to view it');
$replacement .= "\n \n";
return $replacement;
}
function encoding_converter( $text ) {
// replace vowels with character encoding
$text = str_replace( 'a', 'a', $text );
$text = str_replace( 'e', 'e', $text );
$text = str_replace( 'i', 'i', $text );
$text = str_replace( 'o', 'o', $text );
$text = str_replace( 'u', 'u', $text );
return $text;
}
}
class mosCommonHTML {
function ContentLegend( ) {
?>
Pending') ?> |
Current') ?> |
Expired') ?> |
menutype; ?>
name; ?>
published ) {
case -2:
echo ''.T_('Trashed').' ';
break;
case 0:
echo T_('UnPublished') ;
break;
case 1:
default:
echo ''.T_('Published').' ';
break;
}
?>
menutype; ?>
type; ?>
name; ?>
published ) {
case -2:
echo ''.T_('Trashed').' ';
break;
case 0:
echo T_('UnPublished');
break;
case 1:
default:
echo ''.T_('Published').' ';
break;
}
?>
checked_out_time, '%A, %d %B %Y' );
$time = mosFormatDate( $row->checked_out_time, '%H:%M' );
$checked_out_text = '';
$checked_out_text .= ''. $row->editor .' ';
$checked_out_text .= ''. $date .' ';
$checked_out_text .= ''. $time .' ';
$checked_out_text .= '
';
$hover = 'onMouseOver="return overlib(\''. $checked_out_text .'\', CAPTION, \''.T_('Checked Out') .'\', BELOW, RIGHT);" onMouseOut="return nd();"';
}
$checked = ' ';
return $checked;
}
/*
* Loads all necessary files for JS Overlib tooltips
*/
function loadOverlib() {
global $mosConfig_live_site;
?>
access ) {
$color_access = 'style="color: green;"';
$task_access = 'accessregistered';
} else if ( $row->access == 1 ) {
$color_access = 'style="color: red;"';
$task_access = 'accessspecial';
} else {
$color_access = 'style="color: black;"';
$task_access = 'accesspublic';
}
$href = '
'. $row->groupname .'
'
;
return $href;
}
function CheckedOutProcessing( &$row, $i ) {
global $my;
if ( $row->checked_out ) {
$checked = mosCommonHTML::checkedOut( $row );
} else {
$checked = mosHTML::idBox( $i, $row->id, ($row->checked_out && $row->checked_out != $my->id ) );
}
return $checked;
}
function PublishedProcessing( &$row, $i ) {
$img = $row->published ? 'publish_g.png' : 'publish_x.png';
$task = $row->published ? 'unpublish' : 'publish';
$alt = $row->published ? T_('Published') : T_('Unpublished');
$action = $row->published ? T_('Unpublish Item') : T_('Publish item');
$href = '
'
;
return $href;
}
}
/**
* Tab Creation handler
* @package Mambo
* @author Phil Taylor
*/
class mosTabs {
/** @var int Use cookies */
var $useCookies = 0;
/**
* Constructor
* Includes files needed for displaying tabs and sets cookie options
* @param int useCookies, if set to 1 cookie will hold last used tab between page refreshes
*/
function mosTabs($useCookies) {
global $mosConfig_live_site;
echo " ";
echo "";
$this->useCookies = $useCookies;
}
/**
* creates a tab pane and creates JS obj
* @param string The Tab Pane Name
*/
function startPane($id){
echo "";
echo "\n";
}
/**
* Ends Tab Pane
*/
function endPane() {
echo "
";
}
/*
* Creates a tab with title text and starts that tabs page
* @param tabText - This is what is displayed on the tab
* @param paneid - This is the parent pane to build this tab on
*/
function startTab( $tabText, $paneid ) {
echo "";
echo "
".$tabText." ";
echo "";
}
/*
* Ends a tab page
*/
function endTab() {
echo "";
}
}
?>