/**
  * Makes all protected methods from class Controller callable publically.
  */
 public function __call($strMethod, $arrArgs)
 {
     return call_user_func_array(array(MetaModelController::getInstance(), $strMethod), $arrArgs);
 }
 /**
  * Replace all insert tags in the query string.
  *
  * @param string $strSQL    SQL to parse
  *
  * @param array  $arrParams Query param stack
  *
  * @return string Parsed SQL
  */
 protected function parseInsertTags($strSQL, array &$arrParams)
 {
     return MetaModelController::getInstance()->replaceInsertTags($strSQL);
 }
 /**
  * Returns the frontend filter widget information for the filter setting.
  *
  * The returning array will hold the following keys:
  * * class      - The CSS classes for the widget.
  * * label      - The label text for the widget.
  * * formfield  - The parsed default widget object for this filter setting.
  * * raw        - The widget information that was used for rendering "formfield" as raw array (this means
  *                prior calling prepareForWidget()).
  * * urlparam   - The URL parameter used for this widget.
  * * options    - The filter options available to be used in selects etc. see prepareFrontendFilterOptions
  *                for details on the contained array.
  * * autosubmit - True if the frontend filter shall perform auto form submitting, false otherwise.
  * * urlvalue   - The current value selected in the filtersetting. Will use "urlvalue" from $arrWidget with
  *                fallback to the value of the url param in the filter url.
  *
  * @param array $arrWidget     The widget information to use for generating.
  *
  * @param array $arrFilterUrl  The filter url parameters to use.
  *
  * @param array $arrJumpTo     The jumpTo page to use for URL generating - if empty, the current
  *                             frontend page will get used.
  *
  * @param bool  $blnAutoSubmit Determines if the generated options/widgets shall perform auto submitting
  *                             or not.
  *
  * @return array
  */
 protected function prepareFrontendFilterWidget($arrWidget, $arrFilterUrl, $arrJumpTo, MetaModelFrontendFilterOptions $objFrontendFilterOptions)
 {
     $strClass = $GLOBALS['TL_FFL'][$arrWidget['inputType']];
     // No widget? no output! that's it.
     if (!$strClass) {
         return array();
     }
     // Determine current value.
     $arrWidget['value'] = $arrFilterUrl[$arrWidget['eval']['urlparam']];
     $arrData = MetaModelController::getInstance()->prepareForWidget($arrWidget, $arrWidget['eval']['urlparam'], $arrWidget['value']);
     if ($objFrontendFilterOptions->isAutoSubmit() && TL_MODE == 'FE') {
         $GLOBALS['TL_JAVASCRIPT']['metamodels'] = 'system/modules/metamodels/html/metamodels.js';
     }
     /** @var Widget $objWidget */
     $objWidget = new $strClass($arrData);
     $strField = $objWidget->generate();
     return array('class' => sprintf('mm_%s %s%s%s', $arrWidget['inputType'], $arrWidget['eval']['urlparam'], $arrWidget['value'] !== null ? ' used' : ' unused', $objFrontendFilterOptions->isAutoSubmit() ? ' submitonchange' : ''), 'label' => $objWidget->generateLabel(), 'formfield' => $strField, 'raw' => $arrWidget, 'urlparam' => $arrWidget['eval']['urlparam'], 'options' => $this->prepareFrontendFilterOptions($arrWidget, $arrFilterUrl, $arrJumpTo, $objFrontendFilterOptions->isAutoSubmit()), 'count' => $arrWidget['count'], 'showCount' => $objFrontendFilterOptions->isShowCountValues(), 'autosubmit' => $objFrontendFilterOptions->isAutoSubmit(), 'urlvalue' => array_key_exists('urlvalue', $arrWidget) ? $arrWidget['urlvalue'] : $arrWidget['value']);
 }
 /**
  * Process all folders and resolve to a valid file list.
  *
  * @return ToolboxFile
  */
 public function resolveFiles()
 {
     // Step 1.: fetch all files.
     $this->collectFiles();
     // TODO: check if downloading is allowed and send file to browser then
     // see https://github.com/MetaModels/attribute_file/issues/6
     if (!$this->getShowImages() && ($strFile = Input::getInstance()->get('file')) && in_array($strFile, $this->foundFiles)) {
         MetaModelController::getInstance()->sendFileToBrowser($strFile);
     }
     // Step 2.: Fetch all meta data for the found files.
     $this->parseMetafiles();
     // Step 3.: fetch additional information like modification time etc. and prepare the output buffer.
     $this->fetchAdditionalData();
     return $this;
 }