public function actionAddPrice() { $model = new PriceAdmin(); $res = ServiceTypes::model()->findAll(); $userS = ServiceUser::model()->findAll(); if (isset($_POST['PriceAdmin'])) { $model->attributes = $_POST['PriceAdmin']; //echo "<pre>";print_r($_REQUEST);die; if ($model->validate()) { //echo "<pre>";print_r($_REQUEST);die; if (!empty($_REQUEST['PriceAdmin']['recid'])) { $id = $_REQUEST['PriceAdmin']['recid']; $findRec = PriceAdmin::model()->findByPk($id); $findRec->id = $_REQUEST['PriceAdmin']['recid']; $findRec->bedroom = $_REQUEST['PriceAdmin']['bedroom']; $findRec->bathroom = $_REQUEST['PriceAdmin']['bathroom']; $findRec->property = $_REQUEST['PriceAdmin']['property']; $findRec->desk = $_REQUEST['PriceAdmin']['desk']; $findRec->living_room = $_REQUEST['PriceAdmin']['living_room']; $findRec->kitchen_staircases = $_REQUEST['PriceAdmin']['kitchen_staircases']; $findRec->carpets_interior_windows = $_REQUEST['PriceAdmin']['carpets_interior_windows']; $findRec->cupboards = $_REQUEST['PriceAdmin']['cupboards']; $findRec->kitchen = $_REQUEST['PriceAdmin']['kitchen']; $findRec->staircases = $_REQUEST['PriceAdmin']['staircases']; $findRec->elevator = $_REQUEST['PriceAdmin']['elevator']; $findRec->cleaning_material_price = $_REQUEST['PriceAdmin']['cleaning_material_price']; $findRec->bedroom_hr = $_REQUEST['PriceAdmin']['bedroom_hr']; $findRec->bathroom_hr = $_REQUEST['PriceAdmin']['bathroom_hr']; $findRec->property_hr = $_REQUEST['PriceAdmin']['property_hr']; $findRec->desk_hr = $_REQUEST['PriceAdmin']['desk_hr']; $findRec->living_room_hr = $_REQUEST['PriceAdmin']['living_room_hr']; $findRec->kitchen_staircases_hr = $_REQUEST['PriceAdmin']['kitchen_staircases_hr']; $findRec->carpets_interior_windows_hr = $_REQUEST['PriceAdmin']['carpets_interior_windows_hr']; $findRec->cupboards_hr = $_REQUEST['PriceAdmin']['cupboards_hr']; $findRec->kitchen_hr = $_REQUEST['PriceAdmin']['kitchen_hr']; $findRec->staircases_hr = $_REQUEST['PriceAdmin']['staircases_hr']; $findRec->elevator_hr = $_REQUEST['PriceAdmin']['elevator_hr']; $findRec->cleaning_material_price_hr = $_REQUEST['PriceAdmin']['cleaning_material_price_hr']; if ($findRec->save(false)) { $this->redirect(array('pricelisting')); } } $date = date('Y-m-d'); $model->date = $date; if ($model->save()) { $this->redirect(array('pricelisting')); } } else { $errors = $model->getErrors(); } } $this->render('addprice', array('model' => $model, 'serType' => $res, 'user' => $userS)); }
public function actionProviderEdit($id) { $model = new ServiceUser(); $detail = ServiceUser::model()->with('servicePrices')->findByPk(array('id' => $id)); /*foreach($detail->priceAdmins as $i=>$d) { echo "<pre>";print_r($d); } die;*/ if (isset($_POST['ServiceUser'])) { // echo "<pre>";print_r($_REQUEST);die; $model->attributes = $_POST['ServiceUser']; $rnd = rand(0, 9999); $uploadedFile = CUploadedFile::getInstance($model, 'company_logo'); $fileName = "{$rnd}-{$uploadedFile}"; // random number + file name //echo "<pre>";print_r($_FILES);die; if ($model->validate()) { $rec = ServiceUser::model()->with('servicePrices')->findByPk(array('id' => $id)); $cname = $_REQUEST['ServiceUser']['company_name']; $city = $_REQUEST['ServiceUser']['city']; $zip = $_REQUEST['ServiceUser']['zipcode']; $phone = $_REQUEST['ServiceUser']['phone']; $rec->phone = $phone; $rec->company_name = $cname; $rec->city = $city; $rec->zipcode = $zip; if (is_uploaded_file($_FILES['ServiceUser']['tmp_name']['company_logo'])) { $rec->company_logo = $fileName; } /*code to save the details for price in db starts here*/ foreach ($rec->priceAdmins as $editPrice) { $editPrice->bedroom = $_REQUEST['PriceAdmin'][$editPrice->service_type_id][0]; $editPrice->bathroom = $_REQUEST['PriceAdmin'][$editPrice->service_type_id][1]; if (!empty($_REQUEST['PriceAdmin'][$editPrice->service_type_id][2]) || !empty($_REQUEST['PriceAdmin'][$editPrice->service_type_id][3])) { $editPrice->property = $_REQUEST['PriceAdmin'][$editPrice->service_type_id][2]; $editPrice->desk = $_REQUEST['PriceAdmin'][$editPrice->service_type_id][3]; } $editPrice->save(); } //die; /*code to save the details for price in db ends here*/ if ($rec->save()) { if (is_uploaded_file($_FILES['ServiceUser']['tmp_name']['company_logo'])) { $uploadedFile->saveAs(Yii::app()->basePath . '/../CompanyLogo/' . $fileName); } $this->redirect(array('providerdetails')); } } else { $errors = $model->getErrors(); var_dump($errors); } } $this->render('provideredit', array('companyDetail' => $detail, 'model' => $model)); }
public function actionForgotPassword() { $model = new ForgotPassword(); $getEmail = $_POST['ForgotPassword']['email']; $getModel = ServiceUser::model()->findByAttributes(array('email' => $getEmail)); $gtModel = CustomerUser::model()->findByAttributes(array('email' => $getEmail)); if (isset($_POST['ForgotPassword'])) { $model->attributes = $_POST['ForgotPassword']; if ($model->validate()) { if (!empty($getModel)) { $p = rand(); $pwd = md5($p); $subject = 'Welcome to Wow Cleans'; $body = $this->renderPartial('registrationEmail', array('model' => $model, 'password' => $p), true); $getModel->password = $pwd; if ($getModel->save()) { $msg = Yii::app()->user->setFlash('serviceforgot', "Please check you email !"); Yii::app()->mailer->send($model->email, $subject, $body); $this->redirect(array('registration/registration/index')); } } if (!empty($gtModel)) { $p = rand(); $pwd = md5($p); $subject = 'Welcome to Wow Cleans'; $body = $this->renderPartial('registrationEmail', array('model' => $model, 'password' => $p), true); $gtModel->password = $pwd; if ($gtModel->save()) { Yii::app()->mailer->send($model->email, $subject, $body); Yii::app()->user->setFlash('forgotc', "Please check you email"); $this->redirect(array('registration/registration/index')); } } } else { $errors = $model->getErrors(); } } $links = CmsPages::model()->findAll(); Yii::app()->params['MyArray'] = $links; $this->render('forgotpassword', array('model' => $model)); }
</script> <div id="msglis<?php echo $bookingId; ?> "> <div id="mailbox-inbox" class="ajax-paged"><!-- class ajax-paged required to make pagination work --> <div class="grid-header-row"> <span class="subject">Subject</span> <!--<span class="username">From</span> --> <!--<span class="lowest_bid">Quote</span> --> <span class="date"><a href="/ajax-dashboard-customer-messages/sort-field-created_at/sort-direction-asc" class="">Received</a></span> <!--<span class="delete-message bluebtn dlt">Delete</span>--> </div> <?php $loggedId = Yii::app()->session['loggedId']; $name = ServiceUser::model()->findByPk(array('id' => $loggedId)); $custname = $name->company_name; $lastId = end($inbox); $last = $lastId['id']; echo "<input type='hidden' id='msgnotify' value='" . $last . "'>"; foreach ($inbox as $msg1) { //echo "<pre>";print_r($msg1); ?> <div class="message close has-more read- first-row unread" id="<?php echo $msg1->id; ?> " data-id="17602932"> <!-- <div class="status read"></div>--> <div class="subject"><?php echo $msg1->conversation['subject']; ?>
public function actionIndex() { $model = new PaymentCustomerUser(); $booking = new CustomerBooking(); $address = new CustomerAddress(); $company = new CompanyRequest(); $ses = Yii::app()->session['CleaningDetail']; $servicetype = Yii::app()->session['ServiceTypeId']; $zip = $ses['CleaningTime']['PostCode']; // echo "<pre>";print_r(base64_decode($_REQUEST['value']));die; //echo "<pre>";print_r($ses);die; //$myProducts = Yii::app()->session['detail']; $detail = Yii::app()->session['detail']; foreach ($detail['Additional'] as $k => $d) { $detailadnl[$k] = ServicetypeAdditionalservices::model()->findAll(array('condition' => 'id=:id', 'params' => array(':id' => $k))); } foreach ($detailadnl as $key => $nam) { // echo "<pre>";print_r($nam); foreach ($nam as $value) { $detailadnl[$key] = $value['additional_service_name']; } } //echo "<pre>";print_r($detail['Additional']); $finalDetailadnl = array_combine($detailadnl, $detail['Additional']); //echo "<pre>";print_r($fin);die; //$price =$_REQUEST['price']; // code to get the method from admin %age or fiexd cost of total amount $paymentAdmin = PaymentToAdmin::model()->find(array('condition' => 'status=1')); if (!empty($paymentAdmin)) { //echo "adda";die; if ($paymentAdmin['type_of_cost'] == 'Fixed') { $price = $paymentAdmin['cost_percentage']; } else { if (isset($_REQUEST['value'])) { $pri = $paymentAdmin['cost_percentage'] * base64_decode($_REQUEST['value']); $pce = $pri / 100; $price = $pce; } else { $price = base64_decode($_REQUEST['value1']); } } } else { $price = base64_decode($_REQUEST['value']); } //echo $price;die; $service_id = $_REQUEST['service_id']; $rec = UkPostcodes::model()->findByattributes(array('postcode' => $zip)); // detail for logged user $loggedId = Yii::app()->session['loggedId']; $customerDetail = PaymentCustomerUser::model()->findByPk(array('id' => $loggedId)); //echo "<pre>";print_r($customerDetail);die; //echo "<pre>";print_r($servicetype);die; if (isset($_POST['PaymentCustomerUser'])) { $logged = Yii::app()->session['loggedId']; //echo "<pre>";print_r($ses);die; $model->attributes = $_POST['PaymentCustomerUser']; if ($model->validate()) { // echo "<pre>";print_r($_REQUEST);die; $exp = $_REQUEST['PaymentCustomerUser']['expire']; $res = explode("/", $exp); $month = $res[0]; $year = $res[1]; $cardDetail = implode(explode(" ", trim($_REQUEST['PaymentCustomerUser']['cardDetail']))); /*if($_REQUEST['value']==0) { $price=0; } */ $paymentInfo = array('Member' => array('first_name' => $_REQUEST['PaymentCustomerUser']['cname'], 'last_name' => $_REQUEST['PaymentCustomerUser']['clname'], 'billing_address' => $_REQUEST['PaymentCustomerUser']['caddress'], 'billing_address2' => $_REQUEST['PaymentCustomerUser']['caddress'], 'billing_country' => $_REQUEST['PaymentCustomerUser']['country'], 'billing_city' => $_REQUEST['PaymentCustomerUser']['city'], 'billing_zip' => $_REQUEST['PaymentCustomerUser']['zipcode']), 'CreditCard' => array('card_number' => $cardDetail, 'expiration_month' => trim($month), 'expiration_year' => trim($year), 'cv_code' => $_REQUEST['PaymentCustomerUser']['code'], 'credit_type' => $_REQUEST['PaymentCustomerUser']['cardType']), 'Order' => array('theTotal' => $price)); // echo "<pre>";print_r($paymentInfo); $result = Yii::app()->Paypal->DoDirectPayment($paymentInfo); //echo http_build_query($data, 'flags_'); //echo "<pre>";print_r($result);die; if ($result['ACK'] == 'Failure') { $links = CmsPages::model()->findAll(); Yii::app()->params['MyArray'] = $links; Yii::app()->user->setFlash('ack', "Please check your card details"); $this->render('index', array('model' => $model, 'town' => $rec, 'price' => $price, 'service_id' => $service_id)); } if (!Yii::app()->Paypal->isCallSucceeded($result)) { if (Yii::app()->Paypal->apiLive === true) { //Live mode basic error message $error = 'We were unable to process your request. Please try again later'; } else { //Sandbox output the actual error message to dive in. $error = $result['L_LONGMESSAGE0']; } echo $error; } else { //Payment was completed successfully, do the rest of your stuff // code to register the customer and save transaction id in differ table if (!empty($result['TRANSACTIONID'])) { $model->cname = $_REQUEST['PaymentCustomerUser']['cname']; $model->clname = $_REQUEST['PaymentCustomerUser']['clname']; $model->caddress = $_REQUEST['PaymentCustomerUser']['caddress']; $model->zipcode = $_REQUEST['PaymentCustomerUser']['zipcode']; $model->phone = $_REQUEST['PaymentCustomerUser']['phone']; $model->email = $_REQUEST['PaymentCustomerUser']['email']; $model->city = $_REQUEST['PaymentCustomerUser']['city']; $model->country = $_REQUEST['PaymentCustomerUser']['country']; $model->cregistered = date('Y-m-d'); $email = $_REQUEST['PaymentCustomerUser']['email']; $user = PaymentCustomerUser::model()->exists('email=:email', array('email' => $email)); // $user=PaymentCustomerUser::model()->findByAttributes(array('email'=>$email)); //echo "<pre>";print_r($user);die; //if(count($user)<0) if (empty($user)) { //echo "hlo";die; $cleartext_password = rand(0, 9999); $model->password = md5($cleartext_password); if ($model->save()) { $signature = md5($model->email . $model->password); $subject = 'Welcome to Wow Cleans'; $body = $this->renderPartial('registrationEmail', array('model' => $model, 'password' => $cleartext_password, 'url' => $this->createAbsoluteUrl('../registration/login', array('email' => $model->email, 'signature' => $signature))), true); Yii::app()->mailer->send($model->email, $subject, $body); // booking detail for register customer here $custId = Yii::app()->db->getLastInsertID(); $transId = $result['TRANSACTIONID']; $cust = PaymentCustomerUser::model()->findByAttributes(array('id' => $custId)); $companyDetail = ServiceUser::model()->findByAttributes(array('id' => $_REQUEST['service_id'])); //echo "<pre>";print_r($companyDetail);die; // save address for customer in different table $address->address = $_REQUEST['PaymentCustomerUser']['caddress']; $address->zipcode = $_REQUEST['PaymentCustomerUser']['zipcode']; $address->date = date('Y-m-d'); $address->customer_id = $custId; $address->save(); $address_id = Yii::app()->db->getLastInsertID(); $re = CustomerAddress::model()->findByAttributes(array('customer_id' => $custId)); //echo "<pre>";print_r($re);die; $addressId = $re->id; $booking->customer_id = $custId; $booking->service_id = $_REQUEST['service_id']; $booking->service_type_id = $servicetype; //$booking->price =$_REQUEST['price']; $booking->price = $price; $booking->trans_id = $transId; $booking->date = date('Y-m-d'); if (!empty($address_id)) { $booking->customer_address_id = $address_id; } else { $booking->customer_address_id = $addressId; } $detail = Yii::app()->session['detail']; // echo "<pre>";print_r($detail);die; foreach ($detail['Cleaning'] as $type => $number) { $cleaningDetail .= $number . "-" . $type . ","; } $booking->cleaningDetail = substr($cleaningDetail, 0, -1); /*foreach($detail['Additional'] as $k=>$val) { if($val!=0) { $addnl .=$val."-".$k.","; } } */ foreach ($finalDetailadnl as $k => $val) { if ($val != 0) { $addnl .= $val . "-" . $k . ","; } } $booking->additional = substr($addnl, 0, -1); $booking->additional_details = $detail['AdditionalCustDetail']['AdditionalCustDetail']; if ($booking->save()) { //booking id for thaks page $insert_id = Yii::app()->db->getLastInsertID(); $cutId = Booking::model()->findByPk(array('id' => $insert_id)); $customerId = $cutId->customer_id; /*code to enter the company request details in company request table*/ $company->booking_id = $insert_id; $company->service_id = $_REQUEST['service_id']; $company->customer_id = $customerId; $company->cleaningtime = $ses['CleaningTime']['time']; $company->postcode = $ses['CleaningTime']['PostCode']; $company->cleaningdate = date("Y-m-d", strtotime($ses['CleaningTime']['CleaningDate'])); $company->date = date('Y-m-d'); $company->no_of_hours = $ses['CleaningTime']['noOfhour']; $company->no_of_cleaners = $ses['CleaningTime']['noOfCleaners']; $company->save(false); // echo $insert_id;die; // send mail to customer $subject = 'Welcome to Wow Cleans'; $body = $this->renderPartial('customerEmail', array('model' => $companyDetail, 'cust' => $_REQUEST, 'detail' => $detail, 'adnl' => $finalDetailadnl, 'price' => $price, 'trans' => $result['TRANSACTIONID']), true); Yii::app()->mailer->send($cust->email, $subject, $body); // send mail to company $subject = 'Welcome to Wow Cleans'; $body = $this->renderPartial('companyEmail', array('model' => $companyDetail, 'cust' => $_REQUEST, 'detail' => $detail, 'adnl' => $finalDetailadnl, 'price' => $price, 'trans' => $result['TRANSACTIONID']), true); Yii::app()->mailer->send($companyDetail->email, $subject, $body); //$this->refresh(); //$this->redirect(array('../registration/index')); } // booking detail for register customer ends here $link = CmsPages::model()->findAll(); Yii::app()->params['MyArray'] = $link; // $this->redirect('thanks','param1'=>$companyDetail); $this->redirect(array('payment/thanks', 'param1' => $insert_id)); //exit(); //$this->refresh(); //$this->redirect(array('registration/registration')); } } else { // echo "fsf";die; //$price =$_REQUEST['price']; $email = $_REQUEST['PaymentCustomerUser']['email']; $transId = $result['TRANSACTIONID']; $rec = PaymentCustomerUser::model()->findByAttributes(array('email' => $email)); //echo "<pre>";print_r($rec);die; $custId = $rec->id; $companyDetail = ServiceUser::model()->findByAttributes(array('id' => $_REQUEST['service_id'])); // save address for customer in different table $address->address = $_REQUEST['PaymentCustomerUser']['caddress']; $address->zipcode = $_REQUEST['PaymentCustomerUser']['zipcode']; $address->date = date('Y-m-d'); $address->customer_id = $custId; if (!($user = CustomerAddress::model()->exists('address=:address', array('address' => $_REQUEST['PaymentCustomerUser']['caddress'])))) { $address->save(); $address_id = Yii::app()->db->getLastInsertID(); } //$address_id = Yii::app()->db->getLastInsertID(); $re = CustomerAddress::model()->findByAttributes(array('customer_id' => $custId)); //echo "<pre>";print_r($rec->id);die; $addressId = $re->id; $booking->customer_id = $custId; $booking->service_id = $_REQUEST['service_id']; $booking->service_type_id = $servicetype; //$booking->price =$_REQUEST['price']; $booking->price = $price; $booking->trans_id = $transId; $booking->date = date('Y-m-d'); if (!empty($address_id)) { $booking->customer_address_id = $address_id; } else { $booking->customer_address_id = $addressId; } $detail = Yii::app()->session['detail']; // echo "<pre>";print_r($detail);die; foreach ($detail['Cleaning'] as $type => $number) { $cleaningDetail .= $number . "-" . $type . ","; } $booking->cleaningDetail = substr($cleaningDetail, 0, -1); //echo "<pre>";print_r($detail['Additional']);die; /*foreach($detail['Additional'] as $k=>$val) { if($val!=0) { $addnl .=$val."-".$k.","; } } */ foreach ($finalDetailadnl as $k => $val) { if ($val != 0) { $addnl .= $val . "-" . $k . ","; } } $booking->additional = substr($addnl, 0, -1); $booking->additional_details = $detail['AdditionalCustDetail']['AdditionalCustDetail']; if ($booking->save(false)) { $insert_id = Yii::app()->db->getLastInsertID(); $cutId = Booking::model()->findByPk(array('id' => $insert_id)); //echo "<pre>";print_r($cutId);die; $customerId = $cutId->customer_id; /*code to add the company request details in company request table*/ $company->booking_id = $insert_id; $company->service_id = $_REQUEST['service_id']; $company->customer_id = $customerId; $company->cleaningtime = $ses['CleaningTime']['time']; $company->postcode = $ses['CleaningTime']['PostCode']; $company->cleaningdate = date("Y-m-d", strtotime($ses['CleaningTime']['CleaningDate'])); $company->date = date('Y-m-d'); $company->no_of_hours = $ses['CleaningTime']['noOfhour']; $company->no_of_cleaners = $ses['CleaningTime']['noOfCleaners']; $company->save(false); // send mail to customer $subject = 'Welcome to Wow Cleans'; $body = $this->renderPartial('customerEmail', array('model' => $companyDetail, 'cust' => $_REQUEST, 'detail' => $detail, 'adnl' => $finalDetailadnl, 'price' => $price, 'trans' => $result['TRANSACTIONID']), true); Yii::app()->mailer->send($rec->email, $subject, $body); // send mail to company $subject = 'Welcome to Wow Cleans'; $body = $this->renderPartial('companyEmail', array('model' => $companyDetail, 'cust' => $_REQUEST, 'detail' => $detail, 'adnl' => $finalDetailadnl, 'price' => $price, 'trans' => $result['TRANSACTIONID']), true); Yii::app()->mailer->send($companyDetail->email, $subject, $body); //$this->refresh(); if ($logged != '') { //$this->redirect(array('../registration/customerdashboard')); $this->redirect(array('payment/thanks', 'param1' => $insert_id)); } else { $this->redirect(array('payment/thanks', 'param1' => $insert_id)); //$this->redirect(array('../registration/index')); } } //echo $servicetype; die; //echo "<pre>";print_r($rec);die; } } } Yii::app()->end(); } else { $errors = $model->getErrors(); // var_dump($errors); } } $links = CmsPages::model()->findAll(); Yii::app()->params['MyArray'] = $links; $this->render('index', array('model' => $model, 'town' => $rec, 'price' => $price, 'service_id' => $service_id, 'customerDetail' => $customerDetail)); }
echo "</div>"; echo "<div class='leftMsg appendmsg" . $d['id'] . "'>"; echo "<div class='time'>"; echo date('jS \\of F Y H:i:s', strtotime($d['date'])); echo "</div>"; echo "<div class='msg'>"; echo $d['msg']; echo "</div>"; echo "<div class='time'>"; //echo $d['date']; echo "</div>"; echo "</div>" . "</br>"; echo "<div class='clear'></div>"; } else { //$name=CustomerUser::model()->findByPk(array('id'=>$d['tomsg'])); $name2 = ServiceUser::model()->findByPk(array('id' => $d['user_id'])); echo "<input type='hidden' id='" . $d['conversation_id'] . "' class='append'>"; /*if(!empty($name)) { echo "<div class='rightname'>"; echo $name['cname']; echo "</div>"; }*/ /*else {*/ echo "<div class='rightname'>"; echo $name2['company_name']; echo "</div>"; //} echo "<div class='rightMsg appendmsg" . $d['id'] . "'>"; echo "<div class='time'>";
public function actionReplyticketfromProvider() { $model = new ConversationMsg(); $msg = new MsgDetails(); //$senderId =$_REQUEST['loggedId']; //$reciverId =$_REQUEST['receiverId']; $subject = $_REQUEST['subject']; $text = $_REQUEST['text']; $conversationID = $_REQUEST['conversionId']; $loggedId = Yii::app()->session['loggedId']; //$bookingId =$_REQUEST['replysectionBookingId']; //echo "<pre>";print_r($_REQUEST);die; if (!empty($_REQUEST)) { $name = ServiceUser::model()->findByPk(array('id' => $loggedId)); $custname = $name->company_name; $msg->conversation_id = $conversationID; $msg->user_type = 'company'; $msg->msg = $text; $msg->user_id = $loggedId; $msg->tomsg = 0; $msg->logged_id = $loggedId; //$date =date('Y-m-d'); //$msg->date =$date; $msg->booking_id = 0; $msg->save(false); $msgConverLastId = Yii::app()->db->getLastInsertID(); $re = MsgDetails::model()->findByPk(array('id' => $msgConverLastId)); echo "<div class='name'>"; echo $custname; echo "</div>"; echo "<div class='leftMsg appendmsg" . $re['id'] . "'>"; echo "<div class='time'>"; //echo $re['date']; echo date('jS \\of F Y H:i:s', strtotime($re['date'])); echo "</div>"; echo $re['msg']; echo "</div> "; //echo "success";die; } }
public function actionCustomerView($id) { $rec = CustomerUser::model()->with('bookings')->findByPk($id); $msgDetails = MsgDetails::model()->findAll(array('condition' => 'user_id=:user_id AND tomsg=:tomsg', 'group' => 'conversation_id', 'params' => array(':user_id' => $rec['id'], ':tomsg' => 0))); foreach ($msgDetails as $conId) { //echo $conId->conversation_id; $inboxDtal[] = MsgDetails::model()->findAll(array('condition' => 'conversation_id=:conversation_id AND inbox_dlt_status=:status', 'params' => array(':conversation_id' => $conId->conversation_id, ':status' => 0))); $companyName = ServiceUser::model()->findAll(array('condition' => 'id=:id', 'params' => array(':id' => $conId->user_id))); // echo "<pre>";print_r($companyName); } //echo "<pre>";print_r($inboxDtal);die; // echo "<pre>";print_r($rec['bookings']);die; $this->render('customerview', array('detail' => $rec, 'inbox' => $msgDetails, 'inboxDtal' => $inboxDtal)); }
public function actionDashboard() { //echo "<pre>";print_r($_SESSION);die; $rec = ServiceUser::model()->findAll(); /*foreach($rec as $re) { $name[]=$re['company_name']; } */ //echo "<pre>";print_r($name);die; //echo "<pre>";print_r(count($rec));die; $customer = CustomerUser::model()->findAll(); $this->render('dashboard', array('name' => $rec, 'customer' => $customer)); }
<section style="float:right;margin-bottom:2px;"><div><button class="reset">Create Message</button></div></section> </a> <table class="datatable"> <thead> <tr> <th>From</th> <th>Message</th> <th>Action</th> </tr> </thead> <tbody> <?php foreach ($list as $l) { if ($l->conversation['reciver_type'] == 'company') { $rec = ServiceUser::model()->findByAttributes(array('id' => $l->conversation['reciver_id'])); $name = $rec->company_name; } ?> <tr class="gradeX"> <td> <?php if ($l->user_type == 'admin') { echo "Me:"; } else { echo ucfirst($name); } ?> </td> <td><?php
public function actionCreateMessage() { $msg = new MsgDetails(); $model = new ConversationMsg(); if (isset($_POST['ConversationMsg']) && isset($_POST['MsgDetails'])) { $model->attributes = $_POST['ConversationMsg']; $msg->attributes = $_POST['MsgDetails']; if ($model->validate() || $msg->validate()) { $btn = $_REQUEST['btn']; if ($btn == 'company') { //echo "<pre>";print_r($_REQUEST); die; $email = $_REQUEST['ConversationMsg']['reciver_id']; //echo $email; $email = ltrim($email); $email = rtrim($email); $rec = ServiceUser::model()->findByAttributes(array('email' => $email)); //echo "fsfsf"."<pre>";print_r($rec);die; $companyRecvierId = $rec->id; //echo $companyRecvierId;die; $sender_id = Yii::app()->session['username']; $date = date('Y-m-d'); $model->date = $date; $model->sender_id = $sender_id; $model->sender_type = 'admin'; $model->reciver_id = $companyRecvierId; $model->reciver_type = 'company'; $model->save(false); $conversationId = Yii::app()->db->getLastInsertID(); $convMsg = ConversationMsg::model()->findByPk(array('id' => $conversationId)); //echo "<pre>";print_r($rec);die; $text = $_REQUEST['MsgDetails']['msg']; $msg->conversation_id = $conversationId; $msg->user_type = 'admin'; $msg->msg = $text; $msg->tomsg = $convMsg['reciver_id']; $date = date('Y-m-d'); $msg->date = $date; if ($msg->save(false)) { $this->redirect(array('messagelisting')); } } else { $email = $_REQUEST['ConversationMsg']['reciver_id']; //echo $email;die; $email = ltrim($email); $email = rtrim($email); $rec = CustomerUser::model()->findByAttributes(array('email' => $email)); //echo "fsfsf"."<pre>";print_r($rec);die; $companyRecvierId = $rec->id; //echo $companyRecvierId;die; $sender_id = Yii::app()->session['username']; // echo $sender_id;die; $date = date('Y-m-d'); $model->date = $date; $model->sender_id = $sender_id; $model->sender_type = 'admin'; $model->reciver_id = $companyRecvierId; $model->reciver_type = 'company'; $model->save(false); $conversationId = Yii::app()->db->getLastInsertID(); $convMsg = ConversationMsg::model()->findByPk(array('id' => $conversationId)); $text = $_REQUEST['MsgDetails']['msg']; $msg->conversation_id = $conversationId; $msg->user_type = 'admin'; $msg->msg = $text; $msg->tomsg = $convMsg['reciver_id']; $date = date('Y-m-d'); $msg->date = $date; if ($msg->save(false)) { $this->redirect(array('messagelisting')); } } } else { $errors = $model->getErrors(); //var_dump($errors); $err = $msg->getErrors(); //var_dump($err); } } $this->render('createmessage', array('model' => $model, 'msg' => $msg)); }
public function actionExport() { $re = ServiceUser::model()->with('priceAdmins')->findAll(); // echo "<pre>";print_r($re);die; foreach ($re as $res) { $compName = $res['company_name']; $email = $res['email']; $city = $res['city']; $phone = $res['phone']; $zip = $res['zipcode']; $company[] = array('Company Name' => $compName, 'Email Address' => $email, 'City' => $city, 'Phone' => $phone, 'Zip' => $zip); } //die; //echo "<pre>";print_r($val);die; $filename = "company.csv"; $csv = new ECSVExport($company); $content = $csv->toCSV(); Yii::app()->getRequest()->sendFile($filename, $content, "text/csv", false); exit; }
public function actionProviderEdit($id) { //ob_start(); Yii::app()->theme = 'back'; $model = new ServiceUser(); $detail = ServiceUser::model()->with('servicePrices')->findByPk(array('id' => $id)); if (isset($_POST['ServiceUser'])) { $model->attributes = $_POST['ServiceUser']; $rnd = rand(0, 9999); $uploadedFile = CUploadedFile::getInstance($model, 'company_logo'); $fileName = "{$rnd}-{$uploadedFile}"; // random number + file name //echo "<pre>";print_r($_FILES);die; if ($model->validate()) { $rec = ServiceUser::model()->with('servicePrices')->findByPk(array('id' => $id)); $cname = $_REQUEST['ServiceUser']['company_name']; $city = $_REQUEST['ServiceUser']['city']; $zip = $_REQUEST['ServiceUser']['zipcode']; $rec->company_name = $cname; $rec->city = $city; $rec->zipcode = $zip; if (is_uploaded_file($_FILES['ServiceUser']['tmp_name']['company_logo'])) { $rec->company_logo = $fileName; } if ($rec->save()) { if (is_uploaded_file($_FILES['ServiceUser']['tmp_name']['company_logo'])) { $uploadedFile->saveAs(Yii::app()->basePath . '/../CompanyLogo/' . $fileName); } $this->redirect(array('providerdetails')); } } else { $errors = $model->getErrors(); var_dump($errors); } } $this->render('provideredit', array('companyDetail' => $detail, 'model' => $model)); }
echo "</div>"; echo "<div class='leftMsg appendmsg" . $d['id'] . "'>"; echo "<div class='time'>"; echo date('jS \\of F Y H:i:s', strtotime($d['date'])); echo "</div>"; echo "<div class='msg'>"; echo $d['msg']; echo "</div>"; echo "<div class='time'>"; //echo $d['date']; echo "</div>"; echo "</div>" . "</br>"; echo "<div class='clear'></div>"; } else { $name = CustomerUser::model()->findByPk(array('id' => $d['tomsg'])); $name2 = ServiceUser::model()->findByPk(array('id' => $d['tomsg'])); echo "<input type='hidden' id='" . $d['conversation_id'] . "' class='append'>"; if (!empty($name)) { echo "<div class='rightname'>"; echo $name['cname']; echo "</div>"; } else { echo "<div class='rightname'>"; echo $name2['company_name']; echo "</div>"; } echo "<div class='rightMsg appendmsg" . $d['id'] . "'>"; echo "<div class='time'>"; echo date('jS \\of F Y H:i:s', strtotime($d['date'])); echo "</div>"; echo "<br>";