本文整理汇总了PHP中SearchHandler::extract方法的典型用法代码示例。如果您正苦于以下问题:PHP SearchHandler::extract方法的具体用法?PHP SearchHandler::extract怎么用?PHP SearchHandler::extract使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SearchHandler
的用法示例。
在下文中一共展示了SearchHandler::extract方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: summary_report
public function summary_report()
{
$users = array();
if (isModuleAdmin()) {
$u = DataObjectFactory::Factory('User');
$users = $u->getAll();
}
$this->view->set('users', $users);
if (isset($this->_data['filter'])) {
$cc = new ConstraintChain();
if (!empty($this->_data['from_date'])) {
$cc->add(new Constraint('enddate', '>', fix_date($this->_data['from_date'])));
}
if (!empty($this->_data['to_date'])) {
$cc->add(new Constraint('enddate', '<', fix_date($this->_data['to_date'])));
}
if (!isModuleAdmin()) {
$cc->add(new Constraint('assigned', '=' . EGS_USERNAME));
} elseif (!empty($this->_data['assigned'])) {
$cc->add(new Constraint('assigned', '=', $this->_data['assigned']));
}
$opp_sh = new SearchHandler(new OpportunityCollection($this->_templateobject), false);
$opp_sh->addConstraintChain($cc);
$opp_sh->extract();
$os = DataObjectFactory::Factory('Opportunitystatus');
$os->addSearchHandler('opportunities', $opp_sh);
$statuses = new OpportunitystatusCollection($os);
$sh = new SearchHandler($statuses, false);
$sh->extract();
$statuses->load($sh);
$this->view->set('statuses', $statuses);
$this->view->set('report_headings', array('name', 'company', 'person', 'enddate', 'type', 'cost', 'assigned'));
$this->view->set('cc', $cc);
}
}
示例2: view
public function view()
{
if (!$this->loadData()) {
$this->dataError();
sendBack();
}
$transaction = $this->_uses[$this->modeltype];
$id = $transaction->id;
$this->view->set('transaction', $transaction);
$elements = new WHTransferruleCollection(new WHTransferrule());
$sh = new SearchHandler($elements, false);
$sh->extract();
$sh->addConstraint(new Constraint('whaction_id', '=', $id));
$sh->extractOrdering();
$sh->extractPaging();
$elements->load($sh);
$this->view->set('elements', $elements);
$sidebar = new SidebarController($this->view);
$sidebar->addList('Show', array('all' => array('tag' => 'All Actions', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'index'))), 'locations' => array('tag' => 'All Stores', 'link' => array_merge($this->_modules, array('controller' => 'WHStores', 'action' => 'index')))));
$sidebarlist = array();
$sidebarlist['edit'] = array('tag' => 'Edit', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'edit', 'id' => $id)));
$sidebarlist['delete'] = array('tag' => 'Delete', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'delete', 'id' => $id)));
if (is_null($transaction->max_rules) || $elements->count() < $transaction->max_rules) {
$sidebarlist['Add'] = array('tag' => 'Add Rule', 'link' => array_merge($this->_modules, array('controller' => 'WHTransferrules', 'action' => 'new', 'whaction_id' => $id)));
}
$sidebar->addList('This Action', $sidebarlist);
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
$this->view->set('clickaction', 'view');
$this->view->set('clickcontroller', 'WHTransferrules');
$this->view->set('no_ordering', true);
}
示例3: _new
public function _new()
{
parent::_new();
// For new actions the stitem_id and from_uom_id will be set
// For edit actions, the id will be set pointing to the uom conversion to be edited
if ($this->_data['action'] == 'edit') {
$stuom = $this->_uses[$this->modeltype];
$stitem_id = $stuom->stitem_id;
$stitem_uom_id = $stuom->from_uom_id;
$stitem_uom_name = $stuom->from_uom_name;
} else {
$stitem = new STitem();
$stitem->load($this->_data['stitem_id']);
$stitem_id = $stitem->id;
$stitem_uom_id = $stitem->uom_id;
$stitem_uom_name = $stitem->uom_name;
}
$this->view->set('stitem_id', $stitem_id);
$this->view->set('stitem_uom_id', $stitem_uom_id);
$this->view->set('stitem_uom_name', $stitem_uom_name);
$this->view->set('stitem', Stuomconversion::getStockItem($stitem_id));
$elements = new STuomconversionCollection(new STuomconversion());
$sh = new SearchHandler($elements, false);
$sh->extract();
$sh->addConstraint(new Constraint('stitem_id', '=', $stitem_id));
$sh->setOrderBy('from_uom_name');
$sh->extractOrdering();
$sh->extractPaging();
$elements->load($sh);
$this->view->set('elements', $elements);
$this->view->set('no_ordering', true);
}
示例4: 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();
}
示例5: index
public function index()
{
$moduleobjects = new ModuleObjectCollection($this->_templateobject);
$sh = new SearchHandler($moduleobjects, false);
$sh->extract();
parent::index(new ModuleObjectCollection($this->_templateobject), $sh);
$this->view->set('clickaction', 'view');
$sidebar = new SidebarController($this->view);
$sidebarlist['new'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'new'), 'tag' => 'New');
$sidebar->addList('Actions', $sidebarlist);
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
}
示例6: view
public function view()
{
$id = $this->_data['id'];
global $smarty;
$this->view->set('clickaction', 'viewuser');
$collection = new HasRoleCollection($this->_templateobject);
$sh = new SearchHandler($collection);
$sh->extract();
$sh->addConstraint(new Constraint('roleid', '=', $id));
$collection->load($sh);
$this->view->set(strtolower($collection->getModelName()) . 's', $collection);
$this->view->set('num_pages', $collection->num_pages);
$this->view->set('cur_page', $collection->cur_page);
}
示例7: 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());
}
示例8: 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();
}
示例9: index
public function index()
{
$collection = new TicketCollection($this->_templateobject);
$sh = new SearchHandler($collection, false);
$sh->extract();
$sh->setFields(array('id' => 'id', 'summary' => 'summary', 'originator_person' => 'originator_person', 'client_ticket_status' => 'client_ticket_status', 'client_ticket_priority' => 'client_ticket_priority', 'client_ticket_severity' => 'client_ticket_severity', 'created' => 'created', 'lastupdated' => 'lastupdated'));
$this->setSearch('TicketsSearch', 'useClient');
parent::index($collection, $sh);
$this->view->set('no_delete', true);
$this->view->set('clickaction', 'view');
$sidebar = new SidebarController($this->view);
$sidebar->addList('Actions', array('new' => array('link' => array('module' => 'ticketing', 'controller' => 'client', 'action' => 'new'), 'tag' => 'New Ticket')));
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
}
示例10: 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();
}
示例11: 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();
}
示例12: showclicks
public function showclicks()
{
$clicks = new NewsletterurlclickCollection(new Newsletterurlclick());
$sh = new SearchHandler($clicks, false);
$sh->extract();
$sh->addConstraint(new Constraint('newsletter_id', '=', $this->_data['newsletter_id']));
if (isset($sh->fields['newsletter'])) {
unset($sh->fields['newsletter']);
}
$clicks->load($sh);
$this->setTemplateName('view_related');
$this->view->set('clickaction', 'viewperson');
$this->view->set('paging_link', array('module' => 'crm', 'controller' => 'newsletters', 'action' => 'showclicks', 'newsletter_id' => $this->_data['newsletter_id']));
$this->view->set('no_ordering', true);
$this->view->set('related_collection', $clicks);
$this->view->set('num_pages', $clicks->num_pages);
$this->view->set('cur_page', $clicks->cur_page);
}
示例13: getYTD
function getYTD($ytd_periods, $print = false, $use_saved_search)
{
if (count($ytd_periods) > 0) {
$sh = new SearchHandler($this, $use_saved_search);
if ($print) {
$sh->setLimit(0);
} else {
$sh->extract();
}
$fields = array('centre||account', 'centre', 'account');
$sh->setOrderBy($fields);
$fields = array_merge($fields, array('glcentre_id', 'glaccount_id'));
$sh->setGroupBy($fields);
$fields[] = 'sum(value) as value';
$sh->setFields($fields);
$sh->addConstraint(new Constraint('glperiods_id', 'in', '(' . implode(',', $ytd_periods) . ')'));
$this->load($sh);
}
}
示例14: view
public function view()
{
$option = $this->checkValidOption() or sendBack();
$modelname = $this->setup_options[$option];
$col_name = $modelname . 'Collection';
$model = DataObjectFactory::Factory($modelname);
$collection = new $col_name();
$sh = new SearchHandler($collection, FALSE);
$sh->extract();
$sh->setLimit(0);
$collection->load($sh);
$this->view->set('collection', $collection);
$this->view->set('model', $model);
$this->view->set('extrafields', $this->viewFields($option, $model));
$this->view->set('edit_extrafields', $this->newFields($option, $model));
if ($model->isField('position') || $model->isField('index')) {
$this->view->set('orderable', TRUE);
}
// Set the Sidebar options
$this->sidebar_options();
$this->setTemplateName('module_setup_view');
}
示例15: view_my_expenses
public function view_my_expenses()
{
$flash = Flash::Instance();
$employee_id = $this->get_employee_id();
if (!empty($employee_id)) {
$this->_templateName = $this->getTemplateName('index');
$errors = array();
$s_data = array();
// Set context from calling module
$this->setSearch('expenseSearch', 'myExpenses', $s_data);
unset($this->_templateobject->defaultDisplayFields['person']);
$he = new ExpenseCollection($this->_templateobject);
$sh = new SearchHandler($he, false);
$sh->extract();
$sh->addConstraint(new Constraint('employee_id', '=', $employee_id));
parent::index($he, $sh);
$sidebarlist = array();
$sidebarlist['new'] = array('tag' => 'New', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'new', 'employee_id' => $employee_id));
$sidebar = new SidebarController($this->view);
$sidebar->addList('actions', $sidebarlist);
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
$this->view->set('clickaction', 'view');
} else {
$flash->addError('You have not been set up as an employee');
sendBack();
}
}