本文整理汇总了PHP中Textarea::addAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP Textarea::addAttribute方法的具体用法?PHP Textarea::addAttribute怎么用?PHP Textarea::addAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Textarea
的用法示例。
在下文中一共展示了Textarea::addAttribute方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
parent::__construct('questions_add');
$language = OW::getLanguage();
$this->setAjax();
$this->setAjaxResetOnSuccess(false);
$field = new Textarea('question');
$field->addAttribute('maxlength', 500);
$field->setRequired();
$field->setHasInvitation(true);
$field->setInvitation($language->text('questions', 'question_add_text_inv'));
$field->addAttribute("inv", $language->text('questions', 'question_add_text_inv'));
$this->addElement($field);
$field = new CheckboxField('allowAddOprions');
$field->addAttribute('checked');
$field->setLabel($language->text('questions', 'question_add_allow_add_opt'));
$this->addElement($field);
$field = new QUESTIONS_OptionsField('answers');
$field->setHasInvitation(true);
$field->setInvitation($language->text('questions', 'question_add_option_inv'));
$this->addElement($field);
$submit = new Submit('save');
$submit->setValue($language->text('questions', 'question_add_save'));
$this->addElement($submit);
if (!OW::getRequest()->isAjax()) {
OW::getLanguage()->addKeyForJs('questions', 'feedback_question_empty');
OW::getLanguage()->addKeyForJs('questions', 'feedback_question_min_length');
OW::getLanguage()->addKeyForJs('questions', 'feedback_question_max_length');
OW::getLanguage()->addKeyForJs('questions', 'feedback_question_two_apt_required');
OW::getLanguage()->addKeyForJs('questions', 'feedback_question_dublicate_option');
OW::getLanguage()->addKeyForJs('questions', 'feedback_option_max_length');
$this->initJsResponder();
}
$this->setAction(OW::getRequest()->buildUrlQueryString(OW::getRouter()->urlFor('QUESTIONS_CTRL_List', 'addQuestion')));
}
示例2: __construct
public function __construct($albumId)
{
parent::__construct('albumEditForm');
$album = PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumById($albumId);
$this->setAction(OW::getRouter()->urlForRoute('photo.ajax_update_photo'));
$this->setAjax(TRUE);
$this->setAjaxResetOnSuccess(FALSE);
$albumIdField = new HiddenField('album-id');
$albumIdField->setValue($album->id);
$albumIdField->setRequired();
$albumIdField->addValidator(new PHOTO_CLASS_AlbumOwnerValidator());
$this->addElement($albumIdField);
$albumNameField = new TextField('albumName');
$albumNameField->setValue($album->name);
$albumNameField->setRequired();
if ($album->name != trim(OW::getLanguage()->text('photo', 'newsfeed_album'))) {
$albumNameField->addValidator(new PHOTO_CLASS_AlbumNameValidator(TRUE, NULL, $album->name));
}
$albumNameField->addAttribute('class', 'ow_photo_album_name_input');
$this->addElement($albumNameField);
$desc = new Textarea('desc');
$desc->setValue(!empty($album->description) ? $album->description : NULL);
$desc->setHasInvitation(TRUE);
$desc->setInvitation(OW::getLanguage()->text('photo', 'describe_photo'));
$desc->addAttribute('class', 'ow_photo_album_description_textarea');
$this->addElement($desc);
}
示例3: __construct
public function __construct($albumId)
{
parent::__construct(self::FORM_NAME);
$album = PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumById($albumId);
$this->setAction(OW::getRouter()->urlForRoute('photo.ajax_update_photo'));
$this->setAjax(true);
$this->setAjaxResetOnSuccess(false);
$albumIdField = new HiddenField(self::ELEMENT_ALBUM_ID);
$albumIdField->setValue($album->id);
$albumIdField->setRequired();
$albumIdField->addValidator(new PHOTO_CLASS_AlbumOwnerValidator());
$this->addElement($albumIdField);
$albumNameField = new TextField(self::ELEMENT_ALBUM_NAME);
$albumNameField->setValue($album->name);
$albumNameField->setRequired();
if ($album->name != trim(OW::getLanguage()->text('photo', 'newsfeed_album'))) {
$albumNameField->addValidator(new PHOTO_CLASS_AlbumNameValidator(true, null, $album->name));
}
$albumNameField->addAttribute('class', 'ow_photo_album_name_input');
$this->addElement($albumNameField);
$desc = new Textarea(self::ELEMENT_DESC);
$desc->setValue(!empty($album->description) ? $album->description : NULL);
$desc->setHasInvitation(TRUE);
$desc->setInvitation(OW::getLanguage()->text('photo', 'describe_photo'));
$desc->addAttribute('class', 'ow_photo_album_description_textarea');
$this->addElement($desc);
$this->triggerReady(array('albumId' => $albumId));
}
示例4: __construct
public function __construct($widgetUniqName = null, $content = null)
{
parent::__construct('about_me_form');
$this->widgetUniqName = $widgetUniqName;
$this->setAjax(true);
$this->setAction(OW::getRouter()->urlFor('BASE_CTRL_ComponentPanel', 'ajaxSaveAboutMe'));
$input = new Textarea('about_me');
$input->addAttribute('style', 'width: 93%');
$input->setId('about_me_widget_input');
$input->setHasInvitation(true);
$input->setInvitation(OW::getLanguage()->text('base', 'about_me_widget_inv_text'));
//$input->setRequired(true);
$input->setValue($content);
$this->addElement($input);
$hidden = new HiddenField('widget_uniq_name');
$hidden->setValue($widgetUniqName);
$this->addElement($hidden);
$submit = new Submit('save');
//$submit->setLabel(OW::getLanguage()->text('base', 'widget_about_me_save_btn'));
$this->addElement($submit);
OW::getDocument()->addOnloadScript('
window.owForms["about_me_form"].bind("success", function(data){
OW.info(data.message);
});
window.owForms["about_me_form"].reset = false;
');
}
示例5: __construct
public function __construct($entityType, $entityId, $albumId = NULL, $albumName = NULL, $albumDescription = NULL, $url = NULL)
{
parent::__construct('ajax-upload');
$this->setAjax(TRUE);
$this->setAjaxResetOnSuccess(FALSE);
$this->setAction(OW::getRouter()->urlForRoute('photo.ajax_upload_submit'));
$this->bindJsFunction('success', UTIL_JsGenerator::composeJsString('function( data )
{
if ( data )
{
if ( !data.result )
{
if ( data.msg )
{
OW.error(data.msg);
}
else
{
OW.getLanguageText("photo", "photo_upload_error");
}
}
else
{
var url = {$url};
if ( url )
{
window.location.href = url;
}
else if ( data.url )
{
window.location.href = data.url;
}
}
}
else
{
OW.error("Server error");
}
}', array('url' => $url)));
$language = OW::getLanguage();
$albumField = new TextField('album');
$albumField->setRequired();
$albumField->addAttribute('class', 'ow_dropdown_btn ow_inputready ow_cursor_pointer');
$albumField->addAttribute('autocomplete', 'off');
$albumField->addAttribute('readonly');
$albumNameField = new TextField('album-name');
$albumNameField->setRequired();
$albumNameField->addValidator(new PHOTO_CLASS_AlbumNameValidator(FALSE));
$albumNameField->addAttribute('class', 'ow_smallmargin invitation');
$this->addElement($albumNameField);
$desc = new Textarea('description');
$desc->addAttribute('class', 'invitation');
if (!empty($albumDescription)) {
$desc->setValue($albumDescription);
} else {
$desc->setValue($language->text('photo', 'album_desc'));
}
$this->addElement($desc);
$userId = OW::getUser()->getId();
if (!empty($albumId) && ($album = PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumById($albumId, $userId)) !== NULL && $album->userId == $userId && $album->name != trim(OW::getLanguage()->text('photo', 'newsfeed_album'))) {
$albumField->setValue($album->name);
$albumNameField->setValue($album->name);
} elseif (!empty($albumName)) {
$albumField->setValue($albumName);
$albumNameField->setValue($albumName);
} else {
$event = new BASE_CLASS_EventCollector(PHOTO_CLASS_EventHandler::EVENT_SUGGEST_DEFAULT_ALBUM, array('userId' => $userId, 'entityType' => $entityType, 'entityId' => $entityId));
OW::getEventManager()->trigger($event);
$data = $event->getData();
if (!empty($data)) {
$albumField->setValue($data[0]);
$albumNameField->setValue($data[0]);
} else {
$albumField->setValue($language->text('photo', 'choose_existing_or_create'));
$albumNameField->setValue($language->text('photo', 'album_name'));
}
}
$this->addElement($albumField);
$submit = new Submit('submit');
$submit->addAttribute('class', 'ow_ic_submit ow_positive');
$this->addElement($submit);
}
示例6: __construct
/**
*
* Constructor
* @param $prefix
* @param $key
* @param BASE_CMP_LanguageValueEdit $parent
*/
public function __construct(BOL_QuestionAccountType $accountType, $formName = '')
{
if (empty($formName)) {
$formName = 'account_type_' . sha1(rand(0, 99999999));
}
parent::__construct($formName);
$key = BOL_QuestionService::getInstance()->getQuestionLangKeyName(BOL_QuestionService::LANG_KEY_TYPE_ACCOUNT_TYPE, $accountType->name);
$prefix = 'base';
$this->setAjax(true);
$this->setAction(OW::getRouter()->urlFor("ADMIN_CTRL_Questions", "ajaxResponder"));
$hidden = new HiddenField('command');
$hidden->setValue('AddAccountType');
$this->addElement($hidden);
$hidden = new HiddenField('key');
$hidden->setValue($key);
$this->addElement($hidden);
$hidden = new HiddenField('prefix');
$hidden->setValue($prefix);
$this->addElement($hidden);
$hidden = new HiddenField('accountTypeName');
$hidden->setValue($accountType->name);
$this->addElement($hidden);
$languageService = BOL_LanguageService::getInstance();
$list = $languageService->findActiveList();
foreach ($list as $item) {
$textArea = new Textarea("lang[{$item->getId()}][{$prefix}][{$key}]");
$dto = $languageService->getValue($item->getId(), $prefix, $key);
$value = $dto !== null ? $dto->getValue() : '';
$textArea->setValue($value);
$textArea->addAttribute('style', 'height: 32px;');
$this->addElement($textArea);
}
$roleList = BOL_AuthorizationService::getInstance()->findNonGuestRoleList();
$defaultRole = null;
if (!empty($accountType->roleId)) {
$defaultRole = BOL_AuthorizationService::getInstance()->getRoleById($accountType->roleId);
}
if (empty($defaultRole)) {
$defaultRole = BOL_AuthorizationService::getInstance()->getDefaultRole();
}
$options = array();
foreach ($roleList as $role) {
$options[$role->id] = BOL_AuthorizationService::getInstance()->getRoleLabel($role->name);
}
$roleFormElement = new Selectbox('role');
$roleFormElement->setOptions($options);
$roleFormElement->setValue($defaultRole->id);
$roleFormElement->setHasInvitation(false);
$this->addElement($roleFormElement);
if (!empty($accountType->id)) {
$accountTypes = BOL_QuestionService::getInstance()->findAllAccountTypes();
if (count($accountTypes) > 1) {
$options = array();
$i = 1;
foreach ($accountTypes as $dto) {
/* @var $dto BOL_QuestionAccountType */
$options[$dto->sortOrder] = $i;
$i++;
}
$orderFormElement = new Selectbox('order');
$orderFormElement->setOptions($options);
$orderFormElement->setValue($accountType->sortOrder);
$orderFormElement->setHasInvitation(false);
$this->addElement($orderFormElement);
}
}
$submit = new Submit('submit');
$submit->setValue(OW::getLanguage()->text('admin', 'questions_add_new_account_type'));
$jsString = ' owForms[{$formName}].bind("success", function(json){
if ( json.result.add == true) {
OW.registerLanguageKey("base", ' . json_encode($key) . ', json.accountTypeName);
OW.trigger("admin.add_account_type", [json], this);
}
}); ';
OW::getLanguage()->addKeyForJs($prefix, $key);
if (!empty($accountType->id)) {
$jsString = ' owForms[{$formName}].bind("success", function(json){
if ( json.result.update == true) {
OW.registerLanguageKey("base", ' . json_encode($key) . ', json.accountTypeName);
OW.trigger("admin.update_account_type", [json], this);
}
}); ';
}
$script = UTIL_JsGenerator::composeJsString($jsString, array('formName' => $this->getName()));
OW::getDocument()->addOnloadScript($script);
if ($accountType->id) {
$submit->setValue(OW::getLanguage()->text('admin', 'questions_save_account_type'));
}
$this->addElement($submit);
}
示例7: __construct
/**
* Class constructor
*
*/
public function __construct($questionId)
{
$this->questionId = (int) $questionId;
$language = OW::getLanguage();
parent::__construct('add_qst_values_form');
$this->setId('add_qst_values_form');
$this->setAjax();
$qstCommand = new HiddenField('command');
$qstCommand->setValue('submit_add_values_form');
$this->addElement($qstCommand);
$qstQuestionId = new HiddenField('questionId');
$qstQuestionId->setValue((int) $questionId);
$this->addElement($qstQuestionId);
$qstValues = new Textarea('qst_add_values');
$qstValues->addAttribute('class', $qstValues->getName());
$qstValues->setLabel($language->text('admin', 'questions_add_values_label'));
$qstValues->setDescription($language->text('admin', 'questions_add_values_description'));
$qstValues->setRequired();
$this->addElement($qstValues);
$qstValuesSubmit = new Submit('add_qst_submit');
$qstValuesSubmit->addAttribute('class', 'ow_button ow_ic_save');
$qstValuesSubmit->setValue($language->text('admin', 'questions_add_values_submit_button'));
$this->addElement($qstValuesSubmit);
if (!OW::getRequest()->isAjax()) {
$js = " owForms['add_qst_values_form'].bind( 'success',\n function( json )\n {\n \$('#add_qst_values_form input[name=questionId]').val('" . $questionId . "');\n \$('#add_qst_values_form input[name=command]').val('submit_add_values_form');\n if( json.result == true )\n {\n window.addValueBox.close();\n\n OW.info(json.notice);\n window.editQuestion.displayAddValues( json.values );\n }\n else\n {\n OW.error(json.error);\n }\n\n } ); ";
OW::getDocument()->addOnloadScript($js);
}
}
示例8: __construct
public function __construct($entityType, $entityId, $albumId = null, $albumName = null, $albumDescription = null, $url = null, $data = null)
{
parent::__construct(self::FORM_NAME);
$this->setAjax(true);
$this->setAjaxResetOnSuccess(false);
$this->setAction(OW::getRouter()->urlForRoute('photo.ajax_upload_submit'));
$this->bindJsFunction(self::BIND_SUCCESS, UTIL_JsGenerator::composeJsString('function( data )
{
if ( data )
{
if ( !data.result )
{
if ( data.msg )
{
OW.error(data.msg);
}
else
{
OW.getLanguageText("photo", "photo_upload_error");
}
}
else
{
var url = {$url};
if ( url )
{
window.location.href = url;
}
else if ( data.url )
{
window.location.href = data.url;
}
}
}
else
{
OW.error("Server error");
}
}', array('url' => $url)));
$language = OW::getLanguage();
$albumField = new TextField(self::ELEMENT_ALBUM);
$albumField->setRequired();
$albumField->addAttribute(FormElement::ATTR_CLASS, 'ow_dropdown_btn ow_inputready ow_cursor_pointer');
$albumField->addAttribute('autocomplete', 'off');
$albumField->addAttribute(FormElement::ATTR_READONLY);
$albumNameField = new TextField(self::ELEMENT_ALBUM_NAME);
$albumNameField->setRequired();
$albumNameField->addValidator(new PHOTO_CLASS_AlbumNameValidator(false));
$albumNameField->addAttribute('placeholder', $language->text('photo', 'album_name'));
$this->addElement($albumNameField);
$desc = new Textarea(self::ELEMENT_DESCRIPTION);
$desc->addAttribute('placeholder', $language->text('photo', 'album_desc'));
$desc->setValue(!empty($albumDescription) ? $albumDescription : null);
$this->addElement($desc);
$userId = OW::getUser()->getId();
$albumService = PHOTO_BOL_PhotoAlbumService::getInstance();
if (!empty($albumId) && ($album = $albumService->findAlbumById($albumId)) !== null && $album->userId == $userId && !$albumService->isNewsfeedAlbum($album)) {
$albumField->setValue($album->name);
$albumNameField->setValue($album->name);
} elseif (!empty($albumName)) {
$albumField->setValue($albumName);
$albumNameField->setValue($albumName);
} else {
$event = OW::getEventManager()->trigger(new BASE_CLASS_EventCollector(PHOTO_CLASS_EventHandler::EVENT_SUGGEST_DEFAULT_ALBUM, array('userId' => $userId, 'entityType' => $entityType, 'entityId' => $entityId)));
$eventData = $event->getData();
if (!empty($eventData)) {
$value = array_shift($eventData);
$albumField->setValue($value);
$albumNameField->setValue($value);
} else {
$albumField->setValue($language->text('photo', 'choose_existing_or_create'));
}
}
$this->addElement($albumField);
$submit = new Submit('submit');
$submit->addAttribute('class', 'ow_ic_submit ow_positive');
$this->addElement($submit);
$this->triggerReady(array('entityType' => $entityType, 'entityId' => $entityId, 'albumId' => $albumId, 'albumName' => $albumName, 'albumDescription' => $albumDescription, 'url' => $url, 'data' => $data));
}