예제 #1
0
 /**
  *
  * @param Icon $icon
  * @param array $options
  * @author Benjamin Butschell <*****@*****.**>
  */
 public function prepareIconMarkup(Icon $icon, array $options = array())
 {
     // error checking
     if (empty($options['contentElementKey'])) {
         throw new \InvalidArgumentException('The option "contentElementKey" is required and must not be empty', 1440754978);
     }
     $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $this->storageRepository = $this->objectManager->get("MASK\\Mask\\Domain\\Repository\\StorageRepository");
     $this->extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['mask']);
     $this->contentElement = $this->storageRepository->loadElement("tt_content", $options["contentElementKey"]);
     $icon->setMarkup($this->generateMarkup($icon, $options));
 }
예제 #2
0
 /**
  * action delete
  *
  * @param string $key
  * @param string $type
  * @return void
  */
 public function deleteAction($key, $type)
 {
     $this->storageRepository->remove($type, $key);
     $this->generateAction();
     $this->addFlashMessage(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('tx_mask.content.deletedcontentelement', 'mask'));
     $this->redirect('list');
 }
예제 #3
0
 /**
  * Checks if a key for an element is available
  *
  * @param array $params Array of parameters from the AJAX interface, not
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj Object of type AjaxRequestHandler
  * @author Benjamin Butschell <*****@*****.**>
  * @return void
  */
 public function checkElementKey($params = array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj = NULL)
 {
     $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $this->storageRepository = $this->objectManager->get("MASK\\Mask\\Domain\\Repository\\StorageRepository");
     // Get parameters, is there a better way? $params is not used yet
     $elementKey = $_GET["key"];
     // check if elementKey is available
     $isAvailable = TRUE;
     if ($this->storageRepository->loadElement("tt_content", $elementKey)) {
         $isAvailable = FALSE;
     }
     // return infos as json
     $ajaxObj->setContentFormat("plain");
     $ajaxObj->addContent("isAvailable", json_encode($isAvailable));
 }
예제 #4
0
 /**
  * Adds FAL-Files to the data-array if available
  *
  * @param array $data
  * @param array $table
  * @author Benjamin Butschell <*****@*****.**>
  */
 public function addIrreToData(&$data, $table = "tt_content", $cType = "")
 {
     if ($cType == "") {
         $cType = $data["CType"];
     }
     $storage = $this->storageRepository->load();
     $contentFields = $storage[$table]["tca"];
     if ($contentFields) {
         foreach ($contentFields as $fieldname => $field) {
             if ($this->getFormType($field["key"], $cType, $table) == "Inline") {
                 $elements = $this->getInlineElements($data, $fieldname, $cType, "parentid", $table);
                 $data[$fieldname] = $elements;
             }
         }
     }
 }
예제 #5
0
 /**
  * Returns the SQL of all elements
  *
  * @param array $sqlString
  * @return array
  */
 public function addDatabaseTablesDefinition(array $sqlString)
 {
     $sql = $this->storageRepository->loadSql();
     $mergedSqlString = array_merge($sqlString, $sql);
     return array('sqlString' => $mergedSqlString);
 }
예제 #6
0
 /**
  * action delete
  *
  * @param array $storage
  * @return void
  */
 public function deleteAction(array $storage)
 {
     $this->storageRepository->remove($storage);
     $this->addFlashMessage('Your Page was removed.');
     $this->redirect('list');
 }