public function drawTextMenu($id) { foreach ($this->textMenus[$id] as $menuItem) { list($name, $URL, $relative, $title) = $menuItem; if ($relative) { $URL = SiteURL($URL); } echo '<li><a href="' . $URL . '"' . (is_string($title) ? ' title="' . $title . '"' : '') . '>' . $name . '</a></li>'; } }
public function generate() { // displaying errors (if any) foreach ($this->errors as $error) { if ($this->globalMessages) { Watermelon::displayError($error); } else { $r .= '<div class="error">' . $error . '</div>'; } } $this->errors = array(); // storing form object in session (so that in can be reconstructed on action page) $_SESSION['Form_' . $this->formID] = serialize($this); // extra <form> attributes $attributes = ''; foreach ($this->extraFormAttributes as $attribute => $value) { $attributes .= ' ' . $attribute . '="' . $value . '"'; } // generating $r .= '<form action="' . SiteURL($this->actionPage) . '" method="post"' . $attributes . ">\n"; $r .= '<input type="hidden" name="formID" value="' . $this->formID . '">' . "\n"; // items foreach ($this->items as $item) { if (is_object($item)) { $r .= $item->generate() . "\n"; } else { $r .= $item . "\n"; } } // submit button if ($this->displaySubmitButton) { if (empty($this->submitLabel)) { $submitLabel = ' value="Zapisz"'; } else { $submitLabel = ' value="' . $this->submitLabel . '"'; } $r .= '<label><span></span><input type="submit"' . $submitLabel . '></label>'; } //-- $r .= '</form>'; return $r; }
function QuestionBox($message, $yesPage) { $h .= '<div class="questionBox">' . $message . '<menu>'; $h .= '<input type="button" value="Anuluj" onclick="history.back()" autofocus>'; $h .= '<form action="' . SiteURL($yesPage) . '" method="post"><input type="submit" value="Tak"></div>'; $h .= '</menu></div>'; return $h; }
public function drawSubNav() { // checking if any item is selected if (!$this->isSelected) { return; } // checking if any subitems are given $subitems = Watermelon::$controller->subNav; if (empty($subitems)) { return; } // composing links array $links = array(); foreach ($subitems as $subitem) { list($name, $title, $page) = $subitem; // title if (!empty($title)) { $title = ' title="' . $title . '"'; } // checking, whether it's current page $currentPage = ''; if ($this->startsWith($page)) { $currentPage = ' class="currentPage"'; // FIXME: if two subitems are starting the same, both will be shown as current } // generating $links[] = '<a href="' . SiteURL($page) . '"' . $title . $currentPage . '>' . $name . '</a>'; } // final generation echo '<nav id="subNav">'; echo implode(' | ', $links); echo '</nav>'; }
public function generate() { // pagination if ($this->isPagination) { //TODO: better pagination $pb .= '<div class="acp-tablePages">'; $pb .= 'Strona: '; if ($this->currentPage > 1) { $pb .= '<a href="' . SiteURL($this->pageLink . '1') . '">Pierwsza</a> | '; $pb .= '<a href="' . SiteURL($this->pageLink . ($this->currentPage - 1)) . '">Poprzednia</a> | '; } $pb .= $this->currentPage . ' | '; if ($this->currentPage < $this->lastPage) { $pb .= '<a href="' . SiteURL($this->pageLink . ($this->currentPage + 1)) . '">Następna</a> | '; $pb .= '<a href="' . SiteURL($this->pageLink . $this->lastPage) . '">Ostatnia</a>'; } $pb .= '</div>'; } // buttons if ($this->isCheckbox) { $pb .= '<menu>'; if (!empty($this->selectedActions)) { $pb .= 'Zaznaczone: '; foreach ($this->selectedActions as $action) { list($label, $basePage, $description) = $action; if (!empty($description)) { $description = ' title="' . htmlspecialchars($description) . '"'; } $basePage = SiteURL($basePage); $pb .= '<input type="button" value="' . $label . '"' . $description . ' onclick="TableAction(' . $this->tableID . ',\'' . $basePage . '\')">' . "\n"; } } $t .= '</menu>'; } // header/footer of the table $h .= '<tr>'; // select/unselect all if ($this->isCheckbox) { $h .= '<th style="width: 15px" onclick="TableChangeSelection(' . $this->tableID . ', true)">'; $h .= '<input type="checkbox" title="Zaznacz/odznacz wszystkie">'; $h .= '</th>'; } // header labels foreach ($this->header as $headerLabel) { $h .= "<th>\n\t" . $headerLabel . "\n</th>\n"; } //-- $h .= "</tr>\n\n"; // table beginning $t .= $pb; $t .= '<table id="acptable-' . $this->tableID . '" class="acptable">'; $t .= '<thead>' . $h . '</thead>'; $t .= '<tfoot>' . $h . '</tfoot>'; // adding rows foreach ($this->rows as $line) { // data if ($this->isCheckbox) { list($id, $cells, $attributes) = $line; } else { list($cells, $attributes) = $line; } if (!isset($attributes)) { $attributes = array(); } // attributes (optionally) $t .= '<tr'; foreach ($attributes as $attribute => $value) { $t .= ' ' . $attribute . '="' . htmlspecialchars($value) . '"'; } $t .= '>'; // checkbox if ($this->isCheckbox) { $t .= '<td title="ID: ' . $id . '" onclick="TableFlip(' . $this->tableID . ', ' . $id . ')">'; $t .= '<input type="checkbox" id="table' . $this->tableID . '-id' . $id . '" onclick="TableFlip(' . $this->tableID . ', ' . $id . ')"></td>' . "\n"; } // cells foreach ($cells as $cell) { $t .= "<td>\n\t" . $cell . "\n</td>\n"; } //-- $t .= "</tr>\n\n"; } $t .= '</table>'; $t .= $pb; // returning return $t; }