Exemplo n.º 1
0
 /**
  * Create the Editor for a new lookup row
  */
 protected function lookup_new()
 {
     global $INPUT;
     global $lang;
     $tablename = $INPUT->str('schema');
     $schema = new Schema($tablename);
     if (!$schema->isEditable()) {
         return;
     }
     // no permissions, no editor
     echo '<div class="struct_entry_form">';
     echo '<fieldset>';
     echo '<legend>' . $this->getLang('lookup new entry') . '</legend>';
     /** @var action_plugin_struct_entry $entry */
     $entry = plugin_load('action', 'struct_entry');
     foreach ($schema->getColumns(false) as $column) {
         $label = $column->getLabel();
         $field = new Value($column, '');
         echo $entry->makeField($field, "entry[{$label}]");
     }
     formSecurityToken();
     // csrf protection
     echo '<input type="hidden" name="call" value="plugin_struct_lookup_save" />';
     echo '<input type="hidden" name="schema" value="' . hsc($tablename) . '" />';
     echo '<button type="submit">' . $lang['btn_save'] . '</button>';
     echo '<div class="err"></div>';
     echo '</fieldset>';
     echo '</div>';
 }