>
option = $option; } /** * pageNav を設定、または設定されているpageNav を返す * @param mosPageNav pageNav * @return mosPageNav */ function & pageNav($pageNav = null) { $pageNav and $this->pageNav =& $pageNav; return $this->pageNav; } /** * 列定義を追加 * @param string name * @param string title * @param string task * @param string width */ function appendField($name, $title, $task = null, $width = null) { $this->fields[] = array('name' => $name, 'title' => $title, 'task' => $task, 'width' => $width); } /** * 行番号列定義を追加 * @param string title * @param string width */ function appendRowNumberField($title, $width = null) { $this->fields[] = array('type' => 'rownumber', 'title' => $title, 'width' => $width); } /** * チェックボックス列定義を追加 * @param string width */ function appendCheckboxField($width = null) { $this->fields[] = array('type' => 'checkbox', 'width' => $width); } /** * 行オブジェクト作成 * @param mixed id */ function & createRow($id = null) { $row = new mosKingyoyaAdminHTMLListRow($id); return $row; } /** * 行オブジェクトを追加 * @param mixed row */ function & appendRow($row) { if (!is_object($row)) { $row = new mosKingyoyaAdminHTMLListRow($row); } $this->rows[] =& $row; return $row; } /** * 一覧を描画 */ function show() { ?> fields as $field) { $type = isset($field['type']) ? $field['type'] : null; $title = isset($field['title']) ? $field['title'] : null; if ($width = $field['width']) { echo "\n"; } ?> rows as $row) { echo "\n"; foreach ($this->fields as $field) { $type = isset($field['type']) ? $field['type'] : null; $name = isset($field['name']) ? $field['name'] : null; $task = isset($field['task']) ? $field['task'] : null; echo '\n"; } echo "\n"; $i ++; } ?>
"; } else { echo ''; } switch($type) { case 'checkbox'; $count = count($this->rows); echo ''; break; default; echo $title; break; } echo "
'; switch($type) { case 'checkbox'; echo mosHTML::idBox( $i, $row->id() ); break; case 'rownumber'; echo $this->pageNav->rowNumber($i); break; default; if ($task) { echo "option}&task={$task}&id={$row->id}\">"; } if ($name === 'id') { echo $row->id(); } else { echo $row->field($name); } if ($task) { echo ''; } break; } echo "
pageNav) { echo $this->pageNav->getListFooter(); } } } /** * 管理画面一覧HTML生成行クラス */ class mosKingyoyaAdminHTMLListRow { /** @var mixed id */ var $id = null; /** @var array field set */ var $fields = array(); /** * コンストラクタ * @param mixed id */ function mosKingyoyaAdminHTMLListRow($id = null) { $this->id = $id; } /** * 行のIDを設定、または返す * @param mixed id * @return mixed */ function id($id = null) { isset($id) and $this->id = $id; return $this->id; } /** * 列の値を設定、または返す * @param string name * @param string value * @return string */ function field($name, $value = null) { if (!isset($this->fields[$name])) $this->fields[$name] = null; isset($value) and $this->fields[$name] = $value; return $this->fields[$name]; } } /** * 管理画面フォームHTML生成クラス */ class mosKingyoyaAdminHTMLForm { }