public function executeAddNewSubscriber(sfWebRequest $request) { $this->minyan = Utils::extractDomainObjectFromRequest($request, 'Minyan', 'minyanId', true); $this->form = new SignupForm(); unset($this->form['password']); if ($request->isMethod('post')) { $this->form->bind($request->getParameter('signup')); if ($this->form->isValid()) { $fields = $this->form->getValues(); $con = Doctrine::getConnectionByTableName('SfGuardUser'); try { $con->beginTransaction(); $this->logMessage("Executing signup for new user for minyan {$this->minyan->getName()}: {$fields['email']}", 'notice'); $sgu = new SfGuardUser(); $sgu->setFirstName($fields['first_name']); $sgu->setLastName($fields['last_name']); $sgu->setUsername($fields['email']); $sgu->setEmailAddress($fields['email']); $sgu->setPhone($fields['phone']); $sgu->setPassword(sfConfig::get('app_temp_password')); $sgu->setIsActive(true); $sgu->save(); $contactMethods = $request->getParameter('contact_method'); foreach ($contactMethods as $name => $method) { $contactMethods[$name] = Utils::toBoolean($method); } $minyanUser = new MinyanUser(); $minyanUser->setMinyanId($this->minyan->getId()); $minyanUser->setUserId($sgu->getId()); $minyanUser->setUsePhone($contactMethods['phone']); $minyanUser->setUseSms($contactMethods['text']); $minyanUser->setUseEmail($contactMethods['email']); $minyanUser->save(); $con->commit(); } catch (Exception $e) { $con->rollback(); $this->logMessage("Problem when signing up user {$fields['email']}: {$e->getMessage()}", 'notice'); throw $e; } MAMUtils::sendInternalEmail("New Make a Minyan User Alert for minyan {$this->minyan->getName()}! - {$sgu->getFullName()}", ""); //send email $options = array(); $options['template'] = 'welcomeToMinyan'; $options['subject'] = 'Welcome!'; $options['minyan'] = $this->minyan; $options['user'] = $sgu; $options['minyanUser'] = $minyanUser; $options['first_name'] = $sgu->getFirstName(); $options['to'] = $sgu->getUsername(); EmailUtils::send($options); $this->logMessage('Welcome email sent to ' . $sgu->getUsername(), 'notice'); $this->getUser()->setFlash('subscribersSuccess', 'Added ' . $sgu->getUsername() . ' successfully!'); echo Utils::ajaxResponse(true, $this->minyan->getId()); return sfView::NONE; } } }
public function executeLogout(sfWebRequest $request) { if ($this->getUser()->isAuthenticated()) { AuthenticationUtils::signOut(); MAMUtils::setView($this, array('title' => 'You have been logged out.', 'mobileTemplate' => 'logoutMobile')); return sfView::SUCCESS; } else { $this->redirect('index/index'); } }
public static function fireBlast(Blast $blast) { //dont do anything if we've already fired if ($blast->getHasFired()) { return; } $blast->setHasFired(true); $blast->save(); $minyan = $blast->getMinyan(); //loop through the minyan subscribers, generate a response, and send notifications $phoneCounter = 0; $emailCounter = 0; $textCounter = 0; $subscribers = $minyan->getUsers(); foreach ($subscribers as $subscriber) { $response = new BlastResponse(); $response->setBlastId($blast->getId()); $response->setUserId($subscriber->getUserId()); $response->save(); if ($subscriber->getUsePhone()) { self::createPhoneResponse($response); $phoneCounter++; } else { if ($subscriber->getUseSms()) { self::createTextResponse($response); $textCounter++; } } if ($subscriber->getUseEmail()) { self::createEmailResponse($response); $emailCounter++; } } MAMUtils::sendInternalEmail("Minyan Blast - {$minyan->getName()}", $blast->getTextMessage() . "<br><ul><li>Emails: {$emailCounter}</li><li>Phone Calls: {$phoneCounter}</li><li>Texts: {$textCounter}</li></ul>"); //update the minyan resource counters $minyan->setNumberEmails($minyan->getNumberEmails() + $emailCounter); $minyan->setNumberTexts($minyan->getNumberTexts() + $textCounter); $minyan->setNumberPhoneCalls($minyan->getNumberPhoneCalls() + $phoneCounter); $minyan->save(); $blast->setNumberEmails($blast->getNumberEmails() + $emailCounter); $blast->setNumberTexts($blast->getNumberTexts() + $textCounter); $blast->setNumberPhoneCalls($blast->getNumberPhoneCalls() + $phoneCounter); $blast->save(); }
public function executeIndex(sfWebRequest $request) { $this->blastResponse = Utils::extractDomainObjectFromRequest($request, 'BlastResponse', 'responseId'); MAMUtils::setView($this, array('title' => 'Thanks for your response!')); if ($request->hasParameter('status') && array_search($request->getParameter('status'), array('yes', 'no', 'maybe')) !== false) { $this->blastResponse->setStatus($request->getParameter('status')); if ($request->getParameter('status') !== 'yes') { $this->blastResponse->setAdditional(0); } $this->blastResponse->save(); } if ($request->hasParameter('additional') && is_numeric($request->getParameter('additional')) && $request->getParameter('additional') < 10) { $this->blastResponse->setAdditional($request->getParameter('additional')); $this->blastResponse->save(); $this->getUser()->setMessage('additionalSuccess', 'Additional number of people stored successfully'); } $this->minyan = $this->blastResponse->getBlast()->getMinyan()->getName(); $this->eventType = $this->blastResponse->getBlast()->getEventType(); $this->eventTime = $this->blastResponse->getBlast()->getEventTimeString(); }
/** * Executes index action * * @param sfRequest $request A request object */ public function executeIndex(sfWebRequest $request) { $this->form = new SignupForm(); if ($request->isMethod('post')) { $this->form->bind($request->getParameter('signup')); if ($this->form->isValid()) { $fields = $this->form->getValues(); $con = Doctrine::getConnectionByTableName('SfGuardUser'); try { $con->beginTransaction(); $this->logMessage("Executing signup for new user: {$fields['email']}", 'notice'); $sgu = new SfGuardUser(); $sgu->setFirstName($fields['first_name']); $sgu->setLastName($fields['last_name']); $sgu->setUsername($fields['email']); $sgu->setEmailAddress($fields['email']); $sgu->setPhone($fields['phone']); $sgu->setPassword($fields['password']); $sgu->setIsActive(true); $sgu->save(); $con->commit(); } catch (Exception $e) { $con->rollback(); $this->logMessage("Problem when signing up user {$fields['email']}: {$e->getMessage()}", 'notice'); throw $e; } MAMUtils::sendInternalEmail("New Make a Minyan User Alert! - {$sgu->getFullName()}, Plan: {$this->plan['name']}", ""); //send email $options = array(); $options['template'] = 'welcome'; $options['subject'] = 'Welcome!'; $options['first_name'] = $sgu->getFirstName(); $options['to'] = $sgu->getUsername(); EmailUtils::send($options); $this->logMessage('Welcome email sent to ' . $sgu->getUsername(), 'notice'); $this->redirect('signup/thanks'); } } }
private function setupView($options = array()) { $options['selected'] = 'Dashboard'; MAMUtils::setView($this, $options); }
<style> table.minyanim { width: 100%; font-size: 16px; margin-top: 10px; } table.minyanim td { vertical-align: middle; } </style> <?php echo MAMUtils::writeFlashBlock('dashboard'); ?> <div class="minyanZone" style="margin-bottom: 20px;"> <? if (count($minyanim) == 0): ?> <h3> You are currently not subscribed to any minyan</h3> <? else: ?> <h3> Your minyanim: </h3> <? foreach($minyanim as $minyanUser): ?> <h2><?php echo link_to($minyanUser->getMinyan()->getName(), 'subscriptions/index?minyanId=' . $minyanUser->getMinyan()->getId()); ?> </h2> <? if ($minyanUser->isAdmin()): ?> <?php echo link_to('Blast', 'blast/create?minyanId=' . $minyanUser->getMinyan()->getId(), array('class' => 'action'));
<h2 class="centeredTitle">Please log in</h2> <? MAMUtils::writeFlashBlock('login');?> <form id="loginForm" method="post" action="<? echo url_for('login/index'); ?>" class="tableless"> <div class="fieldset"> <div class="fields"> <div class="field"> <input style="font-weight: bold" value="<?php echo $sf_request->getParameter('username'); ?> " type="text" name="username" /> <label>Email or Phone Number</label> </div> <div class="field"> <input style="font-weight: bold" type="password" name="password" /> <label>Password</label> </div> </div> </div> <? Utils::clearDiv(); ?> <input type="hidden" name="remember_me" value="true" /> <input type="hidden" name="redirect" value="<?php echo $redirectUrl; ?> " /> <div class="centered"> <button class="greenButtonFixed" type="submit">Login</button>
/** * Executes index action * * @param sfRequest $request A request object */ public function setupPage($options = array()) { MAMUtils::setView($this, $options); }
/** * Executes index action * * @param sfRequest $request A request object */ private function setupView($options = array()) { $options['selected'] = 'My Account'; MAMUtils::setView($this, $options); }
} div.contact_method p { margin-bottom: 20px; } div.responses { float: left; width: 640px; } </style> <h2>Your responses for '<?php echo $minyan->getName(); ?> '</h2> <? MAMUtils::writeFlashBlock('subscriptions'); ?> <br/> <div class="responses"> <? if (count($responses) == 0): ?> <h3> This minyan has not yet sent you any requests. </h3> <? else: ?> <table class="responses"> <? foreach ($this->minyanResponses as $response): ?> <tr> </tr> <? endforeach; ?> </table> <? endif; ?>
?> minyan at <?php echo $minyan; ?> <?php echo $eventTime; ?> . </h2> <br/><br/> <? if ($blastResponse->getStatus() != 'yes'): ?> <h3 align="center">No further action is required at this time.</h3> <? else: ?> <?php echo MAMUtils::writeFlashBlock('additional'); ?> <h3>If you are bringing others besides yourself, <br/>please enter how many you are bringing here: </h3><br/> <form action="<?php echo url_for('emailResponse/index?responseId=' . $blastResponse->getId()); ?> " method="post"> <input type="text" name="additional" value="<?php echo $blastResponse->getAdditional(); ?> " /> <button type="submit">Save</button> </form> <? endif; ?>
<div style="float: right; padding: 10px; border: 1px solid #EBE6D1; width: 260px;"> <a href="/files/subscriberForm.pdf"> <img border="0" src="/images/pdf.png" align="right" style="margin-left: 5px; margin-bottom: 5px" /> <strong>Download a subscriber form</strong> </a> <br/><br/> Put this handy subscriber form somewhere in your shul to collect emails and phone numbers for your minyan. Then, enter the information on this page using the "Add New Subscriber" button. </div> <h2>Subscribers for <?php echo $minyan->getName(); ?> </h2><br/> <?php echo MAMUtils::writeFlashBlock('subscribers'); ?> <button onclick="showAddSubscriberForm();" class="fancy"> Add New Subscriber </button> <button onclick="deleteSubscribers();" class="fancy"> Delete Subscribers </button> <br/><br/> <strong><?php echo count($minyanUsers); ?>