Beispiel #1
1
 /**
  * @param $name
  * @param Set $set
  * @param \RedBean_SimpleModel $bean
  */
 public function __construct($name, Set $set = null, $bean = null)
 {
     $this->name = $name;
     $this->cleanName = Utility::cleanFieldName($name);
     $this->set = $set;
     $this->bean = $bean;
     if ($bean !== null) {
         $this->prerequisite = $bean->prerequisite;
     }
 }
Beispiel #2
-1
 public function getBean()
 {
     if ($this->bean !== null) {
         return $this->bean;
     }
     $bean = R::findOne('skemaset', ' name = ? ', [$this->name]);
     if (empty($bean)) {
         $bean = R::dispense('skemaset');
         $bean->name = $this->name;
         $bean->cleanName = Utility::cleanTableName($this->name);
         $bean->created = R::isoDateTime();
         $bean->description = '';
         $bean->ownFieldList;
         $bean->{'ownSkemarecord' . $this->cleanBaseName . 'List'};
     }
     return $this->bean = $bean;
 }
Beispiel #3
-1
 public function renderHTMLInput()
 {
     $template = $this->field->htmlInputTemplate;
     $options = '';
     $this->field->eachOption(function ($directives, $recordID) use(&$options, $template) {
         $optionText = Utility::mustachify($template, function ($match) use($directives, $recordID) {
             if (isset($directives[$match])) {
                 return Type::Directive($directives[$match])->renderPlain();
             } else {
                 if ($match === 'key') {
                     return $recordID;
                 }
             }
             return '';
         });
         $optionTextEncoded = htmlentities($optionText);
         $selected = $this->value == $recordID ? ' selected="selected"' : '';
         $options .= "<option value='{$recordID}'{$selected}>{$optionTextEncoded}</option>";
     });
     $key = $this->key();
     return "<select name='{$key}'>{$options}</select>";
 }