本文整理汇总了PHP中Feedback类的典型用法代码示例。如果您正苦于以下问题:PHP Feedback类的具体用法?PHP Feedback怎么用?PHP Feedback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Feedback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionFeedback
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, '反馈失败,请重试');
}
}
示例2: actionFeedback
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]);
}
示例3: add_feedback
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' => '保存成功'));
}
示例4: submitAction
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";
}
}
示例5: save
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');
}
}
示例6: actionAdmin
/**
* 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));
}
示例7: executeLeave
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);
}
示例8: fbHandler
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
}
示例9: actionAjaxSave
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);
}
}
示例10: submit
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;
}
示例11: testService
/**
* 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));
}
示例12: readFeedbackList
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);
}
示例13: getInstance
/**
* 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;
}
示例14: dashboard
/**
* 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'));
}
示例15: form_appears_and_saves
/**
* @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');
}
}
开发者ID:helpfulrobot,项目名称:mandrew-silverstripe-quickfeedback,代码行数:30,代码来源:QuickFeedbackExtensionTest.php