Esempio n. 1
0
 public static function uploadHelper($file)
 {
     $imgurKey = AppSetting::findOne('imgur_key')->string_value;
     $imgurSecret = AppSetting::findOne('imgur_secret')->string_value;
     $imgurToken = AppSetting::findOne('imgur_token')->string_value;
     $cacher = new FilesystemCache('/tmp');
     $uploader = RemoteImageUploader\Factory::create('Imgur', array('cacher' => $cacher, 'api_key' => $imgurKey, 'api_secret' => $imgurSecret, 'refresh_token' => $imgurToken, 'auto_authorize' => false, 'username' => '', 'password' => ''));
     $uploader->authorize();
     $url = $uploader->upload($file);
     return $url;
 }
Esempio n. 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = AppSetting::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $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;
     }
     $query->andFilterWhere(['number_value' => $this->number_value, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'string_value', $this->string_value]);
     return $dataProvider;
 }
Esempio n. 3
0
 /**
  * get how many listings to be sync.so that I can get how many pages
  */
 public function getPreListingInfo()
 {
     $request = $this->activeListReqInit();
     $appSetting = \common\models\setting\AppSetting::findOne('listing_sync_entries_per_page');
     $request->ActiveList->Pagination = new Types\PaginationType();
     $request->ActiveList->Pagination->EntriesPerPage = $appSetting->number_value;
     $service = $this->tradingServiceInit();
     $response = $service->getMyeBaySelling($request);
     $result = $this->getResponseError($response);
     if ($response->Ack !== 'Failure' && isset($response->ActiveList)) {
         $result['data'] = $response->ActiveList->PaginationResult->TotalNumberOfEntries;
         $result['totalPages'] = $response->ActiveList->PaginationResult->TotalNumberOfPages;
     } else {
         $result['Error'][] = \Yii::t('app/listing', 'connect Failure', []);
     }
     return $result;
 }
Esempio n. 4
0
 /**
  * Finds the AppSetting model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return AppSetting the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = AppSetting::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Esempio n. 5
0
}], ['attribute' => 'create_to', 'value' => function ($model, $key, $index, $column) {
    if ($model['create_to']) {
        $date = new DateTime($model['create_to'], new DateTimeZone('GMT'));
        $date->setTimezone(new DateTimeZone('Australia/Sydney'));
        return $date->format('Y-m-d H:i:s');
    } else {
        return null;
    }
}], 'complete_at', ['attribute' => 'status', 'value' => function ($model, $key, $index, $column) {
    if ($model['status']) {
        return $model['status'] == 1 ? 'Init' : 'Completed';
    } else {
        return null;
    }
}], ['class' => 'yii\\grid\\ActionColumn', 'header' => Yii::t('app/order', 'Not Paid', []), 'template' => '{update-not-paid}', 'buttons' => ['update-not-paid' => function ($url, $model, $key) {
    $appSetting = \common\models\setting\AppSetting::findOne('fetch_order_entries_per_page');
    if ($model['Not Paid'] == 0) {
        return $model['Not Paid'];
    } else {
        return Html::button('<span class="ace-icon fa fa-refresh"></span>' . $model['Not Paid'], ['type' => 'button', 'class' => 'btn btn-xs btn-warning btn-update-not-paid', 'data-ebay-id' => $model['ebay_id'], 'data-toggle' => 'modal', 'data-target' => '#update-not-paid-orders-modal']);
    }
}]], ['attribute' => 'Not Shipped'], ['class' => 'yii\\grid\\ActionColumn', 'header' => Yii::t('app/order', 'Get Orders', []), 'template' => '{pre-fetch}', 'buttons' => ['pre-fetch' => function ($url, $model, $key) {
    return Html::button('<span class="ace-icon fa fa-cart-arrow-down"></span>', ['type' => 'button', 'class' => 'btn btn-xs btn-danger btn-pre-fetch', 'data-ebay-id' => $model['ebay_id'], 'data-toggle' => 'modal', 'data-target' => '#download-orders-modal']);
}]]]]);
?>
</div>
<?php 
echo Html::endForm();
Modal::begin(['header' => 'Download Orders', 'options' => ['id' => 'download-orders-modal'], 'size' => 'modal-lg', 'clientOptions' => ['backdrop' => 'static', 'keyboard' => false], 'clientEvents' => ['shown.bs.modal' => "function(e){downloadOrdersInit(e);}", 'hidden.bs.modal' => "function(e){location.reload();}"]]);
?>
 <div class="download-orders-container" style="max-height:500px;min-height:500px;">
Esempio n. 6
0
 private function commonFetchRequest($createFrom, $createTo)
 {
     $appSetting = \common\models\setting\AppSetting::findOne('fetch_order_entries_per_page');
     $request = $this->fetchPaidOrderReqInit();
     $request->Pagination = new Types\PaginationType();
     $request->Pagination->EntriesPerPage = $appSetting->number_value;
     $request->CreateTimeFrom = $createFrom;
     $request->CreateTimeTo = $createTo;
     $request->OrderStatus = 'Completed';
     $request->OrderRole = 'Seller';
     $request->IncludeFinalValueFee = true;
     return $request;
 }