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


PHP active_context函数代码示例

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


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

示例1: getWorkspaces

 static function getWorkspaces($limit = 10)
 {
     $ws_dim = Dimensions::findByCode('workspaces');
     $ws_object_type = self::instance()->getObjectTypeId();
     $sql = "dimension_id = " . $ws_dim->getId() . " AND object_type_id = {$ws_object_type}";
     $allowed_members = array();
     $add_ctx_members = true;
     $context = active_context();
     foreach ($context as $selection) {
         if ($selection instanceof Dimension && $selection->getCode() == 'workspaces') {
             $add_ctx_members = false;
         } else {
             if ($selection instanceof Member && $selection->getObjectTypeId() == $ws_object_type) {
                 $allowed_members[] = $selection->getId();
             }
         }
     }
     if ($add_ctx_members && count($allowed_members) > 0) {
         $sql .= " AND parent_member_id IN (" . implode(",", $allowed_members) . ")";
     } else {
         $sql .= " AND parent_member_id = 0";
     }
     $members = Members::findAll(array('conditions' => $sql, 'order' => 'name'));
     $res = array();
     foreach ($members as $mem) {
         // controlar permissos para cada fucking miembro
     }
     return $members;
 }
开发者ID:rorteg,项目名称:fengoffice,代码行数:29,代码来源:Workspaces.class.php

示例2: getActiveMilestonesByUser

 /**
  * Returns milestones from active context and parent members of the active context
  *
  * @param User $user
  * @return array
  */
 static function getActiveMilestonesByUser(Contact $user, $context = null)
 {
     if (is_null($context)) {
         $context = active_context();
     }
     $parents = array();
     foreach ($context as $k => $member) {
         if ($member instanceof Member) {
             $tmp = $member->getParentMember();
             while ($tmp != null) {
                 $parents[] = $tmp->getId();
                 $tmp = $tmp->getParentMember();
             }
         }
     }
     $extra_conditions = "";
     /*
     if (count($parents) > 0) {
     	$extra_conditions = "OR EXISTS (SELECT `aux`.`object_id` FROM ".ObjectMembers::instance()->getTableName(true)." `aux` WHERE `aux`.`is_optimization` = 0 
     		AND `aux`.`object_id`=`om`.`object_id` AND `aux`.`member_id` IN (".implode(",",$parents)."))";
     }
     
     $result = ProjectMilestones::getContentObjects($context, ObjectTypes::findById(ProjectMilestones::instance()->getObjectTypeId()), null, null, $extra_conditions);
     */
     $result = ProjectMilestones::instance()->listing(array("extra_conditions" => $extra_conditions, "extra_member_ids" => $parents));
     $milestones = $result->objects;
     return $milestones;
 }
开发者ID:rorteg,项目名称:fengoffice,代码行数:34,代码来源:ProjectMilestones.class.php

示例3: getActiveMilestonesByUser

	/**
	 * Returns milestones from active context and parent members of the active context
	 *
	 * @param User $user
	 * @return array
	 */
	static function getActiveMilestonesByUser(Contact $user, $context = null) {
		if (is_null($context)) {
			$context = active_context();
		}
		$members = array();
		$parents = array();
		foreach ($context as $k => $member) {
			if ($member instanceof Member) {
				if ($member->getDimension()->getCode() == 'tags') continue;
				$members[] = $member->getId();
				$tmp = $member->getParentMember();
				while ($tmp != null){
					$parents[] = $tmp->getId();
					$tmp = $tmp->getParentMember();
				}
			}
		}
		
		$result = ProjectMilestones::instance()->listing(array(
			"ignore_context" => true,
			"member_ids" => $members,
			"extra_member_ids" => $parents
		));
		$milestones = $result->objects;
		return $milestones;
	} // getActiveMilestonesByUser
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:32,代码来源:ProjectMilestones.class.php

示例4: core_dimensions_after_add_to_members

function core_dimensions_after_add_to_members($object, &$ignored)
{
    if ($object instanceof Report || $object instanceof Timeslot) {
        return;
    }
    // Add to persons and users dimensions
    $user_ids = array();
    if (logged_user() instanceof Contact) {
        $user_ids[] = logged_user()->getId();
    }
    if ($object instanceof ProjectTask) {
        /* @var $object ProjectTask */
        if ($object->getAssignedById() > 0) {
            $user_ids[] = $object->getAssignedById();
        }
        if ($object->getAssignedToContactId() > 0) {
            $user_ids[] = $object->getAssignedToContactId();
        }
    }
    if ($object instanceof ProjectEvent) {
        /* @var $object ProjectEvent */
        $invitations = EventInvitations::findAll(array("conditions" => "`event_id` = " . $object->getId()));
        foreach ($invitations as $inv) {
            $user_ids[] = $inv->getContactId();
        }
    }
    if ($object instanceof Contact && !$object->isUser()) {
        $member = Members::findOne(array("conditions" => "`object_id` = (" . $object->getId() . ") AND `dimension_id` = (SELECT `id` FROM `" . TABLE_PREFIX . "dimensions` WHERE `code` = 'feng_persons')"));
        if ($member instanceof Member) {
            $object->addToMembers(array($member));
        }
    }
    $context = active_context();
    if (count($context) > 0) {
        foreach ($context as $selection) {
            if ($selection instanceof Member && $selection->getDimension()->getCode() == 'feng_persons') {
                $object->addToMembers(array($selection));
            }
        }
    }
    core_dim_add_to_person_user_dimensions($object, $user_ids);
}
开发者ID:rorteg,项目名称:fengoffice,代码行数:42,代码来源:core_dimensions_hooks.php

示例5: getActiveMilestonesByUser

 /**
  * Returns milestones from active context and parent members of the active context
  *
  * @param User $user
  * @return array
  */
 static function getActiveMilestonesByUser(Contact $user, $context = null)
 {
     if (is_null($context)) {
         $context = active_context();
     }
     $filter_option = config_option('milestone_selector_filter');
     $members = array();
     $parents = array();
     if ($filter_option == 'current_and_parents' || $filter_option == 'current') {
         foreach ($context as $k => $member) {
             if ($member instanceof Member) {
                 if ($member->getDimension()->getCode() == 'tags') {
                     continue;
                 }
                 $members[] = $member->getId();
                 if ($filter_option == 'current_and_parents') {
                     $tmp = $member->getParentMember();
                     while ($tmp != null) {
                         $parents[] = $tmp->getId();
                         $tmp = $tmp->getParentMember();
                     }
                 }
             }
         }
     }
     $members = array_merge($members, $parents);
     $pgs = logged_user()->getPermissionGroupIds();
     if (count($pgs) == 0) {
         $pgs[] = 0;
     }
     $permission_conditions = "EXISTS(SELECT sh.object_id FROM " . TABLE_PREFIX . "sharing_table sh WHERE sh.object_id=o.id AND sh.group_id IN (" . implode(',', $pgs) . "))";
     if ($filter_option != 'all' && count($members) > 0) {
         $member_conditions = " AND EXISTS(SELECT om.object_id FROM " . TABLE_PREFIX . "object_members om WHERE om.object_id=o.id AND om.member_id IN (" . implode(',', $members) . "))";
     } else {
         $member_conditions = "";
     }
     $conditions = "trashed_by_id = 0 AND archived_by_id = 0 AND {$permission_conditions} {$member_conditions}";
     $milestones = ProjectMilestones::findAll(array('conditions' => $conditions, 'order' => 'name'));
     return $milestones;
 }
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:46,代码来源:ProjectMilestones.class.php

示例6: get_member_childs

 function get_member_childs()
 {
     $mem_id = array_var($_GET, 'member');
     $offset = array_var($_REQUEST, 'offset', 0);
     $limit = array_var($_REQUEST, 'limit', 100);
     $new_limit = $limit + 1;
     if (function_exists('logged_user') && logged_user() instanceof Contact && ContactMemberPermissions::contactCanAccessMemberAll(implode(',', logged_user()->getPermissionGroupIds()), $mem_id, logged_user(), ACCESS_LEVEL_READ)) {
         $mem = Members::getMemberById($mem_id);
         if ($mem instanceof Member) {
             //Do not use contact member cache for superadmins
             if (!logged_user()->isAdministrator()) {
                 //use the contact member cache
                 $dimension = $mem->getDimension();
                 $params = array("dimension" => $dimension, "contact_id" => logged_user()->getId(), "parent_member_id" => $mem->getId(), "extra_condition" => " AND m.archived_by_id=0 ", "start" => $offset, "limit" => $new_limit, "order" => '`name`', "order_dir" => 'ASC');
                 $childs = $member_cache_list = ContactMemberCaches::getAllMembersWithCachedParentId($params);
             } else {
                 $childs = Members::getSubmembers($mem, false, "", null, null, $offset, $new_limit);
             }
             $more_nodes_left = false;
             if (count($childs) > $limit) {
                 $more_nodes_left = true;
                 array_pop($childs);
             }
             // filter $childs by other dimension associations
             $context = active_context();
             $filter_by_members = array();
             foreach ($context as $selection) {
                 if ($selection instanceof Member) {
                     $filter_by_members[] = $selection;
                 }
             }
             // build resultant member list
             $members = $this->buildMemberList($childs, $mem->getDimension(), null, null, null, null);
             ajx_extra_data(array("members" => $members, "dimension" => $mem->getDimensionId(), "member_id" => $mem->getId(), "more_nodes_left" => $more_nodes_left));
         }
     }
     ajx_current("empty");
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:38,代码来源:DimensionController.class.php

示例7: isset

     $w = $day_of_month - $lastday;
 }
 $day_tmp = isset($w) && is_numeric($w) ? $w : 0;
 $dates[$day_of_week] = new DateTimeValue(mktime(0, 0, 0, $month_aux, $day_tmp, $year_aux));
 $today_style[$day_of_week] = '';
 if ($currentyear == $dates[$day_of_week]->getYear() && $currentmonth == $dates[$day_of_week]->getMonth() && $currentday == $dates[$day_of_week]->getday()) {
     // Today
     $drawHourLine = true;
     $today_style[$day_of_week] = 'background-color:#FFFF88;opacity:0.4;filter: alpha(opacity = 40);z-index=0;';
 } else {
     if ($year == $year_aux && $month == $month_aux && $day == $day_of_month) {
         // Selected day
         $today_style[$day_of_week] = 'background-color:#E4EEEE;opacity:0.4;filter: alpha(opacity = 40);z-index=0;';
     }
 }
 $results[$day_of_week] = ProjectEvents::getDayProjectEvents($dates[$day_of_week], active_context(), $user_filter, $status_filter);
 if (!$results[$day_of_week]) {
     $results[$day_of_week] = array();
 }
 foreach ($results[$day_of_week] as $key => $event) {
     if ($event->getTypeId() > 1) {
         $alldayevents[$day_of_week][] = $event;
         unset($results[$day_of_week][$key]);
     }
 }
 if (is_array($milestones)) {
     foreach ($milestones as $milestone) {
         $due_date = new DateTimeValue($milestone->getDueDate()->getTimestamp() + logged_user()->getTimezone() * 3600);
         if ($dates[$day_of_week]->getTimestamp() == mktime(0, 0, 0, $due_date->getMonth(), $due_date->getDay(), $due_date->getYear())) {
             $alldayevents[$day_of_week][] = $milestone;
         }
开发者ID:rorteg,项目名称:fengoffice,代码行数:31,代码来源:viewweek5days.php

示例8: require_javascript

<?php
require_javascript('og/modules/addMessageForm.js'); 
?>

<form id="<?php echo $genid . 'add-User-Form'?>" class="internalForm" style="height: 100%;width: 100%; overflow: auto;" action="<?php echo get_url("object","add_subscribers_from_object_view",array('object_id'=>$object->getId()))?>" method="post">
<div class="og-add-subscribers">
<?php
	if (!isset($genid)) $genid = gen_id();
	if (!is_array($subscriberIds)) $subscriberIds = array(logged_user()->getId());
	
	// build context to retrieve allowed users, exclude users and persons dimensions
	$context_tmp = active_context();
	$members = $object->getMembers();
	$context = array();
	foreach ($context_tmp as $selection) {
		$dimension = ($selection instanceof Member ? $selection->getDimension() : $selection);
		if (in_array($dimension->getCode(), array('feng_persons', 'feng_users'))) continue;
		$replace_with = null;
		foreach ($members as $member) {
			if ($dimension->getId() == $member->getDimensionId()) {
				if (is_null($replace_with)) $replace_with = array();
				$replace_with[] = $member;
			}
		}
		if (!is_null($replace_with)) {
			foreach ($replace_with as $rw) $context[] = $rw;
		}
		else $context[] = $dimension;
	}
	
	$allowed_users = allowed_users_in_context($object->getObjectTypeId(), $context, ACCESS_LEVEL_READ);
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:31,代码来源:add_subscribers_list.php

示例9: gen_id

<?php

$genid = gen_id();
$selectedPage = user_config_option('custom_report_tab');
$customReports = Reports::getAllReportsByObjectType();
$report = new Report();
$can_add_reports = $report->canAdd(logged_user(), active_context());
$reportPages = array();
$object_types = ObjectTypes::getAvailableObjectTypes();
foreach ($object_types as $ot) {
    $reportPages[$ot->getId()] = array("name" => $ot->getName(), "display_name" => lang($ot->getName()));
}
$ignored = null;
Hook::fire('modify_report_pages', $ignored, $reportPages);
// To add, edit or remove report pages
$default_reports = array('task' => array('task time report' => array('url' => get_url('reporting', 'total_task_times_p'), 'name' => lang('task time report'), 'description' => lang('task time report description'))));
Hook::fire('modify_default_reports', $ignored, $default_reports);
// To add, edit or remove default reports
require_javascript("og/ReportingFunctions.js");
?>

<div style="padding:7px">
<table width=100% id="reportingMenu">
<tr>
	<td style="height:2px;width:140px"></td><td width=12></td><td style="line-height:2px;">&nbsp;</td><td width=12></td>
</tr>
<tr>
<td height=12></td>
<td rowspan=<?php 
echo count($reportPages) + 2;
?>
开发者ID:rorteg,项目名称:fengoffice,代码行数:31,代码来源:index.php

示例10: stylesheet_tag

if ($use_24_hours) {
    $timeformat = 'G:i';
} else {
    $timeformat = 'g:i A';
}
echo stylesheet_tag('event/day.css');
//today in gmt 0
$today = DateTimeValueLib::now();
//user today
//	$today->add('h', logged_user()->getTimezone());
$currentday = $today->format("j");
$currentmonth = $today->format("n");
$currentyear = $today->format("Y");
$drawHourLine = $day == $currentday && $month == $currentmonth && $year == $currentyear;
$dtv = DateTimeValueLib::make(0, 0, 0, $month, $day, $year);
$result = ProjectEvents::getDayProjectEvents($dtv, active_context(), $user_filter, $status_filter);
if (!$result) {
    $result = array();
}
$alldayevents = array();
$milestones = ProjectMilestones::getRangeMilestones($dtv, $dtv);
if ($task_filter != "hide") {
    $tasks = ProjectTasks::getRangeTasksByUser($dtv, $dtv, $user_filter != -1 ? $user : null, $task_filter);
}
if (user_config_option('show_birthdays_in_calendar')) {
    $birthdays = Contacts::instance()->getRangeContactsByBirthday($dtv, $dtv, active_context_members(false));
} else {
    $birthdays = array();
}
foreach ($result as $key => $event) {
    if ($event->getTypeId() > 1) {
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:31,代码来源:viewdate.php

示例11: count

        } else {
            if ($selection instanceof Member) {
                if ($selection->getObjectTypeId() == Workspaces::instance()->getObjectTypeId()) {
                    $allowed_members[] = $selection->getId();
                    $selected_ws = $selection->getId();
                } else {
                    $show_widget = false;
                }
            }
        }
    }
}
if ($show_widget) {
    $extra_conditions = " AND parent_member_id " . ($add_ctx_members && count($allowed_members) > 0 ? "IN (" . implode(",", $allowed_members) . ")" : "=0");
    $parent = null;
    $context = active_context();
    if (is_array($context)) {
        foreach ($context as $selection) {
            if ($selection instanceof Member && $selection->getDimensionId() == $ws_dimension->getId()) {
                $parent = $selection;
                break;
            }
        }
    }
    $ws_ot_id = ObjectTypes::findByName('workspace')->getId();
    $pg_array = logged_user()->getPermissionGroupIds();
    $current_member_cond = $parent instanceof Member ? "AND parent_member_id=" . $parent->getId() : "";
    $members = Members::findAll(array('limit' => $limit, 'order' => "depth, name", 'conditions' => "object_type_id={$ws_ot_id} {$current_member_cond} AND archived_by_id=0 AND EXISTS (\r\n\t\t\tSELECT cmp.member_id FROM " . TABLE_PREFIX . "contact_member_permissions cmp WHERE cmp.member_id=" . TABLE_PREFIX . "members.id AND cmp.permission_group_id IN (" . implode(',', $pg_array) . "))"));
    if ($parent instanceof Member && count($members) < $limit) {
        $tmp_ids = array();
        foreach ($members as $m) {
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:31,代码来源:index.php

示例12: set_page_title

<?php

  set_page_title(lang('milestones'));
  project_tabbed_navigation(PROJECT_TAB_MILESTONES);
  project_crumbs(lang('milestones'));
  if(ProjectMilestone::canAdd(logged_user(), active_context())) {
    add_page_action(lang('add milestone'), get_url('milestone', 'add'), 'ico-milestone');
  } // if

?>
<?php if($late_milestones || $today_milestones || $upcoming_milestones) { ?>
<div id="milestones">
<?php if(is_array($late_milestones) && count($late_milestones)) { ?>
  <div id="lateMilestones">
  <h2><?php echo lang('late milestones') ?></h2>
<?php 
  foreach($late_milestones as $milestone) {
    $this->assign('milestone', $milestone);
    $this->includeTemplate(get_template_path('view_milestone', 'milestone'));
  } // foreach 
?>
  </div>
<?php } // if ?>

<?php if(is_array($today_milestones) && count($today_milestones)) { ?>
  <div id="todayMilestones">
  <h2><?php echo lang('today milestones') ?></h2>
<?php 
  foreach($today_milestones as $milestone) {
    $this->assign('milestone', $milestone);
    $this->includeTemplate(get_template_path('view_milestone', 'milestone'));
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:31,代码来源:index.php

示例13: instantiate

 function instantiate()
 {
     $selected_members = array();
     $id = get_id();
     $template = COTemplates::findById($id);
     if (!$template instanceof COTemplate) {
         flash_error(lang("template dnx"));
         ajx_current("empty");
         return;
     }
     $parameters = TemplateParameters::getParametersByTemplate($id);
     $parameterValues = array_var($_POST, 'parameterValues');
     if (count($parameters) > 0 && !isset($parameterValues)) {
         ajx_current("back");
         return;
     }
     if (array_var($_POST, 'members')) {
         $selected_members = json_decode(array_var($_POST, 'members'));
     } else {
         $context = active_context();
         foreach ($context as $selection) {
             if ($selection instanceof Member) {
                 $selected_members[] = $selection->getId();
             }
         }
     }
     $objects = $template->getObjects();
     $controller = new ObjectController();
     if (count($selected_members > 0)) {
         $selected_members_instances = Members::findAll(array('conditions' => 'id IN (' . implode($selected_members) . ')'));
     } else {
         $selected_members_instances = array();
     }
     DB::beginWork();
     $active_context = active_context();
     foreach ($objects as $object) {
         if (!$object instanceof ContentDataObject) {
             continue;
         }
         // copy object
         $copy = $object->copy();
         if ($copy->columnExists('is_template')) {
             $copy->setColumnValue('is_template', false);
         }
         if ($copy instanceof ProjectTask) {
             // don't copy parent task and milestone
             $copy->setMilestoneId(0);
             $copy->setParentId(0);
         }
         $copy->save();
         /*		if (!can_write(logged_user(), $selected_members_instances, $copy->getObjectTypeId()) ) {
         				flash_error(lang('no context permissions to add', $copy instanceof ProjectTask ? lang("tasks") : ($copy instanceof ProjectMilestone ? lang('milestones') : '')));
         				DB::rollback();
         				ajx_current("empty");
         				return;
         			}*/
         // Copy members from origial object, if it doesn't have then use active context members
         /*	$template_object_members = $object->getMemberIds();
         			if (count($template_object_members) == 0) {
         				$object_member_ids = active_context_members(false);
         				if (count($object_member_ids) > 0) {
         					$template_object_members = Members::findAll(array("id" => true, "conditions" => "id IN (".implode(",", $object_member_ids).")"));
         				}
         			}*/
         /* Set instantiated object members:
          * foreach dimension:
          * 		if no member is active then the instantiated object is put in the same members as the original for current dimension
          * 		if a member is selected in current dimension then the instantiated object will be put in that member  
          */
         $template_object_members = $object->getMembers();
         $object_members = array();
         foreach ($active_context as $selection) {
             if ($selection instanceof Member) {
                 // member selected
                 $object_members[] = $selection->getId();
             } else {
                 if ($selection instanceof Dimension) {
                     // no member selected
                     foreach ($template_object_members as $tom) {
                         if ($tom->getDimensionId() == $selection->getId()) {
                             $object_members[] = $tom->getId();
                         }
                     }
                 }
             }
         }
         $controller->add_to_members($copy, $object_members);
         // copy linked objects
         $copy->copyLinkedObjectsFrom($object);
         // copy subtasks if applicable
         if ($copy instanceof ProjectTask) {
             ProjectTasks::copySubTasks($object, $copy, false);
             foreach ($copy->getOpenSubTasks(false) as $m_task) {
                 $controller->add_to_members($m_task, $object_members);
             }
             $manager = $copy->manager();
         } else {
             if ($copy instanceof ProjectMilestone) {
                 ProjectMilestones::copyTasks($object, $copy, false);
                 foreach ($copy->getTasks(false) as $m_task) {
//.........这里部分代码省略.........
开发者ID:rorteg,项目名称:fengoffice,代码行数:101,代码来源:TemplateController.class.php

示例14: array_pop

$not_overdue_limit = 5;
$overdue_limit = 20;
$show_more = false;
// Not due tasks
$not_due_tasks = ProjectTasks::getUpcomingWithoutDate($not_overdue_limit + 1);
if (count($not_due_tasks) > $not_overdue_limit) {
    $show_more = true;
    array_pop($not_due_tasks);
}
// Due Tasks
$overdue_upcoming_objects = ProjectTasks::getOverdueAndUpcomingObjects($overdue_limit + 1);
// FIXME: performance Killer
if (count($overdue_upcoming_objects) > $overdue_limit) {
    $show_more = true;
    array_pop($overdue_upcoming_objects);
}
$overdue_upcoming_objects = array_merge($not_due_tasks, $overdue_upcoming_objects);
$users = array();
// Render only when the context isnt 'all' and you have perms
$render_add = active_context_members(false) && ProjectTask::canAdd(logged_user(), active_context());
if ($render_add) {
    $users[] = array(0, lang('dont assign'));
    foreach (allowed_users_to_assign() as $company) {
        foreach ($company['users'] as $user) {
            $name = logged_user()->getId() == $user['id'] ? lang('me') : $user['name'];
            $users[] = array($user['id'], $name);
        }
    }
}
include_once 'template.php';
开发者ID:rorteg,项目名称:fengoffice,代码行数:30,代码来源:index.php

示例15: list_objects

 function list_objects()
 {
     //alert("debugging. remove this line");ajx_current('empty'); return array() ; //TODO remove this line
     /* get query parameters */
     $filesPerPage = config_option('files_per_page');
     $start = array_var($_GET, 'start') ? (int) array_var($_GET, 'start') : 0;
     $limit = array_var($_GET, 'limit') ? array_var($_GET, 'limit') : $filesPerPage;
     $order = array_var($_GET, 'sort');
     $ignore_context = (bool) array_var($_GET, 'ignore_context');
     if ($order == "dateUpdated") {
         $order = "updated_on";
     } elseif ($order == "dateArchived") {
         $order = "archived_on";
     } elseif ($order == "dateDeleted") {
         $order = "trashed_on";
     }
     $orderdir = array_var($_GET, 'dir');
     $page = (int) ($start / $limit) + 1;
     $hide_private = !logged_user()->isMemberOfOwnerCompany();
     $typeCSV = array_var($_GET, 'type');
     $types = null;
     if ($typeCSV) {
         $types = explode(",", $typeCSV);
     }
     $name_filter = mysql_escape_string(array_var($_GET, 'name'));
     $linked_obj_filter = array_var($_GET, 'linkedobject');
     $object_ids_filter = '';
     if (!is_null($linked_obj_filter)) {
         $linkedObject = Objects::findObject($linked_obj_filter);
         $objs = $linkedObject->getLinkedObjects();
         foreach ($objs as $obj) {
             $object_ids_filter .= ($object_ids_filter == '' ? '' : ',') . $obj->getId();
         }
     }
     $filters = array();
     if (!is_null($types)) {
         $filters['types'] = $types;
     }
     if (!is_null($name_filter)) {
         $filters['name'] = $name_filter;
     }
     if ($object_ids_filter != '') {
         $filters['object_ids'] = $object_ids_filter;
     }
     $user = array_var($_GET, 'user');
     $trashed = array_var($_GET, 'trashed', false);
     $archived = array_var($_GET, 'archived', false);
     /* if there's an action to execute, do so */
     if (array_var($_GET, 'action') == 'delete') {
         $ids = explode(',', array_var($_GET, 'objects'));
         $result = ContentDataObjects::listing(array("extra_conditions" => " AND o.id IN (" . implode(",", $ids) . ") ", "include_deleted" => true));
         $objects = $result->objects;
         list($succ, $err) = $this->do_delete_objects($objects);
         if ($err > 0) {
             flash_error(lang('error delete objects', $err));
         } else {
             Hook::fire('after_object_delete_permanently', $ids, $ignored);
             flash_success(lang('success delete objects', $succ));
         }
     } else {
         if (array_var($_GET, 'action') == 'delete_permanently') {
             $ids = explode(',', array_var($_GET, 'objects'));
             //$result = Objects::getObjectsFromContext(active_context(), null, null, true, false, array('object_ids' => implode(",",$ids)));
             $objects = Objects::instance()->findAll(array("conditions" => "id IN (" . implode(",", $ids) . ")"));
             list($succ, $err) = $this->do_delete_objects($objects, true);
             if ($err > 0) {
                 flash_error(lang('error delete objects', $err));
             }
             if ($succ > 0) {
                 Hook::fire('after_object_delete_permanently', $ids, $ignored);
                 flash_success(lang('success delete objects', $succ));
             }
         } else {
             if (array_var($_GET, 'action') == 'markasread') {
                 $ids = explode(',', array_var($_GET, 'objects'));
                 list($succ, $err) = $this->do_mark_as_read_unread_objects($ids, true);
             } else {
                 if (array_var($_GET, 'action') == 'markasunread') {
                     $ids = explode(',', array_var($_GET, 'objects'));
                     list($succ, $err) = $this->do_mark_as_read_unread_objects($ids, false);
                 } else {
                     if (array_var($_GET, 'action') == 'empty_trash_can') {
                         $result = Objects::getObjectsFromContext(active_context(), 'trashed_on', 'desc', true);
                         $objects = $result->objects;
                         list($succ, $err) = $this->do_delete_objects($objects, true);
                         if ($err > 0) {
                             flash_error(lang('error delete objects', $err));
                         }
                         if ($succ > 0) {
                             flash_success(lang('success delete objects', $succ));
                         }
                     } else {
                         if (array_var($_GET, 'action') == 'archive') {
                             $ids = explode(',', array_var($_GET, 'objects'));
                             list($succ, $err) = $this->do_archive_unarchive_objects($ids, 'archive');
                             if ($err > 0) {
                                 flash_error(lang('error archive objects', $err));
                             } else {
                                 flash_success(lang('success archive objects', $succ));
                             }
//.........这里部分代码省略.........
开发者ID:rorteg,项目名称:fengoffice,代码行数:101,代码来源:ObjectController.class.php


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