getInput() public method

public getInput ( $attr = [] )
Ejemplo n.º 1
0
 function getInput($attr = array())
 {
     $this->template->trySet('field_caption', '');
     $this->template->tryDel('label_container');
     $label = '&nbsp;<label for="' . $this->name . '">' . $this->caption . '</label>';
     return parent::getInput(array_merge(array('type' => 'checkbox', 'value' => '1', 'checked' => (bool) ($this->true_value == $this->value)), $attr)) . $label;
 }
Ejemplo n.º 2
0
 function getInput()
 {
     $s = $this->name . '_slider';
     $this->js(true)->_selector('#' . $s)->slider(array('min' => $this->min, 'max' => $this->max, 'value' => $this->js()->val(), 'change' => $this->js()->_enclose()->val($this->js()->_selector('#' . $s)->slider('value'))->change()));
     $this->setProperty('style', 'display: none');
     return '<table width=200 border=0><tr>' . '<td align="left">' . $this->left . '</td>' . '<td align="right">' . $this->right . '</td>' . '</tr><tr><td colspan=2>' . parent::getInput() . '<div id="' . $s . '"></div></td></tr></table>';
 }
Ejemplo n.º 3
0
 function getInput($attr = array())
 {
     $this->template->trySet('field_caption', '');
     $this->template->tryDel('label_container');
     if (strpos('<', $this->caption) !== false) {
         // HTML in label
         $label = $this->caption;
     } else {
         $label = '<label for="' . $this->name . '">' . $this->caption . '</label>';
     }
     return parent::getInput(array_merge(array('type' => 'checkbox', 'value' => '1', 'checked' => (bool) ($this->true_value == $this->value)), $attr)) . $label;
 }
Ejemplo n.º 4
0
 function getInput()
 {
     if ($id = $_GET[$this->name . '_delete_action']) {
         // this won't be called in post unfortunatelly, because ajaxec does not send POST data
         // This is JavaScript upload. We do not want to trigger form submission event
         if ($c = $this->model) {
             try {
                 $c->loadData($id);
                 $c->delete();
                 $this->js()->_selector('[name=' . $this->name . ']')->atk4_uploader('removeFiles', array($id))->execute();
             } catch (Exception $e) {
                 $this->js()->univ()->alert("Could not delete image - " . $e->getMessage())->execute();
             }
             //$this->js(true,$this->js()->_selector('#'.$this->name.'_token')->val(''))->_selectorRegion()->closest('tr')->remove()->execute();
         }
     }
     if ($id = $_GET[$this->name . '_save_action']) {
         // this won't be called in post unfortunatelly, because ajaxec does not send POST data
         // This is JavaScript upload. We do not want to trigger form submission event
         if ($c = $this->model) {
             $c->loadData($id);
             $f = $c;
             $mime = $f->getRef('filestore_type_id')->get('mime_type');
             $path = $f->getPath();
             $name = $f->get("original_filename");
             $len = $f->get("filesize");
             header("Content-type: {$mime}");
             header("Content-legnth: {$len}");
             if ($_GET["redirect"]) {
                 /* it should be possible to use redirect method as well */
                 header("HTTP/1.1 301 Moved Permanently");
                 header("Location: {$path}");
             } else {
                 if (!$_GET['view']) {
                     header("Content-disposition: attachment; filename=\"{$name}\"");
                 }
                 print file_get_contents($path);
             }
             exit;
             $this->js()->_selector('[name=' . $this->name . ']')->atk4_uploader('removeFiles', array($id))->execute();
             //$this->js(true,$this->js()->_selector('#'.$this->name.'_token')->val(''))->_selectorRegion()->closest('tr')->remove()->execute();
         }
     }
     if ($_GET[$this->name . '_upload_action']) {
         $this->uploadComplete();
     }
     $o = '';
     $options = array('size_limit' => $this->max_file_size);
     switch ($this->mode) {
         case 'simple':
             break;
         case 'iframe':
             $options['iframe'] = $this->name . '_iframe';
             break;
         case 'flash':
             $options['flash'] = true;
             break;
     }
     if ($this->multiple) {
         $options['multiple'] = $this->multiple;
     }
     if ($this->mode != 'simple') {
         $options['form'] = $this->owner;
         $this->js(true)->_load('ui.atk4_uploader')->atk4_uploader($options);
     }
     // First - output list of files wi already have uploaded
     $o .= '<div id="' . $this->name . '_files" class="uploaded_files">' . $this->getUploadedFiles() . '</div>';
     $o .= $this->getTag('input', array('type' => 'hidden', 'name' => 'MAX_FILE_SIZE', 'value' => $this->max_file_size));
     $o .= $this->getTag('input', array('type' => 'hidden', 'name' => $this->name . '_token', 'value' => $this->value, 'id' => $this->name . '_token'));
     $o .= parent::getInput();
     return $o;
 }
Ejemplo n.º 5
0
 function getInput($attr = array())
 {
     return parent::getInput(array_merge(array('type' => 'hidden'), $attr));
 }
Ejemplo n.º 6
0
 function getInput($attr = array())
 {
     return parent::getInput(array_merge(array('' => 'textarea'), $attr)) . $this->app->encodeHtmlChars($this->value) . $this->getTag('/textarea');
 }
Ejemplo n.º 7
0
 function getInput($attr = array())
 {
     return parent::getInput(array_merge(array('type' => 'checkbox', 'value' => 'Y', 'checked' => $this->value == 'Y'), $attr));
 }
Ejemplo n.º 8
0
 function getInput($attr = array())
 {
     return parent::getInput(array_merge(array('' => 'textarea'), $attr)) . htmlspecialchars(stripslashes($this->value), ENT_COMPAT, 'ISO-8859-1', false) . $this->getTag('/textarea');
 }
Ejemplo n.º 9
0
Archivo: Upload.php Proyecto: atk4/atk4
 public function getInput()
 {
     if ($id = $_GET[$this->name . '_delete_action']) {
         // this won't be called in post unfortunatelly, because ajaxec does not send POST data
         // This is JavaScript upload. We do not want to trigger form submission event
         if ($c = $this->model) {
             try {
                 $c->tryLoad($id);
                 $c->delete();
                 $this->js()->_selector('[name=' . $this->name . ']')->atk4_uploader('removeFiles', array($id))->execute();
             } catch (BaseException $e) {
                 $this->js()->univ()->alert('Could not delete image - ' . $e->getMessage())->execute();
             }
             //$this->js(true,$this->js()->_selector('#'.$this->name.'_token')->val(''))
             //    ->_selectorRegion()->closest('tr')->remove()->execute();
         }
     }
     if ($id = $_GET[$this->name . '_save_action']) {
         // this won't be called in post unfortunatelly, because ajaxec does not send POST data
         // This is JavaScript upload. We do not want to trigger form submission event
         if ($c = $this->model) {
             $c->tryLoad($id);
             $f = $c;
             $mime = $f->ref($this->getTypeIDFieldName())->get('mime_type');
             $path = $f->getPath();
             $name = $f->get($this->getOriginalFilenameFieldName());
             $len = $f->get($this->getFilesizeFieldName());
             header("Content-type: {$mime}");
             header("Content-legnth: {$len}");
             if ($_GET['redirect']) {
                 /* it should be possible to use redirect method as well */
                 header('HTTP/1.1 301 Moved Permanently');
                 header("Location: {$path}");
             } else {
                 if (!$_GET['view']) {
                     header("Content-disposition: attachment; filename=\"{$name}\"");
                 }
                 echo file_get_contents($path);
             }
             exit;
             /* unreachable code
                $this->js()->_selector('[name='.$this->name.']')->atk4_uploader('removeFiles', array($id))->execute();
                */
             //$this->js(true,$this->js()->_selector('#'.$this->name.'_token')->val(''))
             //    ->_selectorRegion()->closest('tr')->remove()->execute();
         }
     }
     if ($_GET[$this->name . '_upload_action'] && !$_POST) {
         if (!$this->model) {
             $this->uploadFailed('You are not using model with upolad field. ' . 'Please use "isUploaded" and uploadComplete() methods in form submit handler');
         }
         $this->uploadFailed('Webserver settings have blocked this file. Perhaps post_max_size should incleased (' . $_SERVER['CONTENT_LENGTH'] . ' sent, ' . ini_get('post_max_size') . ' max)(post: ' . json_encode($_POST) . ', get: ' . json_encode($_GET) . ')');
     }
     $o = '';
     $options = array('size_limit' => $this->max_file_size);
     switch ($this->mode) {
         case 'simple':
             break;
         case 'iframe':
             $options['iframe'] = $this->name . '_iframe';
             break;
         case 'flash':
             $options['flash'] = true;
             break;
     }
     if (is_numeric($this->multiple)) {
         $options['multiple'] = $this->multiple;
     }
     if ($this->mode != 'simple') {
         $options['form'] = $this->owner;
         $this->js(true)->_load('ui.atk4_uploader')->atk4_uploader($options);
     }
     // First - output list of files wi already have uploaded
     $o .= '<div id="' . $this->name . '_files" class="uploaded_files">' . $this->getUploadedFiles() . '</div>';
     $o .= $this->getTag('input', array('type' => 'hidden', 'name' => 'MAX_FILE_SIZE', 'value' => $this->max_file_size));
     $o .= $this->getTag('input', array('type' => 'hidden', 'name' => $this->name . '_token', 'value' => $this->value, 'id' => $this->name . '_token'));
     $o .= parent::getInput();
     return $o;
 }
Ejemplo n.º 10
0
Archivo: Search.php Proyecto: atk4/atk4
 public function getInput($attr = array())
 {
     return parent::getInput(array_merge(array('type' => 'search'), $attr));
 }
Ejemplo n.º 11
0
 function getInput()
 {
     $f_id = $this->name . '_f';
     $this->js(true)->_selector('#' . $f_id)->atk4_blueimp_uploader(array('progressbar' => $this->progressbar, 'input' => $this, 'fieldname' => $this->short_name));
     return parent::getInput() . $this->getTag('input', array('type' => 'file', 'name' => $this->name . '_f', 'id' => $this->name . '_f'));
 }
Ejemplo n.º 12
0
 function getInput($attr = array())
 {
     return parent::getInput(array_merge(array('type' => 'text', 'value' => date($this->api->getConfig('locale/time', 'H:i:s'), strtotime($this->value))), $attr));
 }