IncludeScript("/cms/components/Forms/js/redactor3/plugins/alignment/alignment.min.js"); $PAGE->IncludeScript("/cms/components/Forms/js/redactor3/plugins/properties/properties.min.js"); $PAGE->IncludeScript("/cms/components/Forms/js/redactor3/plugins/specialchars/specialchars.min.js"); $PAGE->IncludeScript("/cms/components/Forms/js/redactor3/plugins/table/table.min.js"); $PAGE->IncludeScript("/cms/components/Forms/js/redactor3/plugins/video/video.min.js"); $PAGE->IncludeScript("/cms/components/Forms/js/redactor3/plugins/imagemanager/imagemanager.min.js"); $PAGE->IncludeScript("/cms/components/Forms/js/redactor3/plugins/widget/widget.min.js"); $PAGE->IncludeScript("/cms/components/Forms/index.js"); $PAGE->IncludeStyle("/cms/components/Forms/style.css"); //$PAGE->IncludeStyle("/cms/components/Forms/js/redactor/css/docstyle.css"); $PAGE->IncludeStyle("/cms/components/Forms/js/redactor3/redactor.css"); $PAGE->IncludeStyle("/cms/components/Forms/js/jcrop/jcrop.css"); $PAGE->IncludeStyle("/cms/components/Forms/js/dialogs/dialogs.css"); } class CForm { protected $action = "/cms/components/Forms/php/ajax.php?action=Edit"; protected $method = "post"; protected $class = ""; protected $deleteFunction = "__forms_DeleteFunction()"; protected $name = ""; protected $id = ""; protected $isUserForm = false; protected $object; function __construct($_object, $_action = null, $_method = null, $_name = null, $_id = null) { $this->object = $_object; if(!is_null($_action)) { $this->action = $_action; $this->isUserForm = true; } if(!is_null($_method)) $this->method = $_method; if(!is_null($_name)) $this->name = $_name; if(!is_null($_formId)) $this->id = $_id; else $this->formId = "forms__".date("dmY").rand(1000000, 9999999); if($this->formName == "") $this->id = $this->id; } function __get($field) { switch($field) { case "Object": return $this->object; break; case "Action": return $this->action; break; case "Method": return $this->method; break; case "FormName": return $this->name; break; case "FormId": return $this->id; break; case "Class": return $this->class; break; } } function __set($field, $value) { switch($field) { case "Action": $this->action = $value; $this->isUserForm = true; break; case "Method": $this->method = $value; break; case "FormName": $this->name = $value; break; case "FormId": $this->id = $value; break; case "Class": $this->class = $value; break; } } function Header() { global $USER; if($USER->IsAdmin()) { $html = '
class.'" id="'.$this->id.'" name="'.$this->name.'" method="'.$this->method.'" action="'.$this->action.'"> '; if($this->object->Id) $html .= ''; if(get_class($this->object) == "CTableElement") $html .= ''; echo $html; } } function Footer() { global $USER; if($USER->IsAdmin()) echo "
"; } function Editor($param, $options = []) { global $USER; $text = $this->object->Value($param); $property = $this->object->Property($param); if($text == "") $text = $property["defaultValue"]; $tabIndex = ""; if(array_key_exists("TabIndex", $options)) $tabIndex = " tabindex=\"".$options["TabIndex"]."\""; $validate = ""; if(!$property["isNullable"] || $options["Validate"]) $validate = " ui-validate"; if(array_key_exists("Name", $options)) $param = $options["Name"]; if($USER->IsAdmin()) { echo '
'.$text.'
'; } else echo $text; //if($USER->IsAdmin()) { // echo '
'; //} else echo $text; } function BigEditor($param, $options = []) { global $USER; $text = $this->object->Value($param); $property = $this->object->Property($param); if($text == "") $text = $property["defaultValue"]; $tabIndex = ""; if(array_key_exists("TabIndex", $options)) $tabIndex = " tabindex=\"".$options["TabIndex"]."\""; $validate = ""; if(!$property["isNullable"] || $options["Validate"]) $validate = " ui-validate"; if(array_key_exists("Name", $options)) $param = $options["Name"]; if($USER->IsAdmin()) { echo '
'.$text.'
'; } else { echo ContentWithSupportItems($text); } //if($USER->IsAdmin()) { // echo '
'; //} else echo $text; } function Text($param, $options = []) { global $USER; $text = $this->object->Value($param); $property = $this->object->Property($param); if($text == "") $text = $property["defaultValue"]; if(array_key_exists("Name", $options)) $param = $options["Name"]; $height = ""; if(array_key_exists("Height", $options)) $height = "height:" . $options["Height"]; $style = ""; if(array_key_exists("Style", $options)) $style = " style=\"".$options["Style"]."\""; $class = ""; if(array_key_exists("Class", $options)) $class = " class=\"" . $options["Class"] . "\""; $tabIndex = ""; if(array_key_exists("TabIndex", $options)) $tabIndex = " tabindex=\"".$options["TabIndex"]."\""; $placeholder = ""; if(array_key_exists("Placeholder", $options)) $placeholder = " placeholder=\"" . $options["Placeholder"] . "\""; $validate = ""; if(!$property["isNullable"]) $validate = " ui-validate"; if($USER->IsAdmin()) { echo '
'; } else echo $text; } function Link($param) { global $USER; $text = $this->object->Value($param); $property = $this->object->Property($param); if($text == "") $text = $property["defaultValue"]; if(array_key_exists("Name", $options)) $param = $options["Name"]; if($USER->IsAdmin()) { echo '
'; } else echo $text; } function Input($param, $options = array()) { global $USER; $property = $this->object->Property($param); if($property != false) $value = $this->object->Value($param); if($value == "") { if(array_key_exists("DefaultValue", $options)) $value = $options["DefaultValue"]; else if($property != false) $value = $property["defaultValue"]; } if(array_key_exists("Name", $options)) $param = $options["Name"]; if(array_key_exists("Value", $options)) $value = $options["Value"]; $class = ""; if(array_key_exists("Class", $options)) $class = " class=\"" . $options["Class"] . "\""; $style = ""; if(array_key_exists("Style", $options)) $style = " style=\"" . $options["Style"] . "\""; $placeholder = ""; if(array_key_exists("Placeholder", $options)) $placeholder = " placeholder=\"" . $options["Placeholder"] . "\""; $validate = ""; if(!$property["isNullable"] || $options["Validate"]) $validate = " ui-validate"; $readonly = ""; $readonlyClass = ""; if(array_key_exists("Readonly", $options) && $options["Readonly"]) { $readonly = " readonly=\"readonly\""; $readonlyClass = " ui-readonly"; } $tabIndex = ""; if(array_key_exists("TabIndex", $options)) $tabIndex = " tabindex=\"".$options["TabIndex"]."\""; $options = '
'; if($USER->IsAdmin()) { echo '
'.$options.'
'; } else echo $value; } function Hidden($param, $options = array()) { global $USER; $property = $this->object->Property($param); if($property != false) $value = $this->object->Value($param); if(is_object($value)) $value = $value->Id; if($value == "") { if(array_key_exists("DefaultValue", $options)) $value = $options["DefaultValue"]; else if($property != false) $value = $property["defaultValue"]; } if(array_key_exists("Value", $options)) $value = $options["Value"]; $class = ""; if(array_key_exists("Class", $options)) $class = " class=\"" . $options["Class"] . "\""; echo '
'; } function Select($param = false, $options = []) { global $USER; global $SITE; $property = $this->object->Property($param); $value = ""; if($property != false) $value = $this->object->Value($param); if(is_object($value)) $value = $value->Id; if($value == "") { if(array_key_exists("DefaultValue", $options)) $value = $options["DefaultValue"]; else if($property != false) $value = $property["defaultValue"]; } $id = ""; if(array_key_exists("Id", $options)) $id = " id=\"" . $options["Id"] . "\""; if(array_key_exists("Name", $options)) $param = $options["Name"]; $class = ""; if(array_key_exists("Class", $options)) $class = " class=\"" . $options["Class"] . "\""; $style = ""; if(array_key_exists("Style", $options)) $style = " style=\"" . $options["Style"] . "\""; $where = null; if(array_key_exists("Where", $options)) $where = $options["Where"]; $validate = ""; if(!$property["isNullable"] || $options["Validate"]) $validate = " ui-validate"; $addButton = ""; if(array_key_exists("AddButton", $options)) { $addButton = ''; } $tabIndex = ""; $tabIndexNum = "0"; if(array_key_exists("TabIndex", $options)) { $tabIndex = " tabindex=\"".$options["TabIndex"]."\""; $tabIndexNum = $options["TabIndex"]; } $valueText = ""; if($USER->IsAdmin()) { $items = ""; $itemsLi = ""; if($options["UserOptionsPlacement"] != "Replace" && $property != false) { switch($property["type"]) { case "enum": foreach($property["enumValues"] as $enumValue) { if($enumValue == $value) { $items .= ''; $itemsLi .= '
  • '.$enumValue.'
  • '; $valueText = $value; } else { $items .= ''; $itemsLi .= '
  • '.$enumValue.'
  • '; } } break; case "CUser": $result = $SITE->Users->GetList($where); foreach($result as $item) { if($value == $item->Id) { $items .= ''; $itemsLi .= '
  • '.$item->Name.'
  • '; $valueText = $item->Name; } else { $items .= ''; $itemsLi .= '
  • '.$item->Name.'
  • '; } } break; case "CTableElement": $result = $SITE->Table($property["referencedTable"])->GetList($where); foreach($result as $item) { if($value == $item->Id) { $items .= ''; $itemsLi .= '
  • '.$item->Name.'
  • '; $valueText = $item->Name; } else { $items .= ''; $itemsLi .= '
  • '.$item->Name.'
  • '; } } break; } } $searchMode = ""; if(array_key_exists("Mode", $options) && $options["Mode"] == "Search") $searchMode = " ui-select-search-mode"; if(array_key_exists("UserOptions", $options) && is_array($options["UserOptions"])) { $userOptions = ""; $userOptionsLi = ""; foreach($options["UserOptions"] as $key => $val) { if($value == $key) { $userOptions .= ''; if(is_array($val)) { $userOptionsLi .= '
  • '.$val["Value"].'
  • '; $valueText = $val["Value"]; } else { $userOptionsLi .= '
  • '.$val.'
  • '; $valueText = $val; } } else { $userOptions .= ''; if(is_array($val)) $userOptionsLi .= '
  • '.$val["Value"].'
  • '; else $userOptionsLi .= '
  • '.$val.'
  • '; } } if(array_key_exists("UserOptionsPlacement", $options)) { switch($options["UserOptionsPlacement"]) { case "Replace": $items = $userOptions; $itemsLi = $userOptionsLi; break; case "After": $items .= $userOptions; $itemsLi .= $userOptionsLi; break; case "Before": $items = $userOptions . $items; $itemsLi = $userOptionsLi . $itemsLi; break; } } else { $items .= $userOptions; //default: After $itemsLi .= $userOptionsLi; //default: After } } echo '
    '.$valueText.'
    '; } else echo $text; } function Radio($param, $defaultValue = "") { } function Date($param, $options = array()) { global $USER; $property = $this->object->Property($param); if($property != false) $text = $this->object->Value($param); if($text == "") { if(array_key_exists("DefaultValue", $options)) $text = $options["DefaultValue"]; else if($property != false) $text = $property["defaultValue"]; } if($text != "") $text = date("d M Y", strtotime(str_replace("/", ".", $text))); if($text == "01 Jan 1970") $text = ""; // ;) if(array_key_exists("Name", $options)) $param = $options["Name"]; $style = ""; if(array_key_exists("Style", $options)) $style = " style=\"".$options["Style"]."\""; $class = ""; if(array_key_exists("Class", $options)) $class = " " . $options["Class"]; $validate = ""; if(!$property["isNullable"] || $options["Validate"]) $validate = " ui-validate"; $tabIndex = ""; if(array_key_exists("TabIndex", $options)) $tabIndex = " tabindex=\"".$options["TabIndex"]."\""; if($USER->IsAdmin()) { echo '
    '; } else echo $text; } function Image($param, $options = null) { global $USER; $image = $this->object->Value($param); if(!array_key_exists("width", $options)) $options["width"] = "auto"; if(!array_key_exists("height", $options)) $options["height"] = "auto"; if(!array_key_exists("uploadFormats", $options)) $options["uploadFormats"] = "jpg,png,gif"; if(!array_key_exists("uploadMaxFileSize", $options)) $options["uploadMaxFileSize"] = 2048; if(!array_key_exists("crop", $options)) $options["crop"] = true; if(!array_key_exists("cropAspectRatio", $options)) $options["cropAspectRatio"] = ""; if(!array_key_exists("cropScale", $options)) $options["cropScale"] = 1.0; if(array_key_exists("DefaultValue", $options) && !$image->Id) $image = $options["DefaultValue"]; $css = 'style="width:' . $options["width"] . ';height:' . $options["height"] . '"'; $tempId = "__forms-image-".date("dmY").rand(1000000, 9999999); $cropWidth = 0; $cropHeight = 0; if($options["cropAspectRatio"] != "") { $arr = explode("/", $options["cropAspectRatio"]); $cropWidth = $arr[0]; $cropHeight = $arr[1]; } $uploadTextHTML = ""; if($options["uploadText"] != "") $uploadTextHTML = '
    '.$options["uploadText"].'
    '; if($USER->IsAdmin()) { echo '
    '.$uploadTextHTML.'
    ' . ((is_object($this->object) && is_object($image)) ? '' : '') . '
    '; } else echo (is_object($this->object) && is_object($image)) ? ''.$image->Alt.'' : ''; } function Calc($param, $options = array()) { global $USER; $text = $this->object->Value($param); $property = $this->object->Property($param); if($text == "") { if(array_key_exists("DefaultValue", $options)) $text = $options["DefaultValue"]; else $text = $property["defaultValue"]; } if(array_key_exists("Name", $options)) $param = $options["Name"]; $class = ""; if(array_key_exists("Class", $options)) $class = " class=\"" . $options["Class"] . "\""; $style = ""; if(array_key_exists("Style", $options)) $style = " style=\"" . $options["Style"] . "\""; $tabIndex = ""; if(array_key_exists("TabIndex", $options)) $tabIndex = " tabindex=\"".$options["TabIndex"]."\""; if($USER->IsAdmin()) { echo '
    '; } else echo $text; } function SubmitButton() { global $USER; if($USER->IsAdmin()) { echo ''; } } function DeleteButton() { global $USER; if($USER->IsAdmin()) { echo ''; } } }?>
    Fatal error: Uncaught Error: Class 'CForm' not found in /home/avers.com.au/www/cms/core/api/CPage.class.php(20) : eval()'d code:1 Stack trace: #0 /home/avers.com.au/www/cms/core/api/CPage.class.php(20): eval() #1 /home/avers.com.au/www/index.php(24): CPage->HTML() #2 {main} thrown in /home/avers.com.au/www/cms/core/api/CPage.class.php(20) : eval()'d code on line 1