Esempio n. 1
0
 public function initialize()
 {
     parent::initialize();
     $form = Loader::helper('form');
     $this->fieldAttrs = array('rows' => "10", "cols" => "50", "style" => "width:auto;");
     $this->field = $form->textarea($this->getDisplayFieldName(), $this->default, $this->fieldAttrs);
 }
 public function initialize()
 {
     parent::initialize();
     if (is_string($this->values)) {
         if (class_exists(ucfirst($this->values))) {
             $className = $this->values;
             $provider = new $className();
             $this->values = $provider->getValues();
         } else {
             $values = array();
             foreach (split(' ', $this->values) as $value) {
                 list($key, $val) = split('\\|', $value);
                 $values[$key] = $val;
             }
             $this->values = $values;
         }
     } elseif (!is_array($this->values)) {
         $this->values = array('0' => '- Select -');
     }
     $form = Loader::helper('form');
     $this->field = '';
     $curValues = split(',', $this->default);
     foreach ($this->values as $key => $val) {
         $this->field .= '<div>' . $form->checkbox($this->getDisplayFieldName() . '[]', $key, in_array($key, $curValues), array("id" => $this->getDisplayFieldName())) . '<span for="Added">&nbsp;&nbsp;' . $val . '</span></div>';
     }
 }
Esempio n. 3
0
 public function initialize()
 {
     parent::initialize();
     $this->fieldAttrs['class'] .= ' ccm-advanced-editor';
     $form = Loader::helper('form');
     $this->field = $template = file_get_contents(dirname(__FILE__) . '/../../../assets/templates/editor_controls.html');
     $this->field .= $form->textarea($this->getDisplayFieldName(), $this->default, $this->fieldAttrs);
     if (!$_GLOBALS['mce_conf']) {
         Loader::element('editor_init');
         Loader::element('editor_config', array('editor_mode' => 'ADVANCED'));
         $_GLOBALS['mce_conf'] = 1;
     }
 }
 public function initialize()
 {
     parent::initialize();
     $form = Loader::helper('form');
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         $this->default = $_POST[$this->getDisplayFieldName()];
     }
     if (!is_string($this->default)) {
         $this->default = serialize($this->default);
     }
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         $_POST[$this->getDisplayFieldName()] = $this->default;
     }
     $this->field = t('<b>%s</b>', $this->default);
 }
Esempio n. 5
0
 public function initialize()
 {
     parent::initialize();
     $this->template = "{{{field}}}";
     $form = Loader::helper('form');
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         $this->default = $_POST[$this->getDisplayFieldName()];
     }
     if (!is_string($this->default)) {
         $this->default = serialize($this->default);
     }
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         $_POST[$this->getDisplayFieldName()] = $this->default;
     }
     $this->field = $form->hidden($this->getDisplayFieldName(), $this->default);
 }
 public function initialize()
 {
     parent::initialize();
     if ($this->model != NULL) {
         $relationModel = new $this->model();
         $values = $relationModel->getDistinctRows($this->filter, $this->requiredArgs);
         if (is_null($values)) {
             $values = array();
         }
         OJUtil::array_unshift_assoc($values, '0', '- Select -');
         $form = Loader::helper('form');
         $this->field = $form->select($this->getDisplayFieldName(), $values, $this->default, $this->fieldAttrs);
     } else {
         $this->field = "Model Name not defined properly for the model-drop-down field";
     }
 }
Esempio n. 7
0
 public static function getFieldValue(&$args, $field, $prefix, &$extra = null)
 {
     $key = $prefix . $field['name'];
     if (!$extra['upload_dir']) {
         $extra['upload_dir'] = DIR_REL . "/files/";
     }
     $extra['upload_dir'] = $_SERVER['DOCUMENT_ROOT'] . $extra['upload_dir'];
     if ($_FILES[$key]['name'] != '') {
         $fileName = date('YmdHis') . $_FILES[$key]['name'];
         move_uploaded_file($_FILES[$key]['tmp_name'], $extra['upload_dir'] . $fileName);
         $retval = array();
         $retval[$field['name']] = $fileName;
         return $retval;
     }
     return parent::getFieldValue($args, $field . '-prev', $prefix, $extra);
 }
 public function initialize()
 {
     parent::initialize();
     if ($this->model != NULL) {
         $model = new $this->model();
         $rows = $model->getDistinctRowsFor($this->column, $this->filter);
         $values = array();
         foreach ($rows as $row) {
             $values[$row] = $row;
         }
         $this->values = array_merge(array('0' => '- Select -'), $values);
         $form = Loader::helper('form');
         $this->field = $form->select($this->getDisplayFieldName(), $this->values, $this->default, $this->fieldAttrs);
     } else {
         $this->field = "Model Name not defined properly for the model-drop-down field";
     }
 }
Esempio n. 9
0
 public function initialize()
 {
     parent::initialize();
     if (is_string($this->values)) {
         if (class_exists(ucfirst($this->values))) {
             $className = $this->values;
             $provider = new $className();
             $this->values = $provider->getValues();
         } else {
             $values = array();
             foreach (split(' ', $this->values) as $value) {
                 list($key, $val) = split('\\|', $value);
                 $values[$key] = $val;
             }
             $this->values = $values;
         }
     } elseif (!is_array($this->values)) {
         $this->values = array('0' => '- Select -');
     }
     $form = Loader::helper('form');
     $this->field = $form->select($this->getDisplayFieldName(), $this->values, $this->default, $this->fieldAttrs);
 }
Esempio n. 10
0
 public function initialize()
 {
     parent::initialize();
     $pageSelector = Loader::helper('form/page_selector');
     $this->field = '<div id="' . $this->getDisplayFieldName() . '">' . $pageSelector->selectPage($this->getDisplayFieldName(), $this->default) . '</div>';
 }
Esempio n. 11
0
 public function initialize()
 {
     parent::initialize();
     $form = Loader::helper('form');
     $this->field = $form->checkbox($this->getDisplayFieldName(), 1, $this->default == 1, $this->fieldAttrs);
 }
Esempio n. 12
0
 public function initialize()
 {
     parent::initialize();
     $ast = Loader::helper('concrete/asset_library');
     $this->field = $ast->image($this->getDisplayFieldName(), $this->getDisplayFieldName(), $this->label, $this->default ? File::getByID($this->default) : null);
 }
Esempio n. 13
0
 public function initialize()
 {
     parent::initialize();
     $dtt = Loader::helper('form/date_time');
     $this->field = $dtt->date($this->getDisplayFieldName(), $this->default, true, $this->fieldAttrs);
 }
Esempio n. 14
0
 public function initialize()
 {
     parent::initialize();
     $form = Loader::helper('form');
     $this->field = $form->hidden($this->getDisplayFieldName(), $this->default) . t('<b>%s</b>', $this->default);
 }
Esempio n. 15
0
 public function initialize()
 {
     parent::initialize();
     $uh = Loader::helper('form/user_selector');
     $this->field = $uh->selectUser($this->getDisplayFieldName(), $this->default);
 }
Esempio n. 16
0
 public function initialize()
 {
     parent::initialize();
     $form = Loader::helper('form');
     $this->field = $form->password($this->getDisplayFieldName(), $this->default, $this->fieldAttrs);
 }