public function newNotificationsAction() { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $request = $this->getRequest(); $subjectNotification = $request->getParam("subjectNotification", ""); $contentNotification = $request->getParam("contentNotification", ""); $receideid = $request->getParam("receiverid", ""); $sestionClient = PR_Session::getSession(PR_Session::SESSION_USER); $clientID = $sestionClient['UserID']; $noti = new PR_Api_Noti(null); $updateFields = array('subjecttext' => $subjectNotification, 'sender_iduser' => $clientID, 'sender_iduser' => $clientID, 'receiver_iduser' => $receideid, 'content' => $contentNotification); $rsl = $noti->save($updateFields); if ($rsl !== 0) { $return = 1; } else { $return = 0; } $notiClass = new PR_Api_Core_NotiClass(); $result = array(); $result['list'] = $notiClass->getList($clientID, $limit = 10, $offset = 0); $result['suc'] = $return; //reload $Career_PR_Api = new PR_Api_Core_CareerClass(); $receivIDs = $Career_PR_Api->getListReceiveIDbySenderID($clientID); $listCandidate1 = $Career_PR_Api->getListCandidateByUserID($receivIDs, 3, 0); $CompanyID = $sestionClient['CompanyID']; $listSkill = $Career_PR_Api->getSkillByCompanyID($CompanyID); $listCandidate = array(); $list = array(); if (!empty($listCandidate1) && count($listCandidate1) > 0) { foreach ($listCandidate1 as $kkk => $listCandidate1Info) { if (!empty($listCandidate1Info['Skills']) && count($listCandidate1Info['Skills']) > 0) { $list = ""; foreach ($listCandidate1Info['Skills'] as $listInfor) { if (!empty($listSkill) && count($listSkill) > 0) { foreach ($listSkill as $keylistskill => $listSkillInfo) { if ($listSkillInfo['SkillID'] == $listInfor['SkillID']) { $list[] = $listSkillInfo['title']; } } } } } if (!empty($list) && count($list) > 0) { $list = array_unique($list); $listCandidate1Info['strTitle'] = $list; $listCandidate[] = $listCandidate1Info; } } } $result['listCandidate'] = $listCandidate; /*echo "<pre>"; print_r($result); echo "</pre>"; die(); */ $response = $this->getResponse(); $response->clearAllHeaders()->clearBody(); $result = json_encode($result); $response->setHeader('Content-type', 'application/json'); $response->setHeader('Content-Length', strlen($result), true)->setBody($result); }
public function saveEditNotificationsAction() { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $request = $this->getRequest(); $subject = $request->getParam("editNotification", ""); $content = $request->getParam("editcontentNotification", ""); $ModalEditNotiID = $request->getParam("ModalEditNotiID", ""); $ModalEditNotiID = trim($ModalEditNotiID); // echo "<pre>"; //print_r($ModalEditNotiID); // echo "</pre>"; die(); $sestionClient = PR_Session::getSession(PR_Session::SESSION_USER); $clientID = $sestionClient['UserID']; $noti = new PR_Api_Noti($ModalEditNotiID); //$updateFields = array('subjecttext'=>$content,'sender_iduser'=>$clientID,'sender_iduser'=>$clientID, 'receiver_iduser'=>$receideid); $updateFields = array('subjecttext' => $subject, 'sender_iduser' => $clientID, 'content' => $content); $result = $noti->save($updateFields); if ($result) { $return = array("success" => 1, "error" => ""); } else { $return = array("success" => 0, "error" => ""); } $response = $this->getResponse(); $response->clearAllHeaders()->clearBody(); $return = json_encode($return); $response->setHeader('Content-type', 'application/json'); $response->setHeader('Content-Length', strlen($return), true)->setBody($return); }