public function html($obj)
 {
     $url = CRUDCompiler::compile($this->getLink(), ['this' => $obj]);
     $html = CRUDCompiler::compile($this->getHtml(), ['this' => $obj]);
     if (trim($html) == '') {
         $html = '#EMPTY#';
     }
     return HTML::tag('a', ['href' => $url, 'class' => $this->getClassesStr()], $html);
 }
 /**
  * Returns sanitized content.
  * @param $obj
  * @return string
  */
 public function html($obj)
 {
     $value = CRUDCompiler::compile($this->getValue(), ['this' => $obj]);
     $html = "UNDEFINED";
     $options_arr = $this->getOptionsArr();
     if (array_key_exists($value, $options_arr)) {
         $html = $options_arr[$value];
     }
     return Sanitize::sanitizeTagContent($html);
 }
 public function html($obj)
 {
     $url = CRUDCompiler::compile($this->getLink(), ['this' => $obj]);
     $text = CRUDCompiler::compile($this->getText(), ['this' => $obj]);
     if (trim($text) == '') {
         $text = '#EMPTY#';
     }
     $o = BT::a($url, $text, $this->getClassesStr());
     return $o;
 }
Example #4
0
 /**
  * @param $obj InterfaceWeight
  * @return string
  */
 public function html($obj)
 {
     Assert::assert($obj);
     $o = '';
     $o .= '<form style="display: inline;" method="post" action="' . \OLOG\Url::getCurrentUrl() . '">';
     $o .= Operations::operationCodeHiddenField(CRUDTable::OPERATION_SWAP_MODEL_WEIGHT);
     $o .= '<input type="hidden" name="' . self::FORMFIELD_CONTEXT_FIELDS_NAME . '" value="' . Sanitize::sanitizeAttrValue(implode(',', array_keys($this->context_fields_arr))) . '">';
     foreach ($this->context_fields_arr as $context_field_name => $context_field_value) {
         $context_field_value = CRUDCompiler::compile($context_field_value, ['this' => $obj]);
         $o .= NullablePostFields::hiddenFieldHtml($context_field_name, $context_field_value);
     }
     $o .= '<input type="hidden" name="_class_name" value="' . Sanitize::sanitizeAttrValue(get_class($obj)) . '">';
     $o .= '<input type="hidden" name="_id" value="' . Sanitize::sanitizeAttrValue(CRUDFieldsAccess::getObjId($obj)) . '">';
     $o .= '<button class="' . $this->button_class_str . '" type="submit">' . $this->button_text . '</button>';
     $o .= '</form>';
     return $o;
 }
Example #5
0
 protected static function saveEditorFormOperation($url_to_redirect_after_save = '', $redirect_get_params_arr = [])
 {
     $model_class_name = POSTAccess::getRequiredPostValue(self::FIELD_CLASS_NAME);
     $object_id = self::saveOrUpdateObjectFromFormData();
     if ($url_to_redirect_after_save != '') {
         $obj = CRUDObjectLoader::createAndLoadObject($model_class_name, $object_id);
         $redirect_url = $url_to_redirect_after_save;
         $redirect_url = CRUDCompiler::compile($redirect_url, ['this' => $obj]);
         $params_arr = [];
         foreach ($redirect_get_params_arr as $param => $value) {
             $params_arr[$param] = CRUDCompiler::compile($value, ['this' => $obj]);
         }
         if (!empty($redirect_get_params_arr)) {
             $redirect_url = $url_to_redirect_after_save . '?' . http_build_query($params_arr);
         }
         \OLOG\Redirects::redirect($redirect_url);
     }
     // keep get form
     \OLOG\Redirects::redirectToSelf();
 }
 /**
  * Returns sanitized content.
  * @param $obj
  * @return mixed
  */
 public function html($obj)
 {
     $timestamp = CRUDCompiler::compile($this->getTimestamp(), ['this' => $obj]);
     $date = date($this->getFormat(), $timestamp);
     return Sanitize::sanitizeTagContent($date);
 }
Example #7
0
 /**
  * Returns sanitized content.
  * @param $obj
  * @return mixed
  */
 public function html($obj)
 {
     $html = CRUDCompiler::compile($this->getText(), ['this' => $obj]);
     return Sanitize::sanitizeTagContent($html);
 }