<input type="radio" name="digit" value="8"> 8個 <input type="radio" name="digit" value="10"> 10個 </p> <p>スタイル<br> <input type="radio" name="style" value="0" checked> 半角英字 <input type="radio" name="style" value="1"> 半角英字&数字 <input type="radio" name="style" value="2"> 半角英字(大小)&数字 </p> <p><input type="submit" name="generate" value="生成"> </p> </form> </div> <div id="passwordTable"> <?php try { $display = new TableDisplay($passValue); $display->display(); } catch (Exception $e) { die($e->getMessage); } ?> <br/> <a>この乱数をダウンロードする</a> <form method="post" action=""> <input type="submit" name="csv" value="download"> </form> </div> </div> <footer> <p>Copyright © Password Factory All Rights Reserved.</p> </footer>
/** * Callback for AssessmentsStats parser function * @param Parser $parser Parser object passed by MW hook system (unused) * @param unknown A project object?? */ public static function AssessmentStatsRender($parser, $project) { $projectStats = Statistics::getProjectStats($project); $output = TableDisplay::formatTable($project, $projectStats); return $output; }
} } class TableDisplay extends AbstractDisplay { protected function displayHeader() { echo '<table border="1" cellpadding="2" cellspacing="2">'; } protected function displayBody() { foreach ($this->getData() as $key => $value) { echo '<tr>'; echo '<th>' . $key . '</th>'; echo '<td>' . $value . '</td>'; echo '</tr>'; } } protected function displayFooter() { echo '</table>'; } } /* * Client */ $data = array('Design Pattern', 'Gang of Four', 'Template Method Sample1', 'Template Method Sample2'); $display1 = new ListDisplay($data); $display2 = new TableDisplay($data); $display1->display(); echo '<hr>'; $display2->display();