当前位置: 首页>>代码示例>>PHP>>正文


PHP Submit::addAttribute方法代码示例

本文整理汇总了PHP中Submit::addAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP Submit::addAttribute方法的具体用法?PHP Submit::addAttribute怎么用?PHP Submit::addAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Submit的用法示例。


在下文中一共展示了Submit::addAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 public function index($params = array())
 {
     $userService = BOL_UserService::getInstance();
     $language = OW::getLanguage();
     $this->setPageHeading($language->text('hotlist', 'admin_heading_settings'));
     $this->setPageHeadingIconClass('ow_ic_gear_wheel');
     $settingsForm = new Form('settingsForm');
     $settingsForm->setId('settingsForm');
     $expiration_time = new TextField('expiration_time');
     $expiration_time->setRequired();
     $expiration_time->setLabel($language->text('hotlist', 'label_expiration_time'));
     $expiration_time_value = (int) OW::getConfig()->getValue('hotlist', 'expiration_time') / 86400;
     $expiration_time->setValue($expiration_time_value);
     $settingsForm->addElement($expiration_time);
     $submit = new Submit('save');
     $submit->addAttribute('class', 'ow_ic_save');
     $submit->setValue($language->text('hotlist', 'label_save_btn_label'));
     $settingsForm->addElement($submit);
     $this->addForm($settingsForm);
     if (OW::getRequest()->isPost()) {
         if ($settingsForm->isValid($_POST)) {
             $data = $settingsForm->getValues();
             OW::getConfig()->saveConfig('hotlist', 'expiration_time', $data['expiration_time'] * 86400);
             OW::getFeedback()->info($language->text('hotlist', 'settings_saved'));
             $this->redirect();
         }
     }
 }
开发者ID:hardikamutech,项目名称:loov,代码行数:28,代码来源:admin.php

示例2: __construct

 public function __construct($ctrl)
 {
     parent::__construct('settings-form');
     $configs = OW::getConfig()->getValues('yncontactimporter');
     $ctrl->assign('configs', $configs);
     $l = OW::getLanguage();
     $miValidator = new IntValidator(1, 999);
     $miValidator->setErrorMessage($l->text('yncontactimporter', 'max_validation_error', array('min' => 1, 'max' => 999)));
     //Contacts per page
     $textField['contact_per_page'] = new TextField('contact_per_page');
     $textField['contact_per_page']->setLabel($l->text('yncontactimporter', 'settings_contact_per_page'))->setValue($configs['contact_per_page'])->addValidator($miValidator)->setRequired(true);
     $this->addElement($textField['contact_per_page']);
     //Maximum invite per times
     $textField['max_invite_per_times'] = new TextField('max_invite_per_times');
     $textField['max_invite_per_times']->setLabel($l->text('yncontactimporter', 'settings_max_invite_per_times'))->setValue($configs['max_invite_per_times'])->addValidator($miValidator)->setRequired(true);
     $this->addElement($textField['max_invite_per_times']);
     //Default invite message
     $textField['default_invite_message'] = new Textarea('default_invite_message');
     $textField['default_invite_message']->setLabel($l->text('yncontactimporter', 'settings_default_invite_message'))->setValue($configs['default_invite_message']);
     $this->addElement($textField['default_invite_message']);
     // Logo width
     $textField['logo_width'] = new TextField('logo_width');
     $textField['logo_width']->setLabel($l->text('yncontactimporter', 'settings_logo_width'))->setValue($configs['logo_width'])->addValidator($miValidator)->setRequired(true);
     $this->addElement($textField['logo_width']);
     // Logo Height
     $textField['logo_height'] = new TextField('logo_height');
     $textField['logo_height']->setLabel($l->text('yncontactimporter', 'settings_logo_height'))->setValue($configs['logo_height'])->addValidator($miValidator)->setRequired(true);
     $this->addElement($textField['logo_height']);
     $submit = new Submit('submit');
     $submit->setValue($l->text('yncontactimporter', 'save_btn_label'));
     $submit->addAttribute('class', 'ow_ic_save ow_positive');
     $this->addElement($submit);
 }
开发者ID:vazahat,项目名称:dudex,代码行数:33,代码来源:settings_form.php

示例3: __construct

 public function __construct($name, $senderId, $context = MCOMPOSE_BOL_Service::CONTEXT_USER, $initJs = true, $inPopup = true)
 {
     parent::__construct($name);
     $language = OW::getLanguage();
     $this->userId = $senderId;
     $this->context = $context;
     $this->setAction(OW::getRouter()->urlFor('MCOMPOSE_CTRL_Compose', 'send', array('userId' => $senderId, 'formName' => $this->getName())));
     $this->setMethod(self::METHOD_POST);
     $this->setId($this->getName());
     $this->setEnctype('multipart/form-data');
     $this->setAjax();
     $this->setAjaxResetOnSuccess(false);
     $to = new MCOMPOSE_CLASS_UserSelectField('recipients', OW::getLanguage()->text('mcompose', 'selector_invitation_label'));
     $to->setRequired();
     $this->addElement($to);
     //thickbox
     $validatorSubject = new StringValidator(0, 2048);
     $validatorSubject->setErrorMessage($language->text('mailbox', 'message_too_long_error', array('maxLength' => 2048)));
     $subject = new TextField('subject');
     $subject->setInvitation('Subject');
     $subject->setHasInvitation(true);
     $subject->setLabel($language->text('mailbox', 'subject'))->addAttribute('class', 'ow_text');
     $subject->addValidator($validatorSubject);
     $subject->setRequired(true);
     $this->addElement($subject);
     $validatorTextarea = new StringValidator(0, 24000);
     $validatorTextarea->setErrorMessage($language->text('mailbox', 'message_too_long_error', array('maxLength' => 24000)));
     $message = new WysiwygTextarea('message', array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_VIDEO), true);
     $message->setLabel($language->text('mailbox', 'text'))->addAttribute('class', 'ow_text');
     $message->setSize(300);
     $message->addValidator($validatorTextarea);
     $message->setRequired(true);
     $this->addElement($message);
     if (OW::getConfig()->getValue('mailbox', 'enable_attachments')) {
         $multiUpload = new MAILBOX_CLASS_AjaxFileUpload('attachments');
         //$multiUpload->setId('attachments');
         $this->addElement($multiUpload);
     }
     // Captcha
     $captcha = new MailboxCaptchaField('captcha');
     $captcha->addValidator(new MailboxCaptchaValidator($captcha->getId()));
     $captcha->addAttribute('disabled', 'disabled');
     $this->addElement($captcha);
     $submit = new Submit('send');
     $submit->setValue($language->text('mailbox', 'send_button'));
     $submit->addAttribute('class', 'ow_button ow_ic_mail');
     $this->addElement($submit);
     if ($initJs) {
         $js = "owForms['" . $this->getName() . "'].bind( 'success',\n            function( json )\n            {\n                var _complete = function(){ \n                    if ( _scope.floatBox ) _scope.floatBox.close();\n                };\n\n                var form = \$('#" . $this->getName() . "');\n                var captcha = form.find('input[name=captcha]');\n\n                if ( json.result == 'permission_denied' )\n                {\n                    if ( json.message )\n                    {\n                        OW.error(json.message);\n                    }\n                    else\n                    {\n                        OW.error(" . json_encode(OW::getLanguage()->text('mailbox', 'write_permission_denied')) . ");\n                    }\n                    \n                    _complete();\n                }\n                else if ( json.result == 'display_captcha' )\n            \t{\n                   window." . $captcha->jsObjectName . ".refresh();\n\n                   if ( captcha.attr('disabled') != 'disabled' )\n                   {\n                        owForms['" . $this->getName() . "'].getElement('captcha').showError(" . json_encode(OW::getLanguage()->text('base', 'form_validator_captcha_error_message')) . ");\n                   }\n                   else\n                   {\n                        captcha.removeAttr('disabled');\n                   }\n\n                   form.find('tr.captcha').show();\n                   form.find('tr.mailbox_conversation').hide();\n                }\n                else if ( json.result == true )\n            \t{\n                    captcha.attr('disabled','disabled');\n                    form.find('tr.captcha').hide();\n                    window." . $captcha->jsObjectName . ".refresh();\n\n                    form.find('tr.captcha').hide();\n                    form.find('tr.mailbox_conversation').show();\n\n                    owForms['" . $this->getName() . "'].resetForm();\n                    form.find('textarea[name=message]').get(0).htmlareaRefresh();\n\n                    if ( json.error )\n                        OW.error(json.error);\n\n                    if ( json.warning )\n                        OW.warning(json.warning);\n\n                     if ( json.message )\n                        OW.info(json.message);\n                        \n                    _complete();\n                }\n                else if ( json.error )\n                {\n                    OW.error(json.error);\n                    \n                    _complete();\n                }\n\n            }); ";
         OW::getDocument()->addOnloadScript($js);
     }
 }
开发者ID:vazahat,项目名称:dudex,代码行数:52,代码来源:form.php

示例4: __construct

 public function __construct($entityType, $entityId, $url = NULL)
 {
     parent::__construct('ajax-upload');
     $this->clipService = VIDEO_BOL_ClipService::getInstance();
     $this->setAjax(TRUE);
     $this->setAjaxResetOnSuccess(FALSE);
     //$this->setAjaxDataType(Form::AJAX_DATA_TYPE_JSON);
     $this->setAction(OW::getRouter()->urlForRoute('spvideolite.ajax_video_add_submit'));
     $this->bindJsFunction('success', UTIL_JsGenerator::composeJsString('function( data )
         {
             if ( data )
             {
                 if ( !data.result )
                 {
                     if ( data.msg )
                     {
                         OW.error(data.msg);
                     }
                     else
                     {
                         OW.getLanguageText("spvideolite", "video_add_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();
     $userId = OW::getUser()->getId();
     $submit = new Submit('submit');
     $submit->addAttribute('class', 'ow_ic_submit ow_positive');
     $this->addElement($submit);
 }
开发者ID:mohamedveto,项目名称:spvideolite,代码行数:48,代码来源:ajax_upload_form.php

示例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('admin.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("admin", "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)));
     $submit = new Submit('submit');
     $submit->addAttribute('class', 'ow_ic_submit ow_positive');
     $this->addElement($submit);
 }
开发者ID:ZyXelP,项目名称:oxwall,代码行数:44,代码来源:ajax_upload_form.php

示例6: 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'));
             }
         }
     }
 }
开发者ID:vazahat,项目名称:dudex,代码行数:36,代码来源:restricted_usernames.php

示例7: __construct

 public function __construct($controller)
 {
     parent::__construct('joinForm');
     $this->setId('joinForm');
     $stamp = OW::getSession()->get(self::SESSION_START_STAMP);
     if (empty($stamp)) {
         OW::getSession()->set(self::SESSION_START_STAMP, time());
     }
     unset($stamp);
     $this->checkSession();
     $joinSubmitLabel = "";
     // get available account types from DB
     $accounts = $this->getAccountTypes();
     $joinData = OW::getSession()->get(self::SESSION_JOIN_DATA);
     if (!isset($joinData) || !is_array($joinData)) {
         $joinData = array();
     }
     $accountsKeys = array_keys($accounts);
     $this->accountType = $accountsKeys[0];
     if (isset($joinData['accountType'])) {
         $this->accountType = trim($joinData['accountType']);
     }
     $step = $this->getStep();
     if (count($accounts) > 1) {
         $this->stepCount = 2;
         switch ($step) {
             case 1:
                 $this->displayAccountType = true;
                 $joinSubmitLabel = OW::getLanguage()->text('base', 'join_submit_button_continue');
                 break;
             case 2:
                 $this->isLastStep = true;
                 $joinSubmitLabel = OW::getLanguage()->text('base', 'join_submit_button_join');
                 break;
         }
     } else {
         $this->isLastStep = true;
         $joinSubmitLabel = OW::getLanguage()->text('base', 'join_submit_button_join');
     }
     $joinSubmit = new Submit('joinSubmit');
     $joinSubmit->addAttribute('class', 'ow_button ow_ic_submit');
     $joinSubmit->setValue($joinSubmitLabel);
     $this->addElement($joinSubmit);
     $this->init($accounts);
     $this->getQuestions();
     $section = null;
     $questionNameList = array();
     $this->sortedQuestionsList = array();
     foreach ($this->questions as $sort => $question) {
         if ((string) $question['base'] === '0' && $step === 2 || $step === 1) {
             if ($section !== $question['sectionName']) {
                 $section = $question['sectionName'];
             }
             //$this->questionListBySection[$section][] = $this->questions[$sort];
             $questionNameList[] = $this->questions[$sort]['name'];
             $this->sortedQuestionsList[] = $this->questions[$sort];
         }
     }
     $this->questionValuesList = BOL_QuestionService::getInstance()->findQuestionsValuesByQuestionNameList($questionNameList);
     $this->addFakeQuestions();
     $this->addQuestions($this->sortedQuestionsList, $this->questionValuesList, $this->updateJoinData());
     $this->setQuestionsLabel();
     $this->addClassToBaseQuestions();
     if ($this->isLastStep) {
         $this->addLastStepQuestions($controller);
     }
     $controller->assign('step', $step);
     $controller->assign('questionArray', $this->questionListBySection);
     $controller->assign('displayAccountType', $this->displayAccountType);
     $controller->assign('isLastStep', $this->isLastStep);
 }
开发者ID:ZyXelP,项目名称:oxwall,代码行数:71,代码来源:join.php

示例8: view

 public function view(array $params = array())
 {
     OW::getDocument()->addStyleSheet(OW::getPluginManager()->getPlugin('photo')->getStaticCssUrl() . 'admin.css');
     OW::getDocument()->addOnloadScript(';window.photoAdmin.init();');
     $form = new Form('view-mode');
     $form->setAjax(TRUE);
     $form->bindJsFunction('success', 'function(data)
     {
         if ( data && data.result )
         {
             OW.info(data.msg);
         }
     }');
     if (OW::getRequest()->isPost()) {
         OW::getConfig()->saveConfig('photo', 'photo_list_view_classic', (bool) $_POST['photo-list-mode']);
         OW::getConfig()->saveConfig('photo', 'album_list_view_classic', (bool) $_POST['album-list-mode']);
         OW::getConfig()->saveConfig('photo', 'photo_view_classic', (bool) $_POST['photo-view-mode']);
         exit(json_encode(array('result' => true, 'msg' => OW::getLanguage()->text('photo', 'settings_updated'))));
     }
     $photoListMode = new HiddenField('photo-list-mode');
     $photoListMode->setValue(OW::getConfig()->getValue('photo', 'photo_list_view_classic'));
     $form->addElement($photoListMode);
     $albumListMode = new HiddenField('album-list-mode');
     $albumListMode->setValue(OW::getConfig()->getValue('photo', 'album_list_view_classic'));
     $form->addElement($albumListMode);
     $photoViewMode = new HiddenField('photo-view-mode');
     $photoViewMode->setValue(OW::getConfig()->getValue('photo', 'photo_view_classic'));
     $form->addElement($photoViewMode);
     $submit = new Submit('save');
     $submit->addAttribute('class', 'ow_ic_save ow_positive');
     $submit->setValue(OW::getLanguage()->text('photo', 'btn_edit'));
     $form->addElement($submit);
     $this->addForm($form);
 }
开发者ID:hardikamutech,项目名称:hammu,代码行数:34,代码来源:admin.php

示例9: __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);
 }
开发者ID:hardikamutech,项目名称:loov,代码行数:83,代码来源:ajax_upload_form.php

示例10: fillRequiredQuestions

 public function fillRequiredQuestions($params)
 {
     if (!OW::getUser()->isAuthenticated()) {
         throw new AuthenticateException();
     }
     $user = OW::getUser()->getUserObject();
     $accountType = BOL_QuestionService::getInstance()->findAccountTypeByName($user->accountType);
     if (empty($accountType)) {
         throw new Redirect404Exception();
     }
     $language = OW::getLanguage();
     $event = new OW_Event(OW_EventManager::ON_BEFORE_USER_COMPLETE_PROFILE, array('user' => $user));
     OW::getEventManager()->trigger($event);
     // -- Edit form --
     $form = new EditQuestionForm('requiredQuestionsForm', $user->id);
     $form->setId('requiredQuestionsForm');
     $editSubmit = new Submit('submit');
     $editSubmit->addAttribute('class', 'ow_button ow_ic_save');
     $editSubmit->setValue($language->text('base', 'continue_button'));
     $form->addElement($editSubmit);
     $questions = $this->questionService->getEmptyRequiredQuestionsList($user->id);
     if (empty($questions)) {
         $this->redirect(OW::getRouter()->urlForRoute('base_default_index'));
     }
     $section = null;
     $questionArray = array();
     $questionNameList = array();
     foreach ($questions as $sort => $question) {
         if ($section !== $question['sectionName']) {
             $section = $question['sectionName'];
         }
         $questionArray[$section][$sort] = $questions[$sort];
         $questionNameList[] = $questions[$sort]['name'];
     }
     $this->assign('questionArray', $questionArray);
     //$questionData = $this->questionService->getQuestionData(array($user->id), $questionNameList);
     $questionValues = $this->questionService->findQuestionsValuesByQuestionNameList($questionNameList);
     $form->addQuestions($questions, $questionValues, array());
     if (OW::getRequest()->isPost()) {
         if ($form->isValid($_POST)) {
             $this->saveRequiredQuestionsData($form->getValues(), $user->id);
         }
     } else {
         OW::getDocument()->addOnloadScript(" OW.info(" . json_encode(OW::getLanguage()->text('base', 'complete_profile_info')) . ") ");
     }
     $this->addForm($form);
     $language->addKeyForJs('base', 'join_error_username_not_valid');
     $language->addKeyForJs('base', 'join_error_username_already_exist');
     $language->addKeyForJs('base', 'join_error_email_not_valid');
     $language->addKeyForJs('base', 'join_error_email_already_exist');
     $language->addKeyForJs('base', 'join_error_password_not_valid');
     $language->addKeyForJs('base', 'join_error_password_too_short');
     $language->addKeyForJs('base', 'join_error_password_too_long');
     //include js
     $onLoadJs = " window.edit = new OW_BaseFieldValidators( " . json_encode(array('formName' => $form->getName(), 'responderUrl' => OW::getRouter()->urlFor("BASE_CTRL_Edit", "ajaxResponder"))) . ",\n                " . UTIL_Validator::EMAIL_PATTERN . ", " . UTIL_Validator::USER_NAME_PATTERN . ", " . $user->id . " ); ";
     OW::getDocument()->addOnloadScript($onLoadJs);
     $jsDir = OW::getPluginManager()->getPlugin("base")->getStaticJsUrl();
     OW::getDocument()->addScript($jsDir . "base_field_validators.js");
 }
开发者ID:hardikamutech,项目名称:loov,代码行数:59,代码来源:complete_profile.php

示例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));
    }
开发者ID:tammyrocks,项目名称:photo,代码行数:80,代码来源:ajax_upload_form.php

示例12: __construct

 public function __construct(Post $post, $tags = array())
 {
     parent::__construct('save');
     $this->service = PostService::getInstance();
     $this->post = $post;
     $this->setMethod('post');
     $titleTextField = new TextField('title');
     $this->addElement($titleTextField->setLabel(OW::getLanguage()->text('blogs', 'save_form_lbl_title'))->setValue($post->getTitle())->setRequired(true));
     $buttons = array(BOL_TextFormatService::WS_BTN_BOLD, BOL_TextFormatService::WS_BTN_ITALIC, BOL_TextFormatService::WS_BTN_UNDERLINE, BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_LINK, BOL_TextFormatService::WS_BTN_ORDERED_LIST, BOL_TextFormatService::WS_BTN_UNORDERED_LIST, BOL_TextFormatService::WS_BTN_MORE, BOL_TextFormatService::WS_BTN_SWITCH_HTML, BOL_TextFormatService::WS_BTN_HTML, BOL_TextFormatService::WS_BTN_VIDEO);
     $postTextArea = new WysiwygTextarea('post', $buttons);
     $postTextArea->setSize(WysiwygTextarea::SIZE_L);
     $postTextArea->setLabel(OW::getLanguage()->text('blogs', 'save_form_lbl_post'));
     $postTextArea->setValue($post->getPost());
     $postTextArea->setRequired(true);
     $this->addElement($postTextArea);
     $draftSubmit = new Submit('draft');
     $draftSubmit->addAttribute('onclick', "\$('#save_post_command').attr('value', 'draft');");
     if ($post->getId() != null && !$post->isDraft()) {
         $text = OW::getLanguage()->text('blogs', 'change_status_draft');
     } else {
         $text = OW::getLanguage()->text('blogs', 'sava_draft');
     }
     $this->addElement($draftSubmit->setValue($text));
     if ($post->getId() != null && !$post->isDraft()) {
         $text = OW::getLanguage()->text('blogs', 'update');
     } else {
         $text = OW::getLanguage()->text('blogs', 'save_publish');
     }
     $publishSubmit = new Submit('publish');
     $publishSubmit->addAttribute('onclick', "\$('#save_post_command').attr('value', 'publish');");
     $this->addElement($publishSubmit->setValue($text));
     $tagService = BOL_TagService::getInstance();
     $tags = array();
     if (intval($this->post->getId()) > 0) {
         $arr = $tagService->findEntityTags($this->post->getId(), 'blog-post');
         foreach (!empty($arr) ? $arr : array() as $dto) {
             $tags[] = $dto->getLabel();
         }
     }
     $tf = new TagsInputField('tf');
     $tf->setLabel(OW::getLanguage()->text('blogs', 'tags_field_label'));
     $tf->setValue($tags);
     $this->addElement($tf);
 }
开发者ID:jorgemunoz8807,项目名称:havanabook,代码行数:44,代码来源:save.php

示例13: index

 public function index($params)
 {
     $adminMode = false;
     $viewerId = OW::getUser()->getId();
     if (!OW::getUser()->isAuthenticated() || $viewerId === null) {
         throw new AuthenticateException();
     }
     if (!empty($params['userId']) && $params['userId'] != $viewerId) {
         if (OW::getUser()->isAdmin() || OW::getUser()->isAuthorized('base')) {
             $adminMode = true;
             $userId = (int) $params['userId'];
             $user = BOL_UserService::getInstance()->findUserById($userId);
             if (empty($user) || BOL_AuthorizationService::getInstance()->isSuperModerator($userId)) {
                 throw new Redirect404Exception();
             }
             $editUserId = $userId;
         } else {
             throw new Redirect403Exception();
         }
     } else {
         $editUserId = $viewerId;
         $changePassword = new BASE_CMP_ChangePassword();
         $this->addComponent("changePassword", $changePassword);
         $contentMenu = new BASE_CMP_DashboardContentMenu();
         $contentMenu->getElement('profile_edit')->setActive(true);
         $this->addComponent('contentMenu', $contentMenu);
         $user = OW::getUser()->getUserObject();
         //BOL_UserService::getInstance()->findUserById($editUserId);
     }
     $changeList = BOL_PreferenceService::getInstance()->getPreferenceValue(self::PREFERENCE_LIST_OF_CHANGES, $editUserId);
     if (empty($changeList)) {
         $changeList = '[]';
     }
     $this->assign('changeList', json_decode($changeList, true));
     $isEditedUserModerator = BOL_AuthorizationService::getInstance()->isModerator($editUserId) || BOL_AuthorizationService::getInstance()->isSuperModerator($editUserId);
     $accountType = $user->accountType;
     // dispaly account type
     if (OW::getUser()->isAdmin() || OW::getUser()->isAuthorized('base')) {
         $accountType = !empty($_GET['accountType']) ? $_GET['accountType'] : $user->accountType;
         // get available account types from DB
         $accountTypes = BOL_QuestionService::getInstance()->findAllAccountTypes();
         $accounts = array();
         if (count($accountTypes) > 1) {
             /* @var $value BOL_QuestionAccount */
             foreach ($accountTypes as $key => $value) {
                 $accounts[$value->name] = OW::getLanguage()->text('base', 'questions_account_type_' . $value->name);
             }
             if (!in_array($accountType, array_keys($accounts))) {
                 if (in_array($user->accountType, array_keys($accounts))) {
                     $accountType = $user->accountType;
                 } else {
                     $accountType = BOL_QuestionService::getInstance()->getDefaultAccountType()->name;
                 }
             }
             $editAccountType = new Selectbox('accountType');
             $editAccountType->setId('accountType');
             $editAccountType->setLabel(OW::getLanguage()->text('base', 'questions_question_account_type_label'));
             $editAccountType->setRequired();
             $editAccountType->setOptions($accounts);
             $editAccountType->setHasInvitation(false);
         } else {
             $accountType = BOL_QuestionService::getInstance()->getDefaultAccountType()->name;
         }
     }
     $language = OW::getLanguage();
     $this->setPageHeading($language->text('base', 'edit_index'));
     $this->setPageHeadingIconClass('ow_ic_user');
     // -- Edit form --
     $editForm = new EditQuestionForm('editForm', $editUserId);
     $editForm->setId('editForm');
     $this->assign('displayAccountType', false);
     // dispaly account type
     if (!empty($editAccountType)) {
         $editAccountType->setValue($accountType);
         $editForm->addElement($editAccountType);
         OW::getDocument()->addOnloadScript(" \$('#accountType').change(function() {\n                \n                var form = \$(\"<form method='get'><input type='text' name='accountType' value='\" + \$(this).val() + \"' /></form>\");\n                \$('body').append(form);\n                \$(form).submit();\n\n            }  ); ");
         $this->assign('displayAccountType', true);
     }
     $userId = !empty($params['userId']) ? $params['userId'] : $viewerId;
     // add avatar field
     $editAvatar = OW::getClassInstance("BASE_CLASS_AvatarField", 'avatar', false);
     $editAvatar->setLabel(OW::getLanguage()->text('base', 'questions_question_user_photo_label'));
     $editAvatar->setValue(BOL_AvatarService::getInstance()->getAvatarUrl($userId, 1, null, true, false));
     $displayPhotoUpload = OW::getConfig()->getValue('base', 'join_display_photo_upload');
     // add the required avatar validator
     if ($displayPhotoUpload == BOL_UserService::CONFIG_JOIN_DISPLAY_AND_SET_REQUIRED_PHOTO_UPLOAD) {
         $avatarValidator = OW::getClassInstance("BASE_CLASS_AvatarFieldValidator", true, $userId);
         $editAvatar->addValidator($avatarValidator);
     }
     $editForm->addElement($editAvatar);
     $isUserApproved = BOL_UserService::getInstance()->isApproved($editUserId);
     $this->assign('isUserApproved', $isUserApproved);
     // add submit button
     $editSubmit = new Submit('editSubmit');
     $editSubmit->addAttribute('class', 'ow_button ow_ic_save');
     $editSubmit->setValue($language->text('base', 'edit_button'));
     if ($adminMode && !$isUserApproved) {
         $editSubmit->setName('saveAndApprove');
         $editSubmit->setValue($language->text('base', 'save_and_approve'));
         // TODO: remove
//.........这里部分代码省略.........
开发者ID:ZyXelP,项目名称:oxwall,代码行数:101,代码来源:edit.php

示例14: index

 public function index($params)
 {
     $adminMode = false;
     $viewerId = OW::getUser()->getId();
     if (!OW::getUser()->isAuthenticated() || $viewerId === null) {
         throw new AuthenticateException();
     }
     if (!empty($params['userId']) && $params['userId'] != $viewerId) {
         if (OW::getUser()->isAdmin() || OW::getUser()->isAuthorized('base')) {
             $adminMode = true;
             $userId = (int) $params['userId'];
             $user = BOL_UserService::getInstance()->findUserById($userId);
             if (empty($user) || BOL_AuthorizationService::getInstance()->isSuperModerator($userId)) {
                 throw new Redirect404Exception();
             }
             $editUserId = $userId;
         } else {
             throw new Redirect403Exception();
         }
     } else {
         $editUserId = $viewerId;
         $changePassword = new BASE_CMP_ChangePassword();
         $this->addComponent("changePassword", $changePassword);
         $contentMenu = new BASE_CMP_DashboardContentMenu();
         $contentMenu->getElement('profile_edit')->setActive(true);
         $this->addComponent('contentMenu', $contentMenu);
         $user = BOL_UserService::getInstance()->findUserById($editUserId);
     }
     $accountType = $user->accountType;
     $language = OW::getLanguage();
     $this->setPageHeading($language->text('base', 'edit_index'));
     $this->setPageHeadingIconClass('ow_ic_user');
     // -- Edit form --
     $editForm = new EditQuestionForm('editForm', $editUserId);
     $editForm->setId('editForm');
     $editSubmit = new Submit('editSubmit');
     $editSubmit->addAttribute('class', 'ow_button ow_ic_save');
     $editSubmit->setValue($language->text('base', 'edit_button'));
     $editForm->addElement($editSubmit);
     $questions = $this->questionService->findEditQuestionsForAccountType($accountType);
     $section = null;
     $questionArray = array();
     $questionNameList = array();
     foreach ($questions as $sort => $question) {
         if ($section !== $question['sectionName']) {
             $section = $question['sectionName'];
         }
         $questionArray[$section][$sort] = $questions[$sort];
         $questionNameList[] = $questions[$sort]['name'];
     }
     $this->assign('questionArray', $questionArray);
     $questionData = $this->questionService->getQuestionData(array($editUserId), $questionNameList);
     $questionValues = $this->questionService->findQuestionsValuesByQuestionNameList($questionNameList);
     $editForm->addQuestions($questions, $questionValues, $questionData[$editUserId]);
     if (OW::getRequest()->isPost()) {
         if ($editForm->isValid($_POST)) {
             $data = $editForm->getValues();
             foreach ($questionArray as $section) {
                 foreach ($section as $key => $question) {
                     switch ($question['presentation']) {
                         case 'multicheckbox':
                             if (is_array($data[$question['name']])) {
                                 $data[$question['name']] = array_sum($data[$question['name']]);
                             } else {
                                 $data[$question['name']] = 0;
                             }
                             break;
                     }
                 }
             }
             // save user data
             if (!empty($user->id)) {
                 if ($this->questionService->saveQuestionsData($data, $user->id)) {
                     if (!$adminMode) {
                         $event = new OW_Event(OW_EventManager::ON_USER_EDIT, array('userId' => $user->id, 'method' => 'native'));
                         OW::getEventManager()->trigger($event);
                         OW::getFeedback()->info($language->text('base', 'edit_successfull_edit'));
                         $this->redirect();
                     } else {
                         $event = new OW_Event(OW_EventManager::ON_USER_EDIT_BY_ADMIN, array('userId' => $user->id));
                         OW::getEventManager()->trigger($event);
                         OW::getFeedback()->info($language->text('base', 'edit_successfull_edit'));
                         $this->redirect(OW::getRouter()->urlForRoute('base_user_profile', array('username' => BOL_UserService::getInstance()->getUserName($editUserId))));
                     }
                 } else {
                     OW::getFeedback()->info($language->text('base', 'edit_edit_error'));
                 }
             } else {
                 OW::getFeedback()->info($language->text('base', 'edit_edit_error'));
             }
         }
     }
     $this->addForm($editForm);
     $this->assign('unregisterProfileUrl', OW::getRouter()->urlForRoute('base_delete_user'));
     $language->addKeyForJs('base', 'join_error_username_not_valid');
     $language->addKeyForJs('base', 'join_error_username_already_exist');
     $language->addKeyForJs('base', 'join_error_email_not_valid');
     $language->addKeyForJs('base', 'join_error_email_already_exist');
     $language->addKeyForJs('base', 'join_error_password_not_valid');
     $language->addKeyForJs('base', 'join_error_password_too_short');
//.........这里部分代码省略.........
开发者ID:vazahat,项目名称:dudex,代码行数:101,代码来源:edit.php

示例15: init

 protected function init($params = array())
 {
     $accountTypes = $this->questionService->findAllAccountTypes();
     $serviceLang = BOL_LanguageService::getInstance();
     $language = OW::getLanguage();
     $currentLanguageId = OW::getLanguage()->getCurrentId();
     $accounts = array();
     /* @var $value BOL_QuestionAccount */
     foreach ($accountTypes as $value) {
         $accounts[$value->name] = $this->questionService->getAccountTypeLang($value->name);
     }
     $sections = $this->questionService->findSortedSectionList();
     // need to hide sections select box
     if (empty($sections)) {
         $this->assign('no_sections', true);
     }
     $sectionsArray = array();
     /* @var $section BOL_QuestionSection */
     foreach ($sections as $section) {
         $sectionsArray[$section->name] = $language->text('base', 'questions_section_' . $section->name . '_label');
     }
     $event = new OW_Event('base.question.add_question_form.on_get_available_sections', $sectionsArray, $sectionsArray);
     OW::getEventManager()->trigger($event);
     $sectionsArray = $event->getData();
     $presentationList = array_keys($this->presentations2types);
     $presentations = array();
     $presentationsLabel = array();
     foreach ($presentationList as $item) {
         $presentations[$item] = $item;
         $presentationsLabel[$item] = $language->text('base', 'questions_question_presentation_' . $item . '_label');
     }
     $presentation = $presentationList[0];
     if (isset($_POST['qst_answer_type']) && isset($presentations[$_POST['qst_answer_type']])) {
         $presentation = $presentations[$_POST['qst_answer_type']];
     }
     $qstName = new TextField('qst_name');
     $qstName->setLabel($language->text('admin', 'questions_question_name_label'));
     //$qstName->addValidator(new StringValidator(0, 24000));
     $qstName->setRequired();
     $this->addElement($qstName);
     $qstName = new TextField('qst_description');
     $qstName->setLabel($language->text('admin', 'questions_question_description_label'));
     //$qstName->addValidator(new StringValidator(0, 24000));
     $this->addElement($qstName);
     if (count($accountTypes) > 1) {
         $qstAccountType = new CheckboxGroup('qst_account_type');
         $qstAccountType->setLabel($language->text('admin', 'questions_for_account_type_label'));
         $qstAccountType->setRequired();
         $qstAccountType->setDescription($language->text('admin', 'questions_for_account_type_description'));
         $qstAccountType->setOptions($accounts);
         $this->addElement($qstAccountType);
     }
     if (!empty($sectionsArray)) {
         $qstSection = new Selectbox('qst_section');
         $qstSection->setLabel($language->text('admin', 'questions_question_section_label'));
         $qstSection->setOptions($sectionsArray);
         $qstSection->setHasInvitation(false);
         $this->addElement($qstSection);
     }
     $qstAnswerType = new Selectbox('qst_answer_type');
     $qstAnswerType->setLabel($language->text('admin', 'questions_answer_type_label'));
     $qstAnswerType->addAttribute('class', $qstAnswerType->getName());
     $qstAnswerType->setOptions($presentationsLabel);
     $qstAnswerType->setRequired();
     $qstAnswerType->setHasInvitation(false);
     $qstAnswerType->setValue($presentation);
     $this->addElement($qstAnswerType);
     //        if ( $displayPossibleValues )
     //        {
     $qstPossibleValues = new addValueField('qst_possible_values');
     //$qstPossibleValues->addAttribute('class', $qstPossibleValues->getName());
     $qstPossibleValues->setLabel($language->text('admin', 'questions_possible_values_label'));
     $qstPossibleValues->setDescription($language->text('admin', 'questions_possible_values_description'));
     //$qstPossibleValues->setValue( array( '1' => 'aaa', '2' => 'bbbb', '4' => 'ccc' ) );
     $this->addElement($qstPossibleValues);
     //        }
     $configList = $this->questionConfigs;
     foreach ($configList as $config) {
         $className = $config->presentationClass;
         /* @var $qstConfig OW_FormElement */
         $qstConfig = OW::getClassInstance($className, $config->name);
         $qstConfig->setLabel($language->text('admin', 'questions_config_' . $config->name . '_label'));
         if (!empty($config->description)) {
             $qstConfig->setDescription($config->description);
         }
         $this->addElement($qstConfig);
     }
     $qstColumnCount = new Selectbox('qst_column_count');
     $qstColumnCount->addAttribute('class', $qstColumnCount->getName());
     $qstColumnCount->setLabel($language->text('admin', 'questions_columns_count_label'));
     $qstColumnCount->setOptions($this->qstColumnCountValues);
     $qstColumnCount->setValue(1);
     $this->addElement($qstColumnCount);
     $qstRequired = new CheckboxField('qst_required');
     $qstRequired->setLabel($language->text('admin', 'questions_required_label'));
     $qstRequired->setDescription($language->text('admin', 'questions_required_description'));
     $this->addElement($qstRequired);
     $qstOnSignUp = new CheckboxField('qst_on_sign_up');
     $qstOnSignUp->setLabel($language->text('admin', 'questions_on_sing_up_label'));
     $qstOnSignUp->setDescription($language->text('admin', 'questions_on_sing_up_description'));
//.........这里部分代码省略.........
开发者ID:hardikamutech,项目名称:loov,代码行数:101,代码来源:add_question_form.php


注:本文中的Submit::addAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。