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(); }
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(); }
function viewBranches() { $branches = new CompanyCollection($this->_templateobject); $sh = new SearchHandler($branches, false); $sh->extract(); $sh->addConstraint(new Constraint('parent_id', '=', $this->_data['parent_id'])); $branches->load($sh); $this->_templateName = $this->getTemplateName('view_related'); $this->view->set('clickaction', 'view'); $this->view->set('related_collection', $branches); $this->view->set('num_pages', $branches->num_pages); $this->view->set('cur_page', $branches->cur_page); $this->view->set('no_ordering', true); }