当前位置: 首页>>代码示例>>PHP>>正文


PHP ApplicationLogs::createLog方法代码示例

本文整理汇总了PHP中ApplicationLogs::createLog方法的典型用法代码示例。如果您正苦于以下问题:PHP ApplicationLogs::createLog方法的具体用法?PHP ApplicationLogs::createLog怎么用?PHP ApplicationLogs::createLog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ApplicationLogs的用法示例。


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

示例1: purge_trash

 function purge_trash()
 {
     Env::useHelper("permissions");
     $days = config_option("days_on_trash", 0);
     $count = 0;
     if ($days > 0) {
         $date = DateTimeValueLib::now()->add("d", -$days);
         $objects = Objects::findAll(array("conditions" => array("`trashed_by_id` > 0 AND `trashed_on` < ?", $date), "limit" => 100));
         foreach ($objects as $object) {
             $concrete_object = Objects::findObject($object->getId());
             if (!$concrete_object instanceof ContentDataObject) {
                 continue;
             }
             if ($concrete_object instanceof MailContent && $concrete_object->getIsDeleted() > 0) {
                 continue;
             }
             try {
                 DB::beginWork();
                 if ($concrete_object instanceof MailContent) {
                     $concrete_object->delete(false);
                 } else {
                     $concrete_object->delete();
                 }
                 ApplicationLogs::createLog($concrete_object, ApplicationLogs::ACTION_DELETE);
                 DB::commit();
                 $count++;
             } catch (Exception $e) {
                 DB::rollback();
                 Logger::log("Error delting object in purge_trash: " . $e->getMessage(), Logger::ERROR);
             }
         }
     }
     return $count;
 }
开发者ID:rorteg,项目名称:fengoffice,代码行数:34,代码来源:Trash.class.php

示例2: delete

 /**
  * Delete specific user
  *
  * @access public
  * @param void
  * @return null
  */
 function delete()
 {
     $this->setTemplate('del_user');
     $user = Users::findById(get_id());
     if (!$user instanceof User) {
         flash_error(lang('user dnx'));
         $this->redirectTo('administration');
     }
     // if
     if (!$user->canDelete(logged_user())) {
         flash_error(lang('no access permissions'));
         $this->redirectToReferer(get_url('dashboard'));
     }
     // if
     $delete_data = array_var($_POST, 'deleteUser');
     tpl_assign('user', $user);
     tpl_assign('delete_data', $delete_data);
     if (!is_array($delete_data)) {
         $delete_data = array('really' => 0, 'password' => '');
         // array
         tpl_assign('delete_data', $delete_data);
     } else {
         if ($delete_data['really'] == 1) {
             $password = $delete_data['password'];
             if (trim($password) == '') {
                 tpl_assign('error', new Error(lang('password value missing')));
                 return $this->render();
             }
             if (!logged_user()->isValidPassword($password)) {
                 tpl_assign('error', new Error(lang('invalid login data')));
                 return $this->render();
             }
             try {
                 DB::beginWork();
                 $user->delete();
                 ApplicationLogs::createLog($user, null, ApplicationLogs::ACTION_DELETE);
                 DB::commit();
                 flash_success(lang('success delete user', $user->getDisplayName()));
             } catch (Exception $e) {
                 DB::rollback();
                 flash_error(lang('error delete user'));
             }
             // try
             $this->redirectToUrl($user->getCompany()->getViewUrl());
         } else {
             flash_error(lang('error delete user'));
             $this->redirectToUrl($user->getCompany()->getViewUrl());
         }
     }
 }
开发者ID:bklein01,项目名称:Project-Pier,代码行数:57,代码来源:UserController.class.php

示例3: purge_trash

 function purge_trash()
 {
     Env::useHelper("permissions");
     $days = config_option("days_on_trash", 0);
     $count = 0;
     if ($days > 0) {
         $date = DateTimeValueLib::now()->add("d", -$days);
         $managers = array('Comments', 'Companies', 'Contacts', 'MailContents', 'ProjectCharts', 'ProjectEvents', 'ProjectFiles', 'ProjectFileRevisions', 'ProjectForms', 'ProjectMessages', 'ProjectMilestones', 'ProjectTasks', 'ProjectWebpages');
         foreach ($managers as $manager_class) {
             $manager = new $manager_class();
             $prevcount = -1;
             while ($prevcount != $count) {
                 $prevcount = $count;
                 if ($manager_class == 'MailContents') {
                     $objects = $manager->findAll(array("include_trashed" => true, "conditions" => array("`trashed_by_id` > 0 AND `trashed_on` < ? AND `is_deleted` = 0", $date), "limit" => 100));
                 } else {
                     $objects = $manager->findAll(array("include_trashed" => true, "conditions" => array("`trashed_by_id` > 0 AND `trashed_on` < ?", $date), "limit" => 100));
                 }
                 if (is_array($objects)) {
                     // delete one by one because each one knows what else to delete
                     foreach ($objects as $o) {
                         try {
                             DB::beginWork();
                             $ws = $o->getWorkspaces();
                             if ($o instanceof MailContent) {
                                 $o->delete(false);
                             } else {
                                 $o->delete();
                             }
                             ApplicationLogs::createLog($o, $ws, ApplicationLogs::ACTION_DELETE);
                             DB::commit();
                             $count++;
                         } catch (Exception $e) {
                             DB::rollback();
                             Logger::log("Error deleting object in purge_trash: " . $e->getMessage(), Logger::ERROR);
                         }
                     }
                 }
             }
         }
     }
     return $count;
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:43,代码来源:Trash.class.php

示例4: 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

示例5: open

 /**
  * Open specific milestone
  *
  * @access public
  * @param void
  * @return null
  */
 function open()
 {
     $milestone = ProjectMilestones::findById(get_id());
     if (!$milestone instanceof ProjectMilestone) {
         flash_error(lang('milestone dnx'));
         $this->redirectTo('milestone');
     }
     // if
     if (!$milestone->canChangeStatus(logged_user())) {
         flash_error(lang('no access permissions'));
         $this->redirectToReferer(get_url('milestone'));
     }
     // if
     try {
         $milestone->setCompletedOn(null);
         $milestone->setCompletedById(0);
         DB::beginWork();
         $milestone->save();
         ApplicationLogs::createLog($milestone, active_project(), ApplicationLogs::ACTION_OPEN);
         DB::commit();
         flash_success(lang('success open milestone', $milestone->getName()));
     } catch (Exception $e) {
         DB::rollback();
         flash_error(lang('error open milestone'));
     }
     // try
     $this->redirectToReferer($milestone->getViewUrl());
 }
开发者ID:ukd1,项目名称:Project-Pier,代码行数:35,代码来源:MilestoneController.class.php

示例6: delete_logo

	/**
	 * Delete company logo
	 *
	 * @param void
	 * @return null
	 */
	function delete_logo() {
		if(!logged_user()->isAdministrator()) {
			flash_error(lang('no access permissions'));
			ajx_current("empty");
			return;
		} // if

		$company = Contacts::findById(get_id());
		if(!($company instanceof Contact)) {
			flash_error(lang('company dnx'));
			ajx_current("empty");
			return;
		} // if

		try {
			DB::beginWork();
			$company->deleteLogo();
			$company->save();
			ApplicationLogs::createLog($company, ApplicationLogs::ACTION_EDIT);
			DB::commit();

			flash_success(lang('success delete company logo'));
			ajx_current("back");
		} catch(Exception $e) {
			DB::rollback();
			flash_error(lang('error delete company logo'));
			ajx_current("empty");
		} // try
	} // delete_logo
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:35,代码来源:ContactController.class.php

示例7: delete_category

 /**
  * Delete specific category
  *
  * @access public
  * @param void
  * @return null
  */
 function delete_category()
 {
     $category = ProjectCategories::findById(get_id());
     if (!$category instanceof ProjectCategory) {
         flash_error(lang('category dnx'));
         $this->redirectTo('tickets', 'categories');
     }
     // if
     if (!$category->canDelete(logged_user())) {
         flash_error(lang('no access permissions'));
         $this->redirectToReferer(get_url('tickets', 'categories'));
     }
     // if
     try {
         DB::beginWork();
         $category->delete();
         ApplicationLogs::createLog($category, $category->getProject(), ApplicationLogs::ACTION_DELETE);
         DB::commit();
         flash_success(lang('success deleted category', $category->getName()));
     } catch (Exception $e) {
         DB::rollback();
         flash_error(lang('error delete category'));
     }
     // try
     $this->redirectTo('tickets', 'categories');
 }
开发者ID:469306621,项目名称:Languages,代码行数:33,代码来源:TicketsController.class.php

示例8: delete

 /**
  * Delete project
  *
  * @param void
  * @return null
  */
 function delete()
 {
     if (logged_user()->isGuest()) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     $pid = get_id();
     $u = Users::findOne(array("conditions" => "personal_project_id = {$pid}"));
     if ($u) {
         //flash_error("id: $pid, u: ".$u->getId());
         ajx_current("empty");
         flash_error(lang('cannot delete personal project'));
         return;
         //$this->redirectTo('administration', 'projects');
     }
     $project = Projects::findById(get_id());
     if (!$project instanceof Project) {
         flash_error(lang('project dnx'));
         ajx_current("empty");
         return;
         //$this->redirectTo('administration', 'projects');
     }
     // if
     if (!$project->canDelete(logged_user())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
         //$this->redirectToReferer(get_url('administration', 'projects'));
     }
     // if
     if (!array_var($_GET, 'confirm')) {
         tpl_assign('project', $project);
         $this->setTemplate('pre_delete');
         return;
     }
     ajx_current("empty");
     try {
         $id = $project->getId();
         $name = $project->getName();
         DB::beginWork();
         $project->delete();
         CompanyWebsite::instance()->setProject(null);
         ApplicationLogs::createLog($project, null, ApplicationLogs::ACTION_DELETE);
         DB::commit();
         flash_success(lang('success delete project', $project->getName()));
         evt_add("workspace deleted", array("id" => $id, "name" => $name));
         ajx_current("start");
     } catch (Exception $e) {
         DB::rollback();
         flash_error($e->getMessage());
         ajx_current("empty");
     }
     // try
     //$this->redirectTo('administration', 'projects');
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:62,代码来源:ProjectController.class.php

示例9: fckimagesupload

	function fckimagesupload(){
		try {
			if ( isset( $_FILES['NewFile'] ) && !is_null( $_FILES['NewFile']['tmp_name'] ) )
			{
				$oFile = $_FILES['NewFile'] ;
			}else{
				$sErrorNumber = '202';
				echo $this->SendUploadResults( $sErrorNumber ) ;	
				return;
			}
			$sErrorNumber = '0' ;
			$sFileName = $oFile['name'] ;
			
			$file = new ProjectFile();
			$file->setFilename($sFileName);
						
			$file->setIsVisible(true);
			$file->setCreatedOn(new DateTimeValue(time()));		

	
			DB::beginWork();
			$file->save();
			//FIXME $workspaces = array(personal_project());
			/*FIXME if (is_array($workspaces)) {
				foreach ($workspaces as $ws) {
					$file->addToWorkspace($ws);
				}
			}*/
			$revision = $file->handleUploadedFile($oFile, true, '');
			ApplicationLogs::createLog($file, ApplicationLogs::ACTION_ADD);
			DB::commit();
			echo $this->SendUploadResults( $sErrorNumber, $file->getDownloadUrl() , $file->getFilename() ) ;
		} catch (Exception $e) {
			DB::rollback();			
			$sErrorNumber = '202';
			echo $this->SendUploadResults( $sErrorNumber ) ;
		}
		
	}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:39,代码来源:FilesController.class.php

示例10: uploadDocument

 function uploadDocument($doc_name, $ws_id, $path)
 {
     if (str_starts_with($doc_name, "~")) {
         return;
     }
     try {
         DB::beginWork();
         $project = Projects::findById($ws_id);
         //$file = ProjectFiles::findOne(array("conditions" => "`filename` = '$doc_name'"));
         $files = ProjectFiles::getAllByFilename($doc_name, $ws_id);
         if (is_array($files) && count($files) > 0) {
             $file = $files[0];
         } else {
             $file = null;
         }
         if (!$file instanceof ProjectFile) {
             $file = new ProjectFile();
             $file->setFilename($doc_name);
             $file->setIsVisible(true);
             $file->setIsPrivate(false);
             $file->setIsImportant(false);
             $file->setCommentsEnabled(true);
             $file->setAnonymousCommentsEnabled(false);
             //$file->setCreatedOn(new DateTimeValue(time()) );
         }
         $sourcePath = $path . $doc_name;
         $handle = fopen($sourcePath, "r");
         $size = filesize($sourcePath);
         $file_content = fread($handle, $size);
         fclose($handle);
         $file_dt['name'] = $file->getFilename();
         $file_dt['size'] = strlen($file_content);
         $file_dt['tmp_name'] = $sourcePath;
         //TEMP_PATH . DIRECTORY_SEPARATOR . rand() ;
         $extension = trim(get_file_extension($sourcePath));
         $file_dt['type'] = Mime_Types::instance()->get_type($extension);
         if (!trim($file_dt['type'])) {
             $file_dt['type'] = 'text/html';
         }
         $file->save();
         $file->removeFromAllWorkspaces();
         $file->addToWorkspace($project);
         $old_revs = $file->getRevisions();
         foreach ($old_revs as $rev) {
             $rev->delete();
         }
         $revision = $file->handleUploadedFile($file_dt, true, '');
         $file_date = new DateTimeValue(filemtime($sourcePath));
         $revision->setCreatedOn($file_date);
         $revision->setUpdatedOn($file_date);
         $revision->save();
         $file->setCreatedOn($file_date);
         $file->setUpdatedOn($file_date);
         $file->save();
         $ws = $file->getWorkspaces();
         ApplicationLogs::createLog($file, $ws, ApplicationLogs::ACTION_ADD);
         ImportLogger::instance()->log("   File: {$doc_name} [{$ws_id}]");
         print "   File: {$doc_name} [{$ws_id}]\r\n";
         DB::commit();
     } catch (Exception $e) {
         DB::rollback();
         ImportLogger::instance()->logError("{$e}\r\n**************************************************");
         print "\r\n\r\nERROR: {$e}\r\n";
     }
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:65,代码来源:ZipImport.class.php

示例11: logout

 /**
  * Log user out
  *
  * @access public
  * @param void
  * @return null
  */
 function logout()
 {
     ApplicationLogs::createLog(logged_user(), ApplicationLogs::ACTION_LOGOUT, false, false, true, get_ip_address());
     CompanyWebsite::instance()->logUserOut();
     $this->redirectTo('access', 'login');
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:13,代码来源:AccessController.class.php

示例12: addEmailToWorkspace

 function addEmailToWorkspace($id, $destination, $mantainWs = true)
 {
     $email = MailContents::findById($id);
     if ($email instanceof MailContent && $email->canEdit(logged_user())) {
         if (!$mantainWs) {
             $removed = "";
             $ws = $email->getWorkspaces();
             foreach ($ws as $w) {
                 if (can_add(logged_user(), $w, 'MailContents')) {
                     $email->removeFromWorkspace($w);
                     $removed .= $w->getId() . ",";
                 }
             }
             $removed = substr($removed, 0, -1);
             $log_action = ApplicationLogs::ACTION_MOVE;
             $log_data = ($removed == "" ? "" : "from:{$removed};") . "to:" . $destination->getId();
         } else {
             $log_action = ApplicationLogs::ACTION_COPY;
             $log_data = "to:" . $destination->getId();
         }
         $email->addToWorkspace($destination);
         ApplicationLogs::createLog($email, $email->getWorkspaces(), $log_action, false, null, true, $log_data);
         return 1;
     } else {
         return 0;
     }
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:27,代码来源:MailController.class.php

示例13: delete

 /**
  * Delete group
  *
  * @param void
  * @return null
  */
 function delete()
 {
     if (!can_manage_security(logged_user())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     // if
     $group = Groups::findById(get_id());
     if (!$group instanceof Group) {
         flash_error(lang('group dnx'));
         ajx_current("empty");
         return;
     }
     // if
     try {
         DB::beginWork();
         $group->delete();
         ApplicationLogs::createLog($group, null, ApplicationLogs::ACTION_DELETE);
         DB::commit();
         flash_success(lang('success delete group', $group->getName()));
         ajx_current("reload");
     } catch (Exception $e) {
         DB::rollback();
         flash_error(lang('error delete group'));
         ajx_current("empty");
     }
     // try
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:35,代码来源:GroupController.class.php

示例14: delete

 function delete()
 {
     if (!can_manage_templates(logged_user())) {
         flash_error(lang("no access permissions"));
         ajx_current("empty");
         return;
     }
     ajx_current("empty");
     $cotemplate = COTemplates::findById(get_id());
     if (!$cotemplate instanceof COTemplate) {
         flash_error(lang('template dnx'));
         return;
     }
     // if
     if (!$cotemplate->canDelete(logged_user())) {
         flash_error(lang('no access permissions'));
         return;
     }
     // if
     try {
         DB::beginWork();
         $cotemplate->delete();
         ApplicationLogs::createLog($cotemplate, ApplicationLogs::ACTION_DELETE);
         DB::commit();
         flash_success(lang('success delete template', $cotemplate->getObjectName()));
         if (array_var($_GET, 'popup', false)) {
             ajx_current("reload");
         } else {
             ajx_current("back");
         }
     } catch (Exception $e) {
         DB::rollback();
         flash_error($e->getMessage());
     }
     // try
 }
开发者ID:rorteg,项目名称:fengoffice,代码行数:36,代码来源:TemplateController.class.php

示例15: delete_link

 /**
  * Delete project link
  *
  * @param void
  * @return null
  */
 function delete_link()
 {
     $project_link = ProjectLinks::findById(get_id());
     if (!ProjectLink::canEdit(logged_user())) {
         flash_error(lang('no access permissions'));
         $this->redirectTo('links', 'index');
     }
     // if
     if (!$project_link instanceof ProjectLink) {
         flash_error(lang('project link dnx'));
         $this->redirectTo('links');
     }
     // if
     try {
         DB::beginWork();
         $project_link->delete();
         ApplicationLogs::createLog($project_link, active_project(), ApplicationLogs::ACTION_DELETE);
         DB::commit();
         flash_success(lang('success delete link', $project_link->getTitle()));
         $this->redirectTo('links');
     } catch (Exception $e) {
         DB::rollback();
         tpl_assign('error', $e);
     }
     // try
 }
开发者ID:469306621,项目名称:Languages,代码行数:32,代码来源:LinksController.class.php


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