Exemplo n.º 1
0
 /**
  * The main method called by the controller
  *
  * @param array $field
  * @param integer $form
  * @param object $mail
  * @param Tx_Powermail_Controller_FormsController $pObj
  *
  * @return string
  */
 public function process($field, $form, $mail, $pObj)
 {
     $data = array();
     if (is_array($field) && count($field) > 0) {
         foreach ($field as $uid => $value) {
             if (is_numeric($uid)) {
                 $fieldsRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Powermail_Domain_Repository_FieldsRepository');
                 $row = $fieldsRepository->findByUid($uid);
                 if ('sharepoint' == $row->getType()) {
                     if (NULL === $this->sharepointApi) {
                         $typoscriptConfiguration = $GLOBALS['TSFE']->tmpl->setup['module.']['tx_sharepointconnector.']['settings.']['sharepointServer.'];
                         $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
                         $sharepointRESTApi = $objectManager->create('Aijko\\SharepointConnector\\Sharepoint\\Rest\\Sharepoint');
                         $this->sharepointApi = $objectManager->create('Aijko\\SharepointConnector\\Sharepoint\\SharepointFacade', $sharepointRESTApi, $typoscriptConfiguration);
                     }
                     $sharepointAttribute = $this->sharepointApi->getListMappingAttributeByUid($row->getSharepointAttribute());
                     $data[$row->getSharepointList()][$sharepointAttribute->getTypo3FieldName()] = $value;
                 }
             }
         }
         // Store data
         $resultArray = $this->sharepointApi->addToMultipleLists($data);
         //if (!$resultArray) {
         // TODO error handling - array iteration
         //}
     }
 }
 /**
  * The main method called by the controller
  *
  * @return void
  */
 public function process()
 {
     // Get values from flexform
     $piObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tslib_pibase');
     $listMappingUid = $piObject->pi_getFFvalue($this->cObj->data['pi_flexform'], 'list', 'sSHAREPOINT');
     $typoscriptConfiguration = $GLOBALS['TSFE']->tmpl->setup['module.']['tx_sharepointconnector.']['settings.']['sharepointServer.'];
     $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $sharepointRESTApi = $objectManager->create('Aijko\\SharepointConnector\\Sharepoint\\Rest\\Sharepoint');
     $this->sharepointApi = $objectManager->create('Aijko\\SharepointConnector\\Sharepoint\\SharepointFacade', $sharepointRESTApi, $typoscriptConfiguration);
     if (!$this->sharepointApi->addToList($listMappingUid, $this->gp)) {
         // TODO error handling
     }
     return $this->gp;
 }