本文整理汇总了PHP中PageList::addFromCollection方法的典型用法代码示例。如果您正苦于以下问题:PHP PageList::addFromCollection方法的具体用法?PHP PageList::addFromCollection怎么用?PHP PageList::addFromCollection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageList
的用法示例。
在下文中一共展示了PageList::addFromCollection方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: populate
function populate()
{
$tickets = new TicketCollection(new Ticket());
$pl = new PageList('current_tickets');
$ticket_sh = new SearchHandler($tickets, false);
$ticket_sh->setLimit(10);
$ticket_sh->setOrderBy('created', 'ASC');
$user = new User();
$user->loadBy('username', EGS_USERNAME);
$ticket_sh->addConstraint(new Constraint('originator_person_id', '=', $user->username));
$ticket_sh->addConstraint(new Constraint('usercompanyid', '=', EGS_COMPANY_ID));
// Find open statuses
$statuses = new TicketStatusCollection(new TicketStatus());
$status_sh = new SearchHandler($statuses);
$status_sh->addConstraint(new Constraint('usercompanyid', '=', EGS_COMPANY_ID));
$status_sh->addConstraint(new Constraint('status_code', '=', 'NEW'), 'OR');
$status_sh->addConstraint(new Constraint('status_code', '=', 'OPEN'), 'OR');
$statuses->load($status_sh);
foreach ($statuses->getContents() as $status) {
$ticket_sh->addConstraint(new Constraint('client_ticket_status_id', '=', $status->id), 'OR');
}
$tickets->load($ticket_sh);
$pl->addFromCollection($tickets, array('module' => 'ticketing', 'controller' => 'tickets', 'action' => 'view'), array('id'), 'ticket', 'summary');
$this->contents = $pl->getPages()->toArray();
}
示例2: populate
function populate()
{
$pl = new PageList('companies_added_today');
$companies_do = new CompanyCollection(new Company());
$sh = new SearchHandler($companies_do, false);
$sh->extract();
$sh->addConstraint(new Constraint('is_lead', '=', 'false'));
$sh->addConstraint(new Constraint('created', '>', fix_date(date(DATE_FORMAT))));
$sh->setLimit(10);
$companies_do->load($sh);
$pl->addFromCollection($companies_do, array('module' => 'contacts', 'controller' => 'companys', 'action' => 'view'), array('id'), 'company', 'name');
$this->contents = $pl->getPages()->toArray();
}
示例3: populate
function populate()
{
$pl = new PageList('open_opportunities');
$open_opportunities = new OpportunityCollection(new Opportunity());
$sh = new SearchHandler($open_opportunities, false);
$sh->extract();
$sh->addConstraint(new Constraint('owner', '=', EGS_USERNAME));
$sh->addConstraint(new Constraint('open', '=', 'true'));
$sh->setLimit(10);
$sh->setOrderBy('cost', 'DESC');
$open_opportunities->load($sh);
$pl->addFromCollection($open_opportunities, array('module' => 'crm', 'controller' => 'opportunitys', 'action' => 'view'), array('id'), 'opportunity', 'name');
$this->setData($pl->getPages()->toArray());
}
示例4: populate
function populate()
{
$pl = new PageList('current_activities');
$current_activities = new ActivityCollection(new Activity());
$sh = new SearchHandler($current_activities, false);
$sh->extract();
$sh->addConstraint(new Constraint('assigned', '=', EGS_USERNAME));
$sh->addConstraint(new Constraint('completed', 'IS', 'NULL'));
$sh->addConstraint(new Constraint('startdate', '<', '(now())'));
$sh->setLimit(10);
$sh->setOrderBy('created', 'DESC');
$current_activities->load($sh);
$pl->addFromCollection($current_activities, array('module' => 'crm', 'controller' => 'activitys', 'action' => 'view'), array('id'), 'activity', 'name');
$this->contents = $pl->getPages()->toArray();
}
示例5: populate
function populate()
{
if (!$this->isCached()) {
$pl = new PageList('recently_added_leads');
$companies_do = new CompanyCollection(new Company());
$sh = new SearchHandler($companies_do, false);
$sh->extract();
$sh->addConstraint(new Constraint('is_lead', '=', 'true'));
$sh->setLimit(10);
$sh->setOrderBy('created', 'DESC');
$companies_do->load($sh);
$pl->addFromCollection($companies_do, array('module' => 'contacts', 'controller' => 'companys', 'action' => 'view'), array('id'), 'company', 'name');
$this->setCache($pl->getPages()->toArray());
}
$this->contents = $this->getCache();
}
示例6: populate
function populate()
{
$pl = new PageList('my_tickets');
$my_tickets = new TicketCollection(new Ticket());
$sh = new SearchHandler($my_tickets, false);
$sh->extract();
$sh->addConstraint(new Constraint('assigned_to', 'IS', 'NULL'));
$cc = new ConstraintChain();
$cc->add(new Constraint('internal_status_code', '=', 'NEW'), 'OR');
$cc->add(new Constraint('internal_status_code', '=', 'OPEN'), 'OR');
$sh->addConstraintChain($cc);
$sh->setLimit(10);
$sh->setOrderBy('created', 'DESC');
$my_tickets->load($sh);
$pl->addFromCollection($my_tickets, array('module' => 'ticketing', 'controller' => 'tickets', 'action' => 'view'), array('id'), 'ticket', 'summary');
$this->contents = $pl->getPages()->toArray();
}
示例7: populate
function populate()
{
$pl = new PageList('my_customers');
$customers = new SLCustomerCollection(new SLCustomer());
// Either get data from a function that returns a collection
// $customers->getUnassignedCompanies();
// Or construct a collection from a sql query
$db = DB::Instance();
$query = 'select id, * from slmaster where usercompanyid=' . EGS_COMPANY_ID . ' limit 10';
$results = $db->getAssoc($query);
foreach ($results as $id => $row) {
$customer = new SLCustomer();
$customer->_data = $row;
$customer->load($id);
$customer->id = $id;
$customers->add($customer);
}
$pl->addFromCollection($customers, array('module' => 'sales_ledger', 'controller' => 'slcustomers', 'action' => 'view'), array('id'), '', 'name');
$this->contents = $pl->getPages()->toArray();
}