Exemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Blocks::find();
     // add conditions that should always apply here
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['sortOrder' => SORT_ASC]]]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     // grid filtering conditions
     $query->andFilterWhere(['id' => $this->id, 'sortOrder' => $this->sortOrder, 'active' => $this->active]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'content', $this->content]);
     return $dataProvider;
 }
Exemplo n.º 2
0
 public function addressbalance($address = null)
 {
     $txs = Blocks::find('all', array('conditions' => array('txid.vout.scriptPubKey.addresses' => $address)));
     $amount = 0;
     $this->_render['layout'] = false;
     foreach ($txs as $tx) {
         foreach ($tx['txid'] as $txid) {
             if (!$txid['vin']['coinbase']) {
                 if ($txid['vout'] != "") {
                     foreach ($txid['vout'] as $vout) {
                         foreach ($vout['scriptPubKey']['addresses'] as $addresses) {
                             if ($addresses == $address) {
                                 $amount = $amount + $vout['value'];
                             }
                         }
                     }
                 }
             }
         }
     }
     return compact('amount');
 }
Exemplo n.º 3
0
 /**
  * Finds the Blocks model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Blocks the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Blocks::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }