public function execute() { //set view $view = ViewHelper::getView('deals', 'raw'); $view->setLayout('list'); //get filters $type = $this->getInput()->get('type'); $stage = $this->getInput()->get('stage'); $user = $this->getInput()->get('user'); $close = $this->getInput()->get('close'); $team = $this->getInput()->get('team_id'); //get deals $model = new DealModel(); $deals = $model->getDeals(null, $type, $user, $stage, $close, $team); //assign references $view->deals = $deals; $view->pagination = $model->getPagination(); //display echo $view->render(); }
public function _display_deal_milestones() { //get deals for reports $dealModel = new DealModel(); $dealModel->set('archived', 0); $deals = $dealModel->getDeals(); //pagination $this->pagination = $dealModel->getPagination(); // Initialise state variables. $this->state = $dealModel->getState(); //list view $this->deal_milestone_list = ViewHelper::getView('reports', 'deal_milestones_filter', 'phtml', array('deals' => $deals)); $this->deals = $deals; }
public function render($tpl = null) { $app = JFactory::getApplication(); $id = $app->input->get('id', null); $company_id = $app->input->get('company_id'); $person_id = $app->input->get('person_id'); //get deals $model = new DealModel(); if ($company_id) { $model->set('company_id', $company_id); } elseif ($person_id) { $model->set('person_id', $person_id); } elseif ($id) { $model->set('_id', $id); } $layout = $this->getLayout(); $total = $model->getTotal(); $this->total = $total; $pagination = $model->getPagination(); $this->pagination = $pagination; //assign references switch ($layout) { case "entry": $this->stages = DealHelper::getStages(null, true, false); $this->statuses = DealHelper::getStatuses(null, true); $this->sources = DealHelper::getSources(null); $this->users = UsersHelper::getUsers(null, true); $this->k = 0; $this->deal = $model->getDeal(); break; case "deal": $this->deal = $model->getDeal($id); $this->dealList = $model->getDeals(); $primary_contact_id = DealHelper::getPrimaryContact($this->deal->id); $this->closed_stages = DealHelper::getClosedStages(); $model = new EventModel(); $events = $model->getEvents("deal", null, $app->input->get('id')); $this->event_dock = ViewHelper::getView('events', 'event_dock', 'phtml', array('events' => $events)); $this->document_list = ViewHelper::getView('documents', 'document_row', 'phtml', array('documents' => $this->deal->documents)); $this->custom_fields_view = ViewHelper::getView('custom', 'default', 'phtml', array('type' => 'deal', 'item' => $this->deal)); $this->contact_info = ViewHelper::getView('contacts', 'default', 'phtml', array('contacts' => $this->deal->people, 'primary_contact_id' => $primary_contact_id)); break; case "deal_dock_list": $this->deals = $model->getDeals(); break; case "add": case "edit": $this->deal = $model->getDeal($id); $this->edit_custom_fields_view = ViewHelper::getView('custom', 'edit', 'phtml', array('type' => 'deal', 'item' => $this->deal)); break; case "edit_conversation": $model = new ConversationModel(); $conversation = $model->getConversation($id); $this->conversation = $conversation[0]; break; case "conversation_entry": $model = new ConversationModel(); $conversation = $model->getConversation($id); $this->conversation = $conversation[0]; break; default: $this->dealList = $model->getDeals(); $state = $model->getState(); $this->state = $state; break; } //display view echo parent::render(); }