Beispiel #1
0
 function DataGridCapture($numrows, $numcolumns, $titles, $gadget, $action, $entry_type, $caption = '', $id = '')
 {
     $this->_name = 'datagridcapture';
     $this->_class = 'datagrid';
     $this->_columns = array();
     $this->_caption = $caption;
     $this->_actionColumns = array();
     $this->_data = array();
     if (empty($id)) {
         $this->_id = 'datagridcapture_' . rand(1, 100);
     } else {
         $this->_id = $id;
     }
     /*if (is_array($data)) {
           $this->_data = $data;
       } else {
           die("beh!");
       }
       */
     $this->setOddColor('#eee');
     $this->setEvenColor('#fff');
     for ($id = 0; $id < $numrows; $id++) {
         $idtext = $this->_id . '_' . $id;
         $keyField1 = new Entry('name_' . $idtext, str_replace('"', '&quot;', ''));
         #$keyField->setStyle('background: transparent;border-style: solid; border: 10px;');
         $keyField1->setStyle('border-style: solid; border: 10px;');
         $keyField1->setEnabled(true);
         $keyField1->setSize(30);
         $data[$id]['key'] = $keyField1->get();
         $keyField2 = new Entry('value_' . $idtext, str_replace('"', '&quot;', ''));
         $keyField2->setStyle('background: transparent; border: 1px;');
         $keyField2->setEnabled(true);
         $keyField2->setSize(30);
         $data[$id]['value'] = $keyField2->get();
         $data[$id]['action'] = '<a OnClick="javascript: if(confirm(\'Are this values correct?\')) { window.location=\'?gadget=' . $gadget . '&action=' . $action . '&id=' . $id . '&key=\'+document.getElementById(\'' . $keyField1->getID() . '\').value+\'&value=\'+document.getElementById(\'' . $keyField2->getID() . '\').value+\'&entry_type=' . $entry_type . '\';}"><img id="imgcat' . $id . '" src="images/stock/save.png" border="0" alt="" /></a>';
     }
     parent::init();
     foreach ($titles as $t) {
         $this->addColumn(new Column(_("{$t}"), "{$t}", true));
     }
     $this->addData($data);
 }
Beispiel #2
0
 function _buildXHTML()
 {
     $this->_entry->setReadOnly($this->_readOnly);
     $this->_entry->setEnabled($this->_isEnabled);
     $this->_button->setEnabled($this->_isEnabled);
     $this->_XHTML = "<table";
     $this->_XHTML .= $this->buildBasicXHTML();
     $this->_XHTML .= $this->buildJSEvents();
     $this->_XHTML .= ">\n";
     $this->_XHTML .= " <tr>\n";
     $this->_XHTML .= "  <td>\n";
     $this->_XHTML .= $this->_entry->get();
     $this->_XHTML .= "  </td>\n";
     $this->_XHTML .= "  <td>\n";
     $this->_XHTML .= $this->_button->get();
     $this->_XHTML .= "  </td>\n";
     $this->_XHTML .= " </tr>\n";
     $this->_XHTML .= "</table>";
 }