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


PHP ApplicationLogs::findAll方法代码示例

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


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

示例1: execute


//.........这里部分代码省略.........
         }
         if (!defined('MAX_SEARCHABLE_FILE_SIZE')) {
             define('MAX_SEARCHABLE_FILE_SIZE', 1048576);
         }
         try {
             DB::connect(DB_ADAPTER, array('host' => DB_HOST, 'user' => DB_USER, 'pass' => DB_PASS, 'name' => DB_NAME, 'persist' => DB_PERSIST));
             if (defined('DB_CHARSET') && trim(DB_CHARSET)) {
                 DB::execute("SET NAMES ?", DB_CHARSET);
             }
         } catch (Exception $e) {
             $this->printMessage("Error connecting to database: " . $e->getMessage() . "\n" . $e->getTraceAsString());
         }
         try {
             $db_result = DB::execute("SELECT value FROM " . $t_prefix . "config_options WHERE name = 'file_storage_adapter'");
             $db_result_row = $db_result->fetchRow();
             if ($db_result_row['value'] == FILE_STORAGE_FILE_SYSTEM) {
                 if (!defined('FILES_DIR')) {
                     define('FILES_DIR', ROOT . '/upload');
                 }
                 FileRepository::setBackend(new FileRepository_Backend_FileSystem(FILES_DIR, TABLE_PREFIX));
             } else {
                 FileRepository::setBackend(new FileRepository_Backend_DB(TABLE_PREFIX));
             }
             PublicFiles::setRepositoryPath(ROOT . '/public/files');
             if (!defined('PUBLIC_FOLDER')) {
                 define('PUBLIC_FOLDER', 'public');
             }
             if (trim(PUBLIC_FOLDER) == '') {
                 PublicFiles::setRepositoryUrl(with_slash(ROOT_URL) . 'files');
             } else {
                 PublicFiles::setRepositoryUrl(with_slash(ROOT_URL) . 'public/files');
             }
             $member_parents = array();
             $members = Members::findAll();
             foreach ($members as $member) {
                 $member_parents[$member->getId()] = $member->getAllParentMembersInHierarchy(false, false);
             }
             $object_members = DB::executeAll('SELECT * FROM ' . $t_prefix . 'object_members WHERE is_optimization=0 and not exists (SELECT x.object_id FROM ' . $t_prefix . 'object_members x where x.object_id=fo_object_members.object_id and x.is_optimization=1)');
             foreach ($object_members as $om) {
                 $parents = isset($member_parents[$om['member_id']]) ? $member_parents[$om['member_id']] : array();
                 if (count($parents) > 0) {
                     $sql_values = "";
                     foreach ($parents as $p) {
                         $sql_values .= ($sql_values == "" ? "" : ",") . "(" . $om['object_id'] . "," . $p->getId() . ",1)";
                     }
                     $sql = "INSERT INTO " . $t_prefix . "object_members (object_id, member_id, is_optimization) VALUES {$sql_values} ON DUPLICATE KEY UPDATE is_optimization=1;";
                     DB::execute($sql);
                 }
             }
             $this->printMessage("Finished generating Object Members");
             foreach ($members as $m) {
                 if ($m->getParentMember() instanceof Member && $m->getDimensionId() != $m->getParentMember()->getDimensionId()) {
                     $m->setDimensionId($m->getParentMember()->getDimensionId());
                     $m->save();
                 }
             }
             $app_move_logs = ApplicationLogs::findAll(array("conditions" => "action = 'move'"));
             foreach ($app_move_logs as &$app_log) {
                 /* @var $app_log ApplicationLog */
                 $exp_log_data = explode(";", $app_log->getLogData());
                 if (count($exp_log_data) > 1) {
                     $old_to = array_var($exp_log_data, 1);
                     $old_from = array_var($exp_log_data, 0);
                 } else {
                     $old_to = array_var($exp_log_data, 0);
                     $old_from = "";
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:67,代码来源:AsadoUpgradeScript.class.php

示例2: getLastActivities

 static function getLastActivities()
 {
     $members = active_context_members(false);
     // Context Members Ids
     $options = explode(",", user_config_option("filters_dashboard", null, null, true));
     $extra_conditions = "action <> 'login' AND action <> 'logout' AND action <> 'subscribe' AND created_by_id > '0'";
     if ($options[1] == 0) {
         //do not show timeslots
         $extra_conditions .= "AND action <> 'open' AND action <> 'close' AND ((action <> 'add' OR action <> 'edit' OR action <> 'delete') AND object_name NOT LIKE 'Time%')";
     }
     // task assignment conditions
     if (!SystemPermissions::userHasSystemPermission(logged_user(), 'can_see_assigned_to_other_tasks')) {
         $extra_conditions .= " AND IF((SELECT o.object_type_id FROM " . TABLE_PREFIX . "objects o WHERE o.id=rel_object_id)=(SELECT ot.id FROM " . TABLE_PREFIX . "object_types ot WHERE ot.name='task'),\r\n\t\t\t\t(SELECT t.assigned_to_contact_id FROM " . TABLE_PREFIX . "project_tasks t WHERE t.object_id=rel_object_id) = " . logged_user()->getId() . ",\r\n\t\t\t\ttrue)";
     }
     //do not display template tasks logs
     $extra_conditions .= " AND IF((SELECT o.object_type_id FROM " . TABLE_PREFIX . "objects o WHERE o.id=rel_object_id)=(SELECT ot.id FROM " . TABLE_PREFIX . "object_types ot WHERE ot.name='template_task'), false, true)";
     // if logged user is guest dont show other users logs
     if (logged_user()->isGuest()) {
         $extra_conditions .= " AND `created_by_id`=" . logged_user()->getId();
     }
     $members_sql = "";
     $is_member_child = "";
     if (count($members) > 0) {
         $members_sql = "(EXISTS(\r\n\t\t\t\tSELECT om.object_id FROM  " . TABLE_PREFIX . "object_members om\r\n\t\t\t\tWHERE om.member_id IN (" . implode(',', $members) . ") AND rel_object_id = om.object_id\r\n\t\t\t\tGROUP BY object_id\r\n\t\t\t\tHAVING count(member_id) = " . count($members) . "\r\n\t\t\t))";
         $is_member_child = "AND mem.parent_member_id IN (" . implode(',', $members) . ")";
     }
     //permissions
     $logged_user_pgs = implode(',', logged_user()->getPermissionGroupIds());
     $permissions_condition = "al.rel_object_id IN (\r\n\t\tSELECT sh.object_id FROM " . TABLE_PREFIX . "sharing_table sh\r\n\t\tWHERE al.rel_object_id = sh.object_id AND sh.object_id > 0\r\n\t\tAND sh.group_id  IN ({$logged_user_pgs})\r\n\t\t)";
     $sql = "SELECT al.id FROM " . TABLE_PREFIX . "application_logs al \r\n\t\t\t\tWHERE {$permissions_condition} AND {$extra_conditions}";
     if ($members_sql != "") {
         $sql .= " AND {$members_sql}";
         //do not display users logs
         $sql .= " AND NOT EXISTS(SELECT con.object_id FROM " . TABLE_PREFIX . "contacts con WHERE con.object_id=rel_object_id AND user_type > 0)";
     }
     $sql .= " ORDER BY created_on DESC LIMIT 100";
     $id_rows = array_flat(DB::executeAll($sql));
     // if logged user is guest dont show other users logs
     $user_condition = "";
     if (logged_user()->isGuest()) {
         $user_condition .= " AND `created_by_id`=" . logged_user()->getId();
     }
     $member_logs_sql = "SELECT al.id FROM " . TABLE_PREFIX . "application_logs al\r\n\t\t\t\t\t\t\t\t\tINNER JOIN " . TABLE_PREFIX . "members mem ON mem.id=al.member_id \r\n\t\t\t\t\t\t\t\t\t\tINNER JOIN " . TABLE_PREFIX . "contact_member_cache cmcache ON cmcache.member_id=mem.id AND cmcache.contact_id = " . logged_user()->getId() . "\r\n\t\t\t\t\t\t\t\t\t\t\tWHERE al.member_id>0\r\n\t\t\t\t\t\t\t\t\t\t\t{$user_condition}\r\n\t\t\t\t\t\t\t\t\t\t\t{$is_member_child}\r\n\t\t\t\t\t\t\tORDER BY created_on DESC LIMIT 100";
     $m_id_rows = array_flat(DB::executeAll($member_logs_sql));
     $id_rows = array_filter(array_merge($id_rows, $m_id_rows));
     $logs = array();
     if (count($id_rows) > 0) {
         $logs = ApplicationLogs::findAll(array("condition" => "id IN (" . implode(',', $id_rows) . ")", "order" => "created_on DESC"));
     }
     return $logs;
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:51,代码来源:ApplicationLogs.class.php

示例3: getLastActivities

	static function getLastActivities() {
		$members = active_context_members(false); // Context Members Ids
		$options = explode(",",user_config_option("filters_dashboard",null,null,true));

		$extra_conditions = "action <> 'login' AND action <> 'logout' AND action <> 'subscribe' ";
		if($options[1] == 0){//do not show timeslots
			$extra_conditions .= "AND action <> 'open' AND action <> 'close' AND ((action <> 'add' OR action <> 'edit' OR action <> 'delete') AND object_name NOT LIKE 'Time%')";
		}
		
		// task assignment conditions
		if (!SystemPermissions::userHasSystemPermission(logged_user(), 'can_see_assigned_to_other_tasks')) {
			$extra_conditions .= " AND IF((SELECT o.object_type_id FROM ".TABLE_PREFIX."objects o WHERE o.id=rel_object_id)=(SELECT ot.id FROM ".TABLE_PREFIX."object_types ot WHERE ot.name='task'),
				(SELECT t.assigned_to_contact_id FROM ".TABLE_PREFIX."project_tasks t WHERE t.object_id=rel_object_id) = ".logged_user()->getId().",
				true)";
		}

		$members_sql = "";
		if(count($members) > 0){
			$object_ids_rows = DB::executeAll("SELECT object_id FROM " . TABLE_PREFIX . "object_members om
				WHERE member_id IN (" . implode ( ',', $members ) . ")
				GROUP BY object_id HAVING count(member_id) = ".count($members)."");
			
			$object_ids = implode(',', array_flat($object_ids_rows));
			if ($object_ids == "") $object_ids = "0";
			$members_sql = "rel_object_id IN ($object_ids)";
		}

		$permissions_sql = "AND rel_object_id IN (
			SELECT object_id FROM ".TABLE_PREFIX."sharing_table
			WHERE group_id  IN (SELECT permission_group_id FROM ".TABLE_PREFIX."contact_permission_groups WHERE contact_id = ".logged_user()->getId().")
		)";

		$condition = ($members_sql != "" ? $members_sql . " AND " : "") . $extra_conditions . $permissions_sql;
		return ApplicationLogs::findAll(array(
			"condition" => $condition,
			"order" => "created_on DESC",
			"limit" => "100"
		));
	}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:39,代码来源:ApplicationLogs.class.php

示例4: send_reports

 function send_reports()
 {
     $company = Companies::findById(1);
     $lTime = time() + 60 * 60 * $company->getTimezone();
     $dayOfWeek = date("l", $lTime);
     $footer = '<a href="' . externalUrl(ROOT_URL) . '">' . externalUrl(ROOT_URL) . "</a>";
     $people = Reminders::findAll(array('conditions' => 'reports_enabled = 1 and report_day = "' . $dayOfWeek . '"'));
     if (is_array($people) && count($people)) {
         foreach ($people as $person) {
             tpl_assign('settings', $person);
             $user = Users::findById($person->getUserId());
             tpl_assign('user', $user);
             $offset = 60 * 60 * $user->getTimezone();
             tpl_assign('offset', $offset);
             $allProjects = $user->getProjects();
             $emailBody = '';
             $recipient = Notifier::prepareEmailAddress($user->getEmail(), $user->getDisplayName());
             foreach ($allProjects as $project) {
                 if ($project->isActive() || $project->getCompletedOn()->getLeftInDays() > -7) {
                     tpl_assign('project', $project);
                     $condition = 'project_id = ' . $project->getId();
                     $condition .= " and is_private = 0 and is_silent = 0";
                     if (!$person->getReportsIncludeEveryone()) {
                         $condition .= ' and taken_by_id = ' . $user->getId();
                     }
                     $logs = array();
                     if ($person->getReportsIncludeActivity()) {
                         $condition .= " and created_on > Interval -7 day + now()";
                         $logs = ApplicationLogs::findAll(array('conditions' => $condition));
                     }
                     tpl_assign('logs', $logs);
                     $taskLists = $project->getAllTaskLists();
                     $emailTaskLists = array();
                     if (is_array($taskLists) && count($taskLists)) {
                         foreach ($taskLists as $taskList) {
                             $condition = 'task_list_id = ' . $taskList->getId();
                             if (!$person->getReportsIncludeEveryone()) {
                                 $condition .= " and assigned_to_user_id = " . $user->getId();
                             }
                             $condition .= " and completed_on > Interval -7 day + now()";
                             $tasks = ProjectTasks::findAll(array('conditions' => $condition));
                             if (is_array($tasks) && count($tasks)) {
                                 $emailTaskLists[] = $taskList;
                             }
                         }
                     }
                     if (count($emailTaskLists) || count($logs)) {
                         tpl_assign('taskLists', $emailTaskLists);
                         $emailBody .= tpl_fetch(get_template_path('report_per_project', 'reminders'));
                         if ($person->getReportsSummarizedBy()) {
                             try {
                                 Notifier::sendEmail($recipient, $recipient, "[ProjectPier] - Project Report - " . $project->getObjectName(), $emailBody . $footer, 'text/html');
                                 // send
                                 $emailBody = '';
                             } catch (Exception $e) {
                                 echo $e;
                             }
                         }
                     }
                 }
             }
             if (strlen($emailBody) && !$person->getReportsSummarizedBy()) {
                 $time = time() + 60 * 60 * $user->getTimezone();
                 try {
                     Notifier::sendEmail($recipient, $recipient, "[ProjectPier] - Activity Report - " . gmdate('Y/m/d', $time), $emailBody . $footer, 'text/html');
                     // send
                     $emailBody = '';
                 } catch (Exception $e) {
                     echo $e;
                 }
             }
         }
     }
 }
开发者ID:bklein01,项目名称:Project-Pier,代码行数:74,代码来源:RemindersController.class.php


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