本文整理汇总了PHP中Alert类的典型用法代码示例。如果您正苦于以下问题:PHP Alert类的具体用法?PHP Alert怎么用?PHP Alert使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Alert类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
public static function send($id_user, $content)
{
$alert = new Alert();
$alert->id_user = (int) $id_user;
$alert->is_read = 0;
$alert->content = pSQL($content);
$alert->add_date = "";
return $alert->add();
}
示例2: sendMessage
/**
* @brief Envoie un message à un membre
* @param int $idUser ID du membre qui doit recevoir le message
* @param String $msg Message à envoyer
* @return Error Retourne une information
*/
public function sendMessage($idUser, $msg)
{
$privateAlert = new Alert();
$privateAlert->setIdMember($idUser);
$privateAlert->setMessage($msg);
$privateAlert->setTitle('Message de l\'administrateur');
AlertsManager::instance()->add($privateAlert);
return new Error("Votre message a bien été envoyé");
}
示例3: addAlert
public function addAlert()
{
$input = Input::all();
$alert = new Alert();
$alert->value = $input['value'];
$alert->condition = $input['condition'];
$alert->user_id = $input['user'];
$alert->owner_user_id = $input['user'];
$alert->save();
return Redirect::to('/alerts');
}
示例4: index
public function index(){
$alert = DAO::getOne("Alert", "idUser = ".Auth::getUser()->getId());
if ($alert == null){
$alert = new Alert();
$alert->setUser(Auth::getUser());
}
$days = array("Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche");
$this->loadView("alert/vEdit", array('alert' => $alert, "days" => $days));
}
示例5: testbean_implements
public function testbean_implements()
{
error_reporting(E_ERROR | E_PARSE);
$alert = new Alert();
$this->assertEquals(false, $alert->bean_implements(''));
//test with empty value
$this->assertEquals(false, $alert->bean_implements('test'));
//test with invalid value
$this->assertEquals(true, $alert->bean_implements('ACL'));
//test with valid value
}
示例6: processAlerts
function processAlerts()
{
if (isset($_POST[POST_INTERN_PROCESS_ALERTS . "_va"])) {
$alerts = explode(POST_ACTION_VALUE_SPLITTER, slashesStrip($_POST[POST_INTERN_PROCESS_ALERTS . "_va"]));
$visitors = explode(POST_ACTION_VALUE_SPLITTER, $_POST[POST_INTERN_PROCESS_ALERTS . "_vb"]);
$browsers = explode(POST_ACTION_VALUE_SPLITTER, $_POST[POST_INTERN_PROCESS_ALERTS . "_vc"]);
foreach ($alerts as $key => $text) {
$alert = new Alert($visitors[$key], $browsers[$key], $alerts[$key]);
$alert->Save();
}
}
}
示例7: __construct
/**
*
* Contruct that checks you are loged in before nothing else happens!
*/
function __construct(Request $request, Response $response)
{
if (Theme::get('premium') != 1) {
Alert::set(Alert::INFO, __('Upgrade your Open Classifieds site to activate this feature.'));
}
parent::__construct($request, $response);
}
示例8: action_status
public function action_status()
{
$status = (bool) $this->request->param('id');
Model_Config::set_value('general', 'cron', $status);
Alert::set(Alert::SUCCESS, __('General Configuration updated'));
$this->redirect(Route::url('oc-panel', array('controller' => 'crontab')));
}
示例9: action_pay
/**
* [action_form] generates the form to pay at paypal
*/
public function action_pay()
{
$this->auto_render = FALSE;
$order_id = $this->request->param('id');
$order = new Model_Order();
$order->where('id_order', '=', $order_id)->where('status', '=', Model_Order::STATUS_CREATED)->limit(1)->find();
if ($order->loaded()) {
// case when selling advert
if ($order->id_product == Model_Order::PRODUCT_AD_SELL) {
$paypal_account = $order->ad->paypal_account();
$currency = i18n::get_intl_currency_symbol();
if (isset($order->ad->cf_shipping) and Valid::numeric($order->ad->cf_shipping) and $order->ad->cf_shipping > 0) {
$order->amount = $order->amount + $order->ad->cf_shipping;
}
} else {
$paypal_account = core::config('payment.paypal_account');
$currency = core::config('payment.paypal_currency');
}
$paypal_url = Core::config('payment.sandbox') ? Paypal::url_sandbox_gateway : Paypal::url_gateway;
$paypal_data = array('order_id' => $order_id, 'amount' => number_format($order->amount, 2, '.', ''), 'site_name' => core::config('general.site_name'), 'site_url' => URL::base(TRUE), 'paypal_url' => $paypal_url, 'paypal_account' => $paypal_account, 'paypal_currency' => $currency, 'item_name' => $order->description);
$this->template = View::factory('paypal', $paypal_data);
$this->response->body($this->template->render());
} else {
Alert::set(Alert::INFO, __('Order could not be loaded'));
$this->redirect(Route::url('default'));
}
}
示例10: action_update
/**
* CRUD controller: UPDATE
*/
public function action_update()
{
$id_role = $this->request->param('id');
//we do not allow modify the admin
if ($id_role == Model_Role::ROLE_ADMIN) {
Alert::set(Alert::WARNING, __('Admin Role can not be modified!'));
$this->redirect(Route::url('oc-panel', array('controller' => 'role')));
}
$this->template->title = __('Update') . ' ' . __($this->_orm_model) . ' ' . $id_role;
$role = new Model_Role($id_role);
if ($this->request->post() and $role->loaded()) {
//delete all the access
DB::delete('access')->where('id_role', '=', $role->id_role)->execute();
//set all the access where post = on
foreach ($_POST as $key => $value) {
if ($value == 'on') {
DB::insert('access', array('id_role', 'access'))->values(array($role->id_role, str_replace('|', '.', $key)))->execute();
}
}
//saving the role params
$role->name = core::post('name');
$role->description = core::post('description');
$role->save();
Alert::set(Alert::SUCCESS, __('Item updated'));
$this->redirect(Route::get($this->_route_name)->uri(array('controller' => Request::current()->controller())));
}
//getting controllers actions
$controllers = Model_Access::list_controllers();
//get all the access this user has
$query = DB::select('access')->from('access')->where('id_role', '=', $id_role)->execute();
$access_in_use = array_keys($query->as_array('access'));
// d(in_array('access_index',$access_in_use));
//d($access_in_use);
return $this->render('oc-panel/pages/role/update', array('role' => $role, 'controllers' => $controllers, 'access_in_use' => $access_in_use));
}
示例11: action_pay
/**
* [action_form] generates the form to pay at paypal
*/
public function action_pay()
{
$this->auto_render = FALSE;
//sandobx doesnt do the x_receipt_link_url redirect so in sanbbox instead we put the order id
$id_order = Core::config('payment.twocheckout_sandbox') == 1 ? Core::request('x_receipt_link_url') : $this->request->param('id');
//retrieve info for the item in DB
$order = new Model_Order();
$order = $order->where('id_order', '=', $id_order)->where('status', '=', Model_Order::STATUS_CREATED)->limit(1)->find();
if ($order->loaded()) {
//its a fraud...lets let him know
if ($order->is_fraud() === TRUE) {
Alert::set(Alert::ERROR, __('We had, issues with your transaction. Please try paying with another paymethod.'));
$this->redirect(Route::url('default', array('controller' => 'product', 'action' => 'checkout', 'id' => $order->id_order)));
}
if (($order_id = twocheckout::validate_passback($order)) !== FALSE) {
//mark as paid
$order->confirm_payment('2checkout', $order_id, NULL, NULL, NULL, Twocheckout::calculate_fee($order->amount));
//redirect him to his ads
Alert::set(Alert::SUCCESS, __('Thanks for your payment!'));
$this->redirect(Route::url('default', array('controller' => 'product', 'action' => 'goal', 'id' => $order->id_order)));
} else {
Alert::set(Alert::INFO, __('Please fill your card details.'));
$this->redirect(Route::url('default', array('controller' => 'product', 'action' => 'checkout', 'id' => $order->id_order)));
}
} else {
Alert::set(Alert::INFO, __('Order could not be loaded'));
$this->redirect(Route::url('default'));
}
}
示例12: action_form
/**
* [action_form] generates the form to pay at paypal
*/
public function action_form()
{
$this->auto_render = FALSE;
$order_id = $this->request->param('id');
$order = new Model_Order();
$order->where('id_order', '=', $order_id)->where('status', '=', Model_Order::STATUS_CREATED)->limit(1)->find();
if ($order->loaded()) {
// dependant on product we have different names
if ($order->id_product == Paypal::to_featured) {
$item_name = __('Advertisement to featured');
} else {
if ($order->id_product == Paypal::to_top) {
$item_name = __('Advertisement to top');
} else {
$item_name = $order->description . __(' category');
}
}
$paypal_url = Core::config('payment.sandbox') ? Paypal::url_sandbox_gateway : Paypal::url_gateway;
$paypal_data = array('order_id' => $order_id, 'amount' => number_format($order->amount, 2, '.', ''), 'site_name' => core::config('general.site_name'), 'site_url' => URL::base(TRUE), 'paypal_url' => $paypal_url, 'paypal_account' => core::config('payment.paypal_account'), 'paypal_currency' => core::config('payment.paypal_currency'), 'item_name' => $item_name);
$this->template = View::factory('paypal', $paypal_data);
$this->response->body($this->template->render());
} else {
Alert::set(Alert::INFO, __('Order could not be loaded'));
$this->request->redirect(Route::url('default'));
}
}
示例13: send
/**
* sends an email using our configs
* @param string/array $to array(array('name'=>'chema','email'=>'chema@'),)
* @param [type] $to_name [description]
* @param [type] $subject [description]
* @param [type] $body [description]
* @param [type] $reply [description]
* @param [type] $replyName [description]
* @param [type] $file [description]
* @return boolean
*/
public static function send($to, $to_name = '', $subject, $body, $reply, $replyName, $file = NULL)
{
require_once Kohana::find_file('vendor', 'php-mailer/phpmailer', 'php');
$body = Text::bb2html($body, TRUE);
//get the template from the html email boilerplate
$body = View::factory('email', array('title' => $subject, 'content' => nl2br($body)))->render();
$mail = new PHPMailer();
$mail->CharSet = Kohana::$charset;
if (core::config('email.smtp_active') == TRUE) {
$mail->IsSMTP();
//SMTP HOST config
if (core::config('email.smtp_host') != "") {
$mail->Host = core::config('email.smtp_host');
// sets custom SMTP server
}
//SMTP PORT config
if (core::config('email.smtp_port') != "") {
$mail->Port = core::config('email.smtp_port');
// set a custom SMTP port
}
//SMTP AUTH config
if (core::config('email.smtp_auth') == TRUE) {
$mail->SMTPAuth = TRUE;
// enable SMTP authentication
$mail->Username = core::config('email.smtp_user');
// SMTP username
$mail->Password = core::config('email.smtp_pass');
// SMTP password
if (core::config('email.smtp_ssl') == TRUE) {
$mail->SMTPSecure = "ssl";
// sets the prefix to the server
}
}
}
$mail->From = core::config('email.notify_email');
$mail->FromName = "no-reply " . core::config('general.site_name');
$mail->Subject = $subject;
$mail->MsgHTML($body);
if ($file !== NULL) {
$mail->AddAttachment($file['tmp_name'], $file['name']);
}
$mail->AddReplyTo($reply, $replyName);
//they answer here
if (is_array($to)) {
foreach ($to as $contact) {
$mail->AddBCC($contact['email'], $contact['name']);
}
} else {
$mail->AddAddress($to, $to_name);
}
$mail->IsHTML(TRUE);
// send as HTML
if (!$mail->Send()) {
//to see if we return a message or a value bolean
Alert::set(Alert::ALERT, "Mailer Error: " . $mail->ErrorInfo);
return FALSE;
} else {
return TRUE;
}
}
示例14: addUser
function addUser($args)
{
global $dbUsers;
global $Language;
// Check if the username already exist in db.
if (Text::isEmpty($args['username'])) {
Alert::set($Language->g('username-field-is-empty'));
return false;
}
if ($dbUsers->userExists($args['username'])) {
Alert::set($Language->g('username-already-exists'));
return false;
}
// Validate password.
if ($args['password'] != $args['confirm-password'] || Text::isEmpty($args['password'])) {
Alert::set($Language->g('The password and confirmation password do not match'));
return false;
}
// Add the user.
if ($dbUsers->add($args)) {
Alert::set($Language->g('user-has-been-added-successfully'));
return true;
} else {
Log::set(__METHOD__ . LOG_SEP . 'Error occurred when trying to create the account.');
return false;
}
}
示例15: action_index
public function action_index()
{
//template header
$this->template->title = __('Contact Us');
$this->template->meta_description = __('Contact') . ' ' . core::config('general.site_name');
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Home'))->set_url(Route::url('default')));
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Contact Us')));
if ($this->request->post()) {
//captcha check
if (captcha::check('contact')) {
//check if user is loged in
if (Auth::instance()->logged_in()) {
$email_from = Auth::instance()->get_user()->email;
$name_from = Auth::instance()->get_user()->name;
} else {
$email_from = core::post('email');
$name_from = core::post('name');
}
//akismet spam filter
if (!core::akismet($name_from, $email_from, core::post('message'))) {
$replace = array('[EMAIL.BODY]' => core::post('message'), '[EMAIL.SENDER]' => $name_from, '[EMAIL.FROM]' => $email_from);
if (Email::content(core::config('email.notify_email'), core::config('general.site_name'), $email_from, $name_from, 'contact-admin', $replace)) {
Alert::set(Alert::SUCCESS, __('Your message has been sent'));
} else {
Alert::set(Alert::ERROR, __('Message not sent'));
}
} else {
Alert::set(Alert::WARNING, __('This email has been considered as spam! We are sorry but we can not send this email.'));
}
} else {
Alert::set(Alert::ERROR, __('Wrong captcha'));
}
}
$this->template->content = View::factory('pages/contact');
}