本文整理汇总了PHP中TextField::addAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP TextField::addAttribute方法的具体用法?PHP TextField::addAttribute怎么用?PHP TextField::addAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextField
的用法示例。
在下文中一共展示了TextField::addAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
parent::__construct();
$language = OW::getLanguage();
$serviceLang = BOL_LanguageService::getInstance();
$addSectionForm = new Form('qst_add_section_form');
$addSectionForm->setAjax();
$addSectionForm->setAjaxResetOnSuccess(true);
$addSectionForm->setAction(OW::getRouter()->urlFor("ADMIN_CTRL_Questions", "ajaxResponder"));
$input = new HiddenField('command');
$input->setValue('addSection');
$addSectionForm->addElement($input);
$qstSectionName = new TextField('section_name');
$qstSectionName->addAttribute('class', 'ow_text');
$qstSectionName->addAttribute('style', 'width: auto;');
$qstSectionName->setRequired();
$qstSectionName->setLabel($language->text('admin', 'questions_new_section_label'));
$addSectionForm->addElement($qstSectionName);
$this->addForm($addSectionForm);
$addSectionForm->bindJsFunction('success', ' function (result) {
if ( result.result )
{
OW.info(result.message);
}
else
{
OW.error(result.message);
}
window.location.reload();
} ');
}
示例2: render
public function render()
{
$name = $this->getName();
$hidden = new HiddenField($name, $this->getValue());
$id = $this->getId();
$hidden->addAttribute("id", $id);
$ret = $hidden->render();
if ($this->storedFieldSet === false) {
$this->addSearchField($this->storedField);
$this->storedFieldSet = true;
}
$object = array("model" => $this->model->package, "format" => "json", "fields" => $this->searchFields, "limit" => 20, "conditions" => "", "and_conditions" => $this->andConditions);
$jsonSearchFields = array_reverse($this->searchFields);
$object = base64_encode(serialize($object));
$path = Application::$prefix . "/lib/models/urlaccess.php?object={$object}";
$fields = urlencode(json_encode($jsonSearchFields));
$text = new TextField();
$text->addAttribute("onkeyup", "fapiUpdateSearchField('{$id}','{$path}','{$fields}',this," . ($this->boldFirst ? "true" : "false") . ",'{$this->onChangeAttribute}')");
$text->addAttribute("autocomplete", "off");
if ($this->getValue() != "") {
$data = $this->model[$this->getValue()];
for ($i = 2; $i < count($jsonSearchFields); $i++) {
$val .= $data[0][$jsonSearchFields[$i]] . " ";
}
$text->setValue($val);
}
$text->setId($id . "_search_entry");
$ret .= $text->render();
$ret .= "<div class='fapi-popup' id='{$id}_search_area'></div>";
return $ret;
}
示例3: __construct
public function __construct()
{
parent::__construct('add-album');
$this->setAjax();
$this->setAjaxResetOnSuccess(FALSE);
$this->setAction(OW::getRouter()->urlFor('PHOTO_CTRL_Photo', 'ajaxResponder'));
$ajaxFunc = new HiddenField('ajaxFunc');
$ajaxFunc->setValue('ajaxMoveToAlbum');
$ajaxFunc->setRequired();
$this->addElement($ajaxFunc);
$fromAlbum = new HiddenField('from-album');
$fromAlbum->setRequired();
$fromAlbum->addValidator(new PHOTO_CLASS_AlbumOwnerValidator());
$this->addElement($fromAlbum);
$toAlbum = new HiddenField('to-album');
$this->addElement($toAlbum);
$photos = new HiddenField('photos');
$photos->setRequired();
$this->albumPhotosValidator = new AlbumPhotosValidator();
$photos->addValidator($this->albumPhotosValidator);
$this->addElement($photos);
$albumName = new TextField('album-name');
$albumName->setRequired();
$albumName->addValidator(new PHOTO_CLASS_AlbumNameValidator(FALSE));
$albumName->setHasInvitation(TRUE);
$albumName->setInvitation(OW::getLanguage()->text('photo', 'album_name'));
$albumName->addAttribute('class', 'ow_smallmargin');
$this->addElement($albumName);
$desc = new Textarea('desc');
$desc->setHasInvitation(TRUE);
$desc->setInvitation(OW::getLanguage()->text('photo', 'album_desc'));
$this->addElement($desc);
$this->addElement(new Submit('add'));
}
示例4: __construct
/**
* Class constructor
*/
public function __construct($providerName)
{
parent::__construct('provider-config-form');
$this->setAjax(true);
$this->bindJsFunction(Form::BIND_SUCCESS, 'function(data){if( data.result ){OW.info(data.message);setTimeout(function(){location.reload();}, 1000);}else{OW.error(data.message);}}');
$this->setAction(OW::getRouter()->urlForRoute('ynsocialconnect-admin-ajaxUpdateProfileQuestion'));
$language = OW::getLanguage();
$service = YNSOCIALCONNECT_BOL_ServicesService::getInstance();
$questionDtoList = $service->getOWQuestionDtoList($providerName);
$aliases = $service->findAliasList($providerName);
$options = $service->getServiceFields($providerName);
foreach ($questionDtoList as $question) {
$new_element = new Selectbox('alias[' . $question->name . ']');
foreach ($options as $option) {
$new_element->addOption($option->name, $option->label);
}
$new_element->setValue(empty($aliases[$question->name]) ? '' : $aliases[$question->name]);
$this->addElement($new_element);
}
$hidden = new TextField('providerName');
$hidden->addAttribute('type', 'hidden');
$hidden->setValue($providerName);
$this->addElement($hidden);
$submit = new Submit('edit');
$submit->setValue($language->text('ynsocialconnect', 'save_btn_label'));
$this->addElement($submit);
}
示例5: __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));
}
示例6: __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);
}
示例7: index
public function index($params = array())
{
$userService = BOL_UserService::getInstance();
$language = OW::getLanguage();
$this->setPageHeading($language->text('admin', 'restrictedusernames'));
$this->setPageHeadingIconClass('ow_ic_script');
$restrictedUsernamesForm = new Form('restrictedUsernamesForm');
$restrictedUsernamesForm->setId('restrictedUsernamesForm');
$username = new TextField('restrictedUsername');
$username->addAttribute('class', 'ow_text');
$username->addAttribute('style', 'width: auto;');
$username->setRequired();
$username->setLabel($language->text('admin', 'restrictedusernames_username_label'));
$restrictedUsernamesForm->addElement($username);
$submit = new Submit('addUsername');
$submit->addAttribute('class', 'ow_button');
$submit->setValue($language->text('admin', 'restrictedusernames_add_username_button'));
$restrictedUsernamesForm->addElement($submit);
$this->addForm($restrictedUsernamesForm);
$this->assign('restricted_list', $this->userService->getRestrictedUsernameList());
if (OW::getRequest()->isPost()) {
if ($restrictedUsernamesForm->isValid($_POST)) {
$data = $restrictedUsernamesForm->getValues();
$username = $this->userService->getRestrictedUsername($data['restrictedUsername']);
if (empty($username)) {
$username = new BOL_RestrictedUsernames();
$username->setRestrictedUsername($data['restrictedUsername']);
$this->userService->addRestrictedUsername($username);
OW::getFeedback()->info($language->text('admin', 'restrictedusernames_username_added'));
$this->redirect();
} else {
OW::getFeedback()->warning($language->text('admin', 'restrictedusernames_username_already_exists'));
}
}
}
}
示例8: __construct
/**
* Constructor.
*
* @param array $itemsList
*/
public function __construct($langId)
{
parent::__construct();
$this->service = BOL_LanguageService::getInstance();
if (empty($langId)) {
$this->setVisible(false);
return;
}
$languageDto = $this->service->findById($langId);
if ($languageDto === null) {
$this->setVisible(false);
return;
}
$language = OW::getLanguage();
$form = new Form('lang_edit');
$form->setAjax();
$form->setAction(OW::getRouter()->urlFor('ADMIN_CTRL_Languages', 'langEditFormResponder'));
$form->setAjaxResetOnSuccess(false);
$labelTextField = new TextField('label');
$labelTextField->setLabel($language->text('admin', 'clone_form_lbl_label'));
$labelTextField->setDescription($language->text('admin', 'clone_form_descr_label'));
$labelTextField->setRequired();
$labelTextField->setValue($languageDto->getLabel());
$form->addElement($labelTextField);
$tagTextField = new TextField('tag');
$tagTextField->setLabel($language->text('admin', 'clone_form_lbl_tag'));
$tagTextField->setDescription($language->text('admin', 'clone_form_descr_tag'));
$tagTextField->setRequired();
$tagTextField->setValue($languageDto->getTag());
if ($languageDto->getTag() == 'en') {
$tagTextField->addAttribute('disabled', 'disabled');
}
$form->addElement($tagTextField);
$rtl = new CheckboxField('rtl');
$rtl->setLabel($language->text('admin', 'lang_edit_form_rtl_label'));
$rtl->setDescription($language->text('admin', 'lang_edit_form_rtl_desc'));
$rtl->setValue((bool) $languageDto->getRtl());
$form->addElement($rtl);
$hiddenField = new HiddenField('langId');
$hiddenField->setValue($languageDto->getId());
$form->addElement($hiddenField);
$submit = new Submit('submit');
$submit->setValue($language->text('admin', 'btn_label_edit'));
$form->addElement($submit);
$form->bindJsFunction(Form::BIND_SUCCESS, "function(data){if(data.result){OW.info(data.message);setTimeout(function(){window.location.reload();}, 1000);}else{OW.error(data.message);}}");
$this->addForm($form);
}
示例9: __construct
public function __construct($photoId = NULL)
{
parent::__construct('photo-edit-form');
$this->setAjax(TRUE);
$this->setAction(OW::getRouter()->urlFor('PHOTO_CTRL_Photo', 'ajaxUpdatePhoto'));
$this->bindJsFunction('success', 'function( data )
{
OW.trigger("photo.afterPhotoEdit", data);
}');
$photo = PHOTO_BOL_PhotoService::getInstance()->findPhotoById($photoId);
$album = PHOTO_BOL_PhotoAlbumService::getInstance()->findAlbumById($photo->albumId);
$photoIdField = new HiddenField('photoId');
$photoIdField->setRequired(TRUE);
$photoIdField->setValue($photo->id);
$photoIdField->addValidator(new PHOTO_CLASS_PhotoOwnerValidator());
$this->addElement($photoIdField);
$albumField = new TextField('album');
$albumField->setId('ajax-upload-album');
$albumField->setRequired();
$albumField->setValue($album->name);
$albumField->setLabel(OW::getLanguage()->text('photo', 'create_album'));
$albumField->addAttribute('class', 'ow_dropdown_btn ow_inputready ow_cursor_pointer');
$albumField->addAttribute('autocomplete', 'off');
$albumField->addAttribute('readonly');
$this->addElement($albumField);
$albumNameField = new TextField('album-name');
$albumNameField->setRequired();
$albumNameField->setValue($album->name);
$albumNameField->addValidator(new PHOTO_CLASS_AlbumNameValidator(FALSE, NULL, $album->name));
$albumNameField->setHasInvitation(TRUE);
$albumNameField->setInvitation(OW::getLanguage()->text('photo', 'album_name'));
$albumNameField->addAttribute('class', 'ow_smallmargin invitation');
$this->addElement($albumNameField);
$desc = new Textarea('description');
$desc->setHasInvitation(TRUE);
$desc->setInvitation(OW::getLanguage()->text('photo', 'album_desc'));
$this->addElement($desc);
$photoDesc = new PHOTO_CLASS_HashtagFormElement('photo-desc');
$photoDesc->setValue($photo->description);
$photoDesc->setLabel(OW::getLanguage()->text('photo', 'album_desc'));
$this->addElement($photoDesc);
$submit = new Submit('edit');
$submit->setValue(OW::getLanguage()->text('photo', 'btn_edit'));
$this->addElement($submit);
}
示例10: index
public function index($params = array())
{
$userService = BOL_UserService::getInstance();
$language = OW::getLanguage();
$this->setPageHeading($language->text('admin', 'massmailing'));
$this->setPageHeadingIconClass('ow_ic_script');
$massMailingForm = new Form('massMailingForm');
$massMailingForm->setId('massMailingForm');
$rolesList = BOL_AuthorizationService::getInstance()->getRoleList();
$userRoles = new CheckboxGroup('userRoles');
$userRoles->setLabel($language->text('admin', 'massmailing_user_roles_label'));
foreach ($rolesList as $role) {
if ($role->name != 'guest') {
$userRoles->addOption($role->name, $language->text('base', 'authorization_role_' . $role->name));
}
}
$massMailingForm->addElement($userRoles);
$emailFormat = new Selectbox('emailFormat');
$emailFormat->setLabel($language->text('admin', 'massmailing_email_format_label'));
$emailFormat->setOptions(array(self::EMAIL_FORMAT_TEXT => $language->text('admin', 'massmailing_email_format_text'), self::EMAIL_FORMAT_HTML => $language->text('admin', 'massmailing_email_format_html')));
$emailFormat->setValue(self::EMAIL_FORMAT_TEXT);
$emailFormat->setHasInvitation(false);
if (!empty($_POST['emailFormat'])) {
$emailFormat->setValue($_POST['emailFormat']);
}
$massMailingForm->addElement($emailFormat);
$subject = new TextField('subject');
$subject->addAttribute('class', 'ow_text');
$subject->addAttribute('style', 'width: auto;');
$subject->setRequired();
$subject->setLabel($language->text('admin', 'massmailing_subject_label'));
if (!empty($_POST['subject'])) {
$subject->setValue($_POST['subject']);
}
$massMailingForm->addElement($subject);
$body = new Textarea('body');
if ($emailFormat->getValue() == self::EMAIL_FORMAT_HTML) {
$body = new WysiwygTextarea('body');
$body->forceAddButtons(array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_HTML));
}
$body->addAttribute('class', 'ow_text');
$body->addAttribute('style', 'width: auto;');
$body->setRequired();
$body->setLabel($language->text('admin', 'massmailing_body_label'));
if (!empty($_POST['body'])) {
$body->setValue($_POST['body']);
}
$massMailingForm->addElement($body);
$submit = new Submit('startMailing');
$submit->addAttribute('class', 'ow_button');
$submit->setValue($language->text('admin', 'massmailing_start_mailing_button'));
$massMailingForm->addElement($submit);
$this->addForm($massMailingForm);
$ignoreUnsubscribe = false;
$isActive = true;
if (defined('OW_PLUGIN_XP')) {
$massMailingTimestamp = OW::getConfig()->getValue('admin', 'mass_mailing_timestamp');
$timeout = $massMailingTimestamp + 60 * 60 * 24 - time();
if ($timeout > 0) {
$isActive = false;
$this->assign('expireText', $language->text('admin', 'massmailing_expire_text', array('hours' => (int) ceil($timeout / (60 * 60)))));
}
}
$this->assign('isActive', $isActive);
$total = $userService->findMassMailingUserCount($ignoreUnsubscribe);
if (OW::getRequest()->isPost() && $isActive && isset($_POST['startMailing'])) {
if ($massMailingForm->isValid($_POST)) {
$data = $massMailingForm->getValues();
$start = 0;
$count = self::MAILS_ARRAY_MAX_RECORDS;
$mailCount = 0;
$total = $userService->findMassMailingUserCount($ignoreUnsubscribe, $data['userRoles']);
while ($start < $total) {
$result = $this->userService->findMassMailingUsers($start, $count, $ignoreUnsubscribe, $data['userRoles']);
$mails = array();
$userIdList = array();
foreach ($result as $user) {
$userIdList[] = $user->id;
}
$displayNameList = $this->userService->getDisplayNamesForList($userIdList);
$event = new BASE_CLASS_EventCollector('base.add_global_lang_keys');
OW::getEventManager()->trigger($event);
$vars = call_user_func_array('array_merge', $event->getData());
foreach ($result as $key => $user) {
$vars['user_email'] = $user->email;
$mail = OW::getMailer()->createMail();
$mail->addRecipientEmail($user->email);
$vars['user_name'] = $displayNameList[$user->id];
$code = md5($user->username . $user->password);
$link = OW::getRouter()->urlForRoute('base_massmailing_unsubscribe', array('id' => $user->id, 'code' => $code));
$subjectText = UTIL_String::replaceVars($data['subject'], $vars);
$mail->setSubject($subjectText);
if ($data['emailFormat'] === self::EMAIL_FORMAT_HTML) {
$htmlContent = UTIL_String::replaceVars($data['body'], $vars);
$htmlContent .= $language->text('admin', 'massmailing_unsubscribe_link_html', array('link' => $link));
$mail->setHtmlContent($htmlContent);
$textContent = preg_replace("/\\<br\\s*[\\/]?\\s*\\>/", "\n", $htmlContent);
$textContent = strip_tags($textContent);
$mail->setTextContent($textContent);
} else {
//.........这里部分代码省略.........
示例11: __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));
}
示例12: __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);
}
示例13: __construct
/**
* Class constructor
*
*/
public function __construct(MAILBOX_CMP_NewMessage $component = null)
{
$language = OW::getLanguage();
parent::__construct('mailbox-new-message-form');
$this->setId('mailbox-new-message-form');
$this->setAjax(true);
$this->setAjaxResetOnSuccess(false);
$this->setAction(OW::getRouter()->urlFor('MAILBOX_CTRL_Ajax', 'newMessage'));
$this->setEmptyElementsErrorMessage('');
$this->setEnctype('multipart/form-data');
$subject = new TextField('subject');
// $subject->setHasInvitation(true);
// $subject->setInvitation($language->text('mailbox', 'subject'));
$subject->addAttribute('placeholder', $language->text('mailbox', 'subject'));
$requiredValidator = new RequiredValidator();
$requiredValidator->setErrorMessage($language->text('mailbox', 'subject_is_required'));
$subject->addValidator($requiredValidator);
$validatorSubject = new StringValidator(1, 2048);
$validatorSubject->setErrorMessage($language->text('mailbox', 'message_too_long_error', array('maxLength' => 2048)));
$subject->addValidator($validatorSubject);
$this->addElement($subject);
$validator = new StringValidator(1, MAILBOX_BOL_AjaxService::MAX_MESSAGE_TEXT_LENGTH);
$validator->setErrorMessage($language->text('mailbox', 'message_too_long_error', array('maxLength' => MAILBOX_BOL_AjaxService::MAX_MESSAGE_TEXT_LENGTH)));
$textarea = OW::getClassInstance("MAILBOX_CLASS_Textarea", "message");
/* @var $textarea MAILBOX_CLASS_Textarea */
$textarea->addValidator($validator);
$textarea->setCustomBodyClass("mailbox");
// $textarea->setHasInvitation(true);
// $textarea->setInvitation($language->text('mailbox', 'message_invitation'));
$textarea->addAttribute('placeholder', $language->text('mailbox', 'message_invitation'));
$requiredValidator = new RequiredValidator();
$requiredValidator->setErrorMessage($language->text('mailbox', 'chat_message_empty'));
$textarea->addValidator($requiredValidator);
$this->addElement($textarea);
$user = OW::getClassInstance("MAILBOX_CLASS_UserField", "opponentId");
/* @var $user MAILBOX_CLASS_UserField */
// $user->setHasInvitation(true);
// $user->setInvitation($language->text('mailbox', 'to'));
$requiredValidator = new RequiredValidator();
$requiredValidator->setErrorMessage($language->text('mailbox', 'recipient_is_required'));
$user->addValidator($requiredValidator);
$this->addElement($user);
if (OW::getSession()->isKeySet('mailbox.new_message_form_attachments_uid')) {
$uidValue = OW::getSession()->get('mailbox.new_message_form_attachments_uid');
} else {
$uidValue = UTIL_HtmlTag::generateAutoId('mailbox_new_message');
OW::getSession()->set('mailbox.new_message_form_attachments_uid', $uidValue);
}
$uid = new HiddenField('uid');
$uid->setValue($uidValue);
$this->addElement($uid);
$configs = OW::getConfig()->getValues('mailbox');
if (!empty($configs['enable_attachments']) && !empty($component)) {
$attachmentCmp = new BASE_CLASS_FileAttachment('mailbox', $uidValue);
$attachmentCmp->setInputSelector('#newMessageWindowAttachmentsBtn');
$component->addComponent('attachments', $attachmentCmp);
}
$submit = new Submit("send");
$submit->setValue($language->text('mailbox', 'send_button'));
$this->addElement($submit);
if (!OW::getRequest()->isAjax()) {
$this->initStatic();
}
}
示例14: __construct
/**
* Class constructor
*
*/
public function __construct($maxUploadFileSize)
{
parent::__construct('configSaveForm');
$language = OW::getLanguage();
$configs = OW::getConfig()->getValues('mailbox');
$element = new CheckboxField('enableAttachments');
$element->setValue($configs['enable_attachments']);
$this->addElement($element);
$element = new TextField('uploadMaxFileSize');
$element->addAttribute('style', 'width:30px');
/* if ( !$configs['enable_attachments'] )
{
$element->addAttribute('disabled', 'disabled');
} */
$validator = new FloatValidator(0, $maxUploadFileSize);
$validator->setErrorMessage($language->text('admin', 'settings_max_upload_size_error'));
$element->addValidator($validator);
$element->setValue((double) $configs['upload_max_file_size']);
$this->addElement($element);
// submit
$submit = new Submit('save');
$submit->setValue($language->text('base', 'edit_button'));
$this->addElement($submit);
}
示例15: __construct
/**
* Class constructor
*
*/
public function __construct()
{
parent::__construct('configSaveForm');
$language = OW::getLanguage();
// baseSwf_url Field
$baseSwf_urlField = new TextField('baseSwf_url');
$baseSwf_urlField->addAttribute('readonly', 'readonly');
$this->addElement($baseSwf_urlField->setLabel($language->text('vwvc', 'baseSwf_url')));
// server Field
$serverField = new TextField('server');
$serverField->setRequired(true);
$this->addElement($serverField->setLabel($language->text('vwvc', 'server')));
// serverAMF Field
$serverAMFField = new TextField('serverAMF');
$serverAMFField->setRequired(true);
$this->addElement($serverAMFField->setLabel($language->text('vwvc', 'serverAMF')));
// serverRTMFP Field
$serverRTMFPField = new TextField('serverRTMFP');
$serverRTMFPField->setRequired(true);
$this->addElement($serverRTMFPField->setLabel($language->text('vwvc', 'serverRTMFP')));
// select box for certain parameters
$par = array('0' => 'no', '1' => 'yes');
$par1 = array('1' => 'yes', '0' => 'no');
// enableRTMP Field
$enableRTMPField = new Selectbox('enableRTMP');
$enableRTMPField->addOptions($par1);
$enableRTMPField->setRequired();
$enableRTMPField->setHasInvitation(false);
$this->addElement($enableRTMPField->setLabel($language->text('vwvc', 'enableRTMP')));
// enableP2P Field
$enableP2PField = new Selectbox('enableP2P');
$enableP2PField->addOptions($par);
$enableP2PField->setRequired();
$enableP2PField->setHasInvitation(false);
$this->addElement($enableP2PField->setLabel($language->text('vwvc', 'enableP2P')));
// supportRTMP Field
$supportRTMPField = new Selectbox('supportRTMP');
$supportRTMPField->addOptions($par1);
$supportRTMPField->setRequired();
$supportRTMPField->setHasInvitation(false);
$this->addElement($supportRTMPField->setLabel($language->text('vwvc', 'supportRTMP')));
// supportP2P Field
$supportP2PField = new Selectbox('supportP2P');
$supportP2PField->addOptions($par1);
$supportP2PField->setRequired();
$supportP2PField->setHasInvitation(false);
$this->addElement($supportP2PField->setLabel($language->text('vwvc', 'supportP2P')));
// alwaysRTMP Field
$alwaysRTMPField = new Selectbox('alwaysRTMP');
$alwaysRTMPField->addOptions($par);
$alwaysRTMPField->setRequired();
$alwaysRTMPField->setHasInvitation(false);
$this->addElement($alwaysRTMPField->setLabel($language->text('vwvc', 'alwaysRTMP')));
// alwaysP2P Field
$alwaysP2PField = new Selectbox('alwaysP2P');
$alwaysP2PField->addOptions($par);
$alwaysP2PField->setRequired();
$alwaysP2PField->setHasInvitation(false);
$this->addElement($alwaysP2PField->setLabel($language->text('vwvc', 'alwaysP2P')));
// videoCodec Field
$videoCodecField = new TextField('videoCodec');
$videoCodecField->setRequired(true);
$this->addElement($videoCodecField->setLabel($language->text('vwvc', 'videoCodec')));
// codecLevel Field
$codecLevelField = new TextField('codecLevel');
$codecLevelField->setRequired(true);
$this->addElement($codecLevelField->setLabel($language->text('vwvc', 'codecLevel')));
// codecProfile Field
$codecProfileArr = array('main' => 'main', 'baseline' => 'baseline');
$codecProfileField = new Selectbox('codecProfile');
$codecProfileField->addOptions($codecProfileArr);
$codecProfileField->setRequired();
$codecProfileField->setHasInvitation(false);
$this->addElement($codecProfileField->setLabel($language->text('vwvc', 'codecProfile')));
// soundCodec Field
$soundCodecArr = array('Speex' => 'Speex', 'Nellymoser' => 'Nellymoser');
$soundCodecField = new Selectbox('soundCodec');
$soundCodecField->addOptions($soundCodecArr);
$soundCodecField->setRequired();
$soundCodecField->setHasInvitation(false);
$this->addElement($soundCodecField->setLabel($language->text('vwvc', 'soundCodec')));
// p2pGroup Field
$p2pGroupField = new TextField('p2pGroup');
$p2pGroupField->setRequired(true);
$this->addElement($p2pGroupField->setLabel($language->text('vwvc', 'p2pGroup')));
// camMaxBandwidth Field
$camMaxBandwidthField = new TextField('camMaxBandwidth');
$camMaxBandwidthField->setRequired(true);
$this->addElement($camMaxBandwidthField->setLabel($language->text('vwvc', 'camMaxBandwidth')));
// bufferLive Field
$bufferLiveField = new TextField('bufferLive');
$bufferLiveField->setRequired(true);
$this->addElement($bufferLiveField->setLabel($language->text('vwvc', 'bufferLive')));
// bufferFull Field
$bufferFullField = new TextField('bufferFull');
$bufferFullField->setRequired(true);
//.........这里部分代码省略.........