Esempio n. 1
0
 public function actioninsertComment()
 {
     $model = new LbComment();
     $item_id = false;
     $lb_comment_description = false;
     if (isset($_POST['item_id']) && $_POST['item_id'] > 0) {
         $item_id = $_POST['item_id'];
     }
     $module_name = false;
     if (isset($_POST['module_name'])) {
         $module_name = $_POST['module_name'];
     }
     $date = date('Y-m-d');
     if (isset($_POST['comment'])) {
         $lb_comment_description = $_POST['comment'];
     }
     $id_comment = $model->addComment($module_name, $lb_comment_description, $item_id, $date, 0);
     if ($id_comment) {
         $customer = AccountProfile::model()->getProfile($id_comment->lb_account_id);
         $response = array();
         $response['success'] = YES;
         $response['account_profile_given_name'] = $customer->account_profile_given_name;
         $response['account_profile_surname'] = $customer->account_profile_surname;
         $response['lb_comment_date'] = $id_comment->lb_comment_date;
         $response['lb_comment_description'] = nl2br($id_comment->lb_comment_description);
         $response['lb_module_name'] = $id_comment->lb_module_name;
         $response['lb_item_module_id'] = $id_comment->lb_item_module_id;
         $response['lb_parent_comment_id'] = $id_comment->lb_parent_comment_id;
         $response['lb_record_primary_key'] = $id_comment->lb_record_primary_key;
         LBApplication::renderPlain($this, array('content' => CJSON::encode($response)));
     }
 }