| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/dcb/application/modules/admin/models/ |
Upload File : |
<?php
/* * *************************************************************
* Catabatic Technology Pvt. Ltd.
* File Name : Location.php
* File Description : Location Model for all manage methods
* Created By : Praveen Kumar
* Created Date: 17-June-2015
* ************************************************************* */
class Admin_Model_Leadcampaign extends Zend_Db_Table_Abstract {
function __construct() {
}
/**
* checkLocationNameExistsOrNot() method is used to check location name exists or not in db
* @param email string
* @return object
*/
public function checkCampaignNameExistsOrNot($campaignname) {
$db = Zend_Db_Table::getDefaultAdapter();
$select = $db->select()
->from("tbl_campaignname", array('count(*) AS total_record'))
->where('campaignname = ?', $campaignname);
$result = $db->fetchOne($select);
return $result;
}
public function deleteMultipleRows($comma_user_ids) {
$comma_user_ids_arr = @explode(",", $comma_user_ids);
$dbtable = new Zend_Db_Table('tbl_leadcampaign');
$where = array('id IN (?)' => $comma_user_ids_arr);
$dbtable->delete($where);
}
public function getAllLmsUsersList($fdate, $tdate) {
$dbtable = new Zend_Db_Table('tbl_leadcampaign');
$select = $dbtable->select()->where('1=1');
if ($fdate != "" && $tdate != "") {
$tomorrow = date('Y-m-d', strtotime($tdate . "+1 days"));
$select->where("CreteDate BETWEEN '" . $fdate . "' AND '" . $tomorrow . "'");
}
//echo $select; exit;
return $select;
}
public function createLeadcampaignCsv($fdate, $tdate) {
$dbtable = new Zend_Db_Table('tbl_leadcampaign');
$select = $dbtable->select()->where('1=1');
if ($fdate != "" && $tdate != "") {
$tomorrow = date('Y-m-d', strtotime($tdate . "+1 days"));
$select->where("CreteDate BETWEEN '" . $fdate . "' AND '" . $tomorrow . "'");
}
$result = $dbtable->fetchAll($select);
//echo "<pre>";print_r($result);die;
$file_name = "DCB_Lead" . "_" . date("Y-m-d_H-i", time()) . ".csv";
header('Content-Type: text/html; charset=utf-8');
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"$file_name\"");
header("Cache-Control: cache, must-revalidate");
header("Pragma: public");
$col = array(
"ID",
"Create Date",
"Full Name",
"Email ID",
"Country Name",
"City Name",
"Area Code",
"Landline No.",
"Mobile No.",
"UTM Content",
"UTM Source",
"UTM Medium",
"UTM Campaign",
"UTM Term",
"IP Address");
foreach ($col as $key => $value) {
echo $value . ",";
}
echo "\n";
$i=1;
foreach ($result as $key => $value) {
$username = $value['salutation'] . '. ' . ucfirst($value['FName']) . ' ' . ucfirst($value['LName']);
$date = date("d-M-Y", strtotime($value["CreteDate"]));
echo $i . ",";
echo $date . ",";
echo $username . ",";
echo $value["EmailId"] . ",";
echo $value["Country"] . ",";
echo $value["City"] . ",";
echo $value["AreaCode"] . ",";
echo $value["LandlineNo"] . ",";
echo $value["MobileNo"] . ",";
echo $value["utm_content"] . ",";
echo $value["utm_source"] . ",";
echo $value["utm_medium"] . ",";
echo $value["utm_campaign"] . ",";
echo $value["utm_term"] . ",";
echo $value["ip_address"] . ",";
echo "\n";
$i++;
}
}
public function getLocationDetailsById($id) {
$dbtable = new Zend_Db_Table('tbl_campaignname');
$select = $dbtable->select()->where('md5(concat("DCBLOCATION",id))= ?', $id);
$result = $dbtable->fetchRow($select);
return $result;
}
public function edit($editData, $where) {
$dbtable = new Zend_Db_Table('tbl_campaignname');
$dbtable->update($editData, $where);
}
public function delete($lid) {
$dbtable = new Zend_Db_Table('tbl_campaignname');
$where = array('md5(concat("DCBLOCATION",id))=?' => $lid);
$dbtable->delete($where);
}
public function checkEditCampaignNameExistsOrNot($location_id, $location_name) {
$db = Zend_Db_Table::getDefaultAdapter();
$select = $db->select()
->from("tbl_campaignname", array('count(*) AS total_record'))
->where('campaignname = ?', $location_name)
->where('md5(concat("DCBLOCATION",id)) !=?', $location_id);
$result = $db->fetchOne($select);
return $result;
}
/**
* add() method is used to add state name
* @param array
* @return true
*/
public function add($addData = array()) {
$dbtable = new Zend_Db_Table('tbl_campaignname');
try {
$dbtable->insert($addData);
} catch (Zend_Exception $e) {
echo $e;
exit;
}
}
public function getAllLocationList() {
$db = Zend_Db_Table::getDefaultAdapter();
$select = $db->select()
->from(array("tl" => "tbl_campaignname"), array('*'))
->order('tl.CreateDate');
$result = $db->fetchAll($select);
return $result;
}
/**
* checkEditLocationNameExistsOrNot() method is used to check location name exists or not in db
* @param city_id integer
* @param location_id integer
* @return object
*/
public function checkEditLocationNameExistsOrNot($location_id, $city_id, $location_name) {
$db = Zend_Db_Table::getDefaultAdapter();
$select = $db->select()
->from("tbl_location", array('count(*) AS total_record'))
->where('city_id = ?', $city_id)
->where('location_name = ?', $location_name)
->where('md5(concat("DCBLOCATION",id)) !=?', $location_id);
$result = $db->fetchOne($select);
return $result;
}
/**
* edit() method is used to add menu
* @param array
* @return true
*/
/**
* getLocationDetailsById() method is used to get location details
* @param id integer
* @return object
*/
/**
* getAllLocationList() method is used to get all states list
* @param NULL
* @return object
*/
/**
* delete() method is used to add menu
* @param array
* @return true
*/
/**
* getAllCityListByStateId() method is used to get city list by state id
* @param email string
* @return object
*/
public function getAllCityListByStateId($state_id) {
$dbtable = new Zend_Db_Table('tbl_city');
$select = $dbtable->select()
->where('state_id = ?', $state_id)
->where('status = ?', 'Activate')
->order('city_name');
$result = $dbtable->fetchAll($select);
return $result;
}
/**
* getAllLocationActiveList() method is used to get all location list
* @param NULL
* @return object
*/
public function getAllLocationActiveList() {
$dbtable = new Zend_Db_Table('tbl_location');
$select = $dbtable->select()
->where('status = ?', 'Activate')
->order('location_name');
$result = $dbtable->fetchAll($select);
return $result;
}
/**
* getAllLocationListBycityId() method is used to get all location list by city id
* @param NULL
* @return object
*/
public function getAllLocationListBycityId($city_id) {
$dbtable = new Zend_Db_Table('tbl_location');
$select = $dbtable->select()
->where('status = ?', 'Activate')
->where('city_id = ?', $city_id)
->order('location_name');
$result = $dbtable->fetchAll($select);
return $result;
}
}