Esempio n. 1
0
 /**
  * 
  * @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;
 }
Esempio n. 2
0
 $presentationDefault[1] = '';
 $presentationDefault[2] = '';
 $presentationDefault[3] = '';
 $presentationDefault[4] = '';
 $presentationDefault[5] = '';
 $presentationDefault[$table->getAdminPresentation()] = ' selected';
 $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') {