本文整理汇总了PHP中Feedback::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Feedback::save方法的具体用法?PHP Feedback::save怎么用?PHP Feedback::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Feedback
的用法示例。
在下文中一共展示了Feedback::save方法的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: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Feedback();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
$panel_ident = $_REQUEST['panel_ident'];
if (isset($_POST['Feedback'])) {
$model->attributes = $_POST['Feedback'];
$model->q_time = Time::now();
if ($model->save()) {
$model->addTags('tag1, tag2, tag3')->save();
if (isset($_GET['ajax'])) {
$str = Yii::t('cp', 'Create Success On ') . Time::now();
Yii::app()->user->setFlash('success', $str);
$this->renderPartial('create_next', array('model' => $model, 'panel_ident' => $panel_ident), false, true);
exit;
} else {
$this->redirect(array('view', 'id' => $model->id));
}
}
}
if (isset($_GET['ajax'])) {
$this->renderPartial('create', array('model' => $model, 'panel_ident' => $panel_ident), false, true);
} else {
$this->render('create', array('model' => $model));
}
}
示例3: 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";
}
}
示例4: 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]);
}
示例5: 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' => '保存成功'));
}
示例6: addFeedback
public static function addFeedback($userId, $data)
{
$feedback = new Feedback();
$feedback->user_id = $userId;
$feedback->attributes = $data;
return $feedback->save();
die;
}
示例7: actionCreate
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Feedback();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Feedback'])) {
$model->attributes = $_POST['Feedback'];
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->id));
}
}
示例8: addFeedback
public function addFeedback($attr)
{
if (is_array($attr)) {
$model = new Feedback();
$model->created_at = time();
$model->updated_at = time();
$model->setAttributes($attr);
if ($model->save(FALSE)) {
return $model;
}
}
return FALSE;
}
示例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: postCreate
public function postCreate()
{
$validator = Validator::make(Input::all(), Feedback::$rules);
if ($validator->passes()) {
$feedback = new Feedback();
$feedback->title = Input::get('title');
$feedback->body = Input::get('body');
$user = Auth::user();
$feedback->user_id = $user->id;
$feedback->save();
return Redirect::to('feedbacks/index')->with('message', 'Feedback Created');
}
return Redirect::to('feedbacks/formcreate')->with('message', 'Something went wrong')->withErrors($validator)->withInput();
}
示例11: 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;
}
示例12: actionCustomer
public function actionCustomer()
{
$this->layout = false;
if (isset($_POST['feedback'])) {
$model = new Feedback();
$errorMessage = null;
$createFeedback = json_decode($_POST['feedback'], true);
$sql_existFeedback = "SELECT * FROM `st_feedback` WHERE order_id = '" . $createFeedback['order_id'] . "'";
if (!Order::model()->existOrderByOrderId($createFeedback['order_id'])) {
$errorMessage = "订单号有错,请核实后重新输入";
} elseif (is_dir("images/feedback/" . $createFeedback['order_id'])) {
$errorMessage = "已经提交过问题,请等候处理,或直接与客服人员联系";
} else {
$model->order_id = $createFeedback['order_id'];
$model->text = $createFeedback['content_text'];
$model->contact_method = isset($createFeedback['contact_method']) ? $createFeedback['contact_method'] : null;
$model->create_time = date("Y-m-d H:i:s");
$model->dealed = 2;
if (!$model->save()) {
$errorMessage = "提交的信息可能有误,请重新提交或者与客服联系。";
}
if (isset($_POST['image'])) {
$images = CUploadedFile::getInstancesByName('image');
if (isset($images) && count($images) > 0) {
foreach ($images as $image => $pic) {
$pic->saveAs(Yii::getPathOfAlias('webroot') . '/images/feedback/' . $order_id . $pic->name);
}
}
$model->photo_name = "feedback.png";
}
if (!$model->save()) {
$errorMessage = "提交的信息可能有误,请重新提交或者与客服联系。";
}
}
$this->render('customer', array('errorMessage' => $errorMessage));
}
}
示例13: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Feedback();
if (Yii::app()->user->id) {
$model->email = Yii::app()->user->getModel()->email;
$model->name = Yii::app()->user->getModel()->getName();
}
if (isset($_POST['Feedback'])) {
$model->attributes = $_POST['Feedback'];
if ($model->save()) {
$this->redirect('/feedback/index');
}
}
$this->render('create', array('model' => $model));
}
示例14: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Feedback();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Feedback'])) {
$model->attributes = $_POST['Feedback'];
if ($model->save()) {
if (Yii::app()->user->getLevel() == 3) {
$this->redirect(array('view', 'id' => $model->id_feedback));
}
Yii::app()->user->setFlash('notifFeedback', 'Feedback telah dikirim.');
$this->redirect(array('create'));
}
}
$this->render('create', array('model' => $model));
}
示例15: add_feedback
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' => '反馈成功'));
}