Exemple #1
0
function listLibraries($inPrefix = "", $inPath)
{
    $output = array();
    $baseList = listFolders($inPath);
    foreach ($baseList as $l) {
        array_push($output, "{$inPrefix}{$l}");
    }
    return $output;
}
function listFolders($dir, $name = 'image_folder', $class = '', $echo = true, $defaultPath = '.')
{
    global $aas_cpath;
    if (!$echo) {
        global $html;
    }
    $ffs = scandir($dir);
    if ($echo) {
        echo '<ol>';
        foreach ($ffs as $ff) {
            if ($ff != '.' && $ff != '..' && is_dir($dir . '/' . $ff)) {
                $aas_cpath = $dir . '/' . $ff;
                $aas_cpath_sub_img = substr($aas_cpath, strlen(DIR_FS_CATALOG_IMAGES));
                $aas_cpath_sub_cat = substr($aas_cpath, strlen(DIR_FS_CATALOG));
                if (!tep_is_writable($dir . '/' . $ff)) {
                    echo '<li><label style="color:lightGray"><input disabled="disabled" type="radio" name="' . $name . '" value="' . $aas_cpath_sub_img . '">' . $aas_cpath_sub_cat . '&nbsp;<span class="no-writable">' . AAS_DIALOG_TEXT_NO_WRITABLE . '</span></label>';
                } else {
                    echo '<li><label><input class="' . $class . '" ' . ($defaultPath == $aas_cpath_sub_img ? 'checked="checked"' : '') . ' type="radio" name="' . $name . '" value="' . $aas_cpath_sub_img . '">' . $aas_cpath_sub_cat . '</label>';
                }
                listFolders($dir . '/' . $ff, $name, $class, $echo, $defaultPath);
                echo '</li>';
            }
        }
        echo '</ol>';
    } else {
        $html .= '<ol>';
        foreach ($ffs as $ff) {
            if ($ff != '.' && $ff != '..' && is_dir($dir . '/' . $ff)) {
                $aas_cpath = $dir . '/' . $ff;
                $aas_cpath_sub_img = substr($aas_cpath, strlen(DIR_FS_CATALOG_IMAGES));
                $aas_cpath_sub_cat = substr($aas_cpath, strlen(DIR_FS_CATALOG));
                if (!tep_is_writable($dir . '/' . $ff)) {
                    $html .= '<li><label style="color:lightGray"><input disabled="disabled" type="radio" name="' . $name . '" value="' . $aas_cpath_sub_img . '">' . $aas_cpath_sub_cat . '&nbsp;<span class="no-writable">' . AAS_DIALOG_TEXT_NO_WRITABLE . '</span></label>';
                } else {
                    $html .= '<li><label><input class="' . $class . '" ' . ($defaultPath == $aas_cpath_sub_img ? 'checked="checked"' : '') . ' type="radio" name="' . $name . '" value="' . $aas_cpath_sub_img . '">' . $aas_cpath_sub_cat . '</label>';
                }
                listFolders($dir . '/' . $ff, $name, $class, $echo, $defaultPath);
                $html .= '</li>';
            }
        }
        $html .= '</ol>';
        return $html;
    }
}
</h2><?php 
    echo AAS_PRODUCT_IMAGES_DRAG_N_DROP_NEW_IMAGE_HERE_OR;
    ?>
&nbsp;&nbsp;<input type="file" accept="image/*" name="products_image" id="products_image_change_default">
                  <fieldset class="dropbox-image-fieldset"><legend><?php 
    echo AAS_PRODUCT_IMAGES_SELECT_FOLDER_TO_SAVE_NEW_IMAGE;
    ?>
&nbsp;<img class="product_images-image_change_save_path_toggle" src="ext/aas/images/circle_plus-15x15.png" alt="toggle folders list"></legend>
                    <ol id="product_images-images_folders">
                    <?php 
    if (!tep_is_writable(DIR_FS_CATALOG_IMAGES)) {
        echo '<li><label style="color:lightGray"><input disabled="disabled" type="radio" name="image_folder" value="' . DIR_FS_CATALOG_IMAGES . '">' . AAS_PRODUCT_IMAGES_IMAGES . '<span class="no-writable">' . AAS_PRODUCT_IMAGES_NO_WRITABLE . '</span></label>';
    } else {
        echo '<li><label><input type="radio" name="product_images-image_folder" value="" class="product_images-image_folder" checked="checked" >' . substr(DIR_FS_CATALOG_IMAGES, strlen(DIR_FS_CATALOG)) . '</label>';
    }
    listFolders(realpath(DIR_FS_CATALOG_IMAGES), 'product_images-image_folder', 'product_images-image_folder');
    ?>
                    </li>
                    </ol>
                  </fieldset>
              </fieldset>
<?php 
} else {
    ?>
              <p class="no-writable-image-folders-wrapper"><strong><?php 
    echo DIR_FS_CATALOG_IMAGES;
    ?>
</strong>&nbsp;<?php 
    echo AAS_PRODUCT_IMAGES_NO_WRITABLE_FOLDERS_WARNING;
    ?>
</p>
Exemple #4
0
 public static function _tree($dir)
 {
     return listFolders($dir);
 }
</h2><?php 
    echo AAS_CATEGORY_IMAGES_DRAG_N_DROP_NEW_IMAGE_HERE_OR;
    ?>
&nbsp;&nbsp;<input type="file" accept="image/*" name="categories_image" id="categories_image_change_default">
                <fieldset class="dropbox-image-fieldset"><legend><?php 
    echo AAS_CATEGORY_IMAGES_SELECT_FOLDER_TO_SAVE_NEW_IMAGE;
    ?>
&nbsp;<img class="categories_images-image_change_save_path_toggle" src="ext/aas/images/circle_minus-15x15.png" alt="toggle folders list"></legend>
                  <ol id="categories_images-images_folders">
                  <?php 
    if (!tep_is_writable(DIR_FS_CATALOG_IMAGES)) {
        echo '<li><label style="color:lightGray"><input disabled="disabled" type="radio" name="image_folder" value="' . DIR_FS_CATALOG_IMAGES . '">' . AAS_CATEGORY_IMAGES_IMAGES . '<span class="no-writable">' . AAS_CATEGORY_IMAGES_NO_WRITABLE . '</span></label>';
    } else {
        echo '<li><label><input type="radio" name="categories_images-image_folder" value="" class="categories_images-image_folder" checked="checked" >' . substr(DIR_FS_CATALOG_IMAGES, strlen(DIR_FS_CATALOG)) . '</label>';
    }
    listFolders(realpath(DIR_FS_CATALOG_IMAGES), 'categories_images-image_folder', 'categories_images-image_folder');
    ?>
                  </li>
                  </ol>
                </fieldset>
            </fieldset>
<?php 
} else {
    ?>
            <p class="no-writable-image-folders-wrapper"><strong><?php 
    echo DIR_FS_CATALOG_IMAGES;
    ?>
</strong>&nbsp;<?php 
    echo AAS_CATEGORY_IMAGES_NO_WRITABLE_FOLDERS_WARNING;
    ?>
</p>
Exemple #6
0
function drawFolderForSearch($_selectedFolders = array())
{
    $html = '';
    $foldersList = listFolders();
    foreach ($foldersList as $folderDatas) {
        $checked = '';
        if (in_array($folderDatas['id'], $_selectedFolders)) {
            $checked = 'checked';
        }
        $html .= '<li class="checkbox"><label><input data-folderid="' . $folderDatas['id'] . '" ' . $checked . ' type="checkbox" class="checkbox_folder" name="folder_' . $folderDatas['id'] . '" value="' . $folderDatas['id'] . '"/> ' . $folderDatas['name'] . '</label></li>';
    }
    return $html;
}