Пример #1
0
 /**
  * @param string $login
  * @return boolean|Model_Numista_Token
  */
 public static function findByLogin($login)
 {
     $que = self::$_db_static->select()->from('numista_api_tokens')->where('login = ?', $login);
     $data = self::$_db_static->fetchRow($que);
     if ($data === false) {
         return false;
     }
     $obj = new Model_Numista_Token();
     $obj->fromArray($data);
     return $obj;
 }
Пример #2
0
 /**
  * @route '|^coins/mine[/]?$|'
  */
 public function mycoinsAction()
 {
     if (!$this->token->isActive()) {
         return $this->returnError('Wrong access token');
     }
     $country = $this->input->filter_country;
     $page = (int) $this->input->page;
     if ($page < 1) {
         $page = 1;
     }
     $url = "http://en.numista.com/vous/vos_pieces.php?page={$page}";
     if (!empty($country)) {
         $url .= '&pays=' . $country;
     }
     $this->data = new Model_Numista_DataProvider_Simple();
     $this->data->io->addOption(CURLOPT_COOKIE, $this->token->buildCookieString());
     $html = $this->data->get($url);
     $parser = new Model_Numista_Parser_MyCoins($html);
     $data = $parser->parse();
     $data['pages'] = array('current' => $page, 'max' => $parser->getMaxPage());
     $data['filter'] = array('country' => $country);
     $this->view->setArray($data);
 }