public function actionFeedback() { $content = zmf::val('content', 1); if (!$content) { $this->jsonOutPut(0, '内容不能为空哦~'); } //一个小时内最多只能反馈5条 if (zmf::actionLimit('feedback', '', 5, 3600)) { $this->jsonOutPut(0, '操作太频繁,请稍后再试'); } $attr['uid'] = $this->uid; $attr['type'] = 'web'; $attr['contact'] = zmf::val('email', 1); $attr['appinfo'] = zmf::val('url', 1); $attr['sysinfo'] = Yii::app()->request->userAgent; $attr['content'] = $content; $model = new Feedback(); $model->attributes = $attr; if ($model->validate()) { if ($model->save()) { $this->jsonOutPut(1, '感谢您的反馈'); } else { $this->jsonOutPut(1, '感谢您的反馈'); } } else { $this->jsonOutPut(0, '反馈失败,请重试'); } }
public function actionFeedback() { $form = new FeedbackForm('insert'); $formName = get_class($form); $this->performAjaxValidation($form); // проверить не передан ли тип и присвоить его аттрибуту модели $module = Yii::app()->getModule('feedback'); if (Yii::app()->getRequest()->getIsPostRequest() && !empty($_POST[$formName])) { $form->setAttributes(Yii::app()->getRequest()->getPost($formName)); if ($form->validate()) { // обработка запроса $feedback = new Feedback(); $feedback->setAttributes($form->getAttributes()); if ($feedback->save()) { Yii::app()->eventManager->fire(FeedbackEvents::SUCCESS_SEND_MESSAGE, new SendFeedbackMessageEvent($feedback)); if (Yii::app()->getRequest()->getIsAjaxRequest()) { Yii::app()->ajax->success(Yii::t('FeedbackModule.feedback', 'Your message sent! Thanks!')); } Yii::app()->getUser()->setFlash(YFlashMessages::SUCCESS_MESSAGE, Yii::t('FeedbackModule.feedback', 'Your message sent! Thanks!')); $this->redirect($module->successPage ? [$module->successPage] : ['/feedback/contact/index/']); } else { if (Yii::app()->getRequest()->getIsAjaxRequest()) { Yii::app()->ajax->failure(Yii::t('FeedbackModule.feedback', 'It is not possible to send message!')); } Yii::app()->user->setFlash(YFlashMessages::ERROR_MESSAGE, Yii::t('FeedbackModule.feedback', 'It is not possible to send message!')); } } else { if (Yii::app()->getRequest()->getIsAjaxRequest()) { Yii::app()->ajax->rawText(CActiveForm::validate($form)); } } } $this->render('index', ['model' => $form, 'module' => $module]); }
public function add_feedback() { $type = Input::get('type'); $title = Input::get('title'); $content = Input::get('content'); if (!isset($type)) { return Response::json(array('errCode' => 1, 'message' => '请选者反馈类型')); } if (!isset($title)) { return Response::json(array('errCode' => 2, 'message' => '请输入标题')); } if (!isset($content)) { return Response::json(array('errCode' => 3, 'message' => '请输入内容')); } $feedback = new Feedback(); $feedback->user_id = Sentry::getUser()->user_id; $feedback->type = $type; $feedback->title = $title; $feedback->content = $content; $feedback->status = 0; if (!$feedback->save()) { return Response::json(array('errCode' => 4, 'message' => '保存失败')); } return Response::json(array('errCode' => 0, 'message' => '保存成功')); }
public function submitAction() { // Get our context (this takes care of starting the session, too) $context = $this->getDI()->getShared('ltiContext'); $this->view->disable(); $this->view->ltiContext = $context; $this->view->userAuthorized = $context->valid; // Check for valid LTI context if ($context->valid) { // Store user feedback in the Feedback Phalcon model $feedback = new Feedback(); $feedback->type = $_POST["feedbackType"]; $feedback->feedback = $_POST["feedback"]; $feedback->student_email = $context->getUserEmail(); $feedback->student_name = $context->getUserName(); // The Phalcon model code takes care of creating a new row in the PostgreSQL database if ($feedback->save()) { echo "Thank you for your feedback!"; } else { echo "There was an error saving your feedback"; } // Send an email with this feedback to the developer $to = $this->getDI()->getShared('config')->feedback_email; $subject = 'Dashboard Feedback: ' . $feedback->type . " " . date(DATE_RFC2822); $message = $feedback->feedback . "\n Sent by " . $feedback->student_name . ", " . $feedback->student_email; $headers = 'From: admin@byuopenanalytics-dashboard.com' . "\r\n" . 'Reply-To: admin@byuopenanalytics-dashboard.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); } else { echo "You must be signed in to submit feedback"; } }
public function save(Feedback $feedback) { if ($feedback->isValid()) { $feedback->isNew() ? $this->add($feedback) : $this->modify($feedback); } else { throw new RuntimeException('Le feedback doit être valide pour être enregistrée'); } }
/** * Manages all models. */ public function actionAdmin() { $model = new Feedback('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['Feedback'])) { $model->attributes = $_GET['Feedback']; } $this->render('admin', array('model' => $model)); }
public function executeLeave(HTTPRequest $request) { $this->authenticationRedirection(); if (!$request->getExists('feedbackRequestId')) { $this->app->httpResponse()->redirect404(); exit; } $feedbackRequestId = htmlspecialchars($request->getData('feedbackRequestId')); $feedbackRequest = $this->_feedbackRequestsManager->get($feedbackRequestId); if (is_null($feedbackRequest)) { $this->app->httpResponse()->redirect404(); exit; } if ($request->postExists('submit-form')) { $feedback = new Feedback(); $feedback->setAnnounceId($feedbackRequest->getAnnounceId()); $feedback->setUserAuthorId($feedbackRequest->getUserAuthorId()); $feedback->setUserOwnerId($feedbackRequest->getUserOwnerId()); $feedback->setUserSubscriberId($feedbackRequest->getUserSubscriberId()); $feedback->setReservationId($feedbackRequest->getReservationId()); $mark = htmlspecialchars($request->postData('mark')); $comment = htmlspecialchars($request->postData('comment')); $feedback->setMark($mark); $feedback->setComment($comment); $this->_feedbacksManager->save($feedback); $this->_feedbackRequestsManager->delete($feedbackRequest->id()); $this->app->user()->setFlash('feedback-saved'); $this->app->httpResponse()->redirect('/feedback'); exit; } $this->page->smarty()->assign('feedbackRequest', $feedbackRequest); }
function fbHandler($p) { $session = SessionHandler::getInstance(); $o = new Feedback(); $o->type = USER; $o->subject = $p['subj']; $o->body = $p['body']; $o->from = $session->id; $o->time_created = sql_datetime(time()); $o->store(); js_redirect(''); // jump to start page }
public function actionAjaxSave() { if (Yii::app()->request->isAjaxRequest) { $model = new Feedback(); $model->attributes = $_POST['Feedback']; if ($model->save()) { echo true; } Yii::app()->end(); } else { throw new CHttpException(400); } }
public function submit() { if ($this->validate()) { $feedback = new Feedback(); $feedback->name = $this->name; $feedback->content = $this->content; $feedback->email = $this->email; $feedback->phone = $this->phone; $feedback->create_time = date('Y-m-d'); $feedback->is_reply = 0; return $feedback->save(); } return false; }
/** * Base feedback test */ public function testService() { $this->connection->expects($this->any())->method('is')->will($this->returnValue(false)); $this->connection->expects($this->once())->method('create'); $this->connection->expects($this->never())->method('write'); $this->connection->expects($this->once())->method('read')->with($this->equalTo(-1))->will($this->returnValue($this->packData() . $this->packData() . $this->packData())); // Create service $service = new Feedback(); $service->setConnection($this->connection); // Testing get invalid devices $devices = $service->getInvalidDevices(); $this->assertNotEmpty($devices); $this->assertEquals(3, count($devices)); }
function readFeedbackList() { $db = new Feedback(); $course_id = $db->getCourseID($_POST["course"]); $lecture_list = $db->readContents($course_id, $_POST["lecture"]); $jsonarray = array(); for ($i = 0; $i < sizeof($lecture_list); $i++) { $jsonarray[$i] = array(); $jsonarray[$i]["feedback_no"] = $lecture_list[$i][0]; $jsonarray[$i]["content_text"] = $lecture_list[$i][4]; $jsonarray[$i]["div_no"] = $lecture_list[$i][7]; $jsonarray[$i]["confirm_flag"] = $lecture_list[$i][6]; } print json_encode($jsonarray); }
/** * get singleton instance. * role: visitor|player|administrator * @return Feedback|null|object */ public static function getInstance() { if (!self::$instance) { self::$instance = new Feedback(); } return self::$instance; }
/** * Show Admin Dashboard * GET /admin/dashboard * * @return Response */ public function dashboard() { $users = \DB::table('users')->count(); $posts = \Post::all()->count(); $feedback = \Feedback::all()->count(); return \View::make('admin.dashboard', compact('posts', 'users', 'feedback')); }
/** * @test */ public function form_appears_and_saves() { Config::inst()->update('Controller', 'extensions', array('QuickFeedbackExtension')); $controller = new TestController(); $result = $controller->handleRequest(new SS_HTTPRequest('GET', 'form_appears_and_saves'), DataModel::inst()); $body = $result->getBody(); $this->assertContains('Form_QuickFeedbackForm', $body); $this->assertContains('Form_QuickFeedbackForm_Rating', $body); $this->assertContains('Form_QuickFeedbackForm_Comment', $body); preg_match('/action="([^"]+)"/', $body, $action); if (!count($action)) { $this->fail('No form action'); } preg_match('/name="SecurityID" value="([^"]+)"/', $body, $token); if (!count($action)) { $this->fail('No token'); } $parts = explode('/', $action[1]); $action = end($parts); $time = time(); $data = ['SecurityID' => $token[1], 'Rating' => '0', 'Comment' => 'comment at ' . $time]; $controller->handleRequest(new SS_HTTPRequest('POST', $action, array(), $data), DataModel::inst()); $existing = Feedback::get()->filter('Comment', 'comment at ' . $time)->first(); if (!$existing) { $this->fail('Record missing'); } }
public function loadModel($id) { if (($model = Feedback::model()->findByPk($id)) === null) { throw new CHttpException(404, 'Страница не найдена'); } return $model; }
/** * @inheritdoc */ public function getDescription() { switch ($this->key) { case self::KEY_NUEVO_PEDIDO: $pedido = ProyectoPedido::findOne($this->key_id); return Yii::t('app', 'Pedido #{pedido} por {usuario}', ['pedido' => $pedido->id, 'usuario' => $pedido->asignado0->usuario->username]); break; case self::KEY_NUEVO_PEDIDO_ACC: $pedido = AccionCentralizadaPedido::findOne($this->key_id); return Yii::t('app', 'Pedido #{pedido} por {usuario}', ['pedido' => isset($pedido->id) ? $pedido->id : '', 'usuario' => isset($pedido->asignado0->nombreUsuario) ? isset($pedido->asignado0->nombreUsuario) : '']); break; case self::KEY_PEDIDO_ACC_APROBADO: $acc_uej = AcEspUej::findOne($this->key_id); $pedido = $acc_uej->Nombreunidadejecutora; $aprobado = $acc_uej->aprobado == 1 ? 'aprobados' : 'no aprobados'; return Yii::t('app', 'Pedidos De Unidad Ejecutora ' . $pedido . ' fuerón ' . $aprobado . ''); break; case self::KEY_FEEDBACK: $feedback = Feedback::findOne($this->key_id); return Yii::t('app', 'Observación del proyecto #{id} <div class="actions pull-right"> <span class="notification-seen fa fa-eye" onclick="feedback({id})"></span> </div> ', ['id' => $feedback->id]); break; } }
protected function modify(Feedback $feedback) { $q = $this->dao->prepare('UPDATE ' . $this->table() . ' SET ANNOUNCE_ID = :announceId, USER_OWNER_ID = :userOwnerId, USER_SUBSCRIBER_ID = :userSubscriberId, USER_AUTHOR_ID = :userAuthorId, RESERVATION_ID = :reservationId, MARK = :mark, COMMENT = :comment WHERE ID = :id'); $q->bindValue(':announceId', $feedback->getAnnounceId(), PDO::PARAM_INT); $q->bindValue(':userOwnerId', $feedback->getUserOwnerId(), PDO::PARAM_INT); $q->bindValue(':userSubscriberId', $feedback->getUserSubscriberId(), PDO::PARAM_INT); $q->bindValue(':userAuthorId', $feedback->getUserAuthorId(), PDO::PARAM_INT); $q->bindValue(':reservationId', $feedback->getReservationId(), PDO::PARAM_INT); $q->bindValue(':mark', $feedback->getMark()); $q->bindValue(':comment', $feedback->getComment()); $q->bindValue(':id', $feedback->id(), PDO::PARAM_INT); $q->execute(); }
public function add_feedback() { if (!Input::has('title')) { return Response::json(array('error_code' => 2, 'message' => '请输入标题')); } if (!Input::has('content')) { return Response::json(array('error_code' => 3, 'message' => '请输入反馈内容')); } $feedback = new Feedback(); $feedback->title = Input::get('title'); $feedback->content = Input::get('content'); $feedback->user_id = Session::get('user.id'); if (!$feedback->save()) { return Response::json(array('error_code' => 1, 'message' => '反馈失败')); } return Response::json(array('error_code' => 0, 'message' => '反馈成功')); }
$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin')); } } else { throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.'); } } /** * Lists all models. */
public function run() { $models = Feedback::model()->finished()->review()->slider()->findAll(array('limit' => (int) $this->limit, 'order' => 't.sort ASC')); if (empty($models)) { return; } $this->render($this->view, array('models' => $models)); }
/** * * Param: productId * * @return Response */ public function post($id) { $input = Input::all(); $sessionId = Common::checkSessionLogin($input); $inputFeedback = ['product_id' => $id, 'user_id' => $input['user_id'], 'message' => $input['message'], 'status' => ACTIVE]; Feedback::create($inputFeedback)->id; return Common::returnData(200, SUCCESS, $input['user_id'], $sessionId); }
function done() { DB::escapePost(); if ($_POST) { Feedback::done(); $this->redirect('/feedback/'); } }
public function actionView($id) { $this->data['id'] = $id; $this->connection->createCommand("update xm_feedback set haveread = 1 where feedback_id = {$id}")->query(); $feedback = Feedback::model()->findByPk($id); $this->data['feedback'] = $feedback; $this->render('view', $this->data); }
public function run() { DB::table('feedbacks')->delete(); Feedback::create(array('title' => '好坑爹啊', 'content' => '不会治病学别人当什么医生', 'user_id' => 1)); Feedback::create(array('title' => '超赞', 'content' => '好棒哦', 'user_id' => 2)); Feedback::create(array('title' => '一般般', 'content' => '阿西吧~~~~', 'user_id' => 3)); Feedback::create(array('title' => '不错', 'content' => '这家医院不错哦', 'user_id' => 4)); }
public static function getFeedbackById($id) { $feedBack = Feedback::model()->findByPk($id); if ($feedBack) { return $feedBack; } return null; }
public function postContact() { $rules = array('name' => 'required', 'number' => 'required', 'email' => 'required', 'message' => 'required'); $v = Validator::make(Input::all(), $rules); if ($v->fails()) { App::abort(403, 'Unauthorized action.'); } Feedback::create(Input::all()); }
public function displayMain() { global $smarty; $attributes = Product::getAttributeAndGrop($this->entity->id); $feedbacks = Feedback::feedbackWithProdict($this->entity->id); $brand = $this->entity->id_brand > 0 ? new Brand($this->entity->id_brand) : false; $smarty->assign(array('feedback' => $feedbacks, 'entity' => $this->entity, 'images' => $this->entity->getImages(), 'groups' => Product::getAttributeAndGrop($this->entity->id), 'brand' => $brand, 'products' => $this->entity->getAlsoProduct())); return $smarty->fetch('product.tpl'); }
public function run() { Feedback::create(['product_id' => '1', 'user_id' => '2', 'message' => 'message test 1', 'status' => '1']); Feedback::create(['product_id' => '1', 'user_id' => '3', 'message' => 'message test 2', 'status' => '1']); Feedback::create(['product_id' => '2', 'user_id' => '2', 'message' => 'message test 3', 'status' => '1']); Feedback::create(['product_id' => '2', 'user_id' => '3', 'message' => 'message test 4', 'status' => '1']); Feedback::create(['product_id' => '3', 'user_id' => '2', 'message' => 'message test 5', 'status' => '1']); Feedback::create(['product_id' => '1', 'user_id' => '3', 'message' => 'message test 6', 'status' => '1']); }
public function actionStat() { $posts = Posts::model()->count(); $commentsNum = Comments::model()->count(); $attachsNum = Attachments::model()->count(); $feedbackNum = Feedback::model()->count(); $arr = array('posts' => $posts, 'commentsNum' => $commentsNum, 'attachsNum' => $attachsNum, 'feedbackNum' => $feedbackNum); $this->render('stat', $arr); }