Пример #1
0
 public function __construct()
 {
     parent::__construct('buy-credits-form');
     $packs = USERCREDITS_BOL_CreditsService::getInstance()->getPackList();
     $packField = new RadioField('pack');
     $packField->setRequired();
     $value = 0;
     foreach ($packs as $p) {
         $packField->addOption($p['id'], $p['title']);
         if ($value == 0) {
             $value = $p['id'];
         }
     }
     $packField->setValue($value);
     $this->addElement($packField);
     $gatewaysField = new BillingGatewaySelectionField('gateway');
     $gatewaysField->setRequired(true);
     $this->addElement($gatewaysField);
     $submit = new Submit('buy');
     $submit->setValue(OW::getLanguage()->text('base', 'checkout'));
     $this->addElement($submit);
 }
Пример #2
0
 public function __construct($formName)
 {
     parent::__construct($formName);
     $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA);
     $language = OW::getLanguage();
     $field = new TextField('title');
     $field->setRequired(true);
     $field->setLabel($language->text('groups', 'create_field_title_label'));
     $this->addElement($field);
     $field = new WysiwygTextarea('description');
     $field->setLabel($language->text('groups', 'create_field_description_label'));
     $field->setRequired(true);
     $this->addElement($field);
     $field = new GROUPS_Image('image');
     $field->setLabel($language->text('groups', 'create_field_image_label'));
     $field->addValidator(new GROUPS_ImageValidator());
     $this->addElement($field);
     $whoCanView = new RadioField('whoCanView');
     $whoCanView->setRequired();
     $whoCanView->addOptions(array(GROUPS_BOL_Service::WCV_ANYONE => $language->text('groups', 'form_who_can_view_anybody'), GROUPS_BOL_Service::WCV_INVITE => $language->text('groups', 'form_who_can_view_invite')));
     $whoCanView->setLabel($language->text('groups', 'form_who_can_view_label'));
     $this->addElement($whoCanView);
     $whoCanInvite = new RadioField('whoCanInvite');
     $whoCanInvite->setRequired();
     $whoCanInvite->addOptions(array(GROUPS_BOL_Service::WCI_PARTICIPANT => $language->text('groups', 'form_who_can_invite_participants'), GROUPS_BOL_Service::WCI_CREATOR => $language->text('groups', 'form_who_can_invite_creator')));
     $whoCanInvite->setLabel($language->text('groups', 'form_who_can_invite_label'));
     $this->addElement($whoCanInvite);
 }
Пример #3
0
 public function __construct($name)
 {
     parent::__construct($name);
     $militaryTime = Ow::getConfig()->getValue('base', 'military_time');
     $language = OW::getLanguage();
     $currentYear = date('Y', time());
     $title = new TextField('title');
     $title->setRequired();
     $title->setLabel($language->text('event', 'add_form_title_label'));
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'title'), $title);
     OW::getEventManager()->trigger($event);
     $title = $event->getData();
     $this->addElement($title);
     $startDate = new DateField('start_date');
     $startDate->setMinYear($currentYear);
     $startDate->setMaxYear($currentYear + 5);
     $startDate->setRequired();
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'start_date'), $startDate);
     OW::getEventManager()->trigger($event);
     $startDate = $event->getData();
     $this->addElement($startDate);
     $startTime = new EventTimeField('start_time');
     $startTime->setMilitaryTime($militaryTime);
     if (!empty($_POST['endDateFlag'])) {
         $startTime->setRequired();
     }
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'start_time'), $startTime);
     OW::getEventManager()->trigger($event);
     $startTime = $event->getData();
     $this->addElement($startTime);
     $endDate = new DateField('end_date');
     $endDate->setMinYear($currentYear);
     $endDate->setMaxYear($currentYear + 5);
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'end_date'), $endDate);
     OW::getEventManager()->trigger($event);
     $endDate = $event->getData();
     $this->addElement($endDate);
     $endTime = new EventTimeField('end_time');
     $endTime->setMilitaryTime($militaryTime);
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'end_time'), $endTime);
     OW::getEventManager()->trigger($event);
     $endTime = $event->getData();
     $this->addElement($endTime);
     $location = new TextField('location');
     $location->setRequired();
     $location->setLabel($language->text('event', 'add_form_location_label'));
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'location'), $location);
     OW::getEventManager()->trigger($event);
     $location = $event->getData();
     $this->addElement($location);
     $whoCanView = new RadioField('who_can_view');
     $whoCanView->setRequired();
     $whoCanView->addOptions(array('1' => $language->text('event', 'add_form_who_can_view_option_anybody'), '2' => $language->text('event', 'add_form_who_can_view_option_invit_only')));
     $whoCanView->setLabel($language->text('event', 'add_form_who_can_view_label'));
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'who_can_view'), $whoCanView);
     OW::getEventManager()->trigger($event);
     $whoCanView = $event->getData();
     $this->addElement($whoCanView);
     $whoCanInvite = new RadioField('who_can_invite');
     $whoCanInvite->setRequired();
     $whoCanInvite->addOptions(array(EVENT_BOL_EventService::CAN_INVITE_PARTICIPANT => $language->text('event', 'add_form_who_can_invite_option_participants'), EVENT_BOL_EventService::CAN_INVITE_CREATOR => $language->text('event', 'add_form_who_can_invite_option_creator')));
     $whoCanInvite->setLabel($language->text('event', 'add_form_who_can_invite_label'));
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'who_can_invite'), $whoCanInvite);
     OW::getEventManager()->trigger($event);
     $whoCanInvite = $event->getData();
     $this->addElement($whoCanInvite);
     $submit = new Submit('submit');
     $submit->setValue($language->text('event', 'add_form_submit_label'));
     $this->addElement($submit);
     $desc = new WysiwygTextarea('desc');
     $desc->setLabel($language->text('event', 'add_form_desc_label'));
     $desc->setRequired();
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'desc'), $desc);
     OW::getEventManager()->trigger($event);
     $desc = $event->getData();
     $this->addElement($desc);
     $imageField = new FileField('image');
     $imageField->setLabel($language->text('event', 'add_form_image_label'));
     $this->addElement($imageField);
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'image'), $imageField);
     OW::getEventManager()->trigger($event);
     $imageField = $event->getData();
     $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA);
 }
Пример #4
0
 /**
  * Class constructor
  *
  */
 public function __construct()
 {
     parent::__construct('configSaveForm');
     $language = OW::getLanguage();
     $configs = OW::getConfig()->getValues('mailbox');
     //        $element = new CheckboxField('enableAttachments');
     //        $element->setValue($configs['enable_attachments']);
     //        $this->addElement($element);
     $activeModeList = new RadioField('active_mode_list');
     $activeModeList->setLabel($language->text('mailbox', 'settings_label_active_mode_list'));
     $availableModeCollector = new BASE_CLASS_EventCollector('plugin.mailbox.on_available_mode_collect');
     OW::getEventManager()->trigger($availableModeCollector);
     $data = $availableModeCollector->getData();
     if (!empty($data)) {
         foreach ($data as $modeName) {
             $availableModeList[$modeName] = $language->text('mailbox', 'label_btn_' . $modeName);
         }
     } else {
         $availableModeList = array('mail' => $language->text('mailbox', 'label_btn_mail'), 'chat' => $language->text('mailbox', 'label_btn_chat'), 'mailchat' => $language->text('mailbox', 'label_btn_mailchat'));
     }
     $activeModeList->setOptions($availableModeList);
     $activeModes = MAILBOX_BOL_ConversationService::getInstance()->getActiveModeList();
     if (in_array('mail', $activeModes) && in_array('chat', $activeModes)) {
         $activeModeList->setValue('mailchat');
     } else {
         $activeModeList->setValue($activeModes[0]);
     }
     $activeModeList->setRequired();
     $this->addElement($activeModeList);
     if (in_array('mail', $activeModes)) {
         $sendMessageInterval = new TextField('send_message_interval');
         $sendMessageInterval->setValue($configs['send_message_interval']);
         $sendMessageInterval->setLabel($language->text('mailbox', 'settings_label_send_message_interval'));
         $this->addElement($sendMessageInterval);
     }
     $showAllMembers = new CheckboxField('show_all_members');
     $showAllMembers->setLabel($language->text('mailbox', 'settings_label_show_all_members'));
     $showAllMembers->setDescription($language->text('mailbox', 'settings_desc_show_all_members'));
     $showAllMembers->setValue(OW::getConfig()->getValue('mailbox', 'show_all_members'));
     $this->addElement($showAllMembers);
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('base', 'edit_button'));
     $this->addElement($submit);
     //        $js = <<<EOT
     //$("input[name='active_mode_list']").click(function(){
     //    if ($(this).val()=='mail')
     //    {
     //        $("input[name='show_all_members']").attr('disabled', 'disabled');
     //        $("#showAllMembersContainer").hide();
     //    }
     //    else
     //    {
     //        $("input[name='show_all_members']").removeAttr('disabled');
     //        $("#showAllMembersContainer").show();
     //    }
     //});
     //EOT;
     //
     //        OW::getDocument()->addOnloadScript($js);
 }
Пример #5
0
 public function __construct($pluginKey, $entityType, $entityId)
 {
     // remove newfeeds cookie if has
     setcookie('ynsocialpublisher_feed_data_' . $entityId, '', -1, '/');
     parent::__construct();
     $userId = OW::getUser()->getId();
     $language = OW::getLanguage();
     $service = YNSOCIALPUBLISHER_BOL_Service::getInstance();
     $core = YNSOCIALPUBLISHER_CLASS_Core::getInstance();
     // user setting
     $userSetting = $service->getUsersetting($userId, $pluginKey);
     $this->assign('userSetting', $userSetting);
     // avatar
     $avatar = BOL_AvatarService::getInstance()->getAvatarUrl($userId);
     if (empty($avatar)) {
         $avatar = BOL_AvatarService::getInstance()->getDefaultAvatarUrl();
     }
     $this->assign('avatar', $avatar);
     // default status
     $defaultStatus = $core->getDefaultStatus($pluginKey, $entityType, $entityId);
     $this->assign('defaultStatus', $defaultStatus);
     // entity url
     $url = $core->getUrl($pluginKey, $entityType, $entityId);
     $this->assign('url', $url);
     // title
     $title = $core->getTitle($pluginKey, $entityType, $entityId);
     $this->assign('title', $title);
     // -- connect each provider to get data
     // callbackUrl
     $callbackUrl = OW::getRouter()->urlForRoute('ynsocialbridge-connects');
     $coreBridge = new YNSOCIALBRIDGE_CLASS_Core();
     $arrObjServices = array();
     foreach (array('facebook', 'twitter', 'linkedin') as $serviceName) {
         $profile = null;
         $connect_url = "";
         $access_token = "";
         $scope = '';
         $objService = array();
         //check enable API
         $clientConfig = YNSOCIALBRIDGE_BOL_ApisettingService::getInstance()->getConfig($serviceName);
         if ($clientConfig) {
             $obj = $coreBridge->getInstance($serviceName);
             $values = array('service' => $serviceName, 'userId' => OW::getUser()->getId());
             //$tokenDto = $obj -> getToken($values);
             //print_r($_SESSION['socialbridge_session'][$serviceName]);die;
             $disconnect_url = OW::getRouter()->urlForRoute('ynsocialbridge-disconnect') . "?service=" . $serviceName;
             if (!empty($_SESSION['socialbridge_session'][$serviceName]['access_token'])) {
                 if ($serviceName == 'facebook') {
                     $access_token = $_SESSION['socialbridge_session'][$serviceName]['access_token'];
                     //check permission
                     $me = $obj->getOwnerInfo(array('access_token' => $access_token));
                     $uid = $me['id'];
                     $permissions = $obj->hasPermission(array('uid' => $uid, 'access_token' => $access_token));
                     if ($permissions) {
                         if (empty($permissions[0]['publish_stream']) || empty($permissions[0]['status_update'])) {
                             $scope = 'publish_stream,status_update';
                             //$scope = "email,user_about_me,user_birthday,user_hometown,user_interests,user_location,user_photos,user_website,publish_stream,status_update";
                         } else {
                             try {
                                 $profile = $obj->getOwnerInfo($_SESSION['socialbridge_session'][$serviceName]);
                             } catch (Exception $e) {
                                 $profile = null;
                             }
                         }
                     }
                 } else {
                     $profile = $obj->getOwnerInfo($_SESSION['socialbridge_session'][$serviceName]);
                 }
             } else {
                 $scope = "";
                 switch ($serviceName) {
                     case 'facebook':
                         //$scope = "email,user_about_me,user_birthday,user_hometown,user_interests,user_location,user_photos,user_website";
                         $scope = 'publish_stream,status_update';
                         break;
                     case 'twitter':
                         $scope = "";
                         break;
                     case 'linkedin':
                         $scope = "r_basicprofile,rw_nus,r_network,w_messages";
                         break;
                 }
             }
             $connect_url = $obj->getConnectUrl() . "?scope=" . $scope . "&" . http_build_query(array('callbackUrl' => $callbackUrl, 'isFromSocialPublisher' => 1, 'pluginKey' => $pluginKey, 'entityType' => $entityType, 'entityId' => $entityId));
             $objService['has_config'] = 1;
         } else {
             $objService['has_config'] = 0;
         }
         $objService['serviceName'] = $serviceName;
         $objService['connectUrl'] = $connect_url;
         $objService['disconnectUrl'] = $disconnect_url;
         $objService['profile'] = $profile;
         $objService['logo'] = OW::getPluginManager()->getPlugin('ynsocialpublisher')->getStaticUrl() . "img/" . $serviceName . ".png";
         $arrObjServices[$serviceName] = $objService;
     }
     //print_r($userSetting);
     //print_r($arrObjServices);
     $this->assign('arrObjServices', $arrObjServices);
     // create form
     $formUrl = OW::getRouter()->urlFor('YNSOCIALPUBLISHER_CTRL_Ynsocialpublisher', 'ajaxPublish');
     $form = new Form('ynsocialpubisher_share');
     $form->setAction($formUrl);
     $form->setAjax();
     // -- hidden fields
     // for plugin key
     $pluginKeyHiddenField = new HiddenField('ynsocialpublisher_pluginKey');
     $pluginKeyHiddenField->setValue($pluginKey);
     $form->addElement($pluginKeyHiddenField);
     // for entity id
     $entityIdHiddenField = new HiddenField('ynsocialpublisher_entityId');
     $entityIdHiddenField->setValue($entityId);
     $form->addElement($entityIdHiddenField);
     // for entity type
     $entityTypeHiddenField = new HiddenField('ynsocialpublisher_entityType');
     $entityTypeHiddenField->setValue($entityType);
     $form->addElement($entityTypeHiddenField);
     // Status - textarea
     $status = new Textarea('ynsocialpublisher_status');
     $status->setValue($defaultStatus);
     $form->addElement($status);
     // Options - radio buttons
     $options = new RadioField('ynsocialpublisher_options');
     $options->setRequired();
     $options->addOptions(array('0' => $language->text('ynsocialpublisher', 'ask'), '1' => $language->text('ynsocialpublisher', 'auto'), '2' => $language->text('ynsocialpublisher', 'not_ask')));
     $options->setValue($userSetting['option']);
     $form->addElement($options);
     // Providers - checkboxes
     foreach (array('facebook', 'twitter', 'linkedin') as $provider) {
         if (in_array($provider, $userSetting['adminProviders']) && $arrObjServices[$provider]['has_config']) {
             $providerField = new CheckboxField('ynsocialpublisher_' . $provider);
             $form->addElement($providerField);
         }
     }
     // add js action to form
     $form->bindJsFunction(Form::BIND_SUCCESS, 'function(data){if( data.result ){OW.info(data.message);OWActiveFloatBox.close();}else{OW.error(data.message);}}');
     // submit button
     $submit = new Submit('submit');
     $submit->setValue(OW::getLanguage()->text('ynsocialpublisher', 'submit_label'));
     $form->addElement($submit);
     $this->addForm($form);
     // assign to view
     $this->assign('formUrl', $formUrl);
 }
Пример #6
0
 public function __construct($name)
 {
     parent::__construct($name);
     $militaryTime = Ow::getConfig()->getValue('base', 'military_time');
     $language = OW::getLanguage();
     $currentYear = date('Y', time());
     $title = new TextField('title');
     $title->setRequired();
     $title->setLabel($language->text('eventx', 'add_form_title_label'));
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'title'), $title);
     OW::getEventManager()->trigger($event);
     $title = $event->getData();
     $this->addElement($title);
     $startDate = new DateField('start_date');
     $startDate->setMinYear($currentYear);
     $startDate->setMaxYear($currentYear + 5);
     $startDate->setRequired();
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'start_date'), $startDate);
     OW::getEventManager()->trigger($event);
     $startDate = $event->getData();
     $this->addElement($startDate);
     $startTime = new EventTimeField('start_time');
     $startTime->setMilitaryTime($militaryTime);
     if (!empty($_POST['endDateFlag'])) {
         $startTime->setRequired();
     }
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'start_time'), $startTime);
     OW::getEventManager()->trigger($event);
     $startTime = $event->getData();
     $this->addElement($startTime);
     $endDate = new DateField('end_date');
     $endDate->setMinYear($currentYear);
     $endDate->setMaxYear($currentYear + 5);
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'end_date'), $endDate);
     OW::getEventManager()->trigger($event);
     $endDate = $event->getData();
     $this->addElement($endDate);
     $endTime = new EventTimeField('end_time');
     $endTime->setMilitaryTime($militaryTime);
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'end_time'), $endTime);
     OW::getEventManager()->trigger($event);
     $endTime = $event->getData();
     $this->addElement($endTime);
     if (OW::getConfig()->getValue('eventx', 'enableCategoryList') == '1') {
         if (OW::getConfig()->getValue('eventx', 'enableMultiCategories') == 1) {
             $element = new CheckboxGroup('event_category');
             $element->setColumnCount(3);
         } else {
             $element = new SelectBox('event_category');
         }
         $element->setRequired(true);
         $element->setLabel($language->text('eventx', 'event_category_label'));
         foreach (EVENTX_BOL_EventService::getInstance()->getCategoriesList() as $category) {
             $element->addOption($category->id, $category->name);
         }
         $this->addElement($element);
     }
     $maxInvites = new TextField('max_invites');
     $maxInvites->setRequired();
     $validator = new IntValidator(0);
     $validator->setErrorMessage($language->text('eventx', 'invalid_integer_value'));
     $maxInvites->addValidator($validator);
     $maxInvites->setLabel($language->text('eventx', 'add_form_maxinvites_label'));
     $this->addElement($maxInvites);
     $location = new TextField('location');
     $location->setRequired();
     $location->setId('location');
     $location->setLabel($language->text('eventx', 'add_form_location_label'));
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'location'), $location);
     OW::getEventManager()->trigger($event);
     $location = $event->getData();
     $this->addElement($location);
     $whoCanView = new RadioField('who_can_view');
     $whoCanView->setRequired();
     $whoCanView->addOptions(array('1' => $language->text('eventx', 'add_form_who_can_view_option_anybody'), '2' => $language->text('eventx', 'add_form_who_can_view_option_invit_only')));
     $whoCanView->setLabel($language->text('eventx', 'add_form_who_can_view_label'));
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'who_can_view'), $whoCanView);
     OW::getEventManager()->trigger($event);
     $whoCanView = $event->getData();
     $this->addElement($whoCanView);
     $whoCanInvite = new RadioField('who_can_invite');
     $whoCanInvite->setRequired();
     $whoCanInvite->addOptions(array(EVENTX_BOL_EventService::CAN_INVITE_PARTICIPANT => $language->text('eventx', 'add_form_who_can_invite_option_participants'), EVENTX_BOL_EventService::CAN_INVITE_CREATOR => $language->text('eventx', 'add_form_who_can_invite_option_creator')));
     $whoCanInvite->setLabel($language->text('eventx', 'add_form_who_can_invite_label'));
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'who_can_invite'), $whoCanInvite);
     OW::getEventManager()->trigger($event);
     $whoCanInvite = $event->getData();
     $this->addElement($whoCanInvite);
     $desc = new WysiwygTextarea('desc');
     $desc->setLabel($language->text('eventx', 'add_form_desc_label'));
     $desc->setRequired();
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'desc'), $desc);
     OW::getEventManager()->trigger($event);
     $desc = $event->getData();
     $this->addElement($desc);
     $imageField = new FileField('image');
     $imageField->setLabel($language->text('eventx', 'add_form_image_label'));
     $this->addElement($imageField);
     if (OW::getConfig()->getValue('eventx', 'enableTagsList') == '1') {
         $tags = new TagsInputField('tags');
         $tags->setId('tags');
         $tags->setLabel($language->text('base', 'tags_cloud_cap_label'));
         $this->addElement($tags);
     }
     $submit = new Submit('submit');
     $submit->setValue($language->text('eventx', 'add_form_submit_label'));
     $this->addElement($submit);
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'image'), $imageField);
     OW::getEventManager()->trigger($event);
     $imageField = $event->getData();
     $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA);
 }