本文整理汇总了PHP中Messages::addMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP Messages::addMessage方法的具体用法?PHP Messages::addMessage怎么用?PHP Messages::addMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Messages
的用法示例。
在下文中一共展示了Messages::addMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display()
{
if (Session::get('isLoggedIn')) {
$user_name = $this->params->values('username');
$user_password = $this->params->values('password');
return $user_name;
echo $user_name;
echo json_encode($user_name);
echo json_encode($user_pass);
return $user_pass;
echo $user_pass;
//$imp = implode($user_password);
$imp = implode($user_password);
$encrypt = md5($imp);
$exp = explode(" ", $encrypt);
$usr = $this->userManager->getUserProfile($user_name, $user_password);
//echo $user_password . " " . $user_name;
echo json_encode($usr);
return $this;
} else {
Messages::addMessage("warning", "'user_name' and/or 'password' parameters missing.");
return null;
return $usr;
}
}
示例2: login
public function login()
{
if (Session::get('isLoggedIn')) {
Messages::addMessage("info", "You are already logged in.");
return null;
} else {
$user_name = $this->params->getValue('username');
$user_password = $this->params->getValue('password');
if ($user_name != null && $user_password != null) {
$usr = $this->userManager->findUser($user_name, $user_password);
//echo $usr;
if ($usr != null) {
return $usr;
Messages::addMessage("info", "You're already logged in");
} else {
Messages::addMessage("info", "Log in user and/or password incorrect.");
return null;
}
} else {
Messages::addMessage("warning", "'user_name' and/or 'password' parameters missing.");
return null;
//return $usr;
}
}
}
示例3: customerCheckout
public function customerCheckout()
{
if (Session::get('isLoggedIn')) {
Messages::addMessage("warning", "Not customer");
return;
} else {
$response = array();
// params have to be there
//$user_name = $this->params->getValue('user_name');
$custFirstName = $this->params->getValue('firstname');
$custLastName = $this->params->getValue('lastname');
$custPhone = $this->params->getValue('phone');
$custEmail = $this->params->getValue('email');
$custAddress = $this->params->getValue('address');
$custCity = $this->params->getValue('city');
$cartID = $_SESSION['cart_id'];
if ($custFirstName != null && $custLastName != null && $custPhone != null && $custEmail != null && $custAddress != null && $custCity != null && $cartID != null) {
//if($custFirstName != null) {
$cust = $this->userManager->createCustomer($custFirstName, $custLastName, $custPhone, $custEmail, $custAddress, $custCity, $cartID);
return $cust;
} else {
Messages::addMessage("warning", " parameters missing.");
return null;
}
}
}
示例4: register
public function register()
{
$response = array();
// params have to be there
$usr = $this->params->getValue('username');
$pwd = $this->params->getValue('password');
$encrypt = md5($pwd);
$fname = $this->params->getValue('firstname');
$lname = $this->params->getValue('lastname');
$email = $this->params->getValue('email');
echo $usr . " " . $pwd . " " . $fname . " " . $lname . " " . $email . " " . $encrypt;
if ($usr != null && $pwd != null && $fname != null && $lname != null && $email != null) {
// check if user name and password are correct
$user = $this->userManager->addUser($fname, $lname, $usr, $encrypt, $email);
if ($user != null) {
// log user in
Session::set("username", $user['username']);
Session::set("id", $user['ID']);
Session::set("isLoggedIn", true);
return $user;
return $user['ID'];
return $encrypt;
//return $response;
} else {
Messages::addMessage("warning", "'user_name' and/or 'password' parameters missing.");
return null;
return $usr;
}
}
}
示例5: login
public function login()
{
if (Session::get('isLoggedIn')) {
Messages::addMessage("info", "You are already logged in.");
return;
} else {
$response = array();
// params have to be there
$user_name = $this->params->getValue('user_name');
$user_password = $this->params->getValue('password');
if ($user_name != null && $user_password != null) {
// check if user name and password are correct
$usr = $this->userManager->findUser($user_name, $user_password);
if ($usr != null) {
// log user in
Session::set("user_name", $usr['user_name']);
Session::set("id", $usr['ID']);
Session::set("isLoggedIn", true);
return $usr;
} else {
Messages::addMessage("info", "Log in user and/or password incorrect.");
return null;
}
} else {
Messages::addMessage("warning", "'user_name' and/or 'password' parameters missing.");
return null;
}
}
}
示例6: logout
public function logout()
{
if (Session::get('isLoggedIn')) {
Session::closeSession();
Messages::addMessage("info", "Successfully logged out.");
return true;
} else {
Messages::addMessage("warning", "'isLoggedIn' parameter not found.");
return false;
}
}
示例7: updateProducts
public function updateProducts()
{
$response = array();
$sku = $this->params->getValue('sku');
$desc = $this->params->getValue('desc');
$price = $this->params->getValue('price');
$qty = $this->params->getValue('qty');
if ($sku != null && $desc != null && $price != null && $qty != null) {
$product = $this->ProductManager->updateProducts($sku, $desc, $price, $qty);
return $product;
} else {
Messages::addMessage("warning", "parameters missing.");
return null;
}
}
示例8: __construct
/**
* @param string $host
* @param string $username
* @param string $password
* @param string $db
* @param int $port
*/
public function __construct()
{
if (!isset($port)) {
$port = ini_get('mysqli.default_port');
}
if (file_exists("config.php")) {
include "config.php";
} else {
Messages::addMessage("Config file does not exist", Messages::ERRO);
return;
}
$this->_mysqli = new mysqli($db['db_host'], $db['db_user'], $db['db_pass'], $db['db_base'], $port);
$this->_mysqli->set_charset('utf8');
self::$_instance = $this;
}
示例9: getProfile
public function getProfile()
{
if (isset($_POST['method'])) {
$profile = $this->userManager->getUserProfile();
if ($profile != null) {
return $profile;
} else {
Messages::addMessage("info", "No user of that name.");
return null;
}
} else {
}
// otherwise
return null;
}
示例10: getProfile
public function getProfile()
{
if (Session::get('isLoggedIn') && Session::get('user_name')) {
$profile = $this->userManager->getUserProfile(Session::get('user_name'));
if ($profile != null) {
// found a user by that name
return $profile;
} else {
// this shouldn't happen since this is not a log in - this is a
// profile request. Would be good to report this here as well
// in a log file
Messages::addMessage("info", "No user of that name.");
return null;
}
} else {
// most likely session timed out.
}
// otherwise
return null;
}
示例11: logout
public function logout()
{
if (Session::get('isLoggedIn')) {
Session::closeSession();
Messages::addMessage("info", "Successfully logged out.");
return true;
/*
$profile = $this->userManager->getUserProfile(Session::get('user_name'));
if($profile != null) {
// log user out
Session::closeSession();
return true;
} else {
Messages::addMessage("warning", "No user of that name. Logout not performed.");
}
*/
} else {
Messages::addMessage("warning", "'isLoggedIn' parameter not found.");
return false;
}
}
示例12: getTransactionID
public function getTransactionID($sql)
{
try {
if ($this->conn != null) {
$this->conn->beginTransaction();
$this->conn->exec($sql);
// the id of the last inserted row into a table
$lastID = $this->conn->lastInsertId();
$this->conn->commit();
return $lastID;
} else {
// connection failed, add that to the messages
Messages::addMessage("error", "DBConnector 'getTransactionID' failure, PDO Connection was null.");
return -1;
}
return -1;
} catch (PDOException $e) {
$this->conn->rollBack();
Messages::addMessage("error", "DBConnector 'getTransactionID' failure, " . $e->getMessage());
}
}
示例13: processAction
/**
* processAction
* Update the record previously selected
* @return unknown_type
*/
public function processAction()
{
$isp = Shineisp_Registry::get('ISP');
$request = $this->getRequest();
// Check if we have a POST request
if (!$request->isPost()) {
return $this->_helper->redirector('index');
}
// Get our form and validate it
$form = $this->getForm('/admin/orders/process');
if (!$form->isValid($request->getPost())) {
// Invalid entries
$this->view->form = $form;
$this->view->title = $this->translator->translate("Order process");
$this->view->description = $this->translator->translate("Check the information posted and then click on the save button.");
return $this->_helper->viewRenderer('applicantform');
// re-render the login form
}
// Get the values posted
$params = $form->getValues();
// Get the id
$id = $this->getRequest()->getParam('order_id');
// Save the message note
if (!empty($params['note'])) {
// If the order is commentable then go on
if (Orders::IsCommentable($id)) {
$order = Orders::getAllInfo($id, null, true);
$link = Fastlinks::findlinks($id, $this->customer['customer_id'], 'orders');
if (!empty($link[0]['code'])) {
$code = $link[0]['code'];
} else {
$code = Fastlinks::CreateFastlink('orders', 'edit', json_encode(array('id' => $id)), 'orders', $id, $this->customer['customer_id']);
}
// Save the message in the database
Messages::addMessage($params['note'], $this->customer['customer_id'], null, $id);
$in_reply_to = md5($id);
$placeholder['messagetype'] = $this->translator->translate('Order');
$placeholders['subject'] = sprintf("%03s", $id) . " - " . Shineisp_Commons_Utilities::formatDateOut($order[0]['order_date']);
$placeholders['fullname'] = $this->customer['firstname'] . " " . $this->customer['lastname'];
$placeholders['orderid'] = $placeholders['subject'];
$placeholders['conditions'] = Settings::findbyParam('conditions');
$placeholders['url'] = "http://" . $_SERVER['HTTP_HOST'] . "/index/link/id/" . $code;
// Send a message to the customer
Shineisp_Commons_Utilities::sendEmailTemplate($order[0]['Customers']['email'], 'order_message', $placeholders, $in_reply_to, null, null, $isp, $order[0]['Customers']['language_id']);
$placeholders['url'] = "http://" . $_SERVER['HTTP_HOST'] . "/admin/login/link/id/{$code}/keypass/" . Shineisp_Commons_Hasher::hash_string($isp->email);
$placeholders['message'] = $params['note'];
// Send a message to the administrator
Shineisp_Commons_Utilities::sendEmailTemplate($isp->email, 'order_message_admin', $placeholders, $in_reply_to);
}
}
$this->_helper->redirector('index', 'orders', 'default', array('mex' => 'The requested task has been completed successfully', 'status' => 'success'));
}
示例14: processAction
/**
* processAction
* Update the record previously selected
* @return unknown_type
*/
public function processAction()
{
$request = $this->getRequest();
// Check if we have a POST request
if (!$request->isPost()) {
return $this->_helper->redirector('index');
}
// Get our form and validate it
$form = $this->getForm('/admin/service/process');
if (!$form->isValid($request->getPost())) {
// Invalid entries
$this->view->form = $form;
$this->view->title = $this->translator->translate("Service");
$this->view->description = $this->translator->translate("Check all the fields and click on the save button");
return $this->_helper->viewRenderer('customform');
// re-render the login form
}
// Get the values posted
$params = $form->getValues();
// Get the id
$id = $this->getRequest()->getParam('detail_id');
if (is_numeric($id)) {
OrdersItems::setAutorenew($id, $params['autorenew']);
}
// Save the message note
if (!empty($params['message'])) {
Messages::addMessage($params['message'], $this->customer['customer_id'], null, null, $id);
$isp = Shineisp_Registry::get('ISP');
$placeholder['fullname'] = $this->customer['firstname'] . " " . $this->customer['lastname'];
$placeholder['messagetype'] = $this->translator->translate('Order Details');
$placeholder['message'] = $params['message'];
Messages::sendMessage("message_new", $this->customer['email'], $placeholder);
Messages::sendMessage("message_admin", $isp->email, $placeholder);
}
$this->_helper->redirector('edit', 'services', 'default', array('id' => $id, 'mex' => 'The task requested has been executed successfully.', 'status' => 'success'));
}
示例15: query
public function query($sql, $params = array())
{
try {
if ($this->conn != null) {
$statement = $this->conn->prepare($sql);
$statement->execute($params);
$rows = $statement->fetchAll(PDO::FETCH_ASSOC);
return $rows;
} else {
// connection failed, add that to the messages
Messages::addMessage("error", "DBConnector 'query' failure, PDO Connection was null.");
}
return array();
} catch (PDOException $e) {
Messages::addMessage("error", "DBConnector 'query' failure, " . $e->getMessage());
}
}