Initial setup

This commit is contained in:
velz 2018-09-05 11:06:06 +05:30
parent 961c322227
commit fff7532565
20 changed files with 1866 additions and 192 deletions

View File

@ -16,7 +16,9 @@
"smalot/pdfparser": "^0.13.2",
"monolog/monolog": "^1.23",
"ddeboer/tesseract": "^1.1",
"aws/aws-sdk-php": "^3.64"
"aws/aws-sdk-php": "^3.64",
"amphp/amp": "^1.2"
},
"suggest": {
"paragonie/random_compat": "Provides better randomness in PHP 5.x"

View File

@ -4,8 +4,65 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "bfa621df7472a3d505dd26af8163a985",
"content-hash": "b4b72b09cfc21e95dae4ddb7c00d11d6",
"packages": [
{
"name": "amphp/amp",
"version": "v1.2.2",
"source": {
"type": "git",
"url": "https://github.com/amphp/amp.git",
"reference": "4f2161da5f68f274f116985635aea63b5c0f54d2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/amphp/amp/zipball/4f2161da5f68f274f116985635aea63b5c0f54d2",
"reference": "4f2161da5f68f274f116985635aea63b5c0f54d2",
"shasum": ""
},
"require": {
"php": ">=5.5"
},
"require-dev": {
"fabpot/php-cs-fixer": "~1.9",
"phpunit/phpunit": "~4.8"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Amp\\": "lib/"
},
"files": [
"lib/functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Daniel Lowrey",
"email": "rdlowrey@php.net",
"role": "Creator / Lead Developer"
}
],
"description": "A non-blocking concurrency framework for PHP applications",
"homepage": "https://github.com/amphp/amp",
"keywords": [
"async",
"concurrency",
"event",
"non-blocking",
"promise"
],
"time": "2016-05-12T12:54:59+00:00"
},
{
"name": "aws/aws-sdk-php",
"version": "3.64.15",

View File

@ -58,7 +58,7 @@ $autoload['packages'] = array();
|
| $autoload['libraries'] = array('user_agent' => 'ua');
*/
$autoload['libraries'] = array('database','form_validation', 'format');
$autoload['libraries'] = array('database','format');
/*
| -------------------------------------------------------------------
@ -89,7 +89,7 @@ $autoload['drivers'] = array();
|
| $autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array('url', 'form', 'jwt', "authorization", "date","mylog","myocr");
$autoload['helper'] = array('url', 'form', 'jwt', "authorization", "date","mylog","myocr","mydb");
/*
| -------------------------------------------------------------------

View File

@ -85,48 +85,17 @@ defined('EXIT__AUTO_MIN') OR define('EXIT__AUTO_MIN', 9); // lowest automat
defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
// define login route name for token verification
defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'login'); // no errors
defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'getListOfMaster'); // no errors
defined('ROUTE_LOGIN2') OR define('ROUTE_LOGIN2', 'login2'); // no errors
defined('ROUTE_LOGIN3') OR define('ROUTE_LOGIN3', 'login3'); // no errors
//encript database table name
defined('LOGIN') OR define('LOGIN','T_Login');
defined('BRANCH') OR define('BRANCH','T_BranchMaster');
defined('STAFF') OR define('STAFF','T_StaffDetails');
defined('STAFF_BRANCH') OR define('STAFF_BRANCH','T_Staff_BranchAccess');
defined('UNIVERSITY') OR define('UNIVERSITY','T_UniversityMaster');
defined('COURSE') OR define('COURSE','T_CourseMaster');
defined('COURSE_FEES') OR define('COURSE_FEES','T_Course_Fees_Details');
defined('LEAD_DETAILS') OR define('LEAD_DETAILS','T_Lead_Details');
defined('LEAD_TRACKING') OR define('LEAD_TRACKING','T_Lead_Tracking');
defined('LEAD_TRACKING_FOLLOWUP') OR define('LEAD_TRACKING_FOLLOWUP','T_Lead_Tracking_Followup');
defined('PICK_LIST_DETAILS') OR define('PICK_LIST_DETAILS','T_PickListDetails');
defined('BATCH') OR define('BATCH','T_BatchMaster');
defined('STUDENTCOURSE') OR define('STUDENTCOURSE','T_Student_CourseDetails');
defined('STUDENTS') OR define('STUDENTS','T_StudentDetails');
defined('ANNOUNCEMENT') OR define('ANNOUNCEMENT','T_AnnouncementDetails');
defined('ACTIVITY') OR define('ACTIVITY','T_ActivityMaster');
defined('ACTIVITY_STATUS') OR define('ACTIVITY_STATUS','T_Activity_Status');
defined('ANSWER_BOOKLET') OR define('ANSWER_BOOKLET','T_AnswerBookletStatus');
defined('APPLICATION_STATUS') OR define('APPLICATION_STATUS','T_ApplicationStatus');
defined('CERTIFICATION_STATUS') OR define('CERTIFICATION_STATUS','T_CertificationStatus');
defined('STUDENTS_FEES_STATUS') OR define('STUDENTS_FEES_STATUS','T_Students_Fees_Status');
defined('STUDENTS_FEES_PAID') OR define('STUDENTS_FEES_PAID','T_Students_Fees_PaidDetails');
defined('STUDY_MATERIAL_STATUS') OR define('STUDY_MATERIAL_STATUS','T_StudyMaterialStatus');
defined('CERTIFICATION') OR define('CERTIFICATION','T_CertificationMaster');
defined('DEFAULTACTIVITY') OR define('DEFAULTACTIVITY','T_StatusMaster');
defined('CERTIFICATION_MASTER') OR define('CERTIFICATION_MASTER','T_CertificationMaster');
defined('DAYBOOKMASTER') OR define('DAYBOOKMASTER','T_DayBookMaster');
defined('INCOMEOUTCOMEMASTER') OR define('INCOMEOUTCOMEMASTER','T_Income_Outcome_Master');
defined('FEES_INSTALLMENT') OR define('FEES_INSTALLMENT','T_Fees_Installments');
defined('CENTER') OR define('CENTER','T_CenterMaster');
defined('SUBJECTMASTER') OR define('SUBJECTMASTER','T_SubjectMaster');
defined('SESSIONMASTER') OR define('SESSIONMASTER','T_Session_Master');
defined('SESSIONDETAILS') OR define('SESSIONDETAILS','T_SessionDetails');
defined('COURSESUBJECT') OR define('COURSESUBJECT','T_CourseSubject_Details');
defined('SESSIONSCHEDULE') OR define('SESSIONSCHEDULE','T_SessionSchedule_Master');
defined('SESSIONSCHEDULEDETAILS') OR define('SESSIONSCHEDULEDETAILS','T_SessionSchedule_Details');
defined('STUDENTDOCUMENTDETAILS') OR define('STUDENTDOCUMENTDETAILS','T_StudentDocumentsDetails');
defined('STUDENTDOCUMENTTRACKDETAILS') OR define('STUDENTDOCUMENTTRACKDETAILS','T_Student_DocumentTrack_Details');
defined('INDUSTRYCLASSIFICATION') OR define('INDUSTRYCLASSIFICATION','m_industry_classification');
defined('INDUSTRYCLASSIFICATIONID') OR define('INDUSTRYCLASSIFICATIONID','industry_classification_id');
defined('PRODUCTS') OR define('PRODUCTS','m_products');
defined('PRODUCTSID') OR define('PRODUCTSID','product_id');

View File

@ -1,5 +1,9 @@
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/* public key for encrypt AWS JWT token
*/
$config['jwt_public_key'] = '-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy7kgZrHJIliQXFJNCGMV
v9HoGJAziKKEAyF8nW7nvLgtulJ7IUMiLzhmTeB74RVrvphM1ALEtk/BdQegMYXl

View File

@ -76,8 +76,11 @@ $query_builder = TRUE;
$db['dev'] = array(
'dsn' => '',
'hostname' => 'sine-edge-dev.cya6cheplup2.ap-south-1.rds.amazonaws.com',
'username' => 'sparqdev_mas001',
//'hostname' => 'localhost',
'username' => 'sparqdev_mas001',
//'username' => 'root',
'password' => 'sparqvenba',
// 'password' => '',
'database' => 'sine_edge_dev',
'dbdriver' => 'mysqli',
'dbprefix' => '',

View File

@ -53,6 +53,60 @@ $route['default_controller'] = 'welcome';
$route['autenticadors'] = 'autenticador/index';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
$route['login'] = 'Branch_Controller/testAWSS3';
$route['getBranchDetails'] = 'Branch_Controller/getBranchDetails';
$route['fileUpload'] = 'Branch_Controller/uploadFiles';
/*
| -------------------------------------------------------------------------
| SineEdge REST API Routes
| -------------------------------------------------------------------------
*/
/* Routes regards Common Masters CRUD operations*/
$route['getListOfMasters'] = 'Common_Masters_Controller/getListOfMasters';
$route['getListOfIndustryClassifications'] = 'Common_Masters_Controller/getListOfIndustryClassifications';
$route['saveIndustryClassification'] = 'Common_Masters_Controller/saveIndustryClassification';
$route['getListOfProducts'] = 'Common_Masters_Controller/getListOfProducts';
$route['saveProducts'] = 'Common_Masters_Controller/saveProducts';
$route['getListOfSubProducts'] = 'Common_Masters_Controller/getListOfSubProducts';
$route['saveSubProducts'] = 'Common_Masters_Controller/saveSubProducts';
$route['getListOfUOM'] = 'Common_Masters_Controller/getListOfUOM';
$route['saveUOM'] = 'Common_Masters_Controller/saveUOM';
$route['getListOfOccupationNonEarningMembers'] = 'Common_Masters_Controller/getListOfOccupationNonEarningMembers';
$route['saveOccupationNonEarningMembers'] = 'Common_Masters_Controller/saveOccupationNonEarningMembers';
$route['getListOfTypeOfActivities'] = 'Common_Masters_Controller/getListOfTypeOfActivities';
$route['saveTypeOfActivity'] = 'Common_Masters_Controller/saveTypeOfActivity';
$route['getListOfTitles'] = 'Common_Masters_Controller/getListOfTitles';
$route['saveTitle'] = 'Common_Masters_Controller/saveTitle';
$route['getListOfRelationships'] = 'Common_Masters_Controller/getListOfRelationships';
$route['saveRelationship'] = 'Common_Masters_Controller/saveRelationship';
$route['getListOfFrequencies'] = 'Common_Masters_Controller/getListOfFrequencies';
$route['saveFrequency'] = 'Common_Masters_Controller/saveFrequency';
$route['getListOfCustomerBehaviours'] = 'Common_Masters_Controller/getListOfCustomerBehaviours';
$route['saveCustomerBehaviour'] = 'Common_Masters_Controller/saveCustomerBehaviour';
$route['getListOfRegions'] = 'Common_Masters_Controller/getListOfRegions';
$route['saveRegion'] = 'Common_Masters_Controller/saveRegion';
$route['getListOfCites'] = 'Common_Masters_Controller/getListOfCites';
$route['saveCity'] = 'Common_Masters_Controller/saveCity';
$route['getListOfCites'] = 'Common_Masters_Controller/getListOfCites';
$route['saveCity'] = 'Common_Masters_Controller/saveCity';
$route['getListOfBranches'] = 'Common_Masters_Controller/getListOfBranches';
$route['saveBranch'] = 'Common_Masters_Controller/saveBranch';
$route['getListOfMaster'] = 'Common_Masters_Controller/getListOfMaster';
$route['saveMaster'] = 'Common_Masters_Controller/saveMaster';
//$route['login'] = 'User_Management_Controller/saveNewUser';

View File

@ -38,7 +38,7 @@ class Branch_Controller extends REST_Controller {
$this->load->model('Branch_model', 'branch_model');
//$this->load->library('AWS_S3');
//$this->load->library('AWS_SNS');
$this->load->library('AWS_SES');
//$this->load->library('AWS_SES');
}
/*
* get branch details
@ -115,8 +115,46 @@ class Branch_Controller extends REST_Controller {
/* GET FILE FROM S3*/
echo "SNS";
/*
$id = MYDB::saveRecords(array('city_name'=>'salem'),'t_city_master');
print_r($id);
*/
/*
$where_condition_array = array();
$id = MYDB::selectRecords($where_condition_array,'t_city_master',$print_query = '');
print_r($id);
*/
//$data = MYDB::updateRecords($record_data = array(),$table_name,$where_condition_array = array(),$print_query = '')
/*
$where= array('city_name'=>'chennai','fk_state_id'=>'1');
$or_where = array('city_name'=>'salem','fk_state_id'=>'4');
$or_where_total[] = $or_where;
$or_where = array('city_name'=>'erode');
$or_where_total[] = $or_where;
$fields = array('city_name','fk_state_id');
$id = MYDB::selectCustomRecords($fields , $where,$or_where_total,$table = 't_city_master', $limit = '', $order_by_colum_name = 'fk_state_id', $order_by = '',$group_by = 'fk_state_id',$print_query = '');
print_r($id);
*/
/*
$columns = array('city_name','state_name');
$table = 't_states_master';
$joins = array(
array(
'table' => 't_city_master',
'condition' => 't_city_master.fk_state_id = t_states_master.state_id',
'jointype' => 'INNER'
),
);
$id = MYDB::getJoinRecords($columns,$table,$joins,$print_query = '');
print_r($id);
*/
}
public function testPDF_get()

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,75 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . '/libraries/REST_Controller.php';
class Test extends REST_Controller {
/**
* load list modal, library and helpers
*/
function __Construct(){
parent::__Construct();
$this->load->helper(array('form', 'url'));
//$this->load->model('test_model');
$this->load->library('asynclibrary');
}
/**
* @desc : Function to perform multiple task in background
* @param :void
* @return : void
*/
public function ind_get(){
//echo base_url();
print_r(getallheaders());
$url = base_url()."test/sendmail";
$urls = base_url()."test/insert";
$param = array('email' => "jagroop@gmail.com" );
$param1 = array('name' => "Jagroop Singh",
'email' => "jagroop@gmail.com" );
// $async1 = $this->asynclibrary->do_in_background($url, $param);
// $async2 = $this->asynclibrary->do_in_background($urls, $param1);
// print_r($async1);
// print_r($async2);
}
/**
* @desc : Function to send mail
* @param :void
* @return : void
*/
public function sendmail_post(){
// $this->load->library('email');
$user_email = $_POST['email'];
// $message = "Testing";
// $this->email->from('wolfy@gmail.com', 'Wolfy Singh');
// $this->email->to($user_email);
// $this->email->subject("test");
// $this->email->message($message);
// $this->email->send();
$id = $this->db->insert('t_city_master',array('city_name'=> $user_email));
// echo $user_email;
// print_r($id);
}
/**
* @desc : Function to call insert() method
* of test_model to insert data in database
* @param :void
* @return : void
*/
public function insert_post(){
$user_email = $_POST['name'];
$this->db->insert('t_city_master',array('city_name'=>$user_email));
// $email = $this->input->post('email');
// $name = $this->input->post('name');
// $this->test_model->insert($email, $name);
//echo "insert";
}
}

View File

@ -0,0 +1,46 @@
<?php
/**
* User: velz
* This Controller deals with User Management CRUD Operations
*/
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . '/libraries/REST_Controller.php';
class User_Management_Controller extends REST_Controller {
function __construct()
{
// Construct the parent class
parent::__construct();
$this->load->model('User_Management_Model');
}
public function listAllUsers_get()
{
}
public function saveNewUser_post()
{
echo "saveNewUser_post";
$data = $this->post('data');
//$file = $_FILES['myfile'];
print_r($data);//print_r($file);
}
public function updateExistUser_post()
{
}
}

View File

@ -0,0 +1,117 @@
<?php
class MYDB
{
public static function saveRecords($record_data = array(),$table_name,$print_query = '')
{
$CI =&get_instance();
$CI->db->insert($table_name,$record_data);
if($print_query == 1)
{
print_r($CI->db->last_query());
}
return $CI->db->insert_id();
//print_r($CI->db);
}
public static function selectRecords($where_condition_array = array(),$table_name,$print_query = '')
{
$CI =&get_instance();
$data = $CI->db->get_where($table_name,$where_condition_array)->result_array();//only AND condition
if($print_query == 1)
{
print_r($CI->db->last_query());
}
return $data;
}
public static function updateRecords($record_data = array(),$table_name,$where_condition_array = array(),$print_query = '')
{
$CI =&get_instance();
$data = $CI->db->update($table_name,$record_data,$where_condition_array)->result_array();
if($print_query == 1)
{
print_r($CI->db->last_query());
}
return $data;
}
public static function selectCustomRecords($fields = '', $where = array(), $or_where_total = array(),$table = '', $limit = '', $order_by_colum_name = '', $order_by = 'ASC', $group_by = '',$print_query = '') {
$CI =&get_instance();
//$data = array();
if ($fields != '') {
$CI->db->select($fields);
}
if (count($where)) {
$CI->db->where($where);
}
if (count($or_where_total)) {
foreach($or_where_total as $or_where)
{
$CI->db->or_where($or_where);
}
}
if ($table != '') {
$CI->table_name = $table;
}
if ($limit != '') {
$CI->db->limit($limit);
}
if ($order_by_colum_name != '') {
$CI->db->order_by($order_by_colum_name,$order_by);
}
if ($group_by != '') {
$CI->db->group_by($group_by);
}
$data = $CI->db->get($CI->table_name)->result_array();
if ($print_query == '1') {
print_r($CI->db->last_query());
}
return $data;
}
public static function getJoinRecords($columns,$table,$joins,$print_query = '')
{
$CI =&get_instance();
$CI->db->select($columns)->from($table);
if (is_array($joins) && count($joins) > 0)
{
foreach($joins as $k => $join)
{
$CI->db->join($join['table'], $join['condition'], $join['jointype']);
}
}
$data = $CI->db->get()->result_array();
if ($print_query != '') {
print_r($CI->db->last_query());
}
return $data;
}
}
?>

View File

@ -0,0 +1,45 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
include_once APPPATH.'/vendor/autoload.php';
use Amp\Artax\Response;
use Amp\Loop;
class AMP
{
public function __construct()
{
Loop::run(function () {
$uris = [
"https://google.com/",
"https://github.com/",
"https://stackoverflow.com/",
];
$client = new Amp\Artax\DefaultClient;
$client->setOption(Amp\Artax\Client::OP_DISCARD_BODY, true);
try {
foreach ($uris as $uri) {
$promises[$uri] = $client->request($uri);
}
$responses = yield $promises;
foreach ($responses as $uri => $response) {
print $uri . " - " . $response->getStatus() . $response->getReason() . PHP_EOL;
}
} catch (Amp\Artax\HttpException $error) {
// If something goes wrong Amp will throw the exception where the promise was yielded.
// The Client::request() method itself will never throw directly, but returns a promise.
print $error->getMessage() . PHP_EOL;
}
});
}
}
?>

View File

@ -0,0 +1,58 @@
<?php
class Asynclibrary
{
public function __construct()
{
$this->ci =& get_instance();
}
function do_in_background($url, $params)
{
//echo "\n\nURL\n\n";
//print_r($url);
///echo "\n\params\n\n";
//print_r($params);
$post_string = http_build_query($params);
$parts = parse_url($url);
// echo "\n\post_string\n\n";
// print_r($post_string);
// echo "\n\parts\n\n";
// print_r($parts);
$errno = 0;
$errstr = "";
//Use SSL & port 443 for secure servers
//Use otherwise for localhost and non-secure servers
//For secure server
//$fp = fsockopen('ssl://' . $parts['host'], isset($parts['port']) ? $parts['port'] : 443, $errno, $errstr, 30);
//For localhost and un-secure server
$fp = fsockopen($parts['host'], isset($parts['port']) ? 9999 : 9999, $errno, $errstr, 30);
// echo "FP";print_r($fp);
if(!$fp)
{
echo "Something Went Wrong";
}
$out = "POST ".$parts['path']." HTTP/1.1\r\n";
$out.= "Host: ".$parts['host']."\r\n";
$out.= "Authorization:"."sparqvenba2018"."\r\n";
$out.= "Content-Type: application/x-www-form-urlencoded\r\n";
$out.= "Content-Length: ".strlen($post_string)."\r\n";
$out.= "Connection: Close\r\n\r\n";
//print_r($out);
if (isset($post_string)) $out.= $post_string;
//echo "isset";
fwrite($fp, $out);
// while (!feof($fp)) {
// echo fgets($fp, 128);
// }
fclose($fp);
}
}
?>

View File

@ -0,0 +1,125 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class SPARQ_Model extends CI_Model {
public function __construct()
{
parent::__construct();
$this->load->database();
}
public function saveRecords($record_data = array(),$table_name,$print_query = '')
{
$this->db->insert($table_name,$record_data);
if($print_query == 1)
{
print_r($this->db->last_query());
}
return $this->db->insert_id();
}
public function selectRecords($table_name,$where_condition_array = array(),$print_query = '')
{
echo $print_query;
echo $table_name;
$data = $this->db->get_where($table_name,$where_condition_array)->result_array();//only AND condition
print_r($data);
if($print_query == 1)
{
print_r($this->db->last_query());
}
return $data;
}
public function updateRecords($record_data = array(),$table_name,$where_condition_array = array(),$print_query = '')
{
$data = $this->db->update($table_name,$record_data,$where_condition_array);
if($print_query == 1)
{
print_r($this->db->last_query());
}
return $data;
}
public function selectCustomRecords($fields = '', $where = array(), $or_where_total = array(),$table = '', $limit = '', $order_by_colum_name = '', $order_by = 'ASC', $group_by = '',$print_query = '') {
//$data = array();
if ($fields != '') {
$this->db->select($fields);
}
if (count($where)) {
$this->db->where($where);
}
if (count($or_where_total)) {
foreach($or_where_total as $or_where)
{
$this->db->or_where($or_where);
}
}
if ($table != '') {
$this->table_name = $table;
}
if ($limit != '') {
$this->db->limit($limit);
}
if ($order_by_colum_name != '') {
$this->db->order_by($order_by_colum_name,$order_by);
}
if ($group_by != '') {
$this->db->group_by($group_by);
}
$data = $this->db->get($this->table_name)->result_array();
if ($print_query == '1') {
print_r($this->db->last_query());
}
return $data;
}
public function getJoinRecords($columns,$table,$joins,$print_query = '')
{
$this->db->select($columns)->from($table);
if (is_array($joins) && count($joins) > 0)
{
foreach($joins as $k => $join)
{
$this->db->join($join['table'], $join['condition'], $join['jointype']);
}
}
$data = $this->db->get()->result_array();
if ($print_query != '') {
print_r($this->db->last_query());
}
return $data;
}
}

View File

@ -1,151 +1,12 @@
<?php
/**
* Created by PhpStorm.
* User: karthi
* Date: 11/13/17
* Time: 8:03 PM
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Branch_model extends CI_Model {
/*
* add branch details
* params:branchcode,branchname,email,address,mobilenumber,activestatus
* created by kms
* */
public function addBranch($arrayDetails=null, $imageSource)
{
$target = "../images/logo/";
$getUploadStatus = $this-> upload_image($imageSource, $target);
$imageNameDb = $getUploadStatus['imageName'];
$arrayDetails['LogoPath'] = $getUploadStatus == true ? "logo/".$imageNameDb : '';
// print_r($arrayDetails['IsActive']);exit();
$this->db->select('BranchCode');
$this->db->where('BranchCode', $arrayDetails['BranchCode']);
if($this->db->get(BRANCH)->first_row()){
$result['BranchStatus'] = false;
$result['message'] = "This branch code is already exist!";
} else {
$this->db->select('BranchName');
$this->db->where('BranchName', $arrayDetails['BranchName']);
if($this->db->get(BRANCH)->first_row()){
$result['BranchStatus'] = false;
$result['message'] = "This branch name is already exist!";
} else{
$this->db->insert(BRANCH, $arrayDetails);
if($this->db->affected_rows() == '1'){
$result['branchStatus'] = true;
$result['message'] = "Successfully branch details added";
}
else {
$result['branchStatus'] = false;
$result['message'] = "Something went wrong.please try again";
}
}
class Branch_model extends SPARQ_Model {
public function __construct() {
parent::__construct();
}
return $result;
}
/*
* get branch details
* parama id
* created by kms
* */
public function getBranch()
{
$this->db->select('BranchCode,BranchName,LogoPath,MobileNumber,AlternateNumber,LandlineNumber,Address,EmailID,CreatedOn,IsActive,FeesReceiptTitle as feesTitle');
$this->db->order_by('CreatedOn','DESC');
$branchDetails = $this->db->get(BRANCH);
if($branchDetails->result()){
$result['branchStatus'] = true;
$result['details'] = $branchDetails->result();
}
else {
$result['branchStatus'] = false;
$result['message'] = "No records found!";
}
return $result;
}
/*
* update branch details
* created by kms
* */
public function updateBranch($arrayDetails=null,$branchCode=null, $imageSource, $imageStat)
{
if( $imageStat == 1 ) {
$target = "../images/logo/";
$getUploadStatus = $this-> upload_image($imageSource, $target);
$imageNameDb = $getUploadStatus['imageName'];
$arrayDetails['LogoPath'] = $getUploadStatus == true ? "logo/".$imageNameDb : null;
} else {
}
// print_r($arrayDetails['IsActive']);exit();
$this->db->where('BranchCode',$branchCode);
$upateStatus=$this->db->update(BRANCH, $arrayDetails);
if($upateStatus){
$result['branchStatus'] = true;
$result['message'] = "Successfully branch details updated";
}
else {
$result['branchStatus'] = false;
$result['message'] = "Something went wrong.please try again";
}
return $result;
}
// image upload in taget path
public function upload_image( $imageSource, $target ) {
$key2 = substr(str_shuffle('abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, 12);
$new_regNo = "Dri_" . $key2 . "." . 'jpeg';
$targetPlace = $target . $new_regNo;
// echo $targetPlace;exit();
if(!move_uploaded_file($imageSource , $targetPlace))
{
return $result['status'] = false;
} else {
$result['status'] = true;
$result['imageName'] = $new_regNo;
return $result;
}
}
// student document upload target path
public function uploadFiles($resource=null) {
$target="myDocs/";
$key2 = substr(str_shuffle('abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, 12);
$new_regNo = "Dri_".$key2."_".$resource['doc_name'];
$targetPlace = $target . $new_regNo;
// echo $targetPlace;exit();
if (!move_uploaded_file($resource['doc_source'], $targetPlace)) {
return $result['uploadStatus'] = false;
} else {
$result['uploadStatus'] = true;
$result['sourceName'] = $new_regNo;
return $result;
}
}
}

View File

@ -0,0 +1,20 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . '/libraries/SPARQ_Model.php';
class Common_Masters_Model extends SPARQ_Model {
public function __construct()
{
parent::__construct();
}
public function getListOfMasters()
{
return $this->selectRecords('m_list_of_masters');
}
}

View File

@ -0,0 +1,15 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . '/libraries/SPARQ_Model.php';
class User_Management_Model extends SPARQ_Model {
public function __construct() {
parent::__construct();
}
}

View File

@ -1,10 +1,12 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Welcome to CodeIgniter</title>
<style type="text/css">
@ -69,6 +71,10 @@ defined('BASEPATH') OR exit('No direct script access allowed');
<div id="container">
<h1>Welcome to CodeIgniter!</h1>
<h1><?php $INDUSTRYCLASSIFICATION = 'INDUSTRYCLASSIFICATION';
//$id = 'INDUSTRYCLASSIFICATIONID';
echo constant($INDUSTRYCLASSIFICATION.'ID');
?></h1>
<div id="body">
<p>The page you are looking at is being generated dynamically by CodeIgniter.</p>

View File

@ -0,0 +1,122 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class SPARQ_Model extends CI_Model {
public function __construct()
{
parent::__construct();
$this->load->database();
}
public function saveRecords($record_data = array(),$table_name,$print_query = '')
{
$this->db->insert($table_name,$record_data);
if($print_query == 1)
{
print_r($this->db->last_query());
}
return $this->db->insert_id();
//print_r($this->db);
}
public function selectRecords($where_condition_array = array(),$table_name,$print_query = '')
{
$data = $this->db->get_where($table_name,$where_condition_array)->result_array();//only AND condition
if($print_query == 1)
{
print_r($this->db->last_query());
}
return $data;
}
public function updateRecords($record_data = array(),$table_name,$where_condition_array = array(),$print_query = '')
{
$data = $this->db->update($table_name,$record_data,$where_condition_array)->result_array();
if($print_query == 1)
{
print_r($this->db->last_query());
}
return $data;
}
public function selectCustomRecords($fields = '', $where = array(), $or_where_total = array(),$table = '', $limit = '', $order_by_colum_name = '', $order_by = 'ASC', $group_by = '',$print_query = '') {
//$data = array();
if ($fields != '') {
$this->db->select($fields);
}
if (count($where)) {
$this->db->where($where);
}
if (count($or_where_total)) {
foreach($or_where_total as $or_where)
{
$this->db->or_where($or_where);
}
}
if ($table != '') {
$this->table_name = $table;
}
if ($limit != '') {
$this->db->limit($limit);
}
if ($order_by_colum_name != '') {
$this->db->order_by($order_by_colum_name,$order_by);
}
if ($group_by != '') {
$this->db->group_by($group_by);
}
$data = $this->db->get($this->table_name)->result_array();
if ($print_query == '1') {
print_r($this->db->last_query());
}
return $data;
}
public function getJoinRecords($columns,$table,$joins,$print_query = '')
{
$this->db->select($columns)->from($table);
if (is_array($joins) && count($joins) > 0)
{
foreach($joins as $k => $join)
{
$this->db->join($join['table'], $join['condition'], $join['jointype']);
}
}
$data = $this->db->get()->result_array();
if ($print_query != '') {
print_r($this->db->last_query());
}
return $data;
}
}