Ejemplo n.º 1
0
 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();
 }
Ejemplo n.º 2
0
 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();
 }
Ejemplo n.º 3
0
 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());
 }
Ejemplo n.º 4
0
 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();
 }
Ejemplo n.º 5
0
 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();
 }
Ejemplo n.º 6
0
 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();
 }
Ejemplo n.º 7
0
 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();
 }