<commit_before><?php
use Parse\ParseClient;
use Parse\ParseObject;
use Parse\ParseQuery;
use Parse\ParseACL;
use Parse\ParsePush;
use Parse\ParseUser;
use Parse\ParseInstallation;
use Parse\ParseException;
use Parse\ParseAnalytics;
use Parse\ParseFile;
use Parse\ParseCloud;

class Operators_model extends CI_Model
{

	public function __construct()
	{

	}

	public function add($data)
	{
		$filePath = $data["uploadPhoto"]["tmp_name"];
		$ext = pathinfo($data["uploadPhoto"]["name"], PATHINFO_EXTENSION);

		$file = ParseFile::createFromFile($filePath, $data["username"].".".$ext);
		$file->save();
		$url = $file->getUrl();
		$cp = new ParseObject("_User");
		$cp->set("username", $data["username"]);
		$cp->set("password", '<PASSWORD>');
		$cp->set("firstName", $data["firstName"]);
		$cp->set("lastName", $data["lastName"]);
		$cp->set("email", $data["email"]);
		$cp->set("homeAddress", $data["homeAddress"]);
		$cp->set("phoneNumber", $data["phoneNumber"]);
		$cp->set("operatorPicture", $file);
		$cp->set("isOperator", true);
		$cp->set("isRemoved", false);

		try 
		{
			$cp->save();
			return $cp;
		} 
		catch (ParseException $ex) 
		{    
			die('<pre>'.print_r($ex->getMessage(), true));
		}
	}//END ADD

	public function view()
	{
		$array = array();
		$query = new ParseQuery('_User');
		$query->equalTo("isRemoved", false);
		$results["operators"] = $query->find();
		<commit_msg>added userdata<commit_after><?php
use Parse\ParseClient;
use Parse\ParseObject;
use Parse\ParseQuery;
use Parse\ParseACL;
use Parse\ParsePush;
use Parse\ParseUser;
use Parse\ParseInstallation;
use Parse\ParseException;
use Parse\ParseAnalytics;
use Parse\ParseFile;
use Parse\ParseCloud;

class Operators_model extends CI_Model
{

	public function __construct()
	{

	}

	public function add($data)
	{
		$filePath = $data["uploadPhoto"]["tmp_name"];
		$ext = pathinfo($data["uploadPhoto"]["name"], PATHINFO_EXTENSION);

		$file = ParseFile::createFromFile($filePath, $data["username"].".".$ext);
		$file->save();
		$url = $file->getUrl();
		$cp = new ParseObject("_User");
		$cp->set("username", $data["username"]);
		$cp->set("password", '<PASSWORD>');
		$cp->set("firstName", $data["firstName"]);
		$cp->set("lastName", $data["lastName"]);
		$cp->set("email", $data["email"]);
		$cp->set("homeAddress", $data["homeAddress"]);
		$cp->set("phoneNumber", $data["phoneNumber"]);
		$cp->set("operatorPicture", $file);
		$cp->set("isOperator", true);
		$cp->set("isRemoved", false);

		
		



		try 
		{
			$cp->save();
			// die('<pre>'.print_r($cp, true));
			
			$cu = new ParseObject("UserData");
			$cu->set("user", $cp);
			$cu->save();
			
			return $this->get_id($data["objectId"]);
		} 
		catch (ParseException $ex) 
		{    
			die('<pre>'.print_r($ex->getMessage(), true));
		}
	}//END ADD

	public function view()
	{
		$array = array();
		$query = new ParseQuery('_User');
		$query->equalTo("isRemoved", false);
		$results["operators"] = $query->find();
		
{'fraction_non_alphanumeric': 0.21771467207572684, 'fraction_numerical': 0.0, 'mean_word_length': 4.953722334004024, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7233837', 'n_tokens_mistral': 1151, 'n_tokens_neox': 1051, 'n_words': 189}