Ejemplo n.º 1
0
    public function executeLorsubmit()
    {
        $data = $this->getRequestParameter('lorvalue');
        $type = $this->getRequestParameter('type');
        $toid = $this->getRequestParameter('toid');
        $newmail = $data;
        $lorForUser = UserPeer::retrieveByPK($toid);
        $lorById = $this->getUser()->getAttribute('userid');
        if ($lorById) {
            $lorByUser = UserPeer::retrieveByPK($lorById);
            $fromName = $lorByUser->getFullname();
        } else {
            $fromName = "Guest";
        }
        $lorvalue = new Lorvalues();
        $lorvalue->setLorfieldsId(sfConfig::get('app_lor_' . $type));
        $lorvalue->setData($data);
        $lorvalue->setUserId($lorById);
        $lorvalue->setCreatedAt(time());
        $lorvalue->save();
        $loruser = new Loruser();
        $loruser->setLorvaluesId($lorvalue->getId());
        $loruser->setUserId($toid);
        $loruser->save();
        if ($type == 'email') {
            $mail = new sfMail();
            $mail->initialize();
            //$mail->addCc(sfConfig::get('app_to_adminmail'));
            if ($lorForUser->getEmail()) {
                $mail->addAddress($lorForUser->getEmail());
            }
            $sendermail = sfConfig::get('app_from_mail');
            $sendername = sfConfig::get('app_from_name');
            $to = $newmail;
            $subject = "Alert: Connect with your friends at " . sfConfig::get('app_names_org');
            $body = '
			
Hi ' . $lorForUser->getFullname() . ',
	
	' . $fromName . ' has told us that your email address is 
	actually ' . $newmail . '.  If so, we strongly encourage you to claim it 
	at ' . sfConfig::get('app_urls_claim') . ' so you can connect with your friends.
	
	Admin,
	ITBHU Global
	';
            $mail = myUtility::newsendmail($mail, $sendermail, $sendername, $sendermail, $sendername, $sendermail, $to, $subject, $body);
        }
        $this->setFlash('notice', 'Your remark on ' . sfConfig::get('app_lortext_' . $type) . ' has been saved successfully.');
        $this->redirect('/search/profile?id=' . $toid);
    }