当前位置: 首页>>代码示例>>PHP>>正文


PHP Job::model方法代码示例

本文整理汇总了PHP中Job::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Job::model方法的具体用法?PHP Job::model怎么用?PHP Job::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Job的用法示例。


在下文中一共展示了Job::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionEditmoreinfo

 public function actionEditmoreinfo($user_id)
 {
     $user_more_info = UserInfoAR::model()->findByPk($user_id);
     $this->assign('user_more', $user_more_info);
     $maritalStatus = MaritalStatus::model()->findAll();
     // 'MaritalStatus', 'marital_status_id'),
     $hometown = Hometown::model()->findAll();
     // 'Province', 'hometown_id'),
     $nation = Nation::model()->findAll();
     // 'Nation', 'nation_id'),
     $bodyType = BodyType::model()->findAll();
     // 'BodyType', 'body_type_id'),
     $education = Education::model()->findAll();
     // 'Education', 'education_id'),
     $school = School::model()->findAll();
     // 'School', 'school_id'),
     $province = Province::model()->findAll();
     // 'Province', 'province_id'),
     $job = Job::model()->findAll();
     // '$maritalSta,
     $this->assign('maritalStatus', $maritalStatus);
     $this->assign('hometown', $hometown);
     $this->assign('nation', $nation);
     $this->assign('bodyType', $bodyType);
     $this->assign('education', $education);
     $this->assign('school', $school);
     $this->assign('province', $province);
     $this->assign('job', $job);
 }
开发者ID:sheepcat,项目名称:piebridge,代码行数:29,代码来源:PersonController.php

示例2: actionEvents

 public function actionEvents()
 {
     /**
      * @var $task Task
      * @var $cmd CDbCommand
      */
     $result = array('success' => 1);
     if (isset($_GET['from']) && isset($_GET['to'])) {
         $start = date(Task::DF_INTER, intval($_GET['from']) / 1000);
         $end = date(Task::DF_INTER, intval($_GET['to']) / 1000);
         //echo $start."\n".$end;
         $criteria = new CDbCriteria();
         $criteria->addBetweenCondition('start_date', $start, $end);
         if ($this->_user()->role == User::ROLE_USER) {
             $cmd = Yii::app()->db->createCommand();
             $taskIds = $cmd->select('task_id')->from(Job::model()->tableName())->where('organization_id = :id AND (updated_at BETWEEN :start AND :end)', array(':id' => $this->_user()->organization_id, ':start' => $start, ':end' => $end))->queryColumn();
             $criteria->addInCondition('id', $taskIds);
         }
         $tasks = Task::model()->findAll($criteria, array('order' => array('priority' => 'DESC')));
         $data = array();
         foreach ($tasks as $task) {
             $data[] = array('id' => $task->id, 'title' => $task->name, 'url' => Yii::app()->createUrl('task/view', array('id' => $task->id)), 'start' => strtotime($task->created_at) . '000', 'end' => strtotime($task->created_at) + 1800 . '000', 'class' => 'priority-' . $task->priority);
         }
         $result['result'] = $data;
     }
     $this->renderJSON($result);
 }
开发者ID:nsarvar,项目名称:performance,代码行数:27,代码来源:CalendarController.php

示例3: loadModel

 /**
  * 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 $id the ID of the model to be loaded
  * @return User the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Job::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:Gameonn,项目名称:JS_API,代码行数:15,代码来源:JobController.php

示例4: renderContent

 protected function renderContent()
 {
     $criteria = new CDbCriteria();
     $criteria->condition = 'active = 1';
     $criteria->order = 'publication_date DESC';
     $criteria->limit = $this->maxNbrEntries;
     $jobs = Job::model()->findAll($criteria);
     $this->render('recentJobsWidget', array('jobs' => $jobs));
 }
开发者ID:kostya1017,项目名称:our,代码行数:9,代码来源:RecentJobsWidget.php

示例5: run

 public function run()
 {
     $client = new Net_Gearman_Client(array('localhost:4730'));
     $this->JobSet->starttime = date('Y-m-d H:i:s');
     $this->JobSet->save();
     $client->runSet($this->taskList);
     if (!$this->background) {
         if ($this->taskList->finished()) {
             global $WorkerJobSetResults;
             $handles = $this->taskList->handles;
             $key_handles = array_keys($handles);
             for ($i = 0; $i < count($WorkerJobSetResults[$this->randomHash]); $i++) {
                 if (array_key_exists($key_handles[$i], $WorkerJobSetResults[$this->randomHash])) {
                     if ($WorkerJobSetResults[$this->randomHash][$key_handles[$i]]['done']) {
                         $job = Job::model()->find('id=:id', array(':id' => $WorkerJobSetResults[$this->randomHash][$key_handles[$i]]['job_id']));
                         if ($job != null) {
                             if ($job == null) {
                                 $job = new Job();
                             }
                             $this->results[] = unserialize(base64_decode($job->result));
                             // echo "Done";
                             $job->needed = 0;
                             $job->save();
                         } else {
                             die("Some results didn't come...\n");
                         }
                     }
                 } else {
                     die("Some results didn't come...\n");
                 }
             }
             $this->JobSet->finishtime = date('Y-m-d H:i:s');
             if ($this->auto_destroy_results) {
                 $this->JobSet->needed = 0;
                 $this->JobSet->delete();
                 $this->JobSet = null;
             } else {
                 $this->JobSet->save();
             }
             return $this->results;
         }
         echo "Task set could not be finished!<br />\n";
         return false;
     } else {
         // background work
         return true;
     }
 }
开发者ID:lidijakralj,项目名称:bober,代码行数:48,代码来源:WorkerJobSet.php

示例6: run

 public function run($arg)
 {
     try {
         $arg = unserialize(base64_decode($arg));
         if (!isset($arg['class']) || !isset($arg['function'])) {
             return array('result' => array('done' => false, 'job_id' => -1), 'WorkerJobSetIdentifier' => isset($arg['WorkerJobSetIdentifier']) ? $arg['WorkerJobSetIdentifier'] : -1, 'background' => isset($arg['background']) ? $arg['background'] : -1);
         }
         $log = $arg["class"] . '::' . $arg["function"];
         if (defined('THREAD') && defined('THREAD_TYPE')) {
             print date('d.m.Y H:i:s') . ' :: ' . THREAD_TYPE . ' Thread :: ' . str_pad(THREAD, 3, '0', STR_PAD_LEFT) . ' :: ' . $log . "\n";
         }
         $task_id = $arg['task_id'];
         $Job = Job::model()->find('id=:id', array(':id' => $task_id));
         if ($Job == null) {
             $Job = new Job();
             return null;
         }
         $Job->started = 1;
         $Job->starttime = date('Y-m-d H:i:s');
         $Job->save();
         $tmp = $this->runClassFunction($arg["class"], $arg["function"], $arg["params"]);
         $done = false;
         if ($tmp != null) {
             $Job->parameters = null;
             $Job->result = base64_encode(serialize($tmp));
             $Job->finishtime = date('Y-m-d H:i:s');
             $Job->save();
             $Job->finished = 1;
             $Job->save();
             $done = true;
         }
     } catch (CDbException $e) {
         if (function_exists('thread_shutdown')) {
             thread_shutdown();
         }
         die;
     }
     $log = $arg["class"] . '::' . $arg["function"] . ' :: DONE';
     if (defined('THREAD') && defined('THREAD_TYPE')) {
         print date('d.m.Y H:i:s') . ' :: ' . THREAD_TYPE . ' Thread :: ' . str_pad(THREAD, 3, '0', STR_PAD_LEFT) . ' :: ' . $log . "\n";
     }
     return array('result' => array('done' => $done, 'job_id' => $Job->id), 'WorkerJobSetIdentifier' => $arg['WorkerJobSetIdentifier'], 'background' => $arg['background']);
 }
开发者ID:lidijakralj,项目名称:bober,代码行数:43,代码来源:AllClasses.php

示例7: MergePDF

 public static function MergePDF($svg_to_pdf_jobs)
 {
     $log = "Svg2Pdf :: MergePDF :: MergePDF pdf jobs: " . implode(', ', $svg_to_pdf_jobs);
     if (defined('THREAD') && defined('THREAD_TYPE')) {
         print date('d.m.Y H:i:s') . ' :: ' . THREAD_TYPE . ' Thread :: ' . str_pad(THREAD, 3, '0', STR_PAD_LEFT) . ' :: ' . $log . "\n";
     }
     // počakat moramo, da so vsi svg 2 pdf narjeni, preden jih gremo mergat
     for ($i = 0; $i < 2; ++$i) {
         do {
             $job_check = Job::model()->find('id in (:ids) and (finished=:finished or result IS NULL)', array(':ids' => implode(', ', $svg_to_pdf_jobs), ':finished' => 0));
             if ($job_check != null) {
                 $log = 'Svg2Pdf :: MergePDF :: Need to wait to all SVG 2 PDF jobs are finished...';
                 if (defined('THREAD') && defined('THREAD_TYPE')) {
                     print date('d.m.Y H:i:s') . ' :: ' . THREAD_TYPE . ' Thread :: ' . str_pad(THREAD, 3, '0', STR_PAD_LEFT) . ' :: ' . $log . "\n";
                 }
                 sleep(1);
             }
         } while ($job_check != null);
     }
     $pdf_list = array();
     foreach ($svg_to_pdf_jobs as $job_id) {
         $job = Job::model()->find('id=:id', array(':id' => $job_id));
         if ($job == null) {
             $log = 'Svg2Pdf :: MergePDF :: Job with ID: ' . $job_id . ' not found!!!';
             if (defined('THREAD') && defined('THREAD_TYPE')) {
                 print date('d.m.Y H:i:s') . ' :: ' . THREAD_TYPE . ' Thread :: ' . str_pad(THREAD, 3, '0', STR_PAD_LEFT) . ' :: ' . $log . "\n";
             }
             $job = new Job();
             continue;
         }
         if (strlen($job->result) == 0) {
             $log = 'Svg2Pdf :: MergePDF :: Found one empty PDF, retry function MergePDF...';
             if (defined('THREAD') && defined('THREAD_TYPE')) {
                 print date('d.m.Y H:i:s') . ' :: ' . THREAD_TYPE . ' Thread :: ' . str_pad(THREAD, 3, '0', STR_PAD_LEFT) . ' :: ' . $log . "\n";
             }
             sleep(1);
             return self::MergePDF($svg_to_pdf_jobs);
         }
         $log = 'Svg2Pdf :: MergePDF :: Found Job ID: ' . $job->id . ', PDF size: ' . strlen($job->result);
         if (defined('THREAD') && defined('THREAD_TYPE')) {
             print date('d.m.Y H:i:s') . ' :: ' . THREAD_TYPE . ' Thread :: ' . str_pad(THREAD, 3, '0', STR_PAD_LEFT) . ' :: ' . $log . "\n";
         }
         $pdf_list[] = unserialize(base64_decode($job->result));
     }
     $log = 'Svg2Pdf :: MergePDF :: PDF to merge: ' . count($pdf_list);
     if (defined('THREAD') && defined('THREAD_TYPE')) {
         print date('d.m.Y H:i:s') . ' :: ' . THREAD_TYPE . ' Thread :: ' . str_pad(THREAD, 3, '0', STR_PAD_LEFT) . ' :: ' . $log . "\n";
     }
     $list = array();
     $gs = trim(shell_exec('/usr/bin/which gs'));
     $cmd = $gs . ' -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=';
     $counter = 0;
     do {
         $new_pdf_list = array();
         $output_file = tempnam(sys_get_temp_dir(), 'pdfmerge');
         $list[] = $output_file;
         $list[] = $output_file . '.pdf';
         $cmd_to_exec = $cmd . $output_file . '.pdf ';
         $new_pdf_list[] = $output_file . '.pdf';
         for ($i = 0; $i < count($pdf_list); ++$i) {
             if ($i < 10) {
                 $tmp_file = tempnam(sys_get_temp_dir(), 'pdfformerge');
                 file_put_contents($tmp_file . '.pdf', $pdf_list[$i]);
                 $cmd_to_exec .= $tmp_file . '.pdf ';
                 $list[] = $tmp_file;
                 $list[] = $tmp_file . '.pdf';
             } else {
                 $new_pdf_list[] = $pdf_list[$i];
             }
         }
         $result = shell_exec($cmd_to_exec);
         $counter++;
         $log = 'Svg2Pdf :: MergePDF :: Anti too long command handler, merging blocks of 10 pdfs, cylce number: ' . $counter;
         if (defined('THREAD') && defined('THREAD_TYPE')) {
             print date('d.m.Y H:i:s') . ' :: ' . THREAD_TYPE . ' Thread :: ' . str_pad(THREAD, 3, '0', STR_PAD_LEFT) . ' :: ' . $log . "\n";
         }
         $new_pdf_list[0] = file_get_contents($output_file . '.pdf');
         $pdf_list = $new_pdf_list;
     } while (count($pdf_list) > 1);
     for ($i = 0; $i < count($list); ++$i) {
         @unlink($list[$i]);
     }
     return $pdf_list[0];
 }
开发者ID:lidijakralj,项目名称:bober,代码行数:84,代码来源:Svg2Pdf.php

示例8: actionView

 public function actionView()
 {
     $this->_checkAuth();
     // Check if id was submitted via GET
     if (!isset($_GET['id'])) {
         $this->_sendResponse(500, 'Error: Parameter <b>id</b> is missing');
     }
     $currentModel = mb_strtolower($_GET['model'], 'UTF-8');
     $return_array = array();
     $return_custom = false;
     switch ($currentModel) {
         // Find respective model
         case 'convert':
             // {{{
             $return_custom = true;
             $model = Convert::model()->findByPk($_GET['id'], 'user_id=:user_id', array(':user_id' => $this->user_id));
             if ($model != null) {
                 if ($model == null) {
                     $model = new Convert();
                 }
                 if ($model->result == null) {
                     if (isset($model->backgroudJobSet->finalJobResult->result)) {
                         if ($model->backgroudJobSet->finalJobResult->result != null) {
                             $result = unserialize(base64_decode($model->backgroudJobSet->finalJobResult->result));
                             $model->result = base64_encode($result);
                         }
                         // cleanup
                         if ($model->result != null) {
                             $model->backgroudJobSet->delete();
                             $model->backgroud_job_set_id = null;
                         }
                         $model->save();
                     }
                 }
                 $background_done = false;
                 $jobs_done = 0;
                 $jobs_to_do = 0;
                 if ($model->background) {
                     if ($model->result != null) {
                         $background_done = true;
                     }
                     $jobs_done = Job::model()->count('job_set_id=:job_set_id and finished=:finished', array(':job_set_id' => $model->backgroud_job_set_id, ':finished' => 1));
                     $jobs_to_do = Job::model()->count('job_set_id=:job_set_id', array(':job_set_id' => $model->backgroud_job_set_id));
                 }
                 $return_array = array('id' => $model->id, 'background' => $model->background, 'background_done' => $background_done, 'result' => $model->result, 'jobs_done' => $jobs_done, 'jobs_to_do' => $jobs_to_do, 'progress' => $jobs_to_do != 0 ? round($jobs_done / $jobs_to_do * 10000) / 100 : 100);
             }
             break;
             // }}}
         // }}}
         default:
             // {{{
             $this->_sendResponse(501, sprintf('Mode <b>view</b> is not implemented for model <b>%s</b>', $_GET['model']));
             exit;
             // }}}
     }
     if (is_null($model)) {
         $this->_sendResponse(404, 'No Item found with id ' . $_GET['id']);
     } else {
         $this->_sendResponse(200, $this->_getObjectEncoded($_GET['model'], $return_custom ? $return_array : $model->attributes));
     }
 }
开发者ID:lidijakralj,项目名称:bober,代码行数:61,代码来源:ApiController.php

示例9: isset

                    if ($newCommand) {
                        $diffAttr->new = $newCommand->name;
                    }
                    break;
                case 'machine_id':
                    $oldMachine = Machine::model()->findByPk($diffAttr->old);
                    if ($oldMachine) {
                        $diffAttr->old = $oldMachine->name;
                    }
                    $newMachine = Machine::model()->findByPk($diffAttr->new);
                    if ($newMachine) {
                        $diffAttr->new = $newMachine->name;
                    }
                    break;
                case 'crucial':
                    $crucials = Job::model()->getCrucialOptions();
                    $diffAttr->old = isset($crucials[$diffAttr->old]) ? $crucials[$diffAttr->old] : NULL;
                    $diffAttr->new = isset($crucials[$diffAttr->new]) ? $crucials[$diffAttr->new] : NULL;
                    break;
            }
            if ($diffAttr->old === NULL) {
                $diffAttr->old = '[NULL]';
            }
            if ($diffAttr->new === NULL) {
                $diffAttr->new = '[NULL]';
            }
            $model = new $diffAttr->model_name();
            $html .= '<div>' . Yii::t('Diff', 'Update {name}{attribute} from "{old}" to "{new}"', array('{name}' => Yii::t('Diff', $diffAttr->model_name) . '(' . $name . ')', '{attribute}' => $model->getAttributeLabel($diffAttr->attribute), '{old}' => $diffAttr->old, '{new}' => $diffAttr->new)) . '</div>';
        }
    }
}
开发者ID:xuzhitong89,项目名称:web1.0,代码行数:31,代码来源:history.php

示例10: getJobTitle

 public static function getJobTitle()
 {
     $jobTitle = Job::model()->findAll();
     $title = array();
     if ($jobTitle != null) {
         foreach ($jobTitle as $jt) {
             $title[] = $jt->title;
         }
     }
     return $title;
 }
开发者ID:erick305,项目名称:testing,代码行数:11,代码来源:Job.php

示例11: array

?>
			<span><a href="<?php 
echo $this->createUrl('euniversity');
?>
" id="cuniversity" onclick="showAddress(this.href);return false;">修改</a></span>
			<?php 
echo $form->error($model, 'university');
?>
		</div>
		<hr class="space" />	
		<div class="row">
			<?php 
echo $form->labelEx($model, 'job');
?>
			<span id="jobHolder"><?php 
echo Job::model()->getJobName($model->job);
?>
</span>
			<?php 
echo $form->hiddenField($model, 'job', array('size' => 20, 'maxlength' => 20, 'class' => 'span-9 poshy', 'title' => '你的职业'));
?>
			<span><a href="<?php 
echo $this->createUrl('ejob');
?>
" id="cjob" onclick="showAddress(this.href);return false;">修改</a></span>
			<?php 
echo $form->error($model, 'job');
?>
		</div>
		<hr class="space" />	
		<div class="row">
开发者ID:yunsite,项目名称:my-advertise,代码行数:31,代码来源:eauthsecond.php

示例12: actionFile

 public function actionFile($id)
 {
     /**
      * @var $file File
      * @var $job  Job
      */
     if ($id == intval($id) . '') {
         $job = Job::model()->with(array('files', 'task'))->findByPk($id);
         if ($job) {
             if ($job->task->group_id == $this->_user()->group_id || $job->organization_id == $this->_user()->organization_id || $this->_user()->role == User::ROLE_SUPER_ADMIN || $this->_user()->role == User::ROLE_ADMIN) {
                 if (count($job->files) == 1) {
                     return $this->downloadFile($job->files[0]);
                 }
                 if (count($job->files) > 1) {
                     return $this->redirect(Yii::app()->createUrl('task/job', array('id' => $job->id)));
                 }
             } else {
                 return $this->cannotAccess();
             }
         }
     } else {
         $file = File::model()->with(array('task', 'job'))->findByAttributes(array('realname' => $id));
         if ($file) {
             $canAccess = $this->_user()->role == User::ROLE_SUPER_ADMIN || $this->_user()->role == User::ROLE_ADMIN;
             if ($file->job) {
                 $job = $file->job;
                 if ($canAccess || $job->task->group_id == $this->_user()->group_id || $job->organization_id == $this->_user()->organization_id) {
                     return $this->downloadFile($file);
                 }
             } elseif ($task = $file->task) {
                 foreach ($task->jobs as $job) {
                     if ($job->organization_id == $this->_user()->organization_id) {
                         $canAccess = true;
                         break;
                     }
                 }
                 if ($canAccess || $task->group_id == $this->_user()->group_id) {
                     return $this->downloadFile($file);
                 }
             }
             return $this->cannotAccess();
         }
     }
     $this->show404();
 }
开发者ID:nsarvar,项目名称:performance,代码行数:45,代码来源:TaskController.php

示例13: actionList

 public function actionList()
 {
     // validate API key
     if (isset($_GET['key'])) {
         $key = $_GET['key'];
     } else {
         $this->_sendResponse(500, 'Error: Parameter <b>key</b> is missing');
         Yii::app()->end();
     }
     // this should be done against DB
     if ($key !== $this->API_KEY) {
         $this->_sendResponse(401, sprintf('Invalid API Key specified: <b>%s</b>', $key));
         Yii::app()->end();
     }
     // check if we have a range parameter
     if (!isset($_GET['range'])) {
         $this->_sendResponse(500, 'Error: Parameter <b>range</b> is missing');
         Yii::app()->end();
     }
     //  grab range and convert to date
     $day_range = $_GET['range'];
     $start_date = new DateTime('now');
     $date_interval = new DateInterval('P' . $day_range . 'D');
     $start_date->sub($date_interval);
     $end_date = new DateTime('now');
     // retrieve postings from DB that fall within specified date range
     $postings = Job::model()->find('post_date >= :startdate AND post_date <= :enddate AND active=1', array('startdate' => $start_date->format('Y-m-d H:i:s'), 'enddate' => $end_date->format('Y-m-d H:i:s')));
     // check if we got results
     if (empty($postings)) {
         // no results
         $this->_sendResponse(200, sprintf('No active job postings found for the last <b>%s</b> day(s)', $day_range));
     } else {
         // got results, JSON encode and send to client
         $this->_sendResponse(200, CJSON::encode($postings));
     }
 }
开发者ID:erick305,项目名称:testing,代码行数:36,代码来源:APIController.php

示例14: actionCareerPathSync

 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) {
//.........这里部分代码省略.........
开发者ID:erick305,项目名称:testing,代码行数:101,代码来源:HomeController.php

示例15: actionCareerpath

 public function actionCareerpath()
 {
     // 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/cmztbPLWCq?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 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_company_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'];
         $jp_type = $job_posting['PostingType'];
         $jp_website = $job_posting['website'];
         $jp_description = $job_posting['description'];
         $jp_title = $job_posting['title'];
         $jp_expdate = strtotime($job_posting['expiration_date']);
         $jp_compensation = $job_posting['compensation'];
         $jp_contact = $job_posting['contact'];
         $jp_jobtype = $job_posting['type'];
         // attempt to find duplicate in database:
         // since we are using a single user to post for SCIS CareerPath
         // then we can easily search through the job postings by this user
         $posting_user = User::model()->find("username=:username", array(':username' => 'fiuscis'));
         $dup_entries = Job::model()->find("FK_poster=:poster AND " . "title=:title AND " . "deadline=:deadline AND " . "description=:description", array(':poster' => $posting_user->id, ':title' => $jp_title, ':deadline' => date('Y-m-d H:i:s', $jp_expdate), ':description' => $jp_description));
         if (count($dup_entries) > 0) {
             // duplicate found, skip it
             continue;
         }
         // no duplicates found, add job posting to database!
         $new_job_posting = new Job();
         $new_job_posting->FK_poster = $posting_user->id;
         $new_job_posting->post_date = date('m/d/Y');
         $new_job_posting->title = $jp_title;
         $new_job_posting->deadline = date('Y-m-d H:i:s', $jp_expdate);
         $new_job_posting->description = $jp_description;
         $new_job_posting->type = $jp_jobtype;
         $new_job_posting->compensation = $jp_compensation;
         $new_job_posting->save(false);
         $new_jobs_count++;
     }
     // crontab email message
     if ($new_jobs_count > 0) {
         echo date('m/d/Y H:i:s') . ' -> ' . $new_jobs_count . ' new job(s) have been imported from FIU SCIS CareerPath';
     }
 }
开发者ID:erick305,项目名称:testing,代码行数:61,代码来源:ImportJobsCommand.php


注:本文中的Job::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。