本文整理汇总了PHP中Attachments::paginateByProject方法的典型用法代码示例。如果您正苦于以下问题:PHP Attachments::paginateByProject方法的具体用法?PHP Attachments::paginateByProject怎么用?PHP Attachments::paginateByProject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attachments
的用法示例。
在下文中一共展示了Attachments::paginateByProject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: attachments_list
function attachments_list()
{
$project_id = $_GET['project_id'];
$active_project = Projects::findById($project_id);
$tabs = new NamedList();
$tabs->add('overview', array('text' => str_excerpt($active_project->getName(), 25), 'url' => $active_project->getOverviewUrl()));
event_trigger('on_project_tabs', array(&$tabs, &$this->logged_user, &$active_project));
$tabs->add('people', array('text' => lang('People'), 'url' => $active_project->getPeopleUrl()));
$tabs->add('recent_pages', array('text' => lang('Recent Pages'), 'url' => assemble_url('recent_pages') . '&project_id=' . $active_project->getId()));
$tabs->add('reminders', array('text' => lang('Notifications'), 'url' => assemble_url('reminders_list', array('project_id' => $active_project->getId()))));
$tabs->add('calendar', array('text' => lang('Calendar'), 'url' => Calendar::getProjectCalendarUrl($active_project)));
js_assign('active_project_id', $active_project->getId());
$this->smarty->assign('page_tabs', $tabs);
/*$attachments = array();
$link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
mysql_select_db(DB_NAME);
$query = "select id from healingcrystals_project_objects where type='Comment' and project_id='" . $active_project->getId() . "' order by created_on desc";
$result = mysql_query($query, $link);
while($comment = mysql_fetch_assoc($result)){
$comment_id = $comment['id'];
$query_1 = "select id from healingcrystals_attachments where parent_id='" . $comment_id . "' and parent_type='Comment' order by name";
$result_1 = mysql_query($query_1, $link);
while($attachment = mysql_fetch_assoc($result_1)){
$attachment_id = $attachment['id'];
$attachments[] = new Attachment($attachment_id);
}
}
mysql_close($link);
$this->smarty->assign('attachments', $attachments);*/
$this->smarty->assign('page_tab', 'attachments');
$page = (int) $this->request->get('page');
if ($page < 1) {
$page = 1;
}
list($attachments, $pagination) = Attachments::paginateByProject($active_project, $this->logged_user, $page);
$this->smarty->assign(array('attachments' => $attachments, 'pagination' => $pagination, 'active_project' => $active_project));
}
示例2: index
/**
* Show files index page
*
* @param void
* @return null
*/
function index()
{
if ($this->request->isApiCall()) {
if ($this->active_category->isLoaded()) {
$this->serveData(Files::findByCategory($this->active_category, STATE_VISIBLE, $this->logged_user->getVisibility()), 'files');
} else {
$this->serveData(Files::findByProject($this->active_project, STATE_VISIBLE, $this->logged_user->getVisibility()), 'files');
}
// if
} else {
$per_page = 10;
$page = (int) $this->request->get('page');
if ($page < 1) {
$page = 1;
}
// if
$show_attachments = $this->request->get('show_attachments');
if ($this->active_category->isLoaded()) {
$this->wireframe->addBreadCrumb(clean($this->active_category->getName()), $this->active_category->getViewUrl());
list($files, $pagination) = Files::paginateByCategory($this->active_category, $page, $per_page, STATE_VISIBLE, $this->logged_user->getVisibility());
} else {
if ($show_attachments) {
$this->wireframe->addBreadCrumb(lang('All Attachments'), files_module_url($this->active_project, array('show_attachments' => true)));
$this->setTemplate('attachments');
list($files, $pagination) = Attachments::paginateByProject($this->active_project, $this->logged_user, $page, $per_page);
} else {
$this->wireframe->addBreadCrumb(lang('All Files'), files_module_url($this->active_project, array('show_attachments' => true)));
list($files, $pagination) = Files::paginateByProject($this->active_project, $page, $per_page, STATE_VISIBLE, $this->logged_user->getVisibility());
}
// if
}
// if
$this->smarty->assign(array('categories' => Categories::findByModuleSection($this->active_project, FILES_MODULE, 'files'), 'files' => $files, 'pagination' => $pagination, 'attachments_view' => $show_attachments ? true : false, 'mass_edit_url' => assemble_url('project_files_mass_edit', array('project_id' => $this->active_project->getId())), 'can_manage_categories' => $this->logged_user->isProjectLeader($this->active_project) || $this->logged_user->isProjectManager()));
}
// if
}