Example #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);
         }
     }
 }
Example #2
0
 /**
  * Get basic and extended metadata included in the file itself
  *
  * @param    string         $file              path to file or content of file
  * @param    bool           $ispath            indicates whether $file is a path (true) or the file contents (false)
  * @param    bool           $extended          indicates whether to retrieve extended metadata information
  *
  * @return \FileMetadata FileMetadata object with properties for the various types of metadata
  */
 function getMetadata($file, $ispath = true, $extended = true)
 {
     if (empty($file)) {
         return false;
         //set contents and current name as well as type in some situations
     } elseif (!$ispath) {
         //when $file is actual file contents rather than a path - create a temporary file name
         // needed for some php functions
         $temppath = $this->temppathFromContent($file);
         $leavelink = false;
         if (!$temppath) {
             $this->error = 'The file is empty';
         } else {
             $this->filesize = @filesize($temppath);
             $this->currname = $temppath;
         }
     } else {
         //when $file is a path
         if (is_readable($file)) {
             $this->currname = $file;
             $this->filesize = @filesize($file);
             $temppath = $file;
             $leavelink = true;
             if ($this->filesize <= 0) {
                 $this->error = 'The file is empty';
             }
             //if not readable, see if it's an external file
         } elseif (strpos($file, 'http') !== false) {
             $filegallib = TikiLib::lib('filegal');
             $externalinfo = $filegallib->get_info_from_url($file);
             $temppath = $this->temppathFromContent($externalinfo['data']);
             $leavelink = false;
             if (!$temppath) {
                 $this->error = 'The file is not readable';
             } else {
                 $this->currname = $file;
                 //go ahead and get content of external file here since this class is only called for external files
                 //when getting extended metadata through the img plugin
                 $this->content = $externalinfo['data'];
                 $this->filesize = @filesize($file);
                 //set type here for external files
                 $this->type = $externalinfo['type'];
             }
         } else {
             $this->error = 'The file is not readable';
             $leavelink = true;
         }
     }
     //set basic info
     $this->basicraw['size'] = $this->filesize;
     if (class_exists('finfo') && is_readable($temppath)) {
         $finfo = new finfo(FILEINFO_MIME);
         $type_charset = $finfo->file($temppath);
         $type_charset = explode(';', $type_charset);
         //external file types may already be set at this point
         $this->basicraw['type'] = empty($this->type) ? $type_charset[0] : $this->type;
         $this->basicraw['charset'] = trim($type_charset[1]);
         $finfo = new finfo(FILEINFO_DEVICES);
         $this->basicraw['devices'] = $finfo->file($temppath);
     }
     //process basic info
     if (is_array($this->basicraw)) {
         require_once 'lib/metadata/datatypes/basicinfo.php';
         $basic = new BasicInfo();
         $this->basicinfo = $basic->processRawData($this->basicraw);
     }
     //from this point, additional metadata is obtained from classes specific to the file type in separate php files
     //all results for this additional metadata go into the $this->typemeta array
     if ($extended && $this->canProcessExtended()) {
         //set content property
         if ($this->content === null) {
             $this->content = $ispath === false ? $file : file_get_contents($file);
         }
         //used for name of class and the file the class is in
         $type = $this->types[$this->basicraw['type']];
         //file must be named based on $type
         include_once 'lib/metadata/filetypes/' . $type . '.php';
         //class name is same as file name except first letter is capitalized
         $type = ucfirst($type);
         $typeObj = new $type($this);
         $this->typemeta = $typeObj->getExtendedData($this);
         //Set client to null to avoid having clients using metadata to access the file content
         $this->content = null;
     }
     $this->setBestMetadata();
     if (!$leavelink) {
         unlink($temppath);
     }
     return $this;
 }
Example #3
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();
 }
Example #4
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 
Example #5
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));
}
Example #6
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();
 }
Example #7
0
 public function actionPost()
 {
     // check if api is enabled
     $api_status = ApiStatus::getFirst();
     if (!$api_status->isApiOn()) {
         $this->_sendResponse(200, 'API access has been disabled. Contact VJF administrator.');
     }
     // perform routine auth
     $this->authenticate();
     // api key is valid, now parse the json object
     $request_obj = Yii::app()->request->getRawBody();
     $job_posting = CJSON::decode($request_obj);
     if (!isset($job_posting) || is_null($job_posting)) {
         $this->_sendResponse(500, 'Empty job posting body.');
     }
     // dissect scis job posting information
     $jp_id = $job_posting['URL'];
     //$job_posting['ID'];
     $jp_postedTime = $job_posting['PostedTime'];
     $jp_expireTime = $job_posting['ExpireTime'];
     $jp_company = $job_posting['Company'];
     $jp_position = $job_posting['Position'];
     $jp_company_url = $job_posting['URL'];
     $jp_company_background = $job_posting['Background'];
     $jp_description = $job_posting['Description'];
     $jp_duties = $job_posting['Duties'];
     $jp_qualifications = $job_posting['Qualifications'];
     $jp_company_email = $job_posting['Email'];
     $jp_posted_by = $job_posting['PostedBy'];
     //$jp_posting_format = $job_posting['Format']; dont care about this, ask joshua
     // attempt to find user in database (by email) that corresponds to the job posting
     $user_found = User::model()->find('email=:jp_company_email', array(':jp_company_email' => $jp_company_email));
     // if  user not found in database, create a new 'dummy' user for this posting
     if (count($user_found) <= 0) {
         // user info (exclude first name and last name)
         $new_user = new User();
         $new_user->email = $jp_company_email;
         $new_user->activated = 1;
         // activate their account, and force them to retreive password (if they ever want to login)
         // generate username from email
         $user_name = str_replace(array('@', '.'), '_', $jp_company_email);
         $new_user->username = $user_name;
         $new_user->FK_usertype = 2;
         // employer type
         $new_user->registration_date = new CDbExpression('NOW()');
         $new_user->image_url = '/JobFair/images/profileimages/user-default.png';
         // hash the password before storing it into the database
         $hasher = new PasswordHash(8, false);
         $new_user->password = $hasher->HashPassword($new_user->password);
         // add user to db
         $new_user->save(false);
         // user company info
         $cmpny_info = new CompanyInfo();
         $cmpny_info->name = $jp_company;
         $cmpny_info->website = $jp_company_url;
         $cmpny_info->description = $jp_company_background;
         $cmpny_info->FK_userid = $new_user->id;
         // add company info to db
         $cmpny_info->save(false);
         // user basic info
         $basic_info = new BasicInfo();
         $basic_info->about_me = $jp_posted_by;
         // ask professor about this mapping
         $basic_info->userid = $new_user->id;
         $basic_info->hide_phone = 1;
         $basic_info->allowSMS = 0;
         $basic_info->validated = 1;
         // add basic info to db
         $basic_info->save(false);
     }
     // we have a user, post under his/her account
     $current_user = isset($new_user) ? $new_user : $user_found;
     // check for duplicate postings
     //        $dup_entries = Job::model()->find(  "FK_poster=:poster AND ".
     //                                            "title=:title AND ".
     //                                            "deadline=:deadline AND ".
     //                                            "post_date=:post_date",
     //                                            array(  ':poster' => $current_user->id,
     //                                                    ':title' => $jp_position,
     //                                                    ':deadline' => date('Y-m-d H:i:s', strtotime($jp_expireTime)),
     //                                                    ':post_date' => $jp_postedTime));
     $dup_entries = Job::model()->find("posting_url=:job_url", array(':job_url' => $jp_id));
     // duplicate entry, ignore
     if (count($dup_entries) > 0) {
         $new_job_posting = $dup_entries;
         $new_job_posting->FK_poster = $current_user->id;
         // need an account
         $new_job_posting->post_date = $jp_postedTime;
         $new_job_posting->title = $jp_position;
         $new_job_posting->deadline = date('Y-m-d H:i:s', strtotime($jp_expireTime));
         $new_job_posting->description = $jp_description . $jp_duties . $jp_qualifications;
         $new_job_posting->type = 'CIS';
         // know it was posted using this api
         $new_job_posting->compensation = "";
         // not available from CIS
         $new_job_posting->posting_url = $jp_id;
         $new_job_posting->comp_name = $jp_company;
         // post the job to db
         $new_job_posting->save(false);
         // send response and stop application
         $this->_sendResponse(400, 'Job entry has been updated in the database.');
     }
     // no duplicates, add posting
     $new_job_posting = new Job();
     $new_job_posting->FK_poster = $current_user->id;
     // need an account
     $new_job_posting->post_date = $jp_postedTime;
     $new_job_posting->title = $jp_position;
     $new_job_posting->deadline = date('Y-m-d H:i:s', strtotime($jp_expireTime));
     $new_job_posting->description = $jp_description . $jp_duties . $jp_qualifications;
     $new_job_posting->type = 'CIS';
     // know it was posted using this api
     $new_job_posting->compensation = "";
     // not available from CIS
     $new_job_posting->posting_url = $jp_id;
     $new_job_posting->comp_name = $jp_company;
     // post the job to db
     $new_job_posting->save(false);
     // skill match descripnt against database
     $decoded_desc = utf8_decode($new_job_posting->description);
     $decoded_desc = str_replace(array('/', ',', '.'), ' ', $decoded_desc);
     $description_words = explode(' ', $decoded_desc);
     // split into words
     $skill_order = 0;
     foreach ($description_words as $word) {
         // check database to see if current word is a skill
         $skill = Skillset::model()->find("name=:name", array(":name" => $word));
         if ($skill) {
             // its a skill, map it to this posting on database
             $skill_map = new JobSkillMap();
             $skill_map->jobid = $new_job_posting->id;
             $skill_map->skillid = $skill->id;
             $skill_map->ordering = $skill_order;
             $skill_order++;
             $skill_map->save(false);
         }
     }
     // all went good
     $this->_sendResponse(200);
 }
Example #8
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();
 }
Example #9
0
 public function actionCareerPathSync()
 {
     // using test URL retrieve mock json objects
     // here I would request a date range, since this script runs daily as a cron job
     //
     $request = Yii::app()->curl->run('http://www.json-generator.com/api/json/get/bRQiTpYSCq?indent=2');
     $job_postings = CJSON::decode($request->getData());
     // keep track of new jobs
     $new_jobs_count = 0;
     // check each object to see if it has been posted already:
     // criteria for duplicate jobs:
     // - same title, description and expiration date
     foreach ($job_postings as $job_posting) {
         // dissect scis job posting information
         $jp_id = $job_posting['ID'];
         $jp_postedTime = $job_posting['PostedTime'];
         $jp_expireTime = $job_posting['ExpireTime'];
         $jp_company = $job_posting['Company'];
         $jp_position = $job_posting['Position'];
         $jp_company_url = $job_posting['URL'];
         $jp_company_background = $job_posting['Background'];
         $jp_description = $job_posting['Description'];
         $jp_duties = $job_posting['Duties'];
         $jp_qualifications = $job_posting['Qualifications'];
         $jp_company_email = $job_posting['Email'];
         $jp_posted_by = $job_posting['PostedBy'];
         //$jp_posting_format = $job_posting['Format']; dont care about this, ask joshua
         // attempt to find user in database (by email) that corresponds to the job posting
         $user_found = User::model()->find('email=:jp_company_email', array(':jp_company_email' => $jp_company_email));
         // if  user not found in database, create a new 'dummy' user for this posting
         if (count($user_found) <= 0) {
             // user info (exclude first name and last name)
             $new_user = new User();
             $new_user->email = $jp_company_email;
             $new_user->activated = 1;
             // activate their account, and force them to retreive password (if they ever want to login)
             // generate username from email
             $user_name = str_replace(array('@', '.'), '_', $jp_company_email);
             $new_user->username = $user_name;
             $new_user->FK_usertype = 2;
             // employer type
             $new_user->registration_date = new CDbExpression('NOW()');
             $new_user->image_url = '/JobFair/images/profileimages/user-default.png';
             // hash the password before storing it into the database
             $hasher = new PasswordHash(8, false);
             $new_user->password = $hasher->HashPassword($new_user->password);
             // add user to db
             $new_user->save(false);
             // user company info
             $cmpny_info = new CompanyInfo();
             $cmpny_info->name = $jp_company;
             $cmpny_info->website = $jp_company_url;
             $cmpny_info->description = $jp_company_background;
             $cmpny_info->FK_userid = $new_user->id;
             // add company info to db
             $cmpny_info->save(false);
             // user basic info
             $basic_info = new BasicInfo();
             $basic_info->about_me = $jp_posted_by;
             // ask professor about this mapping
             $basic_info->userid = $new_user->id;
             $basic_info->hide_phone = 1;
             $basic_info->allowSMS = 0;
             $basic_info->validated = 1;
             // add basic info to db
             $basic_info->save(false);
         }
         // we have a user, post under his/her account
         $current_user = isset($new_user) ? $new_user : $user_found;
         // check for duplicate postings
         $dup_entries = Job::model()->find("FK_poster=:poster AND " . "title=:title AND " . "deadline=:deadline AND " . "post_date=:post_date", array(':poster' => $current_user->id, ':title' => $jp_position, ':deadline' => date('Y-m-d H:i:s', strtotime($jp_expireTime)), ':post_date' => $jp_postedTime));
         // duplicate entry, ignore
         if (count($dup_entries) > 0) {
             continue;
         }
         // no duplicates, add posting
         $new_job_posting = new Job();
         $new_job_posting->FK_poster = $current_user->id;
         // need an account
         $new_job_posting->post_date = $jp_postedTime;
         $new_job_posting->title = $jp_position;
         $new_job_posting->deadline = date('Y-m-d H:i:s', strtotime($jp_expireTime));
         $new_job_posting->description = $jp_description . $jp_duties . $jp_qualifications;
         $new_job_posting->type = 'CIS';
         // know it was posted using this api
         $new_job_posting->compensation = "";
         // not available from CIS
         $new_job_posting->posting_url = $jp_id;
         // post the job to db
         $new_job_posting->save(false);
         // skill match descripnt against database
         $decoded_desc = utf8_decode($new_job_posting->description);
         $decoded_desc = str_replace(array('/', ',', '.'), ' ', $decoded_desc);
         $description_words = explode(' ', $decoded_desc);
         // split into words
         $skill_order = 0;
         foreach ($description_words as $word) {
             // check database to see if current word is a skill
             $skill = Skillset::model()->find("name=:name", array(":name" => $word));
             if ($skill) {
                 // its a skill, map it to this posting on database
                 $skill_map = new JobSkillMap();
                 $skill_map->jobid = $new_job_posting->id;
                 $skill_map->skillid = $skill->id;
                 $skill_map->ordering = $skill_order;
                 $skill_order++;
                 $skill_map->save(false);
             }
         }
         // all went good
         echo 'Success!';
     }
 }