Exemple #1
0
    /**
     *
     * @return string
     */
    public function getForm($readOnly = 'readwrite')
    {
        $RO = 'readonly' === $readOnly ? 'READONLY="READONLY" ' : '';
        $searchModel = $this->_searchModel;
        $title = $this->getTitle();
        $id = $searchModel->getId();
        $engineName = htmlspecialchars($searchModel->getEngineName());
        $searchName = htmlspecialchars($searchModel->getSearchName());
        $url = htmlspecialchars($searchModel->getUrl());
        $created = $searchModel->getCreated();
        $updated = $searchModel->getUpdated();
        $buttonLabel = $this->getButtonLabel();
        if (Tools::isNumeric($id)) {
            $noteController = new NoteController('read');
            $noteModels = $noteController->getSome("appliesToTable = 'search' and appliesToId = {$id}");
            $noteListView = new NoteListView('html', $noteModels);
            $noteListView->setNoteModels($noteModels);
            $noteListView->setAppliesToTable('search');
            $noteListView->setAppliesToId($id);
            $noteListViewText = $noteListView->getView();
        } else {
            $noteListViewText = '';
        }
        $returnValue = <<<HTML
    <h2>{$title}</h2>
    <form name="search" onsubmit="return validateSearch()" method="GET">
      <table border="1" cellspacing="1" cellpadding="2">
        <tr>
          <th>ID</th>
          <td><input type="text" name="id" value="{$id}" readonly="readonly" /></td>
        </tr>
        <tr>
          <th>Engine Name *</th>
          <td><input type="text" name="engineName" value="{$engineName}" {$RO} /></td>
        </tr>
        <tr>
          <th>Search Name *</th>
          <td><input type="text" name="searchName" value="{$searchName}" {$RO} /></td>
        </tr>
        <tr>
          <th>URL *</th>
          <td><input type="text" name="url" value="{$url}" {$RO} /></td>
        </tr>
        <tr>
          <th>Created</th>
          <td><input type="text" name="created" value="{$created}" disabled="disabled" /></td>
        </tr>
        <tr>
          <th>Updated</th>
          <td><input type="text" name="updated" value="{$updated}" disabled="disabled" /></td>
        </tr>
        <tr>
          <td colspan="2">
            <center>
              <input type="reset" /> &nbsp; &nbsp; <input type="submit" name="act" value="{$buttonLabel}" />
            </center>
          </td>
        </tr>
      </table>
    </form>
    {$noteListViewText}
HTML;
        return $returnValue;
    }