public function __construct($socket) { $this->socket = $socket; $this->nodeID = self::getUniqID(); //Get the handshake from the socket $getHandshake = array($socket); socket_select($getHandshake, $write = null, $except = null, 0); //If we don't receive any data from the client. Disconnect it. if (count($getHandshake) != 1) { echo "DID NOT RECEIVE HANDSHAKE!\n"; } else { @socket_recv($socket, $handshake, 2048, 0); Handshake::findProtocol($this, $handshake); } }
public function cascade_delete() { $id = $this->id; // remove any skill mappings $skill_mappigns = JobSkillMap::model()->findAllByAttributes(array('jobid' => $id)); foreach ($skill_mappigns as $skill_mapping) { $skill_mapping->delete(); } // remove any applications mappings $app_mappings = Application::model()->findAllByAttributes(array('jobid' => $id)); foreach ($app_mappings as $app_mapping) { $app_mapping->delete(); } // remove any handshake mappings $hs_mappings = Handshake::model()->findAllByAttributes(array('jobid' => $id)); foreach ($hs_mappings as $hs_mapping) { $hs_mapping->delete(); } // finally remove job $this->delete(); }
public function actionVirtualHandshake($jobid, $studentid) { $handshake = new Handshake(); $handshake->jobid = $jobid; $handshake->studentid = $studentid; $handshake->employerid = User::getCurrentUser()->id; $student = User::model()->findByPk($studentid); if (Job::hasHandShake($jobid, User::getCurrentUser()->id, $studentid) == "" && User::getCurrentUser()->isAEmployer() && $student->isAStudent()) { $handshake->save(false); //SENDNOTIFICATION to $student, an employer is interested you, apply for this job $joblink = CHtml::link(CHtml::encode('View Job'), "/JobFair/index.php/job/view/jobid/" . $jobid, array('target' => '_blank', 'style' => 'float:left')); $link = 'http://' . Yii::app()->request->getServerName() . '/JobFair/index.php/job/view/jobid/' . $jobid; $job = Job::model()->findByPk($jobid); $message = User::getCurrentUser()->username . " is interested in you for the following job post: " . $job->title . " Click here to view the post and consider applying."; User::sendUserNotificationHandshakeAlart($handshake->employerid, $studentid, $link, $message); //SENT EMAIL NOTIFICATION $link1 = CHtml::link('click here to see ' . $job->title . ' page', 'http://' . Yii::app()->request->getServerName() . '/JobFair/index.php/job/view/jobid/' . $jobid); $message1 = User::getCurrentUser()->username . " is interested in you for the following job post: " . $job->title . "<br/>{$link1}"; //$html = User::replaceMessage($student->username, $message1); User::sendEmail($student->email, "A handshake from Virtual Job Fair", "Handshake Notification", $message1); //User::sendEmailStudentNotificationVirtualHandshakeAlart($student->email, $student->username, User::getCurrentUser()->username ,$message1); } return; }