/**
  *     add/update agency
  *     @param  integer $id 
  */
 function showUpdate($id = 0)
 {
     $this->data['id'] = $id;
     View::share('jsTag', HTML::script("{$this->assetURL}js/select.js"));
     // get list country
     $countryModel = new CountryBaseModel();
     $this->data['listCountry'] = $countryModel->getAllForm();
     // get list Category
     $categoryModel = new CategoryBaseModel();
     $this->data['listCategory'] = $categoryModel->getAllForm();
     // get expected close month
     $this->data['listExpectedCloseMonth'] = getMonthRange();
     // get list Currency
     $currencyModel = new CurrencyBaseModel();
     $this->data['listCurrency'] = $currencyModel->getAllForm();
     // get list Sale Status
     $this->data['listSaleStatus'] = Config::get('data.sale_status');
     $this->loadLeftMenu('menu.campaignList');
     // WHEN UPDATE SHOW CURRENT INFORMATION
     if ($id != 0) {
         $item = $this->model->with('agency', 'advertiser', 'sale', 'campaign_manager')->find($id);
         if ($item) {
             $this->data['item'] = $item;
             $this->loadLeftMenu('menu.campaignUpdate', array('item' => $item));
         } else {
             return Redirect::to($this->moduleURL . 'show-list');
         }
     }
     if (Request::isMethod('post')) {
         if ($this->postUpdate($id, $this->data)) {
             return Redirect::to($this->moduleURL . 'view/' . $this->data['id']);
         }
     }
     $this->layout->content = View::make('showUpdate', $this->data);
 }
 /**
  *     trigger before show list render view
  */
 function beforeShowList()
 {
     $this->loadLeftMenu('menu.Ad');
     // get list country
     $countryModel = new CountryBaseModel();
     $this->data['listCountry'] = $countryModel->getAllForm();
     View::share('jsTag', HTML::script("{$this->assetURL}js/select.js"));
     // get list Category
     $categoryModel = new CategoryBaseModel();
     $this->data['listCategory'] = array('' => '-- Select Channel --') + $categoryModel->getAllForm(0, 0, 'Run of Network');
     // get list Model
     $this->data['listModel'] = array('' => '-- Select Model --') + Config::get('data.flight_model');
 }
Ejemplo n.º 3
0
 public function register()
 {
     if (Request::isMethod('post')) {
         $this->postRegister();
     }
     $countryModel = new CountryBaseModel();
     $this->data['listCountry'] = $countryModel->getAllForm();
     $this->data['listWebsiteCategory'] = CategoryBaseModel::where('status', 1)->where('parent_id', 0)->where('name', '!=', 'Other')->orderBy('name', 'asc')->get()->toArray();
     $this->data['listLanguage'] = LanguageBaseModel::where('status', 1)->orderBy('name', 'asc')->get()->toArray();
     $this->data['listReason'] = $this->model->reason;
     $this->data['errors'] = $this->errors;
     $this->layout->content = View::make('register', $this->data);
 }
Ejemplo n.º 4
0
 public function contactInfo()
 {
     $this->layout = View::make('layout.main');
     $this->layout->slugMenu = '';
     $countryModel = new CountryBaseModel();
     $this->data['listCountry'] = $countryModel->getAllForm();
     $this->data['listWebsiteCategory'] = CategoryBaseModel::where('status', 1)->where('parent_id', 0)->where('name', '!=', 'Other')->orderBy('name', 'asc')->get()->toArray();
     $this->data['listLanguage'] = LanguageBaseModel::where('status', 1)->orderBy('name', 'asc')->get()->toArray();
     //$this->data['listReason']			= $this->model->reason;
     if (Request::isMethod('post')) {
         $this->postContactInfo($this->data);
     }
     $this->layout->slugMenu = '';
     $this->layout->content = View::make('contactInfoPage', $this->data);
 }
 public function getReportJson($arrDate, $data, $flagReport)
 {
     //get country
     $itemCountry = modelCountry::select('id', 'country_name')->get();
     if ($data && count($data) > 0) {
         $totalDisapperved = 0;
         $totalApproved = 0;
         foreach ($arrDate as $key => $value) {
             $approved = 0;
             $disapproved = 0;
             foreach ($data as $key1 => $value1) {
                 if ($flagReport == 1) {
                     $dateFormat = date("Y-n", strtotime($value1->updated_at));
                 } else {
                     $dateFormat = date("d", strtotime($value1->updated_at));
                     $key = $value;
                 }
                 if ($key == $dateFormat) {
                     if ($value1->status == modelAppPubManager::STATUS_APPROVED) {
                         //publisher approved
                         $approved++;
                         $totalApproved++;
                     }
                     if ($value1->status == modelAppPubManager::STATUS_DISAPPROVED) {
                         //publisher disapproved
                         $disapproved++;
                         $totalDisapperved++;
                     }
                 }
             }
             $arrDataApproved[] = $approved;
             $arrDataDisapproved[] = $disapproved;
         }
         //math percent approved and disapproved
         $total = $totalApproved + $totalDisapperved;
         if ($total > 0) {
             $percentApproved = round($totalApproved / $total * 100, 2);
             $percentDisapproved = round($totalDisapperved * 100 / $total, 2);
         } else {
             $percentApproved = 0;
             $percentDisapproved = 0;
         }
         //math percent new publisher
         $mathPercentNewPublisher = $this->mathPercentNewPublisher($flagReport, $itemCountry, $data);
         //get data approve
         $itemApprove = modelPubApprove::whereBetween('updated_at', [$this->dateLast, $this->dateEnd])->limit($this->limit)->get()->toArray();
         //show list approve
         if ($itemApprove) {
             $htmlListApprove = $this->showListApprove($itemApprove);
         } else {
             $htmlListApprove = trim(trans("backend::publisher/text.no_data"));
         }
         $arrJson = ['status' => 1, 'series' => [['name' => 'Approved', 'data' => $arrDataApproved], ['name' => 'Disapproved', 'data' => $arrDataDisapproved]], 'xAxis' => array_values($arrDate), 'chartpie' => [['name' => 'Percentage', 'data' => [['Approved', $percentApproved], ['Disapproved', $percentDisapproved]]]], 'textPie' => 'Application status', 'chartpie2' => $mathPercentNewPublisher, 'textPie2' => 'New publisher', 'htmlApprove' => trim($htmlListApprove)];
     } else {
         $arrJson = ['status' => 0];
     }
     return json_encode($arrJson);
 }
 /**
  *     add/update agency
  *     @param  integer $id 
  */
 function showUpdate($id = 0)
 {
     $this->data['id'] = $id;
     // get list country
     $countryModel = new CountryBaseModel();
     $this->data['listCountry'] = $countryModel->getAllForm();
     // WHEN UPDATE SHOW CURRENT INFOMATION
     if ($id != 0) {
         View::share('jsTag', HTML::script("{$this->assetURL}js/contact.js"));
         $item = $this->model->with('contact')->find($id);
         if ($item) {
             $this->data['item'] = $item;
         } else {
             return Redirect::to($this->moduleURL . 'show-list');
         }
     }
     if (Request::isMethod('post')) {
         if ($this->postUpdate($id, $this->data)) {
             return $this->redirectAfterSave(Input::get('save'));
         }
     }
     $this->layout->content = View::make('showUpdate', $this->data);
 }
 function showUpdate($id = 0)
 {
     $this->data['id'] = $id;
     $this->data['user'] = FALSE;
     $this->data['statusLists'] = Config::get('data.approve_status');
     //get country
     $this->data['countryLists'] = CountryBaseModel::select('id', 'country_name')->get();
     //get language
     $this->data['languageLists'] = LanguageBaseModel::select('id', 'name')->get();
     //get category
     $this->data['channelLists'] = CategoryBaseModel::select('id', 'name')->where('parent_id', 0)->where('status', 1)->get();
     // WHEN UPDATE SHOW CURRENT INFOMATION
     if ($id != 0) {
         $item = $this->model->find($id);
         if ($item) {
             //get site language
             $this->data['languageSelected'] = $item->language->lists('id');
             //get serve country
             $this->data['countryServeSelected'] = $item->serveCountry->lists('id');
             //get site channel
             $this->data['channelSelected'] = $item->channel->lists('id');
             $this->data['item'] = $item;
             if ($item->user_id != 0) {
                 $user = Sentry::findUserById($item->user_id);
                 $this->data['user'] = $user;
             }
         } else {
             return Redirect::to($this->moduleURL);
         }
     }
     if (Request::isMethod('post')) {
         if ($this->postUpdate($id)) {
             return Redirect::to($this->moduleURL);
         }
     }
     $this->layout->content = View::make('showCreate', $this->data);
 }
Ejemplo n.º 8
0
 function showUpdateUser($id = 0)
 {
     $this->data['id'] = $id;
     //get list country
     $countryModel = new CountryBaseModel();
     $this->data['itemCountry'] = $countryModel->getAll();
     // WHEN UPDATE SHOW CURRENT INFOMATION
     if ($id != 0) {
         $item = User::select('users.*', 'groups.id as groups_id')->join('users_groups', 'users_groups.user_id', '=', 'users.id')->join('groups', 'groups.id', '=', 'users_groups.group_id')->where('users.id', $id)->first();
         //pr($item,1);
         if ($item) {
             $this->data['item'] = $item;
         } else {
             return Redirect::to($this->moduleURL . 'users-list');
         }
     }
     if (Request::isMethod('post')) {
         if ($this->postUpdateUser($id, $this->data)) {
             if ($id != 0) {
                 $messages = trans("backend::publisher/text.update_success");
                 $LastUrl = 'update/' . $id;
             } else {
                 $messages = trans("backend::publisher/text.insert_success");
                 $LastUrl = 'create';
             }
             Session::flash('mess', $messages);
             return Redirect::to($this->moduleURL . $LastUrl);
         }
     }
     $this->layout->content = View::make('manager_user.showUpdate', $this->data);
 }
 public function showListPublisher()
 {
     $this->data['defaultField'] = $this->defaultField;
     $this->data['defaultOrder'] = $this->defaultOrder;
     $this->data['defaultURL'] = $this->moduleURL;
     //get country
     $this->data['itemCountry'] = modelCountry::select('id', 'country_name')->get();
     //get category
     $this->data['itemCate'] = modelCategory::select('id', 'name')->get();
     $this->data['publisher_approved'] = Config::get('backend.publisher_approved');
     if (method_exists($this, 'beforeShowList')) {
         $this->beforeShowList();
     }
     $this->layout->content = View::make('showListPublisher', $this->data);
 }