• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP flash_error函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中flash_error函数的典型用法代码示例。如果您正苦于以下问题:PHP flash_error函数的具体用法?PHP flash_error怎么用?PHP flash_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了flash_error函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: closeAutoCheckedoutFilesByUser

 /**
  * Return all project files that were automatically checked out (on edit) by the user
  *
  * @param User $user 
  * @return array
  */
 static function closeAutoCheckedoutFilesByUser($user = null)
 {
     if (!$user) {
         $user = logged_user();
     }
     try {
         $condstr = 'checked_out_by_id = ' . $user->getId() . ' AND was_auto_checked_out = 1 AND checked_out_on <> \'' . EMPTY_DATETIME . '\'';
         $files = self::findAll(array('conditions' => $condstr));
         // findAll
         if ($files) {
             foreach ($files as $file) {
                 $file->setWasAutoCheckedAuto($autoCheckOut);
                 $file->setCheckedOutById(0);
                 $file->setCheckedOutOn(EMPTY_DATETIME);
                 $file->setMarkTimestamps(false);
                 $file->save();
             }
             return true;
         }
         return false;
     } catch (Exception $exc) {
         flash_error(lang('error checkin file'));
         return false;
     }
 }
开发者ID:rorteg,项目名称:fengoffice,代码行数:31,代码来源:ProjectFiles.class.php


示例2: add

 function add()
 {
     $pt = DB::escape(array_var($_GET, 'pt'));
     $t = DB::escape(array_var($_GET, 't'));
     $dep = ProjectTaskDependencies::findOne(array('conditions' => "`previous_task_id` = {$pt} AND `task_id` = {$t}"));
     if (!$dep instanceof ProjectTaskDependency) {
         try {
             DB::beginWork();
             $dep = new ProjectTaskDependency();
             $dep->setPreviousTaskId(array_var($_GET, 'pt'));
             $dep->setTaskId(array_var($_GET, 't'));
             $dep->save();
             DB::commit();
         } catch (Exception $e) {
             flash_error($e->getMessage());
             DB::rollback();
         }
     }
     flash_success(lang('success add task dependency'));
     $reload = array_var($_GET, 'reload', true);
     if ($reload) {
         ajx_current("reload");
     } else {
         ajx_current("empty");
     }
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:26,代码来源:TaskdependencyController.class.php


示例3: update_category

 /**
  * Show and process config category form
  *
  * @param void
  * @return null
  */
 function update_category()
 {
     $category = ConfigCategories::findById(get_id());
     if (!$category instanceof ConfigCategory) {
         flash_error(lang('config category dnx'));
         $this->redirectToReferer(get_url('administration'));
     }
     // if
     if ($category->isEmpty()) {
         flash_error(lang('config category is empty'));
         $this->redirectToReferer(get_url('administration'));
     }
     // if
     $options = $category->getOptions(false);
     $categories = ConfigCategories::getAll(false);
     tpl_assign('category', $category);
     tpl_assign('options', $options);
     tpl_assign('config_categories', $categories);
     $submitted_values = array_var($_POST, 'options');
     if (is_array($submitted_values)) {
         foreach ($options as $option) {
             $new_value = array_var($submitted_values, $option->getName());
             if (is_null($new_value) || $new_value == $option->getValue()) {
                 continue;
             }
             $option->setValue($new_value);
             $option->save();
         }
         // foreach
         flash_success(lang('success update config category', $category->getDisplayName()));
         $this->redirectTo('administration', 'configuration');
     }
     // if
     $this->setSidebar(get_template_path('update_category_sidebar', 'config'));
 }
开发者ID:469306621,项目名称:Languages,代码行数:41,代码来源:ConfigController.class.php


示例4: canGoOn

 /**
  * Determine if a user canGoOn to deny access to files in projects
  * to which the user has not been assigned.
  *
  * @access public
  * @return null
  */
 function canGoOn()
 {
     if (active_project() == null || !logged_user()->isProjectUser(active_project())) {
         flash_error(lang('no access permissions'));
         $this->redirectTo('dashboard');
     }
     // if
 }
开发者ID:469306621,项目名称:Languages,代码行数:15,代码来源:ApplicationController.class.php


示例5: login

 /**
  * Log user in
  *
  * @param void
  * @return null
  */
 function login()
 {
     $redirect_to = null;
     // Get page user wanted to visit based on GET params
     if ($this->request->get('re_route')) {
         $params = array();
         foreach ($this->request->url_params as $k => $v) {
             if ($k != 're_route' && str_starts_with($k, 're_')) {
                 $params[substr($k, 3)] = $v;
             }
             // if
         }
         // if
         $redirect_to = assemble_url($this->request->get('re_route'), $params);
     } else {
         $redirect_to = assemble_url('dashboard');
     }
     // if
     // If user is already logged in redirect him to page he wanted to visit
     if (instance_of($this->logged_user, 'User')) {
         flash_error('You are already logged in as :display. Please logout before you can login on another account', array('display' => $this->logged_user->getDisplayName()));
         $this->redirectToUrl($redirect_to);
     }
     // if
     $login_data = $this->request->post('login');
     $this->smarty->assign(array('login_data' => $login_data, 'auto_focus' => true));
     if ($this->request->isSubmitted()) {
         $errors = new ValidationErrors();
         $email = trim(array_var($login_data, 'email'));
         $password = array_var($login_data, 'password');
         $remember = (bool) array_var($login_data, 'remember');
         if ($email == '') {
             $errors->addError(lang('Email address is required'), 'email');
         }
         // if
         if (trim($password) == '') {
             $errors->addError(lang('Password is required'), 'password');
         }
         // if
         if ($errors->hasErrors()) {
             $this->smarty->assign('auto_focus', false);
             $this->smarty->assign('errors', $errors);
             $this->render();
         }
         // if
         $user =& $this->authentication->provider->authenticate(array('email' => $email, 'password' => $password, 'remember' => $remember));
         if (!$user || is_error($user)) {
             $errors->addError(lang('Failed to log you in with data you provided. Please try again'), 'login');
             $this->smarty->assign('errors', $errors);
             $this->render();
         }
         // if
         flash_success(lang('Welcome back :display!', array('display' => $user->getDisplayName()), true, $user->getLanguage()), null, true);
         $this->redirectToUrl($redirect_to);
     }
     // if
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:63,代码来源:AuthController.class.php


示例6: delete_state

 function delete_state()
 {
     $this->setTemplate(get_template_path('back'));
     ajx_current("empty");
     try {
         $query = "DELETE FROM `" . TABLE_PREFIX . "guistate` WHERE `contact_id` = " . DB::escape(logged_user()->getId());
         DB::executeAll($query);
         flash_success(lang("success reset gui state"));
     } catch (Exception $e) {
         flash_error($e->getMessage());
     }
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:12,代码来源:GuiController.class.php


示例7: project_tag

 /**
  * Show project objects tagged with specific tag
  *
  * @access public
  * @param void
  * @return null
  */
 function project_tag()
 {
     $tag = array_var($_GET, 'tag');
     if (trim($tag) == '') {
         flash_error(lang('tag dnx'));
         $this->redirectTo('project', 'tags');
     }
     // if
     $tagged_objects = active_project()->getObjectsByTag($tag);
     $total_tagged_objects = 0;
     if (is_array($tagged_objects)) {
         foreach ($tagged_objects as $type => $objects) {
             if (is_array($objects)) {
                 $total_tagged_objects += count($objects);
             }
         }
         // foreach
     }
     // if
     tpl_assign('tag', $tag);
     tpl_assign('tagged_objects', $tagged_objects);
     tpl_assign('total_tagged_objects', $total_tagged_objects);
 }
开发者ID:bklein01,项目名称:Project-Pier,代码行数:30,代码来源:TagsController.class.php


示例8: add_attachment

 /**
  * Attach object to specific page and redirects to specified page
  *
  * @access public
  * @param void
  * @return null
  */
 function add_attachment()
 {
     $project = active_project();
     if (!$project instanceof Project) {
         flash_error(lang('project dnx'));
         $this->redirectToReferer(get_url('dashboard'));
     }
     // if
     if (!$project->canEdit(logged_user())) {
         flash_error(lang('no access permissions'));
         $this->redirectToReferer(get_url('dashboard'));
     }
     // if
     $page_attachment = new PageAttachment();
     $page_attachment->setText(lang('description'));
     $page_attachment->setRelObjectId('0');
     $page_attachment->setRelObjectManager(array_var($_GET, 'rel_object_manager'));
     $page_attachment->setProjectId($project->getId());
     $page_attachment->setPageName(array_var($_GET, 'page_name'));
     $page_attachment->setOrder(array_var($_GET, 'order'));
     $page_attachment->save();
     PageAttachments::reorder(array_var($_GET, 'page_name'), $project);
     $this->redirectToReferer(get_url('dashboard'));
 }
开发者ID:federosky,项目名称:ProjectPier-Core,代码行数:31,代码来源:PageAttachmentController.class.php


示例9: view

 function view()
 {
     $comment = Comments::findById(get_id());
     if (!$comment instanceof Comment) {
         flash_error(lang('comment dnx'));
         ajx_current("empty");
         return;
     }
     if (!$comment->canView(logged_user())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     $object = $comment->getRelObject();
     if (!$object instanceof ContentDataObject) {
         flash_error(lang('object dnx'));
         ajx_current("empty");
         return;
     }
     redirect_to($object->getViewUrl());
 }
开发者ID:rorteg,项目名称:fengoffice,代码行数:21,代码来源:CommentController.class.php


示例10: permissions

 /**
  * Show permission update form
  *
  * @param void
  * @return null
  */
 function permissions()
 {
     if (!active_project()->canChangePermissions(logged_user())) {
         flash_error(lang('no access permissions'));
         $this->redirectToUrl(active_project()->getOverviewUrl());
     }
     // if
     $project_init = array_var($_GET, 'project_init');
     tpl_assign('project_init', $project_init);
     tpl_assign('project_users', active_project()->getUsers(false));
     tpl_assign('project_companies', active_project()->getCompanies());
     tpl_assign('user_projects', logged_user()->getProjects());
     $permissions = PermissionManager::getPermissionsText();
     tpl_assign('permissions', $permissions);
     $companies = array(owner_company());
     $clients = owner_company()->getClientCompanies();
     if (is_array($clients)) {
         $companies = array_merge($companies, $clients);
     }
     // if
     tpl_assign('companies', $companies);
     if (array_var($_POST, 'process') == 'process') {
         try {
             DB::beginWork();
             active_project()->clearCompanies();
             active_project()->clearUsers();
             $companies = array(owner_company());
             $client_companies = owner_company()->getClientCompanies();
             if (is_array($client_companies)) {
                 $companies = array_merge($companies, $client_companies);
             }
             // if
             foreach ($companies as $company) {
                 // Company is selected!
                 if (array_var($_POST, 'project_company_' . $company->getId()) == 'checked') {
                     // Owner company is automaticly included so it does not need to be in project_companies table
                     if (!$company->isOwner()) {
                         $project_company = new ProjectCompany();
                         $project_company->setProjectId(active_project()->getId());
                         $project_company->setCompanyId($company->getId());
                         $project_company->save();
                     }
                     // if
                     $users = $company->getUsers();
                     if (is_array($users)) {
                         $counter = 0;
                         foreach ($users as $user) {
                             $user_id = $user->getId();
                             $counter++;
                             if (array_var($_POST, "project_user_{$user_id}") == 'checked') {
                                 $project_user = new ProjectUser();
                                 $project_user->setProjectId(active_project()->getId());
                                 $project_user->setUserId($user_id);
                                 foreach ($permissions as $permission => $permission_text) {
                                     // Owner company members have all permissions
                                     $permission_value = $company->isOwner() ? true : array_var($_POST, 'project_user_' . $user_id . '_' . $permission) == 'checked';
                                     $setter = 'set' . Inflector::camelize($permission);
                                     $project_user->{$setter}($permission_value);
                                 }
                                 // if
                                 $project_user->save();
                             }
                             // if
                         }
                         // foreach
                     }
                     // if
                 }
                 // if
             }
             // foreach
             DB::commit();
             flash_success(lang('success update project permissions'));
             if ($project_init) {
                 $this->redirectToUrl(active_project()->getEditUrl(active_project()->getOverviewUrl()));
             } else {
                 $this->redirectTo('project_settings', 'users');
             }
             // if
         } catch (Exception $e) {
             DB::rollback();
             flash_error(lang('error update project permissions'));
             $this->redirectTo('project_settings', 'permissions');
         }
         // try
     }
     // if
 }
开发者ID:bklein01,项目名称:Project-Pier,代码行数:94,代码来源:ProjectSettingsController.class.php


示例11: quick_add

	/**
	 * @author Ignacio Vazquez <elpepe.uy at gmail dot com>
	 * Handle quick add submit
	 */
	function quick_add() {
		if (array_var($_GET, 'current') == 'overview-panel') {
			ajx_current("reload");	
		}else {
			ajx_current("empty");
		}
		
		//---------- REQUEST PARAMS -------------- 
		//		$_POST = Array (
		//			[member] => Array (
		//				[name] => pepe 333
		//				[dimension_id] => 1
		//				[parent_member_id] => 0
		//				[dimension_id] => 19
		//			)
		//			[contact] => Array (
		//				[email] => [email protected]
		//				[user] => Array (
		//					[create-user]=>on
		//					[type] => 25
		//					[first_name] =>  
		// 					[surname] => 						
		//		)
		//----------------------------------------
		
		// Init variables

		$max_users = config_option('max_users');
		if ($max_users && (Contacts::count() >= $max_users)) {
			flash_error(lang('maximum number of users reached error'));
			ajx_current("empty");
			return;
		}

		if (!can_manage_security(logged_user())) {
			flash_error(lang('no access permissions'));
			ajx_current("empty");
			return;
		}
		
		$email = trim(array_var(array_var($_POST, 'contact'),'email')) ;
		$member = array_var($_POST, 'member');
		$name = array_var($member, 'name');
		$firstName = trim(array_var(array_var($_POST, 'contact'),'first_name'));
		$surname = trim(array_var(array_var($_POST, 'contact'),'surname'));
		$parentMemberId = array_var($member, 'parent_member_id');
		$objectType = ObjectTypes::findById(array_var($member, 'object_type_id'))->getName(); // 'person', 'company'
		$dimensionId =  array_var($member, 'dimension_id'); 		
		$company = array_var(array_var(array_var($_POST, 'contact'),'user'),'company_id');
                
		// Create new instance of Contact and set the basic fields
		$contact = new Contact();
		$contact->setObjectName($name);
		if ($firstName) {
			$contact->setFirstName($firstName);
		}else{
			$contact->setFirstName($name);	
		}
		
		if ($surname) {
			$contact->setSurname($surname);
		}
		
		$contact->setCompanyId($company);
		$contact->setIsCompany($objectType == "company");
		if ($parentMemberId){
			if ( $companyId = Members::findById($parentMemberId)->getObjectId()) {
				$contact->setCompanyId($companyId);
			}
		}
		
		
		// Save Contact
		try {
			DB::beginWork();
			$contact->save();
			if ($email && is_valid_email($email)) {
				if (!Contacts::validateUniqueEmail($email)) {
					DB::rollback();
					flash_error(lang("email address must be unique"));
					return false;
				}else{
					if (!array_var (array_var(array_var($_POST, 'contact'),'user'), 'create-user')) {
						$contact->addEmail($email, 'personal', true);
					}
					flash_success(lang("success add contact", $contact->getObjectName()));
				}
			}
			
			// User settings
			$user = array_var(array_var($_POST, 'contact'),'user');
			$user['username'] = str_replace(" ","",strtolower($name)) ;
			$this->createUserFromContactForm($user, $contact->getId(), $email);
			
			// Reload contact again due to 'createUserFromContactForm' changes
			Hook::fire("after_contact_quick_add", Contacts::instance()->findById($contact->getId()), $ret);
//.........这里部分代码省略.........
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:101,代码来源:ContactController.class.php


示例12: unarchive

 function unarchive()
 {
     if (!can_manage_dimension_members(logged_user())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     $member = Members::findById(get_id());
     if (!$member instanceof Member) {
         flash_error(lang('member dnx'));
         ajx_current("empty");
         return;
     }
     if (get_id('user')) {
         $user = Contacts::findById($get_id('user'));
     } else {
         $user = logged_user();
     }
     if (!$user instanceof Contact) {
         ajx_current("empty");
         return;
     }
     try {
         DB::beginWork();
         set_time_limit(0);
         $count = $member->unarchive($user);
         evt_add("reload dimension tree", $member->getDimensionId());
         ajx_current("back");
         flash_success(lang('success unarchive member', $member->getName(), $count));
         DB::commit();
     } catch (Exception $e) {
         DB::rollback();
         flash_error($e->getMessage());
         ajx_current("empty");
     }
 }
开发者ID:rorteg,项目名称:fengoffice,代码行数:36,代码来源:MemberController.class.php


示例13: delete_custom_report

 function delete_custom_report()
 {
     if (logged_user()->isGuest()) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     $report_id = array_var($_GET, 'id');
     $report = Reports::getReport($report_id);
     if (!$report->canDelete(logged_user())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     // if
     try {
         DB::beginWork();
         $report->delete();
         DB::commit();
         ajx_current("reload");
     } catch (Exception $e) {
         DB::rollback();
         flash_error($e->getMessage());
         ajx_current("empty");
     }
     // try
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:27,代码来源:ReportingController.class.php


示例14: update_unset_billing_values

 function update_unset_billing_values()
 {
     ajx_current("empty");
     if (!logged_user()->isAdministrator()) {
         flash_error(lang("no access permissions"));
         return;
     }
     try {
         DB::beginWork();
         $count = Timeslots::updateBillingValues();
         DB::commit();
         flash_success(lang("success update billing values", $count));
     } catch (Exception $e) {
         DB::rollback();
         flash_error($e->getMessage());
     }
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:17,代码来源:BillingController.class.php


示例15: move

 function move()
 {
     if (logged_user()->isGuest()) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     ajx_current("empty");
     $id = get_id();
     $to = array_var($_GET, 'to', 0);
     // TODO: check permissions
     $ws = Projects::findById($id);
     $parent = Projects::findById($to);
     if (isset($ws)) {
         if ($to == 0 || isset($parent)) {
             $ws->setParentId($to);
             $ws->save();
             evt_add('workspace_edited', array("is" => $ws->getId(), "name" => $ws->getId(), "color" => $ws->getId(), "parent" => $ws->getParentId()));
         }
     }
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:21,代码来源:ProjectController.class.php


示例16: repetitive_task_related_edit

 function repetitive_task_related_edit($task, $task_data)
 {
     $was_template = $task->getIsTemplate();
     $task->setFromAttributes($task_data);
     $task->setIsTemplate($was_template);
     // is_template value must not be changed from ui
     $totalMinutes = array_var($task_data, 'time_estimate_hours') * 60 + array_var($task_data, 'time_estimate_minutes');
     $task->setTimeEstimate($totalMinutes);
     if ($task->getParentId() > 0 && $task->hasChild($task->getParentId())) {
         flash_error(lang('task child of child error'));
         ajx_current("empty");
         return;
     }
     DB::beginWork();
     $task->save();
     $task->setObjectName(array_var($task_data, 'name'));
     $task->save();
     // dependencies
     if (config_option('use tasks dependencies')) {
         $previous_tasks = array_var($task_data, 'previous');
         if (is_array($previous_tasks)) {
             foreach ($previous_tasks as $ptask) {
                 if ($ptask == $task->getId()) {
                     continue;
                 }
                 $dep = ProjectTaskDependencies::findById(array('previous_task_id' => $ptask, 'task_id' => $task->getId()));
                 if (!$dep instanceof ProjectTaskDependency) {
                     $dep = new ProjectTaskDependency();
                     $dep->setPreviousTaskId($ptask);
                     $dep->setTaskId($task->getId());
                     $dep->save();
                 }
             }
             $saved_ptasks = ProjectTaskDependencies::findAll(array('conditions' => 'task_id = ' . $task->getId()));
             foreach ($saved_ptasks as $pdep) {
                 if (!in_array($pdep->getPreviousTaskId(), $previous_tasks)) {
                     $pdep->delete();
                 }
             }
         } else {
             ProjectTaskDependencies::delete('task_id = ' . $task->getId());
         }
     }
     // Add assigned user to the subscibers list
     if ($task->getAssignedToContactId() > 0 && Contacts::instance()->findById($task->getAssignedToContactId())) {
         if (!isset($_POST['subscribers'])) {
             $_POST['subscribers'] = array();
         }
         $_POST['subscribers']['user_' . $task->getAssignedToContactId()] = 'checked';
     }
     $object_controller = new ObjectController();
     $object_controller->add_to_members($task, array_var($task_data, 'members'));
     $object_controller->add_subscribers($task);
     $object_controller->link_to_new_object($task);
     $object_controller->add_custom_properties($task);
     $object_controller->add_reminders($task);
     // apply values to subtasks
     $assigned_to = $task->getAssignedToContactId();
     $subtasks = $task->getAllSubTasks();
     $milestone_id = $task->getMilestoneId();
     $apply_ms = array_var($task_data, 'apply_milestone_subtasks') == "checked";
     $apply_at = array_var($task_data, 'apply_assignee_subtasks', '') == "checked";
     foreach ($subtasks as $sub) {
         $modified = false;
         if ($apply_at || !($sub->getAssignedToContactId() > 0)) {
             $sub->setAssignedToContactId($assigned_to);
             $modified = true;
         }
         if ($apply_ms) {
             $sub->setMilestoneId($milestone_id);
             $modified = true;
         }
         if ($modified) {
             $sub->save();
         }
     }
     $task->resetIsRead();
     ApplicationLogs::createLog($task, ApplicationLogs::ACTION_EDIT);
     DB::commit();
 }
开发者ID:rorteg,项目名称:fengoffice,代码行数:80,代码来源:TaskController.class.php


示例17: detach_from_object

 /**
  * Detach file from related object
  *
  * @param void
  * @return null
  */
 function detach_from_object()
 {
     $manager_class = array_var($_GET, 'manager');
     $object_id = get_id('object_id');
     $file_id = get_id('file_id');
     $object = get_object_by_manager_and_id($object_id, $manager_class);
     if (!$object instanceof ProjectDataObject) {
         flash_error(lang('no access permissions'));
         $this->redirectToReferer(get_url('dashboard'));
     }
     // if
     $file = ProjectFiles::findById($file_id);
     if (!$file instanceof ProjectFile) {
         flash_error(lang('file dnx'));
         $this->redirectToReferer(get_url('dashboard'));
     }
     // if
     $attached_file = AttachedFiles::findById(array('rel_object_manager' => $manager_class, 'rel_object_id' => $object_id, 'file_id' => $file_id));
     // findById
     if (!$attached_file instanceof AttachedFile) {
         flash_error(lang('file not attached to object'));
         $this->redirectToReferer(get_url('dashboard'));
     }
     // if
     try {
         DB::beginWork();
         $attached_file->delete();
         DB::commit();
         flash_success(lang('success detach file'));
     } catch (Exception $e) {
         flash_error(lang('error detach file'));
         DB::rollback();
     }
     // try
     $this->redirectToReferer($object->getObjectUrl());
 }
开发者ID:469306621,项目名称:Languages,代码行数:42,代码来源:FilesController.class.php


示例18: delete_avatar

 /**
  * Delete avatar
  *
  * @param void
  * @return null
  */
 function delete_avatar()
 {
     $user = Users::findById(get_id());
     if (!$user instanceof User) {
         flash_error(lang('user dnx'));
         $this->redirectTo('dashboard');
     }
     // if
     if (!$user->canUpdateProfile(logged_user())) {
         flash_error(lang('no access permissions'));
         $this->redirectTo('dashboard');
     }
     // if
     $redirect_to = array_var($_GET, 'redirect_to');
     if (trim($redirect_to) == '' || !is_valid_url($redirect_to)) {
         $redirect_to = $user->getUpdateAvatarUrl();
     }
     // if
     tpl_assign('redirect_to', $redirect_to);
     if (!$user->hasAvatar()) {
         flash_error(lang('avatar dnx'));
         $this->redirectToUrl($redirect_to);
     }
     // if
     try {
         DB::beginWork();
         $user->deleteAvatar();
         $user->save();
         ApplicationLogs::createLog($user, null, ApplicationLogs::ACTION_EDIT);
         DB::commit();
         flash_success(lang('success delete avatar'));
     } catch (Exception $e) {
         DB::rollback();
         flash_error(lang('error delete avatar'));
     }
     // try
     $this->redirectToUrl($redirect_to);
 }
开发者ID:469306621,项目名称:Languages,代码行数:44,代码来源:AccountController.class.php


示例19: delete

 /**
  * Delete specific project form
  *
  * @param void
  * @return null
  */
 function delete()
 {
     $project_form = ProjectForms::findById(get_id());
     if (!$project_form instanceof ProjectForm) {
         flash_error(lang('project form dnx'));
         if (ProjectForm::canAdd(logged_user(), active_project())) {
             $this->redirectTo('form');
         } else {
             $this->redirectToUrl(active_project()->getOverviewUrl());
         }
         // if
     }
     // if
     if (!$project_form->canDelete(logged_user())) {
         flash_error(lang('no access permissions'));
         if (ProjectForm::canAdd(logged_user(), active_project())) {
             $this->redirectTo('form');
         } else {
             $this->redirectToUrl(active_project()->getOverviewUrl());
         }
         // if
     }
     // if
     if ($project_form->delete()) {
         ApplicationLogs::createLog($project_form, active_project(), ApplicationLogs::ACTION_DELETE, true);
         flash_success(lang('success delete project form', $project_form->getName()));
     } else {
         flash_error(lang('error delete project form'));
     }
     // if
     $this->redirectTo('form');
 }
开发者ID:469306621,项目名称:Languages,代码行数:38,代码来源:FormController.class.php


示例20: list_members

 function list_members()
 {
     if (!logged_user()->isAdminGroup()) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     ajx_set_no_toolbar();
     $dim_id = array_var($_REQUEST, 'dim', 0);
     $dimension = Dimensions::findById($dim_id);
     if (!$dimension instanceof Dimension) {
         flash_error(lang('dimension snx'));
         ajx_current("empty");
         return;
     }
     if (isset($_REQUEST['page'])) {
         ajx_replace(true);
     }
     // parameters
     $page = array_var($_REQUEST, 'page');
     $order_by = array_var($_REQUEST, 'order');
     $order_by_dir = array_var($_REQUEST, 'order_dir');
     // pagination params
     $items_x_page = array_var($_REQUEST, 'items_x_page', 20);
     if (!$page) {
         $page = 1;
     }
     $offset = $items_x_page * ($page - 1);
     // order defaults
     if (!$order_by) {
         $order_by = 'name';
     }
     if (!in_array($order_by_dir, array('ASC', 'DESC'))) {
         $order_by_dir = 'ASC';
     }
     // this function already checks dimension options
     $dim_name = $dimension->getName();
     // permissions sql
     $perm_sql = "";
     if ($dimension->getDefinesPermissions() && !logged_user()->isAdministrator()) {
         $pg_ids = logged_user()->getPermissionGroupIds();
         $perm_sql = " AND EXISTS (SELECT cmp.member_id FROM " . TABLE_PREFIX . "contact_member_permissions cmp WHERE cmp.member_id=m.id AND cmp.permission_group_id IN (" . implode(',', $pg_ids) . "))";
     }
     $main_sql = "SELECT m.id, l.created_on, l.created_by_id, l.member_id FROM " . TABLE_PREFIX . "members m LEFT JOIN " . TABLE_PREFIX . "application_logs l ON l.member_id=m.id AND l.action='add' WHERE m.dimension_id='{$dim_id}' {$perm_sql}";
     $sql = "{$main_sql}\r\n\t\t\t\tORDER BY {$order_by} {$order_by_dir} \r\n\t\t\t\tLIMIT {$offset}, {$items_x_page}";
     $rows = DB::executeAll($sql);
     $count_sql = str_replace("SELECT m.id, l.created_on, l.created_by_id, l.member_id FROM", "SELECT count(*) as total FROM", $main_sql);
     $count_row = DB::executeAll($count_sql);
     $members = array();
     $ids = array();
     $log_data = array();
     foreach ($rows as $row) {
         $members[] = Members::findById($row['id']);
         $log_data[$row['id']] = array('created_on' => $row['created_on'], 'created_by_id' => $row['created_by_id']);
     }
     $member_type_ids = array_flat(DB::executeAll("SELECT object_type_id FROM " . TABLE_PREFIX . "dimension_object_types WHERE dimension_id={$dim_id} AND is_root=1"));
     $member_types = ObjectTypes::findAll(array('conditions' => 'id IN (' . implode(',', $member_type_ids) . ')'));
     tpl_assign('members', $members);
     tpl_assign('log_data', $log_data);
     tpl_assign('dimension', $dimension);
     tpl_assign('dimension_name', $dim_name);
     tpl_assign('member_types', $member_types);
     tpl_assign('page', $page);
     tpl_assign('total_items', $count_row[0]['total']);
     tpl_assign('items_x_page', $items_x_page);
     tpl_assign('order_by', $order_by);
     tpl_assign('order_by_dir', $order_by_dir);
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:68,代码来源:DimensionController.class.php



注:本文中的flash_error函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP flash_get函数代码示例发布时间:2022-05-15
下一篇:
PHP flashMsg函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap