Ejemplo n.º 1
0
 function updatePosition()
 {
     $positionList = $this->input->post('positionList');
     $idList = $this->input->post('idList');
     $o = new Experience();
     for ($i = 0; $i < count($idList); $i++) {
         $o->where("id", $idList[$i]);
         $o->get();
         $o->position = $positionList[$i];
         $o->save();
         $o->clear();
     }
     redirect("admin/experiences/listAll/");
 }
Ejemplo n.º 2
0
 function save($object = '', $related_field = '')
 {
     if (!$this->exists()) {
         $o = new Experience();
         $o->select_max('position');
         $o->get();
         if (count($o->all) != 0) {
             $max = $o->position + 1;
             $this->position = $max;
         } else {
             $this->postion = 1;
         }
     }
     return parent::save($object, $related_field);
 }
 private function _breakdown($leve_id = 0)
 {
     $leve = Leve::with('classjob', 'classjob.en_name', 'item', 'item.name', 'item.recipe', 'item.recipe.reagents', 'item.recipe.reagents.name')->find($leve_id);
     $experience = Experience::whereBetween('level', array($leve->level + 1, $leve->level + 10))->get();
     $chart = array();
     foreach ($experience as $xp) {
         // NQ Turnins
         $amount = $turnins = 0;
         if ($leve->xp > 0) {
             while ($amount < $xp->experience) {
                 $amount += $leve->xp;
                 $turnins++;
             }
         }
         // HQ Turnins
         $amount = $hq_turnins = 0;
         if ($leve->xp > 0) {
             while ($amount < $xp->experience) {
                 $amount += $leve->xp * 2;
                 // 2.1 patch changed it from 200% to 100% bonus
                 $hq_turnins++;
             }
         }
         $chart[$xp->level] = array('level' => $xp->level, 'requires' => $xp->experience, 'turnins' => $turnins, 'hq_turnins' => $hq_turnins);
     }
     return array('leve' => $leve, 'chart' => $chart);
 }
Ejemplo n.º 4
0
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Experience::create([]);
     }
 }
Ejemplo n.º 5
0
 /**
  * Key-value pairs of all experiences
  * @return array [category_id => category_name]
  */
 public static function all()
 {
     static $result;
     if (!is_null($result)) {
         return $result;
     }
     $command = Yii::app()->db;
     /* @var CDbConnection $command */
     $rows = $command->createCommand()->select('id, name')->from(Experience::model()->tableName())->queryAll();
     $result = [];
     foreach ($rows as $row) {
         $result[$row['id']] = $row['name'];
     }
     return $result;
 }
 private function _breakdown($leve_id = 0)
 {
     $leve = Leve::with('item', 'item.name', 'item.recipe', 'item.recipe.reagents', 'item.recipe.reagents.name')->find($leve_id);
     $experience = Experience::whereBetween('level', array($leve->level, $leve->level + 9))->get();
     $xp_rewarded = $leve->xp * 2;
     // 2.1 patch changed it from 200% to 100% bonus
     $chart = array();
     foreach ($experience as $xp) {
         $previous_overkill = isset($chart[$xp->level - 1]) ? $chart[$xp->level - 1]['overkill'] : 0;
         $needed = $xp->experience - $previous_overkill;
         $amount = $turnins = 0;
         if ($xp_rewarded > 0) {
             while ($amount < $needed) {
                 $amount += $xp_rewarded;
                 $turnins++;
             }
         }
         $chart[$xp->level] = array('level' => $xp->level, 'requires' => $xp->experience, 'previous_overkill' => $previous_overkill, 'turnins' => $turnins, 'overkill' => $amount - $needed);
     }
     return array('leve' => $leve, 'chart' => $chart);
 }
    }
}
if (isset($_GET['action']) && $_GET['action'] == "delete" && isset($_GET['id'])) {
    $experience = new Experience();
    $experience->id = (int) $_GET['id'];
    if ($experience->delete()) {
        $session->message("Experience deleted ");
        redirect_to($_SERVER['PHP_SELF'] . "?#" . $_GET['id']);
        die;
    } else {
        $message = join("<br />", $experience->errors);
    }
}
if (isset($_GET['action']) && $_GET['action'] == "add") {
    if (isset($_POST['bt_add'])) {
        $add_new = new Experience();
        $add_new->experience_name = $_POST['txt_experience_name'];
        $add_new->var_name = $add_new->mod_write_check($_POST['txt_experience_name']);
        $add_new->is_active = $_POST['txt_is_active'];
        if ($add_new->save()) {
            $session->message("New Year Experience added.");
            redirect_to($_SERVER['PHP_SELF']);
            die;
        } else {
            $message = join("<br />", $add_new->errors);
        }
    }
}
$experience = Experience::find_all();
$manage_lists = array();
if ($experience && is_array($experience)) {
Ejemplo n.º 8
0
 $city_var_name = empty($city) ? $jobs->city : $city->var_name;
 $smarty->assign('city', $city_name);
 $smarty->assign('city_url', $country_var_name . "/" . $state_var_name . "/" . $county_var_name . "/" . $city_var_name . "/");
 //educations
 $educations = Education::find_by_id($jobs->fk_education_id);
 $education_name = !empty($educations) ? $educations->education_name : format_lang('not_provided');
 $smarty->assign('education_var_name', $educations->var_name);
 $smarty->assign('education', $education_name);
 //career
 $careers = CareerDegree::find_by_id($jobs->fk_career_id);
 $smarty->assign('careers', $careers);
 $career_name = $careers ? $careers->career_name : format_lang('not_provided');
 $smarty->assign('career_var_name', $careers->var_name);
 $smarty->assign('career', $career_name);
 //experience
 $experiences = Experience::find_by_id($jobs->fk_experience_id);
 $smarty->assign('experiences', $experiences);
 $experience_name = !empty($experiences) ? $experiences->experience_name : format_lang('not_provided');
 $smarty->assign('experience_var_name', $experiences->var_name);
 $smarty->assign('experience', $experience_name);
 $smarty->assign('spotlight', $jobs->spotlight);
 if (!empty($jobs->job_salary) && !empty($jobs->salaryfreq)) {
     $job_salary = $jobs->job_salary . format_lang('per') . $jobs->salaryfreq;
 } else {
     $job_salary = format_lang('not_provided');
 }
 $smarty->assign('job_salary', $job_salary);
 //$smarty->assign('salaryfreq', 		$jobs->salaryfreq );
 $employer = Employer::find_by_id($jobs->fk_employer_id);
 $company_name = $employer->company_name;
 $employer_var_name = $employer->var_name;
Ejemplo n.º 9
0
if (is_array($educations) and !empty($educations)) {
    $education_t = array();
    foreach ($educations as $education) {
        $education_t[$education->id] = $education->education_name;
    }
    $smarty->assign('education', $education_t);
}
$careers = CareerDegree::find_all();
if (is_array($careers) and !empty($careers)) {
    $career_t = array();
    foreach ($careers as $career) {
        $career_t[$career->id] = $career->career_name;
    }
    $smarty->assign('career', $career_t);
}
$experiences = Experience::find_all();
if (is_array($experiences) and !empty($experiences)) {
    $experience_t = array();
    foreach ($experiences as $experience) {
        $experience_t[$experience->id] = $experience->experience_name;
    }
    $smarty->assign('experience', $experience_t);
}
$categories = Category::find_all();
if (is_array($categories) and !empty($categories)) {
    $category_t = array();
    foreach ($categories as $category) {
        $category_t[$category->id] = $category->cat_name;
    }
    $smarty->assign('category', $category_t);
}
Ejemplo n.º 10
0
                <a href="#" onclick="document.forms['search-form-kids'].submit(); return false;">
                    <img src='<?php 
echo Yii::app()->params['siteBase'];
?>
/images/icon_homepage_kids.gif' /><h5>Find
                    classes &amp; activities for kids</h5>
                </a>
            </div>
        </div>
    </div>

    <h3>Staff Picks in <span id='city'>Los Angeles</span></h3>
    <!----------- 1 row of tiles---->
    <div class="row">
        <?php 
$experiences = Experience::model()->active()->current()->findAll(array('select' => '*, rand() as rand', 'limit' => 4, 'order' => 'rand'));
$count = count($experiences);
foreach ($experiences as $i => $experience) {
    $imageHTML = '<img src="' . ($experience->picture ? $experience->picture : 'http://placehold.it/400x300') . '" />';
    $imageLink = CHtml::link($imageHTML, array('/experience/view', 'id' => $experience->Experience_ID));
    $hostName = $experience->createUser->display;
    if (strlen($hostName) > 25) {
        $hostName = substr($hostName, 0, 25);
        $hostName .= ' ...';
    }
    $hostLink = CHtml::link($hostName, array('/user/view', 'id' => $experience->Create_User_ID));
    $enrollees = '';
    foreach ($experience->enrolled as $enrollee) {
        $picLink = 'http://placeskull.com/100/100/868686';
        if ($enrollee->profilePic != null) {
            $picLink = $enrollee->profilePic;
Ejemplo n.º 11
0
<?php

require_once 'include/config.php';
///////////////////////////////////////////////////////////
// VARIABLES
//$_SESSION['language_locale'] = 'ES_ES';
//$_SESSION['language_id'] = $objLang->get(array("language_locale" => $_SESSION['language_locale']), "language_id");
///////////////////////////////////////////////////////////
// Texts
//$objTrad = new Traduction();
$arrText = $objTrad->get(array("language_id" => $_SESSION['language_id']));
// Experiences
$objExperience = new Experience();
$arrExperience = $objExperience->get(array("language_id" => $_SESSION['language_id']));
// Projects
$objProject = new Project();
$arrProject = $objProject->get(array("language_id" => $_SESSION['language_id'], "project_image_type_id" => IMAGE_TYPE_MINI));
// Util
$objUtil = new Util();
?>
 

<!-- Header CSS + JS -->
<?php 
include 'include/header.php';
?>

	<body>	
		
		<!-- Line top -->
		<?php 
Ejemplo n.º 12
0
 public function actionDemo()
 {
     // if user canceled, redirect to home page
     if (isset($_GET['oauth_problem'])) {
         $problem = $_GET['oauth_problem'];
         if ($problem == 'user_refused') {
             $this->redirect('/JobFair/index.php');
         }
     }
     if (!isset($_SESSION)) {
         session_start();
     }
     //edit by Manuel making the link dynamic, using Yii. and changing how the account will be link so if the student
     //decide to login with his linkedIn account it will be taken to the account that it is link to.
     $config['base_url'] = 'http://' . Yii::app()->request->getServerName() . '/JobFair/index.php/profile/auth.php';
     $config['callback_url'] = 'http://' . Yii::app()->request->getServerName() . '/JobFair/index.php/profile/demo';
     $config['linkedin_access'] = '2rtmn93gu2m4';
     $config['linkedin_secret'] = 'JV0fYG9ls3rclP8v';
     include_once Yii::app()->basePath . "/views/profile/linkedin.php";
     # First step is to initialize with your consumer key and secret. We'll use an out-of-band oauth_callback
     $linkedin = new LinkedIn($config['linkedin_access'], $config['linkedin_secret'], $config['callback_url']);
     //$linkedin->debug = true;
     if (isset($_REQUEST['oauth_verifier'])) {
         $_SESSION['oauth_verifier'] = $_REQUEST['oauth_verifier'];
         $linkedin->request_token = unserialize($_SESSION['requestToken']);
         $linkedin->oauth_verifier = $_SESSION['oauth_verifier'];
         $linkedin->getAccessToken($_REQUEST['oauth_verifier']);
         $_SESSION['oauth_access_token'] = serialize($linkedin->access_token);
         header("Location: " . $config['callback_url']);
         exit;
     } else {
         $linkedin->request_token = unserialize($_SESSION['requestToken']);
         $linkedin->oauth_verifier = $_SESSION['oauth_verifier'];
         $linkedin->access_token = unserialize($_SESSION['oauth_access_token']);
     }
     # You now have a $linkedin->access_token and can make calls on behalf of the current member
     $xml_response = $linkedin->getProfile("~:(id,first-name,last-name,headline,picture-url,industry,email-address,languages,phone-numbers,skills,educations,location:(name),positions,picture-urls::(original))");
     $data = simplexml_load_string($xml_response);
     // print "<pre>"; print_r($xml_response);print "</pre>";
     //print "<pre>"; print_r($data->{'picture-urls'}->{'picture-url'}[0]);print "</pre>";
     // print "<pre>"; print_r($data->{'id'});print "</pre>";
     //return;
     // check that there is no duplicate id
     $duplicateUser = User::model()->findByAttributes(array('linkedinid' => $data->{'id'}));
     if ($duplicateUser != null) {
         $this->actionDuplicationError();
         return;
     }
     // get username and link the accounts
     $username = Yii::app()->user->name;
     $user = User::model()->find("username=:username", array(':username' => $username));
     $user->linkedinid = $data->{'id'};
     $user->save(false);
     $user_id = $user->id;
     // ------------------BASIC INFO---------------
     $basic_info = null;
     $basic_info = BasicInfo::model()->findByAttributes(array('userid' => $user_id));
     if ($basic_info == null) {
         $basic_info = new BasicInfo();
     }
     $basic_info->userid = $user_id;
     $basic_info->save(false);
     // ------------------BASIC INFO -----------------
     // -----------------EDUCATION ----------------------
     // get number of educations to add
     $educ_count = $data->educations['total'];
     // delete current educations
     $delete_educs = Education::model()->findAllByAttributes(array('FK_user_id' => $user_id));
     foreach ($delete_educs as $de) {
         $de->delete();
     }
     // add educations
     for ($i = 0; $i < $educ_count; $i++) {
         // first check if current education is in school table. if not, add it
         $current_school_name = $data->educations->education[$i]->{'school-name'};
         $school_exists = School::model()->findByAttributes(array('name' => $current_school_name));
         if ($school_exists == null) {
             $new_school = new School();
             $new_school->name = $current_school_name;
             $new_school->save();
             $school_id = School::model()->findByAttributes(array('name' => $current_school_name))->id;
         } else {
             $school_id = $school_exists->id;
         }
         // now ready to add new education
         $new_educ = new Education();
         $new_educ->degree = $data->educations->education[$i]->degree;
         $new_educ->major = $data->educations->education[$i]->{'field-of-study'};
         // 	   	$model->admission_date=date('Y-m-d',strtotime($model->admission_date));
         $new_educ->graduation_date = date('Y-m-d', strtotime($data->educations->education[$i]->{'end-date'}->year));
         // 	   	print "<pre>"; print_r($new_educ->graduation_date);print "</pre>";return;
         $new_educ->FK_school_id = $school_id;
         $new_educ->FK_user_id = $user_id;
         $new_educ->additional_info = $data->educations->education[$i]->notes;
         $new_educ->save(false);
     }
     // -----------------EDUCATION ----------------------
     // -----------------EXPERIENCE -------------------
     // get number of educations to add
     $pos_count = $data->positions['total'];
     // delete current positions
     $delete_pos = Experience::model()->findAllByAttributes(array('FK_userid' => $user_id));
     foreach ($delete_pos as $de) {
         $de->delete();
     }
     for ($i = 0; $i < $pos_count; $i++) {
         $new_pos = new Experience();
         $new_pos->FK_userid = $user_id;
         $new_pos->company_name = $data->positions->position[$i]->company->name;
         $new_pos->job_title = $data->positions->position[$i]->title;
         $new_pos->job_description = $data->positions->position[$i]->summary;
         $temp_start_date = $data->positions->position[$i]->{'start-date'}->month . '/01/' . $data->positions->position[$i]->{'start-date'}->year;
         $new_pos->startdate = date('Y-m-d', strtotime($temp_start_date));
         if ($data->positions->position[$i]->{'is-current'} == 'true') {
             $new_pos->enddate = '';
         } else {
             $temp_end_date = $data->positions->position[$i]->{'end-date'}->month . '/01/' . $data->positions->position[$i]->{'end-date'}->year;
             $new_pos->enddate = date('Y-m-d', strtotime($temp_end_date));
         }
         $new_pos->city = '';
         $new_pos->state = '';
         $new_pos->save(false);
     }
     // -----------------EXPERIENCE -------------------
     // ----------------------SKILLS----------------------
     // get number of educations to add
     $linkedin_skill_count = $data->skills['total'];
     for ($i = 0; $i < $linkedin_skill_count; $i++) {
         // check if skill exists in skill set table, if not, add it to skill set table
         if (Skillset::model()->findByAttributes(array('name' => $data->skills->skill[$i]->skill->name)) == null) {
             $new_skill = new Skillset();
             $new_skill->name = $data->skills->skill[$i]->skill->name;
             $new_skill->save(false);
             //echo 'New Skill ' . $new_skill->attributes;
         }
         // check if student has that skill, if not add it to student-skill-map table
         if (StudentSkillMap::model()->findByAttributes(array('userid' => $user_id, 'skillid' => Skillset::model()->findByAttributes(array('name' => $data->skills->skill[$i]->skill->name))->id)) == null) {
             $new_sdnt_skill = new StudentSkillMap();
             $new_sdnt_skill->userid = $user_id;
             $new_sdnt_skill->skillid = Skillset::model()->findByAttributes(array('name' => $data->skills->skill[$i]->skill->name))->id;
             $new_sdnt_skill->ordering = $i + 1;
             $new_sdnt_skill->save(false);
             //echo 'New Skill for student' . $new_sdnt_skill->attributes;
         }
     }
     // ----------------------end SKILLS----------------------
     //get variables
     $mesg = "LinkedIn";
     $phone = $data->{'phone-numbers'}->{'phone-number'}->{'phone-number'};
     if ($phone != null) {
         $phone = strip_tags($data->{'phone-numbers'}->{'phone-number'}->{'phone-number'}->asXML());
     }
     $city = $data->location->name;
     if ($city != null) {
         $city = strip_tags($data->location->name->asXML());
     }
     $state = '';
     $about_me = $data->headline;
     if ($about_me != null) {
         $about_me = strip_tags($data->headline->asXML());
     }
     $picture = $data->{'picture-urls'}->{'picture-url'}[0];
     if ($picture != null) {
         $picture = strip_tags($data->{'picture-urls'}->{'picture-url'}[0]->asXML());
     }
     $xemail = $data->{'email-address'};
     if ($xemail != null) {
         $xemail = strip_tags($data->{'email-address'}->asXML());
     }
     $fname = $data->{'first-name'};
     if ($fname != null) {
         $fname = strip_tags($data->{'first-name'}->asXML());
     }
     $lname = $data->{'last-name'};
     if ($lname != null) {
         $lname = strip_tags($data->{'last-name'}->asXML());
     }
     $this->actionLinkToo($xemail, $fname, $lname, $picture, $mesg, $phone, $city, $state, $about_me);
     // return;
 }
Ejemplo n.º 13
0
 public function save_order()
 {
     $experience_array = $_POST['experience_id'];
     $order_array = $_POST['order'];
     $experience = new Experience();
     foreach ($experience_array as $key => $value) {
         $experience_id = $value;
         $experience_order = $order_array[$key];
         $experience->update('Experience', array('sequence' => $experience_order), 'id=' . $experience_id);
     }
     Flash::set('success', __('This experience sequence has been saved.'));
     redirect(get_url('experience'));
 }
Ejemplo n.º 14
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Experience::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Ejemplo n.º 15
0
 public static function GetExperienceFromCode($code)
 {
     $id = intval($code, Experience::CODE_BASE) - Experience::CODE_OFFSET;
     $experience = Experience::model()->findByPk($id);
     return $experience;
 }
Ejemplo n.º 16
0
 public function save()
 {
     $isSaved = null;
     $experience = new Experience();
     $transaction = $experience->dbConnection->beginTransaction();
     try {
         if (isset($this->free) && $this->free === true) {
             unset($this->Price);
         }
         $experience->Name = $this->Name;
         $experience->ExperienceType = $this->ExperienceType;
         $experience->Audience = $this->Audience;
         $experience->Category_ID = $this->Category_ID;
         $experience->Start = $this->Start;
         $experience->End = $this->End;
         $experience->Description = $this->Description;
         $experience->Offering = $this->Offering;
         $experience->FinePrint = $this->FinePrint;
         $experience->Price = $this->Price;
         $experience->Min_occupancy = $this->Min_occupancy;
         $experience->Max_occupancy = $this->Max_occupancy;
         $experience->MaxPerPerson = $this->MaxPerPerson;
         $experience->MultipleAllowed = $this->MultipleAllowed;
         $appropriateAges = 0;
         if (isset($this->AppropriateAges) && is_array($this->AppropriateAges)) {
             foreach ($this->AppropriateAges as $age) {
                 $appropriateAges += $age;
             }
         }
         $experience->AppropriateAges = $appropriateAges;
         $location = $this->getLocation();
         $experience->Location_ID = $location->Location_ID;
         $experience->save();
         $this->experience = $experience;
         if ($this->imageFiles != null) {
             foreach ($this->imageFiles as $imageFile) {
                 $content = Content::AddContent($imageFile, 'Class Image', ContentType::ImageID);
                 $experienceToContent = new ExperienceToContent();
                 $experienceToContent->Experience_ID = $this->experience->Experience_ID;
                 $experienceToContent->Content_ID = $content->Content_ID;
                 $experienceToContent->save();
             }
         }
         if (isset($this->fromRequest_ID) && is_numeric($this->fromRequest_ID)) {
             $request = Request::model()->findByPk($this->fromRequest_ID);
             if ($request != null) {
                 $request->Created_Experience_ID = $this->experience->Experience_ID;
                 $request->save();
                 // Notify the students
                 foreach ($request->requestors as $user) {
                     if ($user->User_ID != $this->experience->Create_User_ID) {
                         $userName = CHtml::link($this->experience->createUser->fullName, array('//user/view', 'id' => $this->experience->createUser->User_ID));
                         $requestName = CHtml::link($request->Name, array('//request/view', 'id' => $request->Request_ID));
                         $experienceName = CHtml::link($this->experience->Name, array('//experience/view', 'id' => $this->experience->Experience_ID));
                         Message::SendNotification($user->User_ID, "{$userName} has picked up the request \"{$requestName}\" and created the experience \"{$experienceName}\".");
                     }
                 }
             }
         }
         $tagsArray = Tag::model()->string2array($this->tags);
         foreach ($tagsArray as $tagName) {
             $tag = Tag::model()->findOrCreate($tagName);
             $experienceToTag = new ExperienceToTag();
             $experienceToTag->Experience_ID = $this->experience->Experience_ID;
             $experienceToTag->Tag_ID = $tag->Tag_ID;
             $experienceToTag->save();
         }
         if (isset($this->sessions) && strlen($this->sessions) > 0) {
             $sessionData = json_decode($this->sessions);
             foreach ($sessionData as $sessionItem) {
                 $session = new Session();
                 $session->Experience_ID = $this->experience->Experience_ID;
                 $session->Start = $sessionItem->Start;
                 $session->End = $sessionItem->End;
                 $session->save();
             }
         }
         $transaction->commit();
         $isSaved = true;
     } catch (Exception $e) {
         $isSaved = false;
         $transaction->rollback();
     }
     return $isSaved;
 }
Ejemplo n.º 17
0
$id = $_GET['id'];
$smarty->assign('id', $id);
$employee_id = $_GET['u'];
$smarty->assign('employee_id', $employee_id);
$cv_setting = new CVSetting();
$cv_setting->id = $cv_id = $id;
$cv_setting->fk_employee_id = $employee_id;
/** update cv views */
$cv_setting->update_no_views();
$cv_details = $cv_setting->cv_review_by_employer();
$cv_status = $cv_details->cv_status;
$smarty->assign('cv_status', $cv_status);
if (empty($cv_details->year_experience) || $cv_details->year_experience == 0) {
    $cv_details->year_experience = 0;
}
$experiences = Experience::find_by_id($cv_details->year_experience);
$exper = !empty($experiences) ? $experiences->experience_name : format_lang('none');
$smarty->assign('exper', $exper);
$educations = Education::find_by_id($cv_details->highest_education);
$educ = !empty($educations) ? $educations->education_name : format_lang('none');
$smarty->assign('educ', $educ);
$get_salary = format_lang('select', 'salary');
$salary = !empty($cv_details->salary_range) ? $get_salary[$cv_details->salary_range] : format_lang('none');
$smarty->assign('salary', $salary);
$get_NoYes = format_lang('select', 'NoYes');
$availabe = !empty($cv_details->availability) ? $get_NoYes[$cv_details->availability] : format_lang('none');
$smarty->assign('availabe', $availabe);
$str_date = $cv_details->start_date;
$smarty->assign('str_date', "N/A");
if ($cv_details->start_date != "0000-00-00 00:00:00" && $cv_details->start_date != NULL && $cv_details->start_date != '') {
    $str_date_d = date("d", strtotime($cv_details->start_date));
Ejemplo n.º 18
0
 public function search()
 {
     $requestCriteria = new CDbCriteria();
     $experienceCriteria = new CDbCriteria();
     $requestCriteria->with = array('category', 'tags', 'createUser');
     $experienceCriteria->with = array('location', 'category', 'tags', 'createUser');
     $keywords = explode(' ', $this->keywords);
     if (isset($this->includedResults)) {
         $included = json_decode($this->includedResults);
         $experiences = array();
         $requests = array();
         foreach ($included as $item) {
             if ($item->type == 'experience') {
                 $experiences[] = $item->id;
             } else {
                 $requests[] = $item->id;
             }
         }
         $experienceCriteria->addInCondition('t.Experience_ID', $experiences);
         $requestCriteria->addInCondition('t.Request_ID', $requests);
     } else {
         foreach ($keywords as $keyword) {
             $requestCriteria->compare('t.Name', $keyword, true, 'OR');
             $requestCriteria->compare('t.Description', $keyword, true, 'OR');
             $requestCriteria->compare('category.Name', $keyword, true, 'OR');
             $requestCriteria->compare('tags.Name', $keyword, true, 'OR');
             $requestCriteria->compare('createUser.First_name', $keyword, true, 'OR');
             $requestCriteria->compare('createUser.Last_name', $keyword, true, 'OR');
             $requestCriteria->compare('createUser.DisplayName', $keyword, true, 'OR');
             $experienceCriteria->compare('t.Name', $keyword, true, 'OR');
             $experienceCriteria->compare('t.Description', $keyword, true, 'OR');
             $experienceCriteria->compare('category.Name', $keyword, true, 'OR');
             $experienceCriteria->compare('tags.Name', $keyword, true, 'OR');
             $experienceCriteria->compare('createUser.First_name', $keyword, true, 'OR');
             $experienceCriteria->compare('createUser.Last_name', $keyword, true, 'OR');
             $experienceCriteria->compare('createUser.DisplayName', $keyword, true, 'OR');
         }
     }
     $requestCriteria->addCondition('t.Created_Experience_ID is NULL');
     if (isset($this->category) && is_numeric($this->category) && $this->category > 0) {
         $requestCriteria->compare('t.Category_ID', $this->category);
         $experienceCriteria->compare('t.Category_ID', $this->category);
     }
     if ($this->minPrice != null && $this->minPrice > 0) {
         $experienceCriteria->compare('t.Price', '>=' . $this->minPrice);
     }
     if ($this->maxPrice != null && $this->maxPrice > 0) {
         $experienceCriteria->compare('t.Price', '<=' . $this->maxPrice);
     }
     if ($this->start != null && strlen($this->start) > 0) {
         $experienceCriteria->compare('t.End', '>' . date('Y-m-d', strtotime($this->start)));
     }
     if ($this->end != null && strlen($this->end) > 0) {
         $experienceCriteria->compare('t.Start', '<' . date('Y-m-d', strtotime($this->end)));
     }
     if ($this->posterType != null && $this->posterType > 0) {
         $experienceCriteria->compare('createUser.PosterType', '=' . $this->posterType);
     }
     if ($this->experienceType != null && $this->experienceType > 0) {
         $experienceCriteria->compare('t.ExperienceType', '=' . $this->experienceType);
     }
     if ($this->ageRanges != null && !in_array(0, $this->ageRanges)) {
         $ageRange = 0;
         foreach ($this->ageRanges as $item) {
             $ageRange += $item;
         }
         $experienceCriteria->addCondition('t.AppropriateAges | ' . $ageRange . ' = ' . $ageRange);
         $experienceCriteria->compare('t.AppropriateAges', '>' . 0);
     }
     $experiences = Experience::model()->active()->current()->findAll($experienceCriteria);
     $requests = Request::model()->findAll($requestCriteria);
     foreach ($requests as $i => $request) {
         if (count($request->requestors) == 0) {
             unset($requests[$i]);
         }
     }
     if (isset($this->location) && strlen($this->location) > 0) {
         foreach ($experiences as $i => $experience) {
             if (!stristr($experience->location->fullAddress, $this->location)) {
                 unset($experiences[$i]);
             }
         }
         foreach ($requests as $i => $request) {
             if ($request->Zip != $this->location) {
                 unset($requests[$i]);
             }
         }
     }
     $experiences = array_values($experiences);
     $items = array_merge($experiences, $requests);
     $scores = array();
     foreach ($items as $item) {
         $score = 1;
         $locationFound = false;
         foreach ($keywords as $keyword) {
             if (strlen($keyword) == 0) {
                 continue;
             }
             if (stristr($item->Name, $keyword)) {
                 $score += ExperienceSearchForm::NameValue;
             }
             if (stristr($item->Description, $keyword)) {
                 $score += ExperienceSearchForm::NameValue;
             }
             if (stristr($item->category->Name, $keyword)) {
                 $score += ExperienceSearchForm::CategoryValue;
             }
             if (stristr($item->tagstring, $keyword)) {
                 $score += ExperienceSearchForm::TagValue;
             }
             if ($item instanceof Experience && $item->location != null && !$locationFound) {
                 if (stristr($item->location->fulladdress, $keyword)) {
                     $score *= ExperienceSearchForm::LocationMultiplier;
                     $locationFound = true;
                 }
             }
         }
         array_push($scores, $score);
     }
     arsort($scores);
     $sortedItems = array();
     foreach ($scores as $i => $score) {
         $sortedItems[] = $items[$i];
     }
     $this->totalResults = count($sortedItems);
     $this->totalPages = ceil($this->totalResults / ExperienceSearchForm::PageSize);
     if (isset($this->disablePaging) && $this->disablePaging != null) {
         return $sortedItems;
     }
     if (!isset($this->page)) {
         $this->page = 1;
     }
     $offset = ($this->page - 1) * ExperienceSearchForm::PageSize;
     $sortedItems = array_slice($sortedItems, $offset, ExperienceSearchForm::PageSize);
     return $sortedItems;
 }
Ejemplo n.º 19
0
$cv_setting->fk_employee_id = $user_id;
$cv_details = $cv_setting->cv_review_by_employee();
if (!$cv_details && !is_array($cv_details)) {
    $session->message("<div class='error'>" . format_lang('errormsg', 00) . "</div>");
    redirect_to(BASE_URL . 'curriculum_vitae/');
    exit;
}
if ($cv_details->modified_at == '' || empty($cv_details->modified_at)) {
    //$session->message("<div class='error'>CV has not been modified</div>");
    redirect_to(BASE_URL . 'curriculum_vitae/resume/' . $id . '/change/');
    exit;
}
$cv_status = strtolower($cv_details->cv_status);
$smarty->assign('cv_status', $cv_status);
$ye = empty($cv_details->year_experience) ? 0 : $cv_details->year_experience;
$experiences = Experience::find_by_id($ye);
$exper = !empty($experiences) ? $experiences->experience_name : format_lang('none');
$smarty->assign('exper', $exper);
$he = empty($cv_details->highest_education) ? 0 : $cv_details->highest_education;
$educations = Education::find_by_id($he);
$educ = !empty($educations) ? $educations->education_name : format_lang('none');
$smarty->assign('educ', $educ);
$get_salary = format_lang('select', 'salary');
$salary = !empty($cv_details->salary_range) ? $get_salary[$cv_details->salary_range] : format_lang('none');
$smarty->assign('salary', $salary);
$get_NoYes = format_lang('select', 'NoYes');
$availabe = !empty($cv_details->availability) ? $get_NoYes[$cv_details->availability] : format_lang('none');
$smarty->assign('availabe', $availabe);
$str_date = $cv_details->start_date;
if ($cv_details->start_date != "0000-00-00 00:00:00" && $cv_details->start_date != NULL) {
    $str_date_d = date("d", strtotime($cv_details->start_date));
Ejemplo n.º 20
0
 /**
  * calculate profile completion for member
  * 
  * @author EL GUENNUNI Sohaib s.elguennuni@gmail.com
  * @param [int] 
  * @return [int]
  */
 public function calculateProfileCompletion($idMember, $regulate = 25)
 {
     $completion = 25;
     $experience = new Experience();
     $skills = new MemberSkill();
     $study = new Study();
     if (count($experience->getExperienceByMember($idMember)) > 0) {
         $completion += $regulate;
     }
     if (count($skills->getSkillsByMember($idMember)) > 0) {
         $completion += $regulate;
     }
     if (count($study->getStudyByMember($idMember)) > 0) {
         $completion += $regulate;
     }
     return $completion;
 }
Ejemplo n.º 21
0
 public function actionMergeAccounts()
 {
     $model = new LinkTooForm();
     $error = '';
     if (isset($_POST['LinkTooForm'])) {
         $model = new LinkTooForm();
         $model->attributes = $_POST['LinkTooForm'];
         $username = $model->email;
         $password = $model->password;
         $login = new LoginForm();
         $login->username = $username;
         $login->password = $password;
         $user1 = User::model()->findByAttributes(array('username' => $username));
         $user2 = User::getCurrentUser();
         if ($user1 == null || !$login->validate()) {
             $error = "Username or password was incorrect.";
             $this->render('MergeAccounts', array('model' => $model, 'error' => $error));
         } elseif ($user1->disable == 1) {
             $error = "User's account is disable.";
             $this->render('MergeAccounts', array('model' => $model, 'error' => $error));
         } else {
             $basic_info = BasicInfo::model()->findByAttributes(array('userid' => $user1->id));
             //link the third party accounts;
             $linkedinid = $user1->linkedinid;
             $googleid = $user1->googleid;
             $fiucsid = $user1->fiucsid;
             $fiu_account_id = $user1->fiu_account_id;
             if ($user2->linkedinid == null && $linkedinid != null) {
                 $user2->linkedinid = $linkedinid;
                 $user1->linkedinid = null;
                 $user2->save(false);
             }
             if ($user2->googleid == null && $googleid != null) {
                 $user2->googleid = $googleid;
                 $user1->googleid = null;
                 $user2->save(false);
             }
             if ($user2->fiucsid == null && $fiucsid != null) {
                 $user2->fiucsid = $fiucsid;
                 $user1->fiucsid = null;
                 $user2->save(false);
             }
             if ($user2->fiu_account_id == null && $fiu_account_id != null) {
                 $user2->fiu_account_id = $fiu_account_id;
                 $user1->fiu_account_id = null;
                 $user2->save(false);
             }
             //disable user
             $user1->disable = 1;
             $user1->save(false);
             //get basic info
             $first_name = $user1->first_name;
             $last_name = $user1->last_name;
             $email = $user1->email;
             $picture = $user1->image_url;
             $mesg = "Virtual Job Fair";
             $phone = $basic_info->phone;
             $city = $basic_info->city;
             $state = $basic_info->state;
             $about_me = $basic_info->about_me;
             //get education
             $education1 = Education::model()->find('FK_user_id=:id', array(':id' => $user1->id));
             $education2 = Education::model()->find('FK_user_id=:id', array(':id' => $user2->id));
             if ($education1 != null && $education2 == null) {
                 $education1->FK_user_id = $user2->id;
                 $education1->save(false);
             }
             if ($education1 != null && $education2 != null) {
                 if ($education1->FK_school_id != $education2->FK_school_id) {
                     $education1->FK_user_id = $user2->id;
                     $education1->save(false);
                 }
             }
             //get experience
             $experience1 = Experience::model()->find('FK_userid=:id', array(':id' => $user1->id));
             $experience2 = Experience::model()->find('FK_userid=:id', array(':id' => $user2->id));
             if ($experience1 != null && $experience2 == null) {
                 $experience1->FK_userid = $user2->id;
                 $experience1->save(false);
             }
             if ($experience1 != null && $experience2 != null) {
                 if ($experience1->company_name != $experience2->company_name) {
                     $experience1->FK_userid = $user2->id;
                     $experience1->save(false);
                 }
             }
             //get skill
             $this->actionLinkTo($email, $first_name, $last_name, $picture, $mesg, $phone, $city, $state, $about_me);
             return;
         }
         //
     } else {
         $this->render('MergeAccounts', array('model' => $model, 'error' => $error));
     }
 }