Ejemplo n.º 1
0
 public function run($args)
 {
     date_default_timezone_set('America/New_York');
     $date = date('Y-m-d');
     $time = date('H:i:s');
     $futuretime = date('H:i:s', strtotime("+30 min"));
     $entries = VideoInterview::model()->findAllBySql("SELECT * FROM video_interview WHERE\n    \t                                                    date=:date AND time BETWEEN CONVERT(" . "'" . $time . "'" . ", TIME) AND\n    \t                                                    CONVERT(" . "'" . $futuretime . "'" . ", TIME)", array(":date" => $date));
     echo $date . " " . $time . "\n";
     echo $futuretime . "\n";
     spl_autoload_unregister(array('YiiBase', 'autoload'));
     require 'Services/Twilio.php';
     $sid = "AC1a9ec3e5aaf3135a5e4893c095be8430";
     $token = "15871d8b55c402145f12c77dd7525644";
     $client = new Services_Twilio($sid, $token);
     spl_autoload_register(array('YiiBase', 'autoload'));
     echo "Timeframe: " . $date . " (" . $time . " - " . $futuretime . ")\nFound " . count($entries) . "interview(s)\n";
     foreach ($entries as $avideo) {
         $infoEmployer = BasicInfo::model()->find("userid=:userid", array('userid' => $avideo->FK_employer));
         $userEmployer = User::model()->find("id=:id", array('id' => $avideo->FK_employer));
         $infoStudent = BasicInfo::model()->find("userid=:userid", array('userid' => $avideo->FK_student));
         $userStudent = User::model()->find("id=:id", array('id' => $avideo->FK_student));
         //Send message to employer
         //if($infoEmployer->allowSMS == 1 && $infoEmployer->validated == 1)
         if ($infoEmployer->allowSMS == 1 && $infoEmployer->validated == 1 && $userEmployer->activated == 1) {
             echo "Sending Employer SMS [" . $infoEmployer->phone . "]\n";
             $msg = "Hello " . $userEmployer->username . " this is friendly reminder from Virtual Job Fair about your scheduled interview with " . $userStudent->username . " today at  " . $avideo->time;
             //echo $avideo->session_key . "\n";
             $client->account->messages->sendMessage("+17868375870", "+1" . $infoEmployer->phone, $msg);
         }
         //Send message to student
         //if($infoStudent->allowSMS == 1 && $infoStudent->validated == 1)
         if ($infoStudent->allowSMS == 1 && $infoStudent->validated == 1 && $userStudent->activated == 1) {
             echo "Sending Student SMS [" . $infoStudent->phone . "]\n";
             $msg = "Hello " . $userStudent->username . " this is friendly reminder from Virtual Job Fair about your scheduled interview with " . $userEmployer->username . " today at  " . $avideo->time;
             //echo $avideo->session_key . "\n";
             $client->account->messages->sendMessage("+17868375870", "+1" . $infoStudent->phone, $msg);
         }
     }
 }
Ejemplo n.º 2
0
 public function cascade_delete()
 {
     $id = $this->id;
     // delete basic info mappings
     $basic_info = BasicInfo::model()->findByAttributes(array('userid' => $id));
     if (isset($basic_info)) {
         $basic_info->delete();
     }
     // delete company info mapping
     $comp_info = CompanyInfo::model()->findByAttributes(array('FK_userid' => $id));
     if (isset($comp_info)) {
         $comp_info->delete();
     }
     // delete sms mappings
     $sms_mappings = SMS::model()->findAll("sender_id=:id OR receiver_id=:id ", array(':id' => $id));
     foreach ($sms_mappings as $sms_mapping) {
         $sms_mapping->delete();
     }
     // delete education mapping
     $edu_mappings = Education::model()->findAllByAttributes(array('FK_user_id' => $id));
     foreach ($edu_mappings as $edu_mapping) {
         $edu_mapping->delete();
     }
     // delete skills mappings
     $skills_mappings = StudentSkillMap::model()->findAllByAttributes(array('userid' => $id));
     foreach ($skills_mappings as $skills_mapping) {
         $skills_mapping->delete();
     }
     // delete application mappings
     $app_mappings = Application::model()->findAllByAttributes(array('userid' => $id));
     foreach ($app_mappings as $app_mapping) {
         $app_mapping->delete();
     }
     // delete jobs mappings
     $job_mappings = Job::model()->findAllByAttributes(array('FK_poster' => $id));
     foreach ($job_mappings as $job_mapping) {
         $job_mapping->cascade_delete();
     }
     $this->delete();
 }
Ejemplo n.º 3
0
?>
	
	<?php 
if (isset($_GET['error'])) {
    $error = $_GET['error'];
    ?>
		<p style="color:red;"> <?php 
    echo $error;
    ?>
</p><?php 
}
?>

	
	<?php 
$model->basicInfo = BasicInfo::model();
//needed to store phone number
?>
	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<p style="color:red" id="errors"></p>
	

	
	<div id="regbox">
	

		<?php 
echo $form->labelEx($model, 'first_name');
?>
		<?php 
Ejemplo n.º 4
0
        <div class="modal-body">
            Choose the one you want to keep: <br>


<?php 
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'link_accounts', 'enableClientValidation' => true, 'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => false, 'afterValidate' => 'js:formSend'), 'htmlOptions' => array('class' => 'well')));
?>

<?php 
//echo $form->hiddenField( $model, 'next',array('value'=>$email));
?>

<?php 
//get current user information
$user = User::getCurrentUser();
$basic_info = BasicInfo::model()->findByAttributes(array('userid' => $user->id));
$nothing = false;
//choosing a picture
if ($picture != null && $user->image_url != null && $picture != $user->image_url) {
    $nothing = true;
    echo 'Choose your profile picture';
    $model->profilePic = $user->image_url;
    $image = CHtml::image($picture, '', array('width' => 100, 'height' => 60));
    $user_image = CHtml::image($user->image_url, '', array('width' => 100, 'height' => 60));
    echo $form->radioButtonList($model, 'profilePic', array($user->image_url => $user_image, $picture => $image));
    echo '<br/>';
}
if ($user->image_url == null) {
    $nothing = true;
    echo $form->hiddenField($model, 'profilePicVar', array('value' => $first_name));
}
Ejemplo n.º 5
0
 public function actionChangeSMSpref()
 {
     $username = Yii::app()->user->name;
     $model = User::model()->find("username=:username", array(':username' => $username));
     $info = BasicInfo::model()->find("userid=:userid", array('userid' => $model->id));
     $SMS = new SMS();
     $selection = $_POST['BasicInfo']['allowSMS'];
     $info->allowSMS = $selection;
     $info->save(false);
     if (User::isCUrrentUserStudent() && $info->validated == 1) {
         $this->render('verified', array('info' => $info));
         return;
     }
     $this->render('sendsms', array('info' => $info, 'SMS' => $SMS));
     //$this->actionSendsms();
 }
Ejemplo n.º 6
0
 public function actionUserChoice()
 {
     if (isset($_POST['LinkTooForm'])) {
         $user = User::getCurrentUser();
         $basic_info = BasicInfo::model()->findByAttributes(array('userid' => $user->id));
         $model = new LinkTooForm();
         $model->attributes = $_POST['LinkTooForm'];
         $mesg = $model->toPost;
         if ($model->profilePic != null) {
             $user->image_url = $model->profilePic;
             $user->save(false);
         }
         if ($model->profilePicVar != null) {
             $user->image_url = $model->profilePicVar;
             $user->save(false);
         }
         if ($model->firstname != null) {
             $user->first_name = $model->firstname;
             $user->save(false);
         }
         if ($model->firstnamevar != null) {
             $user->first_name = $model->firstnamevar;
             $user->save(false);
         }
         if ($model->lastname != null) {
             $user->last_name = $model->lastname;
             $user->save(false);
         }
         if ($model->lastnamevar != null) {
             $user->last_name = $model->lastnamevar;
             $user->save(false);
         }
         if ($model->email != null) {
             $user->email = $model->email;
             $user->save(false);
         }
         if ($model->emailvar != null) {
             $user->email = $model->emailvar;
             $user->save(false);
         }
         if ($model->phone != null) {
             $basic_info->phone = $model->phone;
             $basic_info->save(false);
         }
         if ($model->phonevar != null) {
             $basic_info->phone = $model->phonevar;
             $basic_info->save(false);
         }
         if ($model->city != null) {
             $basic_info->city = $model->city;
             $basic_info->save(false);
         }
         if ($model->cityvar != null) {
             $basic_info->city = $model->cityvar;
             $basic_info->save(false);
         }
         if ($model->state != null) {
             $basic_info->state = $model->state;
             $basic_info->save(false);
         }
         if ($model->statevar != null) {
             $basic_info->state = $model->statevar;
             $basic_info->save(false);
         }
         if ($model->about_me != null) {
             $basic_info->about_me = $model->about_me;
             $basic_info->save(false);
         }
         if ($model->about_me_var != null) {
             $basic_info->about_me = $model->about_me_var;
             $basic_info->save(false);
         }
     }
     Yii::app()->end();
 }