Beispiel #1
0
 function viewAction()
 {
     $clearArray = array();
     $this->filter($clearArray);
     $stateCode = AF::get($this->params, 'state_code', null);
     $countryID = AF::get($this->params, 'country_id', null);
     $defaultCheck = $countryID ? null : AF::get($this->params, 'searchdefaultCountryCheck', null);
     $stateModel = new State();
     if ($stateCode && !$countryID) {
         $stateModel->fillFromStateCode($stateCode);
         $countryID = $stateModel->country_id;
         $this->params['country_id'] = $countryID;
     }
     $pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params, 'ajax' => true));
     // pass in blank model with possible location info to be used in pre-selecting fields during tax creation on the modal form
     $model = new Tax();
     $model->state_code = $stateCode;
     $model->country_id = $countryID;
     $models = AFActiveDataProvider::models('Tax', $this->params, $pagination);
     $dataProvider = $defaultCheck ? $models->getDefaultCountries() : $models->getAll();
     $filterFields = $models->getoutFilterFields($clearArray);
     // set ajax table
     if (AF::isAjaxRequestModels()) {
         $this->view->includeFile('_table', array('application', 'views', 'taxes'), array('access' => $this->access, 'controller' => $this->controller, 'dataProvider' => $dataProvider, 'pagination' => $pagination, 'filterFields' => $filterFields));
         die;
     }
     $countries = Country::model()->cache()->findAllInArray();
     $states = State::model()->cache()->findAllInArray();
     $countryDefault = Taxs::getCountryDefault($countryID);
     Assets::js('jquery.form');
     Assets::js('ajax_table');
     Assets::js('af_input_field');
     $this->addToPageTitle('Taxes');
     $this->render('view', array('dataProvider' => $dataProvider, 'pagination' => $pagination, 'models' => $models, 'countries' => $countries, 'states' => $states, 'countryDefault' => $countryDefault, 'countryID' => $countryID, 'model' => $model, 'filterFields' => $filterFields));
 }
Beispiel #2
0
 function welcomeAction()
 {
     $filterFields = array();
     $dataProvider = array();
     if ($this->access->actionAccess('dashboard')) {
         if (!isset($this->params['dates'])) {
             //$dataFrom=mktime(0, 0, 0, date("m"), date("d")-1, date("Y"));
             $fromDate = date("d.m.Y");
             $this->params['dates'] = $fromDate . '-' . $fromDate;
         }
         $models = AFActiveDataProvider::models('Order', $this->params);
         $dataProvider = $models->dashboard();
         $filterFields = $models->getoutFilterFields(array(), array('dates'));
         // set ajax table
         if (AF::isAjaxRequestModels()) {
             $this->view->includeFile('_dashboard', array('application', 'views', 'home'), array('access' => $this->access, 'controller' => $this->controller, 'dataProvider' => $dataProvider, 'filterFields' => $filterFields));
             die;
         }
         Assets::css('jquery-ui');
         Assets::js('jquery-ui');
         Assets::js('dateRange/jquery.daterange');
         Assets::js('ajax_table');
         Assets::js('//www.google.com/jsapi');
     }
     $this->addToPageTitle(__('welcome'));
     $this->render('welcome', array('dataProvider' => $dataProvider, 'filterFields' => $filterFields));
 }
Beispiel #3
0
 function viewAction()
 {
     $id = AF::get($this->params, 'campaign_id', FALSE);
     if (!($modelCampaign = Campaign::model()->restrictions()->findByPk($id))) {
         throw new AFHttpException(0, 'incorrect_id');
     }
     $clearArray = array();
     $this->filter($clearArray);
     $pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params, 'ajax' => true));
     $models = AFActiveDataProvider::models('Pixel', $this->params, $pagination);
     $dataProvider = $models->getAll();
     $filterFields = $models->getoutFilterFields($clearArray);
     // set ajax table
     if (AF::isAjaxRequestModels()) {
         $this->view->includeFile('_table', array('application', 'views', 'pixels'), array('access' => $this->access, 'controller' => $this->controller, 'dataProvider' => $dataProvider, 'pagination' => $pagination, 'filterFields' => $filterFields));
         die;
     }
     $affiliates = Affiliate::model()->restrictions()->findAllInArray();
     Assets::js('jquery.form');
     Assets::css('jquery-ui');
     Assets::js('jquery-ui');
     Assets::js('ajax_table');
     Assets::js('af_input_field');
     $this->addToPageTitle(__('pixels'));
     $this->render('view', array('dataProvider' => $dataProvider, 'pagination' => $pagination, 'campaign_id' => AF::get($this->params, 'campaign_id'), 'affiliates' => $affiliates, 'modelCampaign' => $modelCampaign));
 }
Beispiel #4
0
 public function ordersAction()
 {
     $from = AF::get($this->params, 'from', false);
     $clearArray = array();
     $this->filter($clearArray);
     if (!isset($this->params['r_dates'])) {
         $today = date("d.m.Y");
         $this->params['r_dates'] = $today . '-' . $today;
     }
     $pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params, 'ajax' => true));
     $models = AFActiveDataProvider::models('Attempt', $this->params, $pagination);
     $dataProvider = $models->getDeclineOrdersReport();
     $filterFields = Attempt::$FilterFields = $models->getoutFilterFields($clearArray, array('r_dates'));
     $fields = array('order_formatted', 'type_formatted', 'status_note', 'created_formatted');
     $gateways = $models->getDSearchGateways();
     $reasons = $models->getDSearchReasons();
     // set ajax table
     if (AF::isAjaxRequestModels()) {
         $this->view->includeFile('_orders_table', array('application', 'views', 'declinedreports'), array('access' => $this->access, 'controller' => $this->controller, 'dataProvider' => $dataProvider, 'pagination' => $pagination, 'filterFields' => $filterFields, 'fields' => $fields, 'gateways' => $gateways, 'reasons' => $reasons));
         die;
     }
     Assets::css('jquery-ui');
     Assets::js('//code.jquery.com/ui/1.10.3/jquery-ui.js');
     Assets::js('dateRange/jquery.daterange');
     Assets::js('ajax_table');
     $this->render('orders', array('dataProvider' => $dataProvider, 'pagination' => $pagination, 'filterFields' => $filterFields, 'fields' => $fields, 'gateways' => $gateways, 'reasons' => $reasons, 'from' => $from));
 }
Beispiel #5
0
 function viewAction()
 {
     $clearArray = array('action', 'section');
     $this->filter($clearArray);
     if (!isset($this->params['dates'])) {
         //$dataFrom=mktime(0, 0, 0, date("m"), date("d"), date("Y")-2);
         //$fromDate = date("d.m.Y", $dataFrom);
         $today = date("d.m.Y");
         $this->params['dates'] = $today . '-' . $today;
     }
     $pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params, 'ajax' => true));
     $models = AFActiveDataProvider::models('Log', $this->params, $pagination);
     $dataProvider = $models->getAll();
     $filterFields = $models->getoutFilterFields($clearArray, array('dates'));
     // set ajax table
     if (AF::isAjaxRequestModels()) {
         $this->view->includeFile('_table', array('application', 'views', 'logs'), array('access' => $this->access, 'controller' => $this->controller, 'dataProvider' => $dataProvider, 'pagination' => $pagination, 'filterFields' => $filterFields));
         die;
     }
     $this->addToPageTitle('Logs');
     Assets::css('jquery-ui');
     Assets::js('jquery-ui');
     Assets::js('dateRange/jquery.daterange');
     Assets::js('ajax_table');
     Assets::js('af_input_field');
     $this->render('view', array('dataProvider' => $dataProvider, 'pagination' => $pagination, 'models' => $models, 'filterFields' => $filterFields));
 }
Beispiel #6
0
 function viewAction()
 {
     $clearArray = array('flags');
     $this->filter($clearArray);
     if (empty($this->params)) {
         $today = date("d.m.Y");
         $this->params['dates'] = $today . '-' . $today;
     }
     $pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params, 'ajax' => true));
     $models = AFActiveDataProvider::models('ProspectEmail', $this->params, $pagination);
     $dataProvider = $models->getAll();
     $filterFields = $models->getoutFilterFields($clearArray, array('dates'));
     // set ajax table
     if (AF::isAjaxRequestModels()) {
         $this->view->includeFile('_table', array('application', 'views', 'emails'), array('access' => $this->access, 'controller' => $this->controller, 'dataProvider' => $dataProvider, 'pagination' => $pagination, 'filterFields' => $filterFields));
         die;
     }
     $campaigns = Campaign::model()->cache()->findAllInArray();
     $templates = Template::model()->cache()->findAllInArray();
     $flags = ProspectEmail::getEmailFlags();
     /*
     $campaignsFilter = $models->getFilterCampaigns();
     $templatesFilter = $models->getFilterTemplates();
     $flagsFilter = $models->getFilterFlags();
     */
     Assets::css('jquery-ui');
     Assets::js('jquery-ui');
     Assets::js('dateRange/jquery.daterange');
     Assets::js('ajax_table');
     Assets::js('af_input_field');
     $this->addToPageTitle(__('prospect_emails'));
     $this->render('view', array('dataProvider' => $dataProvider, 'pagination' => $pagination, 'models' => $models, 'filterFields' => $filterFields, 'campaigns' => $campaigns, 'templates' => $templates, 'flags' => $flags));
 }
Beispiel #7
0
 function viewAction()
 {
     $clearArray = array();
     $this->filter($clearArray);
     $pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params, 'ajax' => true));
     $models = AFActiveDataProvider::models('Customer', $this->params, $pagination);
     $dataProvider = $models->getCustomers();
     $filterFields = $models->getoutFilterFields($clearArray);
     $displayFields = $models->getDisplayFields();
     // set ajax table
     if (AF::isAjaxRequestModels()) {
         $this->view->includeFile('_table', array('application', 'views', 'customers'), array('access' => $this->access, 'controller' => $this->controller, 'dataProvider' => $dataProvider, 'pagination' => $pagination, 'filterFields' => $filterFields, 'displayFields' => $displayFields));
         die;
     }
     $flags = AF::get($_POST, 'flags', false);
     if (!$flags) {
         $flags = array();
     }
     $model = new Customer();
     $model->addFlags($flags);
     Assets::js('jquery.form');
     Assets::js('ajax_table');
     Assets::js('af_input_field');
     $this->addToPageTitle(__('Customers'));
     $this->render('view', array('dataProvider' => $dataProvider, 'pagination' => $pagination, 'models' => $models, 'model' => $model, 'displayFields' => $displayFields, 'filterFields' => $filterFields));
 }
Beispiel #8
0
 function viewAction()
 {
     $clearArray = array();
     $this->filter($clearArray);
     $pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params, 'ajax' => true));
     $models = AFActiveDataProvider::models('CCombo', $this->params, $pagination);
     $dataProvider = $models->getAll();
     $filterFields = $models->getoutFilterFields($clearArray);
     // set ajax table
     if (AF::isAjaxRequestModels()) {
         $this->view->includeFile('_table', array('application', 'views', 'ccombo'), array('access' => $this->access, 'controller' => $this->controller, 'dataProvider' => $dataProvider, 'pagination' => $pagination, 'filterFields' => $filterFields));
         die;
     }
     $connectCampaignIDs = array();
     foreach ($dataProvider as $item) {
         if (!in_array($item->campaign1_id, $connectCampaignIDs)) {
             $connectCampaignIDs[] = $item->campaign1_id;
         }
         if (!in_array($item->campaign2_id, $connectCampaignIDs)) {
             $connectCampaignIDs[] = $item->campaign2_id;
         }
     }
     CCombos::getDoubleShippingSKUArray($connectCampaignIDs, AF::get($this->params, 'campaign_id'));
     $this->addToPageTitle('Campaigns Shipping');
     Assets::js('jquery.form');
     $this->render('view', array('dataProvider' => $dataProvider, 'pagination' => $pagination, 'models' => $models, 'filterFields' => $filterFields, 'campaign_id' => AF::get($this->params, 'campaign_id')));
 }
Beispiel #9
0
 function viewAction()
 {
     $clearArray = array();
     $this->filter($clearArray);
     $pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params, 'ajax' => true));
     $models = AFActiveDataProvider::models('CampaignShipping', $this->params, $pagination);
     $dataProvider = $models->getAll();
     $filterFields = $models->getoutFilterFields($clearArray);
     // set ajax table
     if (AF::isAjaxRequestModels()) {
         $this->view->includeFile('_table', array('application', 'views', 'campship'), array('access' => $this->access, 'controller' => $this->controller, 'dataProvider' => $dataProvider, 'pagination' => $pagination, 'filterFields' => $filterFields));
         die;
     }
     $this->addToPageTitle('Campaigns Shipping');
     Assets::js('jquery.form');
     $this->render('view', array('dataProvider' => $dataProvider, 'pagination' => $pagination, 'models' => $models, 'filterFields' => $filterFields, 'campaign_id' => AF::get($this->params, 'campaign_id')));
 }
Beispiel #10
0
 function viewAction()
 {
     $clearArray = array();
     $this->filter($clearArray);
     $pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params, 'ajax' => true));
     $models = AFActiveDataProvider::models('Prodcat', $this->params, $pagination, '`prodcat_id` DESC');
     //$dataProvider = $models->getAll();
     $dataProvider = $models->cache()->getMethod('getAll');
     $filterFields = $models->getoutFilterFields($clearArray);
     // set ajax table
     if (AF::isAjaxRequestModels()) {
         $this->view->includeFile('_table', array('application', 'views', 'prodcats'), array('access' => $this->access, 'controller' => $this->controller, 'dataProvider' => $dataProvider, 'pagination' => $pagination, 'filterFields' => $filterFields));
         die;
     }
     Assets::js('ajax_table');
     Assets::js('af_input_field');
     $this->addToPageTitle(__('prodcats'));
     $this->render('view', array('dataProvider' => $dataProvider, 'pagination' => $pagination, 'models' => $models, 'filterFields' => $filterFields));
 }
Beispiel #11
0
 function viewAction()
 {
     $clearArray = array();
     $this->filter($clearArray);
     $pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params, 'ajax' => true));
     $models = AFActiveDataProvider::models('Event', $this->params, $pagination);
     $dataProvider = $models->getAll();
     $filterFields = $models->getoutFilterFields($clearArray);
     // set ajax table
     if (AF::isAjaxRequestModels()) {
         $this->view->includeFile('_table', array('application', 'views', 'events'), array('access' => $this->access, 'controller' => $this->controller, 'dataProvider' => $dataProvider, 'pagination' => $pagination, 'filterFields' => $filterFields));
         die;
     }
     $templates = Template::model()->cache()->findAllInArray();
     $smtps = Smtp::model()->cache()->findAllInArray();
     $this->addToPageTitle('Events');
     Assets::js('ajax_table');
     Assets::js('af_input_field');
     $this->render('view', array('dataProvider' => $dataProvider, 'pagination' => $pagination, 'models' => $models, 'templates' => $templates, 'smtps' => $smtps, 'filterFields' => $filterFields));
 }
Beispiel #12
0
 function viewAction()
 {
     $clearArray = array();
     $this->filter($clearArray);
     $pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params, 'ajax' => true));
     $models = AFActiveDataProvider::models('Campaign', $this->params, $pagination);
     //$dataProvider = $models->getAll();
     $dataProvider = $models->cache()->getMethod('getAll');
     $filterFields = $models->getoutFilterFields($clearArray, array('dates'));
     // set ajax table
     if (AF::isAjaxRequestModels()) {
         $this->view->includeFile('_table', array('application', 'views', 'campaigns'), array('access' => $this->access, 'controller' => $this->controller, 'dataProvider' => $dataProvider, 'pagination' => $pagination, 'filterFields' => $filterFields));
         die;
     }
     $campaignsFilter = Campaign::model()->cache()->restrictions()->findAllInArray();
     // useful UI components for popup dialogs and things of that nature.  added to use a dialog popup on the single campaign clone action
     Assets::js('jquery-ui');
     Assets::js('ajax_table');
     Assets::css('jquery-ui');
     $this->addToPageTitle('Campaigns');
     $this->render('view', array('dataProvider' => $dataProvider, 'campaignsFilter' => $campaignsFilter, 'pagination' => $pagination, 'models' => $models, 'filterFields' => $filterFields));
 }
Beispiel #13
0
 function viewAction()
 {
     $clearArray = array();
     $this->filter($clearArray);
     $pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params, 'ajax' => true));
     $models = AFActiveDataProvider::models('User', $this->params, $pagination);
     $dataProvider = $models->getAll();
     $filterFields = $models->getoutFilterFields($clearArray);
     // set ajax table
     if (AF::isAjaxRequestModels()) {
         $this->view->includeFile('_table', array('application', 'views', 'users'), array('access' => $this->access, 'controller' => $this->controller, 'dataProvider' => $dataProvider, 'pagination' => $pagination, 'filterFields' => $filterFields));
         die;
     }
     $roles = Role::model()->cache()->findAllInArray();
     // Clear the super user role
     if (isset($roles[1])) {
         unset($roles[1]);
     }
     Assets::js('ajax_table');
     Assets::js('af_input_field');
     $this->addToPageTitle('Users');
     $this->render('view', array('dataProvider' => $dataProvider, 'pagination' => $pagination, 'models' => $models, 'roles' => $roles, 'filterFields' => $filterFields));
 }
Beispiel #14
0
 function viewAction()
 {
     $clearArray = array();
     $this->filter();
     $pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params, 'ajax' => true));
     $campaignID = AF::get($this->params, 'campaign_id', NULL);
     $methodID = AF::get($this->params, 'method_id', NULL);
     if (!($campaignID || !$methodID)) {
         throw new AFHttpException(0, 'incorrect_id');
     }
     $models = AFActiveDataProvider::models('Pixelrate', $this->params, $pagination, 'aff_id');
     $dataProvider = $models->getAll();
     $filterFields = $models->getoutFilterFields($clearArray);
     // set ajax table
     if (AF::isAjaxRequestModels()) {
         $this->view->includeFile('_table', array('application', 'views', 'pixelrates'), array('access' => $this->access, 'controller' => $this->controller, 'dataProvider' => $dataProvider, 'pagination' => $pagination, 'filterFields' => $filterFields));
         die;
     }
     $affids = Affiliates::getPixelratesAffids($campaignID, $methodID);
     Assets::js('jquery.form');
     Assets::js('ajax_table');
     $this->addToPageTitle('Pixel rates');
     $this->render('view', array('dataProvider' => $dataProvider, 'pagination' => $pagination, 'campaign_id' => $campaignID, 'method_id' => $methodID, 'affids' => $affids, 'filterFields' => $filterFields));
 }
Beispiel #15
0
 function emailAction()
 {
     $model = new CampaignEmail();
     if (isset($_POST['ajax'])) {
         if (isset($_POST['model']) && $_POST['model'] == 'prospects') {
             // Uncomment the following line if AJAX validation is needed
             $this->performAjaxValidation($model);
             $model->fillFromArray($_POST);
             /*
             $model->user_id_created = $this->user->user_id;
             $model->user_id_updated = $this->user->user_id;
             $model->updated = 'NOW():sql';
             $model->created = 'NOW():sql';
             $model->model_uset_id = $this->user->user_id;
             */
             if ($model->save()) {
                 Message::echoJsonSuccess();
             } else {
                 Message::echoJsonError(__('prospects_email_not_created') . ' ' . $model->errors2string);
             }
             die;
         }
         if (isset($_POST['model']) && $_POST['model'] == 'campaigns') {
             $campaignModel = new Campaign();
             $campaignModel->setIsNewRecord(false);
             $campaignID = AF::get($_POST, 'campaign_id');
             $campaignModel->fillFromDbPk($campaignID);
             $campaignModel->smtp_id = AF::get($_POST, 'smtp_id');
             $campaignModel->user_id_updated = $this->user->user_id;
             $campaignModel->updated = 'NOW():sql';
             if ($campaignModel->save(false)) {
                 Message::echoJsonSuccess(__('campaign_updated'));
             } else {
                 Message::echoJsonError(__('campaign_no_updated'));
             }
             die;
         }
     }
     $clearArray = array();
     $this->filter($clearArray);
     $pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params, 'ajax' => true));
     $models = AFActiveDataProvider::models('CampaignEmail', $this->params, $pagination);
     $dataProvider = $models->getAll();
     $filterFields = $models->getoutFilterFields($clearArray);
     // set ajax table
     if (AF::isAjaxRequestModels()) {
         $this->view->includeFile('_email_table', array('application', 'views', 'prospects'), array('access' => $this->access, 'controller' => $this->controller, 'dataProvider' => $dataProvider, 'pagination' => $pagination, 'filterFields' => $filterFields));
         die;
     }
     $templates = Template::model()->cache()->findAllInArray();
     $smtps = Smtp::model()->cache()->findAllInArray();
     $campaignID = AF::get($this->params, 'campaign_id');
     $campaignModel = new Campaign();
     $campaignModel->fillFromDbPk($campaignID);
     Assets::js('jquery.form');
     $this->addToPageTitle(__('prospect_email'));
     $this->render('email', array('dataProvider' => $dataProvider, 'pagination' => $pagination, 'models' => $models, 'campaignModel' => $campaignModel, 'templates' => $templates, 'smtps' => $smtps, 'filterFields' => $filterFields));
 }
Beispiel #16
0
 function approvalsAction()
 {
     $clearArray = array();
     $this->filter($clearArray);
     if (!isset($this->params['dates'])) {
         $today = date("d.m.Y");
         $this->params['dates'] = $today . '-' . $today;
     }
     if (!isset($this->params['sort_by'])) {
         $this->params['sort_by'] = 'bank_name';
     }
     if (!isset($this->params['sort'])) {
         $this->params['sort'] = 'asc';
     }
     $models = AFActiveDataProvider::models('Order', $this->params);
     $dataProvider = $models->getApprovalsReport();
     $filterFields = $models->getoutFilterFields($clearArray, array('dates'));
     //=Order::$FilterFields
     // Download a csv file
     if (isset($this->params['download_csv'])) {
         Csv::printArray($dataProvider);
     }
     // set an ajax table
     if (AF::isAjaxRequestModels()) {
         $this->view->includeFile('_approvals_table', array('application', 'views', 'reports'), array('access' => $this->access, 'controller' => $this->controller, 'dataProvider' => $dataProvider, 'filterFields' => $filterFields, 'ajax' => true));
         die;
     }
     $campaigns = Campaign::model()->cache()->findAllInArray();
     $countries = Country::model()->cache()->findAllInArray();
     $this->addToPageTitle(__('section_name_approvals_report'));
     Assets::css('jquery-ui');
     Assets::js('jquery-ui');
     Assets::js('dateRange/jquery.daterange');
     Assets::js('ajax_table');
     Assets::js('af_input_field');
     $this->render('approvals', array('dataProvider' => $dataProvider, 'filterFields' => $filterFields, 'campaigns' => $campaigns, 'countries' => $countries));
 }