function StartSurvey($data, $form)
 {
     try {
         $data = SQLDataCleaner::clean($data);
         $data['MembershipType'] = 'community';
         Session::set("FormInfo.{$form->FormName()}.data", $data);
         $profile_page = EditProfilePage::get()->first();
         $member = $this->member_manager->registerMobile($data, new MemberRegistrationSenderService());
         //Get profile page
         if (!is_null($profile_page)) {
             //Redirect to profile page with success message
             Session::clear("FormInfo.{$form->FormName()}.data");
             $request = Controller::curr()->getRequest();
             $back_url = $request->postVar('BackURL');
             $link = $profile_page->Link('?success=1');
             if (!empty($back_url)) {
                 $link .= "&BackURL=" . $back_url;
             }
             return OpenStackIdCommon::loginMember($member, $link);
         }
     } catch (EntityValidationException $ex1) {
         Form::messageForForm($form->FormName(), $ex1->getMessage(), 'bad');
         //Return back to form
         SS_Log::log($ex1->getMessage(), SS_Log::WARN);
         return Controller::curr()->redirectBack();
     } catch (Exception $ex) {
         Form::messageForForm($form->FormName(), "There was an error with your request, please contact your admin.", 'bad');
         //Return back to form
         SS_Log::log($ex->getMessage(), SS_Log::ERR);
         return Controller::curr()->redirectBack();
     }
 }
Exemplo n.º 2
0
 function __construct()
 {
     $this->pageName = "missing";
     $this->pageTitle = "Missing Info";
     $this->pageParams = array('head_extra_fn' => array(&$this, 'extra_head'));
     parent::__construct();
 }
Exemplo n.º 3
0
 public function testPublicUserProfile(WebGuy $I)
 {
     $user = '******';
     $I->amOnPage(EditProfilePage::getPublicProfileUrl($user));
     $I->seeInCurrentUrl($user);
     $I->seeInTitle($user);
     $I->see('Мнений пока нет, станьте первым!');
 }
Exemplo n.º 4
0
 function __construct()
 {
     $this->pageName = "recommend";
     $this->pagePath = "/profile_recommend";
     $this->pageTitle = "Journalists you recommend";
     $this->pageParams = array('head_extra_fn' => array(&$this, 'extra_head'));
     parent::__construct();
 }
Exemplo n.º 5
0
 function __construct()
 {
     $this->pageName = "awards";
     $this->pagePath = "/profile_awards";
     $this->pageTitle = "Awards";
     $this->pageParams = array('head_extra_fn' => array(&$this, 'extra_head'));
     parent::__construct();
 }
Exemplo n.º 6
0
 function __construct()
 {
     $this->pageName = "employment";
     $this->pageTitle = "Employment";
     $this->pagePath = "/profile_employment";
     $this->pageParams = array('head_extra_fn' => array(&$this, 'extra_head'));
     parent::__construct();
 }
Exemplo n.º 7
0
 function __construct()
 {
     $this->pageName = "import";
     $this->pageTitle = "Import Profile";
     $this->pagePath = "/profile_import";
     $this->pageParams = array('head_extra_fn' => array(&$this, 'extra_head'));
     parent::__construct();
     $this->imported = null;
 }
Exemplo n.º 8
0
 public function testPublicUserProfile(WebGuy $I)
 {
     $user = '******';
     $I->amOnPage(EditProfilePage::getPublicProfileUrl($user));
     $I->seeInCurrentUrl($user);
     $I->seeInTitle($user);
     $I->seeLink('yupe');
     $I->seeLink('Первая публичная запись в опубликованном блоге');
     $I->seeElement('div.avatar > img');
 }
Exemplo n.º 9
0
    function __construct()
    {
        $this->pageName = "photo";
        $this->pageTitle = "Photo";
        $this->pagePath = "/profile_photo";
        $this->pageParams = array('head_extra_fn' => array(&$this, 'extra_head'));
        $this->uploadError = NULL;
        parent::__construct();
        // fetch the current photo, if any
        $sql = <<<EOT
SELECT p.id, p.image_id, p.is_thumbnail, i.width, i.height, i.filename, i.created
    FROM (journo_photo p INNER JOIN image i ON i.id=p.image_id )
    WHERE p.journo_id=?
    LIMIT 1
EOT;
        $this->photo = db_getRow($sql, $this->journo['id']);
        if (!is_null($this->photo)) {
            $this->photo['is_thumbnail'] = $this->photo['is_thumbnail'] == 't' ? TRUE : FALSE;
        }
    }
Exemplo n.º 10
0
 function __construct()
 {
     $this->pageName = "weblinks";
     $this->pagePath = "/profile_weblinks";
     $this->pageTitle = "Weblinks";
     $this->pageParams = array('head_extra_fn' => array(&$this, 'extra_head'));
     parent::__construct();
     /* if submitting, hold fields as class-wide data, so we can add error messages etc... */
     $this->submitted = null;
     $this->badSubmit = false;
     if (get_http_var('action') == 'submit') {
         $this->submitted = $this->weblinksFromHTTPVars();
         /* check links, agument with error message if there is one */
         foreach ($this->submitted as &$w) {
             $err = $this->checkWebLink($w);
             if (!is_null($err)) {
                 $this->badSubmit = true;
                 $w['err'] = $err;
             }
         }
     }
 }
Exemplo n.º 11
0
 function doRegister($data, $form)
 {
     if (!isset($data["Affiliations"]) || empty($data["Affiliations"])) {
         //Set error message
         $form->AddErrorMessage('Affiliations', "Sorry, You must at least enter one valid Affiliation.", 'bad');
         //Set form data from submitted values
         Session::set("FormInfo.Form_RegistrationForm.data", $data);
         //Return back to form
         return $this->redirectBack();
     }
     $new_affiliations = json_decode($data["Affiliations"]);
     //Check for existing member email address
     if ($member = Member::get()->filter('Email', Convert::raw2sql($data['Email']))->first()) {
         //Set error message
         $form->AddErrorMessage('Email', "Sorry, that email address already exists. Please choose another.", 'bad');
         //Set form data from submitted values
         Session::set("FormInfo.Form_RegistrationForm.data", $data);
         //Return back to form
         return $this->redirectBack();
     }
     //Otherwise create new member and log them in
     $Member = new Member();
     $form->saveInto($Member);
     if (isset($data['Gender'])) {
         $Gender = $data['Gender'];
         if ($Gender != 'Male' && $Gender != 'Female' && $Gender != 'Prefer not to say') {
             $Member->Gender = Convert::raw2sql($data['GenderSpecify']);
         }
     }
     $Member->write();
     if ($data['MembershipType'] == 'foundation') {
         $Member->upgradeToFoundationMember();
     } else {
         $Member->convert2SiteUser();
     }
     //Find or create the 'user' group
     if (!($userGroup = Group::get()->filter('Code', 'users')->first())) {
         $userGroup = new Group();
         $userGroup->Code = "users";
         $userGroup->Title = "Users";
         $userGroup->Write();
         $Member->Groups()->add($userGroup);
     }
     //Add member to user group
     $Member->Groups()->add($userGroup);
     foreach ($new_affiliations as $key => $newAffiliation) {
         $dbAffiliation = new Affiliation();
         $org_name = Convert::raw2sql($newAffiliation->OrgName);
         $org_name = trim($org_name);
         AffiliationController::Save($dbAffiliation, $newAffiliation, $org_name, $Member);
     }
     PublisherSubscriberManager::getInstance()->publish('new_user_registered', array($Member->ID));
     //Get profile page
     if ($ProfilePage = EditProfilePage::get()->first()) {
         //send Thank you email
         $config = SiteConfig::current_site_config();
         if ($config->RegistrationSendMail && !empty($config->RegistrationFromMessage) && !empty($config->RegistrationSubjectMessage) && !empty($config->RegistrationHTMLMessage) && !empty($config->RegistrationPlainTextMessage)) {
             $registration_email = new CustomEmail($config->RegistrationFromMessage, $Member->Email, $data['MembershipType'] == 'foundation' ? 'Thank you for becoming an OpenStack Foundation Member' : 'Thank you for becoming an OpenStack Community Member', $config->RegistrationHTMLMessage, $config->RegistrationPlainTextMessage);
             $registration_email->send();
         }
         //Redirect to profile page with success message
         return OpenStackIdCommon::loginMember($member, $ProfilePage->Link('?success=1'));
     }
 }
Exemplo n.º 12
0
 public function getProfileAttendeeRegistrationLink()
 {
     $page = EditProfilePage::get()->first();
     if (!$page) {
         return '#';
     }
     return $page->Link("attendeeInfoRegistration");
 }
Exemplo n.º 13
0
 function doRegister($data, $form)
 {
     try {
         $data = SQLDataCleaner::clean($data, $non_check_keys = array('HiddenAffiliations'));
         Session::set("FormInfo.{$form->FormName()}.data", $data);
         $profile_page = EditProfilePage::get()->first();
         $member = $this->member_manager->register($data, $profile_page, new MemberRegistrationSenderService());
         //Get profile page
         if (!is_null($profile_page)) {
             //Redirect to profile page with success message
             Session::clear("FormInfo.{$form->FormName()}.data");
             return OpenStackIdCommon::loginMember($member, $profile_page->Link('?success=1'));
         }
     } catch (EntityValidationException $ex1) {
         Form::messageForForm('HoneyPotForm_RegistrationForm', $ex1->getMessage(), 'bad');
         //Return back to form
         SS_Log::log($ex1->getMessage(), SS_Log::ERR);
         return $this->redirectBack();
     } catch (Exception $ex) {
         Form::messageForForm('HoneyPotForm_RegistrationForm', "There was an error with your request, please contact your admin.", 'bad');
         //Return back to form
         SS_Log::log($ex->getMessage(), SS_Log::ERR);
         return $this->redirectBack();
     }
 }
Exemplo n.º 14
0
 function Link()
 {
     if ($ProfilePage = EditProfilePage::get()->first()) {
         return $ProfilePage->Link();
     }
 }
Exemplo n.º 15
0
 /**
  * Handles the registration. Validates and creates the member, then redirects
  * to the appropriate place
  *  
  * @param  array $data
  * @param  BootstrapForm $form
  * @return SSViewer
  */
 public function doRegister($data, $form)
 {
     try {
         $back_url = Session::get('BackURL');
         Session::set("FormInfo.{$form->getName()}.data", $data);
         $data = SQLDataCleaner::clean($data);
         $profile_page = EditProfilePage::get()->first();
         $speaker_registration_token = Session::get(SpeakerRegistrationRequest::ConfirmationTokenParamName);
         if (!empty($speaker_registration_token)) {
             $data[SpeakerRegistrationRequest::ConfirmationTokenParamName] = $speaker_registration_token;
         }
         $member = $this->member_manager->registerSpeaker($data, new MemberRegistrationSenderService());
         //Get profile page
         if (!is_null($profile_page)) {
             //Redirect to profile page with success message
             Session::clear("FormInfo.{$form->FormName()}.data");
             if ($back_url) {
                 $redirect = HTTP::setGetVar('welcome', 1, $back_url);
                 return OpenStackIdCommon::loginMember($member, $redirect);
             }
             $form->sessionMessage('Awesome! You should receive an email shortly.', 'good');
             Session::clear(SpeakerRegistrationRequest::ConfirmationTokenParamName);
             Session::clear('BackURL');
             return OpenStackIdCommon::loginMember($member, $this->redirectBackUrl());
         }
     } catch (EntityValidationException $ex1) {
         Form::messageForForm($form->FormName(), $ex1->getMessage(), 'bad');
         //Return back to form
         SS_Log::log($ex1->getMessage(), SS_Log::WARN);
         return $this->redirectBack();
     } catch (Exception $ex) {
         Form::messageForForm($form->FormName(), "There was an error with your request, please contact your admin.", 'bad');
         //Return back to form
         SS_Log::log($ex->getMessage(), SS_Log::ERR);
         return $this->redirectBack();
     }
 }