function list_all() { ajx_current("empty"); // Get all variables from request $start = array_var($_GET, 'start', 0); $limit = array_var($_GET, 'limit', config_option('files_per_page')); $order = 'name'; $order_dir = array_var($_GET, 'dir'); $action = array_var($_GET, 'action'); $attributes = array("ids" => explode(',', array_var($_GET, 'ids'))); if (!$order_dir) { switch ($order) { case 'name': $order_dir = 'ASC'; break; default: $order_dir = 'DESC'; } } $dim_controller = new DimensionController(); $members = $dim_controller->initial_list_dimension_members(Dimensions::findByCode('workspaces')->getId(), ObjectTypes::findByName('workspace')->getId(), $context, true); $ids = array(); foreach ($members as $m) { $ids[] = $m['object_id']; } $members = active_context_members(false); // Context Members Ids $members_sql = ""; if (count($members) > 0) { $members_sql .= " AND parent_member_id IN (" . implode(',', $members) . ")"; } else { $members_sql .= " AND parent_member_id = 0"; } $res = Members::findAll(array("conditions" => "object_id IN (" . implode(',', $ids) . ") " . $members_sql, 'offset' => $start, 'limit' => $limit, 'order' => "{$order} {$order_dir}")); $object = $this->prepareObject($res, $start, $limit, count($res)); ajx_extra_data($object); tpl_assign("listing", $object); }
private function list_members($request) { $service = $request['srv']; $members = array(); $type = ObjectTypes::instance()->findByName($service); $typeId = $type->getId(); $ids = array(); $dimensionController = new DimensionController(); foreach ($dimensionController->initial_list_dimension_members(Dimensions::findByCode('customer_project')->getId(), $typeId) as $member) { $ids[] = $member['object_id']; } if (count($ids)) { $args['conditions'] = " `object_id` IN (" . implode(",", $ids) . ") AND object_type_id = {$typeId}"; foreach (Members::instance()->findAll($args) as $member) { /* @var $member Member */ $memberInfo = array('id' => $member->getId(), 'name' => $member->getName(), 'type' => $service, 'path' => $member->getPath()); $members[] = $memberInfo; } } return $this->response('json', $members); }
function list_all($parameters = null) { $return_the_list = true; // if parameters not specified => use the request if (is_null($parameters)) { ajx_current("empty"); $parameters = $_REQUEST; $return_the_list = false; } // Get all variables from request $start = array_var($parameters, 'start', '0'); $limit = array_var($parameters, 'limit', config_option('files_per_page')); $order = array_var($parameters, 'sort'); $order_dir = array_var($parameters, 'dir'); $dimension_id = array_var($parameters, 'dim_id'); $member_type_id = array_var($parameters, 'type_id'); $parent_id = array_var($parameters, 'parent_id'); $dimension = Dimensions::findById($dimension_id); $join_sql = ""; switch ($order) { /*case 'task_completion_p': $order = "d.task_completion_p"; break; case 'time_worked_p': $order = "d.time_worked_p"; break; case 'total_tasks': $order = "d.total_tasks"; break; case 'completed_tasks': $order = "d.completed_tasks"; break; case 'total_estimated_time': $order = "d.total_estimated_time"; break; case 'total_worked_time': $order = "d.total_worked_time"; break;*/ case 'name': case 'description': $order = "mem." . $order; break; default: if (str_starts_with($order, "cp_")) { $cp_id = str_replace("cp_", "", $order); $join_sql = "LEFT JOIN " . TABLE_PREFIX . "member_custom_property_values cpv ON cpv.member_id=mem.id AND cpv.custom_property_id={$cp_id}"; $order = "LPAD(cpv.`value`, 25, ' ')"; } else { $order = 'mem.`name`'; } break; } if (!$order_dir) { $order_dir = 'ASC'; } $associated_dimension_ids = array(); $dimension_associations = DimensionMemberAssociations::findAll(array("conditions" => array("(`dimension_id` = ? AND `object_type_id` = ?) OR (`associated_dimension_id` = ? AND `associated_object_type_id` = ?)", $dimension->getId(), $member_type_id, $dimension->getId(), $member_type_id))); foreach ($dimension_associations as $da) { /* @var $da DimensionMemberAssociation */ if ($da->getDimensionId() == $dimension->getId()) { $associated_dimension_ids[] = $da->getAssociatedDimensionMemberAssociationId(); } else { $associated_dimension_ids[] = $da->getDimensionId(); } } $parent = null; if ($parent_id > 0) { $parent = Members::findById($parent_id); } $associated_member_ids = array(); $extra_conds = ""; $context = active_context(); if (is_array($context)) { foreach ($context as $sel) { if ($sel instanceof Member) { if ($sel->getDimensionId() == $dimension->getId()) { $parent = $sel; } else { if (in_array($sel->getDimensionId(), $associated_dimension_ids)) { $associated_member_ids[] = $sel->getId(); } } } } } $member_association_cond = ""; // associated member conditions foreach ($associated_member_ids as $amid) { if (is_numeric($amid) && $amid > 0) { $member_association_cond .= " AND EXISTS (SELECT mpm.id FROM " . TABLE_PREFIX . "member_property_members mpm \r\n\t\t\t\t\tWHERE mpm.member_id=" . TABLE_PREFIX . "members.id AND mpm.property_member_id={$amid} ) "; } } $ids = array(); $pg_array = logged_user()->getPermissionGroupIds(); $current_member_cond = $parent instanceof Member ? "AND parent_member_id=" . $parent->getId() : ""; if ($parent instanceof Member) { $extra_conds = " AND archived_by_id=0 AND EXISTS (\r\n\t\t\t\tSELECT cmp.member_id FROM " . TABLE_PREFIX . "contact_member_permissions cmp \r\n\t\t\t\tWHERE cmp.member_id=" . TABLE_PREFIX . "members.id AND cmp.permission_group_id IN (" . implode(',', $pg_array) . "))"; $members = $parent->getAllChildren(true, 'name', $extra_conds); $member_ids = array(); foreach ($members as $member) { if ($member->getObjectTypeId() == $member_type_id) { $member_ids[] = $member->getId(); } } if (count($associated_member_ids) > 0 && count($member_ids) > 0) { $mpm_sql = "SELECT m.object_id FROM " . TABLE_PREFIX . "members m \r\n\t\t\t\t\t\tINNER JOIN " . TABLE_PREFIX . "member_property_members mpm ON mpm.member_id=m.id \r\n\t\t\t\t\t\tWHERE m.id IN (" . implode(',', $member_ids) . ") \r\n\t\t\t\t\t\tAND mpm.property_member_id IN (" . implode(',', $associated_member_ids) . ")"; $ids = array_flat(DB::executeAll($mpm_sql)); } $ids = $member_ids; } else { $dim_controller = new DimensionController(); $members = $dim_controller->initial_list_dimension_members($dimension->getId(), null, array($member_type_id), false, $extra_conds . $member_association_cond); foreach ($members as $m) { $ids[] = $m['id']; } } if (count($ids) == 0) { $ids[] = 0; } $sql = "SELECT *, mem.id as member_id FROM " . TABLE_PREFIX . "members mem\r\n\t\t--\tLEFT JOIN " . TABLE_PREFIX . "member_additional_data d ON c.object_id=d.customer_id\r\n\t\t\t{$join_sql}\r\n\t\t\tWHERE mem.id IN (" . implode(',', $ids) . ") AND mem.dimension_id=" . $dimension->getId() . "\r\n\t\t\tORDER BY {$order} {$order_dir}\r\n\t\t\tLIMIT {$start}, {$limit}"; $rows = DB::executeAll($sql); if (!is_array($rows)) { $rows = array(); } $object = $this->prepareObject($rows, $start, $limit, $dimension, $member_type_id, count($ids)); if ($return_the_list) { return $object; } else { ajx_extra_data($object); tpl_assign("listing", $object); } }
$acc_id = user_config_option('mails account filter'); $acc = $acc_id > 0 ? MailAccounts::findById($acc_id) : null; echo $acc instanceof MailAccount ? mysql_real_escape_string($acc->getName()) : ''; ?> '; } else og.emailFilters.accountName = ''; <?php } ?> og.lastSelectedRow = {messages:0, mails:0, contacts:0, documents:0, weblinks:0, overview:0, linkedobjs:0, archived:0}; og.menuPanelCollapsed = false; og.dimensionPanels = [ <?php $dimensionController = new DimensionController(); $first = true; $dimensions = $dimensionController->get_context(); foreach ($dimensions['dimensions'] as $dimension) { if ($dimension->getOptions(1) && isset($dimension->getOptions(1)->hidden) && $dimension->getOptions(1)->hidden) { continue; } /* @var $dimension Dimension */ $title = $dimension->getOptions() && isset($dimension->getOptions(1)->useLangs) && $dimension->getOptions(1)->useLangs ? lang($dimension->getCode()) : $dimension->getName(); if (!$first) { ?> ,<?php } $first = false; ?>
private function list_latest_active_members($request) { $service = $request['srv']; $members = array(); $type = ObjectTypes::instance()->findByName($service); $typeId = $type->getId(); if ($service == "workspace") { $dimension_id = Dimensions::findByCode('workspaces')->getId(); } else { $dimension_id = Dimensions::findByCode('customer_project')->getId(); } $ids = array(); $dimensionController = new DimensionController(); foreach ($dimensionController->latest_active_dimension_members($dimension_id, $typeId, null, user_config_option("mobile_logs_amount_to_search"), user_config_option("mobile_minimum_display_dimension_members"), user_config_option("mobile_maximum_display_dimension_members")) as $member) { $ids[] = $member['object_id']; } if (count($ids)) { $args['conditions'] = " `object_id` IN (" . implode(",", $ids) . ") AND object_type_id = {$typeId}"; $args['order'] = " name ASC"; foreach (Members::instance()->findAll($args) as $member) { /* @var $member Member */ $memberInfo = array('id' => $member->getId(), 'name' => $member->getName(), 'type' => $service, 'path' => $member->getPath()); $members[] = $memberInfo; } } return $this->response('json', $members); }
function linked_object_filters() { $genid = gen_id(); $html = "<div class='linked-objects-member-filters'>"; $context = active_context(); $dimensions = Dimensions::findAll(array('conditions' => 'is_manageable = 1')); foreach ($dimensions as $dimension) { $dimension_id = $dimension->getId(); $sel_name = ""; $sel_id = 0; foreach ($context as $selection) { if ($selection instanceof Member && $selection->getDimensionId() == $dimension_id) { $sel_name = clean($selection->getName()); $sel_id = $selection->getId(); } } $html .= '<div class="lo-member-selector"><div class="selector-label">'.lang('filter by '.$dimension->getCode()).'</div>'; $autocomplete_options = array(); $dim_controller = new DimensionController(); $members = $dim_controller->initial_list_dimension_members($dimension_id, null, null, false, "", null, false, null, true, array()); foreach ($members as $m) { $autocomplete_options[] = array($m['id'], $m['name'], $m['path'], $m['to_show'], $m['ico'], $m['dim']); } $combo_listeners = array( "select" => "function (combo, record, index) { Ext.getCmp('dimFilter').fireEvent('memberselected', record.data); }", ); $html .= autocomplete_member_combo("member_autocomplete-dim".$dimension_id, $dimension_id, $autocomplete_options, lang($dimension->getCode()), array('class' => 'member-name-input', 'selected_name' => $sel_name), false, $genid .'add-member-input-dim'. $dimension_id, $combo_listeners); $html .= "</div>"; if ($sel_id > 0) { $html .= "<script>Ext.getCmp('obj_picker_grid').member_filter[$dimension_id] = $sel_id;</script>"; } } $html .= '<div class="buttons"><button onclick="Ext.getCmp(\'dimFilter\').fireEvent(\'clearfilters\', \''.$genid.'\');">'.lang('remove all filters').'</button></div>'; $html .= '</div>'; die($html); }
if (!array_var($options, 'allow_non_manageable') && !$dimension['is_manageable']) continue; $is_required = $dimension['is_required']; $dimension_name = $dimension['dimension_name']; if ($is_required) $dimension_name .= " *"; if (is_array($simulate_required) && in_array($dimension_id, $simulate_required)) $is_required = true; $dimension_selected_members = array(); foreach ($selected_members as $selected_member) { if ($selected_member->getDimensionId() == $dimension_id) $dimension_selected_members[] = $selected_member; } $autocomplete_options = array(); if (!isset($dim_controller)) $dim_controller = new DimensionController(); $members = $dim_controller->initial_list_dimension_members($dimension_id, $content_object_type_id, $allowed_member_type_ids, false, "", null, false, null, true, $initial_selected_members, ACCESS_LEVEL_WRITE); foreach ($members as $m) { if (can_add_to_member(logged_user(), $m, active_context(), $content_object_type_id)) { $autocomplete_options[] = array($m['id'], $m['name'], $m['path'], $m['to_show'], $m['ico'], $m['dim']); $members_dimension[$m['id']] = $m['dim']; } } $expgenid = gen_id(); ?> <div id="<?php echo $genid; ?>member-seleector-dim<?php echo $dimension_id?>" class="single-dimension-selector"> <div class="header x-accordion-hd" onclick="og.dashExpand('<?php echo $expgenid?>', 'selector-body-dim<?php echo $dimension_id ?>');"> <?php echo $dimension_name?>
<?php $total = 5; $genid = gen_id(); $ws_dimension = Dimensions::findByCode('workspaces'); $dim_controller = new DimensionController(); $selected_ws = '0'; $allowed_members = array(); $add_ctx_members = true; $context = active_context(); if(isset($context)){ foreach ($context as $selection) { if ($selection instanceof Dimension && $selection->getCode() == 'workspaces') { $add_ctx_members = false; } else if ($selection instanceof Member && $selection->getObjectTypeId() == Workspaces::instance()->getObjectTypeId()) { $allowed_members[] = $selection->getId(); $selected_ws = $selection->getId(); } } } $extra_conditions = " AND parent_member_id " . ($add_ctx_members && count($allowed_members) > 0 ? "IN (". implode(",", $allowed_members) .")" : "=0"); $workspaces = $dim_controller->initial_list_dimension_members($ws_dimension->getId(), null, null, false, $extra_conditions, $total, true); $parent = null; $context = active_context(); foreach ($context as $selection) { if ($selection instanceof Member && $selection->getDimensionId() == $ws_dimension->getId()) { $parent = $selection;