static public function array_merge($a1, $a2) { $n = $a1; foreach($a2 as $k => $v) if(is_array($v) && isset($n[$k]) && is_array($n[$k])) $n[$k] = ComplexArray :: array_merge($n[$k], $v); else $n[$k] = $v; return $n; }
protected function _defineDatamap() { $datamap = array('_FILES_' => 'files_data'); $ini = Limb::toolkit()->getINI('image_variations.ini'); $image_variations = $ini->getAll(); foreach ($image_variations as $variation => $variation_data) { $datamap['upload_' . $variation . '_max_size'] = 'upload_' . $variation . '_max_size'; $datamap['generate_' . $variation . '_max_size'] = 'generate_' . $variation . '_max_size'; $datamap[$variation . '_action'] = $variation . '_action'; $datamap[$variation . '_base_variation'] = $variation . '_base_variation'; } return ComplexArray::array_merge(parent::_defineDatamap(), $datamap); }
protected function _defineDatamap() { return ComplexArray::array_merge(parent::_defineDatamap(), array('question' => 'question', 'question_author' => 'question_author', 'question_author_email' => 'question_author_email', 'answer' => 'answer', 'answer_author' => 'answer_author', 'answer_author_email' => 'answer_author_email')); }
protected function _defineDatamap() { return ComplexArray::array_merge(parent::_defineDatamap(), array('article_content' => 'content', 'annotation' => 'annotation', 'author' => 'author', 'source' => 'source', 'uri' => 'uri')); }
function _defineColumns() { return ComplexArray :: array_merge( parent :: _defineColumns(), array( 'annotation' => '', 'content' => '', 'news_date' => array('type' => 'date'), ) ); }
protected function _doGetShippingOptions($shipping_configuration) { $this->_cleanCookie(); $this->_browseToHomePage(); $express_html = $this->_getExpressShippingOptionsHtml($shipping_configuration); $ground_html = $this->_getGroundShippingOptionsHtml($shipping_configuration); if ($express_html === false) { $express_options = array(); } else { $express_options = $this->_parseHtmlOptions($express_html); } if ($ground_html === false) { $ground_options = array(); } else { $ground_options = $this->_parseHtmlOptions($ground_html); } $options = ComplexArray::array_merge($express_options, $ground_options); if (empty($options)) { return false; } return $options; }
protected function _defineDatamap() { return ComplexArray::array_merge(parent::_defineDatamap(), array('annotation' => 'annotation', 'news_content' => 'content', 'news_date' => 'news_date')); }
protected function _initFirstTimeDataspace($dataspace, $request) { $object_data = $this->_loadObjectData(); ComplexArray :: map($this->_defineDatamap(), $object_data, $data = array()); $dataspace->merge($data); }
public function getShippingOptions($shipping_configuration) { if ($this->cache_result) { if (($options = $this->_getCachedOptions($shipping_configuration)) !== false) { return $options; } } if (!($options = $this->_doGetShippingOptions($shipping_configuration))) { return array(); } $options = ComplexArray::sortArray($options, array('price' => 'ASC')); if ($this->cache_result) { $this->_saveCachedOptions($shipping_configuration, $options); } return $options; }
public function getObjectIds() { if ($this->object_ids) return $this->object_ids; if (!$this->node_ids) return array(); $tree = Limb :: toolkit()->getTree(); if (!$nodes = Limb :: toolkit()->getTree()->getNodesByIds($this->node_ids)) return array(); $this->object_ids = ComplexArray :: getColumnValues('object_id', $nodes); return $this->object_ids; }
public function getObjectIds() { if ($this->object_ids) return $this->object_ids; $tree = Limb :: toolkit()->getTree(); if(!$nodes = $tree->getSubBranchByPath($this->path, $this->depth, $this->include_parent, $this->check_expanded_parents)) { return array(); } $this->object_ids = ComplexArray :: getColumnValues('object_id', $nodes); return $this->object_ids; }
function _findMaxValues(&$arr) { include_once LIMB_DIR . '/core/util/ComplexArray.class.php'; if (ComplexArray::getMaxColumnValue('hosts', $arr, $index) !== false) { $arr[$index]['max_hosts'] = 1; } if (ComplexArray::getMaxColumnValue('hits', $arr, $index) !== false) { $arr[$index]['max_hits'] = 1; } if (ComplexArray::getMaxColumnValue('home_hits', $arr, $index) !== false) { $arr[$index]['max_home_hits'] = 1; } if (ComplexArray::getMaxColumnValue('audience', $arr, $index) !== false) { $arr[$index]['max_audience'] = 1; } foreach ($arr as $index => $data) { if (date('w', $data['time'] + 60 * 60 * 24) == 1) { $arr[$index]['new_week'] = 1; } } }
protected function _processResultArray($arr) { if (ComplexArray::getMaxColumnValue('hosts', $arr, $index) !== false) { $arr[$index]['max_hosts'] = 1; } if (ComplexArray::getMaxColumnValue('hits', $arr, $index) !== false) { $arr[$index]['max_hits'] = 1; } if (ComplexArray::getMaxColumnValue('home_hits', $arr, $index) !== false) { $arr[$index]['max_home_hits'] = 1; } if (ComplexArray::getMaxColumnValue('audience', $arr, $index) !== false) { $arr[$index]['max_audience'] = 1; } $result = array(); foreach ($arr as $index => $data) { if (date('w', $data['time'] + 60 * 60 * 24) == 1) { $data['new_week'] = 1; } $result[$index] = $data; } return $result; }
static function _doSort($tree_array, & $sorted_tree_array, $sort_params, $parent_id, $id_hash, $parent_hash) { $children = array(); foreach($tree_array as $index => $item) { if($item[$parent_hash] == $parent_id) { $children[] = $item; unset($tree_array[$index]); } } if(!($count = sizeof($children))) return; $children = ComplexArray :: sortArray($children, $sort_params); if(!$sorted_tree_array) { $sorted_tree_array = $children; } else { $ids = ComplexArray :: getColumnValues($id_hash, $sorted_tree_array); $offset = array_search($parent_id, $ids) + 1; array_splice($sorted_tree_array, $offset, 0, $children); } for($i=0; $i < $count; $i++) { TreeSorter :: _doSort($tree_array, $sorted_tree_array, $sort_params, $children[$i][$id_hash], $id_hash, $parent_hash); } }
protected function _mergeDataspaceWithRequest($dataspace, $request) { ComplexArray :: map($this->_defineDatamap(), $request->get($this->form_name), $data = array()); $dataspace->merge($data); }
protected function _defineColumns() { return ComplexArray::array_merge(parent::_defineColumns(), array('description' => '', 'media_id' => '')); }
protected function _defineDatamap() { return ComplexArray::array_merge(parent::_defineDatamap(), array('start_date' => 'start_date', 'finish_date' => 'finish_date', 'restriction' => 'restriction')); }
protected function _defineColumns() { return ComplexArray::array_merge(parent::_defineColumns(), array('count' => array('type' => 'numeric'))); }
function _defineDatamap() { return ComplexArray::array_merge(parent::_defineDatamap(), array('url' => 'url', 'new_window' => 'new_window')); }
protected function _defineColumns() { return ComplexArray::array_merge(parent::_defineColumns(), array('message' => '', 'sender_email' => '', 'sender' => '', 'comment' => '', 'comment_author' => '', 'comment_author_email' => '')); }
/** * Returns flat query_string * */ function getQueryString() { $query_string = ''; $query_items = array(); $flat_array = array(); ComplexArray :: toFlatArray($this->_query_items, $flat_array); ksort($flat_array); foreach($flat_array as $key => $value) { if ($value != '' || is_null($value)) $query_items[] = $key . '=' . $value; else $query_items[] = $key; } if($query_items) $query_string = implode('&', $query_items); return $query_string; }
protected function _defineDatamap() { return ComplexArray::array_merge(parent::_defineDatamap(), array('name' => 'name', 'lastname' => 'lastname', 'password' => 'password', 'email' => 'email', 'second_password' => 'second_password')); }
function arrayMapRecursive($in_func, &$in_array) { foreach (array_keys($in_array) as $key) { $value =& $in_array[$key]; if (is_array($value)) ComplexArray :: arrayMapRecursive($in_func, $value); else $value = call_user_func_array($in_func, array($value)); } return $in_array; }
function _defineDatamap() { return ComplexArray::array_merge(parent::_defineDatamap(), array('description' => 'description')); }
public function searchFetchSubBranch($path, $loader_class_name, &$counter, $params = array(), $fetch_method = 'fetch') { $tree = Limb::toolkit()->getTree(); $site_object = Limb::toolkit()->createSiteObject($loader_class_name); if (!isset($params['restrict_by_class']) || isset($params['restrict_by_class']) && (bool) $params['restrict_by_class']) { $class_id = $site_object->getClassId(); } else { $class_id = null; } if (isset($params['check_expanded_parents'])) { $check_expanded_parents = (bool) $params['check_expanded_parents']; } else { $check_expanded_parents = false; } if (isset($params['include_parent'])) { $include_parent = (bool) $params['include_parent']; } else { $include_parent = false; } $depth = isset($params['depth']) ? $params['depth'] : 1; if (!($nodes = $tree->getAccessibleSubBranchByPath($path, $depth, $include_parent, $check_expanded_parents, $class_id))) { return array(); } $object_ids = ComplexArray::getColumnValues('object_id', $nodes); if (!count($object_ids)) { return array(); } return $this->searchFetchByIds($object_ids, $loader_class_name, $counter, $params, $fetch_method); }
protected function _defineDatamap() { return ComplexArray::array_merge(parent::_defineDatamap(), array('content' => 'content')); }
/** * Return the URI to a specific page in the list. */ public function getPageUri($page) { $params = ComplexArray :: array_merge($_GET, $_POST); if ($page <= 1) { unset($params[$this->pager_variable.'_'. $this->getServerId()]); } else { $params[$this->pager_variable .'_'. $this->getServerId()] = $page; } $sep = ''; $query = ''; $flat_params = array(); ComplexArray :: toFlatArray($params, $flat_params); foreach ($flat_params as $key => $value) { $query .= $sep . $key . '=' . urlencode($value); $sep = '&'; } if (empty($query)) { return $this->base_url; } else { return $this->base_url . '?' . $query; } }
protected function _defineColumns() { return ComplexArray::array_merge(parent::_defineColumns(), array('content' => '')); }
protected function _defineColumns() { return ComplexArray::array_merge(parent::_defineColumns(), array('url' => '', 'new_window' => array('type' => 'numeric'))); }
protected function _defineColumns() { return ComplexArray::array_merge(parent::_defineColumns(), array('restriction' => array('type' => 'numeric'), 'start_date' => array('type' => 'date'), 'finish_date' => array('type' => 'date'))); }