public function delete($id)
 {
     $this->db->trans_start();
     # delete company related by field
     $this->load->model("JobModel");
     $job = new JobModel();
     $job->delete_by_field($id);
     # remove the field itself
     $condition = array(JobFieldModel::$primary_key => $id);
     $this->db->delete(JobFieldModel::$table_name, $condition);
     $this->db->trans_complete();
     return $this->db->trans_status();
 }
 public static function manage()
 {
     self::requireLogin();
     $studentId = $_SESSION['_id'];
     $applications = ApplicationStudent::getByStudent($studentId);
     $data = [];
     foreach ($applications as $application) {
         $jobId = $application->getJobId();
         $job = JobModel::getByIdMinimal($jobId);
         if (is_null($job)) {
             continue;
         }
         $companyId = $job['company'];
         $companyName = CompanyModel::getName($companyId);
         $data[] = ['title' => $job['title'], 'location' => $job['location'], 'company' => $companyName, 'jobId' => $application->getJobId(), 'submitted' => $application->isSubmitted()];
     }
     self::render('jobs/student/home', ['applications' => $data]);
 }
 public function get_recommended_list()
 {
     $page = $_POST['page'];
     $size = $_POST['number'];
     $start = ($page - 1) * $size;
     $jobOb = new JobModel();
     $userinfo = $_SESSION['userinfo'];
     $uid = $userinfo['userid'];
     $username = $userinfo['username'];
     $num = $jobOb->recommend_job_count(2, $uid);
     //得到列表总条数
     //var_dump($num);
     $limit = "{$start},{$size}";
     //每页的数据数和内容$limit
     $result = $jobOb->getRecommendJob(2, $limit, $uid);
     if (empty($result)) {
         $result = array();
     }
     $data = array('count' => $num, 'result' => $result);
     echo json_encode($data);
 }
Beispiel #4
0
 /**
  * JobAct::act_delete()
  * 删除岗位act
  * @return bool
  */
 public function act_delete()
 {
     $jobId = intval($_POST['jobId']);
     $jobpowerId = intval($_POST['jobpowerId']);
     if (!$jobId || !$jobpowerId) {
         return "参数错误!";
         exit;
     }
     $result = JobModel::jobDelete($jobId, $jobpowerId);
     return $result;
 }
 public function get_recommended_list()
 {
     $page = $_POST['page'];
     $size = $_POST['number'];
     $start = ($page - 1) * $size;
     $jobOb = new JobModel();
     $userinfo = $_SESSION['userinfo'];
     $uid = $userinfo['userid'];
     $username = $userinfo['username'];
     $num = $jobOb->recommend_job_count(2, $uid);
     //得到列表总条数
     $limit = "{$start},{$size}";
     //每页的数据数和内容$limit
     $result = $jobOb->getRecommendJob(2, $limit, $uid);
     if (empty($result)) {
         $result = array();
     }
     foreach ($result as $k => $v) {
         $arNotice = M("notice_log")->where("type=1 and bt_id=" . $v['bt_id'])->order("id desc")->select();
         if (empty($arNotice)) {
             $arNotice = array();
         } else {
             foreach ($arNotice as $k1 => $v1) {
                 $arNotice[$k1]['posttime'] = date("Y-m-d H:i", $v1['created_at']);
             }
         }
         $result[$k]['notice_log'] = $arNotice;
         //查看改用户是否已经评论过该职位
         $arEvaluate = M("evaluate")->where("uid=" . $uid . " and pid=" . $result[$k]['recordid'] . " and tag='record'")->find();
         if (empty($arEvaluate)) {
             $result[$k]['is_evaluate'] = 1;
         }
     }
     $data = array('count' => $num, 'result' => $result);
     //echo "<pre>";var_dump($result);echo "</pre>";die;
     echo json_encode($data);
 }
Beispiel #6
0
<?php

// Move jobs past deadline to jobsold.
function pastDeadline($dateText)
{
    return strtotime($dateText) < time();
}
class JobOldModel extends Model
{
    const DB_TYPE = parent::DB_INTERNSHIPS;
    public function __construct()
    {
        parent::__construct(self::DB_TYPE, 'jobsold');
    }
    public static function save($data)
    {
        self::$collection->save($data);
    }
}
new JobOldModel();
global $MJob;
$jobs = $MJob->getAll();
foreach ($jobs as $job) {
    if (pastDeadline($job['deadline'])) {
        $jobId = $job['_id'];
        JobOldModel::save($job);
        JobModel::deleteById($jobId);
    }
}
Beispiel #7
0
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */
require_once "Libs/autoload.php";
$config = new Config();
$webPage = new PJSWebPage($config->getTitle() . ' - Delete Job');
$act = Tools::Param('act');
if ("Delete Job" === $act) {
    $jobModel = new JobModel();
    $jobModel->populateFromForm();
    if (!$jobModel->validateForDelete()) {
        $jobView = new JobFormView('Delete Job', $jobModel);
        $body = "<h2>Invalid data</h2>\n" . $jobView->getForm();
    } else {
        $jobController = new JobController();
        $jobController->delete($jobModel);
        $body = "Deleted job # " . $jobModel->getId() . "<br />\n";
    }
} else {
    $jobController = new JobController();
    $jobModel = $jobController->get(Tools::param('id'));
    $jobView = new JobFormView('Delete Job', $jobModel);
    $body = $jobView->getForm();
}
Beispiel #8
0
 /**
  * 根据订单状态,获得用户对应的可操作状态
  * @param  int $p_userID       用户ID
  * @param  [type] $p_itemModel [description]
  * @return [type]              [description]
  */
 public static function getNextAction($p_userID, JobModel $p_targetModel)
 {
     $userModel = Utility::getUserByID($p_userID);
     $actionNext = array();
     if (is_object($userModel) && $userModel->getGenre() == USER_GENRE::BANG) {
         switch ($p_targetModel->getJobStatus()) {
             case static::PENDING:
                 $actionNext = array(static::DRAFT, static::WAITJOIN);
                 break;
             default:
                 $actionNext = array();
                 break;
         }
     }
     return $actionNext;
 }
Beispiel #9
0
    /**
     * @param JobModel $model
     * @see ControllerBase::update()
     */
    public function update($model)
    {
        if ($model->validateForUpdate()) {
            try {
                $query = <<<SQL
UPDATE job
   SET primaryContactId = ?
     , companyId = ?
     , applicationStatusId = ?
     , lastStatusChange = ?
     , urgency = ?
     , nextActionDue = ?
     , nextAction = ?
     , positionTitle = ?
     , location = ?
     , url = ?
 WHERE id = ?
SQL;
                $id = $model->getId();
                $primaryContactId = $model->getPrimaryContactId();
                $companyId = $model->getCompanyId();
                $applicationStatusId = $model->getApplicationStatusId();
                $lastStatusChange = $model->getLastStatusChange();
                $urgency = $model->getUrgency();
                $nextActionDue = $model->getNextActionDue();
                $nextAction = $model->getNextAction();
                $positionTitle = $model->getPositionTitle();
                $location = $model->getLocation();
                $url = $model->getUrl();
                $stmt = $this->_dbh->prepare($query);
                if (!$stmt) {
                    throw new ControllerException('Prepared statement failed for ' . $query);
                }
                if (!$stmt->bind_param('iiisssssssi', $primaryContactId, $companyId, $applicationStatusId, $lastStatusChange, $urgency, $nextActionDue, $nextAction, $positionTitle, $location, $url, $id)) {
                    throw new ControllerException('Binding parameters for prepared statement failed.');
                }
                if (!$stmt->execute()) {
                    throw new ControllerException('Failed to execute UPDATE statement. (' . $this->_dbh->error . ')');
                }
                /**
                 * @SuppressWarnings checkAliases
                 */
                if (!$stmt->close()) {
                    throw new ControllerException('Something broke while trying to close the prepared statement.');
                }
                return $id;
            } catch (Exception $e) {
                throw new ControllerException($e->getMessage());
            }
        } else {
            throw new ControllerException("Invalid data.");
        }
    }
Beispiel #10
0
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */
require_once "Libs/autoload.php";
$config = new Config();
$webPage = new PJSWebPage($config->getTitle() . "Jobs - Add Job");
$body = '';
$act = Tools::Param('act');
if ("Add Job" === $act) {
    $model = new JobModel();
    $model->populateFromForm();
    if (!$model->validateForAdd()) {
        $view = new JobFormView('Add Job', $model);
        $body = "<h2>Invalid data</h2>\n" . $view->getForm();
    } else {
        $jobController = new JobController();
        $newId = $jobController->add($model);
        if ($newId > 0) {
            $body = "Added job # " . $newId . "<br />\n";
        }
    }
} else {
    $body = "";
    $view = new JobFormView("Add Job", null);
    $body = $view->getForm();
Beispiel #11
0
 /**
  * load数据并进行读取权限判断
  */
 protected static function loadList($p_where = null, $p_order = null, $p_pageIndex = null, $p_pageSize = null, &$p_countThis = null, $isDetail = false)
 {
     $tmpResult = parent::loadList($p_where, $p_order, $p_pageIndex, $p_pageSize, $p_countThis, $isDetail);
     if (is_array($tmpResult) && array_key_exists('errorCode', $tmpResult)) {
         return $tmpResult;
     }
     switch ($auth = static::getAuthIfUserCanDoIt(Utility::getCurrentUserID(), $isDetail ? 'detail' : 'list', $tmpResult)) {
         case 'admin':
             //有管理权限
         //有管理权限
         case 'self':
             //作者
             // break;//仅管理员和自己可见
         //作者
         // break;//仅管理员和自己可见
         case 'normal':
             //正常用户
         //正常用户
         case 'draft':
             //未激活
         //未激活
         case 'pending':
             //待审禁言
         //待审禁言
         case 'disabled':
             //封号
         //封号
         case 'visitor':
             //游客
             // return Utility::getArrayForResults(RUNTIME_CODE_ERROR_NO_AUTH,'您没有权限执行该操作');//其他用户不可见
             break;
         case 'empty':
             //空
             return Utility::getArrayForResults(RUNTIME_CODE_ERROR_DATA_EMPTY, '不存在对应数据');
             break;
         default:
             return Utility::getArrayForResults(RUNTIME_CODE_ERROR_NO_AUTH, '您没有权限执行该操作');
             break;
     }
     JobModel::$authViewDisabled = static::$authViewDisabledList[$auth];
     return $tmpResult;
 }
 function search()
 {
     // $this->requireLogin();
     global $params;
     $params = $_REQUEST;
     global $MJob, $MStudent, $MCompany, $MRecruiter;
     // Function for processing results and showing them
     function process($res)
     {
         global $MCompany;
         // Processing results
         $jobs = array();
         foreach ($res as $job) {
             $company = $MCompany->get($job['company']);
             $job['company'] = $company['name'];
             $job['desc'] = strmax($job['desc'], 300);
             $job['logophoto'] = $company['logophoto'];
             array_push($jobs, $job);
         }
         return $jobs;
     }
     // Predefined searches
     $showSearch = true;
     $showCompany = null;
     if (isset($_GET['byrecruiter'])) {
         $params = $this->dataSearchEmpty();
         $params['recruiter'] = $_GET['byrecruiter'];
         $showSearch = false;
     }
     if (isset($_GET['bycompany'])) {
         $params = $this->dataSearchEmpty();
         $params['company'] = $_GET['bycompany'];
         $showCompany = $MCompany->getByName($_GET['bycompany']);
         $showSearch = false;
     }
     if ($showSearch and !isset($params['search'])) {
         // If not searching for anything, then return last 6 entries
         $showMore = isset($_GET['showMore']);
         if ($showMore) {
             if (isset($_SESSION['showMoreJobs'])) {
                 $_SESSION['showMoreJobs'] += 6;
             } else {
                 $_SESSION['showMoreJobs'] = 12;
             }
             $showMore = $_SESSION['showMoreJobs'];
         } else {
             $_SESSION['showMoreJobs'] = 6;
         }
         $res = $MJob->last($_SESSION['showMoreJobs']);
         $jobs = process($res);
         $recent = count($jobs) < JobModel::getSize();
         self::render('jobs/search/form', $this->dataSearchSetup());
         self::render('jobs/search/results', array('jobs' => $jobs, 'recent' => $recent, 'search' => 'jobs', 'showMore' => $showMore));
         return;
     }
     // Params to vars
     extract($data = $this->dataSearch($params));
     // Validations
     $this->startValidations();
     $this->validate(!MongoId::isValid($recruiter) or !is_null(RecruiterModel::getById(new MongoId($recruiter))), $err, 'unknown recruiter');
     // Code
     if ($this->isValid()) {
         // Searching for companies
         $companyquery = array();
         if (strlen($company) > 0) {
             $companyquery['name'] = array('$regex' => keywords2mregex($company));
         }
         if (strlen($industry) > 0) {
             $companyquery['industry'] = array('$regex' => keywords2mregex($industry));
         }
         if (strlen($city) > 0) {
             $companyquery['location'] = array('$regex' => keywords2mregex($city));
         }
         $cs = $MCompany->find($companyquery);
         // Search query building
         $query = array();
         if (strlen($recruiter) > 0) {
             $query['recruiter'] = new MongoId($recruiter);
         }
         if (strlen($title) > 0) {
             $query['title'] = array('$regex' => keywords2mregex($title));
         }
         $companies = array();
         foreach ($cs as $c) {
             array_push($companies, $c['_id']);
         }
         $query['company'] = array('$in' => $companies);
         // Performing search
         $res = $MJob->find($query);
         $jobs = process($res);
         if ($showSearch) {
             self::render('jobs/search/form', $data);
         }
         self::render('jobs/search/results', array('jobs' => $jobs, 'showCompany' => $showCompany, 'search' => 'jobs'));
         // Send email notification of search to us
         // $this->sendrequestreport("Search for jobs:", $jobs);
         // Save search to db
         global $MApp;
         $MApp->recordSearch('jobs');
         return;
     }
     $this->error($err);
     self::render('jobs/search/form', array_merge($data, array('search' => 'jobs')));
 }
 /**
  * Creates a student application to be inserted into the 'applications'
  * collection.
  * Need to make sure student has not already saved an application for the
  * job.
  */
 private static function create(MongoId $jobId, MongoId $studentId, array $questions, $submitted)
 {
     // Retrieve application list from $jobId.
     $applicationQuestions = JobModel::getApplicationQuestionIds($jobId);
     // Build question-answer pairs.
     $savedQuestions = self::pruneQuestionsByIdSet($questions, $applicationQuestions);
     // Save the application.
     $application = new ApplicationStudent(['jobid' => $jobId, 'studentid' => $studentId, 'questions' => $savedQuestions, 'submitted' => $submitted]);
     $id = ApplicationModel::insert($application->getData());
     $application->setId($id);
     // Return created application.
     return $application;
 }
Beispiel #14
0
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */
require_once "Libs/autoload.php";
$config = new Config();
$webPage = new PJSWebPage($config->getTitle() . ' - Edit Job');
$act = Tools::Param('act');
if ("Edit Job" === $act) {
    $jobModel = new JobModel();
    $jobModel->populateFromForm();
    if (!$jobModel->validateForUpdate()) {
        $view = new JobFormView('Edit Job', $jobModel);
        $body = "<h2>Invalid data</h2>\n" . $view->getForm();
    } else {
        $jobController = new JobController();
        $newId = $jobController->update($jobModel);
        if ($newId > 0) {
            $body = "Edited job # " . $newId . "<br />\n";
        }
    }
} else {
    $jobController = new JobController();
    $jobModel = $jobController->get(Tools::param('id'));
    $view = new JobFormView('Edit Job', $jobModel);
 public function get_job_list()
 {
     $page = $_POST['page'];
     $size = $_POST['number'];
     $title = $_POST['condition'];
     $start = ($page - 1) * $size;
     $mOb = new JobModel();
     $num = intval($mOb->new_job_count($title));
     //得到列表总条数
     $limit = "{$start},{$size}";
     $result = $mOb->new_job_list($limit, $title);
     //得到职位列表
     //                echo "<pre>";var_dump($result);echo "</pre>";
     if (empty($result)) {
         $result = array();
     }
     //                foreach ($result as &$v) {
     //                        unset($v['content']);
     //                        unset($v['workdesc']);
     //                        unset($v['softlytip']);
     //                        unset($v['jobbright']);
     //                        unset($v['email']);
     //                        unset($v['match_company']);
     //                        unset($v['match_title']);
     //                        unset($v['match_skill']);
     //                        unset($v['match_industry']);
     //                        unset($v['is_match']);
     //                        unset($v['orderid']);
     //                        unset($v['joblang']);
     //                        unset($v['checkinfo']);
     //                        unset($v['is_deleted']);
     //                        unset($v['newstatus']);
     //                        unset($v['is_view']);
     //                        unset($v['meth']);
     //                        unset($v['expertid']);
     //                        unset($v['report']);
     //                }
     $data = array('count' => $num, 'result' => $result);
     echo json_encode($data);
 }
 private static function submit(MongoId $jobId, MongoId $studentId, array $questions)
 {
     $answers = array();
     foreach ($questions as $_id => $answer) {
         $answers[] = ['_id' => $_id, 'answer' => $answer];
     }
     $application = ApplicationStudent::save($jobId, $studentId, $answers);
     $applicationId = $application->getId();
     $submitted = ApplicationStudent::submit($applicationId);
     if ($submitted) {
         $job = JobModel::getByIdMinimal($jobId);
         $jobTitle = $job['title'];
         $linkApplicants = "http://sublite.net/employers/viewapplicants/{$jobId}";
         $linkManage = "http://sublite.net/employers/home";
         $recruiterId = $job['recruiter'];
         $recruiter = RecruiterModel::getByIdMinimal($recruiterId);
         $recruiterFirstname = $recruiter['firstname'];
         $recruiterEmail = $recruiter['email'];
         $message = "\n          Hi {$recruiterFirstname},\n          <br /><br />\n          You have received a new applicant for your job: <b>{$jobTitle}</b>!\n          <br /><br />\n          To unlock and view this application, go to\n          <a href='{$linkApplicants}'>View Applicants</a>.\n          <br />\n          To manage your jobs, go to <a href='{$linkManage}'>Manage</a>.\n          <br /><br />\n          View Applicants: <a href='{$linkApplicants}'>{$linkApplicants}</a><br />\n          Manage Jobs: <a href='{$linkManage}'>{$linkManage}</a><br />\n          <br /><br />\n          -------------------<br />\n          Team SubLite\n          <br /><br />\n          Please let us know if you have any questions. We hope you find the\n          right candidate for your job.\n        ";
         sendgmail([$recruiterEmail], "*****@*****.**", "New Applicant for '{$jobTitle}' | SubLite", $message);
         //send an email to the student
         $companyId = $job['company'];
         $company = CompanyModel::getById($companyId);
         $companyName = $company['name'];
         $student = StudentModel::getByIdMinimal($studentId);
         $studentFirstName = $student['name'];
         $studentEmail = $student['email'];
         $linkApplication = "http://sublite.net/jobs/application/{$applicationId}";
         $linkJob = "http://sublite.net/job?id={$jobId}";
         $linkJobSearch = "http://sublite.net/jobs/search";
         $linkJobsByCompany = "http://sublite.net/jobs/search?byrecruiter={$recruiterId}";
         $message = "\n          Hi {$studentFirstName},\n          <br />\n          <br />{$companyName} has successfully received your <a href='{$linkApplication}'>application</a> for <b>{$jobTitle}</b>!<br />\n          <br />View your application: {$linkApplication}\n          <br />View the job you applied to {$linkJob}\n          <br />View more jobs by {$linkJobsByCompany}<br />\n          <br />You are now one step closer to finding your perfect summer experience! Take more steps by applying to more jobs: {$linkJobSearch}<br />\n          -------------------<br />\n          Good luck!\n          <br />\n          Team SubLite\n        ";
         sendgmail([$studentEmail], "*****@*****.**", "Confirmation for Job Application", $message);
         self::redirect("../application/{$applicationId}");
     }
     self::error("You must attach a resume to your profile in order to submit " . "an application.");
 }
 public function delete($id)
 {
     $this->db->trans_start();
     # remove company task
     $this->load->model("CompanyTaskModel");
     $task = new CompanyTaskModel();
     $task->delete_by_company($id);
     # remove company achievement
     $this->load->model("AchievementModel");
     $achievement = new AchievementModel();
     $achievement->delete_by_company($id);
     # remove people and people photo
     $this->load->model("PeopleModel");
     $people = new PeopleModel();
     $people->delete_by_company($id);
     # remove company activity
     $this->load->model("CompanyActivityModel");
     $activity = new CompanyActivityModel();
     $activity->delete_by_company($id);
     # remove company photo
     $this->load->model("CompanyPhotoModel");
     $photo = new CompanyPhotoModel();
     $photo->delete_by_company($id);
     # remove follower record
     $this->load->model("FollowerModel");
     $follower = new FollowerModel();
     $follower->delete_by_company($id);
     # remove all job, application and bookmark
     $this->load->model("JobModel");
     $job = new JobModel();
     $job->delete_by_company($id);
     # remove all section, application and bookmark
     $this->load->model("CompanySectionModel");
     $job = new CompanySectionModel();
     $job->delete_by_company($id);
     # remove the company itself
     $condition = array(CompanyModel::$primary_key => $id);
     $this->db->delete(CompanyModel::$table_name, $condition);
     $this->db->trans_complete();
     return $this->db->trans_status();
 }
 private static function jobExists(MongoId $id)
 {
     return JobModel::exists($id);
 }
Beispiel #19
0
    public function getJobLists($filed, $where, $order = '', $limit = '')
    {
        self::initDB();
        $sql = 'SELECT ' . $filed . ' FROM ' . self::$table_job_info . '
				LEFT JOIN ' . self::$table_dept_info . ' ON dept_id=job_dept_id
				LEFT JOIN ' . self::$table_job_power . ' ON jobpower_job_id=job_id
				LEFT JOIN ' . self::$table_company_info . ' ON job_company_id=company_id
				' . $where . ' ' . $order . ' ' . $limit;
        $query = self::$dbConn->query($sql);
        if (!$query) {
            self::$errCode = '1803';
            self::$errMsg = "[{$sql}] is error";
            return false;
        }
        if ($this->is_count === true) {
            $this->is_count = false;
            return self::$dbConn->num_rows($query);
        }
        return self::$dbConn->fetch_array_all($query);
    }
 public function job_detail()
 {
     $id = $_GET['id'];
     if (!$id) {
         header("location:/Companyabout/recording");
         die;
     }
     $jobOb = new JobModel();
     $arJob = $jobOb->get_detail($id);
     $this->assign("arJob", $arJob);
     //为引入的头部传入标题
     $lArr = array(array("name" => "回到首页", "url" => "/", "img" => "/Public/new-images/head-icon/m-icon1.png"), array("name" => "发布职位", "url" => "/index.php?s=/Company/send_job", "img" => "/Public/new-images/com-head-icon/send_job.png"), array("name" => "正在招聘", "url" => "/index.php?s=/Companyabout/recording", "img" => "/Public/new-images/com-head-icon/recording.png"), array("name" => "往期招聘", "url" => "/index.php?s=/Companyabout/recorded", "img" => "/Public/new-images/com-head-icon/recorded.png"));
     $this->assign("lArr", $lArr);
     $this->assign("header_title", "职位详情");
     $this->assign("select", "send_job");
     $this->display("Company/job_detail");
 }