Esempio n. 1
0
 /**
  * @return mixed
  * @throws \ErrorException
  */
 public function getShortList()
 {
     $result = Request::get('/corporations/corporation_list.json', $this->instanceIdentifier);
     if (!empty($result->error)) {
         Error::exception($result->setFlash[0]->msg);
     }
     return $result->corporations;
 }
Esempio n. 2
0
 public function loadVacancies()
 {
     $result = Request::get('/vacancies/index.json', $this->instanceIdentifier);
     $this->companies = $result->companies;
     if (empty($result->vacancies)) {
         $this->vacancies = array();
         $this->indexes = array();
     } else {
         $this->vacancies = $result->vacancies;
         $this->rebuildIndexes();
     }
 }
Esempio n. 3
0
File: Job.php Progetto: pshon/vcapi
 public function getShortInfo()
 {
     $result = Request::get('/users/user_work.json', $this->instanceIdentifier);
     if (!$result->worker) {
         $this->worker = false;
     } else {
         $this->worker = true;
         $this->professionId = $result->profession_type_id;
         $this->professionName = $result->profession_name;
         $this->salary = $result->salary;
         $this->companyId = $result->company_id;
         $this->companyWorkerId = $result->company_worker_id;
         $this->companyName = $result->company_name;
     }
 }
Esempio n. 4
0
 /**
  * @param string $currency (vdollars OR vgold)
  * @param $itemTypeId
  * @param string $sort (price or date)
  * @param string $direction (asc OR desc)
  * @return mixed
  */
 public function getLotsOffer($currency, $itemTypeId, $sort = 'price', $direction = 'asc')
 {
     $result = Request::get('/exchanges/lot_offers/' . $currency . '/' . $itemTypeId . '/' . $sort . '/' . $direction . '.json', $this->instanceIdentifier);
     return $this->validateResponse($result, 'offers');
 }
Esempio n. 5
0
 /**
  * @throws \ErrorException
  */
 public function getWorkers()
 {
     $result = Request::get('/company_workers/list_workers/' . $this->id . '.json');
     if (!empty($result->error)) {
         Error::exception($result->setFlash[0]->msg);
     }
     $this->workplaces = $result->currentCompany->Company->company_level * 5;
     $this->workersAllCnt = count($result->currentCompany->CompanyWorker) + count($result->currentCompany->UserForeignWorker);
     $this->workersForeignCnt = count($result->currentCompany->UserForeignWorker);
     $this->workers = array();
     $this->vacancy = array_shift($result->currentCompany->CompanyVacancy);
     if (!empty($result->currentCompany->CompanyWorker)) {
         foreach ($result->currentCompany->CompanyWorker as $item) {
             $this->workers[] = new Worker($item, $this->instanceIdentifier);
         }
     }
     if (!empty($result->currentCompany->UserForeignWorker)) {
         foreach ($result->currentCompany->UserForeignWorker as $item) {
             $this->workers[] = new Worker($item, $this->instanceIdentifier);
         }
     }
 }
Esempio n. 6
0
 /**
  * @return bool
  * @throws \ErrorException
  */
 public function getInfo()
 {
     $result = Request::get('/corporations/corporation_office/' . $this->id . '.json', $this->instanceIdentifier);
     $this->name = $result->currentCorporation->name;
     $this->vd_balance = $result->currentCorporation->vd_balance;
     $this->vg_balance = $result->currentCorporation->vg_balance;
     if (!empty($result->error)) {
         Error::exception($result->setFlash[0]->msg);
         return false;
     }
     if (!empty($result->companies)) {
         foreach ($result->companies as $item) {
             $this->companies[] = new Company($item);
         }
     }
 }
Esempio n. 7
0
File: User.php Progetto: pshon/vcapi
 /**
  * Get all companies that belong to user
  *
  * @return \VCAPI\Common\Collection
  * @throws \ErrorException
  */
 public function getCompanies()
 {
     $result = Request::get('/companies/user_companies.json', $this->instanceIdentifier);
     if (empty($result->userId)) {
         return Error::exception('Authorization error');
     }
     $companies = new Collection();
     foreach ($result->companies as $company) {
         $companies->add(new Company($company->Company, $this->instanceIdentifier));
     }
     return $companies;
 }