本文整理汇总了PHP中Notification::setMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP Notification::setMessage方法的具体用法?PHP Notification::setMessage怎么用?PHP Notification::setMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notification
的用法示例。
在下文中一共展示了Notification::setMessage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dologinAction
public function dologinAction()
{
Db::connect();
$bean = R::dispense('user');
// the redbean model
$required = ['Name' => 'name', 'Email' => 'email', 'User_Name' => ['rmnl', 'az_lower'], 'Password' => 'password_hash'];
\RedBeanFVM\RedBeanFVM::registerAutoloader();
// for future use
$fvm = \RedBeanFVM\RedBeanFVM::getInstance();
$fvm->generate_model($bean, $required);
//the magic
R::store($bean);
$val = new validation();
$val->addSource($_POST)->addRule('email', 'email', true, 1, 255, true)->addRule('password', 'string', true, 10, 150, false);
$val->run();
if (count($val->errors)) {
Debug::r($val->errors);
foreach ($val->errors as $error) {
Notification::setMessage($error, Notification::TYPE_ERROR);
}
$this->redirect(Request::createUrl('login', 'login'));
} else {
Notification::setMessage("Welcome back !", Notification::TYPE_SUCCESS);
Debug::r($val->sanitized);
session::set('user', ['sanil']);
$this->redirect(Request::createUrl('index', 'index'));
}
}
示例2: createMessageObject
/**
* Creates a by $type parameter specified message
*
* @param string $type
* @param string $message
*
* @return Notification
*/
private function createMessageObject(string $type, string $message) : Notification
{
$msg = new Notification();
$msg->setType($type);
$msg->setMessage($message);
$this->handler->add($msg);
return $msg;
}
示例3: sendEventsCurlAction
/**
* @Route("/sendEventsCurlPost", name="send_events_curl_post")
* @Method("POST")
*/
public function sendEventsCurlAction(Request $request)
{
//$events = $request->request->get('event_check_list');
$em = $this->getDoctrine()->getManager();
$qb = $em->createQueryBuilder();
$qb->select('m');
$qb->from('AppBundle:Event', 'm');
//$qb->where($qb->expr()->in('m.id', $events));
//ArrayCollection
$result = $qb->getQuery()->getResult();
$events = array();
//$serializer = $this->container->get('jms_serializer');
//
$Devices = $em->getRepository('AppBundle:Device')->findAll();
$devicesTokens = "";
foreach ($Devices as $key => $value) {
$devicesTokens = $devicesTokens . ',' . $Devices[$key]->getDeviceToken();
}
$devicesTokens = substr($devicesTokens, 1);
foreach ($result as $key => $value) {
//$events [$key] =json_encode(array_values((array) $value),JSON_FORCE_OBJECT);
$events[$key] = $value;
//$events [$key] =json_encode($serializer->serialize($value, 'json'),JSON_FORCE_OBJECT);
}
$devicesTokens = str_replace(',', '","', $devicesTokens);
$notification = new Notification();
$notification->setTitle($request->request->get('title'));
$notification->setMessage($request->request->get('message'));
$notification->setDate();
$em = $this->getDoctrine()->getManager();
$em->persist($notification);
$em->flush();
$cmd = ' curl -u 485d490dd0720a823c518fb6d39d73623ddff1f0487764a4: -H "Content-Type: application/json" -H "X-Ionic-Application-Id: 9cea62b6" https://push.ionic.io/api/v1/push -d \'{"tokens": ["' . $devicesTokens . '"],"production": false, "notification":{ "alert":"' . $request->request->get('message') . '", "title": "' . $request->request->get('title') . '","android": {"payload":""}, "ios": {"payload": ""}}}\' ';
exec($cmd);
// echo $cmd;
// die;
$notifications = $em->getRepository('AppBundle:Notification')->find($notification->getId());
$serializer = $this->container->get('serializer');
$reports = $serializer->serialize($notifications, 'json');
return new Response($reports);
}
示例4: update
public function update(){
if(RequestUtils::isPost()){
parent::updateNotForward();
$ticket = DAO::getOne("Ticket",$_POST['idTicket']);
$messages = DAO::getAll("Message", 'idTicket = '.$_POST['idTicket']);
$users = array();
foreach ($messages as $message) {
$user = $message->getUser()->getId();
if (!in_array($user, $users) && $user != Auth::getUser()->getId() ) {
array_push($users, $message->getUser()->getId());
}
$message->setUser(DAO::getAll("User", "id=".$message->getUser()->getId())[0]);
}
$message = DAO::getOne("Message", "idUser=".Auth::getUser()->getId()." ORDER BY date DESC");
foreach ($users as $user) {
if (DAO::getOne("Notification", 'idUser = '.$user.' AND idTicket = '.$ticket->getId()) == null) {
$user = DAO::getOne("User", $user);
$notif = new Notification();
$notif->setUser($user);
$notif->setTicket($ticket);
$notif->setMessage($message);
DAO::insert($notif);
}
}
$this->loadView("ticket/vMessage",array("messages"=>$messages, "ticket" => $ticket));
Jquery::execute("CKEDITOR.replace('contenu');");
Jquery::executeOn('.submitMessage', "click", "
for ( instance in CKEDITOR.instances )
CKEDITOR.instances[instance].updateElement();
");
Jquery::postFormOn("click",".submitMessage","messages/update","frm",".contentMessages");
echo Jquery::compile();
}
}