本文整理汇总了PHP中HTMLForm::setTextarea方法的典型用法代码示例。如果您正苦于以下问题:PHP HTMLForm::setTextarea方法的具体用法?PHP HTMLForm::setTextarea怎么用?PHP HTMLForm::setTextarea使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLForm
的用法示例。
在下文中一共展示了HTMLForm::setTextarea方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderForm
public function renderForm()
{
$form = new HTMLForm();
$hsid = isset($_GET['hsid']) ? (int) $_GET['hsid'] : 0;
$data = $this->getDataHtmlSnippet($hsid);
$form->open('editsnippet', '', 'POST');
$form->setInput('hsname')->setRules('regexp[#[a-z\\-_0-9]{3,15}#i]')->setErrorText('Имя сниппета может содержать след. символы: a-z_-0-9 от 3 до 15 символов')->setAttr('class|form-control input-lg')->setAttr(isset($data['hsname']) ? 'value|' . $data['hsname'] : '')->addInput();
$form->setTextarea('hsdescription')->setRules('trim|notempty')->setErrorText('Введите описание снипета')->setAttr('class|desc form-control')->setText(isset($data['hsdescription']) ? $data['hsdescription'] : '')->addTextarea();
$form->setTextarea('code')->setRules('trim|notempty')->setErrorText('Введите код снипета')->setAttr('class|preview_desc form-control')->setAttr('id|content')->setText(isset($data['code']) ? $data['code'] : '')->addTextarea();
$form->setInput('editsnippet')->setAttr('type|submit')->setAttr('class|btn btn-primary btn-lg addpage')->setAttr('value|Сохранить')->addInput();
$formEditSnippet = $form->close();
Bufer::add(array('formEditSnippet' => $formEditSnippet));
/**
* Провервка отправленной формы
*/
if (!$form->sendForm('editsnippet')) {
$errors = $form->getErrors();
Bufer::add(array('errors' => $errors));
} else {
$data = $form->getData();
$data = array('hsid' => $hsid = isset($_GET['hsid']) ? (int) $_GET['hsid'] : 0, 'hsname' => $this->model->escape($data['hsname']), 'hsdescription' => $this->model->escape($data['hsdescription']), 'code' => $this->model->escape($data['code']));
$checkHsname = $this->model->checkHsname($data);
if (!isset($checkHsname['error'])) {
$result = $this->saveSnippet($data);
if ($result['success'] === false) {
Bufer::add(array('errors' => $result['error']));
} else {
Route::go('?mode=admin&route=edithtmlsnippets&hsid=' . $data['hsid']);
}
} else {
Bufer::add(array('errors' => $checkHsname['error']));
}
}
}
示例2: renderForm
public function renderForm()
{
$form = new HTMLForm();
$form->open('addsnippet', '', 'POST');
$form->setInput('hsname')->setRules('regexp[#[a-z\\-_0-9]{3,15}#i]')->setErrorText('Имя сниппета может содержать след. символы: a-z_-0-9 от 3 до 15 символов')->setAttr('class|form-control input-lg')->setAttr(isset($_POST['hsname']) ? 'value|' . $_POST['hsname'] : '')->addInput();
$form->setTextarea('hsdescription')->setRules('trim|notempty')->setErrorText('Введите описание снипета')->setAttr('class|desc form-control')->setText(isset($_POST['hsdescription']) ? $_POST['hsdescription'] : '')->addTextarea();
$form->setTextarea('hscode')->setRules('trim|notempty')->setErrorText('Введите код снипета')->setAttr('class|preview desc form-control')->setAttr('id|content')->setText(isset($_POST['hscode']) ? $_POST['hscode'] : '')->addTextarea();
$form->setInput('addsnippet')->setAttr('type|submit')->setAttr('class|btn btn-primary btn-lg addpage')->setAttr('value|Создать')->addInput();
$formAddSnippet = $form->close();
Bufer::add(array('formAddSnippet' => $formAddSnippet));
/**
* Провервка отправленной формы
*/
if (!$form->sendForm('addsnippet')) {
$errors = $form->getErrors();
Bufer::add(array('errors' => $errors));
} else {
$data = $form->getData();
$data = array('hsname' => $this->model->escape($data['hsname']), 'hsdescription' => $this->model->escape($data['hsdescription']), 'hscode' => $this->model->escape($data['hscode']));
$checkHsname = $this->model->checkHsname($data);
if (!isset($checkHsname['error'])) {
$this->addSnippet($data);
} else {
Bufer::add(array('errors' => $checkHsname['error']));
}
}
}
示例3: renderForm
public function renderForm()
{
$model = $this->model;
$pid = isset($_GET['pid']) ? (int) $_GET['pid'] : 0;
$pageData = $this->getPage($pid);
if (isset($pageData['errors'])) {
Bufer::set(array('errors' => $pageData['errors']));
} else {
Bufer::set(array('pageData' => $pageData['pageData']));
}
$errors = isset($pageData['errors']) ? $pageData['errors'] : false;
$dataPage = isset($pageData['pageData'][0]) ? $pageData['pageData'][0] : false;
$getSections = $model->returnData("select * from section");
$form = new HTMLForm();
$form->open('addpage', '', 'POST');
$form->setInput('title')->setAttr('type|text')->setAttr('onkeyup|document.getElementById(\'child\').value=translit(this.value)')->setAttr(isset($dataPage['title']) ? 'value|' . $dataPage['title'] : '')->setRules('notempty|trim')->setErrorText('Введите Title страницы')->setAttr('class|form-control input-lg')->addInput();
$form->setInput('pid')->setAttr('type|hidden')->setAttr('value|' . $pid)->setRules('notempty')->addInput();
$form->setInput('description')->setAttr('type|text')->setAttr(isset($dataPage['description']) ? 'value|' . $dataPage['description'] : '')->setRules('notempty')->setErrorText('Введите описание для страницы')->setAttr('class|form-control input-lg')->addInput();
$form->setInput('keywords')->setAttr('type|text')->setAttr(isset($dataPage['keywords']) ? 'value|' . $dataPage['keywords'] : '')->setRules('notempty')->setErrorText('Введите ключевые слова для страницы')->setAttr('class|form-control input-lg')->addInput();
$form->setInput('index')->setAttr('type|text')->setAttr('id|child')->setAttr(isset($dataPage['name']) ? 'value|' . $dataPage['name'] : '')->setRules('notempty')->setErrorText('Введите псевдоним страницы')->setAttr('class|form-control input-lg')->addInput();
$form->setSelect('section')->setAttr('class|form-control')->setAttr('style|width:300px')->setRules('notempty')->addSelect();
foreach ($getSections as $s) {
$form->setOption($s['sname'] . ' (' . $s['sindex'] . ')')->setAttr('value|' . $s['sid'])->setAttr(isset($dataPage['sid']) && $dataPage['sid'] == $s['sid'] ? 'selected|selected' : '')->addOption('section');
}
$form->setSelect('display')->setAttr('class|form-control')->setAttr('style|width:300px')->setRules('notempty')->addSelect();
$display = array(1 => 'да', 2 => 'нет', 3 => 'только для администрации');
foreach ($display as $k => $v) {
$form->setOption($v)->setAttr('value|' . $k)->setAttr(isset($dataPage['display']) && $dataPage['display'] == $k ? 'selected|selected' : '')->addOption('display');
}
$form->setTextarea('preview')->setAttr('id|preview')->setText(isset($dataPage['preview']) ? $dataPage['preview'] : '')->setAttr('class|preview form-control')->setRules('trim')->addTextarea();
$form->setTextarea('content')->setAttr('id|content')->setText(isset($dataPage['content']) ? $dataPage['content'] : '')->setAttr('class|addpage form-control content')->setRules('notempty')->addTextarea();
$form->setInput('editpage')->setAttr('type|submit')->setAttr('class|btn btn-primary btn-lg addpage')->setAttr('value|Сохранить')->addInput();
$formEditpage = $form->close();
Bufer::set(array('errors' => $errors, 'formEditpage' => $formEditpage, 'titlePage' => isset($dataPage['title']) ? $dataPage['title'] : ''));
/**
* Провервка отправленной формы
*/
if (!$form->sendForm('editpage')) {
$errors = $form->getErrors();
Bufer::set(array('errors' => $errors, 'formEditpage' => $formEditpage, 'titlePage' => isset($dataPage['title']) ? $dataPage['title'] : ''));
} else {
$data = $form->getData();
$data = array('pid' => (int) $data['pid'], 'title' => $this->model->escape($data['title']), 'description' => $this->model->escape($data['description']), 'keywords' => $this->model->escape($data['keywords']), 'index' => $this->model->escape($data['index']), 'sid' => (int) $data['section'], 'display' => (int) $data['display'], 'preview' => $this->model->escape($data['preview']), 'content' => $this->model->escape($data['content']));
$savePage = $this->savePage($data);
$checkIndexPage = $this->model->checkIndexPage($data);
if (!isset($checkIndexPage['error'])) {
$result = $this->savePage($data, $formEditpage);
if (!isset($savePage['errors'])) {
Route::go('?mode=admin&route=editpage&pid=' . $data['pid']);
} else {
Bufer::set(array('errors' => $savePage['error'], 'formEditpage' => $formEditpage, 'titlePage' => isset($data['title']) ? $data['title'] : ''));
}
} else {
Bufer::set(array('errors' => $checkIndexPage['error'], 'formEditpage' => $formEditpage, 'titlePage' => isset($data['title']) ? $data['title'] : ''));
}
}
}
示例4: renderForm
public function renderForm()
{
$model = $this->model;
$form = new HTMLForm();
$form->open('addsection', '', 'POST');
$form->setInput('sname')->setAttr('type|text')->setAttr('onkeyup|document.getElementById(\'child\').value=translit(this.value)')->setAttr(isset($_POST['sname']) ? 'value|' . $_POST['sname'] : '')->setRules('notempty')->setErrorText('Введите наименование раздела')->setAttr('class|form-control input-lg')->addInput();
$form->setInput('sindex')->setAttr('type|text')->setAttr('id|child')->setAttr(isset($_POST['sindex']) ? 'value|' . $_POST['sindex'] : '')->setRules('notempty|regexp[#([a-z]){3,}#i]')->setErrorText('Введите псевдоним раздела (от 3х букв)')->setAttr('class|form-control input-lg')->addInput();
$form->setTextarea('sdescription')->setAttr('class|form-control')->setRules('notempty')->setText(isset($_POST['sdescription']) ? $_POST['sdescription'] : '')->setErrorText('Введите описание раздела')->addTextarea();
$form->setInput('createsection')->setAttr('type|submit')->setAttr('class|btn btn-primary btn-lg addpage')->setAttr('value|Создать')->addInput();
$formAddsection = $form->close();
Bufer::set(array('formAddsection' => $formAddsection));
if (!$form->sendForm('createsection')) {
$errors = $form->getErrors();
Bufer::add(array('errors' => $errors));
} else {
$data = $form->getData();
$data = array('sname' => $this->model->escape($data['sname']), 'sdescription' => $this->model->escape($data['sdescription']), 'sindex' => $this->model->escape($data['sindex']));
$checkIndexSection = $this->model->checkIndexSection($data);
if (!isset($checkIndexSection['errors'])) {
$result = $this->addsection($data, $formAddsection);
if ($result['errors']) {
Bufer::add(array('errors' => $result['errors']));
}
} else {
Bufer::add(array('errors' => $checkIndexSection['errors']));
}
}
}
示例5: renderForm
public function renderForm($data)
{
$form = new HTMLForm();
$form->open('editgalery', '', 'POST', 'enctype|multipart/form-data');
$form->setInput('name_galery')->setAttr('type|text')->setAttr('onkeyup|document.getElementById(\'child\').value=translit(this.value)')->setAttr('class|form-control input-lg')->setRules('notempty|trim')->setAttr('value|' . (isset($_POST['name_galery']) ? $_POST['name_galery'] : $data['meta']['gname']))->setErrorText('Укажите название новой галереи (3-30 знаков)')->addInput();
$form->setInput('sinonim_galery')->setAttr('type|text')->setAttr('id|child')->setAttr('class|form-control input-lg')->setAttr('value|' . (isset($_POST['sinonim_galery']) ? $_POST['sinonim_galery'] : $data['meta']['gindex']))->setRules('notempty|trim|regexp[#[a-z0-9\\-_\\.]#]')->setErrorText('Укажите синоним галереи')->addInput();
$form->setTextarea('gdescription')->setAttr('class|form-control')->setText(isset($_POST['gdescription']) ? $_POST['gdescription'] : $data['meta']['gdescription'])->setRules('notempty|trim')->setErrorText('Укажите описание галереи')->addTextarea();
$form->setInput('images[]')->setAttr('type|file')->setAttr('multiple|multiple')->addInput();
$form->setInput('resize')->setAttr('type|checkbox')->setAttr(isset($_POST['resize']) ? 'checked|checked' : '')->addInput();
$form->setInput('resize_w')->setAttr('type|text')->setAttr('value|' . (isset($_POST['resize_w']) ? (int) $_POST['resize_w'] : 800))->setRules('regexp[#[0-9]*#]')->setErrorText('Укажите ширину картинки для ресайза')->setAttr('class|form-control input-lg notlong')->addInput();
$form->setInput('resize_h')->setAttr('type|text')->setAttr('value|' . (isset($_POST['resize_h']) ? (int) $_POST['resize_h'] : 0))->setRules('regexp[#[0-9]*#]')->setErrorText('Укажите высоту картинки для ресайза')->setAttr('class|form-control input-lg notlong')->addInput();
$form->setInput('preview')->setAttr('type|checkbox')->setAttr('checked')->setAttr('disabled|disabled')->addInput();
$form->setInput('preview_w')->setAttr('type|text')->setAttr('value|' . (isset($_POST['preview_w']) ? (int) $_POST['preview_w'] : 150))->setAttr('class|form-control input-lg notlong')->setRules('regexp[#[0-9]*#]')->setErrorText('Укажите ширину картинки для превью')->addInput();
$form->setInput('preview_h')->setAttr('type|text')->setAttr('value|' . (isset($_POST['preview_h']) ? (int) $_POST['preview_h'] : 0))->setAttr('class|form-control input-lg notlong')->setRules('regexp[#[0-9]*#]')->setErrorText('Укажите высоту картинки для preview')->addInput();
$form->setInput('watermark')->setAttr('type|checkbox')->setAttr(isset($_POST['watermark']) ? 'checked|checked' : '')->addInput();
$form->setInput('watermarkfile')->setAttr('type|file')->addInput();
$form->setSelect('wm_position')->setAttr('class|form-control')->setAttr('style|width:300px')->setRules('notempty')->addSelect();
$form->setOption('Слева наверху')->setAttr('value|top_left')->addOption('wm_position');
$form->setOption('Справа наверху')->setAttr('value|top_right')->addOption('wm_position');
$form->setOption('Внизу слева')->setAttr('value|bottom_left')->addOption('wm_position');
$form->setOption('Внизу справа')->setAttr('value|bottom_right')->setAttr('selected|selected')->addOption('wm_position');
$form->setSelect('image_quality')->setAttr('class|form-control')->setAttr('style|width:300px')->setRules('notempty')->addSelect();
$form->setOption('Исходное качество')->setAttr('value|100')->addOption('image_quality');
$form->setOption('90%')->setAttr('value|90')->addOption('image_quality');
$form->setOption('80%')->setAttr('value|80')->addOption('image_quality');
$form->setOption('70%')->setAttr('value|70')->addOption('image_quality');
$form->setOption('60%')->setAttr('value|60')->addOption('image_quality');
$form->setInput('wm_text')->setAttr('type|text')->setAttr('class|form-control input-lg small')->setAttr('value|' . $_SERVER['SERVER_NAME'])->setAttr('style|width:200px!important')->addInput();
$form->setInput('color')->setAttr('type|text')->setAttr('class|form-control input-lg small')->setAttr('value|' . (isset($_POST['color']) ? $_POST['color'] : 'ffffff'))->setAttr('onblur|setColor(this)')->setAttr('maxlength|6')->setAttr('size|6')->setAttr('id|colorpickerField')->setAttr('style|text-align:center;width:200px')->addInput();
$form->setSelect('size')->setAttr('class|form-control')->setAttr('style|width:200px')->setRules('notempty')->addSelect();
$form->setOption('9 px')->setAttr('value|9')->addOption('size');
$form->setOption('10 px')->setAttr('value|10')->addOption('size');
$form->setOption('12 px')->setAttr('value|12')->addOption('size');
$form->setOption('15 px')->setAttr('value|15')->setAttr('selected|selected')->addOption('size');
$form->setOption('20 px')->setAttr('value|20')->addOption('size');
$form->setSelect('alfa')->setAttr('class|form-control')->setAttr('style|width:300px')->setRules('notempty')->addSelect();
$form->setOption('Не прозрачный')->setAttr('value|1')->addOption('alfa');
$form->setOption('50%')->setAttr('value|50')->addOption('alfa');
$form->setOption('60%')->setAttr('value|60')->addOption('alfa');
$form->setOption('70%')->setAttr('value|70')->addOption('alfa');
$form->setOption('80%')->setAttr('value|80')->addOption('alfa');
$form->setOption('90%')->setAttr('value|90')->addOption('alfa');
$form->setInput('savegalery')->setAttr('type|submit')->setAttr('class|btn btn-primary btn-lg')->setAttr('value|Сохранить галерею')->addInput();
$editForm = $form->close();
Bufer::add(array('editForm' => $editForm));
if (!$form->sendForm('savegalery')) {
$errors = $form->getErrors();
Bufer::add(array('errors' => $errors));
} else {
$glid = isset($_GET['glid']) ? (int) $_GET['glid'] : 0;
$data = array('gname' => $this->model->escape($_POST['name_galery']), 'gindex' => $this->model->escape($_POST['sinonim_galery']), 'gdescription' => $this->model->escape($_POST['gdescription']), 'image' => isset($_POST['cover']) ? $_POST['cover'] : false, 'glid' => $glid);
if (isset($_POST['giname']) && !empty($_POST['giname'])) {
foreach ($_POST['giname'] as $giid => $v) {
if ($v != ' ') {
$meta_images[$giid] = array('giname' => $this->model->escape($v), 'gidescription' => $this->model->escape($_POST['gidescription'][$giid]));
}
}
}
if (isset($meta_images)) {
$data['meta_images'] = $meta_images;
}
if (!empty($_FILES['name'])) {
$settings_upload = $this->getSettingsUploads($glid);
}
$bufer = Bufer::getData();
if (!isset($bufer['errors'])) {
$result = $this->EditGaleryFromDb($data);
if ($result['success'] === false) {
Bufer::add(array('errors' => array($result['error'])));
} else {
}
}
if (!isset($bufer['errors'])) {
$result = $this->creatFolders($glid);
if ($result === true) {
$settings_upload = $this->getSettingsUploads();
$this->copyFiles($settings_upload, $glid);
}
}
}
}