/** * Parse the dataGrids and the reports */ protected function parse() { parent::parse(); // parse dataGrids if (!empty($this->dataGrids)) { $this->tpl->assign('dataGrids', $this->dataGrids); } $this->tpl->assign('emptyDatagrid', $this->emptyDatagrid->getContent()); }
protected function parse() { parent::parse(); // if we don't have a token anymore, redirect to the settings page if ($this->get('fork.settings')->get($this->getModule(), 'certificate') === null || $this->get('fork.settings')->get($this->getModule(), 'account') === null || $this->get('fork.settings')->get($this->getModule(), 'web_property_id') === null || $this->get('fork.settings')->get($this->getModule(), 'profile') === null) { $this->redirect(Model::createURLForAction('Settings')); } $this->header->addJS('highcharts.js', 'Core', false); $analytics = $this->get('analytics.connector'); $analyticsTemplateToFunctionMap = ['page_views' => 'getPageViews', 'visitors' => 'getVisitors', 'pages_per_visit' => 'getPagesPerVisit', 'time_on_site' => 'getTimeOnSite', 'new_sessions_percentage' => 'getNewSessionsPercentage', 'bounce_rate' => 'getBounceRate', 'visitors_graph_data' => 'getVisitorsGraphData', 'source_graph_data' => 'getSourceGraphData']; foreach ($analyticsTemplateToFunctionMap as $templateVariableName => $functionName) { $this->tpl->assign($templateVariableName, $analytics->{$functionName}($this->dateRange->getStartDate(), $this->dateRange->getEndDate())); } $dataGrid = new DataGridArray($analytics->getMostVisitedPagesData($this->dateRange->getStartDate(), $this->dateRange->getEndDate())); $this->tpl->assign('dataGridMostViewedPages', (string) $dataGrid->getContent()); }
/** * Parse the datagrids and the reports. */ protected function parse() { parent::parse(); // parse data grid $this->tpl->assign('dataGridInstallableModules', (string) $this->dataGridInstallableModules->getContent()); $this->tpl->assign('dataGridInstalledModules', (string) $this->dataGridInstalledModules->getContent()); // parse installer warnings $this->tpl->assign('warnings', (array) \SpoonSession::get('installer_warnings')); }
/** * Parse the form */ protected function parse() { parent::parse(); // assign id, name $this->tpl->assign('id', $this->id); $this->tpl->assign('name', $this->record['name']); // assign usage-datagrid $this->tpl->assign('usage', (string) $this->dgUsage->getContent()); }
/** * Parse & display the page */ protected function parse() { parent::parse(); // parse datagrid $this->tpl->assign('dgBackend', $this->dgBackend->getNumResults() != 0 ? $this->dgBackend->getContent() : false); $this->tpl->assign('dgFrontend', $this->dgFrontend->getNumResults() != 0 ? $this->dgFrontend->getContent() : false); // parse filter $this->tpl->assign('language', BL::getWorkingLanguage()); }
/** * Parse. */ protected function parse() { parent::parse(); // assign theme data $this->tpl->assign('name', $this->currentTheme); $this->tpl->assign('warnings', $this->warnings); $this->tpl->assign('information', $this->information); $this->tpl->assign('showExtensionsInstallTheme', !BackendExtensionsModel::isThemeInstalled($this->currentTheme) && BackendAuthentication::isAllowedAction('InstallTheme')); // data grids $this->tpl->assign('dataGridTemplates', isset($this->dataGridTemplates) && $this->dataGridTemplates->getNumResults() > 0 ? $this->dataGridTemplates->getContent() : false); }
/** * Parse. */ protected function parse() { parent::parse(); // assign module data $this->tpl->assign('name', $this->currentModule); $this->tpl->assign('warnings', $this->warnings); $this->tpl->assign('information', $this->information); $this->tpl->assign('showExtensionsInstallModule', !BackendModel::isModuleInstalled($this->currentModule) && BackendAuthentication::isAllowedAction('InstallModule')); // data grids $this->tpl->assign('dataGridEvents', isset($this->dataGridEvents) && $this->dataGridEvents->getNumResults() > 0 ? $this->dataGridEvents->getContent() : false); $this->tpl->assign('dataGridCronjobs', isset($this->dataGridCronjobs) && $this->dataGridCronjobs->getNumResults() > 0 ? $this->dataGridCronjobs->getContent() : false); }
/** * Parse & display the page */ protected function parse() { parent::parse(); // parse datagrids $this->tpl->assign('dgLabels', $this->dgLabels->getNumResults() != 0 ? $this->dgLabels->getContent() : false); $this->tpl->assign('dgMessages', $this->dgMessages->getNumResults() != 0 ? $this->dgMessages->getContent() : false); $this->tpl->assign('dgErrors', $this->dgErrors->getNumResults() != 0 ? $this->dgErrors->getContent() : false); $this->tpl->assign('dgActions', $this->dgActions->getNumResults() != 0 ? $this->dgActions->getContent() : false); // is filtered? if ($this->getParameter('form', 'string', '') == 'filter') { $this->tpl->assign('filter', true); } // parse filter as query $this->tpl->assign('filter', $this->filterQuery); // parse isGod $this->tpl->assign('isGod', $this->isGod); // parse noItems, if all the datagrids are empty $this->tpl->assign('noItems', $this->dgLabels->getNumResults() == 0 && $this->dgMessages->getNumResults() == 0 && $this->dgErrors->getNumResults() == 0 && $this->dgActions->getNumResults() == 0); $this->tpl->assign('hasSubmissions', $this->hasSubmissions); // parse the add URL $this->tpl->assign('addURL', BackendModel::createURLForAction('Add', null, null, null) . $this->filterQuery); }
/** * Load the form */ private function loadForm() { $this->frm = new BackendForm('edit'); // get selected permissions $modulePermissions = BackendGroupsModel::getModulePermissions($this->id); $actionPermissions = BackendGroupsModel::getActionPermissions($this->id); // add selected modules to array foreach ($modulePermissions as $permission) { $selectedModules[] = $permission['module']; } // loop through modules foreach ($this->modules as $key => $module) { // widgets available? if (isset($this->widgets)) { // loop through widgets foreach ($this->widgets as $j => $widget) { // widget is present? if (isset($this->dashboardSequence[$module['value']][$widget['value']]['present']) && $this->dashboardSequence[$module['value']][$widget['value']]['present'] === true && $widget['checkbox_name'] == $module['value'] . $widget['value']) { $selectedWidgets[$j] = $widget['checkbox_name']; } // add widget checkboxes $widgetBoxes[$j]['checkbox'] = '<span>' . $this->frm->addCheckbox('widgets_' . $widget['checkbox_name'], isset($selectedWidgets[$j]) ? $selectedWidgets[$j] : null)->parse() . '</span>'; $widgetBoxes[$j]['module'] = \SpoonFilter::ucfirst(BL::lbl($widget['module_name'])); $widgetBoxes[$j]['widget'] = '<label for="widgets' . \SpoonFilter::toCamelCase($widget['label']) . '">' . $widget['label'] . '</label>'; $widgetBoxes[$j]['description'] = $widget['description']; } } $selectedActions = array(); // loop through action permissions foreach ($actionPermissions as $permission) { // add to selected actions if ($permission['module'] == $module['value']) { $selectedActions[] = $permission['action']; } } // add module labels $permissionBoxes[$key]['label'] = $module['label']; // init var $addedBundles = array(); // loop through actions foreach ($this->actions[$module['value']] as $i => $action) { // action is bundled? if (array_key_exists('group', $action)) { // bundle not yet in array? if (!in_array($action['group'], $addedBundles)) { // assign bundled action boxes $actionBoxes[$key]['actions'][$i]['checkbox'] = $this->frm->addCheckbox('actions_' . $module['label'] . '_' . 'Group_' . \SpoonFilter::ucfirst($action['group']), in_array($action['value'], $selectedActions))->parse(); $actionBoxes[$key]['actions'][$i]['action'] = \SpoonFilter::ucfirst($action['group']); $actionBoxes[$key]['actions'][$i]['description'] = $this->actionGroups[$action['group']]; // add the group to the added bundles $addedBundles[] = $action['group']; } } else { // assign action boxes $actionBoxes[$key]['actions'][$i]['checkbox'] = $this->frm->addCheckbox('actions_' . $module['label'] . '_' . $action['label'], in_array($action['value'], $selectedActions))->parse(); $actionBoxes[$key]['actions'][$i]['action'] = '<label for="actions' . \SpoonFilter::toCamelCase($module['label'] . '_' . $action['label']) . '">' . $action['label'] . '</label>'; $actionBoxes[$key]['actions'][$i]['description'] = $action['description']; } } // widgetboxes available? if (isset($widgetBoxes)) { // create datagrid $widgetGrid = new BackendDataGridArray($widgetBoxes); $widgetGrid->setHeaderLabels(array('checkbox' => '<span class="checkboxHolder"><input id="toggleChecksWidgets" type="checkbox" name="toggleChecks" value="toggleChecks" /></span>')); // get content $widgets = $widgetGrid->getContent(); } // create datagrid $actionGrid = new BackendDataGridArray($actionBoxes[$key]['actions']); // disable paging $actionGrid->setPaging(false); // get content of datagrids $permissionBoxes[$key]['actions']['dataGrid'] = $actionGrid->getContent(); $permissionBoxes[$key]['chk'] = $this->frm->addCheckbox($module['label'], null, 'inputCheckbox checkBeforeUnload selectAll')->parse(); $permissionBoxes[$key]['id'] = \SpoonFilter::toCamelCase($module['label']); } // create elements $this->frm->addText('name', $this->record['name']); $this->frm->addDropdown('manage_users', array('Deny', 'Allow')); $this->frm->addDropdown('manage_groups', array('Deny', 'Allow')); $this->tpl->assign('permissions', $permissionBoxes); $this->tpl->assign('widgets', isset($widgets) ? $widgets : false); }
/** * Load the datagrid for unsubscriptions */ private function loadUnsubscriptions() { // get results $results = BackendMailmotorModel::getRecentUnsubscriptions(self::PAGING_LIMIT); // there are some results if (!empty($results)) { $dataGrid = new BackendDataGridArray($results); $dataGrid->setPaging(false); $dataGrid->setColumnFunction(array(new BackendDataGridFunctions(), 'getTimeAgo'), array('[unsubscribed_on]'), 'unsubscribed_on', true); // check if this action is allowed if (BackendAuthentication::isAllowedAction('EditAddress')) { $dataGrid->setColumnURL('email', BackendModel::createURLForAction('EditAddress', 'Mailmotor') . '&email=[email]'); } // parse the datagrid $this->tpl->assign('dgMailmotorUnsubscriptions', $dataGrid->getContent()); } }
protected function parse() { parent::parse(); $this->header->addJS('highcharts.js', 'Core', false); $this->form->parse($this->tpl); $this->tpl->assign('startTimestamp', $this->startDate); $this->tpl->assign('endTimestamp', $this->endDate); // if we don't have a token anymore, redirect to the settings page if ($this->get('fork.settings')->get($this->getModule(), 'certificate') === null || $this->get('fork.settings')->get($this->getModule(), 'account') === null || $this->get('fork.settings')->get($this->getModule(), 'web_property_id') === null || $this->get('fork.settings')->get($this->getModule(), 'profile') === null) { $this->redirect(Model::createURLForAction('Settings')); } $analytics = $this->get('analytics.connector'); $this->tpl->assign('page_views', $analytics->getPageViews($this->startDate, $this->endDate)); $this->tpl->assign('visitors', $analytics->getVisitors($this->startDate, $this->endDate)); $this->tpl->assign('pages_per_visit', $analytics->getPagesPerVisit($this->startDate, $this->endDate)); $this->tpl->assign('time_on_site', $analytics->getTimeOnSite($this->startDate, $this->endDate)); $this->tpl->assign('new_sessions_percentage', $analytics->getNewSessionsPercentage($this->startDate, $this->endDate)); $this->tpl->assign('bounce_rate', $analytics->getBounceRate($this->startDate, $this->endDate)); $this->tpl->assign('visitors_graph_data', $analytics->getVisitorsGraphData($this->startDate, $this->endDate)); $this->tpl->assign('source_graph_data', $analytics->getSourceGraphData($this->startDate, $this->endDate)); $dataGrid = new DataGridArray($analytics->getMostVisitedPagesData($this->startDate, $this->endDate)); $this->tpl->assign('dataGridMostViewedPages', (string) $dataGrid->getContent()); }