/** *This method loads a csv file content into the database for a new list * *@param null *@return void */ public function getManagenew() { //get the list id to manage $list_id = Input::get('list_id'); //get information about this list $list_info = ListsModel::getById($list_id); //open the csv file $full_path = Path::base() . $list_info[0]['csv_file_path']; //get the first 10 lines $file_pointer = fopen($full_path, 'r'); $itr = 5; while (!feof($file_pointer)) { if ($itr == 0) { break; } //read data into csv $data['list_data'][] = fgetcsv($file_pointer); --$itr; } //get the column list $data['column_list'] = $data['list_data'][0]; //get table fielnames $data['table_fields'] = SubscribersModel::getTableColumnNames(); //lod the view page with this information View::render('lists/managenew', $data); }
/** *This method sets the upload target directory * *@param null *@return \Object $this instance */ public function setTargetdir() { //set the target dir $this->target_dir = Path::base() . $this->upload_path; //check if the directory exists and create if not if (!file_exists($this->target_dir)) { mkdir($this->target_dir); } return $this; }