Esempio n. 1
0
 /**
  * Constructor
  *
  * @param int|string $id
  */
 public function __construct($id)
 {
     parent::__construct();
     if (filter_var($id, FILTER_VALIDATE_INT)) {
         $this->id = $id;
         $this->fetch();
     } elseif (is_string($id)) {
         if (!($this->id = Utility\SlugUtility::getID("location", $id))) {
             $this->name = $id;
             $this->parent_id = 0;
             $this->commit();
         }
     }
 }
 /**
  * Constructor
  * @param $classification_id
  */
 public function __construct($classification_id = false)
 {
     parent::__construct();
     if (filter_var($classification_id, FILTER_VALIDATE_INT)) {
         $this->id = $classification_id;
         $this->fetch();
     } elseif (is_string($classification_id)) {
         $query = "SELECT jn_classification_id FROM jn_classifications WHERE jn_classification_name = ?";
         if ($id = $this->db->fetchOne($query, $classification_id)) {
             $this->id = $id;
             $this->fetch();
         } else {
             $this->name = $classification_id;
             $this->parent_id = 0;
             $this->commit();
         }
     }
 }
Esempio n. 3
0
 /**
  * @depends testCreateOrg
  * @depends testScrape
  */
 public function testGetJobs($Org, $blah)
 {
     $Jobs = new Jobs();
     foreach ($Jobs->yieldProviders() as $Provider) {
         // nahh
     }
     $Jobs->getRandomJob();
     foreach ($Jobs->yieldNewJobs() as $Job) {
         $this->assertFalse(!filter_var($Job->id, FILTER_VALIDATE_INT));
     }
     $Jobs->getNumNewJobs();
     $Jobs->getJobsFromEmployer($Org);
 }
Esempio n. 4
0
 /**
  * Constructor
  * @param $location_id
  */
 public function __construct($location_id = false)
 {
     try {
         parent::__construct();
     } catch (Exception $e) {
         throw new Exception($e->getMessage());
     }
     if (filter_var($location_id, FILTER_VALIDATE_INT)) {
         $this->id = $location_id;
         $this->fetch();
     } elseif (is_string($location_id)) {
         $query = "SELECT jn_location_id FROM jn_locations WHERE jn_location_name = ?";
         if ($id = $this->db->fetchOne($query, $location_id)) {
             $this->id = $id;
             $this->fetch();
         } else {
             $this->name = $location_id;
             $this->parent_id = 0;
             $this->commit();
         }
     }
 }
Esempio n. 5
0
 /**
  * Constructor
  * @since Version 3.8
  * @param int $job_id
  */
 public function __construct($job_id = false)
 {
     try {
         parent::__construct();
     } catch (Exception $e) {
         throw new Exception($e->getMessage());
     }
     if ($job_id) {
         $this->id = $job_id;
         $query = "SELECT organisation_id, job_added, reference_id, job_urls, job_location_id, job_classification_id, job_thread_id, job_title, job_description, job_expiry, DATEDIFF(job_expiry, NOW()) AS job_expiry_until, job_salary, job_special_cond, job_duration FROM jn_jobs WHERE job_id = ?";
         if ($result = $this->db->fetchRow($query, $this->id)) {
             $this->title = $result['job_title'];
             $this->desc = $result['job_description'];
             $this->expiry = $this->expiry = new \DateTime($result['job_expiry']);
             $this->expiry_until = $result['job_expiry_until'];
             $this->salary = $result['job_salary'];
             $this->special_cond = $result['job_special_cond'];
             $this->duration = $result['job_duration'];
             $this->reference_id = $result['reference_id'];
             if (empty($this->duration) || $this->duration === 0) {
                 $this->duration = "Ongoing";
             }
             if ($result['job_added'] != "0000-00-00 00:00:00") {
                 $this->Open = new DateTime($result['job_added']);
             }
             $this->Organisation = new Organisation($result['organisation_id']);
             $this->Location = new Location($result['job_location_id']);
             $this->Classification = new Classification($result['job_classification_id']);
             $this->url = new Url(sprintf("%s/%d", $this->Module->url, $this->id));
             if (is_array(json_decode($result['job_urls'], true))) {
                 foreach (json_decode($result['job_urls'], true) as $title => $link) {
                     if (!is_null($link)) {
                         $this->url->{$title} = $link;
                     }
                 }
             }
         }
     }
 }
Esempio n. 6
0
 /**
  * Constructor
  * @since Version 3.8
  * @param int $job_id
  */
 public function __construct($job_id = false)
 {
     parent::__construct();
     if ($this->id = filter_var($job_id, FILTER_VALIDATE_INT)) {
         $this->mckey = sprintf("railpage:jobs.job=%d", $this->id);
         $this->populate();
     }
 }