protected function getContent($obj, Am_Grid_Editable $grid) { $id = $this->action->getIdForRecord($obj); $val = $obj->{$this->field->getFieldName()}; list($url, $params) = $this->divideUrlAndParams($this->action->getUrl($obj, $id)); $content = sprintf('<input name="%s" class="live-checkbox" data-url="%s" data-id="%d" data-params="%s" data-value="%s" data-empty_value="%s" type="checkbox" %s/>', Am_Controller::escape($grid->getId() . '_' . $this->field->getFieldName() . '-' . $grid->escape($id)), Am_Controller::escape($url), $id, Am_Controller::escape(Am_Controller::getJson($params)), Am_Controller::escape($this->action->getValue()), Am_Controller::escape($this->action->getEmptyValue()), $val == $this->action->getValue() ? 'checked ' : ''); return $content; }
public function createForm(Am_Grid_Editable $grid) { $id = substr($grid->getId(), 1); $form = new Am_Form_Admin(); $form->addText("value", array('size' => 40))->setLabel(___("Value\nuse % as wildcard mask")); $form->addHidden("type")->setValue($id); $form->addText('comment', array('size' => 40))->setLabel(___("Comment")); return $form; }
public function log($message = null, $tablename = null, $record_id = null) { if ($message === null) { $message = $this->grid->getRecordTitle($this->getTitle()); } if ($tablename === null) { $tablename = 'grid' . $this->grid->getId(); } if ($record_id === null) { try { $record_id = $this->grid->getRecordId(); } catch (Exception $e) { } } if (!defined('AM_ADMIN') || !AM_ADMIN) { return; } $this->grid->getDi()->adminLogTable->log($message, $tablename, $record_id); }
public function run(Am_Grid_Editable $grid, Am_Grid_DataSource_Interface_ReadOnly $dataSource, $fields, $config) { header('Cache-Control: maxage=3600'); header('Pragma: public'); header("Content-type: application/xml"); $dat = date('YmdHis'); header("Content-Disposition: attachment; filename=amember" . $grid->getId() . "-{$dat}.xml"); $total = $dataSource->getFoundRows(); $numOfPages = ceil($total / self::EXPORT_REC_LIMIT); $xml = new XMLWriter(); $xml->openMemory(); $xml->setIndent(true); $xml->startDocument(); $xml->startElement('export'); for ($i = 0; $i < $numOfPages; $i++) { $ret = $dataSource->selectPageRecords($i, self::EXPORT_REC_LIMIT); foreach ($ret as $r) { $xml->startElement('row'); foreach ($fields as $field) { $xml->startElement('field'); $xml->writeAttribute('name', $field->getFieldTitle()); $xml->text($field->get($r, $grid)); $xml->endElement(); // field } $xml->endElement(); } } $xml->endElement(); echo $xml->flush(); return; }