public function action_setoptions() { // Upload config and handling $config = array('field' => 'file', 'path' => DOCROOT . 'uploads/data/', 'randomize' => true, 'ext_whitelist' => array('csv')); \Upload::process($config); if (\Upload::is_valid()) { // save them according to the config \Upload::save(); $uploads = \Upload::get_files(); $dataFilename = $uploads[0]['saved_as']; $realFilename = $uploads[0]['filename']; if ($f = fopen(DOCROOT . "uploads/data/" . $dataFilename, 'r')) { $line = fgets($f); // read until first newline fclose($f); } $line = trim(preg_replace('/\\s+/', ' ', $line)); $fileHeadings = explode(',', str_replace('"', '', $line)); // Generate a nice list of headings for the required fields $databaseHeadings = array('title' => 'Title', 'first_name' => 'First Name', 'middle_initial' => 'Middle Initial', 'last_name' => 'Surname', 'address1' => 'Address 1', 'address2' => 'Address 2', 'address3' => 'Address 3', 'city' => 'City', 'state' => 'State', 'province' => 'Province', 'postal_code' => 'Post Code', 'gender' => 'Gender', 'phone_number' => 'Phone Number', 'alt_phone' => 'Alternate Phone', 'email' => 'E-Mail', 'date_of_birth' => 'Date of Birth', 'comments' => 'Comments'); $headingGuess = array(); foreach ($fileHeadings as $heading) { $checkHeading = \Data\Model_Data::heading_suggestion($heading); if ($checkHeading) { $headingGuess[$checkHeading] = $heading; } } } $suppliers = \DB::select('id', 'name')->from('suppliers')->execute()->as_array(); $this->template->title = 'Set Data Options'; $this->template->content = \View::forge('add/setoptions', array('dataFilename' => $dataFilename, 'realFilename' => $realFilename, 'allHeadings' => $databaseHeadings, 'fileHeadings' => $fileHeadings, 'headingsGuess' => $headingGuess, 'suppliers' => $suppliers)); }
public static function minuteReport() { // First get the current campaigns that are running $currentPremierLists = Model_Data::current_lists('PREMIER'); $currentStandardLists = Model_Data::current_lists('STANDARD'); }