示例#1
0
function getFolders($parent, $level = 0)
{
    global $AppUI, $allowed_folders_ary, $denied_folders_ary, $tab, $m, $a, $company_id, $allowed_companies, $project_id, $task_id, $current_uri, $file_types;
    // retrieve all children of $parent
    $folder_where = "file_folder_parent='{$parent}'";
    //   $folder_where .= (count($denied_folders_ary) > 0) ? "\nAND file_folder_id NOT IN (" . implode(",", $denied_folders_ary) . ")" : "";
    $q = new DBQuery();
    $q->addTable('file_folders');
    $q->addQuery('*');
    $q->addWhere($folder_where);
    $q->addOrder('file_folder_name');
    $folder_sql = $q->prepare();
    $q->clear();
    $folders = db_loadList($folder_sql);
    // display each child
    foreach ($folders as $row) {
        if (array_key_exists($row['file_folder_id'], $allowed_folders_ary) or array_key_exists($parent, $allowed_folders_ary)) {
            // indent and display the title of this child
            $file_count = countFiles($row['file_folder_id']);
            echo '<ul><li><table width="100%"><tr><td><span class="folder-name">';
            if ($m == 'files') {
                echo '<a href="./index.php?m=' . $m . '&amp;a=' . $a . '&amp;tab=' . $tab . '&folder=' . $row['file_folder_id'] . '" name="ff' . $row['file_folder_id'] . '">';
            }
            echo dPshowImage('./modules/files/images/folder5_small.png', '16', '16', 'folder icon', 'show only this folder');
            if ($m == 'files') {
                '</a>' . '<a href="./index.php?m=' . $m . '&amp;a=' . $a . '&amp;tab=' . $tab . '&folder=' . $row['file_folder_id'] . '" name="ff' . $row['file_folder_id'] . '">';
            }
            echo $row['file_folder_name'];
            if ($m == 'files') {
                '</a>';
            }
            if ($file_count > 0) {
                echo ' <a href="#ff' . $row['file_folder_id'] . '" onClick="expand(\'files_' . $row['file_folder_id'] . '\')" class="has-files">(' . $file_count . ' files) +</a>';
            }
            echo "</td>\n";
            echo '	<form name="frm_remove_folder_' . $row['file_folder_id'] . '" action="?m=files" method="post">
				<input type="hidden" name="dosql" value="do_folder_aed" />
				<input type="hidden" name="del" value="1" />
				<input type="hidden" name="file_folder_id" value="' . $row['file_folder_id'] . '" />
				<input type="hidden" name="redirect" value="' . $current_uri . '" />
				</form>';
            echo "<td align='right' width='64' nowrap>\n";
            echo '<a href="./index.php?m=files&amp;a=addedit_folder&amp;folder=' . $row['file_folder_id'] . '">' . dPshowImage('./modules/files/images/filesaveas.png', '16', '16', 'edit icon', 'edit this folder') . '</a>' . '<a href="./index.php?m=files&amp;a=addedit_folder&amp;file_folder_parent=' . $row['file_folder_id'] . '&amp;file_folder_id=0">' . dPshowImage('./modules/files/images/edit_add.png', '', '', 'new folder', 'add a new subfolder') . '</a>' . '<a href="#" onclick="if (confirm(\'Are you sure you want to delete this folder?\')) {document.frm_remove_folder_' . $row['file_folder_id'] . '.submit()}">' . dPshowImage('./modules/files/images/remove.png', '', '', 'delete icon', 'delete this folder') . '</a>' . '<a href="./index.php?m=files&amp;a=addedit&amp;folder=' . $row['file_folder_id'] . '&amp;project_id=' . $project_id . '&amp;file_id=0">' . dPshowImage('./modules/files/images/folder_new.png', '', '', 'new file', 'add new file to this folder') . '</a>';
            echo "</td></tr></table></span>\n";
            if ($file_count > 0) {
                echo '<div class="files-list" id="files_' . $row['file_folder_id'] . '" style="display: none;">';
                displayFiles($row['file_folder_id']);
                echo "</div>";
            }
        }
        // call this function again to display this
        // child's children
        if (!getFolders($row['file_folder_id'], $level + 1)) {
            echo "</li>";
        } else {
            echo "</li></ul>";
        }
    }
    return true;
}
示例#2
0
    ?>
</li>
                <?php 
}
?>
            </ul>
        </td>
    </tr>
    </tr>
    <?php 
if (countFiles($folder) > 0) {
    echo displayFiles($AppUI, $folder_id, $task_id, $project_id, $company_id);
} elseif (!empty($limited) && !$limited or $folder_id != 0) {
    echo '<tr><td colspan="20">' . $AppUI->_('no files') . '</td></tr>';
}
echo getFolders($folder_id);
//Lets add our bulk form
$folders_avail = getFolderSelectList();
//used O (uppercase 0)instead of 0 (zero) to keep things in place
$folders = array('-1' => array(0 => 'O', 1 => '(Move to Folder)', 2 => -1)) + array('0' => array(0 => 0, 1 => 'Root', 2 => -1)) + $folders_avail;
$project = new CProject();
$sprojects = $project->getAllowedProjects($AppUI->user_id, false);
foreach ($sprojects as $prj_id => $proj_info) {
    $sprojects[$prj_id] = $idx_companies[$prj_id] . ': ' . $proj_info['project_name'];
}
asort($sprojects);
$sprojects = array('O' => '(' . $AppUI->_('Move to Project', UI_OUTPUT_RAW) . ')') + array('0' => '(' . $AppUI->_('All Projects', UI_OUTPUT_RAW) . ')') + $sprojects;
?>
	<tr>
	    <td colspan="50" align="right">
            <form name="frm_bulk" id="frm_bulk" method="post" action="?m=files&a=do_files_bulk_aed" accept-charset="utf-8">
function mytheme_color_picker()
{
    $patterns_url = IAMD_FW_URL . "theme_options/images/pattern/";
    $skins_url = IAMD_BASE_URL . "images/style-picker/";
    $patterns = "";
    $patterns_array = mytheme_listImage(TEMPLATEPATH . "/images/style-picker/patterns/");
    foreach ($patterns_array as $k => $v) {
        $img = IAMD_BASE_URL . "images/style-picker/patterns/" . $k;
        $patterns .= '<li>';
        $patterns .= "<a id='{$v}' href='' title=''>";
        $patterns .= "<img src='{$img}' alt='{$v}' title='{$v}' width='30' height='30' />";
        $patterns .= '</a>';
        $patterns .= '</li>';
    }
    $colors = "";
    foreach (getFolders(get_template_directory() . "/skins") as $skin) {
        $img = $skins_url . $skin . ".jpg";
        $colors .= '<li>';
        $colors .= '<a id="' . $skin . '" href="" title="">';
        $colors .= '<img src="' . $img . '" alt="color-' . $skin . '" title="color-' . $skin . '"/>';
        $colors .= '</a>';
        $colors .= '</li>';
    }
    $str = '<!-- **Delicate Style Picker Wrapper** -->';
    $str .= '<div class="delicate-style-picker-wrapper">';
    $str .= '	<a href="" title="" class="style-picker-ico"> <img src="' . IAMD_BASE_URL . 'images/style-picker/picker-icon.png" alt="" title="" /> </a>';
    $str .= '	<div id="delicate-style-picker">';
    $str .= '   	<h2>' . __('Select Your Style', 'dt_delicate') . '</h2>';
    $str .= '       <h3>' . __('Choose your layout', 'dt_delicate') . '</h3>';
    $str .= '		<ul class="layout-picker">';
    $str .= '       	<li> <a id="fullwidth" href="" title="" class="selected"> <img src="' . IAMD_BASE_URL . 'images/style-picker/fullwidth.jpg" alt="" title="" /> </a> </li>';
    $str .= '       	<li> <a id="boxed" href="" title=""> <img src="' . IAMD_BASE_URL . 'images/style-picker/boxed.jpg" alt="" title="" /> </a> </li>';
    $str .= '		</ul>';
    $str .= '		<div class="hr"> </div>';
    $str .= '		<div id="pattern-holder" style="display:none;">';
    $str .= '			<h3>' . __('Patterns for Boxed Layout', 'dt_delicate') . '</h3>';
    $str .= '			<ul class="pattern-picker">';
    $str .= $patterns;
    $str .= '			</ul>';
    $str .= '			<div class="hr"> </div>';
    $str .= '		</div>';
    $str .= '		<h3>' . __('Color scheme', 'dt_delicate') . '</h3>';
    $str .= '		<ul class="color-picker">';
    $str .= $colors;
    $str .= '		</ul>';
    $str .= '	</div>';
    $str .= '</div><!-- **Delicate Style Picker Wrapper - End** -->';
    echo $str;
}
                            <h4><?php 
echo $theme;
?>
</h4>
                        </li>
                     </ul>
                </div>
                
                <div class="box-title"><h3><?php 
_e('Available Skins', 'dt_delicate');
?>
</h3></div>
                <div class="box-content">
                	<ul id="j-available-themes" class="skins-list">
					<?php 
foreach (getFolders(get_template_directory() . "/skins") as $skin) {
    $active = $theme == $skin ? 'class="active"' : NULL;
    $img = IAMD_BASE_URL . "skins/{$skin}/screenshot.png";
    echo "<li data-attachment-theme='{$skin}' {$active}>";
    echo "<img src='{$img}' alt='' width='250' height='180' />";
    echo "<h4>{$skin}</h4>";
    echo "</li>";
}
?>
                    </ul>
                </div>
            </div>
        </div><!--Skins Section  End-->

    </div><!-- .bpanel-main-content end -->
</div><!-- #skin  end-->
示例#5
0
function getFolders($dir, $relativePath)
{
    global $folders;
    global $depth;
    foreach (scandir($dir) as $elem) {
        if ($elem === '.' || $elem === '..') {
            continue;
        }
        $dirpath = $dir . '/' . $elem;
        if (is_dir($dirpath)) {
            $folder = array();
            $folder['dirname'] = $elem;
            $folder['shortname'] = strlen($elem) > 17 ? substr($elem, 0, 17) . '...' : $elem;
            $folder['relativePath'] = $relativePath . '/' . $elem;
            $folder['depth'] = $depth;
            $folders[] = $folder;
            if ($depth < 1) {
                $depth++;
                getFolders($dirpath, $folder['relativePath']);
                $depth--;
            } else {
                break;
            }
        }
    }
}
示例#6
0
                            <h4><?php 
echo $theme;
?>
</h4>
                        </li>
                     </ul>
                </div>
                
                <div class="box-title"><h3><?php 
_e('Available Skins', 'dt_themes');
?>
</h3></div>
                <div class="box-content">
                	<ul id="j-available-themes" class="skins-list">
					<?php 
foreach (getFolders(IAMD_TD . "/skins") as $skin) {
    $active = $theme == $skin ? 'class="active"' : NULL;
    $img = IAMD_BASE_URL . "skins/{$skin}/screenshot.png";
    echo "<li data-attachment-theme='{$skin}' {$active}>";
    echo "<img src='{$img}' alt='' width='250' height='180' />";
    echo "<h4>{$skin}</h4>";
    echo "</li>";
}
?>
                    </ul>
                </div>
            </div>
        </div><!--Skins Section  End-->

    </div><!-- .bpanel-main-content end -->
</div><!-- #skin  end-->
示例#7
0
function getFolders($parent, $level = 0)
{
    global $AppUI, $allowed_folders_ary, $denied_folders_ary, $tab, $m, $a, $company_id, $allowed_companies, $project_id, $task_id, $current_uri, $file_types;
    // retrieve all children of $parent
    $folder_where = 'file_folder_parent = \'' . $parent . '\'';
    //   $folder_where .= (count($denied_folders_ary) > 0) ? "\nAND file_folder_id NOT IN (" . implode(',', $denied_folders_ary) . ")" : "";
    $q = new DBQuery();
    $q->addTable('file_folders');
    $q->addQuery('*');
    $q->addWhere($folder_where);
    $q->addOrder('file_folder_name');
    $folders = $q->loadList();
    $q->clear();
    $s = '';
    // display each child
    foreach ($folders as $row) {
        if (array_key_exists($row['file_folder_id'], $allowed_folders_ary) or array_key_exists($parent, $allowed_folders_ary)) {
            // indent and display the title of this child
            $file_count = countFiles($row['file_folder_id']);
            $s .= '<ul><li><table width="100%"><tr><td><span class="folder-name">';
            if ($m == 'files') {
                $s .= '<a href="./index.php?m=' . $m . '&amp;a=' . $a . '&amp;tab=' . $tab . '&folder=' . $row['file_folder_id'] . '" name="ff' . $row['file_folder_id'] . '">';
            }
            $s .= w2PshowImage('folder5_small.png', '16', '16', 'folder icon', 'show only this folder', 'files');
            if ($m == 'files') {
                '</a>' . '<a href="./index.php?m=' . $m . '&amp;a=' . $a . '&amp;tab=' . $tab . '&folder=' . $row['file_folder_id'] . '" name="ff' . $row['file_folder_id'] . '">';
            }
            $s .= $row['file_folder_name'];
            if ($m == 'files') {
                '</a>';
            }
            if ($file_count > 0) {
                $s .= ' <a href="javascript: void(0);" onClick="expand(\'files_' . $row['file_folder_id'] . '\')" class="has-files">(' . $file_count . ' files) +</a>';
            }
            $s .= '</td><form name="frm_remove_folder_' . $row['file_folder_id'] . '" action="?m=files" method="post" accept-charset="utf-8">
				<input type="hidden" name="dosql" value="do_folder_aed" />
				<input type="hidden" name="del" value="1" />
				<input type="hidden" name="file_folder_id" value="' . $row['file_folder_id'] . '" />
				<input type="hidden" name="redirect" value="' . $current_uri . '" />
				</form>';
            $s .= '<td align="right" width="64" nowrap="nowrap">';
            $s .= '<a href="./index.php?m=files&amp;a=addedit_folder&amp;folder=' . $row['file_folder_id'] . '">' . w2PshowImage('filesaveas.png', '16', '16', 'edit icon', 'edit this folder', 'files') . '</a>' . '<a href="./index.php?m=files&amp;a=addedit_folder&amp;file_folder_parent=' . $row['file_folder_id'] . '&amp;file_folder_id=0">' . w2PshowImage('edit_add.png', '', '', 'new folder', 'add a new subfolder', 'files') . '</a>' . '<a href="javascript: void(0);" onclick="if (confirm(\'Are you sure you want to delete this folder?\')) {document.frm_remove_folder_' . $row['file_folder_id'] . '.submit()}">' . w2PshowImage('remove.png', '', '', 'delete icon', 'delete this folder', 'files') . '</a>' . '<a href="./index.php?m=files&amp;a=addedit&amp;folder=' . $row['file_folder_id'] . '&amp;project_id=' . $project_id . '&amp;file_id=0">' . w2PshowImage('folder_new.png', '', '', 'new file', 'add new file to this folder', 'files') . '</a>';
            $s .= '</td></tr></table></span>';
            if ($file_count > 0) {
                $s .= '<div class="files-list" id="files_' . $row['file_folder_id'] . '" style="display: none;">';
                $s .= displayFiles($row['file_folder_id']);
                $s .= "</div>";
            }
        }
        // call this function again to display this
        // child's children
        // getFolders *always* returns true, so there's no point in checking it
        $s .= getFolders($row['file_folder_id'], $level + 1) . '</li></ul>';
        /*
        		if (!getFolders($row['file_folder_id'], $level + 1)) {
        			$s .= '</li>';
        		} else {
        			$s .= '</li></ul>';
        		}
        */
    }
    /*
     *  getFolders  would *alway* return true and would echo the results.  It
     * makes more sense to simply return the results.  Then the calling code can
     * echo it, capture it for parsing, or whatever else needs to be done.  There
     * should be less inadvertent actions as a result.
     */
    return $s;
}
示例#8
0
for ($i = 0; $i < count($files['name']); $i++) {
    /* Get the tmp file path */
    $tmpFilePath = $files['tmp_name'][$i];
    if ($tmpFilePath != "") {
        $newFilePath = $uploaddir . "/" . $files['name'][$i];
        /* move */
        if (move_uploaded_file($tmpFilePath, $newFilePath)) {
            /* handle zip files */
            if (isZip($newFilePath)) {
                unzip($newFilePath);
            }
        }
    }
}
/* GET FOLDERS */
$folders = getFolders($uploaddir);
$group = getGroupFolder($fileName, $fileDescription);
$files = getFiles($uploaddir);
/* DB - ADD FILES TO FOLDER */
foreach ($files as $file) {
    //echo "File: ".$file->getBasename()." in ".$file->getPath()."<br />";
    $fDescr = "Size: " . round($file->getSize() / 1024, 2) . " Kb.";
    $baseFolder = str_replace($uploaddir, "", $file->getPath());
    //echo "BASE: ".$baseFolder.' #### ';
    if ($baseFolder[0] === DIRECTORY_SEPARATOR) {
        $baseFolder = substr($baseFolder, 1);
    }
    if (strcmp($PLOT_FILE_EXTENSION, getExtension($file)) === 0) {
        $fd = file_get_contents($file->getPath() . "/" . $file->getBasename());
        $json = json_decode($fd, true);
        $fileId = createTemplateQuery($json["name"], $json["description"], json_encode($json["sceneGraph"]), $json['thumbnail']);