Ejemplo n.º 1
0
function get_files($tipos, $offset, $maxRecords, $sort_mode, $userName = '', $find = '', $filters = array())
{
    global $smarty, $user, $tikilib;
    $objResponse = new xajaxResponse();
    $actualClass = array("Video" => "VideoPublication", "Audio" => "AudioPublication", "Imagem" => "ImagePublication", "Texto" => "TextPublication", "Outro" => "OtherPublication");
    $filters = array("actualClass" => array());
    foreach ($tipos as $tipo) {
        $filters["actualClass"][] = $actualClass[$tipo];
    }
    if ($userName) {
        $filters["user"] = $userName;
    }
    if ($find) {
        $smarty->load_filter('output', 'highlight');
        $_REQUEST['highlight'] = $find;
        require_once "lib/elgal/model/Find.php";
        $key = new Find(array("title", "description"));
        $filters[$find] = $key;
    }
    $filters["publishDate"] = true;
    $controller = new PersistentObjectController("Publication");
    $files = $controller->findAll($filters, $offset, $maxRecords, $sort_mode);
    $total = $controller->countAll($filters);
    $smarty->assign_by_ref('arquivos', $files);
    $smarty->assign('maxRecords', $maxRecords);
    $smarty->assign('offset', $offset);
    $smarty->assign('sort_mode', $sort_mode);
    $smarty->assign('total', $total);
    $smarty->assign('userName', $userName);
    $smarty->assign('find', $find);
    $smarty->assign('filters', $filters);
    $smarty->assign('currentPage', $offset / $maxRecords + 1);
    $smarty->assign('lastPage', ceil($total / $maxRecords));
    $smarty->assign('dontAskDelete', $tikilib->get_user_preference($user, 'el_dont_check_delete', 0));
    $objResponse->assign("ajax-listNav", "innerHTML", $smarty->fetch("el-gallery_pagination.tpl"));
    $objResponse->assign("ajax-navBottom", "innerHTML", $smarty->fetch("el-gallery_pagination.tpl"));
    $objResponse->assign("ajax-gListCont", "innerHTML", $smarty->fetch("el-gallery_section.tpl"));
    $objResponse->script("nd()");
    return $objResponse;
}
Ejemplo n.º 2
0
}
$smarty->assign('tipos', $tipos);
$actualClass = array("Video" => "VideoPublication", "Audio" => "AudioPublication", "Imagem" => "ImagePublication", "Texto" => "TextPublication", "Outro" => "OtherPublication");
$filters = array("actualClass" => array());
foreach ($tipos as $tipo) {
    $filters["actualClass"][] = $actualClass[$tipo];
}
if (isset($_REQUEST['highlight'])) {
    $find = $_REQUEST['highlight'];
} else {
    $find = '';
}
if ($find) {
    require_once "lib/elgal/model/Find.php";
    $key = new Find(array("title", "description"));
    $filters[$find] = $key;
}
$filters["publishDate"] = true;
$controller = new PersistentObjectController("Publication");
$files = $controller->findAll($filters, 0, 10, $sort_mode);
$total = $controller->countAll($filters);
$smarty->assign('maxRecords', 10);
$smarty->assign('offset', 0);
$smarty->assign('total', $total);
$smarty->assign('find', $find);
$smarty->assign('currentPage', 1);
$smarty->assign('lastPage', ceil($total / 10));
$smarty->assign_by_ref('arquivos', $files);
$smarty->assign('dontAskDelete', $tikilib->get_user_preference($user, 'el_dont_check_delete', 0));
$smarty->assign('mid', 'el-gallery_home.tpl');
$smarty->display('tiki.tpl');
Ejemplo n.º 3
0
$smarty->assign('pageName', $page);
if (is_array($info)) {
    $pdata = $tikilib->parse_data($info["data"], array($info["is_html"]));
    foreach ($info as $infoName => $value) {
        if ($infoName != "user") {
            $smarty->assign($infoName, $value);
        } else {
            $smarty->assign('modifUser', $value);
        }
    }
}
$smarty->assign_by_ref('userWiki', $pdata);
$sort_mode = 'publishDate_desc';
$controller = new PersistentObjectController("Publication");
$filters = array("actualClass" => array("AudioPublication", "VideoPublication", "ImagePublication", "TextPublication"), "user" => $view_user, "publishDate" => true);
$uploads = $controller->findAll($filters, 0, 5, $sort_mode);
$smarty->assign_by_ref('arquivos', $uploads);
$total = $controller->countAll($filters);
$smarty->assign('dontAskDelete', $tikilib->get_user_preference($user, 'el_dont_check_delete', 0));
$smarty->assign('permission', $permission);
$smarty->assign('userName', $view_user);
$smarty->assign('maxRecords', 5);
$smarty->assign('offset', 0);
$smarty->assign('sort_mode', $sort_mode);
$smarty->assign('total', $total);
$smarty->assign('find', '');
$smarty->assign('filters', array());
$smarty->assign('currentPage', 1);
$smarty->assign('lastPage', ceil($total / 5));
// licenca padrao
if ($licencaId = $tikilib->get_user_preference($view_user, 'licencaPadrao')) {
Ejemplo n.º 4
0
    $_REQUEST['tag'] = $_REQUEST['tags'];
}
$files = array();
if (isset($_REQUEST['tag']) && $_REQUEST['tag']) {
    $tagArray = split(",", $_REQUEST['tag']);
    $title .= " - Tags: " . $_REQUEST['tag'];
    $objects = $freetaglib->get_objects_with_tag_combo($tagArray, 'gallery', $userName);
    foreach ($objects['data'] as $object) {
        $arquivo = PersistentObjectFactory::createObject("Publication", (int) $object['itemId']);
        if (in_array($arquivo->type, $type)) {
            $files[] = $arquivo;
        }
    }
} else {
    $controller = new PersistentObjectController("Publication");
    $files = $controller->findAll($filters, 0, $maxRecords, $dateId . '_desc');
}
$uniqueid = $feed . $userName . $maxRecords . implode('', $type);
$changes = array();
$changes["data"] = array();
for ($i = 0; $i < sizeof($files); $i++) {
    if (sizeof($files[$i]->filereferences)) {
        $arquivo = array();
        $file =& $files[$i]->filereferences[0];
        // TODO: devem haver outros casos de nome de arquivo invalido alem de
        // 		 nomes de arquivo com espacos
        $arquivo["sefurl"] = str_replace(' ', '+', $file->fullPath());
        $arquivo["filesize"] = $file->size;
        $arquivo["filetype"] = $file->mimeType;
        $arquivo[$descId] = $tikilib->parse_data($files[$i]->{$descId});
        if ($files[$i]->thumbnail) {
}
$smarty->assign('headtitle', "subir arquivo");
$smarty->assign('category', 'gallery');
$smarty->assign('tag_suggestion', $freetaglib->get_distinct_tag_suggestion('', 0, 10));
$smarty->assign('moreTagsOffset', 10);
//isto eh uma conveniencia, so pra bloquear a mudanca de campo no cliente
//nao garante seguranca
$smarty->assign('permission', $tiki_p_el_upload_files == 'y');
// licenca padrao
if ($licencaId = $tikilib->get_user_preference($user, 'licencaPadrao')) {
    $lController = new PersistentObjectController("License");
    $licenca = $lController->noStructureFindAll(array("id" => $licencaId));
    $smarty->assign('licenca', $licenca[0]);
}
$controller = new PersistentObjectController("Publication");
$pending = $controller->findAll(array('user' => $user, 'publishDate' => false));
$smarty->assign('pending', $pending);
if (isset($arquivo) && $arquivo->user == $user) {
    $tagString = '';
    foreach ($arquivo->tags as $t) {
        $tagString .= $t['tag'] . ", ";
    }
    $tagString = substr($tagString, 0, strlen($tagString) - 2);
    $arquivo->tagString = $tagString;
    $smarty->assign_by_ref("arquivo", $arquivo);
    if (isset($arquivo->license)) {
        $license = array();
        $license["imageName"] = $arquivo->license->imageName;
        $smarty->assign("licenca", $license);
    } else {
        $smarty->assign("licenca", '');