public static function __printFormNew($shema) { $html = '<div style="border-radius: 2px;border: 1px solid #B9B9B9;"><div style="background: #F9F9F9;padding :4px;">'; $html .= FormHelper::getInstance()->file($shema["Field"], array("id" => $shema["Field"])); $html .= '</div></div>'; return $html; }
public static function __printFormNew($shema) { $string = array(); $class = array(); if ($shema["Field"] == "text") { $class = array("class" => "text-editable"); } foreach (Kernel::getLangs() as $lang) { $typeInput = array_key_exists("size", $shema["Link"]) && $shema["Link"]["size"] == "small" ? "input" : "textarea"; array_push($string, FormHelper::getInstance()->{$typeInput}($shema["Field"] . "[" . $lang . "]", $class)); } return $string; }
public function getFormNewElements($table, array $options = array()) { $form = array(); foreach ($table->getShema() as $key => $shema) { if (!in_array($key, array("id", "deleted", "slug", "date")) && (!is_array($shema["Link"]) || is_array($shema["Link"]) && !array_key_exists("editable", $shema["Link"]))) { if (!is_array($shema["Link"]) || !array_key_exists("link", $shema["Link"])) { $params = array("value" => ""); if ($key == "password") { $form[$key] = FormHelper::getInstance()->input($key, array("type" => "password")); } elseif ($key == "text") { $form[$key] = FormHelper::getInstance()->textarea($key, $params); } else { $formType = $shema["Link"]["size"] == "small" ? "input" : "textarea"; $form[$key] = FormHelper::getInstance()->{$formType}($key, $params); } } elseif (array_key_exists("link", $shema["Link"]) && ($shema["Link"]["link"] == "OneToOne" || $shema["Link"]["link"] == "ManyToOne")) { $classOfKey = ucfirst($shema["Link"]["reference"]) . "Object"; if (class_exists($classOfKey) && property_exists($classOfKey, "isType")) { if (is_array($inputs = $classOfKey::__printFormNew($shema))) { $form[$key] = ""; foreach ($inputs as $input) { $form[$key] .= $input; } } else { $form[$key] = $inputs; } } else { $collection = array(); foreach ($this->_form[$key] as $value) { array_push($collection, array("key" => $value->get("id"), "value" => $value->get("title"))); } $form[$key] = FormHelper::getInstance()->select($key, $collection); } } /*elseif($shema["Link"]["link"]=="OneToMany" || $shema["Link"]["link"]=="ManyToMany") { $collection = array(); foreach ($this->_form[$key] as $value) array_push($collection, array("key" => $value->get("id"), "value" => $value->get("title"))); $form[$key] = FormHelper::getInstance()->select($key."[]", $collection, array("style" => "width: 100%;height: 150px;", "multiple" => true, "class" => "select-multiple")); }*/ } } return $form; }