Ejemplo n.º 1
0
 /**
  *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);
 }
Ejemplo n.º 2
0
 /**
  * This method sets the default dependnacies for this class.
  * @param string $table_name The name of the table to be created
  * @param string $model_name The name of the model class calling this instance
  * @param resource $service The mysqli connector
  * @return object $this
  */
 public function __construct($table_name, $model_name, MySQL $service)
 {
     $this->table = $table_name;
     $this->model = $model_name;
     $this->connection = $service;
     $this->table_dir = Path::app() . "database/";
     $this->table_file_path = $this->table_dir . str_replace('\\', '/', $this->model) . "Table.php";
     return $this;
 }
Ejemplo n.º 3
0
 /**
  *This method converts the code into valid php code
  *
  *@param string $file The name of the view whose content is to be parsed
  *@param boolean true|false True if this is an embeded view into another view file
  *@return string $parsedContent The parsed content of the template file
  */
 public static function getContents($fileName, $embeded)
 {
     //compose the file full path
     $filePath = Path::view($fileName);
     //get an instance of the view template class
     $template = self::getBaseTemplateObject();
     //get the compiled file contents
     $contents = $template->compiled($filePath, $embeded, $fileName);
     //return the compiled template file contents
     return $contents;
 }
Ejemplo n.º 4
0
 /**
  *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;
 }