示例#1
0
 public function saveMessage()
 {
     $dataSession = getSession();
     $dataPost = $this->input->post();
     $dataSend = array("message" => clearCaracter($dataPost['msg']), "userid" => $dataSession['userid'], "status" => 1, "groupid" => $dataPost['groupid']);
     $return = $this->chat->saveMessage($dataSend);
     echo json_encode($return);
 }
示例#2
0
 function saveCommentPublication()
 {
     $return = array("rpta" => false);
     $arrPostTemp = $this->input->post();
     $arrPost = $arrPostTemp['data'];
     if (empty($arrPost) || !isset($arrPost['publicationid']) || strlen($arrPost['publicationid']) < 1 || !isset($arrPost['publicationtext']) || strlen($arrPost['publicationtext']) < 1) {
         echo json_encode($return);
         exit;
     }
     $userData = $this->session->userdata('user_data');
     $arrUserActivity = array("userid" => $userData['userid'], "activityid" => "2", "state" => 1);
     $userActivityid = $this->user_activity->saveUserActivity($arrUserActivity);
     if ($userActivityid !== true) {
         $arrCommentPublication = array("user_userid" => $userData['userid'], "publication_publicationid" => $arrPost['publicationid'], "useractivityid" => $userActivityid, "description" => clearCaracter($arrPost['publicationtext']), "state" => 1);
         $return['rpta'] = $this->publication_comment->savePublicationComment($arrCommentPublication, true);
         $acumMail = "";
         $arrId = array();
         $find = 0;
         $message = "";
         if ($return['rpta'] == true) {
             $rptaTmp = $this->notification->getUserOfPub($arrPost['publicationid']);
             if ($rptaTmp['rpta'] == true) {
                 $rptaPubli = $this->notification->findActivityWithPubid($arrPost['publicationid']);
                 //var_dump("<pre>",$rptaPubli);exit;
                 if ($rptaPubli['rpta'] == true) {
                     // CREACION DE MENSAJE A ENVIAR.
                     $rptaPubli = $rptaPubli['array'][0];
                     $message = "<p> <a href='" . site_url() . "/Profile/user/" . $rptaPubli['userid'] . "'>" . $rptaPubli['name'] . " " . $rptaPubli['lastname'] . "</a>";
                     if ($rptaPubli['count'] > 1) {
                         $message .= " y " . ($rptaPubli['count'] - 1) . " personas mas ";
                     }
                     $message .= " han comentado una publicacion. </p>";
                 }
                 $message .= "<p> Ingresa a  <a href='" . site_url() . "/Publication/get/" . $arrPost['publicationid'] . "'>lifeleg.com</a> y enterate. </p>" . "<p style='font-size:11px;color:#F2F2F2'> Lifeleg, Inc </p>";
                 foreach ($rptaTmp['array'] as $key => $value) {
                     if ($value['userid'] == $userData['userid']) {
                         $find = 1;
                     } else {
                         array_push($arrId, $value['notification_id']);
                         $acumMail .= $value['email'];
                     }
                 }
                 if (!empty($arrId)) {
                     $this->notification->updateNotific($arrId, 11);
                 }
                 send_email("Alguien ha comentado una publicación.", $message, $acumMail, false);
             }
             if ($find == 0) {
                 $arrTemp = array("userid" => $userData['userid'], "publicationid" => $arrPost['publicationid'], "activityid" => 2, "statusid" => 12);
                 $this->notification->saveNotification($arrTemp);
             }
         }
     }
     echo json_encode($return);
 }
示例#3
0
 function reg_model($arr)
 {
     $arr['name'] = clearCaracter($arr['name']);
     $arr['lastname'] = clearCaracter($arr['lastname']);
     $arr['email'] = clearCaracter($arr['email']);
     $arr['profile'] = clearCaracter($arr['email']);
     $arr['mobilephone'] = (int) $arr['mobilephone'];
     $real_ip_adress = 0;
     if (isset($_SERVER['HTTP_CLIENT_IP'])) {
         $real_ip_adress = $_SERVER['HTTP_CLIENT_IP'];
     }
     if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
         $real_ip_adress = $_SERVER['HTTP_X_FORWARDED_FOR'];
     } else {
         $real_ip_adress = $_SERVER['REMOTE_ADDR'];
     }
     $countryname = ip_info($real_ip_adress, "countrycode");
     $cityname = ip_info($real_ip_adress, "region");
     if (!is_null($countryname)) {
         $arr['countryid'] = $countryname;
         $arrCity = $this->city->getIdCity($countryname, $cityname);
         if ($arrCity['rpta'] == true) {
             $arr['cityid'] = $arrCity['array']['cityid'];
         }
     }
     $rpta = $this->login->reg_model($arr);
     if ($rpta == true) {
         $this->login($arr);
     } else {
         return "Problemas con la conexión, Intentelo nuevamente dentro de unos momentos.";
     }
 }
示例#4
0
 function checkGroup($groupid = null)
 {
     $return = array("rpta" => false);
     if (is_null($groupid)) {
         echo json_encode($return);
         exit;
     }
     $dataPost = $this->input->post();
     $msg = $dataPost['imboxchat'];
     $dataSession = getSession();
     $userid = $dataSession['userid'];
     $rpta = $this->message->checkGroup($userid, $groupid);
     if ($rpta['rpta'] == true || $groupid == 1) {
         $dataSend = array("message" => clearCaracter($msg), "userid" => $userid, "status" => 1, "groupid" => $groupid);
         $return = $this->chat->saveMessage($dataSend);
         $return['groupid'] = $groupid;
         $return['rpta'] = true;
         $rptaAux = $this->message->getUserGroupId($groupid, $userid);
         $arrFormat = array();
         foreach ($rptaAux['array'] as $key => $value) {
             array_push($arrFormat, $value['userid']);
         }
         $return['array'] = $arrFormat;
     }
     echo json_encode($return);
 }
示例#5
0
 public function saveQualification()
 {
     $return = array("rpta" => false);
     $dataSession = getSession();
     $dataPost = $this->input->post();
     $code = $dataPost['code'];
     $rpta = $this->clinic->checkCodeQualification($code);
     if ($rpta['rpta'] == false) {
         echo json_encode($return);
         exit;
     }
     $arrTmp = array("qualification" => $dataPost['qualification'], "comment" => clearCaracter($dataPost['comment']), "use" => 1);
     $return = $this->clinic->updateQualification($dataPost['code'], $arrTmp);
     echo json_encode($return);
 }