function ErrorLog($text) { return; AjaxEcho('ErrorLog("' . addcslashes(str_replace("\n", '', $text), '"') . '")'); if (utopia::UsingTemplate()) { echo $text; } $cLog = utopia::GetVar('error_log'); if (array_key_exists('__ajax', $_REQUEST)) { if (!empty($cLog)) { utopia::AppendVar('error_log', "\n"); } utopia::AppendVar('error_log', 'ErrorLog("' . $text . '");'); } else { if (!empty($cLog)) { utopia::AppendVar('error_log', '<br/>'); } utopia::AppendVar('error_log', '<span><b>*</b> ' . $text . '</span>'); // utopia::AppendVar('error_log','<span style="color:#EE3333; border-style:solid; border-width:1px; background-color:#DDDDDD; padding:3px">'.$text.'</span>'); } }
public function ShowData() { //check pk and ptable are set up if (is_empty($this->GetTabledef())) { ErrorLog('Primary table not set up for ' . get_class($this)); return; } echo '<h1>' . $this->GetTitle() . '</h1>'; echo '{list.' . get_class($this) . '}'; $row = null; $num_rows = 0; if (!isset($_GET['_n_' . $this->GetModuleId()])) { $this->GetLimit($limit, $page); $dataset = $this->GetDataset(); $num_rows = $dataset->CountRecords(); $row = $dataset->GetPage($page, $limit)->fetch(); } $pagination = ''; $this->GetLimit($limit); if ($limit) { $pages = max(ceil($num_rows / $limit), 1); ob_start(); utopia::OutputPagination($pages, '_p_' . $this->GetModuleId()); $pagination = ob_get_clean(); } $records = $num_rows == 0 ? "There are no records to display." : 'Total Rows: ' . $num_rows; $pager = '<div class="right">' . $pagination . '</div>'; uEvents::TriggerEvent('OnShowDataDetail', $this); if ($this->flag_is_set(ALLOW_DELETE) && $row) { $fltr =& $this->FindFilter($this->GetPrimaryKey(), ctEQ, itNONE); $delbtn = $this->GetDeleteButton($this->GetFilterValue($fltr['uid']), 'Delete Record'); utopia::AppendVar('footer_left', $delbtn); } // if (!$this->IsNewRecord()) { // records exist, lets get the first. // pagination? // if (mysql_num_rows($result) > 1) { // multiple records exist in this set, sort out pagination // } // } $order = $this->GetSortOrder(); $extraCount = 1; $secCount = count($this->layoutSections); foreach ($this->layoutSections as $sectionID => $sectionInfo) { $out = ''; if ($secCount > 1) { $sectionName = $sectionInfo['title']; if ($sectionName === '') { if ($sectionID === 0) { $SN = 'General'; } else { $SN = "Extra ({$extraCount})"; $extraCount++; } } else { $SN = ucwords($sectionName); } $out .= '<h2>' . $SN . '</h2>'; } if (!$this->isAjax) { $out .= '<form class="uf" action="" onsubmit="this.action = window.location" method="post">'; } $out .= "<div class=\"table-wrapper\"><table class=\"module-content layoutDetailSection\">"; $fields = $this->GetFields(true, $sectionID); $hasFieldHeaders = false; foreach ($fields as $fieldName => $fieldData) { $hasFieldHeaders = $hasFieldHeaders || !empty($fieldData['visiblename']); } $fieldCount = count($fields); foreach ($fields as $fieldName => $fieldData) { $targetUrl = $this->GetTargetUrl($fieldName, $row); $out .= "<tr>"; if ($hasFieldHeaders) { $out .= "<td class=\"fld\">" . $fieldData['visiblename'] . "</td>"; } $out .= '<td>' . $this->GetCell($fieldName, $row, $targetUrl) . '</td>'; $out .= "</tr>"; } $out .= "</table></div>"; if (!$this->isAjax) { $out .= '</form>'; } echo $out; } if ($num_rows > 1) { echo '<div class="oh"><b>' . $records . '</b>' . $pager . '</div>'; } }
static function output_buffer($text) { utopia::AppendVar('content', $text); return ''; }