private function getAssignableParents($dim_id, $otype_id) { $parents = Members::findAll(array("conditions" => array("`object_type_id` IN (\n\t\t\tSELECT `parent_object_type_id` FROM `" . DimensionObjectTypeHierarchies::instance()->getTableName() . "` WHERE `dimension_id` = ? AND `child_object_type_id` = ?\n\t\t)", $dim_id, $otype_id))); $parents_info = array(); foreach ($parents as $parent) { $parents_info[] = array('id' => $parent->getId(), 'name' => $parent->getName()); } $dim_obj_type = DimensionObjectTypes::findById(array('dimension_id' => $dim_id, 'object_type_id' => $otype_id)); if ($dim_obj_type && $dim_obj_type->getIsRoot()) { array_unshift($parents_info, array('id' => 0, 'name' => lang('none'))); } return $parents_info; }
_member_type_container"> <?php echo label_tag(lang('type'), "", true); ?> <input type="hidden" id="<?php echo $genid; ?> memberObjectType" name="member[object_type_id]"></input> <div id="<?php echo $genid; ?> object_type_combo_container"></div> <div class="clear"></div> </div> <?php $doths = DimensionObjectTypeHierarchies::findAll(array('conditions' => 'dimension_id=' . $current_dimension->getId() . " AND child_object_type_id=" . $member->getObjectTypeId())); $can_have_parent = count($doths) > 0; //$can_have_parent = count(DimensionObjectTypeHierarchies::getAllParentObjectTypeIds($current_dimension->getId(), $member_ot->getId())) > 0; if ($member instanceof Member && $can_have_parent) { ?> <div id="<?php echo $genid; ?> memberParentContainer" style="width:267px;"> <?php $selected_members = array(); if ($parent_sel) { $selected_members[] = $parent_sel; } //echo label_tag(lang('located under'), "", false); //render_single_dimension_tree($current_dimension, $genid, $selected_members, array('checkBoxes'=>false,'all_members' => true));
/** * This function will return paginated result. Result is an array where first element is * array of returned object and second populated pagination object that can be used for * obtaining and rendering pagination data using various helpers. * * Items and pagination array vars are indexed with 0 for items and 1 for pagination * because you can't use associative indexing with list() construct * * @access public * @param array $arguments Query argumens (@see find()) Limit and offset are ignored! * @param integer $items_per_page Number of items per page * @param integer $current_page Current page number * @return array */ function paginate($arguments = null, $items_per_page = 10, $current_page = 1) { if(isset($this) && instance_of($this, 'DimensionObjectTypeHierarchies')) { return parent::paginate($arguments, $items_per_page, $current_page); } else { return DimensionObjectTypeHierarchies::instance()->paginate($arguments, $items_per_page, $current_page); } // if } // paginate
/** * Returnrs true if members accepts child nodes, false otherwise * @author Alvaro Torterola - alvaro.torterola@fengoffice.com */ function allowChilds() { return DimensionObjectTypeHierarchies::typeAllowChilds($this->getDimensionId(), $this->getObjectTypeId()); }
function active_context_can_contain_member_type($dimension_id, $member_type_id) { $context = active_context(); foreach ($context as $selection) { if ($selection instanceof Dimension && $selection->getId() == $dimension_id) { // if no member of this dimension is selected return true return true; } else { if ($selection instanceof Member && $selection->getDimensionId() == $dimension_id) { // check if member type parameter can be descendant of the selected member type $child_ots = DimensionObjectTypeHierarchies::getAllChildrenObjectTypeIds($dimension_id, $selection->getObjectTypeId()); return in_array($member_type_id, $child_ots); } } } return true; }
function canHaveParents() { $dim_id = $this->getDimensionId(); $otype_id = $this->getObjectTypeId(); $sql = "SELECT count(m.id) as cant from " . TABLE_PREFIX . "members m\r\n\t\t\t\tWHERE m.`object_type_id` IN (\r\n\t\t\t\t\tSELECT `parent_object_type_id` FROM `" . DimensionObjectTypeHierarchies::instance()->getTableName() . "`\r\n\t\t\t\t\tWHERE `dimension_id` = '{$dim_id}' AND `child_object_type_id` = '{$otype_id}'\r\n\t\t\t\t)"; $rows = DB::executeAll($sql); $cant = $rows[0]['cant']; return $cant > 0; }
/** * Return manager instance * * @access protected * @param void * @return DimensionObjectTypeHierarchies */ function manager() { if (!$this->manager instanceof DimensionObjectTypeHierarchyies) { $this->manager = DimensionObjectTypeHierarchies::instance(); } return $this->manager; }
?> , quickAdd: <?php echo intval($dimension->getOptionValue('quickAdd')) ? 'true' : 'false'; ?> , minHeight: 10 //animate: false, //animCollapse: false } <?php $dim_obj_types = DimensionObjectTypes::getObjectTypeIdsByDimension($dimension->getId()); $dim_obj_type_descendants[$dimension->getId()] = array(); foreach ($dim_obj_types as $ot_id) { $all_child_ots = DimensionObjectTypeHierarchies::getAllChildrenObjectTypeIds($dimension->getId(), $ot_id); $dim_obj_type_descendants[$dimension->getId()][$ot_id] = array_values($all_child_ots); } ?> <?php } ?> ]; og.dimension_object_type_descendants = Ext.util.JSON.decode('<?php echo json_encode($dim_obj_type_descendants); ?> '); og.contextManager.construct(); og.objPickerTypeFilters = []; <?php