コード例 #1
0
ファイル: Skin.php プロジェクト: radex/Watermelon
 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>';
     }
 }
コード例 #2
0
ファイル: Form.php プロジェクト: radex/Watermelon
 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;
 }
コード例 #3
0
ファイル: helpers.php プロジェクト: radex/Watermelon
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;
}
コード例 #4
0
ファイル: skin.php プロジェクト: radex/Watermelon
 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>';
 }
コード例 #5
0
ファイル: ACPTable.php プロジェクト: radex/Watermelon
 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;
 }