本文整理汇总了PHP中Textarea::setLabel方法的典型用法代码示例。如果您正苦于以下问题:PHP Textarea::setLabel方法的具体用法?PHP Textarea::setLabel怎么用?PHP Textarea::setLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Textarea
的用法示例。
在下文中一共展示了Textarea::setLabel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($name)
{
parent::__construct($name);
$this->setAction(OW::getRouter()->urlForRoute('ocsaffiliates.action_signup'));
$this->setAjax();
$lang = OW::getLanguage();
$affName = new TextField('name');
$affName->setRequired(true);
$affName->setLabel($lang->text('ocsaffiliates', 'affiliate_name'));
$this->addElement($affName);
$email = new TextField('email');
$email->setRequired(true);
$email->setLabel($lang->text('ocsaffiliates', 'email'));
$email->addValidator(new EmailValidator());
$this->addElement($email);
$password = new PasswordField('password');
$password->setRequired(true);
$password->setLabel($lang->text('ocsaffiliates', 'password'));
$this->addElement($password);
$payment = new Textarea('payment');
$payment->setRequired(true);
$payment->setLabel($lang->text('ocsaffiliates', 'payment_details'));
$this->addElement($payment);
if (OW::getConfig()->getValue('ocsaffiliates', 'terms_agreement')) {
$terms = new CheckboxField('terms');
$validator = new RequiredValidator();
$validator->setErrorMessage($lang->text('ocsaffiliates', 'terms_required_msg'));
$terms->addValidator($validator);
$this->addElement($terms);
}
$submit = new Submit('signup');
$submit->setValue($lang->text('ocsaffiliates', 'signup_btn'));
$this->addElement($submit);
$this->bindJsFunction(Form::BIND_SUCCESS, "function(data){\n if ( !data.result ) {\n OW.error(data.error);\n }\n else {\n document.location.reload();\n }\n }");
}
示例2: __construct
public function __construct()
{
parent::__construct('config-form');
$lang = OW::getLanguage();
$months = new Textarea('months');
$months->setRequired(true);
$months->addValidator(new IntValidator(1, 12));
$months->setLabel($lang->text('ocsguests', 'store_period'));
$this->addElement($months);
$submit = new Submit('save');
$submit->setLabel($lang->text('skapi', 'save'));
$this->addElement($submit);
}
示例3: __construct
/**
*
* Class constructor
*
* @param string $name
*
* @access public
*/
public function __construct($name)
{
parent::__construct($name);
$this->setRepeating(true);
$this->setSortable(true);
$this->setLabel(Translate::translate('Gallery'));
$name = new Text('name');
$name->setLabel(Translate::translate('Name'));
$this->addControl($name);
$values = new Textarea('values');
$values->setLabel(Translate::translate('Description'));
$this->addControl($values);
}
示例4: initialize
/**
* Initializes backend form of pages
*/
public function initialize()
{
$lang = new Select('lang', $this->di->get('config')->application->langs->toArray());
$lang->setLabel('Language');
$this->add($lang);
$title = new Text('title');
$title->setLabel('Title');
$title->addValidator(new PresenceOf());
$title->setAttribute('placeholder', 'Title');
$this->add($title);
$content = new Textarea('content');
$content->setLabel('Content');
$content->addValidator(new PresenceOf());
$content->setAttribute('placeholder', 'content');
$this->add($content);
}
示例5: __construct
public function __construct($name, $mode)
{
parent::__construct($name);
$this->setAction(OW::getRouter()->urlForRoute('ocsaffiliates.action_edit'));
$this->setAjax();
$lang = OW::getLanguage();
$idField = new HiddenField('affiliateId');
$this->addElement($idField);
$modeField = new HiddenField('mode');
$modeField->setValue($mode);
$this->addElement($modeField);
if ($mode == 'admin') {
$emailVerified = new CheckboxField('emailVerified');
$emailVerified->setLabel($lang->text('ocsaffiliates', 'email_verified'));
$this->addElement($emailVerified);
$status = new Selectbox('status');
$status->setLabel($lang->text('ocsaffiliates', 'status'));
$status->setHasInvitation(false);
$status->setRequired(true);
$options = array('active' => $lang->text('ocsaffiliates', 'status_active'), 'unverified' => $lang->text('ocsaffiliates', 'status_unverified'));
$status->setOptions($options);
$this->addElement($status);
}
$affName = new TextField('name');
$affName->setRequired(true);
$affName->setLabel($lang->text('ocsaffiliates', 'affiliate_name'));
$this->addElement($affName);
$email = new TextField('email');
$email->setRequired(true);
$email->setLabel($lang->text('ocsaffiliates', 'email'));
$email->addValidator(new EmailValidator());
$this->addElement($email);
$password = new PasswordField('password');
$password->setLabel($lang->text('ocsaffiliates', 'password'));
$this->addElement($password);
$payment = new Textarea('payment');
$payment->setRequired(true);
$payment->setLabel($lang->text('ocsaffiliates', 'payment_details'));
$this->addElement($payment);
$submit = new Submit('save');
$submit->setValue($lang->text('ocsaffiliates', 'edit'));
$this->addElement($submit);
$this->bindJsFunction(Form::BIND_SUCCESS, "function(data){\n if ( !data.result ) {\n OW.error(data.error);\n }\n else {\n document.location.reload();\n }\n }");
}
示例6: __construct
public function __construct(BOL_MenuItem $menuItem, $custom = false)
{
parent::__construct("settingForm");
$this->menuItem = $menuItem;
$language = OW::getLanguage();
$this->setAjax();
$this->setAction(OW::getRouter()->urlFor("ADMIN_CTRL_MobileNavigation", "saveItemSettings"));
$item = new HiddenField("key");
$item->setValue($menuItem->prefix . ':' . $menuItem->key);
$this->addElement($item);
$settings = BOL_MobileNavigationService::getInstance()->getItemSettings($this->menuItem);
// Mail Settings
$item = new TextField(BOL_MobileNavigationService::SETTING_LABEL);
$item->setLabel($language->text("mobile", "admin_nav_item_label_field"));
$item->setValue($settings[BOL_MobileNavigationService::SETTING_LABEL]);
$this->addElement($item);
if ($custom) {
$item = new TextField(BOL_MobileNavigationService::SETTING_TITLE);
$item->setLabel($language->text("mobile", "admin_nav_item_title_field"));
$item->setValue($settings[BOL_MobileNavigationService::SETTING_TITLE]);
$this->addElement($item);
$item = new Textarea(BOL_MobileNavigationService::SETTING_CONTENT);
$item->setLabel($language->text("mobile", "admin_nav_item_content_field"));
$item->setValue($settings[BOL_MobileNavigationService::SETTING_CONTENT]);
$this->addElement($item);
$item = new CheckboxGroup(BOL_MobileNavigationService::SETTING_VISIBLE_FOR);
$visibleFor = empty($settings[BOL_MobileNavigationService::SETTING_VISIBLE_FOR]) ? 0 : $settings[BOL_MobileNavigationService::SETTING_VISIBLE_FOR];
$options = array('1' => OW::getLanguage()->text('admin', 'pages_edit_visible_for_guests'), '2' => OW::getLanguage()->text('admin', 'pages_edit_visible_for_members'));
$values = array();
foreach ($options as $value => $option) {
if (!($value & $visibleFor)) {
continue;
}
$values[] = $value;
}
$this->addElement($item->setOptions($options)->setValue($values)->setLabel(OW::getLanguage()->text('admin', 'pages_edit_local_visible_for')));
}
// submit
$submit = new Submit('save');
$submit->setValue($language->text('admin', 'save_btn_label'));
$this->addElement($submit);
}
示例7: testVerificaSeOsDadosForamInseridos
public function testVerificaSeOsDadosForamInseridos()
{
$textarea = new Textarea();
$textarea->setId("textareaMsg");
$textarea->setName("mensagem");
$textarea->setClass("form-control");
$textarea->setProtected("protected");
$textarea->setLabel("Mensagem");
$textarea->setAlert("Erro no field.");
$textarea->setValue("valor");
$textarea->setRows(2);
$this->assertEquals("textareaMsg", $textarea->getId());
$this->assertEquals("mensagem", $textarea->getName());
$this->assertEquals("form-control", $textarea->getClass());
$this->assertEquals("protected", $textarea->getProtected());
$this->assertEquals("Mensagem", $textarea->getLabel());
$this->assertEquals("Erro no field.", $textarea->getAlert());
$this->assertEquals("valor", $textarea->getValue());
$this->assertEquals(2, $textarea->getRows());
}
示例8: __construct
/**
* Class constructor
*/
public function __construct($clipId)
{
parent::__construct('videoEditForm');
$this->setAjax(true);
$this->setAction(OW::getRouter()->urlFor('GVIDEOVIEWER_CTRL_Index', 'ajaxUpdateVideo'));
$language = OW::getLanguage();
// clip id field
$clipIdField = new HiddenField('id');
$clipIdField->setRequired(true);
$this->addElement($clipIdField);
// title Field
$titleField = new TextField('title');
$titleField->addValidator(new StringValidator(1, 128));
$titleField->setRequired(true);
$this->addElement($titleField->setLabel($language->text('video', 'title')));
// description Field
$descField = new WysiwygTextarea('description');
$descField->setId("video-desc-area");
$this->addElement($descField->setLabel($language->text('video', 'description')));
$code = new Textarea('code');
$code->setRequired(true);
$this->addElement($code->setLabel($language->text('video', 'code')));
$entityTags = BOL_TagService::getInstance()->findEntityTags($clipId, 'video');
if ($entityTags) {
$tags = array();
foreach ($entityTags as $entityTag) {
$tags[] = $entityTag->label;
}
$tagsField = new TagsInputField('tags');
$tagsField->setValue($tags);
} else {
$tagsField = new TagsInputField('tags');
}
$this->addElement($tagsField->setLabel($language->text('video', 'tags')));
$submit = new Submit('edit');
$submit->setValue($language->text('video', 'btn_edit'));
$this->addElement($submit);
}
示例9: __construct
/**
* Class constructor
*
*/
public function __construct($clipId)
{
parent::__construct('vwvrEditForm');
$language = OW::getLanguage();
// clip id field
$clipIdField = new HiddenField('id');
$clipIdField->setRequired(true);
$this->addElement($clipIdField);
// room_name Field
$generated = base_convert(time() - 1224000000 . rand(0, 10), 10, 36);
$room_nameField = new TextField('room_name');
$sValidator = new StringValidator(1, 22);
$room_nameField->addValidator($sValidator);
$room_nameField->setRequired(true);
$room_nameField->setValue($generated);
$this->addElement($room_nameField->setLabel($language->text('vwvr', 'room_name')));
// Description Field
$descriptionField = new Textarea('description');
$this->addElement($descriptionField->setLabel($language->text('vwvr', 'description')));
$entityTags = BOL_TagService::getInstance()->findEntityTags($clipId, 'vwvr');
if ($entityTags) {
$tags = array();
foreach ($entityTags as $entityTag) {
$tags[] = $entityTag->label;
}
$tagsField = new TagsField('tags', $tags);
} else {
$tagsField = new TagsField('tags');
}
$this->addElement($tagsField->setLabel($language->text('vwvr', 'tags')));
$submit = new Submit('edit');
$submit->setValue($language->text('vwvr', 'btn_edit'));
$this->addElement($submit);
}
示例10: __construct
/**
* Class constructor
*
*/
public function __construct()
{
parent::__construct('videoAddForm');
$language = OW::getLanguage();
// title Field
$titleField = new TextField('title');
$titleField->setRequired(true);
$this->addElement($titleField->setLabel($language->text('video', 'title')));
// description Field
$descField = new WysiwygTextarea('description');
$this->addElement($descField->setLabel($language->text('video', 'description')));
// code Field
$codeField = new Textarea('code');
$codeField->setRequired(true);
$this->addElement($codeField->setLabel($language->text('video', 'code')));
$tagsField = new TagsInputField('tags');
$this->addElement($tagsField->setLabel($language->text('video', 'tags')));
$submit = new Submit('add');
$submit->setValue($language->text('video', 'btn_add'));
$this->addElement($submit);
}
示例11: __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);
//.........这里部分代码省略.........
示例12: page
public function page()
{
if (!OW::getRequest()->isAjax()) {
OW::getNavigation()->activateMenuItem(OW_Navigation::ADMIN_SETTINGS, 'admin', 'sidebar_menu_item_main_settings');
}
$language = OW::getLanguage();
$menu = $this->getMenu();
$this->addComponent('menu', $menu);
if (!OW::getRequest()->isAjax()) {
OW::getDocument()->setHeading(OW::getLanguage()->text('admin', 'heading_page_settings'));
OW::getDocument()->setHeadingIconClass('ow_ic_file');
}
$form = new Form('page_settings');
$form->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA);
$this->addForm($form);
$headCode = new Textarea('head_code');
$headCode->setLabel($language->text('admin', 'page_settings_form_headcode_label'));
$headCode->setDescription($language->text('admin', 'page_settings_form_headcode_desc'));
$form->addElement($headCode);
$bottomCode = new Textarea('bottom_code');
$bottomCode->setLabel($language->text('admin', 'page_settings_form_bottomcode_label'));
$bottomCode->setDescription($language->text('admin', 'page_settings_form_bottomcode_desc'));
$form->addElement($bottomCode);
$favicon = new FileField('favicon');
$favicon->setLabel($language->text('admin', 'page_settings_form_favicon_label'));
$favicon->setDescription($language->text('admin', 'page_settings_form_favicon_desc'));
$form->addElement($favicon);
$enableFavicon = new CheckboxField('enable_favicon');
$form->addElement($enableFavicon);
$submit = new Submit('save');
$submit->setValue($language->text('admin', 'save_btn_label'));
$form->addElement($submit);
$faviconPath = OW::getPluginManager()->getPlugin('base')->getUserFilesDir() . 'favicon.ico';
$faviconUrl = OW::getPluginManager()->getPlugin('base')->getUserFilesUrl() . 'favicon.ico';
$this->assign('faviconSrc', $faviconUrl);
if (OW::getRequest()->isPost()) {
if ($form->isValid($_POST)) {
$data = $form->getValues();
OW::getConfig()->saveConfig('base', 'html_head_code', $data['head_code']);
OW::getConfig()->saveConfig('base', 'html_prebody_code', $data['bottom_code']);
if (!empty($_FILES['favicon']['name'])) {
if ((int) $_FILES['favicon']['error'] === 0 && is_uploaded_file($_FILES['favicon']['tmp_name']) && UTIL_File::getExtension($_FILES['favicon']['name']) === 'ico') {
if (file_exists($faviconPath)) {
@unlink($faviconPath);
}
@move_uploaded_file($_FILES['favicon']['tmp_name'], $faviconPath);
if (file_exists($_FILES['favicon']['tmp_name'])) {
@unlink($_FILES['favicon']['tmp_name']);
}
} else {
OW::getFeedback()->error($language->text('admin', 'page_settings_favicon_submit_error_message'));
}
}
OW::getConfig()->saveConfig('base', 'favicon', !empty($data['enable_favicon']));
OW::getFeedback()->info($language->text('admin', 'settings_submit_success_message'));
} else {
OW::getFeedback()->error($language->text('admin', 'settings_submit_error_message'));
}
$this->redirect();
}
$headCode->setValue(OW::getConfig()->getValue('base', 'html_head_code'));
$bottomCode->setValue(OW::getConfig()->getValue('base', 'html_prebody_code'));
$enableFavicon->setValue((int) OW::getConfig()->getValue('base', 'favicon'));
$this->assign('faviconEnabled', OW::getConfig()->getValue('base', 'favicon'));
$script = "\$('#{$enableFavicon->getId()}').change(function(){ if(this.checked){ \$('#favicon_enabled').show();\$('#favicon_desabled').hide(); \$('{$favicon->getId()}').attr('disabled', true);}else{ \$('#favicon_enabled').hide();\$('#favicon_desabled').show(); \$('{$favicon->getId()}').attr('disabled', false);} });";
OW::getDocument()->addOnloadScript($script);
}
示例13: __construct
/**
* Class constructor
*
*/
public function __construct()
{
parent::__construct('configSaveForm');
$language = OW::getLanguage();
// select box for permission
$arr1 = array('1' => 'yes', '0' => 'no');
// Record path Field
$record_limitPath = new TextField('record_path');
$record_limitPath->setRequired(false);
$this->addElement($record_limitPath->setLabel($language->text('vwvr', 'record_path')));
// Record limit Field
$record_limitField = new TextField('record_limit');
$record_limitField->setRequired(false);
$this->addElement($record_limitField->setLabel($language->text('vwvr', 'record_limit')));
// Show Camera Settings Field
$show_camera_settingsField = new Selectbox('show_camera_settings');
$show_camera_settingsField->addOptions($arr1);
$show_camera_settingsField->setRequired();
$show_camera_settingsField->setHasInvitation(false);
$this->addElement($show_camera_settingsField->setLabel($language->text('vwvr', 'show_camera_settings')));
// Advanced Camera Settings Field
$advanced_camera_settingsField = new Selectbox('advanced_camera_settings');
$advanced_camera_settingsField->addOptions($arr1);
$advanced_camera_settingsField->setRequired();
$advanced_camera_settingsField->setHasInvitation(false);
$this->addElement($advanced_camera_settingsField->setLabel($language->text('vwvr', 'advanced_camera_settings')));
// resolution Field
$resolutionArr = array('320x240' => '320x240', '160x120' => '160x120', '176x144' => '176x144', '352x288' => '352x288', '640x480' => '640x480');
$resolutionField = new Selectbox('resolution');
$resolutionField->addOptions($resolutionArr);
$resolutionField->setRequired();
$resolutionField->setHasInvitation(false);
$this->addElement($resolutionField->setLabel($language->text('vwvr', 'resolution')));
// camera_fps Field
$camera_fpsArr = array('10' => '10', '12' => '12', '20' => '20', '25' => '25', '30' => '30');
$camera_fpsField = new Selectbox('camera_fps');
$camera_fpsField->addOptions($camera_fpsArr);
$camera_fpsField->setRequired();
$camera_fpsField->setHasInvitation(false);
$this->addElement($camera_fpsField->setLabel($language->text('vwvr', 'camera_fps')));
// Microphone Rate Field
$microphone_rateArr = array('11' => '11', '22' => '22', '44' => '44', '48' => '48');
$microphone_rateField = new Selectbox('microphone_rate');
$microphone_rateField->addOptions($microphone_rateArr);
$microphone_rateField->setRequired();
$microphone_rateField->setHasInvitation(false);
$this->addElement($microphone_rateField->setLabel($language->text('vwvr', 'microphone_rate')));
// Bandwidth Field
$bandwidthField = new TextField('bandwidth');
$bandwidthField->setRequired(true);
$this->addElement($bandwidthField->setLabel($language->text('vwvr', 'bandwidth')));
// Layout Code Field
$layout_codeField = new Textarea('layout_code');
$this->addElement($layout_codeField->setLabel($language->text('vwvr', 'layout_code')));
// Fill window Field
$fill_windowField = new Selectbox('fill_window');
$fill_windowField->addOptions($arr1);
$fill_windowField->setRequired();
$fill_windowField->setHasInvitation(false);
$this->addElement($fill_windowField->setLabel($language->text('vwvr', 'fill_window')));
// baseSwf_url Field
$baseSwf_urlField = new TextField('baseSwf_url');
$baseSwf_urlField->addAttribute('readonly', 'readonly');
$this->addElement($baseSwf_urlField->setLabel($language->text('vwvr', 'baseSwf_url')));
// server Field
$serverField = new TextField('server');
$serverField->setRequired(true);
$this->addElement($serverField->setLabel($language->text('vwvr', 'server')));
// serverAMF Field
$serverAMFField = new TextField('serverAMF');
$serverAMFField->setRequired(true);
$this->addElement($serverAMFField->setLabel($language->text('vwvr', 'serverAMF')));
// videoCodec Field
$videoCodecField = new TextField('videoCodec');
$videoCodecField->setRequired(true);
$this->addElement($videoCodecField->setLabel($language->text('vwvr', 'videoCodec')));
// codecLevel Field
$codecLevelField = new TextField('codecLevel');
$codecLevelField->setRequired(true);
$this->addElement($codecLevelField->setLabel($language->text('vwvr', 'codecLevel')));
// soundQuality Field
$soundQualityField = new TextField('soundQuality');
$soundQualityField->setRequired(true);
$this->addElement($soundQualityField->setLabel($language->text('vwvr', 'soundQuality')));
// 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('vwvr', 'codecProfile')));
// soundCodec Field
$soundCodecArr = array('Speex' => 'Speex', 'Nellymoser' => 'Nellymoser');
$soundCodecField = new Selectbox('soundCodec');
$soundCodecField->addOptions($soundCodecArr);
$soundCodecField->setRequired();
//.........这里部分代码省略.........
示例14: index
public function index()
{
$this->setPageTitle(OW::getLanguage()->text('contactus', 'index_page_title'));
$this->setPageHeading(OW::getLanguage()->text('contactus', 'index_page_heading'));
$contactEmails = array();
$contacts = CONTACTUS_BOL_Service::getInstance()->getDepartmentList();
foreach ($contacts as $contact) {
/* @var $contact CONTACTUS_BOL_Department */
$contactEmails[$contact->id]['label'] = CONTACTUS_BOL_Service::getInstance()->getDepartmentLabel($contact->id);
$contactEmails[$contact->id]['email'] = $contact->email;
}
$form = new Form('contact_form');
$fieldTo = new Selectbox('to');
foreach ($contactEmails as $id => $value) {
$fieldTo->addOption($id, $value['label']);
}
$fieldTo->setRequired();
$fieldTo->setHasInvitation(false);
$fieldTo->setLabel($this->text('contactus', 'form_label_to'));
$form->addElement($fieldTo);
$fieldFrom = new TextField('from');
$fieldFrom->setLabel($this->text('contactus', 'form_label_from'));
$fieldFrom->setRequired();
$fieldFrom->addValidator(new EmailValidator());
if (ow::getUser()->isAuthenticated()) {
$fieldFrom->setValue(OW::getUser()->getEmail());
}
$form->addElement($fieldFrom);
$fieldSubject = new TextField('subject');
$fieldSubject->setLabel($this->text('contactus', 'form_label_subject'));
$fieldSubject->setRequired();
$form->addElement($fieldSubject);
$fieldMessage = new Textarea('message');
$fieldMessage->setLabel($this->text('contactus', 'form_label_message'));
$fieldMessage->setRequired();
$form->addElement($fieldMessage);
$fieldCaptcha = new CaptchaField('captcha');
$fieldCaptcha->setLabel($this->text('contactus', 'form_label_captcha'));
$form->addElement($fieldCaptcha);
$submit = new Submit('send');
$submit->setValue($this->text('contactus', 'form_label_submit'));
$form->addElement($submit);
$this->addForm($form);
if (OW::getRequest()->isPost()) {
if ($form->isValid($_POST)) {
$data = $form->getValues();
if (!array_key_exists($data['to'], $contactEmails)) {
OW::getFeedback()->error($this->text('contactus', 'no_department'));
return;
}
$mail = OW::getMailer()->createMail();
$mail->addRecipientEmail($contactEmails[$data['to']]['email']);
$mail->setSender($data['from']);
$mail->setSenderSuffix(false);
$mail->setSubject($data['subject']);
$mail->setTextContent($data['message']);
OW::getMailer()->addToQueue($mail);
OW::getSession()->set('contactus.dept', $contactEmails[$data['to']]['label']);
$this->redirectToAction('sent');
}
}
}
示例15: __construct
public function __construct(BOL_MenuItem $menuItem, $custom = false, $addUrlValidator = true)
{
parent::__construct("settingForm");
$this->menuItem = $menuItem;
$language = OW::getLanguage();
$this->setAjax();
$this->setAction(OW::getRouter()->urlFor("ADMIN_CTRL_MobileNavigation", "saveItemSettings"));
$item = new HiddenField("key");
$item->setValue($menuItem->prefix . ':' . $menuItem->key);
$this->addElement($item);
$settings = BOL_MobileNavigationService::getInstance()->getItemSettings($this->menuItem);
// Mail Settings
$item = new TextField(BOL_MobileNavigationService::SETTING_LABEL);
$item->setLabel($language->text("mobile", "admin_nav_item_label_field"));
$item->setValue($settings[BOL_MobileNavigationService::SETTING_LABEL]);
$item->setRequired();
$this->addElement($item);
if ($custom) {
$typeField = new RadioField(BOL_MobileNavigationService::SETTING_TYPE);
$typeField->setLabel($language->text("mobile", "admin_nav_item_type_field"));
$typeField->setValue($settings[BOL_MobileNavigationService::SETTING_TYPE]);
$typeField->addOption("local", $language->text("mobile", "admin_nav_item_type_local"));
$typeField->addOption("external", $language->text("mobile", "admin_nav_item_type_external"));
$this->addElement($typeField);
$item = new TextField(BOL_MobileNavigationService::SETTING_TITLE);
$item->setLabel($language->text("mobile", "admin_nav_item_title_field"));
$item->setValue($settings[BOL_MobileNavigationService::SETTING_TITLE]);
$item->setRequired();
$this->addElement($item);
$item = new Textarea(BOL_MobileNavigationService::SETTING_CONTENT);
$item->setLabel($language->text("mobile", "admin_nav_item_content_field"));
$item->setValue($settings[BOL_MobileNavigationService::SETTING_CONTENT]);
$this->addElement($item);
$item = new TextField(BOL_MobileNavigationService::SETTING_URL);
if ($addUrlValidator) {
$item->addValidator(new UrlValidator());
$item->setRequired();
}
$item->setLabel($language->text("mobile", "admin_nav_item_url_field"));
$item->setValue($settings[BOL_MobileNavigationService::SETTING_URL]);
$this->addElement($item);
$item = new CheckboxGroup(BOL_MobileNavigationService::SETTING_VISIBLE_FOR);
$visibleFor = empty($settings[BOL_MobileNavigationService::SETTING_VISIBLE_FOR]) ? 0 : $settings[BOL_MobileNavigationService::SETTING_VISIBLE_FOR];
$options = array('1' => OW::getLanguage()->text('admin', 'pages_edit_visible_for_guests'), '2' => OW::getLanguage()->text('admin', 'pages_edit_visible_for_members'));
$values = array();
foreach ($options as $value => $option) {
if (!($value & $visibleFor)) {
continue;
}
$values[] = $value;
}
$this->addElement($item->setOptions($options)->setValue($values)->setLabel(OW::getLanguage()->text('admin', 'pages_edit_local_visible_for')));
$js = UTIL_JsGenerator::newInstance();
$js->addScript('var url = owForms[{$name}].elements["url"]; var validators = url.validators; url.validators = []; $("input[name=type]", "#" + {$id}).change(function() { ' . 'if ($(this).val() == "local") { ' . '$("#mp-content").show(); $("#mp-url").hide(); url.validators = []; ' . '} else { ' . '$("#mp-content").hide(); $("#mp-url").show(); url.validators = validators; } ' . '});', array("id" => $this->getId(), "name" => $this->getName()));
OW::getDocument()->addOnloadScript($js);
}
// submit
$submit = new Submit('save');
$submit->setValue($language->text('admin', 'save_btn_label'));
$this->addElement($submit);
}