*/ class status extends \library\field { private $selected100, $selected101, $selected102, $selected103 = ''; public function build() { switch ($this->value) { case 100: $this->selected100 = "selected=selected"; break; case 101: $this->selected101 = "selected=selected"; break; case 102: $this->selected102 = "selected=selected"; break; case 103: $this->selected103 = "selected=selected"; break; } $readonly = !empty($this->readonly) ? ' readonly="' . $this->readonly . '"' : null; $widget = ''; $widget .= ' <select class="form-control" name="' . $this->name . '" ' . $readonly . '> <option value="100" ' . $this->selected100 . '>' . convertCodes(100) . '</option>
public function build() { $paramAdd = isset($this->param['add']) ? '?' . $this->param['add'] : ''; //display action button $widget = ' <!-- boutons action --> <div class="btn-group primary" style="float:left;margin-right : 10px;"> <button class="btn btn-primary dropdown-toggle btn-small" data-toggle="dropdown"><span class="glyphicon glyphicon-cog"></span> Actions <span class="caret"></span></button> <ul class="dropdown-menu"> <li><a href="' . WEBSITE_ROOT . '/admin/' . encodeHtmlString($this->module) . '/add' . encodeHtmlString($paramAdd) . '"><span class="glyphicon glyphicon-plus"></span> Ajouter</a></li> <li><a href="#" onclick="if(confirm(\'Voulez vous vraiment supprimer ?\')){$(\'#formAction\').val(\'delete\'); window.document.form' . str_replace("\\", "", $this->module) . '.submit();}"><span class="glyphicon glyphicon-trash"></span> Supprimer</a></li> </ul> </div><!-- /btn-group -->'; //display table header $widget .= '<br /><br /> <form name="form' . str_replace("\\", "", $this->module) . '" action="#" method="post"> <table class="table"><thead>'; //display name of the columns $widget .= '<tr><th></th>'; foreach ($this->columns as $column) { $widget .= '<th>' . $column . '</th>'; } $widget .= '</tr></thead><tbody>'; //display result foreach ($this->data as $value) { $widget .= '<tr><td width="20px"><input type="checkbox" name="id[]" value="' . $value->id . '"/></td>'; foreach ($value as $key => $val) { //convert result when the type of the field is highlight, status or active if ($key == "highlight" || $key == "status" || $key == "active") { $widget .= '<td>' . convertCodes($val) . '</td>'; } else { if ($key == "name") { $widget .= '<td><a href="' . WEBSITE_ROOT . '/admin/' . encodeHtmlString($this->module) . '/edit/' . $value->id . '">' . $val . '</a></td>'; } else { if ($key == "id") { } else { $widget .= '<td>' . $val . '</td>'; } } } } $widget .= '</tr>'; } //display footer and hidden fields $widget .= '</tbody></table> <input type="hidden" name="formAction" id="formAction" value="" /> <input type="hidden" name="formName" id="formName" value="form' . str_replace("\\", "", $this->module) . '" /> </form>'; //return result return $widget; }
*/ class bool extends \library\field { private $selected0, $selected1 = ''; public function build() { switch ((int) $this->value) { case 0: $this->selected0 = "selected=selected"; break; case 1: $this->selected1 = "selected=selected"; break; } $widget = ''; $widget .= '
<?php echo $instances->descr; ?> <hr /> <div class="tile double bg-grayLighter no-cursor"> <div style="float : left;margin : 0px 10px 10px 0px;font-size:28px;"><span class="glyphicon glyphicon-time"></span></div> <?php echo "<h5>" . _TR_Deadline . '</h5>' . $instances->deadline; ?> </div> <div class="tile triple bg-grayLighter no-cursor"> <div style="float : left;margin : 0px 10px 10px 0px;font-size:28px;"><span class="glyphicon glyphicon-envelope"></span></div> <?php echo "<h5>" . _TR_WhoCanVote . '</h5>' . convertCodes($instances->whoCanVote); ?> </div> <div class="tile double bg-grayLighter no-cursor"> <div style="float : left;margin : 0px 10px 10px 0px;font-size:28px;"><span class="glyphicon glyphicon-eye-open"></span></div> <?php echo "<h5>" . _TR_WhoCanSeeTheInstance . '</h5>' . convertCodes($instances->whoCanSeeTheInstance); ?> </div> <div class="tile triple bg-grayLighter no-cursor"> <div style="float : left;margin : 0px 10px 10px 0px;font-size:28px;"><span class="glyphicon glyphicon-pencil"></span></div> <?php echo "<h5>" . _TR_WhoCanWriteVote . '</h5>' . convertCodes($instances->whoCanWriteVote); ?> </div> </div>