Ejemplo n.º 1
0
 public function invitegroupmemberforcontest()
 {
     $groupmemberlist = $_GET['checkseparate'];
     $groupid = $_GET['groupid'];
     $contest_id = $_GET['contest_id'];
     $invitetype = $_GET['invitetype'];
     $groupmemberlistid = explode(',', $groupmemberlist);
     $curdate = date('Y-m-d H:i:s');
     /// Contest Details /////////////
     $contest_det = contestModel::where("ID", $contest_id)->first();
     if (Auth::user()->firstname != '') {
         $inviter = Auth::user()->firstname . " " . Auth::user()->lastname;
     } else {
         $inviter = Auth::user()->username;
     }
     if ($contest_det['contesttype'] == "p") {
         $contesttype = "Photo";
     } else {
         if ($contest_det['contesttype'] == "v") {
             $contesttype = "Video";
         } else {
             if ($contest_det['contesttype'] == "t") {
                 $contesttype = "Topic";
             }
         }
     }
     $contestname = $contest_det['contest_name'];
     $contestimage = $contest_det['themephoto'];
     $conteststartdate = $contest_det['conteststartdate'];
     $contestenddate = $contest_det['contestenddate'];
     $contestcreatedby = User::find($contest_det['createdby']);
     if ($contestcreatedby['firstname'] != '') {
         $contestcreatedby = $contestcreatedby['firstname'] . '' . $contestcreatedby['lastname'];
     } else {
         $contestcreatedby = $contestcreatedby['username'];
     }
     $groupdetails = groupModel::where('ID', $groupid)->first();
     $groupname = $groupdetails['groupname'];
     $inv_suc_message = 0;
     for ($i = 0; $i < count($groupmemberlistid); $i++) {
         $groupmemberid = groupmemberModel::where('id', $groupmemberlistid[$i])->first();
         $invited = invitegroupforcontestModel::where('group_id', $groupid)->where('contest_id', $contest_id)->where('user_id', $groupmemberid['user_id'])->count();
         if ($invited == 0) {
             $invited_member = privateusercontestModel::where("contest_id", $contest_id)->where('user_id', $groupmemberid['user_id'])->count();
             if ($contest_det['visibility'] == "p" && $invited_member == 0) {
                 $privat_user['user_id'] = $groupmemberid['user_id'];
                 $privat_user['contest_id'] = $contest_id;
                 $privat_user['requesteddate'] = date('Y-m-d H:i:s');
                 $privat_user['status'] = 1;
                 privateusercontestModel::create($privat_user);
                 unset($privat_user);
             }
             if ($invited_member == 0) {
                 $input_details['group_id'] = $groupid;
                 $input_details['contest_id'] = $contest_id;
                 $input_details['invitedetail'] = 1;
                 $input_details['inviteddate'] = $curdate;
                 $input_details['user_id'] = $groupmemberid['user_id'];
                 invitegroupforcontestModel::create($input_details);
                 $user = ProfileModel::where('ID', $groupmemberid['user_id'])->first();
                 if ($user['firstname'] != '') {
                     $name = $user['firstname'] . ' ' . $user['lastname'];
                 } else {
                     $name = $user['username'];
                 }
                 $email = $user['email'];
                 $gcmid = $user['gcm_id'];
                 $device_type = $user['device_type'];
                 ///
                 if ($gcmid != '' && $device_type == 'A') {
                     $Message['user_id'] = $groupmemberid['user_id'];
                     $Message['title'] = 'Ding Datt';
                     $Message['message'] = 'You are invited for the Contest :' . $contestname;
                     $Message['contest_id'] = $contest_id;
                     $Message = array("notification" => $Message);
                     $DeviceId = array($gcmid);
                     $Message = array("notification" => $Message);
                     $this->PushNotification($DeviceId, $Message);
                 } else {
                     if ($gcmid != '' && $device_type == 'I') {
                         $DeviceId = $gcmid;
                         $Message = 'You are invited for the Contest :' . $contestname;
                         $Message = str_replace(" ", "_", $Message);
                         $this->PushNotificationIos($DeviceId, $Message);
                     } else {
                         $this->invitegroupmemberforcontestmail($email, $contestcreatedby, $contesttype, $contestname, $contest_id, $groupname, $contestimage, $conteststartdate, $contestenddate);
                     }
                 }
                 $inv_suc_message = 1;
             }
         } else {
         }
     }
     if ($inv_suc_message == 1 || $invitetype == 'all') {
         return 1;
     } else {
         return 0;
     }
 }
Ejemplo n.º 2
0
 public function invitegroupmemberforcontest()
 {
     $groupmemberlist = Input::get('groupmemberid');
     $groupid = Input::get('group_id');
     $contest_id = Input::get('contest_id');
     $groupmemberlistid = explode(',', $groupmemberlist);
     $curdate = date('Y-m-d H:i:s');
     /// Contest Details /////////////
     $contest_det = contestModel::where("ID", $contest_id)->first();
     if ($contest_det->firstname != '') {
         $inviter = $contest_det->firstname . " " . $contest_det->lastname;
     } else {
         $inviter = $contest_det->username;
     }
     if ($contest_det->contesttype == "p") {
         $contesttype = "Photo";
     } else {
         if ($contest_det->contesttype == "v") {
             $contesttype = "Video";
         } else {
             if ($contest_det->contesttype == "t") {
                 $contesttype = "Topic";
             }
         }
     }
     $contestname = $contest_det->contest_name;
     $contestimage = $contest_det->themephoto;
     $conteststartdate = $contest_det->conteststartdate;
     $contestenddate = $contest_det->contestenddate;
     $contestcreatedby = User::find($contest_det->createdby);
     if ($contestcreatedby['firstname'] != '') {
         $contestcreatedby = $contestcreatedby['firstname'] . '' . $contestcreatedby['lastname'];
     } else {
         $contestcreatedby = $contestcreatedby['username'];
     }
     $groupdetails = groupModel::where('ID', $groupid)->first();
     $groupname = $groupdetails['groupname'];
     $inv_suc_message = 0;
     for ($i = 0; $i < count($groupmemberlistid); $i++) {
         $groupmemberid = groupmemberModel::where('id', $groupmemberlistid[$i])->first();
         $invited = invitegroupforcontestModel::where('group_id', $groupid)->where('contest_id', $contest_id)->where('user_id', $groupmemberid->user_id)->count();
         if ($invited == 0) {
             $invited_member = privateusercontestModel::where("contest_id", $contest_id)->where('user_id', $groupmemberid['user_id'])->count();
             if ($contest_det->visibility == "p" && $invited_member == 0) {
                 $privat_user['user_id'] = $groupmemberid['user_id'];
                 $privat_user['contest_id'] = $contest_id;
                 $privat_user['requesteddate'] = date('Y-m-d H:i:s');
                 $privat_user['status'] = 1;
                 privateusercontestModel::create($privat_user);
                 unset($privat_user);
             }
             if ($invited_member == 0) {
                 $input_details['group_id'] = $groupid;
                 $input_details['contest_id'] = $contest_id;
                 $input_details['invitedetail'] = 1;
                 $input_details['inviteddate'] = $curdate;
                 $input_details['user_id'] = $groupmemberid['user_id'];
                 invitegroupforcontestModel::create($input_details);
                 $user = ProfileModel::where('ID', $groupmemberid['user_id'])->first();
                 if ($user['firstname'] != '') {
                     $name = $user['firstname'] . ' ' . $user['lastname'];
                 } else {
                     $name = $user['username'];
                 }
                 $email = $user['email'];
                 $gcmid = $user['gcm_id'];
                 $device_type = $user['device_type'];
                 ///
                 if ($gcmid != '' && $device_type == 'A') {
                     $Message['user_id'] = $groupmemberid['user_id'];
                     $Message['title'] = 'Ding Datt';
                     $Message['message'] = 'You are invited for the Contest :' . $contestname;
                     $Message['contest_id'] = $contest_id;
                     $Message = array("notification" => $Message);
                     $DeviceId = array($gcmid);
                     $Message = array("notification" => $Message);
                     $this->PushNotification($DeviceId, $Message);
                 } else {
                     if ($gcmid != '' && $device_type == 'I') {
                         $DeviceId = $gcmid;
                         $Message = $groupmemberid['user_id'] . '*You are invited for the Contest :' . $contestname;
                         $Message = str_replace(" ", "_", $Message);
                         $this->PushNotificationIos($DeviceId, $Message);
                     } else {
                         $this->invitegroupmemberforcontestmail($email, $contestcreatedby, $contesttype, $contestname, $contest_id, $groupname, $contestimage, $conteststartdate, $contestenddate);
                     }
                 }
                 ////
                 //$inv_suc_message = 	'Invitation sent successfully.';
                 $inv_suc_message = 1;
             }
         }
     }
     if ($inv_suc_message == 1) {
         $Response = array('success' => '1', 'message' => 'Invited Successfully', 'msgcode' => "c166");
         $final = array("response" => $Response);
         return json_encode($final);
     } else {
         $Response = array('success' => '0', 'message' => 'No members to invite', 'msgcode' => "c167");
         $final = array("response" => $Response);
         return json_encode($final);
     }
 }
Ejemplo n.º 3
0
    public function activegroup()
    {
        $groupid = $_GET['groupid'];
        $checkstatus = groupModel::where('ID', $groupid)->where('status', 1)->count();
        $savegroup = groupModel::select('grouptype', 'groupname', 'createdby', 'grouptype', 'status', 'groupimage')->where('ID', $groupid)->get();
        $groupowneruserid = $savegroup[0]['createdby'];
        $getcreateduserdetails = ProfileModel::select('email', 'firstname', 'lastname', 'username')->where('ID', $groupowneruserid)->get();
        $email = $getcreateduserdetails[0]['email'];
        if ($getcreateduserdetails[0]['firstname'] != '') {
            $groupownername = $getcreateduserdetails[0]['firstname'] . ' ' . $getcreateduserdetails[0]['lastname'];
        } else {
            $groupownername = $getcreateduserdetails[0]['username'];
        }
        $groupname = $savegroup[0]['groupname'];
        ///// Group member details ///////////
        if ($savegroup[0]['status'] == 1) {
            $status = "Active";
        } else {
            $status = "Inactive";
        }
        $groupdetailsactive = '<div style="font-size:12px;	color: #000000;	float:left;padding:10px 2px;width:100%;margin:15px;">Your group <b>"' . $groupname . '"</b> is activated by admin  </div><div styel"float:left;">
						<table width="180" height="95" border="0" style="margin-bottom:10px;float:left;font-family:Helvetica Neue, Helvetica, Arial, sans-serif;">
					  <tr>
						<td style="font-size:12px;color: #3BBA00;font-weight:bold;">Group Name:</td>
						<td style="font-size:12px;color: #5d5d5d;font-weight:bold;">' . $groupname . '</td>
					  </tr>
					  <tr>
						<td style="font-size:12px;color: #3BBA00;font-weight:bold;">Group Type:</td>
						<td style="font-size:12px;color: #5d5d5d;font-weight:bold;">' . $savegroup[0]['grouptype'] . '</td>
					  </tr>
					   <tr>
						<td style="font-size:12px;color: #3BBA00;font-weight:bold;">Group status </td>
						<td style="font-size:12px;color: #5d5d5d;font-weight:bold;">Active</td>
					  </tr>
					  
					  <tr style="border-radius:6px;-webkit-border-radius: 5px; -moz-border-radius: 5px;">
						<td colspan="2" style="vertical-align: text-middle;" >
							<span><a href="' . URL::to('viewgroupmember/' . $groupowneruserid) . '" style="text-decoration:none;><img src="' . URL::to('assets/inner/images/vist_dingdatt.png') . '/assets/inner/images/vist_dingdatt.png" width="120" height="30" /></a></span>
						</td>
					  </tr>	
					</table>
					</div>';
        $groupdetailsdeactive = '<div style="font-size:12px;	color: #000000;	float:left;padding:10px 2px;width:100%;margin:15px;">Your group <b>"' . $groupname . '"</b> is deactivated by admin  </div><div styel"float:left;">
						<table width="180" height="95" border="0" style="margin-bottom:10px;float:left;font-family:Helvetica Neue, Helvetica, Arial, sans-serif;">
					  <tr>
						<td style="font-size:12px;color: #3BBA00;font-weight:bold;">Group Name:</td>
						<td style="font-size:12px;color: #5d5d5d;font-weight:bold;">' . $groupname . '</td>
					  </tr>
					  <tr>
						<td style="font-size:12px;color: #3BBA00;font-weight:bold;">Group Type:</td>
						<td style="font-size:12px;color: #5d5d5d;font-weight:bold;">' . $savegroup[0]['grouptype'] . '</td>
					  </tr>
					   <tr>
						<td style="font-size:12px;color: #3BBA00;font-weight:bold;">Group status </td>
						<td style="font-size:12px;color: #5d5d5d;font-weight:bold;">Inactive</td>
					  </tr>
					  
					  <tr style="border-radius:6px;-webkit-border-radius: 5px; -moz-border-radius: 5px;">
						<td colspan="2" style="vertical-align: text-middle;" >
							<span><a href="' . URL::to('viewgroupmember/' . $groupowneruserid) . '" style="text-decoration:none;><img src="' . URL::to('assets/inner/images/vist_dingdatt.png') . '/assets/inner/images/vist_dingdatt.png" width="120" height="30" /></a></span>
						</td>
					  </tr>	
					</table>
					</div>';
        if ($checkstatus == 1) {
            ///Inactive process /////
            $updatedetails['status'] = 0;
            $affectedRows = groupModel::where('ID', $groupid)->update($updatedetails);
            //$details = "Your contest ".$contestname." is deactivated by admin.";
            $this->adminmailtogroupownerdelete($email, $groupownername, $groupname, $groupownername, $groupid, $groupdetailsdeactive);
            if ($affectedRows) {
                return 0;
            }
        } else {
            ///Active process /////
            $updatedetails['status'] = 1;
            $affectedRows = groupModel::where('ID', $groupid)->update($updatedetails);
            //$details = "Your contest ".$contestname." is activated by admin.";
            $this->adminmailtogroupowner($email, $groupownername, $groupname, $groupownername, $groupid, $groupdetailsactive);
            if ($affectedRows) {
                return 1;
            }
        }
    }
Ejemplo n.º 4
0
<?php 
if (Session::has('tab')) {
    $tab = Session::get('tab');
} else {
    $tab = "creategroup";
}
?>
@if(isset($er_data))
<p class="alert" style="color:green;padding:5px;text-align:center;font-size:13px">{{ $er_data }}</p>
@endif
<?php 
if (Session::has('er_data')) {
    $er_data = Session::get('er_data');
}
$groupdata = groupModel::where('ID', $groupid)->get();
?>

<div id="con_grp" class="tabs-wrapper">
    <input type="radio" name="tab" id="tab1" class="tab-head" checked />
    <label for="tab1"><span id="submnu_editgroup">Edit Group</span></label>


    <div class="mbblk">
        <select class="radius sel_lang">
            <option>Edit Group</option>

        </select>
    </div>

    <div class="tab-body-wrapper">
Ejemplo n.º 5
0
 public function updategroupdetails()
 {
     $inputdetails['groupname'] = Input::get('groupname');
     $inputdetails['grouptype'] = Input::get('grouptype');
     $group_id = Input::get('group_id');
     $updaterules = array('groupname' => 'required|unique:group,groupname,' . $group_id, 'grouptype' => 'required');
     $validation = Validator::make($inputdetails, $updaterules);
     if ($validation->passes()) {
         $participant = groupModel::where('ID', $group_id)->update($inputdetails);
         $Response = array('success' => '1', 'message' => 'Group Details Updated successfully');
         $final = array("response" => $Response);
         return json_encode($final);
     } else {
         $Response = array('success' => '0', 'message' => $validation->messages()->first());
         $final = array("response" => $Response);
         return json_encode($final);
     }
 }