public static function saveEmail() { $attachment_ref = ''; if (Input::hasFile('attachment')) { $attachment_ref = Helpers::getUniqueID(); Helpers::uploadCampaignFile(Input::file('attachment'), $attachment_ref); } DB::table('mradi_outbox_email_log')->insert(array("sender" => Helpers::getGlobalValue('SYSTEM_EMAIL'), "message" => Input::get('message'), "subject" => Input::get('subject'), "email_cc" => Input::get('email_cc'), "email_bcc" => Input::get('email_bcc'), "email_to" => Input::get('email_to'), "attachment_ref" => $attachment_ref)); return true; }
public function SaveFinancials() { error_log("save financial...."); $rules = array('f_statement' => 'image|required_if:f_statement_h,0'); $validator = Validator::make(Input::all(), $rules); // check if the validator failed ----------------------- if ($validator->fails()) { return Redirect::to(URL::previous())->withErrors($validator)->withInput()->with('activetab', Input::get('activetab')); } else { if (Helpers::isNewCampaign(Input::get('campaign'), 7)) { $f_statement_ref = Helpers::getUniqueID(); DB::table('tbl_campaign_financials')->insert(array('campaign_id' => Helpers::getCampaignID(Input::get('campaign')), 'financial_statement' => $f_statement_ref)); // Insert upload file data $file = Helpers::uploadCampaignFile(Input::file('f_statement'), $f_statement_ref); // Progress Campaign progress Helpers::progressCampaign(Input::get('campaign'), 7); } else { $f_statement_ref = Input::get('f_statement_h'); // Insert upload file data if (Input::hasFile('f_statement')) { error_log("saving image...."); $file = Helpers::uploadCampaignFile(Input::file('f_statement'), $f_statement_ref); } } $tab = explode("_", Input::get('activetab')); $active_tab = "tab_" . ($tab[1] + 1); return Redirect::to(URL::route('campaign_info', array('campaign' => Input::get('campaign'))))->with('activetab', $active_tab); } }
public static function uploadCampaignFile($files, $reference) { if (count($files) > 0) { // if(Input::hasFile($files[0])) // { //foreach ($files as $fileInput) {error_log("image upload 12"); if (isset($files)) { $file_alias = Helpers::getUniqueID() . "_" . $files->getClientOriginalName(); $files->move(storage_path() . "/campaigns", $file_alias); Helpers::uploadFileData($reference, $files->getClientOriginalName(), $file_alias); } //} } }
public function postProfileEdit() { $data = ['phone' => Input::get('phone'), 'address' => Input::get('address'), 'location' => Input::get('location')]; $rules = ['phone' => 'required', 'address' => 'required', 'location' => 'required']; if (Input::hasFile('photo')) { $photo_ref = Helpers::getUniqueID(); $data['profile_pic'] = $photo_ref; $file = Helpers::uploadCampaignFile(Input::file('photo'), $photo_ref); } $valid = Validator::make($data, $rules); if ($valid) { $user_id = Input::get('id'); array_filter($data); $details = array(); foreach ($data as $k => $dt) { if ($k != 'phone') { $details[$k] = $dt; } } Helpers::logAction("Profile Edit"); DB::table('mradi_accounts_profile')->where('account_id', Session::get('account_id'))->update($details); DB::table('accounts_dbx')->where('account_id', Session::get('account_id'))->update(array('phone' => Input::get('phone'))); Session::flash('common_feedback', '<div class="alert alert-success" style="width: 500px;">Profile updated.</div>'); return View::make('admin.pages.my_profile'); } Session::flash('common_feedback', '<div class="alert alert-warning" style="width: 500px;">Error updating profile. Please try again later</div>'); return View::make('admin.pages.my_profile'); }