public function actionComplaintAdd()
 {
     if (Yii::app()->request->isPostRequest) {
         $model = Yii::app()->request->getPost('model');
         $external_id = Yii::app()->request->getPost('external_id');
         $store = $model::model()->findByPk($external_id);
         $profile = Yii::app()->user->getProfile();
         $Company = $profile->company;
         //            if ($Company->id == $store->user->company->id ) {
         //                throw new CHttpException(403);
         //            }
         $complaint = new Complaint();
         $complaint->from_company_id = $Company->id;
         $complaint->user_id = Yii::app()->user->id;
         $complaint->to_company_id = $store->user->company->id;
         $complaint->model = $model;
         $complaint->record_id = $external_id;
         if ($complaint->validate()) {
             $complaint->save();
             echo CJSON::encode(['status' => 'success', 'data' => '/cabinet/complaint/success']);
         } else {
             echo CJSON::encode(['status' => 'error', 'data' => print_r($complaint->getErrors(), true)]);
         }
     }
 }
 public function actionReadTopic($id)
 {
     $thread = Thread::model()->getThreadInfoById($id);
     $this->areaLarge = $thread['program_name'];
     $this->areaSmall = $thread['semester_name'];
     $reply = new Reply();
     $complaint = new Complaint('postComplaint');
     if (isset($_POST['Reply'])) {
         $reply->attributes = $_POST['Reply'];
         $reply->post_item_id = $id;
         if ($reply->save()) {
             Yii::app()->user->setFlash('success', Yii::t('forum', 'forum.view.reply.success'));
             $reply->unsetAttributes();
         } else {
             Yii::app()->user->setFlash('error', Yii::t('forum', 'forum.view.reply.error'));
         }
     }
     if (isset($_POST['Complaint'])) {
         $complaint->attributes = $_POST['Complaint'];
         if ($complaint->save()) {
             if ($complaint->post_item_id == $id) {
                 Yii::app()->user->setFlash('success', Yii::t('forum', 'forum.view.complaint.success'));
             } else {
                 Yii::app()->user->setFlash('success', Yii::t('forum', 'forum.view.complaint.success'));
             }
             $complaint->unsetAttributes();
         } else {
             Yii::app()->clientScript->registerScript('show_modal', "\$('#reportModal').modal('show');", CClientScript::POS_READY);
         }
     }
     $dataProvider = Thread::model()->getPostsDataInThread($id);
     Yii::log(CVarDumper::dumpAsString($dataProvider->getData()));
     $this->render('application.modules.community.views.front.post.view', array('thread' => $thread, 'threadId' => $id, 'dataProvider' => $dataProvider, 'reply' => $reply, 'complaint' => $complaint));
 }
 public function actionReadTopic($id)
 {
     $thread = Thread::model()->getThreadInfoById($id);
     $this->forumBreadcrumb = array('Programs' => array('forum/index'), $thread['program_name'] => array('forum/programView', 'programId' => $thread['program_id']), $thread['semester_name'] => array('forum/viewTopics', 'programId' => $thread['program_id'], 'semesterId' => $thread['semester_id']), $thread['title'] < Yii::app()->params['forum_max_crumb_length'] ? $thread['title'] : substr($thread['title'], 0, Yii::app()->params['forum_max_crumb_length']) . '...');
     $this->areaLarge = $thread['program_name'];
     $this->areaSmall = $thread['semester_name'];
     $reply = new Reply();
     $complaint = new Complaint('postComplaint');
     if (isset($_POST['Reply'])) {
         $reply->attributes = $_POST['Reply'];
         $reply->post_item_id = $id;
         if ($reply->save()) {
             Yii::app()->user->setFlash('success', Yii::t('forum', 'forum.view.reply.success'));
             $reply->unsetAttributes();
         } else {
             Yii::app()->user->setFlash('error', Yii::t('forum', 'forum.view.reply.error'));
         }
     }
     if (isset($_POST['Complaint'])) {
         $complaint->attributes = $_POST['Complaint'];
         if ($complaint->save()) {
             if ($complaint->post_item_id == $id) {
                 Yii::app()->user->setFlash('success', Yii::t('forum', 'forum.view.complaint.success'));
             } else {
                 Yii::app()->user->setFlash('success', Yii::t('forum', 'forum.view.complaint.success'));
             }
             $complaint->unsetAttributes();
         } else {
             Yii::app()->clientScript->registerScript('show_modal', "\$('#reportModal').modal('show');", CClientScript::POS_READY);
         }
     }
     $dataProvider = Thread::model()->getPostsDataInThread($id);
     Yii::log(CVarDumper::dumpAsString($dataProvider->getData()));
     $this->render('view', array('thread' => $thread, 'threadId' => $id, 'dataProvider' => $dataProvider, 'reply' => $reply, 'complaint' => $complaint));
 }
 public function adminSection()
 {
     $adminId = Session::get('admin_id');
     if (!isset($adminId)) {
         return Redirect::to('/');
     }
     $orderCount = Order::where('status', '=', 'pending')->count();
     $userCount = User::where('status', '=', 'active')->count();
     $softwareUserCount = SoftwareUser::where('status', '=', 'active')->count();
     $complaintCount = Complaint::whereIn('status', array('Complaint', 'Problem'))->count();
     return View::make('admin.admin-section')->with('orderCount', $orderCount)->with('userCount', $userCount)->with('complaintCount', $complaintCount)->with('softwareUserCount', $softwareUserCount);
 }
Exemple #5
0
 function __construct($tablename = 'qc_complaints')
 {
     // Register non-persistent attributes
     // Contruct the object
     parent::__construct($tablename);
     // Set specific characteristics
     // Define relationships
     // Define field formats
     // Define validation
     // Define enumerated types
     // Define system defaults
     $this->type = 'RR';
     $this->getField('type')->setDefault('RR');
 }
header("Content-Type:text/html;charset=utf-8");
require '../include/init.inc.php';
$arr = array('month', 'buss_name_detail');
$month = $buss_name_detail = "";
extract($_GET, EXTR_IF_EXISTS);
$user_info = UserSession::getSessionInfo();
$province_id = $user_info['province_id'] ? $user_info['province_id'] : $province_id;
$menus = MenuUrl::getMenuByIds($user_info['shortcuts']);
foreach ($arr as $key => $value) {
    if (${$value}) {
        $param[$value] = ${$value};
    }
}
$province = Info::getProvince();
// $start_date = $param['start_date'] = $_GET['start_date'] = $_GET['start_date']?$_GET['start_date']:date('Y-m');
$data['result'] = Complaint::getSingleDetail($buss_name_detail, $month);
foreach ($data['result'] as $key => $value) {
    $tmp['name'][(string) ($value['num'] + rand(1, 1000) / 1000)] = $province[$value['province_id']]['name'];
    $tmp['value'][] = $value['num'];
}
rsort($tmp['value']);
krsort($tmp['name']);
$data['name'] = '"' . implode('","', $tmp['name']) . '"';
$data['value'] = '"' . implode('","', $tmp['value']) . '"';
// if (Common::isPost ()) {
// if($start_date != '' && $end_date !=''){
$page_size = PAGE_SIZE;
$page_no = $page_no < 1 ? 1 : $page_no;
$start = ($page_no - 1) * $page_size;
// if($_GET['download']==1)
// {
    if (${$value}) {
        $param[$value] = ${$value};
    }
}
$start_date = $param['start_date'] = $_GET['start_date'] = $_GET['start_date'] ? $_GET['start_date'] : date('Y-m');
// if (Common::isPost ()) {
// if($start_date != '' && $end_date !=''){
$page_size = PAGE_SIZE;
$page_no = $page_no < 1 ? 1 : $page_no;
$start = ($page_no - 1) * $page_size;
if ($_GET['download'] == 1) {
    $data['result'] = Complaint::complaintsSearch($param, $start, 0);
} else {
    $data['result'] = Complaint::complaintsSearch($param, $start, $page_size);
}
$row_count = Complaint::complaintsSearchCount($param);
// }
$data['buss_class'] = Info::getProductType();
$data['province'] = Info::getProvince(false);
$data['complaintType'] = Info::getComplaintType('complaint_type', false);
$data['questionType'][1] = Info::getQuestionType(1, 'question_type', true);
$data['questionType'][2] = Info::getQuestionType(2, 'question_type', true);
$data['questionType'][3] = Info::getQuestionType(3, 'question_type', true);
$data['complaintLevel'] = Info::getComplaintLevel('complaint_level', false);
$data['bussType'] = Info::getBussLine('buss_type', true);
//导出excel下载
if ($_GET['download'] == 1) {
    $downloadStr = array_to_string($data);
    //var_dump($data);exit;
    Common::exportExcel($downloadStr, 'black_list');
    exit;
    $sortTmp[$key]['score'] = $tmp['value'][$key];
    $sortTmp[$key]['name'] = $value['class'];
}
if (isset($tmp['value']) && is_array($tmp['value'])) {
    array_multisort($tmp['value'], SORT_DESC, $tmp['typeName'], SORT_DESC, $sortTmp);
}
$tmpName = $tmpScore = array();
foreach ($sortTmp as $key => $value) {
    $tmpName[] = $value['name'];
    $tmpScore[] = $value['score'];
}
$total['cos'] = Complaint::getValueTotal(strtotime($start_date . "-01")) / 10000000;
// $total['cos'] = 1000;
$total['increase'] = $total['num'] - Complaint::getComplaintTotal(strtotime($start_date . "-01 -1 month"), $province_id);
$data['total'] = $total;
$row_count = Complaint::complaintsAnalayze2Count($param);
// $data['month'] = Complaint::baseAnalayzeMonth($param);
// $r = Complaint::complaintsAnalayzeType($param);
// var_dump($r);
// $data['provinces'] = implode(',',Complaint::complaintsAnalayzeType($param)['province']);
// $data['complaints'] = Complaint::complaintsAnalayzeType($param)['complaints'];
$province = Info::getProvince();
foreach ($province as $key => $value) {
    $data['provinceMap'][$key] = $value['name'];
}
if (isset($tmp['typeName'])) {
    $data['zhuString'] = '"' . implode('","', $tmpName) . '"';
    $data['zhuData'] = implode(',', $tmpScore);
}
$data['pie'] = json_encode($data['pie']);
// }
} else {
    if ($_GET['download'] == 1) {
        $data['result'] = Complaint::customSpAnalayze($param, $start, 0);
    } else {
        $data['result'] = Complaint::customSpAnalayze($param, $start, $page_size);
    }
    $row_count = Complaint::customSpAnalayzeNum($param);
}
$wan = array_slice($wanResult, 0, 20);
foreach ($wan as $key => $value) {
    $name[] = $value['name'];
    $score[] = sprintf("%.2f", $value['score']);
}
$data['wanName'] = $name ? '"' . implode('","', $name) . '"' : '';
$data['chartWan'] = $score ? '' . implode(',', $score) . '' : '';
$charData = Complaint::customSpAnalayze($param, 0, 20);
if ($charData) {
    foreach ($charData as $key => $value) {
        $tmp['name'][] = $value['part_name'];
        $tmp['value'][] = $value['num'];
        $tmp['wan'][] = $value['wan'];
    }
    $data['chartName'] = '"' . implode('","', $tmp['name']) . '"';
    $data['chartValue'] = implode(',', $tmp['value']);
    // $data['chartWan'] = implode(',', $tmp['wan']);
}
// $row_count = 20;
// $data['month'] = Complaint::customAnalayzeMonth($param);
// $data['provinces'] = Complaint::customAnalayzeArea($param);
$province = Info::getProvince();
foreach ($province as $key => $value) {
    foreach ($data['result'] as $key => $value) {
        // $total += $value['num'];
        $name = mb_substr($value['sp_name'], 0, 20);
        $tmp['name'][] = $name;
        $tmp['value'][] = $value['num'];
        $tmp['wan'][] = round($value['wan'], 2);
        $data['wanString'][(string) $value['wan']] = $name;
    }
    rsort($tmp['wan']);
    krsort($data['wanString']);
    $data['wanString'] = '"' . implode('","', $data['wanString']) . '"';
    $data['chartName'] = '"' . implode('","', $tmp['name']) . '"';
    $data['chartValue'] = implode(',', $tmp['value']);
    $data['chartWan'] = implode(',', $tmp['wan']);
}
$row_count = Complaint::baseSpAnalayzeCount($param);
if ($wan) {
    $row_count = count($data['result']);
}
// $data['month'] = Complaint::customAnalayzeMonth($param);
// $data['provinces'] = Complaint::customAnalayzeArea($param);
$province = Info::getProvince();
foreach ($province as $key => $value) {
    $data['provinceMap'][$key] = $value['name'];
}
$data['provinceString'] = '"' . implode('","', $data['provinceMap']) . '"';
// }
$data['total'] = $total;
$data['province'] = Info::getProvince(false);
$data['complaintType'] = Info::getComplaintType('complaint_type', false);
$data['questionType'][1] = Info::getQuestionType(1, 'question_type', true);
Exemple #11
0
        $param['complaint_level'] = $data['complaintLevel'][$param['complaint_level']];
    }
}
$start_date = $param['start_date'] = $_GET['start_date'] = $_GET['start_date'] ? $_GET['start_date'] : date('Y-m');
//var_dump($param);exit;
// if (Common::isPost ()) {
if ($start_date != '') {
    $page_size = PAGE_SIZE;
    $page_no = $page_no < 1 ? 1 : $page_no;
    $start = ($page_no - 1) * $page_size;
    if ($_GET['download'] == 1) {
        $data['result'] = Complaint::search($param, $start, 0);
    } else {
        $data['result'] = Complaint::search($param, $start, $page_size);
    }
    $row_count = Complaint::searchCount($param);
}
$data['province'] = Info::getProvince(false);
$data['bussLine'] = Info::getBussLine('buss_line', false);
//导出excel下载
if ($_GET['download'] == 1) {
    $downloadStr = array_to_string($data);
    Common::exportExcel($downloadStr, 'search');
    exit;
}
$page_html = Pagination::showPager("search.php?" . $http_query, $page_no, PAGE_SIZE, $row_count);
// $page_html=Pagination::showPager("search.php?class_name=$class_name&user_name=$user_name&start_date=$start_date&end_date=$end_date",$page_no,PAGE_SIZE,$row_count);
$export_excel = "search.php?download=1&" . $http_query;
Template::assign("error", $error);
Template::assign("_POST", $_POST);
Template::assign('_GET', $_GET);
 public function softwareUserComplaints($id)
 {
     if (isset($id)) {
         $softwareUser = SoftwareUser::find($id);
         if (isset($softwareUser)) {
             $complaints = Complaint::where('software_user_id', $id)->get();
             if (isset($complaints)) {
                 return json_encode(array('message' => 'found', 'complaints' => $complaints->toArray()));
             } else {
                 return json_encode(array('message' => 'empty'));
             }
         } else {
             return json_encode(array('message' => 'invalid'));
         }
     } else {
         return json_encode(array('message' => 'invalid'));
     }
 }
 private function deleteComplaint(\User $user)
 {
     $data = 'user_id = :user_id';
     $param = array(':user_id' => $user->id);
     if ($this->debug) {
         echo "    ... Complaint: del " . Complaint::model()->count($data, $param) . " \n";
     } else {
         Complaint::model()->deleteAll($data, $param);
     }
 }
    if (${$value}) {
        $param[$value] = ${$value};
    }
}
$start_date = $param['start_date'] = $_GET['start_date'] = $_GET['start_date'] ? $_GET['start_date'] : date('Y-m');
// if (Common::isPost ()) {
// if($start_date != '' && $end_date !=''){
$page_size = PAGE_SIZE;
$page_no = $page_no < 1 ? 1 : $page_no;
$start = ($page_no - 1) * $page_size;
if ($_GET['download'] == 1) {
    $data['result'] = Complaint::customAnalayze($param, $start, 0);
} else {
    $data['result'] = Complaint::customAnalayze($param, $start, $page_size);
}
$row_count = Complaint::customAnalayzeCount($param);
$param['flag'] = 1;
#$data['provinces'] = Complaint::customAnalayzeArea($param);
$province = Info::getProvince();
foreach ($province as $key => $value) {
    $data['provinces'][$value['id']]['name'] = $value['name'];
    $data['provinces'][$value['id']]['wan'] = 0;
    $data['provinceMap'][$key] = $value['name'];
}
foreach ($data['result'] as $key => $value) {
    $data['provinces'][$value['province_id']]['wan'] = $value['wan'];
}
foreach ($data['provinces'] as $key => $row) {
    $volume[$key] = $row['wan'];
    $edition[$key] = $row['name'];
}
    $data['result'] = Complaint::complaintsSpAnalayze($param, $start, 0);
} else {
    $data['result'] = Complaint::complaintsSpAnalayze($param, $start, $page_size);
}
if ($data['result']) {
    foreach ($data['result'] as $key => $value) {
        // var_dump($value);
        $tmp['name'][] = mb_substr(str_replace("\n", "", trim($value['sp_corp_name'])), 0, 18, 'utf-8');
        $tmp['value'][] = $value['num'];
        $tmp['wan'][] = $value['wan'];
    }
    $data['chartName'] = '"' . implode('","', $tmp['name']) . '"';
    $data['chartValue'] = implode(',', $tmp['value']);
    $data['chartWan'] = implode(',', $tmp['wan']);
}
$row_count = Complaint::complaintsSpAnalayzeCount($param);
// $data['month'] = Complaint::customAnalayzeMonth($param);
// $data['provinces'] = Complaint::customAnalayzeArea($param);
$province = Info::getProvince();
foreach ($province as $key => $value) {
    $data['provinceMap'][$key] = $value['name'];
}
$data['provinceString'] = '"' . implode('","', $data['provinceMap']) . '"';
// }
$data['province'] = Info::getProvince(false);
$data['complaintType'] = Info::getComplaintType('complaint_type', false);
$data['questionType'][1] = Info::getQuestionType(1, 'question_type', true);
$data['questionType'][2] = Info::getQuestionType(2, 'question_type', true);
$data['questionType'][3] = Info::getQuestionType(3, 'question_type', true);
$data['complaintLevel'] = Info::getComplaintLevel('complaint_level', false);
$data['bussLine'] = Info::getBussLine('buss_type', false);
Exemple #16
0
 static function getComplaintByCustomerId($customerId)
 {
     return Complaint::where('customer_id', '=', $customerId)->where('franchisee_id', '=', Session::get('franchiseId'))->get();
 }
 public function details($id)
 {
     if (Auth::check()) {
         $currentPage = "CUSTOMERS_LIST";
         $mainMenu = "CUSTOMERS_MAIN";
         $inputs = Input::all();
         if (isset($inputs['customerName'])) {
             if (Customers::addCustomers($inputs)) {
                 Session::flash('msg', "Customer added successfully.");
             } else {
                 Session::flash('warning', "Customer, Course Could not be added at the moment.");
             }
         }
         $customer = Customers::getCustomersById($id);
         $students = Students::getStudentByCustomer($id);
         $comments = Comments::getCommentByCustomerId($id);
         $provinces = Provinces::getProvinces("IN");
         $kidsSelect = Students::getStudentsForSelectBox($id);
         $membershipTypes = MembershipTypes::getMembershipTypesForSelectBox();
         $birthdays = BirthdayParties::getBirthdaysByCustomer($id);
         //return $customer;
         //Membership
         if (isset($inputs['membershipTypesMembersDiv'])) {
             /* echo '<pre>';
             			print_r($inputs);
             			echo '</pre>';
             			exit(); */
             if ($inputs['membershipTypesMembersDiv'] != "") {
                 $membershipInput['customer_id'] = $id;
                 $membershipInput['membership_type_id'] = $inputs['membershipTypesMembersDiv'];
                 CustomerMembership::addMembership($membershipInput);
                 $order['customer_id'] = $id;
                 $order['payment_for'] = "membership";
                 $order['payment_dues_id'] = '';
                 $order['payment_mode'] = $inputs['paymentTypeRadio'];
                 $order['card_last_digit'] = $inputs['card4digits'];
                 $order['card_type'] = $inputs['cardType'];
                 $order['bank_name'] = $inputs['bankName'];
                 $order['cheque_number'] = $inputs['chequeNumber'];
                 $order['amount'] = $inputs['membershipPrice'];
                 $order['order_status'] = "completed";
                 Orders::createOrder($order);
             }
         }
         //$customerMembership = "";
         /* echo '<pre>';
         			print_r($customer);
         			echo '</pre>';
         			exit(); */
         $presentDate = Carbon::now();
         $membershipStartDate = Carbon::now();
         $membershipEndDate = Carbon::now();
         $customerMembershipId = '';
         if (isset($customer->CustomerMembership['0'])) {
             $select = count($customer->CustomerMembership) - 1;
             $membershipStartDate = $membershipStartDate->createFromFormat('Y-m-d', $customer->CustomerMembership[$select]->membership_start_date);
             $membershipEndDate = $membershipEndDate->createFromFormat('Y-m-d', $customer->CustomerMembership[$select]->membership_end_date);
             if ($membershipStartDate->lte($presentDate) && $membershipEndDate->gte($presentDate)) {
                 $customerMembershipId = $customer->CustomerMembership[$select]->membership_type_id;
             }
         }
         if (isset($customerMembershipId)) {
             $customerMembership = MembershipTypes::getMembershipTypeByID($customerMembershipId);
         }
         $membershipTypesAll = MembershipTypes::getMembershipTypes();
         $birthdaypaiddata = Orders::getBirthdayfulldata($id);
         for ($i = 0; $i < count($birthdaypaiddata); $i++) {
             $studentData = Students::getStudentById($birthdaypaiddata[$i]['student_id']);
             $birthdaypaiddata[$i]['student_name'] = $studentData[0]['student_name'];
             $birthdaypaiddata[$i]['student_date_of_birth'] = $studentData[0]['student_date_of_birth'];
             $birthdayData = BirthdayParties::getBirthdaybyId($birthdaypaiddata[$i]['birthday_id']);
             $birthdaypaiddata[$i]['birthday_party_date'] = $birthdayData[0]['birthday_party_date'];
             $birthdaypaiddata[$i]['tax_amount'] = $birthdaypaiddata[0]['tax_amount'];
             $user_data = User::getUsersByUserId($birthdaypaiddata[$i]['created_by']);
             $birthdaypaiddata[$i]['name'] = $user_data[0]['first_name'] . $user_data[0]['last_name'];
             $birthdaypaiddata[$i]['encrypted_id'] = Crypt::encrypt($birthdaypaiddata[$i]['id']);
         }
         $birthdayDuedata = PaymentDues::getPaymentpendingfulldata($id);
         for ($i = 0; $i < count($birthdayDuedata); $i++) {
             $studentData = Students::getStudentById($birthdayDuedata[$i]['student_id']);
             $birthdayDuedata[$i]['student_name'] = $studentData[0]['student_name'];
             $user_data = User::getUsersByUserId($birthdayDuedata[$i]['created_by']);
             $birthdayDuedata[$i]['name'] = $user_data[0]['first_name'] . $user_data[0]['last_name'];
             $birthdayData = BirthdayParties::getBirthdaybyId($birthdayDuedata[$i]['birthday_id']);
             $birthdayDuedata[$i]['birthday_party_date'] = $birthdayData[0]['birthday_party_date'];
         }
         //followup_data
         $iv_data = IntroVisit::where('customer_id', '=', $id)->get();
         for ($i = 0; $i < count($iv_data); $i++) {
             $comments_data = Comments::where('introvisit_id', '=', $iv_data[$i]['id'])->orderBy('id', 'DESC')->first();
             $iv_data[$i]['comment_data'] = $comments_data;
             $student = Students::find($iv_data[$i]['student_id']);
             $iv_data[$i]['student_name'] = $student['student_name'];
             $iv_data[$i]['iv_date'] = date("Y-m-d", strtotime($iv_data[$i]['iv_date']));
         }
         $birthday_data = BirthdayParties::where('customer_id', '=', $id)->get();
         for ($i = 0; $i < count($birthday_data); $i++) {
             $birthday_comments = Comments::where('birthday_id', '=', $birthday_data[$i]['id'])->orderBy('id', 'DESC')->first();
             $birthday_data[$i]['comment_data'] = $birthday_comments;
             $student_data = Students::find($birthday_data[$i]['student_id']);
             $birthday_data[$i]['student_name'] = $student_data['student_name'];
             $birthday_data[$i]['birthday_party_date'] = date("Y-m-d", strtotime($birthday_data[$i]['birthday_party_date']));
         }
         //for complaints
         $complaint_data = Complaint::getComplaintByCustomerId($id);
         //Comments::where('customer_id','=',$id)->get();
         for ($i = 0; $i < count($complaint_data); $i++) {
             $complaint_data[$i]['comments'] = Comments::where('complaint_id', '=', $complaint_data[$i]['id'])->orderBy('id', 'DESC')->first();
             $student_data = Students::find($complaint_data[$i]['student_id']);
             $complaint_data[$i]['student_name'] = $student_data['student_name'];
         }
         //for retention
         $retention_data = Retention::getRetentionByCustomerId($id);
         for ($i = 0; $i < count($retention_data); $i++) {
             $retention_data[$i]['comments'] = Comments::where('retention_id', '=', $retention_data[$i]['id'])->orderBy('id', 'DESC')->first();
             $student_data = Students::find($retention_data[$i]['student_id']);
             $retention_data[$i]['student_name'] = $student_data['student_name'];
         }
         //for inquiry
         $inuiry_data = Inquiry::getInquiryByCustomerId($id);
         for ($i = 0; $i < count($inuiry_data); $i++) {
             $inuiry_data[$i]['comments'] = Comments::where('inquiry_id', '=', $inuiry_data[$i]['id'])->orderBy('id', 'DESC')->first();
         }
         //for enrollment payment followup/brush up calls
         $enrollmentFollowupData = PaymentFollowups::getPaymentFollowupByCustomerId($id);
         for ($i = 0; $i < count($enrollmentFollowupData); $i++) {
             $enrollmentFollowupData[$i]['comments'] = Comments::where('paymentfollowup_id', '=', $enrollmentFollowupData[$i]['id'])->orderBy('id', 'DESC')->first();
             $student_data = Students::find($enrollmentFollowupData[$i]['student_id']);
             $enrollmentFollowupData[$i]['student_name'] = $student_data['student_name'];
             $paymentDueData = PaymentDues::find($enrollmentFollowupData[$i]['payment_due_id']);
             $enrollmentFollowupData[$i]['payment_date'] = $paymentDueData['end_order_date'];
         }
         // for customer kids enrollment.
         $customer_student_data = Students::where('customer_id', '=', $id)->where('franchisee_id', '=', Session::get('franchiseId'))->select('id', 'student_name')->get();
         for ($i = 0; $i < count($customer_student_data); $i++) {
             $student_classes = StudentClasses::getEnrolledStudentBatch($customer_student_data[$i]['id']);
             //return $student_classes[0]['batch_id'];
             $customer_student_data[$i]['student_classes_data'] = $student_classes;
         }
         //return $customer_student_data;
         for ($i = 0; $i < count($customer_student_data); $i++) {
             for ($j = 0; $j < count($customer_student_data[$i]['student_classes_data']); $j++) {
                 $find = Batches::find($customer_student_data[$i]['student_classes_data'][$j]['batch_id']);
                 $customer_student_data[$i]['student_classes_data'][$j]['batch_name'] = $find->batch_name;
             }
         }
         //return the customer membership follolwup
         $customer_membership_data = MembershipFollowup::where('customer_id', '=', $id)->get();
         for ($i = 0; $i < count($customer_membership_data); $i++) {
             $membershipid[$i] = $customer_membership_data[$i]['id'];
         }
         if (isset($membershipid)) {
             for ($i = 0; $i < count($membershipid); $i++) {
                 $membership_followup_data[$i] = Comments::where('membership_followup_id', '=', $membershipid[$i])->orderBy('id', 'DESC')->first();
                 $memfollowup_data = MembershipFollowup::find($membershipid[$i]);
                 $Customer_membership_data = CustomerMembership::find($memfollowup_data->membership_id);
                 $membership_followup_data[$i]['membership_end_date'] = $Customer_membership_data->membership_end_date;
             }
         }
         $viewData = array('birthdaypaiddata', 'birthdayDuedata', 'customer', 'students', 'currentPage', 'mainMenu', 'comments', 'provinces', 'customerMembership', 'kidsSelect', 'membershipTypes', 'membershipTypesAll', 'birthdays', 'iv_data', 'birthday_data', 'complaint_data', 'retention_data', 'inuiry_data', 'enrollmentFollowupData', 'customer_student_data', 'membership_followup_data');
         return View::make('pages.customers.details', compact($viewData));
     } else {
         return Redirect::to("/");
     }
 }
 public function createFollowup()
 {
     $inputs = Input::all();
     if ($inputs['followupType'] == 'COMPLAINTS') {
         $createComplaint = Complaint::createComplaint($inputs);
         $input['complaint_id'] = $createComplaint->id;
     } else {
         if ($inputs['followupType'] == 'RETENTION') {
             $createRetention = Retention::createRetention($inputs);
             $input['retention_id'] = $createRetention->id;
         } else {
             if ($inputs['followupType'] == 'INQUIRY') {
                 $createInquiry = Inquiry::createInquiry($inputs);
                 $input['inquiry_id'] = $createInquiry->id;
             }
         }
     }
     //create comment
     if (isset($createComplaint)) {
         $input['customerId'] = $inputs['customer_id'];
         $input['student_id'] = $inputs['student_id'];
         $input['followupType'] = $inputs['followupType'];
         $input['commentStatus'] = $inputs['followupstatus'];
         $input['commentText'] = $inputs['otherCommentTxtarea'];
         $input['commentType'] = $inputs['comment_type'];
         $input['reminderDate'] = $inputs['remindDate'];
         $comments_data = Comments::addComments($input);
     }
     if (isset($createRetention)) {
         $input['customerId'] = $inputs['customer_id'];
         $input['student_id'] = $inputs['student_id'];
         $input['followupType'] = $inputs['followupType'];
         $input['commentStatus'] = $inputs['followupstatus'];
         $input['commentText'] = $inputs['otherCommentTxtarea'];
         $input['commentType'] = $inputs['comment_type'];
         $input['reminderDate'] = $inputs['remindDate'];
         $comments_data = Comments::addComments($input);
     }
     if (isset($createInquiry)) {
         $input['customerId'] = $inputs['customer_id'];
         $input['followupType'] = $inputs['followupType'];
         $input['commentStatus'] = $inputs['followupstatus'];
         $input['commentText'] = $inputs['otherCommentTxtarea'];
         $input['commentType'] = $inputs['comment_type'];
         $input['reminderDate'] = $inputs['remindDate'];
         $comments_data = Comments::addComments($input);
     }
     if ($comments_data) {
         return Response::json(array('status' => 'success'));
     } else {
         return Response::json(array('status' => 'failure'));
     }
 }
    $http_query .= $value . '=' . ${$value} . '&';
    if (${$value}) {
        $param[$value] = ${$value};
    }
}
// if (Common::isPost ()) {
// if($start_date != '' && $end_date !=''){
$page_size = PAGE_SIZE;
$page_no = $page_no < 1 ? 1 : $page_no;
$start = ($page_no - 1) * $page_size;
if ($_GET['download'] == 1) {
    $data['result'] = Complaint::getBlackList($param, $start, 0);
} else {
    $data['result'] = Complaint::getBlackList($param, $start, $page_size);
}
$row_count = Complaint::getBlackListCount($param);
// }
$data['province'] = Info::getProvince(false);
$data['complaintType'] = Info::getComplaintType('complaint_type', false);
$data['questionType'][1] = Info::getQuestionType(1, 'question_type', true);
$data['questionType'][2] = Info::getQuestionType(2, 'question_type', true);
$data['questionType'][3] = Info::getQuestionType(3, 'question_type', true);
$data['complaintLevel'] = Info::getComplaintLevel('complaint_level', false);
$data['bussLine'] = Info::getBussLine('buss_type', false);
// var_dump($data['bussLine']);
//导出excel下载
if ($_GET['download'] == 1) {
    $downloadStr = array_to_string($data);
    //var_dump($data);exit;
    Common::exportExcel($downloadStr, 'black_list');
    exit;
//init code
$routes = BusRoute::find_all();
$stops = BusStop::find_all();
$buses = Bus::find_all();
$bus_personnel = BusPersonnel::find_all();
$complaint_types = ComplaintType::find_all();
$complaint_status = ComplaintStatus::find_all();
//check login
if ($session->is_logged_in()) {
    if ($session->object_type == 6) {
        //commuter
        $user = $commuter_object->find_by_id($_SESSION['id']);
        $profile_picture = $photo_object->get_profile_picture(6, $user->id);
        if (isset($_POST['submit'])) {
            $complaint_to_create = new Complaint();
            $complaint_to_create->bus_route_id = $_POST['bus_route_id'];
            $complaint_to_create->stop_id = $_POST['stop_id'];
            $complaint_to_create->bus_id = $_POST['bus_id'];
            $complaint_to_create->bus_personnel_id = $_POST['bus_personnel_id'];
            $complaint_to_create->complaint_type = $_POST['complaint_type'];
            $complaint_to_create->status = $_POST['status'];
            $complaint_to_create->content = $_POST['content'];
            if (isset($_POST['bus_route_id'])) {
                $complaint_to_create->related_object_type = 1;
                $complaint_to_create->related_object_id = $_POST['bus_route_id'];
            } else {
                if (isset($_POST['stop_id'])) {
                    $complaint_to_create->related_object_type = 2;
                    $complaint_to_create->related_object_id = $_POST['stop_id'];
                } else {
 public function save()
 {
     $type = (string) Input::get('type');
     if (!in_array($type, array('mismatch', 'spam', 'flood', 'rude', 'obscene'))) {
         return $this->respondWithError('Set incorrect complaint type');
     }
     $complaint = new Complaint();
     $complaint->owner_id = Auth::user()->id;
     $complaint->type = $type;
     if (Input::has('post_id')) {
         $post = Post::find((int) Input::get('post_id'));
         if (!$post) {
             return $this->respondWithError('Post isn\'t found');
         } else {
             if ($post->user_id == Auth::user()->id) {
                 return $this->respondWithError('Can\'t complain to your post');
             }
         }
         if (Complaint::where('owner_id', Auth::user()->id)->where('post_id', $post->id)->first()) {
             return $this->respondNoContent();
         }
         $complaint->post_id = $post->id;
     } else {
         if (Input::has('user_id')) {
             $user = User::find((int) Input::get('user_id'));
             if (!$user) {
                 return $this->respondWithError('User isn\'t found');
             } else {
                 if ($user->id == Auth::user()->id) {
                     return $this->respondWithError('Can\'t complain to your profile');
                 }
             }
             if (Complaint::where('owner_id', Auth::user()->id)->where('user_id', $user->id)->first()) {
                 return $this->respondNoContent();
             }
             $complaint->user_id = $user->id;
         } else {
             if (Input::has('comment_id')) {
                 $comment = Comment::find((int) Input::get('comment_id'));
                 if (!$comment) {
                     return $this->respondWithError('Comment isn\'t found');
                 } else {
                     if ($comment->user_id == Auth::user()->id) {
                         return $this->respondWithError('Can\'t complain to your comment');
                     }
                 }
                 if (Complaint::where('owner_id', Auth::user()->id)->where('comment_id', $comment->id)->first()) {
                     return $this->respondNoContent();
                 }
                 $complaint->comment_id = $comment->id;
             } elseif (Input::has('emergency_id')) {
                 $emergency = Emergency::find(Input::get('emergency_id'));
                 if (!$emergency) {
                     return $this->respondNotFound('Emergency not found');
                 }
                 if ($emergency->receiver != Auth::id()) {
                     return $this->respondInsufficientPrivileges('This emergency is not for you to complain');
                 }
                 $emergency->complained_at = Carbon::now();
                 $emergency->save();
                 $emergency->getMembersTokens()->each(function ($token) use($emergency) {
                     $state = new StateSender($token->auth_token);
                     $state->setEmergencyAsComplained($emergency->id, $emergency->complained_at);
                 });
                 return $this->respondNoContent();
             }
         }
     }
     $complaint->save();
     return $this->respondNoContent();
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Complaint the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Complaint::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
<?php

header("Content-Type:text/html;charset=utf-8");
require '../include/init.inc.php';
$arr = array('month', 'sp_corp_code');
$month = $sp_corp_code = "";
extract($_GET, EXTR_IF_EXISTS);
$user_info = UserSession::getSessionInfo();
$menus = MenuUrl::getMenuByIds($user_info['shortcuts']);
foreach ($arr as $key => $value) {
    if (${$value}) {
        $param[$value] = ${$value};
    }
}
// $start_date = $param['start_date'] = $_GET['start_date'] = $_GET['start_date']?$_GET['start_date']:date('Y-m');
$data['result'] = Complaint::getCustomSpDetail($sp_corp_code, $month);
// if (Common::isPost ()) {
// if($start_date != '' && $end_date !=''){
$page_size = PAGE_SIZE;
$page_no = $page_no < 1 ? 1 : $page_no;
$start = ($page_no - 1) * $page_size;
// if($_GET['download']==1)
// {
// 	$data['result'] = Complaint::baseSpAnalayze($param,$start,0);
// }
// else
// {
// 	$data['result'] = Complaint::baseSpAnalayze($param,$start,$page_size);
// }
// $total = Complaint::getProMonthTotal($province_id,$start_date);
$province = Info::getProvince();
    if (${$value}) {
        $param[$value] = ${$value};
    }
}
$start_date = $param['month'] = $_GET['month'] = $_GET['month'] ? $_GET['month'] : date('Y-m');
// if (Common::isPost ()) {
// if($start_date != '' && $end_date !=''){
$page_size = PAGE_SIZE;
$page_no = $page_no < 1 ? 1 : $page_no;
$start = ($page_no - 1) * $page_size;
if ($_GET['download'] == 1) {
    $data['result'] = Complaint::customSearch($param, $start, 0);
} else {
    $data['result'] = Complaint::customSearch($param, $start, $page_size);
}
$row_count = Complaint::customSearchCount($param);
// }
$data['province'] = Info::getProvince(false);
$data['complaintType'] = Info::getComplaintType('complaint_type', false);
$data['questionType'][1] = Info::getQuestionType(1, 'question_type', true);
$data['questionType'][2] = Info::getQuestionType(2, 'question_type', true);
$data['questionType'][3] = Info::getQuestionType(3, 'question_type', true);
$data['complaintLevel'] = Info::getComplaintLevel('complaint_level', false);
$data['bussLine'] = Info::getBussLine('buss_type', false);
//导出excel下载
if ($_GET['download'] == 1) {
    $downloadStr = array_to_string($data);
    //var_dump($data);exit;
    Common::exportExcel($downloadStr, 'black_list');
    exit;
}
        if ($value['buss_name'] == '') {
            unset($data['result'][$key]);
            // var_dump(current($data['result']));
            // if($key == 0){
            // 	$data['result'][0] = current($data['result']);
            // }
            continue;
        }
        $tmp['name'][] = $value['buss_name'];
        $tmp['value'][] = $value['num'];
    }
    $data['chartName'] = '"' . implode('","', $tmp['name']) . '"';
    $data['chartValue'] = implode(',', $tmp['value']);
}
// rsort($tmp['wan']);
$row_count = Complaint::customSingleCount($param);
// $data['month'] = Complaint::customAnalayzeMonth($param);
// $data['provinces'] = Complaint::customAnalayzeArea($param);
$province = Info::getProvince();
foreach ($province as $key => $value) {
    $data['provinceMap'][$key] = $value['name'];
}
$data['provinceString'] = '"' . implode('","', $data['provinceMap']) . '"';
// }
$data['province'] = Info::getProvince(false);
$data['complaintType'] = Info::getComplaintType('complaint_type', false);
$data['questionType'][1] = Info::getQuestionType(1, 'question_type', true);
$data['questionType'][2] = Info::getQuestionType(2, 'question_type', true);
$data['questionType'][3] = Info::getQuestionType(3, 'question_type', true);
$data['complaintLevel'] = Info::getComplaintLevel('complaint_level', false);
$data['bussLine'] = Info::getBussLine('buss_type', false);
Exemple #26
0
foreach ($arr as $key => $value) {
    $http_query .= $value . '=' . ${$value} . '&';
    if (${$value}) {
        $param[$value] = ${$value};
    }
}
$page_size = PAGE_SIZE;
//$page_no=$page_no<1?1:$page_no;
$page_no = !isset($_GET['page_no']) || intval($_GET['page_no']) < 1 ? 1 : intval($_GET['page_no']);
$start = ($page_no - 1) * $page_size;
if ($_GET['download'] == 1) {
    $data['result'] = Complaint::getUnicomBusinessWithSpList($param, $start, 0);
} else {
    $data['result'] = Complaint::getUnicomBusinessWithSpList($param, $start, $page_size);
}
$row_count = Complaint::getUnicomBusinessWithSpListCount($param);
$row_count = isset($row_count[0]['c']) ? $row_count[0]['c'] : 0;
//导出excel下载
if ($_GET['download'] == 1) {
    $downloadStr = array_to_string($data);
    //var_dump($data);exit;
    Common::exportExcel($downloadStr, 'unicom_business_list_with_sp');
    exit;
}
$page_html = Pagination::showPager("sp_search.php?" . $http_query, $page_no, PAGE_SIZE, $row_count);
$export_excel = "sp_search.php?download=1&" . $http_query;
// $page_html=Pagination::showPager("black_list.php?class_name=$class_name&user_name=$user_name&start_date=$start_date&end_date=$end_date",$page_no,PAGE_SIZE,$row_count);
Template::assign("error", $error);
Template::assign("_POST", $_POST);
Template::assign('_GET', $_GET);
Template::assign("data", $data);
Exemple #27
0
<?php

ob_start();
include "../includes/tellsafe.inc";
session_start();
if (!isset($_SESSION[user])) {
    error_log("Attempting to access complaint page without signing in.", 0);
    header("Location: signin.php");
    exit;
}
$u = new Contact($_SESSION[user]);
$c = new Complaint($_GET[c]);
if ($u->company != $c->company) {
    CriticalError("Invalid Complaint: User[{$_SESSION['user']}] Complaint[{$_GET['c']}]");
}
if (isset($_POST[confirm])) {
    if ($u->name != "Guest Account") {
        $c->ConfirmReceipt($u->id);
    }
    header("Location: members.php");
    exit;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>TellSafe - Review Complaint</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<?php 
include "../includes/header.inc";
?>
Exemple #28
0
<?php

include "../includes/tellsafe.inc";
$m = new Complaint($_GET[m]);
$c = new Company($m->company);
if ($_GET[cmd] == "delete") {
    $m->Delete();
    header("Location: company.php?c=" . $c->id . "&");
    exit;
}
?>

<?php 
include "adminheader.inc";
?>

<TABLE BORDER=1 CELLSPACING=1 CELLPADDING=10 style="background-color=#006699; width:100%">

<TR style="background-color=#f5f5f5"><TD>
  <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 style="width:100%">
  <tr><td>
     <TABLE BORDER=0 CELLSPACING=2 CELLPADDING=0>
     <tr><td><a href="admin.php">Administration</a></td></tr>
     <tr><td><a href="companylist.php">View Company List</a></td></tr>
     <tr><td><a href="company.php?c=<?php 
print $c->id;
?>
&"><?php 
print k($c->name);
?>
</a></td></tr>
} else {
    $data['result'] = Complaint::complaintsAnalayze($param, $start, $page_size);
    foreach ($data['result'] as $key => $value) {
        $total['num'] += $value['num'];
        $total['cos'] += $value['cos'];
        $total['wan'] += $value['wan'];
        $total['month'] = date('Y-m', $value['month']);
    }
}
$total['increase'] = $total['num'] - Complaint::getComplaintTotal(strtotime($start_date . "-01 -1 month"), $province_id);
$data['total'] = $total;
$row_count = Complaint::customAnalayzeCount($param);
$data['month'] = Complaint::complaintsAnalayzeMonth($param);
// $data['provinces'] = implode(',',Complaint::complaintsAnalayzeProvince($param)['province']);
// $data['complaints'] = implode(',',Complaint::complaintsAnalayzeProvince($param)['complaints']);
$tmp = Complaint::complaintsAnalayzeProvince($param);
$provincesData = $tmp['province'];
$complaintsData = $tmp['complaints'];
$province = Info::getProvince();
foreach ($province as $key => $value) {
    $data['provinceMap'][$key] = $value['name'];
    $province[$key] = $data['provinces'][$key]['name'] = $data['complaints'][$key]['name'] = $value['name'];
    $data['provinces'][$key]['score'] = $provincesData[$key];
    $data['complaints'][$key]['score'] = $complaintsData[$key];
    // $data['provinces']['name'] = $provincesData[$key];
}
array_multisort($provincesData, SORT_DESC, $province, SORT_ASC, $data['provinces']);
array_multisort($complaintsData, SORT_DESC, $province, SORT_ASC, $data['complaints']);
$proName = $proScore = array();
foreach ($data['provinces'] as $key => $value) {
    if (!$value['name'] || $value['score'] == 0) {
<?php

require '../include/init.inc.php';
$method = $id = $keywords = '';
extract($_REQUEST, EXTR_IF_EXISTS);
if ($method == 'update' && $id > 0) {
    $complaints_type = Complaint::getComplaintsTypeById($id);
    if (empty($complaints_type)) {
        echo -1;
        exit;
    }
    if (Common::isPost()) {
        $update_data = array('keywords' => $keywords, 'update_time' => date('Y-m-d H:i:s', time()));
        $result = Complaint::updateComplaintsTypeKeywords($id, $update_data);
        if ($result >= 0) {
            SysLog::addLog(UserSession::getUserName(), 'MODIFY', 'ComplaintsTypeKeywords', $id, json_encode($update_data));
            echo 1;
            exit;
            //Common::exitWithSuccess ( '投诉分级关键词修改完成','complaints/complaints_type_manage.php' );
        } else {
            echo -2;
            exit;
        }
    }
}
$complaints_types = Complaint::getAllComplaintsType();
Template::assign('complaints_types', $complaints_types);
Template::display('complaint/complaints_type_manage.tpl');