public function testWrap()
 {
     Form::open(['url' => '/formurl']);
     $field = Form::field('Field Title', 'textfield', 'control', 'help text');
     Form::close();
     $this->assertContains('<label for="textfield" class="col-md-3 control-label">Field Title</label>', $field);
     $this->assertContains('<p class="help-block">help text</p>', $field);
     $this->assertContains('control', $field);
 }
Example #2
0
 public function mailField()
 {
     $form = new Form();
     echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST">';
     echo '<h4>Ny email</h4>';
     echo $form->field("text", "email", "", "20", "200", "myClass");
     echo $form->hiddenField("category", $this->category_id);
     echo $form->hiddenField("entry", $this->entry_id);
     echo '<br />';
     echo $form->submitButton("myClass", "Skapa");
     echo '</form>';
 }
Example #3
0
 function date($name, $value = NULL)
 {
     $value_data = $value == NULL ? split("-", date("Y-m-d")) : split("-", $value);
     $months = array();
     $monthslabels = array();
     for ($i = 0; $i < 12; $i++) {
         array_push($monthslabels, date("F", mktime(0, 0, 0, $i + 1)));
         array_push($months, $i + 1 < 10 ? "0" . ($i + 1) : $i + 1);
     }
     $days = array();
     for ($i = 0; $i < 31; $i++) {
         array_push($days, $i + 1 < 10 ? "0" . ($i + 1) : $i + 1);
     }
     $return = Form::combo($name . "[]", $days, $days, $value_data[2]);
     $return .= Form::combo($name . "[]", $months, $monthslabels, $value_data[1]);
     $return .= Form::field($name . "[]", $value_data[0], 4);
     return $return;
 }
Example #4
0
 public function fields()
 {
     echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST">';
     $form = new Form();
     echo "<h4>Titel</h4>" . $form->field("text", "title", $this->entryPlace->getResultRow("title"), 60, 60, "fieldClass") . "<br />";
     echo "<h4>Beskrivning</h4>" . $form->textArea("description", $this->entryPlace->getResultRow("description"), 60, 20, "fieldClass") . "<br />";
     echo "<h4>Bild</h4><br />";
     echo "<h3>N&ouml;dv&auml;ndiga f&auml;lt</h3>";
     echo $form->checkBox("requiredTitle", $this->entryPlace->getResultRow("requiredTitle"), "fieldClass") . "Titel<br />\n";
     echo $form->checkBox("requiredDescription", $this->entryPlace->getResultRow("requiredDescription"), "fieldClass") . "Beskriving<br />\n";
     echo $form->checkBox("requiredText", $this->entryPlace->getResultRow("requiredText"), "fieldClass") . "Text<br />\n";
     echo $form->checkBox("requiredImage", $this->entryPlace->getResultRow("requiredImage"), "fieldClass") . "Bild<br />\n";
     echo $form->checkBox("requiredComments", $this->entryPlace->getResultRow("requiredComments"), "fieldClass") . "Kommentarer<br />\n";
     echo $form->checkBox("requiredRate", $this->entryPlace->getResultRow("requiredRate"), "fieldClass") . "Betyg<br />\n";
     echo $form->hiddenField("entryPlaceTitle", $this->entryPlaceTitle);
     if ($this->entryPlace->getNumRows() < 1) {
         echo $form->submitButton("fieldClass", "Skapa");
     } else {
         echo $form->submitButton("fieldClass", "Uppdatera");
     }
     echo '<hr size="1"/></form>';
 }
Example #5
0
 public function field($class)
 {
     $form = new Form();
     return "<h4>Publiceringsdatum</h4>" . $form->field("text", "pubDate", htmlspecialchars($this->value, ENT_QUOTES), 19, 19, $class) . "<br />";
 }
 public function field($class)
 {
     $form = new Form();
     return "<h4>" . $this->description . "</h4>" . $form->field("text", "buttonImage", htmlspecialchars($this->value, ENT_QUOTES), 70, 70, $class) . "<br />";
 }