} else { $wooofParent = $addressItems[2]; } $content = $path . '<div class="listTitle"><a href="administration.php?action=edit&__address=1_' . $addressItems[1] . '_&wooofParent=' . $wooofParent . '">' . $additionLabel . ' <img src="images/add.png" alt="Create new item" border="0" align="top"></a></div>'; $htmlFragment = '<li class="normalTreeItemLevel@@@level@@@">@@@' . $columnsToShow . '@@@ @@@activation@@@<a href="administration.php?__address=1_@@@tableId@@@_@@@id@@@&action=edit"><img border="0" align="top" alt="edit" src="images/edit.png"></a>@@@upDown@@@ <a href="javascript:confirmDelete(\'administration.php?__address=1_@@@tableId@@@_@@@id@@@&action=delete\');"><img border="0" align="top" alt="Delete" src="images/delete.png"></a> @@@subItems@@@</li>'; if (count($addressItems) == 2) { $whereClauses[$table->getLocalGroupColumn()] = '-1'; } else { $whereClauses[$table->getLocalGroupColumn()] = $addressItems[2]; } $table->getResult($whereClauses, $table->getOrderingColumnForListings()); $output = '<ul class="treeLevel1"> '; for ($i = 0; $i < count($table->resultRows) / 2; $i++) { if ($table->getHasActivationFlag()) { if ($table->resultRows[$i]['active'] == '1') { $activation = '<a href="administration.php?action=deactivate&__address=1_' . $table->getTableId() . '_' . $table->resultRows[$i]['id'] . '" class="catOn">Active</a>'; } else { $activation = '<a href="administration.php?action=activate&__address=1_' . $table->getTableId() . '_' . $table->resultRows[$i]['id'] . '" class="catOff">Inactive</a>'; } } else { $activation = ''; } if (trim($table->getOrderingColumnForListings() != '')) { $upDown = ' <a href="administration.php?action=moveUp&__address=1_' . $table->getTableId() . '_' . $table->resultRows[$i]['id'] . '"><img src="images/arrowUp.png" border="0" alt="Up table item in order"></a><a href="administration.php?action=moveDown&__address=1_' . $table->getTableId() . '_' . $table->resultRows[$i]['id'] . '"><img src="images/arrowDown.png" border="0" alt="Down table item in order"></a>'; } $tmp = str_replace('@@@' . $columnsToShow . '@@@', '<a href="administration.php?__address=1_' . $table->getTableId() . '_' . $table->resultRows[$i]['id'] . '&action=edit">' . $table->resultRows[$i][$columnsToShow] . '</a>', $htmlFragment); $tmp = str_replace('@@@id@@@', $table->resultRows[$i]['id'], $tmp); $tmp = str_replace('@@@tableId@@@', $table->getTableId(), $tmp); $tmp = str_replace('@@@level@@@', 1, $tmp);
/** * * @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; }
$tableName = $table->getTableName(); $orderingColumnForListings = $table->getOrderingColumnForListings(); $appearsInAdminMenu = $table->getAppearsInAdminMenu(); if ($appearsInAdminMenu == '1') { $appearsInAdminMenu = ' checked'; } else { $appearsInAdminMenu = ''; } $adminItemsPerPage = $table->getAdminItemsPerPage(); $adminListMarkingCondition = $table->getAdminListMarkingCondition(); $adminListMarkedStyle = $table->getAdminListMarkedStyle(); $groupedByTable = $table->getGroupedByTable(); $remoteGroupColumn = $table->getRemoteGroupColumn(); $localGroupColumn = $table->getLocalGroupColumn(); $tablesGroupedByThis = $table->getTablesGroupedByThis(); $hasActivationFlag = $table->getHasActivationFlag(); $columnForMultipleTemplates = $table->getColumnForMultipleTemplates(); $dbEngine = $table->getDbEngine(); if ($hasActivationFlag == '1') { $hasActivationFlag = ' checked'; } else { $hasActivationFlag = ''; } $availableForSearching = $table->getAvailableForSearching(); if ($availableForSearching == '1') { $availableForSearching = ' checked'; } else { $availableForSearching = ''; } $hasGhostTable = $table->getHasGhostTable(); if ($hasGhostTable == '1') {