/**
  * Entry function that hooks into the main typo3/alt_clickmenu.php,
  * see ext_tables.php of this extension for more info
  *
  * @param $backRef		the clickMenu object
  * @param $menuItems	the menuItems as an array that are already filled from the main clickmenu 
  * @param $table	the table that is worked on (tx_dam_cat only)
  * @param $uid		the item UID that is worked on
  * @return unknown
  */
 function main(&$backRef, $menuItems, $table, $uid)
 {
     if ($table != 'tx_dam_cat') {
         return $menuItems;
     }
     $this->backRef =& $backRef;
     // Get record
     $this->rec = t3lib_BEfunc::getRecordWSOL($table, $uid);
     $menuItems = array();
     $root = !strcmp($uid, '0') ? true : false;
     if (is_array($this->rec) || $root) {
         $lCP = $GLOBALS['BE_USER']->calcPerms(t3lib_BEfunc::getRecord('pages', $root ? tx_dam_db::getPid() : $this->rec['pid']));
         // Edit
         if (!$root && $GLOBALS['BE_USER']->isPSet($lCP, $table, 'edit') && !in_array('edit', $this->backRef->disabledItems)) {
             $menuItems['edit'] = $this->DAMcatEdit($table, $uid);
         }
         // New Category
         if (!in_array('new', $this->backRef->disabledItems) && $GLOBALS['BE_USER']->isPSet($lCP, $table, 'new')) {
             $menuItems['new'] = $this->DAMnewSubCat($table, $uid);
         }
         // Info
         if (!in_array('info', $this->backRef->disabledItems) && !$root) {
             $menuItems['info'] = $this->DAMcatInfo($table, $uid);
         }
         // Delete
         $elInfo = array(t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle($table, $this->rec), $GLOBALS['BE_USER']->uc['titleLen']));
         if (!in_array('delete', $this->backRef->disabledItems) && !$root && $GLOBALS['BE_USER']->isPSet($lCP, $table, 'delete')) {
             $menuItems['spacer2'] = 'spacer';
             $menuItems['delete'] = $this->DAMcatDelete($table, $uid, $elInfo);
         }
     }
     return $menuItems;
 }
 /**
  * Main function
  *
  * @return	void
  */
 function main()
 {
     global $LANG, $TCA, $BACK_PATH;
     $content = '';
     $param = t3lib_div::_GP('edit');
     $table = key($param);
     $uid = (string) key($param[$table]);
     $cmd = $param[$table][$uid];
     if (is_array($TCA[$table]) and $cmd == 'new') {
         $this->defaultPid = tx_dam_db::getPid();
         $getArray['edit'][$table][$this->defaultPid] = 'new';
         $getArray['defVals'] = t3lib_div::_GP('defVals');
         $getArray['defVals'][$table]['pid'] = $this->defaultPid;
         $getArray['returnUrl'] = $this->pObj->returnUrl;
         $getArray['redirect'] = $this->pObj->redirect;
         $getArray = t3lib_div::compileSelectedGetVarsFromArray('returnUrl,redirect,edit,defVals,overrideVals,columnsOnly,disHelp,noView,editRegularContentFromId', $getArray);
         $getUrl = t3lib_div::implodeArrayForUrl('', $getArray);
         header('Location: ' . $BACK_PATH . 'alt_doc.php?id=' . $this->defaultPid . $getUrl);
         exit;
     } else {
         $content .= 'wrong comand!';
     }
     #TODO do it always this way (with if)
     if ($this->pObj->returnUrl) {
         $content .= '<br /><br />' . $this->pObj->btn_back('', $this->pObj->returnUrl);
     }
     // todo csh
     #		$content.= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'file_rename', $GLOBALS['BACK_PATH'],'<br/>');
     return $content;
 }
 /**
  * tx_dam_db::getPid()
  */
 public function test_getPID()
 {
     $pid = tx_dam_db::getPid();
     self::assertTrue($pid > 0, 'No DAM sysfolder detected/created');
     $pid = tx_dam_db::getPidList();
     self::assertTrue(!($pid == '0'), 'No DAM sysfolder detected/created');
 }
    /**
     * List media types, along with options to edit & delete
     *
     * @return	string		HTML table of all the mimetypes
     */
    function listMimeTypes()
    {
        global $LANG, $BACK_PATH, $BE_USER;
        // Load template
        $content = t3lib_parsehtml::getSubpart(t3lib_div::getURL($BACK_PATH . t3lib_extMgm::extRelPath('dam') . 'modfunc_tools_mimetypes/template.html'), '###MOD_TEMPLATE###');
        $rowTemplate[1] = t3lib_parsehtml::getSubpart($content, '###ROW_1###');
        $rowTemplate[2] = t3lib_parsehtml::getSubpart($content, '###ROW_2###');
        // Add some JS
        $this->pObj->doc->JScode .= $this->pObj->doc->wrapScriptTags('
				function deleteRecord(id)	{	//
					if (confirm(' . $LANG->JScharCode($LANG->getLL('deleteWarning')) . '))	{
						window.location.href = "' . $BACK_PATH . 'tce_db.php?cmd[tx_dam_media_types]["+id+"][delete]=1&redirect=' . rawurlencode(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL')) . '&id=' . tx_dam_db::getPid() . '&vC=' . $BE_USER->veriCode() . '&prErr=1&uPT=1";
					}
					return false;
				}
		');
        // Get content
        $alternate = 1;
        $rows = '';
        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tx_dam_media_types', '', '', 'ext ASC');
        while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
            $editURL = $BACK_PATH . 'alt_doc.php?returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL')) . '&id=' . tx_dam_db::getPid() . '&edit[tx_dam_media_types][' . $row['uid'] . ']=edit';
            //$deleteURL = $BACK_PATH . 'alt_doc.php?returnUrl=' . rawurlencode( t3lib_div::getIndpEnv('TYPO3_REQUEST_URL') ) . '&id=' . tx_dam_db::getPid() . '&edit[tx_dam_media_types][' . $row['uid'] . '][delete]=1';
            $rowMarkers['EDIT'] = '<a href="#" onclick="window.location.href=\'' . $editURL . '\'; return false;"><img' . t3lib_iconWorks::skinImg($this->pObj->doc->backPath, 'gfx/edit2.gif', 'width="11" height="12"') . ' title="Edit this type" alt="" height="16" width="16"></a>';
            $rowMarkers['DELETE'] = '<a href="#" onclick="deleteRecord(' . $row['uid'] . ')"><img' . t3lib_iconWorks::skinImg($this->pObj->doc->backPath, 'gfx/deletedok.gif', 'width="11" height="12"') . ' title="Delete this type" alt="" height="16" width="16"></a>';
            $rowMarkers['EXTENSION'] = $row['ext'];
            $rowMarkers['MIME'] = $row['mime'];
            $rowMarkers['ICON'] = '<img src="' . $BACK_PATH . tx_dam::icon_getFileType(array('file_type' => $row['ext'], 'media_type' => $row['type'])) . '" />';
            $rows .= t3lib_parsehtml::substituteMarkerArray($rowTemplate[$alternate], $rowMarkers, '###|###');
            // Cycle the alternating rows
            if ($alternate == 2) {
                $alternate = 1;
            } else {
                $alternate = 2;
            }
        }
        $content = t3lib_parsehtml::substituteSubpart($content, '###ROWS###', $rows);
        $GLOBALS['TYPO3_DB']->sql_free_result($res);
        return $content;
    }
 /**
  * Init dam config values - which means they are fetched from TSConfig
  *
  * @param	boolean $force Will force the initialization to be done again except definedTSconfig set by config_setValue
  * @return void
  */
 function init($force = false)
 {
     $config =& $GLOBALS['T3_VAR']['ext']['dam']['config'];
     $perfomMerge = false;
     if (!is_array($config)) {
         $config = array();
         $config['mergedTSconfig.'] = array();
         $config['definedTSconfig.'] = array();
     }
     if (($force or !is_array($config['userTSconfig.'])) and $TSconfig = tx_dam_config::_getTSconfig()) {
         $config['pageUserTSconfig.'] = $config['userTSconfig.'] = $TSconfig;
         $perfomMerge = true;
     }
     if ($force or !is_array($config['pageTSconfig.'])) {
         if ($pid = tx_dam_db::getPid() and $TSconfig = tx_dam_config::_getTSconfig($pid)) {
             $config['pageTSconfig.'] = $TSconfig;
             $config['pageUserTSconfig.'] = t3lib_div::array_merge_recursive_overrule((array) $config['pageTSconfig.'], (array) $config['userTSconfig.']);
             $perfomMerge = true;
         }
     }
     if ($perfomMerge) {
         $config['mergedTSconfig.'] = t3lib_div::array_merge_recursive_overrule((array) $config['pageUserTSconfig.'], (array) $config['definedTSconfig.']);
     }
 }
 /**
  * Initializes the backend module by setting internal variables
  *
  * @return	void
  */
 function init()
 {
     global $TYPO3_CONF_VARS, $FILEMOUNTS;
     // name might be set from outside
     if (!$this->MCONF['name']) {
         $this->MCONF = $GLOBALS['MCONF'];
     }
     tx_dam::config_init();
     # tx_dam::config_setValue('setup.devel', '1');
     $this->defaultPid = tx_dam_db::getPid();
     $this->id = $this->defaultPid;
     // from parent::init();
     $this->CMD = t3lib_div::_GP('CMD');
     $this->perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
     $this->menuConfig();
     $this->handleExternalFunctionValue();
     // include the default language file
     $GLOBALS['LANG']->includeLLFile('EXT:dam/lib/locallang.xml');
     //
     // Get current folder
     //
     // tx_dam_folder could be set by GP or stored in module conf
     $SET = t3lib_div::_GP('SET');
     $this->path = $this->MOD_SETTINGS['tx_dam_folder'];
     // check if tx_dam_folder was set by GP which takes precedence, if not use command sent by navframe
     // order: GP (script), SLCMD (navframe), MOD_SETTINGS (stored)
     $SLCMD = t3lib_div::_GPmerged('SLCMD');
     if (!$SET['tx_dam_folder'] and is_array($SLCMD['SELECT']) and is_array($SLCMD['SELECT']['txdamFolder'])) {
         $this->path = tx_dam::path_makeRelative(key($SLCMD['SELECT']['txdamFolder']));
     }
     $this->checkOrSetPath();
     $this->pageinfo = t3lib_BEfunc::readPageAccess($this->defaultPid, $this->perms_clause);
     $this->calcPerms = $GLOBALS['BE_USER']->calcPerms($this->pageinfo);
     //
     // Detect and set forced single function and set params
     //
     // remove selection command from any params
     $this->addParams['SLCMD'] = '';
     $this->addParams['SET'] = '';
     // forced a module function?
     $forcedFunction = t3lib_div::_GP('forcedFunction');
     if ($this->MOD_MENU['function'][$forcedFunction]) {
         $this->forcedFunction = $forcedFunction;
         $this->addParams['forcedFunction'] = $this->forcedFunction;
         $this->handleExternalFunctionValue('function', $this->forcedFunction);
     }
     //
     // Init selection
     //
     $this->selection = t3lib_div::makeInstance('tx_dam_selectionQuery');
     $maxPages = $this->config_checkValueEnabled('browserMaxPages', 20);
     $this->MOD_SETTINGS['tx_dam_resultPointer'] = $this->selection->initPointer($this->MOD_SETTINGS['tx_dam_resultPointer'], $this->MOD_SETTINGS['tx_dam_resultsPerPage'], $maxPages);
     $this->selection->initSelection($this, $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['dam']['selectionClasses'], 'tx_dam', 'tx_dam_select');
     $this->selection->initQueryGen();
     $this->selection->qg->initBESelect('tx_dam', tx_dam_db::getPidList());
     $this->selection->addFilemountsToQuerygen();
     // debug output
     if (tx_dam::config_getValue('setup.devel')) {
         $this->debugContent['MOD_SETTINGS'] = '<h4>MOD_SETTINGS</h4>' . t3lib_div::view_array($this->MOD_SETTINGS);
     }
     // BE Info output
     if (tx_dam::config_getValue('setup.devel') and t3lib_extMgm::isLoaded('cc_beinfo')) {
         require_once t3lib_extMgm::extPath('cc_beinfo') . 'class.tx_ccbeinfo.php';
         $beinfo = t3lib_div::makeInstance('tx_ccbeinfo');
         $beinfoContent = $beinfo->makeInfo($this);
         $this->debugContent['beinfo'] = '<h4>BE Info</h4>' . $beinfoContent;
     }
 }
Exemplo n.º 7
0
 /**
  * Process auto indexing for the given file.
  * This should be used to index files easily.
  * When auto indexing is disabled the indexing will not be processed.
  *
  * @param	string		$filename Filename with path
  * @param	boolean		$reindex If set already indexed files will be reindexed
  * @return	array		Meta data array. $meta['fields'] has the record data. Returns false when nothing was indexed but file might be in index already.
  */
 function index_autoProcess($filename, $reindex = false)
 {
     global $TYPO3_CONF_VARS;
     // disable auto indexing by setup
     if (!tx_dam::config_getValue('setup.indexing.auto')) {
         return false;
     }
     $filename = tx_dam::file_absolutePath($filename);
     if (!@is_file($filename)) {
         return false;
     }
     // we don't index indexing setup files
     if (basename($filename) == '.indexing.setup.xml') {
         return false;
     }
     if (!$reindex and tx_dam::file_isIndexed($filename)) {
         return false;
     }
     require_once PATH_txdam . 'lib/class.tx_dam_indexing.php';
     $index = t3lib_div::makeInstance('tx_dam_indexing');
     $index->init();
     $index->setDefaultSetup(tx_dam::file_dirname($filename));
     $index->initEnabledRules();
     $index->enableReindexing($reindex);
     // overrule some parameter from setup
     $index->setPath($filename);
     $index->setPID(tx_dam_db::getPid());
     $index->setRunType('auto');
     $index->enableMetaCollect();
     // indexing ...
     $index->indexUsingCurrentSetup();
     return current($index->meta);
 }
 /**
  * Get the stored settings from MOD_SETTINGS and set them in $this->storedSettings
  *
  * @return	void
  */
 function initStorage($uidList = '', $pidList = '')
 {
     $pidList = $pidList ? $GLOBALS['TYPO3_DB']->cleanIntList($pidList) : '';
     $pidList = $pidList ? $pidList : tx_dam_db::getPid();
     $pidList = $this->table . '.pid IN (' . $pidList . ')';
     $uidList = $uidList ? $GLOBALS['TYPO3_DB']->cleanIntList($uidList) : '';
     $uidList = $uidList ? ' AND ' . $this->table . '.uid IN (' . $uidList . ')' : '';
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $this->table, $pidList . $uidList . ' AND ' . tx_dam_db::deleteClause($this->table), '', $this->table . '.title');
     $this->storedSettings = array();
     while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
         #$row['definition'] = t3lib_div::xml2array($row['definition']);
         $this->storedSettings[$row['uid']] = $row;
     }
     $GLOBALS['TYPO3_DB']->sql_free_result($res);
     $this->storedSettings = $this->cleanupStorageArray($this->storedSettings);
 }
 /**
  * Move lost DAM records to the DAM sysfolder.
  * This is a maintance function.
  *
  * @param	integer		$pid If set this PID will be used as storage sysfolder for the lost folder.
  * @param	boolean		$forceAll If true (default) all DAM records will be moved not only the ony with pid=0.
  * @return	void
  */
 function collectLostRecords($pid = NULL, $forceAll = true)
 {
     $pid = $pid ? $pid : tx_dam_db::getPid();
     if ($pid) {
         $mediaTables = tx_dam::register_getEntries('mediaTable');
         $values = array('pid' => $pid);
         if ($forceAll) {
             foreach ($mediaTables as $table) {
                 $res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, $table . '.pid NOT IN (' . tx_dam_sysfolder::getPidList() . ')', $values);
             }
         } else {
             foreach ($mediaTables as $table) {
                 $res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, $table . '.pid=0', $values);
             }
         }
     }
 }
Exemplo n.º 10
0
									<size>48</size>
								</config>
							</TCEforms>
					      </xmlTitle>
					    </el>
					  </ROOT>
					</T3DataStructure>
				')));
}
t3lib_extMgm::addTCAcolumns('tt_content', $tempColumns, 1);
unset($tempColumns);
// Adding soft reference keys to tt_content configuration
require_once PATH_txdam . 'binding/softref/ext_tables.php';
if (TYPO3_MODE === 'BE') {
    // this forces the DAM sysfolder to be created if not yet available
    $temp_damFolder = tx_dam_db::getPid();
    if ($TYPO3_CONF_VARS['EXTCONF']['dam']['setup']['hideMediaFolder']) {
        t3lib_extMgm::addUserTSConfig('
			options.hideRecords.pages = ' . $temp_damFolder . '
		');
    }
    // add module after 'File'
    if (!isset($TBE_MODULES['txdamM1'])) {
        $temp_TBE_MODULES = array();
        foreach ($TBE_MODULES as $key => $val) {
            if ($key === 'file') {
                $temp_TBE_MODULES[$key] = $val;
                $temp_TBE_MODULES['txdamM1'] = $val;
            } else {
                $temp_TBE_MODULES[$key] = $val;
            }
 /**
  * Update the media types table for browsing
  * Will be called when a meta data record was inserted.
  *
  * @param	array		$meta meta data. $meta['media_type'] and $meta['file_type'] have to be set
  * @return	void
  */
 function insertMetaTrigger($meta)
 {
     $TX_DAM = $GLOBALS['T3_VAR']['ext']['dam'];
     $mediaType = intval($meta['media_type']);
     // check if media type exists
     if ($typeStr = tx_dam::convert_mediaType($mediaType)) {
         // get the id of the media type record
         $media_id = false;
         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'tx_dam_metypes_avail', 'type=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($mediaType, 'tx_dam_metypes_avail'));
         if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
             $media_id = $row['uid'];
         }
         // no record - then create one
         if (!$media_id) {
             $sorting = $TX_DAM['code2sorting'][$mediaType];
             $sorting = $sorting ? $sorting : 10000;
             $fields_values = array();
             $fields_values['pid'] = tx_dam_db::getPid();
             $fields_values['parent_id'] = 0;
             $fields_values['tstamp'] = time();
             $fields_values['title'] = $typeStr;
             $fields_values['type'] = $mediaType;
             $fields_values['sorting'] = $sorting;
             $res = $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_dam_metypes_avail', $fields_values);
             $media_id = $GLOBALS['TYPO3_DB']->sql_insert_id();
         }
         // get file type record
         $type_id = false;
         if ($media_id) {
             $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'tx_dam_metypes_avail', 'title=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($meta['file_type'], 'tx_dam_metypes_avail') . ' AND parent_id=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($media_id, 'tx_dam_metypes_avail'));
             if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                 $type_id = $row['uid'];
             }
         }
         // no record - then create one
         if (!$type_id) {
             $fields_values = array();
             $fields_values['pid'] = tx_dam_db::getPid();
             $fields_values['parent_id'] = $media_id;
             $fields_values['tstamp'] = time();
             $fields_values['title'] = $meta['file_type'] ? $meta['file_type'] : 'n/a';
             $fields_values['type'] = $mediaType;
             $res = $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_dam_metypes_avail', $fields_values);
         }
     }
 }
Exemplo n.º 12
0
 /**
  * Following fields will be initialized if not set in the array: pid, crdate, tstamp
  *
  * @param	array		$meta Meta data record as array
  * @param	boolean		$force If set the field values will be set no matter what.
  * @return	array		$meta Meta data record as array
  */
 function setMetaDefaultFields($meta, $force = false)
 {
     if ($force or !isset($meta['uid'])) {
         if ($force or !isset($meta['pid'])) {
             $meta['pid'] = tx_dam_db::getPid();
         }
         if ($force or !isset($meta['crdate'])) {
             $meta['crdate'] = time();
         }
     }
     if ($force or !isset($meta['tstamp'])) {
         $meta['tstamp'] = time();
     }
     return $meta;
 }
Exemplo n.º 13
0
    /**
     * Main function of the module. Write the content to $this->content
     */
    function main()
    {
        global $BE_USER, $LANG, $BACK_PATH, $TCA, $TYPO3_CONF_VARS;
        $this->defaultPid = tx_dam_db::getPid();
        $this->id = $this->id ? $this->id : $this->defaultPid;
        // Access check!
        // The page will show only if there is a valid page and if this page may be viewed by the user
        $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause);
        $access = is_array($this->pageinfo) ? 1 : 0;
        if ($this->id && $access || $BE_USER->user['admin'] && !$this->id) {
            // Draw the header.
            $this->doc = t3lib_div::makeInstance('template');
            $this->doc->backPath = $BACK_PATH;
            $this->doc->setModuleTemplate(t3lib_extMgm::extRelPath('dam_catedit') . 'mod1/mod_template.html');
            $this->doc->form = '<form action="" method="post">';
            $this->doc->styleSheetFile2 = t3lib_extMgm::extRelPath('dam') . 'res/css/stylesheet.css';
            if (t3lib_div::compat_version('4.2.0')) {
                $this->doc->getContextMenuCode();
            } else {
                $CMparts = $this->doc->getContextMenuCode();
                $this->doc->bodyTagAdditions = $CMparts[1];
                $this->doc->JScode .= $CMparts[0];
                $this->doc->postCode .= $CMparts[2];
            }
            // Add JavaScript functions to the page:
            $this->doc->JScode = $this->doc->wrapScriptTags('
				function jumpToUrl(URL)	{	//
					window.location.href = URL;
					return false;
				}
				function jumpExt(URL,anchor)	{	//
					var anc = anchor?anchor:"";
					window.location.href = URL+(T3_THIS_LOCATION?"&returnUrl="+T3_THIS_LOCATION:"")+anc;
					return false;
				}
				function jumpSelf(URL)	{	//
					window.location.href = URL+(T3_RETURN_URL?"&returnUrl="+T3_RETURN_URL:"");
					return false;
				}

				function setHighlight(id)	{	//
					top.fsMod.recentIds["dam_cat"]=id;
					top.fsMod.navFrameHighlightedID["dam_cat"]="pages"+id+"_"+top.fsMod.currentBank;	// For highlighting

				}
				' . $this->doc->redirectUrls(t3lib_div::getIndpEnv('REQUEST_URI')) . '
				function editRecords(table,idList,addParams,CBflag)	{	//
					window.location.href="' . $BACK_PATH . 'alt_doc.php?returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . '&edit["+table+"]["+idList+"]=edit"+addParams;
				}
				function editList(table,idList)	{	//
					var list="";

						// Checking how many is checked, how many is not
					var pointer=0;
					var pos = idList.indexOf(",");
					while (pos!=-1)	{
						if (cbValue(table+"|"+idList.substr(pointer,pos-pointer))) {
							list+=idList.substr(pointer,pos-pointer)+",";
						}
						pointer=pos+1;
						pos = idList.indexOf(",",pointer);
					}
					if (cbValue(table+"|"+idList.substr(pointer))) {
						list+=idList.substr(pointer)+",";
					}

					return list ? list : idList;
				}

				if (top.fsMod) top.fsMod.recentIds["dam_cat"] = ' . intval($this->id) . ';

			');
            // title in document body
            $this->content .= $this->doc->header($LANG->getLL('title'));
            $this->content .= $this->doc->spacer(5);
            // render module content
            $this->content .= $this->moduleContent();
            $page = $this->doc->startPage($LANG->getLL('title'));
            $page .= $this->doc->moduleBody(array(), $this->getDocHeaderButtons(), $this->getTemplateMarkers());
            $page .= $this->doc->endPage();
            $this->content = $page;
        } else {
            // If no access or if ID == zero
            $this->doc = t3lib_div::makeInstance('mediumDoc');
            $this->doc->backPath = $BACK_PATH;
            $this->content .= $this->doc->startPage($LANG->getLL('title'));
            $this->content .= $this->doc->header($LANG->getLL('title'));
            $this->content .= $this->doc->spacer(5);
            $this->content .= $this->doc->spacer(10);
        }
    }
 /**
  * Set Pid of the sysfolder where the DAM records should be written
  *
  * @param	integer		$pid page id
  * @return	void
  */
 function setPID($pid = 0)
 {
     if ($pid == 0 and !$this->pid) {
         $this->pid = tx_dam_db::getPid();
     } elseif ($pid) {
         $this->pid = $pid;
     }
     if ($this->writeDevLog) {
         t3lib_div::devLog('setPID(): ' . $this->pid, 'tx_dam_indexing');
     }
 }
 /**
  * Creates a new category
  *
  * @param	[string]		$folder: Foldername for creating the category
  * @param	[integer]		$parentId: Parent ID
  * @return	[integer]		uid of created category
  */
 function createCategory($folder, $parentId = '0')
 {
     $tce = t3lib_div::makeInstance('t3lib_TCEmain');
     $NEW_id = substr(md5(time() - 98 * 123123 . $folder), 0, 8);
     $newdata['tx_dam_cat']['NEW' . $NEW_id] = array('pid' => tx_dam_db::getPid(), 'title' => $folder, 'parent_id' => $parentId);
     $tce->start($newdata, array());
     $tce->process_datamap();
     return $tce->substNEWwithIDs['NEW' . $NEW_id];
 }
 /**
  * Index uploaded files
  *
  * @param	array		$fileList: List of files
  * @return	void
  */
 function indexUploadedFiles($fileList)
 {
     global $BACK_PATH, $LANG, $TYPO3_CONF_VARS;
     require_once PATH_txdam . 'lib/class.tx_dam_indexing.php';
     $index = t3lib_div::makeInstance('tx_dam_indexing');
     $index->init();
     //$index->setDefaultSetup(tx_dam::path_makeAbsolute($this->pObj->path));
     $index->enableReindexing(2);
     $index->initEnabledRules();
     $index->setRunType('auto');
     $index->indexFiles($fileList, tx_dam_db::getPid());
 }