本文整理汇总了PHP中add_success函数的典型用法代码示例。如果您正苦于以下问题:PHP add_success函数的具体用法?PHP add_success怎么用?PHP add_success使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_success函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save($id = null)
{
$this->load->helper('memberspace/authorization');
$this->load->helper('flashmessages/flashmessages');
$this->load->model('memberspace/user');
$this->load->helper('form');
$datas = array();
if (isset($_POST) && isset($_POST['save-user'])) {
$datas = $_POST;
unset($_POST['save-user']);
if (isset($_POST['id']) && $_POST['id']) {
if (!user_can('update', 'user', $_POST['id'])) {
add_error(translate('Vous ne pouvez pas modifier cet utilisateur'));
}
} else {
if (!user_can('add', 'user', $_POST['id'])) {
add_error(translate('Vous ne pouvez pas ajouter d\'utilisateur'));
}
}
if ($this->user->fromPost() !== false) {
add_success(translate('L\'utilisateur a bien été ajouté'));
redirect('bo/users/all');
} else {
add_error($this->form_validation->error_string());
}
} else {
if ($id) {
$datas = $this->user->getId($id, 'array');
}
}
return $datas;
}
示例2: save
public function save($userModel = 'memberspace/user', $mailRedirect = 'memberspace/confirmation/confirm', $redirect = null)
{
$post = $this->input->post();
$modelName = pathinfo($userModel)['filename'];
if (!$post || !isset($post['save-' . $modelName])) {
return array();
}
unset($_POST['save-' . $modelName]);
$this->load->library('form_validation');
if (isset($post['id']) && !user_can('update', $userModel, $post['id'])) {
return $post;
}
$this->load->model($userModel);
$userId = $this->{$modelName}->fromPost();
if ($userId === false) {
add_error($this->form_validation->error_string());
return $post;
}
if (!isset($post['id'])) {
$this->sendMailConfirmation($userId, $mailRedirect);
add_success('Vous avez bien été inscrit !');
} else {
add_success('Vous avez bien mis à jour vos informations');
}
if ($redirect) {
redirect($redirect);
}
return $post;
}
示例3: save_class
function save_class()
{
//add message to alert array
include "../app/student/studentmanager.php";
$connection = db_connect();
//connect to database
$class = $_SESSION['class'];
$teacherid = $_SESSION['id'];
$classname = $class['name'][0];
$query = "INSERT INTO `project`.`class` (`id`, `teacher_id`, `class_group`) VALUES (NULL, '{$teacherid}', '{$classname}')";
$result = mysqli_query($connection, $query);
//perform query
$classid = mysqli_insert_id($connection);
if ($result) {
//check if query ran
for ($i = 0; $i < count($class['fname']); $i++) {
create_student($class['fname'][$i], $class['lname'][$i], $classid);
}
add_success("Class Created.");
clear_class();
} else {
add_error("Class not created, Error in SQL");
}
db_close($connection);
}
示例4: delete
public function delete()
{
global $db;
$query = "DELETE FROM `student_leaves_of_absence` where `id`=" . $db->qstr($this->id);
if (!$db->Execute($query)) {
add_error("Failed to remove leave of absence from database.");
application_log("error", "Unable to delete a student_leaves_of_absence record. Database said: " . $db->ErrorMsg());
} else {
add_success("Successfully removed Leave of Absence.");
}
}
示例5: login_user
function login_user($email, $pass)
{
$pass = sha1($pass);
$connection = db_connect();
$query = 'SELECT * FROM `project`.`teacher` WHERE `email` = "' . $email . '" AND pass = "' . $pass . '"';
//create login query
$result = mysqli_query($connection, $query);
//perform login query
if ($result) {
//check if query ran
if (mysqli_num_rows($result) > 0) {
//if any logins are found
//session_clear(); //clear current session variables
//username details
$resultset = mysqli_fetch_assoc($result);
//get array of values from database
$_SESSION['email'] = $resultset['email'];
//Set details as session variables
$_SESSION['id'] = $resultset['id'];
$_SESSION['firstname'] = $resultset['firstname'];
$_SESSION['lastname'] = $resultset['lastname'];
$_SESSION['school'] = $resultset['school'];
add_success($resultset['firstname'] . " " . $resultset['lastname'] . " Logged in Successfully");
db_close($connection);
header('location: dashboard/classview.php');
die;
} else {
add_error("Login Incorrect");
//add error message
db_close($connection);
header('location: index.php');
die;
}
} else {
add_error("Login Mysql didnt work.");
db_close($connection);
header('location: index.php');
die;
}
}
示例6: save
public function save($mailRedirect = 'memberspace/confirmation/confirm', $redirect = null)
{
$rules = Modules::load_multiple('form_validation', 'memberspace', 'config/', 'config');
$post = $this->input->post();
if (!$post) {
return array();
}
$this->load->library('form_validation');
if (!isset($rules['myuser'])) {
return $post;
}
$this->form_validation->set_rules($rules['myuser']);
if (!$this->form_validation->run()) {
add_error($this->form_validation->error_string());
return $post;
}
unset($_POST['save-user']);
$this->load->model('myuser');
$post = $this->input->post();
if (isset($post['id']) && !user_can('update', 'user', $post['id'])) {
return $post;
}
// It's important to make a call to $this->input->post() again
$userId = $this->myuser->save($post);
if (!isset($post['id'])) {
$this->sendMailConfirmation($userId, $mailRedirect);
$this->load->model('memberspace/right');
$this->right->allowUserTo($userId, '*', 'user', $userId);
$this->user->addToGroup('users', $userId);
add_success('Vous avez bien été inscrit !');
} else {
add_success('Vous avez bien mis à jour vos informations');
}
if ($redirect) {
redirect($redirect);
}
return $post;
}
示例7: save
public function save($id = null, $userModel = 'memberspace/user')
{
$userModel = $this->filterModel($userModel);
$model = pathinfo($userModel)['filename'];
$this->load->helper('memberspace/authorization');
$this->load->helper('flashmessages/flashmessages');
$this->load->model($userModel);
$this->load->helper('form');
$datas = array();
if (isset($_POST) && isset($_POST['save-user'])) {
$datas = $_POST;
unset($_POST['save-user']);
$is_update = false;
if (isset($_POST['id']) && $_POST['id']) {
$is_update = true;
if (!user_can('update', $userModel, $_POST['id'])) {
add_error(translate('Vous ne pouvez pas modifier cet utilisateur'));
}
} else {
if (!user_can('add', $userModel)) {
add_error(translate('Vous ne pouvez pas ajouter cet utilisateur'));
}
}
if ($this->{$model}->fromPost()) {
add_success(translate('L\'utilisateur a bien été ') . ($is_update ? translate('mis à jour') : translate('ajouté')));
redirect('bo/users/all/' . str_replace('/', '-', $userModel));
} else {
add_error($this->form_validation->error_string());
}
} else {
if ($id) {
$datas = $this->{$model}->getId($id, 'array');
}
}
return $datas;
}
示例8: update
public function update(array $input_arr)
{
extract($input_arr);
global $db;
$query = "Update `student_clineval_comments` set `comment`=?, `source`=? where `id`=?";
if (!$db->Execute($query, array($text, $source, $this->id))) {
add_error("Failed to update a clinical performance evaluation comment.");
application_log("error", "Unable to update a student_clineval_comment record. Database said: " . $db->ErrorMsg());
} else {
add_success("Successfully updated clinical performance evaluation.");
}
}
示例9: foreach
foreach ($_POST["remove_ids"] as $day_id) {
if ($tmp_input = clean_input($day_id, "numeric")) {
$PROCESSED["delete"][] = $tmp_input;
$days[] = Models_RestrictedDays::fetchRow($tmp_input);
}
}
}
switch ($STEP) {
case 2:
foreach ($days as $day) {
$day_data = $day->toArray();
$day_data["day_active"] = 0;
if ($day->fromArray($day_data)->update()) {
add_statistic("restricted_days", "delete", "orday_id", $day->getID(), $ENTRADA_USER->getID());
if (!$ERROR) {
add_success("Successfully deleted the restricted day '<strong>" . $day->getName() . "</strong>'. You will now be redirected to the restricted days index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . ENTRADA_URL . "/admin/settings/manage/restricteddays?org=" . $ORGANISATION_ID . "\"><strong>click here</strong></a> to continue.");
}
} else {
add_error("Failed to delete the restricted day '<strong>" . $day->getName() . "</strong>', an Administrator has been informed, please try again later. You will now be redirected to the restricted days index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . ENTRADA_URL . "/admin/settings/manage/restricteddays?org=" . $ORGANISATION_ID . "\"><strong>click here</strong></a> to continue.");
application_log("Failed to delete restricted day, DB said: " . $db->ErrorMsg());
}
}
break;
}
switch ($STEP) {
case 2:
if ($ERROR) {
echo display_error();
}
if ($SUCCESS) {
echo display_success();
示例10: switch
}
}
if ($ERROR) {
$STEP = 1;
}
break;
}
// Display Page
switch ($STEP) {
case 2:
$query = "UPDATE `reports_aamc_ci` SET `report_active` = '0' WHERE `raci_id` IN (" . implode(", ", $report_ids) . ")";
if ($db->Execute($query)) {
$url = ENTRADA_URL . "/admin/reports/aamc";
$ONLOAD[] = "setTimeout('window.location=\\'" . $url . "', 5000)";
if ($total_removed = $db->Affected_Rows()) {
add_success("You have successfully deactived " . $total_removed . " AAMC Curriculum Inventory Report" . ($total_removed != 1 ? "s" : "") . ".<br /><br />You will be automatically redirected to the event index in 5 seconds, or you can <a href=\"" . $url . "\">click here</a> if you do not wish to wait.");
echo display_success();
application_log("success", "Successfully deactived raci_ids: " . implode(", ", $report_ids));
} else {
add_error("We were unable to deactive the requested reports from the system. The system administrator has been informed of this issue and will address it shortly; please try again later.");
echo display_error();
application_log("error", "Failed to deactivate any raci_ids: " . implode(", ", $report_ids) . ". Database said: " . $db->ErrorMsg());
}
} else {
add_error("We were unable to deactive the requested reports from the system. The system administrator has been informed of this issue and will address it shortly; please try again later.");
echo display_error();
application_log("error", "Failed to execute deactivate query for raci_ids: " . implode(", ", $report_ids) . ". Database said: " . $db->ErrorMsg());
}
break;
case 1:
default:
示例11: update
public function update(array $input_arr)
{
extract($input_arr);
global $db;
$query = "update `student_contributions` set\n\t\t\t\t `role`=?, `org_event`=?,`start_month`=?, `start_year`=?, `end_month`=?,`end_year`=?,`status`=?, `comment`=? \n\t\t\t\t where `id`=?";
if (!$db->Execute($query, array($role, $org_event, $start_month, $start_year, $end_month, $end_year, $status, $comment, $this->id))) {
add_error("Failed to update contribution.");
application_log("error", "Unable to update a student_contributions record. Database said: " . $db->ErrorMsg());
} else {
add_success("Successfully updated contribution.");
}
}
示例12: add_error
if ($observership->delete()) {
$deleted[] = $title;
} else {
add_error("An error ocurred while attempting to delete the observership <strong>" . $title . "</strong>. An administrator has been informed, please try again later.\n\t\t\t\t\t\t\t\t\t\t<br />You will be automatically redirected to the My Observerships page in 5 seconds, or you can <a href=\"" . ENTRADA_URL . "/profile/observerships\">click here</a>.");
}
} else {
add_error("Unable to delete the observership <strong>" . $title . "</strong>, the status is " . $observership->getStatus() . ".");
}
}
if ($deleted) {
$message = "<pre>";
foreach ($deleted as $title) {
$message .= " " . $title . "\n";
}
$message .= "</pre>";
add_success("Successfully deleted the following observerships:<br />" . $message . "You will be automatically redirected to the My Observerships page in 5 seconds, or you can <a href=\"" . ENTRADA_URL . "/profile/observerships\">click here</a>.");
}
break;
}
switch ($STEP) {
case 2:
if ($SUCCESS) {
echo display_success();
$ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/profile/observerships\\'', 5000)";
}
if ($ERROR) {
echo display_error();
$ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/profile/observerships\\'', 5000)";
}
break;
case 1:
示例13: add_success
/**
* Remove all records from group_members table.
*/
$query = "DELETE FROM `course_group_audience` WHERE `cgroup_id` = " . $db->qstr($group_id);
$db->Execute($query);
$removed[$group_id]["group_name"] = $result["group_name"];
}
/**
* Remove group_id record from groups table.
*/
$query = "DELETE FROM `course_groups` WHERE `cgroup_id` = " . $db->qstr($group_id);
break;
}
$db->Execute($query);
if ($_POST["coa"] != "delete") {
add_success("Successfully " . $_POST["coa"] . "d the course group.");
}
}
}
$ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/courses/groups?id=" . $COURSE_ID . "\\'', 5000)";
if (!strcmp($_POST["coa"], "delete")) {
if ($total_removed = @count($removed)) {
$SUCCESS++;
$SUCCESSSTR[$SUCCESS] = "You have successfully removed " . $total_removed . " group" . ($total_removed != 1 ? "s" : "") . " from the system:";
$SUCCESSSTR[$SUCCESS] .= "<div style=\"padding-left: 15px; padding-bottom: 15px; font-family: monospace\">\n";
foreach ($removed as $result) {
$SUCCESSSTR[$SUCCESS] .= html_encode($result["group_name"]) . "<br />";
}
$SUCCESSSTR[$SUCCESS] .= "</div>\n";
$SUCCESSSTR[$SUCCESS] .= "You will be automatically redirected to the group index in 5 seconds, or you can <a href=\"" . ENTRADA_URL . "/admin/courses/groups?id=" . $COURSE_ID . "\">click here</a> if you do not wish to wait.";
application_log("success", "Successfully removed group ids: " . implode(", ", $GROUP_IDS));
示例14: array
?>
<h1>Delete Medbiquitous Instructional Methods</h1>
<?php
$BREADCRUMB[] = array("url" => ENTRADA_URL . "/admin/settings/manage/medbiqinstructional?section=delete&org=" . $ORGANISATION['organisation_id'], "title" => "Deactivate Medbiquitous Instructional Method");
if (isset($_POST["remove_ids"]) && is_array($_POST["remove_ids"]) && !empty($_POST["remove_ids"])) {
foreach ($_POST["remove_ids"] as $id) {
$PROCESSED["remove_ids"][] = (int) $id;
}
}
if ($PROCESSED["remove_ids"]) {
switch ($STEP) {
case 2:
foreach ($_POST["remove_ids"] as $id) {
$i_m = Models_MedbiqInstructionalMethod::get($id);
if ($i_m->fromArray(array("active" => "0"))->update()) {
add_success("Successfully deactivated Medbiquitous Instructional Method [" . $i_m->getInstructionalMethod() . "] from your organisation.");
} else {
add_error("An error occurred while deactivating the Medbiquitous Instructional Method [" . $id . "] from the system. The system administrator has been notified. You will now be redirected to the Medbiquitous Instructional Method index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . ENTRADA_URL . "/admin/settings/manage/medbiqinstructional/?org=" . $ORGANISATION_ID . "\" style=\"font-weight: bold\">click here</a> to continue.");
application_log("error", "An error occurred while removing the Medbiquitous Instructional Method [" . $id . "] from the system. ");
}
}
if ($SUCCESS) {
echo display_success();
}
if ($NOTICE) {
echo display_notice();
}
$ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/settings/manage/medbiqinstructional/?org=" . $ORGANISATION_ID . "\\'', 5000)";
break;
case 1:
default:
示例15: application_log
$ERROR++;
}
} else {
application_log("error", "Unable to deactivate organisation_id [" . $id . "], user did not have delete permission.");
$ERROR++;
}
}
if (!$ERROR) {
$success_string = "<br /><div style=\"padding-left: 15px; padding-bottom: 15px; font-family: monospace\">\n";
foreach ($organisations as $organisation_id => $result) {
if (in_array($organisation_id, $PROCESSED["remove_ids"])) {
$success_string .= html_encode($result["organisation_title"]) . "<br />";
}
}
$success_string .= "</div>\n";
add_success("You have successfully removed the following organisations from the system:<br />" . $success_string . "You will be automatically redirected to the event index in 5 seconds, or you can <a href=\"" . ENTRADA_URL . "/admin/settings\">click here</a> if you do not wish to wait.");
echo display_success();
$ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/settings\\'', 5000)";
} else {
add_error("An error occurred when trying to delete an organisation, a system administrator has been informed.");
echo display_error();
$ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/settings\\'', 5000)";
}
break;
default:
add_notice("Please review the following organisations to ensure that you wish to <strong>permanently delete</strong> them.");
echo display_notice();
?>
<div id="organisations-section">
<form action="<?php
echo ENTRADA_URL;