/** * 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); }
function getFilter($n) { $ret = array(); switch ($n) { case 1: // 昨天 $ret['sdate'] = date('Y-m-d 00:00:00', strtotime('-1 day')); $ret['edate'] = date('Y-m-d 23:59:59', strtotime('-1 day')); break; case 2: //本星期 $ret = getWeekRange(date('Y-m-d')); break; case 3: //上一个星期 $strDate = date('Y-m-d', strtotime('-1 week')); $ret = getWeekRange($strDate); break; case 4: //上上星期 $strDate = date('Y-m-d', strtotime('-2 week')); $ret = getWeekRange($strDate); break; case 5: //本月 $ret = getMonthRange(date('Y-m-d')); break; case 6: //上月 $strDate = date('Y-m-d', strtotime('-1 month')); $ret = getMonthRange($strDate); break; } return $ret; }