| 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/b2c.hellogtx.com/application/admin/controllers/ |
Upload File : |
<?php
/* * *************************************************************
* Catabatic Technology Pvt. Ltd.
* File Name : ContactusController.php
* File Desc. : Contactus controller managed all contact queries
* Created By : Piyush Tiwari <piyush@catpl.co.in>
* Created Date : 23 May 2018
* Updated Date : 09 Jan 2018
* ************************************************************* */
class Admin_TicketadsController extends Catabatic_Rvadmin
{
public $dbAdapter;
public $perPageLimit;
public $siteurl;
public $DIR_WRITE_MODE;
public function init()
{
parent::init(); //
/* Initialize db and session access */
$aConfig = $this->getInvokeArg('bootstrap')->getOptions();
$this->view->siteurl = $this->siteurl = $aConfig['bootstrap']['siteUrl'];
$this->view->stylecss = $this->stylecss = $aConfig['bootstrap']['stylecss'];
$this->appmode = $aConfig['bootstrap']['appmode'];
$this->AgencyId = $aConfig['bootstrap']['gtxagencysysid'];
$this->per_page_record = 25;
$this->dbAdapter = Zend_Db_Table::getDefaultAdapter();
$auth = Zend_Auth::getInstance();
$authStorage = $auth->getStorage()->read();
$this->username = $authStorage->username;
$this->admin_type = $authStorage->role;
$this->large_image_width = $aConfig['bootstrap']['large_image_width'];
$this->large_image_height = $aConfig['bootstrap']['large_image_height'];
$this->medium_image_width = $aConfig['bootstrap']['medium_image_width'];
$this->medium_image_height = $aConfig['bootstrap']['medium_image_height'];
$this->small_image_width = $aConfig['bootstrap']['small_image_width'];
$this->small_image_height = $aConfig['bootstrap']['small_image_height'];
$this->DIR_WRITE_MODE = 0777;
$this->current_time = time();
$this->imageDirectory = (($this->appmode == 'MODE_BETA') ? 'beta/' : '') . 'public/upload/' . $this->stylecss . '/ticket/';
$this->imageUrl = (($this->appmode == 'MODE_BETA') ? 'beta/' : '') . 'public/upload/' . $this->stylecss . '/visa/';
}
public function indexAction()
{
$crud = new Admin_Model_CRUD();
$ticketRecord = $crud->rv_select_all('tbl_ticketads', ['*'], ['IsActive' => 1, 'IsmarkForDel' => 0], ['Id' => 'DESC']);
// echo "ticketRecord<pre>"; print_r($ticketRecord);die;
$getData = $this->getRequest()->getPost();
$pId = (int) $this->getRequest()->getParam("id");
if($pId) {
$resultset = $crud->getCmsdata('tbl_ticketads', ['*'], ['id' => $pId], ['id' => 'DESC']);
}
if (isset($getData['save']) == "Save") {
// echo "11ticketRecord<pre>"; print_r($getData);die;
$images = $_FILES['images']['name'];
if (!empty($images)) {
$orignalFolderName = $_SERVER["DOCUMENT_ROOT"] . "/" . $this->imageDirectory;
$fileExtion = $this->_helper->General->getFileExtension($images);
$bfileName = $this->current_time . 'ticket' . '_1.' . $fileExtion;
$file = $orignalFolderName . basename($_FILES['images']['name']);
$size = getimagesize($file);
$image_info = getimagesize($_FILES["images"]["tmp_name"]);
$image_width = $image_info[0];
$image_height = $image_info[1];
if ($this->large_image_width == $image_width && $this->large_image_height == $image_height) {
if (!file_exists($orignalFolderName)) {
mkdir($orignalFolderName, $this->DIR_WRITE_MODE, true);
}
$temp_file_name = $_FILES["images"]["tmp_name"]; // temprary file name
@move_uploaded_file($temp_file_name, $orignalFolderName . "/" . $bfileName);
$savePageData = [
'images' => $bfileName,
'url' => $getData['url'],
'IsActive' => 1,
'IsmarkForDel' => 0,
];
if($getData['id']) {
$crud->rv_update('tbl_ticketads', $savePageData, ['id =?' => $getData['id']]);
$this->view->successMessage = "Ticket has been saved successfully.";
$this->_helper->flashMessenger->addMessage("Ticket has been added successfully.");
} else {
$crud->rv_insert('tbl_ticketads', $savePageData);
$this->view->successMessage = "Ticket has been saved successfully.";
$this->_helper->flashMessenger->addMessage("Ticket has been added successfully.");
}
}
}
$this->_redirect("/admin/ticketads/index");
// echo "save values";
// die;
}
$this->view->messages = $this->_helper->flashMessenger->getMessages();
$this->view->ticketRecord = $ticketRecord;
$this->view->resultset = $resultset;
}
}