function pawusers_input_datetime_print($attributes) { // GET SELECTION $selected = array("year" => "-1", "month" => "-1", "day" => "-1", "hour" => "-1", "minute" => "-1"); if (isset($attributes["value"]) && !empty($attributes["value"])) { $selected = array_merge($selected, $attributes["value"]); } // CREATE DATETIME $create = array("year" => array(1900, date('Y')), "month" => array(1, 12), "day" => array(1, 31), "hour" => array(0, 24), "minute" => array(0, 60)); foreach ($create as $key => $value) { $array =& ${$key}; if (isset($attributes[$key . "_value"]) && !empty($attributes[$key . "_value"])) { $array[] = '<option value="-1" ' . paw_select("-1", $selected[$key], false) . '>' . $attributes[$key . "_value"] . '</option>'; } for ($i = $value[0]; $i <= $value[1]; $i++) { if ($key == "month") { $array[] = '<option value="' . $i . '" ' . paw_select((string) $i, $selected[$key], false) . '>' . date("F", mktime(0, 0, 0, $i, 1, 2000)) . '</option>'; } else { $array[] = '<option value="' . $i . '" ' . paw_select((string) $i, $selected[$key], false) . '>' . $i . '</option>'; } } } arsort($year); if (isset($attributes["year_value"]) && !empty($attributes["year_value"])) { array_unshift($year, array_pop($year)); } // PRINT FORM $form = array("[year]" => '<select id="' . $attributes["id"] . '-year" name="' . $attributes["name"] . '[year]">' . implode($year) . '</select>', "[month]" => '<select id="' . $attributes["id"] . '-year" name="' . $attributes["name"] . '[month]">' . implode($month) . '</select>', "[day]" => '<select id="' . $attributes["id"] . '-year" name="' . $attributes["name"] . '[day]">' . implode($day) . '</select>', "[hour]" => '<select id="' . $attributes["id"] . '-year" name="' . $attributes["name"] . '[hour]">' . implode($hour) . '</select>', "[minute]" => '<select id="' . $attributes["id"] . '-year" name="' . $attributes["name"] . '[minute]">' . implode($minute) . '</select>'); print str_replace(array_keys($form), array_values($form), $attributes["datetime"]); return; }
function pawusers_input_select_print($attributes) { $items = $attributes["items"]; $items = explode("\n", $items); unset($attributes["items"]); $select = $attributes["selected"]; unset($attributes["selected"]); if (!empty($attributes["value"])) { $select = $attributes["value"]; } unset($attributes["value"]); if (!is_array($select)) { $select = explode(",", $select); } if ($attributes["multiple"] == "true") { $attributes["name"] = $attributes["name"] . "[]"; } $attr = paw_format_attributes($attributes); ?> <select <?php echo $attr; ?> > <?php foreach ($items as $item) { $item = explode("#", $item); if (count($item) >= 2) { $key = $item[0]; unset($item[0]); $item = implode("#", $item); } else { $key = $item[0]; $item = $item[0]; } ?> <option value="<?php echo $key; ?> " <?php paw_select($key, $select); ?> ><?php echo $item; ?> </option> <?php } ?> </select><?php return; }
public function printType($key, $data, $value = NULL) { $key = paw_xss_cleaner($key); $input = $this->getTypeConfig($data); $data = $input["type"]; $config = $input["config"]; switch ($data) { case "string": if ($value === NULL && isset($config["value"])) { $value = $config["value"]; } $output = "<input type='text' class='textbox' id='field-attr-{$key}' name='field[attributes][{$key}]' value='" . $value . "' />"; break; case "int": if ($value === NULL && isset($config["value"])) { $value = $config["value"]; } $output = "<input type='number' id='field-attr-{$key}' name='field[attributes][{$key}]' value='" . $value . "' />"; break; case "textarea": if ($value === NULL && isset($config["value"])) { $value = $config["value"]; } $output = "<textarea class='textbox' id='field-attr-{$key}' name='field[attributes][{$key}]'>" . $value . "</textarea>"; break; case "bool": if ($value === NULL && isset($config["true"])) { $value = "true"; } else { if ($value === NULL && isset($config["false"])) { $value = "false"; } } $output = "<select id='field-attr-{$key}' name='field[attributes][{$key}]'>"; $output .= "<option value='true' " . paw_select("true", $value, false) . ">" . __("True") . "</option>"; $output .= "<option value='false' " . paw_select("false", $value, false) . ">" . __("False") . "</option>"; $output .= "</select>"; break; } if (isset($output)) { return $output; } return false; }
<?php $roles = $pawUsers->permissions->getRoles(NULL, false); ?> <select class="pawusers-select" name="role"> <option value=""><?php echo __("User Roles"); ?> </option> <?php foreach ($roles as $role) { ?> <option value="<?php echo $role["name"]; ?> " <?php paw_select($role["name"], $form["roles"]); ?> ><?php echo $role["label"]; ?> </option> <?php } ?> </select> <button name="user-filter"><?php echo __("Filter"); ?> </button> </form> </div>
<option value=""><?php echo __("Status"); ?> </option> <option value="1" <?php if ($action === "filter") { paw_select("1", $form["status"]); } ?> ><?php echo __("Active"); ?> </option> <option value="0" <?php if ($action === "filter") { paw_select("0", $form["status"]); } ?> ><?php echo __("Inactive"); ?> </option> </select> <button><?php echo __("Filter"); ?> </button> </form> </div> <div class="pawusers-search">
<tr> <td class="label"><label for="message_type"><?php echo __("eMail Format"); ?> </label></td> <td class="field"> <select id="message_type" name="message_type"> <option value="text" <?php paw_select("text", $config["message_type"]); ?> ><?php echo __("Text"); ?> </option> <option value="html" <?php paw_select("html", $config["message_type"]); ?> ><?php echo __("HTML"); ?> </option> </select> </td> <td class="help"></td> </tr> <tr> <td class="label"><label for="message_from"><?php echo __("eMail From Address"); ?> </label></td>