function createFilesList($files, $template, $path, $class = 'hidden')
{
    $content = new Template(SYS_UI_TMPL_DIR, 'project/filesTable.xhtml');
    $content->assign('path', $path);
    $content->assign('class', $class);
    if (count($files) == 0) {
        $content->assignFromNew('content', 'project/filesMessage.xhtml', array('message' => 'no Files'));
        $content->assign('height', '70px');
        $template->assign('filesTable', $content);
        return;
    }
    $content->assign('height', count($files) * 29 . 'px');
    foreach ($files as $key => $value) {
        if (is_array($value)) {
            $content->assignFromNew('content', 'project/filesRowDir.xhtml', array('name' => (string) $key, 'date' => '20.12.2012', 'link' => $path . $key . '/'));
            createFilesList($value, $template, $path . $key . '/');
            continue;
        }
        $content->assignFromNew('content', 'project/filesRowFile.xhtml', array('file' => $key . $value, 'name' => $key, 'size' => '37`478 KB', 'date' => '20.12.2012'));
    }
    $template->assign('filesTable', $content);
}
Exemple #2
0
        $template->addCSS('styles/css/color-' . $project->color . '.css');
        $projectTemplate->assign('name', $project->name);
        $projectTemplate->assign('pid', $project->pid);
        $projectTemplate->assign('icon', $project->pid . '.jpg');
        $projectTemplate->assignFromNew('infoTable', 'project/headRow.xhtml', array('key1' => 'Author:', 'value1' => $project->owner, 'key2' => 'Date:', 'value2' => $project->upload_time));
        $projectTemplate->assignFromNew('infoTable', 'project/headRow.xhtml', array('key1' => 'List:', 'value1' => $project->list, 'key2' => '', 'value2' => ''));
        $projectTemplate->assignFromNew('infoTable', 'project/headRow.xhtml', array('key1' => '', 'value1' => '', 'key2' => '', 'value2' => ''));
        if ($project->info !== NULL) {
            $keys = array_keys($project->info);
            for ($i = 0; $i < count($keys); $i += 2) {
                $key1 = $keys[$i];
                $value1 = $project->info[$key1];
                if (empty($keys[$i + 1])) {
                    $projectTemplate->assignFromNew('infoTable', 'project/headRow.xhtml', array('key1' => $key1, 'value1' => $value1, 'key2' => '', 'value2' => ''));
                } else {
                    $projectTemplate->assignFromNew('infoTable', 'project/headRow.xhtml', array('key1' => $key1, 'value1' => $value1, 'key2' => $keys[$i + 1], 'value2' => $project->info[$keys[$i + 1]]));
                }
            }
        }
        for ($i = count($keys) / 2; $i <= 3; $i++) {
            $projectTemplate->assignFromNew('infoTable', 'project/headRow.xhtml', array('key1' => '', 'value1' => '', 'key2' => '', 'value2' => ''));
        }
        //		$projectTemplate->assign('description', str_replace('!newline!', '<br />', $project->description));
        $projectTemplate->assign('description', $project->description);
        createFilesList($project->viewContent(), $projectTemplate, '/', 'show');
        $commentList = new CommentList(CommentList::TYPE_PROJECT, $_GET['pid']);
        createCommentList($commentList->comments, $projectTemplate);
    } else {
        //@TODO: Add error handling;
    }
}