function getCollectionList($exist, $thePath, &$collectionList, $withEmpty = false) { $collectionList = array(); if ($withEmpty) { $collectionList['ref'][] = ''; $collectionList['desc'][] = ''; $collectionList['path'][] = ''; $collectionList['id'][] = ''; $collectionList['short'][] = ''; $collectionList['full'][] = ''; $collectionList['packages'][] = ''; } if ($thePath != '') { $collectionRecord = array(); $collections = $exist->getCollections($thePath); foreach ((array) $collections->collections->elements as $key => $collection) { $thePath2 = $thePath . $collection; $collectionList[$key]['ref'] = $collection; getCollectionRecord($exist, $thePath2, &$collectionRecord); $collectionList[$key]['path'] = $collectionRecord['path']; $collectionList[$key]['desc'] = $collectionRecord['desc']; $collectionList[$key]['id'] = $collectionRecord['id']; $collectionList[$key]['short'] = $collectionRecord['short']; $collectionList[$key]['full'] = $collectionRecord['full']; $collectionList[$key]['packages'] = $collectionRecord['packages']; } } asort($collectionList); }
$returnText .= '>'; if ($fPath != '') { getCollectionRecord($fPath, &$collectionRecord); $returnText .= $collectionRecord['collection_full']; } $returnText .= '</option>'; } $returnText .= '</select>'; $returnText .= SYS_DBL_SPACE . '<input class="action" type="image" src="' . DCTL_IMAGES . 'action_refresh_blue.gif" />'; $returnText .= '<input type="hidden" name="selectColl" value="seleziona" />'; $returnText .= '<input type="hidden" name="posx" value="' . $fDiv0 . '" />'; $returnText .= '</fieldset>'; $returnText .= '</form>'; $prosecute = in_array($collectionPath, $collectionList['path']); if ($prosecute) { getCollectionRecord($collectionPath, &$collectionRecord); $collection_short = $collectionRecord['collection_short']; $returnText .= '<h2>Collection "' . $collectionRecord['collection_short'] . ' - ' . $collectionRecord['collection_work'] . '"</h2>'; $header = $collectionPath . DCTL_FILE_HEADER; $contents = cleanUpIndentation(file_get_contents($header)); $select = $COLLECTION_FIELDS['label']; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * $returnText .= getManagementOfImages('divImagesCollection', 'dei Media', $collection_id, $collection_short, $loc4msg, &$fCount, $resultMsg); } $returnText .= '</div>'; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * $returnText .= '</div>'; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * $returnText .= '</div>'; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * echo $returnText;
function ajax_loadFullTree($upToLevel = 0, $collection_id = '', $media_id = '', $package_id = '', $part_id = '') { $resultText = ''; // BEGIN $basePath = DCTL_PROJECT_PATH; $collectionPath = $basePath . $collection_id; if ($collection_id == '' || $upToLevel == 1) { // ALL COLLECTIONS $resultText .= '<ul>'; getCollectionList($basePath, &$collectionList); foreach ($collectionList['path'] as $key => $fPath) { getCollectionRecord($fPath, &$collectionRecord); $selected = $collection_id == $collectionRecord['collection_id']; $resultText .= '<li' . ($selected ? ' class="open"' : '') . '>'; $resultText .= '<span class="text"><span class="collection ' . ($selected ? ' selected' : '') . '">' . $collectionRecord['collection_full'] . '</span></span>'; if ($selected) { $resultText .= ajax_loadTree(2, $collection_id, $media_id, $package_id, $part_id, $what); } else { $resultText .= '<ul' . ($selected ? '' : ' class="ajax"') . '>'; $resultText .= '<li>{url:indexAjax.php?action=ajax_loadFullTree&collection_id=' . $collectionRecord['collection_id'] . '}</li>'; $resultText .= '</ul>'; } $resultText .= '</li>'; } $resultText .= '<li class="add"><span class="text">aggiungi Collection...</span></li>'; $resultText .= '</ul>'; } else { // ONE COLLECTION if ($package_id == '' && $media_id == '' || $upToLevel == 2) { $resultText .= '<ul>'; $resultText .= '<li class="edit"><span class="text">edit Collection...</span></li>'; $resultText .= '<li class="publish"><span class="text">Pubblicazione Web</span>'; $resultText .= '<a href="#" title="Pubblica" class="publish"><span class="hidden">Pubblica</span></a>'; $resultText .= '<a href="#" title="Ritira" class="unpublish"><span class="hidden">Ritira</span></a>'; $resultText .= '</li>'; // LOAD PACKAGES $resultText .= '<li' . ($package_id != '' ? ' class="open"' : '') . '>'; $resultText .= '<span class="text">Gestione Package</span>'; if ($package_id != '') { $resultText .= ajax_loadTree(3, $collection_id, '', $package_id, $part_id, $what); } else { $resultText .= '<ul' . ($package_id == '' ? ' class="ajax"' : '') . '>'; $resultText .= '<li>{url:indexAjax.php?action=ajax_loadFullTree&collection_id=' . $collection_id . '&package_id=*}</li>'; $resultText .= '</ul>'; } $resultText .= '</li>'; // LOAD MEDIA $resultText .= '<li' . ($media_id != '' ? ' class="open"' : '') . '>'; $resultText .= '<span class="text">Gestione Media</span>'; if ($media_id != '') { $resultText .= ajax_loadTree(3, $collection_id, $media_id, '', $part_id, $what); } else { $resultText .= '<ul' . ($media_id == '' ? ' class="ajax"' : '') . '>'; $resultText .= '<li>{url:indexAjax.php?action=ajax_loadFullTree&collection_id=' . $collection_id . '&media_id=*}</li>'; $resultText .= '</ul>'; } $resultText .= '</li>'; $resultText .= '</ul>'; } else { if ($package_id != '') { if ($package_id == '*' || $upToLevel == 3) { // ALL PACKAGES $basePath = $collectionPath; $packagePath = $basePath . $package_id; $resultText .= '<ul>'; getPackageList($basePath, &$packageList); foreach ($packageList['path'] as $key => $fPath) { getPackageRecord($fPath, &$packageRecord); $selected = $package_id == $packageRecord['package_id']; $resultText .= '<li' . ($selected ? ' class="open"' : '') . '>'; $resultText .= '<span class="text"><span class="package' . ($selected ? ' selected' : '') . '">' . $packageRecord['package_full'] . '</span></span>'; if ($selected) { $resultText .= ajax_loadTree(4, $collection_id, '', $package_id, $part_id, $what); } else { $resultText .= '<ul' . ($selected ? '' : ' class="ajax"') . '>'; $resultText .= '<li>{url:indexAjax.php?action=ajax_loadFullTree&collection_id=' . $collection_id . '&package_id=' . $packageRecord['package_id'] . '}</li>'; $resultText .= '</ul>'; } $resultText .= '</li>'; } $resultText .= '<li class="add"><span class="text">aggiungi Package...</span></li>'; $resultText .= '</ul>'; } else { if ($part_id == '' || $upToLevel == 4) { $resultText .= '<ul>'; $resultText .= '<li class="edit"><span class="text">edit Package...</span></li>'; $resultText .= '<li class="publish"><span class="text">Pubblicazione Web</span>'; $resultText .= '<a href="#" title="Pubblica" class="publish"><span class="hidden">Pubblica</span></a>'; $resultText .= '<a href="#" title="Ritira" class="unpublish"><span class="hidden">Ritira</span></a>'; $resultText .= '</li>'; // LOAD PARTS $resultText .= '<li' . ($part_id != '' ? ' class="open"' : '') . '>'; $resultText .= '<span class="text">Gestione Part</span>'; if ($part_id != '') { $resultText .= ajax_loadTree(5, $collection_id, '', $package_id, $part_id, $what); } else { $resultText .= '<ul' . ($part_id == '' ? ' class="ajax"' : '') . '>'; $resultText .= '<li>{url:indexAjax.php?action=ajax_loadFullTree&collection_id=' . $collection_id . '&package_id=' . $package_id . '&part_id=*}</li>'; $resultText .= '</ul>'; } $resultText .= '</li>'; $resultText .= '</ul>'; } else { // ALL PARTS $basePath = $collectionPath . $package_id . SYS_PATH_SEP; $partPath = $basePath . $part_id; $resultText .= '<ul>'; getPartList($basePath, &$partList); foreach ($partList['path'] as $key => $fPath) { getPartRecord($fPath, &$partRecord); $selected = $part_id == $partRecord['part_id']; $resultText .= '<li' . ($selected ? ' class="open"' : '') . '>'; $resultText .= '<span class="text"><span class="part' . ($selected ? ' selected' : '') . '">' . cleanWebString($partRecord['part_short'] . ' - ' . $partRecord['part_work'], FIELD_STRING_LENGTH) . SYS_DBL_SPACE . '</span></span>'; $resultText .= '<a href="#" title="Scarica" class="dnload"><span class="hidden">Scarica</span></a>'; $resultText .= '<a href="#" title="Ricarica" class="upload"><span class="hidden">Ricarica</span></a>'; $resultText .= '</li>'; } $resultText .= '<li class="add"><span class="text">aggiungi Part...</span></li>'; $resultText .= '</ul>'; } } } if ($media_id != '') { // ALL MEDIA $basePath = $collectionPath . DCTL_MEDIA_BIG; $mediaPath = $basePath . $media_id; $resultText .= '<ul>'; getMediaList($basePath, &$mediaList); foreach ($mediaList['path'] as $key => $fPath) { getMediaRecord($fPath, &$mediaRecord); $selected = $media_id == $mediaRecord['media_id']; $resultText .= '<li' . ($selected ? ' class="open"' : '') . '>'; $resultText .= '<span class="text"><span class="media' . ($selected ? ' selected' : '') . '">' . cleanWebString($mediaRecord['media_short'] . ' - ' . $mediaRecord['media_work'], FIELD_STRING_LENGTH) . SYS_DBL_SPACE . '</span></span>'; $resultText .= '<a href="#" title="Aggiorna" class="update"><span class="hidden">Aggiorna</span></a>'; $resultText .= '<a href="#" title="Elimina" class="delete"><span class="hidden">Elimina</span></a>'; $resultText .= '</li>'; } $resultText .= '<li class="add"><span class="text">aggiungi Media...</span></li>'; $resultText .= '</ul>'; } } } return $resultText; }