本文整理汇总了PHP中Alert::CreateSuccess方法的典型用法代码示例。如果您正苦于以下问题:PHP Alert::CreateSuccess方法的具体用法?PHP Alert::CreateSuccess怎么用?PHP Alert::CreateSuccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Alert
的用法示例。
在下文中一共展示了Alert::CreateSuccess方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$action = 'browse';
if (isset($_GET['action'])) {
$action = $_GET['action'];
}
if (strcmp($action, 'browse') == 0) {
$this->view = SettingsAdministrationAction::$BrowseSettings;
} else {
if (strcmp($action, 'new_setting') == 0) {
$this->view = SettingsAdministrationAction::$NewSettingForm;
} else {
if (strcmp($action, 'add_setting') == 0) {
if (isset($_POST['setting_name']) && isset($_POST['setting_value'])) {
DbSetting::Add($_POST['setting_name'], $_POST['setting_value']);
$this->addAlert(Alert::CreateSuccess('Success', 'Setting added.'));
$this->reloadSettings();
}
$this->reexecute(array('action' => 'browse'));
} else {
if (strcmp($action, 'delete_setting') == 0) {
if (isset($_GET['setting_id'])) {
DbSetting::Delete($_GET['setting_id']);
$this->addAlert(Alert::CreateSuccess('Success', 'Setting deleted.'));
$this->reloadSettings();
}
$this->reexecute(array('action' => 'browse'));
} else {
if (strcmp($action, 'save_settings') == 0) {
$settings = DbSetting::GetAll();
foreach ($settings as $setting) {
if (isset($_POST['setting_' . $setting->id])) {
$setting->value = $_POST['setting_' . $setting->id];
}
}
$container = new SettingContainer($settings);
DbSetting::Save($container);
$this->addAlert(Alert::CreateSuccess('Success', 'Settings saved.'));
$this->reloadSettings();
$this->reexecute(array('action' => 'browse'));
}
}
}
}
}
}
示例2: execute
public function execute()
{
if (isset($_POST['username']) && isset($_POST['password'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$user = DbUser::GetByUsername($username);
if (!$user->isNull()) {
if ($user->testPassword($password)) {
$_SESSION['user_id'] = $user->id;
$this->pushAlert(Alert::CreateSuccess('Success', 'You\'re now connected with success.'));
header('location: index.php');
} else {
$this->addAlert(Alert::CreateDanger('Error', 'Invalid Username and/or password.'));
}
} else {
$this->addAlert(Alert::CreateDanger('Error', 'Invalid Username and/or password.'));
}
}
}
示例3: execute
public function execute()
{
if ($this->isSignUpOpen()) {
if (isset($_POST['username']) && isset($_POST['password']) && isset($_POST['password2']) && isset($_POST['email'])) {
$u_name = $_POST['username'];
$u_pass = $_POST['password'];
$pass2 = $_POST['password2'];
$u_email = $_POST['email'];
if (strcmp($u_pass, $pass2) == 0) {
if (!DbUser::IsUsernameOrEmailExists($u_name, $u_email)) {
$len_username = strlen($u_name);
if ($len_username >= $this->settings->getInt("username_min", 4) && $len_username <= $this->settings->getInt("username_max", 12)) {
//creating the user
$salt = User::GenerateSalt();
$hashType = $this->settings->getString('hash_type', 'sha256');
DbUser::Add($u_name, $salt, $hashType, $u_pass, "", "", $u_email);
$default_group = $this->settings->getString('default_user_group', 'Users');
$group = DbGroup::GetByName($default_group);
if (!$group->isNull()) {
$user = DbUser::GetByUsername($u_name);
if (!$user->isNull()) {
DbGroup::AddUser($group->id, $user->id);
}
}
$this->pushAlert(Alert::CreateSuccess('Success', 'Account created!'));
header('location: index.php');
} else {
$this->addAlert(Alert::CreateWarning('Warning', 'Username must be between ' . $this->settings->getInt("username_min", 4) . ' and ' . $this->settings->getInt("username_max", 12) . ' characters.'));
}
} else {
$this->addAlert(Alert::CreateWarning('Warning', 'Username and/or Email already exists in the database.'));
}
} else {
$this->addAlert(Alert::CreateWarning('Warning', 'Password mismatches.'));
}
}
} else {
$this->addAlert(Alert::CreateWarning('Warning', 'You can\'t create an account!'));
}
}
示例4: execute
public function execute()
{
$action = "";
if (isset($_GET['action'])) {
$action = $_GET['action'];
}
if (strcmp($action, 'save_info') == 0) {
//save user info here
//todo
if (isset($_POST['first_name']) && isset($_POST['last_name'])) {
$firstName = $_POST['first_name'];
$lastName = $_POST['last_name'];
$user = $this->user;
$user->firstName = $firstName;
$user->lastName = $lastName;
DbUser::Update($user);
}
$this->addAlert(Alert::CreateSuccess('Success', 'Account information saved.'));
$this->reloadUser();
}
$this->accountPermissions = DbGroup::GetUserPermissions($this->user->id);
$this->accountGroups = DbGroup::GetUserGroups($this->user->id);
}
示例5: execute
public function execute()
{
$action = 'browse';
$this->view = NewsAction::$BrowseNews;
if (isset($_GET['action'])) {
$action = $_GET['action'];
}
if (strcmp($action, 'browse') == 0) {
$this->mustHavePermission('manage_news');
$this->news = DbNews::GetAll();
$this->view = NewsAction::$BrowseNews;
} else {
if (strcmp($action, 'new_news') == 0) {
$this->mustHavePermission('manage_news');
$this->view = NewsAction::$NewNewsForm;
} else {
if (strcmp($action, 'add_news') == 0) {
$this->mustHavePermission('manage_news');
if (isset($_POST['news_title']) && isset($_POST['news_content'])) {
$title = $_POST['news_title'];
$content = $_POST['news_content'];
$user_id = $this->user->id;
DbNews::Add($title, $content, $user_id);
$this->addAlert(Alert::CreateSuccess('Success', 'News posted.'));
}
$this->reexecute(array('action' => 'browse'));
} else {
if (strcmp($action, 'edit') == 0) {
$this->mustHavePermission('manage_news');
if ($_GET['news_id']) {
$news_id = $_GET['news_id'];
$this->currentNews = DbNews::GetById($news_id);
$this->view = NewsAction::$EditNewsForm;
if ($this->currentNews->isNull()) {
$this->reexecute(array('action' => 'browse'));
}
} else {
$this->reexecute(array('action' => 'browse'));
}
} else {
if (strcmp($action, 'save_news') == 0) {
$this->mustHavePermission('manage_news');
if (isset($_POST['news_id']) && isset($_POST['news_title']) && isset($_POST['news_content'])) {
$news = DbNews::GetById($_POST['news_id']);
if (!$news->isNull()) {
$news->title = $_POST['news_title'];
$news->content = $_POST['news_content'];
DbNews::Update($news);
$this->addAlert(Alert::CreateSuccess('Success', 'News saved.'));
}
}
$this->reexecute(array('action' => 'browse'));
} else {
if (strcmp($action, 'delete_news') == 0) {
$this->mustHavePermission('manage_news');
if (isset($_GET['news_id'])) {
$news_id = $_GET['news_id'];
DbNews::Delete($news_id);
$this->addAlert(Alert::CreateSuccess('Success', 'News deleted.'));
}
$this->reexecute(array('action' => 'browse'));
}
}
}
}
}
}
}
示例6: execute
public function execute()
{
$action = 'browse';
if (isset($_GET['action'])) {
$action = $_GET['action'];
}
if (strcmp($action, 'browse') == 0) {
$this->groups = DbGroup::GetAll();
$this->view = GroupsAdministrationAction::$BrowseGroups;
} else {
if (strcmp($action, 'new_group') == 0) {
$this->view = GroupsAdministrationAction::$NewGroupForm;
} else {
if (strcmp($action, 'add_group') == 0) {
if (isset($_POST['group_name'])) {
$group_name = $_POST['group_name'];
//only contains the ID of the permissions
$group_perms = array();
$permissions = $this->permissions->getPermissions();
foreach ($permissions as $perm) {
if (isset($_POST[$perm->name])) {
$value = $_POST[$perm->name];
if (strcmp($value, 'on') == 0) {
$group_perms[] = $perm->id;
}
}
}
$group = DbGroup::Add($group_name);
$g_id = $group->id;
foreach ($group_perms as $p_id) {
DbGroup::AddPermission($g_id, $p_id);
}
$this->addAlert(Alert::CreateSuccess('Success', 'Group added.'));
}
$this->reexecute(array('action' => 'browse'));
} else {
if (strcmp($action, 'permissions') == 0) {
$this->mustHavePermission('manage_permissions');
$this->view = GroupsAdministrationAction::$BrowsePermissions;
} else {
if (strcmp($action, 'edit_permission') == 0) {
$this->mustHavePermission('manage_permissions');
if (isset($_GET['perm_id'])) {
$this->permission = DbPermission::GetById($_GET['perm_id']);
$this->view = GroupsAdministrationAction::$EditPermissionForm;
if ($this->permission->isNull()) {
$this->addAlert(Alert::CreateDanger('Error', 'Invalid Permission.'));
$this->reexecute(array('action' => 'permissions'));
}
} else {
$this->reexecute(array('action' => 'permissions'));
}
} else {
if (strcmp($action, 'save_permission') == 0) {
$this->mustHavePermission('manage_permissions');
if (isset($_POST['perm_id']) && isset($_POST['perm_name']) && isset($_POST['perm_value']) && isset($_POST['perm_desc'])) {
$perm_id = $_POST['perm_id'];
$perm = DbPermission::GetById($perm_id);
if (!$perm->isNull()) {
$perm->name = $_POST['perm_name'];
$perm->value = $_POST['perm_value'];
$perm->description = $_POST['perm_desc'];
DbPermission::Update($perm);
$this->addAlert(Alert::CreateSuccess('Success', 'Permission saved.'));
$this->reloadPermissions();
} else {
$this->addAlert(Alert::CreateDanger('Error', 'Invalid Permission.'));
}
}
$this->reexecute(array('action' => 'permissions'));
} else {
if (strcmp($action, 'new_permission') == 0) {
$this->mustHavePermission('manage_permissions');
$this->view = GroupsAdministrationAction::$NewPermissionForm;
} else {
if (strcmp($action, 'add_permission') == 0) {
$this->mustHavePermission('manage_permissions');
if (isset($_POST['perm_name']) && isset($_POST['perm_value']) && isset($_POST['perm_desc'])) {
$perm = new Permission();
$perm->name = $_POST['perm_name'];
$perm->value = $_POST['perm_value'];
$perm->description = $_POST['perm_desc'];
DbPermission::Add($perm);
$this->addAlert(Alert::CreateSuccess('Success', 'Permission added.'));
$this->reloadPermissions();
}
$this->reexecute(array('action' => 'permissions'));
} else {
if (strcmp($action, 'edit_group') == 0) {
if (isset($_GET['group_id'])) {
$this->group = DbGroup::GetById($_GET['group_id']);
$this->view = GroupsAdministrationAction::$EditGroupForm;
} else {
$this->reexecute(array('action' => 'browse'));
}
} else {
if (strcmp($action, 'save_group') == 0) {
if (isset($_POST['group_id']) && isset($_POST['group_name'])) {
$group_id = $_POST['group_id'];
$group_name = $_POST['group_name'];
//.........这里部分代码省略.........
示例7: execute
public function execute()
{
if (isset($_GET['action'])) {
$action = $_GET['action'];
} else {
$action = 'browse';
}
if (strcmp($action, 'browse') == 0) {
$this->view = UsersAdministrationAction::$BrowseUsers;
$this->title = "Users Administration - Browse Users";
//retrieve users
$page = 0;
$users_per_page = 50;
if (isset($_GET['page'])) {
$page = $_GET['page'];
}
$start = $page * $users_per_page;
$this->users = DbUser::Get($users_per_page, $start);
} else {
if (strcmp($action, 'new_user') == 0) {
$this->view = UsersAdministrationAction::$NewUserForm;
} else {
if (strcmp($action, 'edit_user') == 0) {
if (isset($_GET['user_id'])) {
$this->pageUser = DbUser::GetById($_GET['user_id']);
$this->groups = DbGroup::GetAll();
if (!$this->pageUser->isNull()) {
$this->userGroups = DbGroup::GetUserGroups($this->pageUser->id);
$this->view = UsersAdministrationAction::$EditUserForm;
} else {
$this->addAlert(Alert::CreateDanger('Error', 'Invalid User.'));
$this->view = UsersAdministrationAction::$BrowseUsers;
$this->reexecute(array('action' => 'browse'));
}
}
} else {
if (strcmp($action, 'save_user') == 0) {
if (isset($_POST['user_id']) && isset($_POST['first_name']) && isset($_POST['last_name']) && isset($_POST['email'])) {
$user_id = $_POST['user_id'];
$firstName = $_POST['first_name'];
$lastName = $_POST['last_name'];
$email = $_POST['email'];
$user = DbUser::GetById($user_id);
if (!$user->isNull()) {
$user->firstName = $firstName;
$user->lastName = $lastName;
$user->email = $email;
DbUser::Update($user);
$this->addAlert(Alert::CreateSuccess('Success', 'User updated.'));
$this->reexecute(array('action' => 'edit_user', 'user_id' => $user_id));
} else {
//error user not found
$this->addAlert(Alert::CreateDanger('Error', 'This user doesn\'t exists.'));
$this->reexecute(array('action' => 'browse'));
}
} else {
//missing field, so edit form again
$this->view = UsersAdministrationAction::$EditUserForm;
}
} else {
if (strcmp($action, 'remove_group') == 0) {
if (isset($_GET['group_id']) && isset($_GET['user_id'])) {
DbGroup::RemoveUser($_GET['group_id'], $_GET['user_id']);
$this->addAlert(Alert::CreateSuccess('Success', 'Group removed.'));
$this->reexecute(array('action' => 'edit_user'));
}
} else {
if (strcmp($action, 'add_user') == 0) {
if (isset($_POST['username']) && isset($_POST['password']) && isset($_POST['password2']) && isset($_POST['first_name']) && isset($_POST['last_name']) && isset($_POST['email'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$password2 = $_POST['password2'];
$firstName = $_POST['first_name'];
$lastName = $_POST['last_name'];
$email = $_POST['email'];
if (strcmp($password, $password2) == 0) {
if (!DbUser::IsUsernameOrEmailExists($username, $email)) {
//username length check
$len_username = strlen($username);
if ($len_username >= $this->settings->getInt("username_min", 4) && $len_username <= $this->settings->getInt("username_max", 12)) {
//creating the user
$salt = User::GenerateSalt();
$hashType = $this->settings->getString('hash_type', 'sha256');
DbUser::Add($username, $salt, $hashType, $password, $firstName, $lastName, $email);
$default_group = $this->settings->getString('default_user_group', 'Users');
$group = DbGroup::GetByName($default_group);
if (!$group->isNull()) {
$user = DbUser::GetByUsername($username);
if (!$user->isNull()) {
DbGroup::AddUser($group->id, $user->id);
}
}
$this->addAlert(Alert::CreateSuccess('Success', 'User added !'));
$this->reexecute(array('action' => 'browse'));
} else {
$this->view = UsersAdministrationAction::$NewUserForm;
$this->addAlert(Alert::CreateWarning('Warning', 'Username must be between ' . $this->settings->getInt("username_min", 4) . ' and ' . $this->settings->getInt("username_max", 12) . ' characters.'));
}
} else {
$this->view = UsersAdministrationAction::$NewUserForm;
//.........这里部分代码省略.........