Exemplo n.º 1
0
     }
     if (${$request_var}["pentry_id"] && ($tmp_input = clean_input(${$request_var}["pentry_id"], array("int")))) {
         $PROCESSED["pentry_id"] = $tmp_input;
     } else {
         add_error("An error occured attempting to attach comment to entry.");
     }
     if (!$ERROR) {
         $PROCESSED["proxy_id"] = $ENTRADA_USER->getID();
         $PROCESSED["submitted_date"] = time();
         $PROCESSED["flag"] = 0;
         $PROCESSED["active"] = 1;
         $PROCESSED["updated_date"] = date(time());
         $PROCESSED["updated_by"] = $ENTRADA_USER->getID();
         $comment = new Models_Eportfolio_Entry_Comment($PROCESSED);
         if ($comment->insert()) {
             $comment_data = $comment->toArray();
             $commentor = User::get($comment->getProxyID());
             $comment_data["commentor"] = $commentor->getFullname(false);
             $comment_data["submitted_date"] = date("Y-m-d H:i", $comment_data["submitted_date"]);
             echo json_encode(array("status" => "success", "data" => $comment_data));
         } else {
             echo json_encode(array("status" => "error", "data" => "An error occurred when attempting to store the comment."));
         }
     }
     break;
 case "delete-pentry-comment":
     if (${$request_var}["pecomment_id"] && ($tmp_input = clean_input(${$request_var}["pecomment_id"], array("int")))) {
         $PROCESSED["pecomment_id"] = $tmp_input;
     } else {
         add_error("An error occured attempting to attach comment to entry.");
     }