Ejemplo n.º 1
0
 public function submitIntroform()
 {
     $payitforward = $sendKarmaNote = $buyyoucoffee = '0';
     $receiverWR = Input::get('receiverWR');
     if (!empty($receiverWR)) {
         foreach ($receiverWR as $key => $value) {
             if ($value == "I'd pay it forward") {
                 $payitforward = '1';
             } elseif ($value == "I'd send you a Karma Note") {
                 $sendKarmaNote = '1';
             }
         }
     }
     $giver_email = Input::get('giver_email');
     $user_id_receiver = Input::get('receiver_id');
     $connection_id_receiver = Input::get('receiver_conn_id');
     if (!empty(Input::get('giver_id') && Input::get('giver_id') != 'undefined')) {
         echo $user_id_giver = Input::get('giver_id');
     }
     $connection_id_giver = Input::get('giver_conn_id');
     $user_id_introducer = Input::get('user_id_Intro');
     $detail = Input::get('note');
     if (!empty($user_id_giver)) {
         $Meetingrequest = new Meetingrequest();
         $Meetingrequest->user_id_introducer = $user_id_introducer;
         $Meetingrequest->user_id_receiver = $user_id_receiver;
         $Meetingrequest->user_id_giver = $user_id_giver;
         $Meetingrequest->connection_id_giver = $connection_id_giver;
         $Meetingrequest->notes = strip_tags($detail);
         $Meetingrequest->payitforward = $payitforward;
         $Meetingrequest->sendKarmaNote = $sendKarmaNote;
         $Meetingrequest->buyyoucoffee = $buyyoucoffee;
         $Meetingrequest->status = 'pending';
         $Meetingrequest->req_createdate = KarmaHelper::currentDate();
         $Meetingrequest->save();
         $meetingId = $Meetingrequest->id;
         Queue::push('MessageSender', array('type' => '12', 'user_id_giver' => $user_id_giver, 'user_id_receiver' => $user_id_receiver, 'meetingId' => $meetingId));
         //$sendLinkedinMessage =  MessageHelper::triggerEmailAndMessage($user_id_giver,$user_id_receiver,'12',$meetingId);
         //echo "<pre>";print_r($sendLinkedinMessage);echo "</pre>";die();
         return Redirect::to('/karma-intro');
     } else {
         $Meetingrequest = new Meetingrequest();
         $Meetingrequest->user_id_introducer = $user_id_introducer;
         $Meetingrequest->user_id_receiver = $user_id_receiver;
         $Meetingrequest->connection_id_giver = $connection_id_giver;
         $Meetingrequest->notes = strip_tags($detail);
         $Meetingrequest->payitforward = $payitforward;
         $Meetingrequest->sendKarmaNote = $sendKarmaNote;
         $Meetingrequest->buyyoucoffee = $buyyoucoffee;
         $Meetingrequest->status = 'pending';
         $Meetingrequest->req_createdate = KarmaHelper::currentDate();
         $Meetingrequest->save();
         $meetingId = $Meetingrequest->id;
         if ($giver_email != "") {
             Queue::push('MessageSender@IntroEmailToNonKarmaGiver', array('type' => '15', 'user_id_giver' => $connection_id_giver, 'user_id_receiver' => $user_id_receiver, 'giver_email' => $giver_email, 'meetingId' => $meetingId));
         }
         Queue::push('MessageSender', array('type' => '13', 'user_id_giver' => $connection_id_giver, 'user_id_receiver' => $user_id_receiver, 'meetingId' => $meetingId));
         return Redirect::to('/karma-intro');
         /*For Sending Intro Email to Non Karma User if email id is given*/
     }
 }
Ejemplo n.º 2
0
 public function updateUser()
 {
     $user_id = Input::get('id');
     $userDetail = User::find($user_id);
     $userstatus = Input::get('userstatus');
     $username = Input::get('name');
     $fname = $lname = '';
     if (isset($username)) {
         list($fname, $lname) = explode(" ", $username);
     }
     if ($userstatus == "approved" && $userDetail->userstatus != "approved") {
         //MessageHelper::sendActivationMessage($userDetail);
         Queue::push('MessageSender@sendActivationEmail', array('user_id' => $user_id));
         // send an email and save a karmanote to user from kc team to show on his profile
         $Meetingrequest = new Meetingrequest();
         $Meetingrequest->user_id_receiver = '430';
         $Meetingrequest->user_id_giver = $user_id;
         $Meetingrequest->subject = '';
         $Meetingrequest->notes = "";
         $Meetingrequest->status = 'completed';
         $Meetingrequest->meetingdatetime = date('Y-m-d H:i:s');
         $Meetingrequest->replyviewstatus = '1';
         $Meetingrequest->requestviewstatus = '1';
         $Meetingrequest->meetingtimezone = '';
         $Meetingrequest->req_createdate = KarmaHelper::currentDate();
         $Meetingrequest->save();
         $meetingId = $Meetingrequest->id;
         $meetingId = $Meetingrequest->id;
         $karmaNote = new Karmanote();
         $karmaNote->req_id = $meetingId;
         $karmaNote->user_idgiver = $user_id;
         $karmaNote->user_idreceiver = '430';
         $karmaNote->details = "Welcome to KarmaCircles. Thank you for joining the world's largest movement to spread good karma.";
         $karmaNote->skills = '';
         $karmaNote->statusreceiver = 'hidden';
         $karmaNote->viewstatus = 0;
         $karmaNote->created_at = KarmaHelper::currentDate();
         $karmaNote->save();
     }
     $profileupdatedate = Input::get('profileupdatedate');
     $userrole = Input::get('role');
     $userupdate = User::find($user_id);
     $userupdate->userstatus = $userstatus;
     $userupdate->fname = $fname;
     $userupdate->lname = $lname;
     $userupdate->profileupdatedate = $profileupdatedate;
     $userupdate->role = $userrole;
     $userupdate->save();
     /*Group Settings*/
     $group_ids = Input::get('Groups');
     $meeting_setting = "accept from group only";
     /* $meeting_setting = Input::get('meeting_setting');
     		if(empty($meeting_setting)){
     			$meeting_setting = "accept from all";
     		}
     		else{
     			$meeting_setting = "accept from group only";
     		} */
     //echo "<pre>";print_r($group_ids);echo "</pre>";die;
     $UsersgroupCount = Usersgroup::where('user_id', '=', $user_id)->count();
     if ($UsersgroupCount > '0') {
         $UsersgroupCount = Usersgroup::where('user_id', '=', $user_id)->delete();
     }
     if (!empty($group_ids)) {
         foreach ($group_ids as $key => $value) {
             $usergroup = new Usersgroup();
             $usergroup->user_id = $user_id;
             $usergroup->group_id = $value;
             $usergroup->save();
         }
         $user = User::find($user_id);
         $user->meeting_setting = $meeting_setting;
         $user->save();
     } else {
         $user = User::find($user_id);
         //$user->meeting_setting = "accept from all";
         $user->meeting_setting = $meeting_setting;
         $user->save();
     }
     return Redirect::to('/admin/manageUser');
     //echo "<pre>"; print_r($_POST);echo "</pre>";
 }