@SELECT pagetitle,id FROM modx_site_content WHERE deleted != 1 AND hidemenu != 1 AND parent = 47 ORDER BY `pagetitle` ASC
@EVAL return $_GET['parent']; - or - @EVAL return $modx->documentObject['parent'];
//removed $sql = "SELECT DISTINCT tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value ";
$sql = "SELECT DISTINCT tv.*, tvc.value as value "; //new by Bruno
$sql .= "FROM $dbase.`" . $table_prefix . "site_tmplvars` tv ";
$sql .= "INNER JOIN $dbase.`" . $table_prefix . "site_tmplvar_templates` tvtpl ON tvtpl.tmplvarid = tv.id ";
$sql .= "LEFT JOIN $dbase.`" . $table_prefix . "site_tmplvar_contentvalues` tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = $id ";
$sql .= "LEFT JOIN $dbase.`" . $table_prefix . "site_tmplvar_access` tva ON tva.tmplvarid=tv.id ";
$sql .= "WHERE tvtpl.templateid = " . $template . " AND (1='" . $_SESSION['mgrRole'] . "' OR ISNULL(tva.documentgroup)" . ((!$docgrp) ? "" : " OR tva.documentgroup IN ($docgrp)") . ") ORDER BY tvtpl.rank,tv.rank;";
$rs = mysql_query($sql);
$limit = mysql_num_rows($rs);
if ($limit > 0) {
echo "<table style='position:relative' border='0' cellspacing='0' cellpadding='3' width='96%'>";
require ('tmplvars.inc.php');
require ('tmplvars.commands.inc.php');
require ('tmplvars.format.inc.php');// add by Bruno
for ($i = 0; $i < $limit; $i++) {
// go through and display all the document variables
$row = mysql_fetch_assoc($rs);
if ($row['type'] == 'richtext' || $row['type'] == 'htmlarea') { // htmlarea for backward compatibility
if (is_array($replace_richtexteditor))
$replace_richtexteditor = array_merge($replace_richtexteditor, array (
"tv" . $row['name']
));
else
$replace_richtexteditor = array (
"tv" . $row['name']
);
}
// splitter
if ($i > 0 && $i < $limit)
echo '<tr><td colspan="2"><div class="split"></div></td></tr>';
?>
<tr style="height: 24px;">
<td align="left" valign="top" width="150">
<span class='warning'><?php echo $row['caption']; ?></span><br /><span class='comment'><?php echo $row['description']; ?></span>
</td>
<td valign="top" style="position:relative">
<?php
$tvPBV = $_POST['tv' . $row['name']]; // post back value
//add by Bruno
if ($row['display'] !== 'unixtime'){
$defaultOutput = getTVDisplayFormat($row['name'], $row['default_text'], $row['display'], $row['display_params'], $row['type'],$id);
}
// $defaultOutput=$row['default_text'];
echo renderFormElement($row['type'], $row['name'], $defaultOutput, $row['elements'], ($tvPBV ? $tvPBV : $row['value']), ' style="width:300px;"');
@SELECT pagetitle,id FROM modx_site_content WHERE deleted != 1 AND hidemenu != 1 AND parent = 47 ORDER BY `pagetitle` ASC
@eval $parent=$modx->getParent($docid,0,'id');return $parent['id'];
//add by Bruno
//$defaultOutput=ProcessTVCommand($row['default_text'], $row['name'], $id);
if ($row['display'] !== 'unixtime'){
$defaultOutput = getTVDisplayFormat($row['name'], $row['default_text'], $row['display'], $row['display_params'], $row['type'],$id);
}
else{
$defaultOutput = ($row['value']!=='')?$row['value']:$row['default_text'];
}
$template = $default_template;
if (isset ($_REQUEST['newtemplate'])) {
$template = $_REQUEST['newtemplate'];
} else {
if (isset ($content['template']))
$template = $content['template'];
}
$sql = 'SELECT DISTINCT tv.*, IF(tvc.value!=\'\',tvc.value,tv.default_text) as value '.
'FROM '.$tbl_site_tmplvars.' AS tv '.
'INNER JOIN '.$tbl_site_tmplvar_templates.' AS tvtpl ON tvtpl.tmplvarid = tv.id '.
'LEFT JOIN '.$tbl_site_tmplvar_contentvalues.' AS tvc ON tvc.tmplvarid=tv.id AND tvc.contentid=\''.$id.'\' '.
'LEFT JOIN '.$tbl_site_tmplvar_access.' AS tva ON tva.tmplvarid=tv.id '.
'WHERE tvtpl.templateid=\''.$template.'\' AND (1=\''.$_SESSION['mgrRole'].'\' OR ISNULL(tva.documentgroup)'.
(!$docgrp ? '' : ' OR tva.documentgroup IN ('.$docgrp.')').
') ORDER BY tvtpl.rank,tv.rank';
$rs = mysql_query($sql);
$limit = mysql_num_rows($rs);
if ($limit > 0) {
echo "\t".'<table style="position:relative;" border="0" cellspacing="0" cellpadding="3" width="96%">'."\n";
require(MODX_MANAGER_PATH.'includes/tmplvars.inc.php');
require(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php');
for ($i = 0; $i < $limit; $i++) {
// Go through and display all Template Variables
$row = mysql_fetch_assoc($rs);
if ($row['type'] == 'richtext' || $row['type'] == 'htmlarea') {
// Add richtext editor to the list
if (is_array($replace_richtexteditor)) {
$replace_richtexteditor = array_merge($replace_richtexteditor, array(
"tv" . $row['name'],
));
} else {
$replace_richtexteditor = array(
"tv" . $row['name'],
);
}
}
// splitter
if ($i > 0 && $i < $limit)
echo "\t\t",'<tr><td colspan="2"><div class="split"></div></td></tr>',"\n";
$tvPBV = array_key_exists('tv'.$row['name'], $_POST) ? $_POST['tv'.$row['name']] : $row['value']; // post back value
echo "\t\t",'<tr style="height: 24px;"><td align="left" valign="top" width="150"><span class="warning">',$row['caption'],"</span>\n",
"\t\t\t",'<br /><span class="comment">',$row['description'],"</span></td>\n",
"\t\t\t",'<td valign="top" style="position:relative">',"\n",
"\t\t\t",renderFormElement($row['type'], $row['name'], $row['default_text'], $row['elements'], $tvPBV, ' style="width:300px;"'),"\n";
"\t\t</td></tr>\n";
}
echo "\t</table>\n";
} else {
// There aren't any Template Variables
echo "\t<p>".$_lang['tmplvars_novars']."</p>\n";
}