コード例 #1
0
 /**
  * Vrátí HTML strukturu pro zobrazní fieldu
  *
  * @author Tomáš Kocifaj
  * @link http://www.ktstudio.cz
  *
  * @return string
  */
 public function getField()
 {
     $html = "";
     $value = htmlentities($this->getValue());
     $html .= "<input type=\"text\" ";
     $html .= $this->getBasicHtml();
     $html .= " value=\"{$value}\" ";
     if (KT::notIssetOrEmpty($this->getDefaultColor())) {
         $html .= " data-default-color=\"{$this->getDefaultColor()}\"";
     }
     $html .= "/>";
     if ($this->hasErrorMsg()) {
         $html .= parent::getHtmlErrorMsg();
     }
     return $html;
 }
コード例 #2
0
 public function getField()
 {
     $fieldValue = $this->getValue();
     $accept = $this->getAcceptFileTypeString();
     $html = "<input type=\"file\"";
     $html .= $this->getBasicHtml();
     if (KT::issetAndNotEmpty($fieldValue)) {
         $html .= " value=\"{$fieldValue}\" ";
     }
     if (KT::issetAndNotEmpty($accept)) {
         $html .= "accept=\"{$accept}\" ";
     }
     $html .= "/>";
     if ($this->hasErrorMsg()) {
         $html .= parent::getHtmlErrorMsg();
     }
     return $html;
 }
コード例 #3
0
 /**
  * Založení objektu typu Hidden
  *
  * @param string $name - hash v poli
  * @param string $label - popisek v html
  * @return self
  */
 public function __construct($name, $label)
 {
     parent::__construct($name, $label);
 }
コード例 #4
0
 public function getValue()
 {
     return stripslashes(parent::getValue());
 }
コード例 #5
0
 /**
  * Vrátí hodnotu ve fieldu
  *
  * @author Tomáš Kocifaj
  * @link http://www.ktstudio.cz
  *
  * @param bolean $original - má vrátít originální hodnotu v DB nebo hodnotou pro zobrazení
  * @return null
  */
 public function getConvertedValue()
 {
     $fieldValue = parent::getValue();
     return self::getSwitchConvertedValue($fieldValue);
 }
コード例 #6
0
 /**
  * Sestaví jeden TR řádek v podobě Label -> value (saved).
  * Pokud je value prázdné, nebude ho vůbec zobrazovat.
  * Pokud má Field definovaný Unit zobrazí ho pouze v případě, že se value rovná KT_EMPTY_TEXT (---)
  *
  * @author Tomáš Kocifaj
  * @link http://www.ktstudio.cz
  *
  * @param KT_Field $field
  * @return string
  */
 private function getInputDataToTr(KT_Field $field, $exclude_keys = array())
 {
     if (in_array($field->getName(), $exclude_keys)) {
         return;
     }
     if ($field->getFieldType() == KT_Hidden_Field::FIELD_TYPE) {
         return;
     }
     $value = $field->getValue();
     if ($field->getFieldType() == KT_Select_Field::FIELD_TYPE || $field->getFieldType() == KT_Radio_Field::FIELD_TYPE) {
         $fieldOption = $field->getDataManager()->getData();
         if (array_key_exists($field->getValue(), $fieldOption)) {
             $value = $fieldOption[$field->getValue()];
         }
     }
     if ($field->getFieldType() == KT_Checkbox_Field::FIELD_TYPE) {
         $fieldOption = $field->getDataManager()->getData();
         $fieldData = $field->getValue();
         if (KT::issetAndNotEmpty($fieldOption) && KT::issetAndNotEmpty($fieldData)) {
             $value = "";
             foreach ($fieldOption as $key => $optionText) {
                 if (in_array($key, $fieldData)) {
                     $value .= $optionText . ", ";
                 }
             }
         } else {
             $value = "";
         }
     }
     if (KT::notIssetOrEmpty($value)) {
         return;
     }
     $unit = $value == KT_EMPTY_SYMBOL ? "" : $field->getUnit();
     $html = "<tr>";
     $html .= "<td>{$field->getLabel()} </td>";
     $html .= "<td>{$value} {$unit}</td>";
     $html .= "</tr>";
     return $html;
 }
コード例 #7
0
ファイル: kt_form.inc.php プロジェクト: ktstudio/wp-framework
 /**
  * Vrátí hodnotu fieldu pro (single) uložení
  * 
  * @author Tomáš Kocifaj
  * @link http://www.ktstudio.cz
  * 
  * @param KT_Field $field
  * @return string
  */
 public function getSavableFieldValue(KT_Field $field)
 {
     $value = $field->getValue();
     if ($field->getFieldType() == KT_Text_Field::FIELD_TYPE) {
         if ($field->getInputType() == KT_Text_Field::INPUT_DATE) {
             $value = KT::dateConvert($value, "Y-m-d");
         }
     }
     return $value;
 }
コード例 #8
0
 /**
  * Vrátí HTML strukturu pro zobrazní fieldu
  *
  * @author Martin Hlaváč
  * @link http://www.ktstudio.cz
  *
  * @return string
  */
 public function getField()
 {
     $html = "<div class=\"file-load-box\">";
     $html .= $this->getFullSpanUrl();
     $html .= "<input type=\"hidden\" {$this->getBasicHtml()} value=\"{$this->getValue()}\" />";
     $multiple = $this->getIsMultiple() ? "true" : "false";
     $html .= "<span id=\"{$this->getAttrValueByName("id")}\" {$this->getAttrClassString()} data-multiple=\"{$multiple}\">" . __("Vybrat soubor", "KT_CORE_DOMAIN") . "</span>";
     if ($this->hasErrorMsg()) {
         $html .= parent::getHtmlErrorMsg();
     }
     return $html;
 }
コード例 #9
0
 /**
  * Provede validaci fieldu na základě zadaných podmínek a WP nonce kontroly
  * V případě, že se jedná o chybu, nastaví automaticky fieldu hlášku s errorem z validatoru
  *
  * @author Martin Hlaváč
  * @link http://www.ktstudio.cz
  *
  * @return boolean
  */
 public function validate()
 {
     return $this->nonceValidate() && parent::Validate();
 }
コード例 #10
0
 /**
  * 
  * @param string $name
  * @param string $label 
  * @param array $fieldsetRecipy Recept na fieldset
  */
 public function __construct($name, $label, array $fieldsetRecipy)
 {
     parent::__construct($name, $label);
     $this->fieldsetRecipy = $fieldsetRecipy;
 }
コード例 #11
0
 /**
  * Vrátí HTML strukturu pro zobrazní fieldu
  *
  * @author Tomáš Kocifaj
  * @link http://www.ktstudio.cz
  *
  * @return string
  */
 public function getField()
 {
     $html = "<div {$this->getAttrClassString()}>";
     $html .= "<span for=\"{$this->getAttrValueByName("id")}\" {$this->getAttrClassString()} title=\"{$this->getToolTip()}\"></span>";
     $html .= "<input type=\"hidden\" ";
     $html .= $this->getBasicHtml();
     $html .= " value=\"{$this->getValue()}\" />";
     $html .= "</div>";
     if ($this->hasErrorMsg()) {
         $html .= parent::getHtmlErrorMsg();
     }
     return $html;
 }