/**
  * returns array with the filter settings of this filter group
  *
  * @param  bool $_valueToJson resolve value for json api?
  * @return array
  */
 public function toArray($_valueToJson = false)
 {
     if (is_string($this->_value)) {
         $this->_value = Addressbook_Controller_ListRole::getInstance()->get($this->_value)->toArray();
     }
     return parent::toArray($_valueToJson);
 }
 /**
  * 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 ($_valueToJson == true) {
         $tags = Tinebase_Tags::getInstance()->getTagsById($this->_value)->toArray();
         if (count($tags) > 0) {
             $result['value'] = is_array($this->_value) ? $tags : $tags[0];
         } else {
             $result['value'] = '';
         }
     }
     return $result;
 }
示例#3
0
 /**
  * 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 ($_valueToJson) {
         if (is_array($result['value'])) {
             foreach ($result['value'] as $key => $value) {
                 $result['value'][$key] = $this->_resolveRecord($value);
             }
         } else {
             $result['value'] = $this->_resolveRecord($result['value']);
         }
     }
     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 ($_valueToJson == true) {
         $result['value'] = Timetracker_Controller_Timeaccount::getInstance()->get($result['value'])->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);
     $result['value'] = array('from' => $this->_from, 'until' => $this->_until);
     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 (strtolower($this->_cfRecord->definition['type']) == 'record') {
         try {
             $modelParts = explode('.', $this->_cfRecord->definition['recordConfig']['value']['records']);
             // get model parts from saved record class e.g. Tine.Admin.Model.Group
             $controller = Tinebase_Core::getApplicationInstance($modelParts[1], $modelParts[3]);
             $result['value']['value'] = $controller->get($result['value']['value'])->toArray();
         } catch (Exception $e) {
             if (Tinebase_Core::isLogLevel(Zend_Log::ERR)) {
                 Tinebase_Core::getLogger()->err(__METHOD__ . '::' . __LINE__ . ' Error resolving custom field record: ' . $e->getMessage());
             }
             $result['value']['value'] = $customField->value;
         }
     }
     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 ($_valueToJson) {
         Calendar_Model_Attender::resolveAttendee($this->_value);
     }
     $result['value'] = $this->_operator == 'equals' ? $this->_value[0]->toArray($_valueToJson) : $this->_value->toArray($_valueToJson);
     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 ($_valueToJson == true) {
         // NOTE: at this point operators should be equals or in and all values should be paths
         $values = array();
         foreach ((array) $this->_value as $path) {
             $containerData = array('path' => $path);
             if ($containerId = Tinebase_Model_Container::pathIsContainer($path)) {
                 $containerData = array_merge($containerData, Tinebase_Container::getInstance()->getContainerById($containerId, TRUE)->toArray());
             } else {
                 if ($ownerId = Tinebase_Model_Container::pathIsPersonalNode($path)) {
                     // transform current user
                     $owner = Tinebase_User::getInstance()->getUserByPropertyFromSqlBackend('accountId', $ownerId);
                     $containerData['name'] = $owner->accountDisplayName;
                     $containerData['path'] = "/personal/{$ownerId}";
                     $containerData['owner'] = $owner->toArray();
                 }
             }
             $values[] = $containerData;
         }
         $result['value'] = is_array($this->_value) ? $values : $values[0];
     }
     return $result;
 }
示例#9
0
 /**
  * returns account id and type
  * @see tine20/Tinebase/Model/Filter/Tinebase_Model_Filter_Abstract::toArray()
  * 
  * @param  bool $_valueToJson resolve value for json api?
  * @return array
  */
 public function toArray($_valueToJson = false)
 {
     $result = parent::toArray($_valueToJson);
     $result['value'] = array('accountId' => $this->_accountId, 'accountType' => $this->_accountType);
     return $result;
 }
 /**
  * get a new single filter action
  *
  * @param string|array $_fieldOrData
  * @param string $_operator
  * @param mixed  $_value
  * @param array  $_options
  *
  * @todo remove legacy code + obsolete params sometimes
  */
 public function __construct($_fieldOrData, $_operator = NULL, $_value = NULL, array $_options = array())
 {
     $this->_setOpSqlMap();
     parent::__construct($_fieldOrData, $_operator, $_value, $_options);
 }
 /**
  * Add a filter to this group
  *
  * @param  Tinebase_Model_Filter_Abstract $_filter
  * @param  boolean $_setFromArray
  * @return Tinebase_Model_Filter_FilterGroup this
  * @throws Tinebase_Exception_InvalidArgument
  */
 public function addFilter(Tinebase_Model_Filter_Abstract $_filter, $_setFromArray = FALSE)
 {
     if (!$_filter instanceof Tinebase_Model_Filter_Abstract) {
         throw new Tinebase_Exception_InvalidArgument('Filters must be of instance Tinebase_Model_Filter_Abstract');
     }
     if (!$_setFromArray && $_filter instanceof Tinebase_Model_Filter_AclFilter) {
         // this is added afterwards and considered as an implicit acl filter
         $_filter->setIsImplicit(TRUE);
     }
     $this->_filterObjects[] = $_filter;
     return $this;
 }