/** * * @param string $table * @param string $where * @param string $parentId * @return string */ public function doTableList(WOOOF_dataBaseTable $table, $where = '', $parentId = '') { $query = 'SELECT id'; if ($table->getShowIdInAdminLists()) { $headers[0] = 'ID'; $presentation[0] = 'objectPropertyCellMedium'; $columnNames[0] = 'id'; } foreach ($table->columns as $key => $value) { if ($key == 'id') { continue; } $column = $value->getColumnMetaData(); if ($column['appearsInLists'] && !($column['name'] == 'active' && $table->getHasActivationFlag()) && !isset($headers[$column['ordering']])) { $headers[$column['ordering']] = $column['description']; $query .= ', ' . $column['name']; $presentation[$column['ordering']] = $column['adminCSS']; $columnNames[$column['ordering']] = $column['name']; } } if ($table->getHasActivationFlag()) { $query .= ', active'; $displayActivation = true; } else { $displayActivation = false; } if (trim($table->getAdminListMarkingCondition()) != '') { $displayPreview = $table->getAdminListMarkingCondition(); } else { $displayPreview = false; } if (trim($table->getOrderingColumnForListings()) != '') { $tmp = str_replace(' desc', '', $table->getOrderingColumnForListings()); $meta = $table->columns[$tmp]->getColumnMetaData(); if ($meta['type'] == WOOOF_dataBaseColumnTypes::int) { $displayUpDown = true; } else { $displayUpDown = false; } } else { $displayUpDown = false; } $query .= ' from ' . $table->getTableName(); if ($where != '') { $query .= ' ' . $where; } if (isset($_GET['orderBy']) && in_array($_GET['orderBy'], $columnNames)) { $query .= ' order by ' . $this->cleanUserInput($_GET['orderBy']); } else { if (trim($table->getOrderingColumnForListings()) != '') { $query .= ' order by ' . trim($table->getOrderingColumnForListings()); } } require $this->getConfigurationFor('templatesRepository') . 'wooof_doTableList_1.activeTemplate.php'; if ($parentId != '') { $content = $addItemParent; } else { $content = $addItem; } $headers = array_values($headers); $presentation = array_values($presentation); $columnNames = array_values($columnNames); $content .= $this->getPresentationListFromQuery($query, $headers, $presentation, $table, $displayActivation, $displayPreview, $displayUpDown, TRUE, $columnNames, $parentId); return $content; }
} else { $hasGhostTable = ''; } $hasDeletedColumn = $table->getHasDeletedColumn(); if ($hasDeletedColumn == '1') { $hasDeletedColumn = ' checked'; } else { $hasDeletedColumn = ''; } $hasEmbededPictures = $table->getHasEmbededPictures(); if ($hasEmbededPictures == '1') { $hasEmbededPictures = ' checked'; } else { $hasEmbededPictures = ''; } $showIdInAdminLists = $table->getShowIdInAdminLists(); if ($showIdInAdminLists == '1') { $showIdInAdminLists = ' checked'; } else { $showIdInAdminLists = ''; } $showIdInAdminForms = $table->getShowIdInAdminForms(); if ($showIdInAdminForms == '1') { $showIdInAdminForms = ' checked'; } else { $showIdInAdminForms = ''; } } else { if (isset($_POST['submit'])) { if ($_POST['action'] == 'new') { $table = $wo->db->getEmptyTable();