コード例 #1
0
ファイル: managefile.php プロジェクト: raum01/Collabtive
    $rolesobj = new roles();
    //get folders
    $folders = $myfile->getProjectFolders($id);
    //get all folders
    $allfolders = $myfile->getAllProjectFolders($id);
    //get the project
    $pro = $myproject->getProject($id);
    //get the project members
    $members = $myproject->getProjectMembers($id, 10000);
    //get all roles
    $allroles = $rolesobj->getAllRoles();
    $projectname = $pro["name"];
    $title = $langfile['files'];
    $template->assign("title", $title);
    $template->assign("projectname", $projectname);
    SmartyPaginate::assign($template);
    $template->assign("files", $files);
    $template->assign("filenum", $filenum);
    $template->assign("folders", $folders);
    $template->assign("members", $members);
    $template->assign("roles", $allroles);
    $template->assign("allfolders", $allfolders);
    $template->assign("postmax", $POST_MAX_SIZE);
    $template->display("projectfiles.tpl");
} elseif ($action == "addfolder") {
    if (!$userpermissions["files"]["add"]) {
        $errtxt = $langfile["nopermission"];
        $noperm = $langfile["accessdenied"];
        $template->assign("errortext", "<h2>{$errtxt}</h2><br>{$noperm}");
        $template->display("error.tpl");
        die;
コード例 #2
0
    $X = SmartyPaginate::getCurrentIndex();
    $Y = SmartyPaginate::getLimit();
    $searchSQL = "SELECT * FROM sionapros_news WHERE 1 ORDER BY news_no DESC LIMIT {$X},{$Y}";
    $result = $dbcon->execute($searchSQL);
    foreach ($result as $row) {
        // collect each record into $_data
        $data[] = $row;
    }
    // now we get the total number of records from the table
    $rowsSQL = "SELECT COUNT(*) FROM sionapros_news WHERE 1";
    $dbcon->query($rowsSQL);
    #$rowNo = $rows[0];
    SmartyPaginate::setTotal($dbcon->getValue());
    $dbcon->free();
    return $data;
}
$results = getSearchResults($db);
if (sizeof($results) == 0) {
    $searchMsg = 'NO ARTICLES WERE FOUND';
    $smarty->assign('searchMsg', $searchMsg);
} else {
    // assign your db results to the template
    $smarty->assign('news', $results);
    // assign {$paginate} var
    SmartyPaginate::assign($smarty);
}
$content = $smarty->fetch('./news/tm0.news.display_news.tpl.html');
SmartyPaginate::disconnect();
?>

コード例 #3
0
 function viewlist($parameter = null, $layout = true, $model = false)
 {
     $options = array();
     $assigns = array();
     $model = $model ? $model : $this->getDefaultModel();
     $this->page_title = Inflector::humanize($this->name);
     $this->auto_render = false;
     $this->base_dir = APP_DIR;
     $assigns['TITLE'] = Inflector::humanize($this->name);
     if ($model) {
         $this->get_search_field($model, $options);
         $this->get_viewlist_options($model, $options);
         $this->get_sort_options($model, $options);
         $this->set_pagination($model);
         $model->find($options);
         $page_content =& NController::singleton('page_content');
         $page_content_model =& $page_content->getDefaultModel();
         $pk = $model->primaryKey();
         $models = array();
         $headline = $model->getHeadline() ? $model->getHeadline() : 'cms_headline';
         $i = 0;
         while ($model->fetch()) {
             $arr = $model->toArray();
             $arr['_headline'] = isset($arr['cms_headline']) && $arr['cms_headline'] ? $arr['cms_headline'] : $model->makeHeadline();
             $arr['_remove_delete'] = $page_content_model->isWorkflowContent($this->name, $arr[$pk]) ? 1 : 0;
             // Remove delete for models that have specified this.
             $arr['_remove_delete'] = isset($model->remove_delete) && $model->remove_delete == true ? 1 : 0;
             $models[] = $arr;
             unset($arr);
         }
         // Override standard paging limit if chosen in the model file.
         $paging = isset($model->paging) ? $model->paging : $this->paging;
         // If paging is not disabled in the model AND the records are > than the paging size AND not searching.
         if ($paging > 0 && count($models) > $paging && !$options['is_search']) {
             SmartyPaginate::connect($this->name);
             SmartyPaginate::setLimit($paging, $this->name);
             SmartyPaginate::setTotal(count($models), $this->name);
             $view =& NView::singleton($this);
             SmartyPaginate::assign($view, 'paginate', $this->name);
             // TODO: Could be more efficient and only get records it needs to.
             $models = array_slice($models, SmartyPaginate::getCurrentIndex($this->name), SmartyPaginate::getLimit($this->name));
             $this->set('paging', true);
         }
         $this->set(array('rows' => $models, 'asset' => $this->name, 'asset_name' => $this->page_title));
         unset($models);
     }
     $this->render(array('layout' => 'default'));
 }