Exemple #1
0
 public function render($tpl = null)
 {
     //get model and retrieve info
     $model = new EventModel();
     if (TemplateHelper::isMobile()) {
         $model->set('current_events', true);
     }
     $events = $model->getEvents();
     $eventDock = ViewHelper::getView('events', 'dashboard_event_dock', 'phtml', array('events' => $events));
     $dealModel = new DealModel();
     $dealModel->set('_view', 'dashboard');
     $dealModel->set('recent', true);
     $dealModel->set('archived', 0);
     $recentDeals = $dealModel->getDeals();
     $doc = JFactory::getDocument();
     //get data for sales graphs
     $model = new GraphsModel();
     $graph_data = $model->getGraphData();
     $activityHelper = new ActivityHelper();
     $activity = $activityHelper->getActivity();
     //assign results to view
     $this->eventDock = $eventDock;
     $this->graph_data = $graph_data;
     $this->recentDeals = $recentDeals;
     $this->activity = $activity;
     $json = TRUE;
     $peopleModel = new PeopleModel();
     if (TemplateHelper::isMobile()) {
         $dealModel->set('recent', false);
         $totalDeals = $dealModel->getTotal();
         $peopleModel->set('type', 'leads');
         $totalLeads = $peopleModel->getTotal();
         $peopleModel->set('type', 'not_leads');
         $totalContacts = $peopleModel->getTotal();
         $companyModel = new CompanyModel();
         $totalCompanies = $companyModel->getTotal();
         $user = UsersHelper::getLoggedInUser();
         $this->first_name = $user->first_name;
         $this->numEvents = count($events);
         $this->numDeals = $totalDeals;
         $this->numLeads = $totalLeads;
         $this->numContacts = $totalContacts;
         $this->numCompanies = $totalCompanies;
     }
     $peopleNames = $peopleModel->getPeopleNames($json);
     $doc->addScriptDeclaration("var people_names=" . $peopleNames . ";");
     $dealModel = new DealModel();
     $dealNames = $dealModel->getDealNames($json);
     $doc->addScriptDeclaration("var deal_names=" . $dealNames . ";");
     /** get latest activities **/
     $this->latest_activities = ViewHelper::getView('dashboard', 'latest_activities', 'phtml');
     $this->latest_activities->activity = $activity;
     $activityHelper = new ActivityHelper();
     $activity = $activityHelper->getActivity();
     //display
     return parent::render();
 }
Exemple #2
0
 public function render()
 {
     $app = JFactory::getApplication();
     $document = JFactory::getDocument();
     $id = $app->input->get('id') ? $app->input->get('id') : null;
     $company_id = $app->input->get('company_id');
     //retrieve people from model
     $model = new PeopleModel();
     $model->set('company_id', $company_id);
     $layout = $this->getLayout();
     $this->total = $model->getTotal();
     $this->pagination = $model->getPagination();
     //assign refs
     switch ($layout) {
         case "entry":
             $this->k = 0;
             $this->person = $model->getPerson();
             break;
         case "add":
         case "edit":
             $this->person = $model->getPerson();
             $this->edit_custom_fields_view = ViewHelper::getView('custom', 'edit', 'phtml', array('type' => 'people', 'item' => $this->person));
             $companyModel = new CompanyModel();
             $json = TRUE;
             $companyNames = $companyModel->getCompanyNames($json);
             $document->addScriptDeclaration("var company_names=" . $companyNames . ";");
             break;
         case "people_dock_list":
             $people = $model->getPeople($id);
             $this->people = $people;
             break;
         default:
             $people = $model->getPeople($id);
             $this->people = $people;
             $this->state = $model->getState();
             break;
     }
     //display view
     echo parent::render();
 }