/** * returns array with the filter settings of this filter * * @param bool $_valueToJson resolve value for json api? * @return array */ public function toArray($_valueToJson = false) { $result = parent::toArray($_valueToJson); if ($this->_userOperator && $this->_userOperator == 'inGroup') { $result['operator'] = $this->_userOperator; $result['value'] = $this->_userValue; } if ($_valueToJson == true) { if ($this->_userOperator && $this->_userOperator == 'inGroup' && $this->_userValue) { $result['value'] = Tinebase_Group::getInstance()->getGroupById($this->_userValue)->toArray(); } else { switch ($this->_operator) { case 'equals': $result['value'] = $result['value'] ? Tinebase_User::getInstance()->getUserById($this->_value)->toArray() : $result['value']; break; case 'in': $result['value'] = array(); foreach ($this->_value as $userId) { $result['value'][] = Tinebase_User::getInstance()->getUserById($userId)->toArray(); } break; default: break; } } } return $result; }
/** * returns array with the filter settings of this filter * * @param bool $_valueToJson resolve value for json api? * @return array */ public function toArray($_valueToJson = false) { $result = parent::toArray($_valueToJson); if ($this->_userOperator && $this->_userOperator == 'inGroup') { $result['operator'] = $this->_userOperator; $result['value'] = $this->_userValue; } else { if ($this->_userValue === Tinebase_Model_User::CURRENTACCOUNT) { // switch back to CURRENTACCOUNT to make sure filter is saved and shown in client correctly $result['value'] = $this->_userValue; } } if ($_valueToJson == true) { if ($this->_userOperator && $this->_userOperator == 'inGroup' && $this->_userValue) { $result['value'] = Tinebase_Group::getInstance()->getGroupById($this->_userValue)->toArray(); } else { switch ($this->_operator) { case 'equals': $result['value'] = $result['value'] ? Tinebase_User::getInstance()->getUserById($this->_value)->toArray() : $result['value']; break; case 'in': $result['value'] = array(); foreach ($this->_value as $userId) { $result['value'][] = Tinebase_User::getInstance()->getUserById($userId)->toArray(); } break; default: break; } } } return $result; }
/** * returns array with the filter settings of this filter * * @param bool $_valueToJson resolve value for json api? * @return array */ public function toArray($_valueToJson = false) { $result = Tinebase_Model_Filter_Text::toArray($_valueToJson); if ($this->_value === '/' || $this->_value === '') { $node = new Tinebase_Model_Tree_Node(array('name' => 'root', 'path' => '/'), TRUE); } else { $node = new Tinebase_Model_Tree_Node(array('path' => $this->_value, 'name' => 'nodeName', 'object_id' => 1)); } $result['value'] = $node->toArray(); return $result; }
/** * returns array with the filter settings of this filter * * @param bool $_valueToJson resolve value for json api? * @return array */ public function toArray($_valueToJson = false) { $result = parent::toArray($_valueToJson); if (!$this->_path) { $this->_path = Tinebase_Model_Tree_Node_Path::createFromPath($this->_value); } if ($this->_path->containerType === Tinebase_Model_Tree_Node_Path::TYPE_ROOT) { $node = new Tinebase_Model_Tree_Node(array('name' => 'root', 'path' => '/'), TRUE); } else { $node = Tinebase_FileSystem::getInstance()->stat($this->_path->statpath); $node->path = $this->_path->flatpath; } $result['value'] = $node->toArray(); return $result; }