/**
  * prepare data for mongo query
  * @param array $filterFields - filter data passed in post
  * @param array $sortFields - sort value passed in post
  * @param array $dbRefData - actual values for ids saved as reference/id
  * @param int $limit - number of rows to return
  * @param int $skip - number of rows to skip
  * @return array - mongodb query conditions for advanced grid
  */
 protected function _getQueryForAdvancedGrid($filterFields, $sortFields, $dbRefData, $limit = 0, $skip = 0)
 {
     $query = parent::_getQueryForAdvancedGrid($filterFields, $sortFields, $dbRefData, $limit, $skip);
     // always have photo in filter list which controls what fields to show
     $query['fields']['photo.fileStorageId'] = 1;
     return $query;
 }
 /**
  * update the fields pulled from form xml to match fields used for query for advanced grid
  * @param array $fields filterFields - original fields pulled from form xml
  * @param array $filterFields filterFields - filter fields' values
  * @param array $sortFields filterFields - sort fields' values
  * @return array - an array with updated field names for advanced grid
  */
 protected function _getFieldsForAdvancedGrid($fields, $filterFields, $sortFields)
 {
     $fields = parent::_getFieldsForAdvancedGrid($fields, $filterFields, $sortFields);
     $fields = ['photo.fileStorageId' => ['label' => 'photo', 'type' => 'image', 'isFilterField' => 1, 'isSortField' => 0, 'filterOrder' => -1, 'sortOrder' => 999, 'position' => 'left']] + $fields;
     // include photo field
     return $fields;
 }
 public function getUserInfo($id)
 {
     // Get the Contact by email or userId to find the contactId
     // Instantiate the contact controller
     $ContactController = $this->getServiceLocator()->get('ContactController');
     $ContactController->setValidateOAuth(false);
     // Get the contact with the user_id associated to the Token
     $where = new Where();
     $where->nest()->equalTo(CONTACT_EMAIL, $id)->or->equalTo(CONTACT_USERID, $id);
     $contact = $ContactController->get($where);
     if ($contact->getVariable('status') == STATUS_FAILED) {
         throw new CommonException(array('messageId' => 'globals.query.record_not_found', 'parms' => array('id' => $id), EXCEPTION_ERRORKEY => 404, 'code' => 404));
     }
     $this->setValidateOAuth(false);
     $result = parent::get($contact->getVariable($ContactController->getTable()->getPk()));
     $this->setValidateOAuth(true);
     // TODO - Validate only one record found
     return $result;
 }
 /**
  * prepare data for mongo query
  * @param array $filterFields - filter data passed in post
  * @param array $sortFields - sort value passed in post
  * @param array $dbRefData - actual values for ids saved as reference/id
  * @param int $limit - number of rows to return
  * @param int $skip - number of rows to skip
  * @param int $type - type of activity
  * @param string $configPath string path of config file
  * @return array - mongodb query conditions for advanced grid
  */
 protected function _getQueryForAdvancedGrid($filterFields, $sortFields, $dbRefData, $limit = 0, $skip = 0)
 {
     $query = parent::_getQueryForAdvancedGrid($filterFields, $sortFields, $dbRefData, $limit, $skip);
     $query['fields']['attachment'] = 1;
     $query['fields']['type'] = 1;
     $query['fields']['owner'] = 1;
     $query['fields']['opportunity.watcher'] = 1;
     $query['fields']['application.watcher'] = 1;
     $query['fields']['lockedRecord'] = 1;
     return $query;
 }
 /**
  * Form service for custom attribute section document
  * @return \Zend\Stdlib\ResponseInterface
  */
 public function sectionFormServiceAction()
 {
     $this->_handler = 'MoveIn4CustomAttribute\\Model\\CustomAttributeSection';
     return parent::formServiceAction();
 }