/** * Parses the data to make the chart with */ private function parseChartData() { $maxYAxis = 2; $metrics = array('visitors', 'pageviews'); $graphData = array(); $metricsPerDay = BackendAnalyticsModel::getMetricsPerDay($metrics, $this->startTimestamp, $this->endTimestamp); foreach ($metrics as $i => $metric) { $graphData[$i] = array(); $graphData[$i]['title'] = $metric; $graphData[$i]['label'] = SpoonFilter::ucfirst(BL::lbl(SpoonFilter::toCamelCase($metric))); $graphData[$i]['i'] = $i + 1; $graphData[$i]['data'] = array(); foreach ($metricsPerDay as $j => $data) { // cast SimpleXMLElement to array $data = (array) $data; // build array $graphData[$i]['data'][$j]['date'] = (int) $data['timestamp']; $graphData[$i]['data'][$j]['value'] = (string) $data[$metric]; } } // loop the metrics foreach ($graphData as $metric) { foreach ($metric['data'] as $data) { // get the maximum value if ((int) $data['value'] > $maxYAxis) { $maxYAxis = (int) $data['value']; } } } $this->tpl->assign('maxYAxis', $maxYAxis); $this->tpl->assign('tickInterval', $maxYAxis == 2 ? '1' : ''); $this->tpl->assign('graphData', $graphData); }
/** * Load the form */ private function loadForm() { $this->imageIsAllowed = BackendModel::getModuleSetting($this->URL->getModule(), 'show_image_form', true); $this->frm = new BackendForm('add'); // set hidden values $rbtHiddenValues[] = array('label' => BL::lbl('Hidden', $this->URL->getModule()), 'value' => 'Y'); $rbtHiddenValues[] = array('label' => BL::lbl('Published'), 'value' => 'N'); // get categories $categories = BackendBlogModel::getCategories(); $categories['new_category'] = SpoonFilter::ucfirst(BL::getLabel('AddCategory')); // create elements $this->frm->addText('title', null, null, 'inputText title', 'inputTextError title'); $this->frm->addEditor('text'); $this->frm->addEditor('introduction'); $this->frm->addRadiobutton('hidden', $rbtHiddenValues, 'N'); $this->frm->addCheckbox('allow_comments', BackendModel::getModuleSetting($this->getModule(), 'allow_comments', false)); $this->frm->addDropdown('category_id', $categories, SpoonFilter::getGetValue('category', null, null, 'int')); if (count($categories) != 2) { $this->frm->getField('category_id')->setDefaultElement(''); } $this->frm->addDropdown('user_id', BackendUsersModel::getUsers(), BackendAuthentication::getUser()->getUserId()); $this->frm->addText('tags', null, null, 'inputText tagBox', 'inputTextError tagBox'); $this->frm->addDate('publish_on_date'); $this->frm->addTime('publish_on_time'); if ($this->imageIsAllowed) { $this->frm->addImage('image'); } // meta $this->meta = new BackendMeta($this->frm, null, 'title', true); }
/** * Loads the dataGrids */ private function loadDatagrids() { // load all categories $categories = BackendFaqModel::getCategories(true); // loop categories and create a dataGrid for each one foreach ($categories as $categoryId => $categoryTitle) { $dataGrid = new BackendDataGridDB(BackendFaqModel::QRY_DATAGRID_BROWSE, array(BL::getWorkingLanguage(), $categoryId)); $dataGrid->setAttributes(array('class' => 'dataGrid sequenceByDragAndDrop')); $dataGrid->setColumnsHidden(array('category_id', 'sequence')); $dataGrid->addColumn('dragAndDropHandle', null, '<span>' . BL::lbl('Move') . '</span>'); $dataGrid->setColumnsSequence('dragAndDropHandle'); $dataGrid->setColumnAttributes('question', array('class' => 'title')); $dataGrid->setColumnAttributes('dragAndDropHandle', array('class' => 'dragAndDropHandle')); $dataGrid->setRowAttributes(array('id' => '[id]')); // check if this action is allowed if (BackendAuthentication::isAllowedAction('edit')) { $dataGrid->setColumnURL('question', BackendModel::createURLForAction('edit') . '&id=[id]'); $dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit') . '&id=[id]', BL::lbl('Edit')); } // add dataGrid to list $this->dataGrids[] = array('id' => $categoryId, 'title' => $categoryTitle, 'content' => $dataGrid->getContent()); } // set empty datagrid $this->emptyDatagrid = new BackendDataGridArray(array(array('dragAndDropHandle' => '', 'question' => BL::msg('NoQuestionInCategory'), 'edit' => ''))); $this->emptyDatagrid->setAttributes(array('class' => 'dataGrid sequenceByDragAndDrop emptyGrid')); $this->emptyDatagrid->setHeaderLabels(array('edit' => null, 'dragAndDropHandle' => null)); }
/** * Loads the datagrid with the groups * * @return void */ private function loadDataGrid() { // create datagrid $this->dataGrid = new BackendDataGridDB(BackendMailmotorModel::QRY_DATAGRID_BROWSE_GROUPS); $this->dataGrid->setColumnsHidden(array('language', 'is_default')); // sorting columns $this->dataGrid->setSortingColumns(array('name', 'created_on'), 'created_on'); $this->dataGrid->setSortParameter('desc'); // set colum URLs $this->dataGrid->setColumnURL('name', BackendModel::createURLForAction('addresses') . '&group_id=[id]'); // set the datagrid ID so we don't run into trouble with multiple datagrids that use mass actions $this->dataGrid->setAttributes(array('id' => 'dgGroups')); // add the multicheckbox column $this->dataGrid->setMassActionCheckboxes('checkbox', '[id]', BackendMailmotorModel::getDefaultGroupIds()); $this->dataGrid->setColumnsSequence('checkbox', 'name', 'created_on', 'language'); // add mass action dropdown $ddmMassAction = new SpoonFormDropdown('action', array('delete' => BL::lbl('Delete')), 'delete'); $this->dataGrid->setMassAction($ddmMassAction); // set column functions $this->dataGrid->setColumnFunction(array('BackendDataGridFunctions', 'getTimeAgo'), array('[created_on]'), 'created_on', true); // add delete column $this->dataGrid->addColumnAction('custom_fields', null, BL::lbl('CustomFields'), BackendModel::createURLForAction('custom_fields') . '&group_id=[id]', BL::lbl('CustomFields'), array('class' => 'button icon iconEdit linkButton')); $this->dataGrid->addColumnAction('export', null, BL::lbl('Export'), BackendModel::createURLForAction('export_addresses') . '&id=[id]', BL::lbl('Export'), array('class' => 'button icon iconExport linkButton')); $this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit_group') . '&id=[id]', BL::lbl('Edit')); // add styles $this->dataGrid->setColumnAttributes('name', array('class' => 'title')); // set paging limit $this->dataGrid->setPagingLimit(self::PAGING_LIMIT); }
/** * Parse this page * * @return void */ protected function parse() { // call parent parse parent::parse(); // get results $results = BackendAnalyticsModel::getLandingPages($this->startTimestamp, $this->endTimestamp); // there are some results if (!empty($results)) { // get the datagrid $dataGrid = new BackendDataGridArray($results); // hide columns $dataGrid->setColumnsHidden('start_date', 'end_date', 'updated_on', 'page_encoded'); // set headers values $headers['page_path'] = ucfirst(BL::lbl('Page')); // set headers $dataGrid->setHeaderLabels($headers); // set url $dataGrid->setColumnURL('page_path', BackendModel::createURLForAction('detail_page') . '&page=[page_encoded]'); // add the multicheckbox column $dataGrid->setMassActionCheckboxes('checkbox', '[id]'); // add mass action dropdown $ddmMassAction = new SpoonFormDropdown('action', array('delete_landing_page' => BL::lbl('Delete')), 'delete'); $dataGrid->setMassAction($ddmMassAction); // parse the datagrid $this->tpl->assign('dgPages', $dataGrid->getContent()); } }
/** * Parses the data to make the line chart * * @param array $metricsPerDay All needed metrics grouped by day. */ private function parseLineChartData($metricsPerDay) { $maxYAxis = 2; $metrics = array('pageviews'); $graphData = array(); foreach ($metrics as $i => $metric) { // build graph data array $graphData[$i] = array(); $graphData[$i]['title'] = $metric; $graphData[$i]['label'] = SpoonFilter::ucfirst(BL::lbl(SpoonFilter::toCamelCase($metric))); $graphData[$i]['data'] = array(); foreach ($metricsPerDay as $j => $data) { // cast SimpleXMLElement to array $data = (array) $data; $graphData[$i]['data'][$j]['date'] = (int) $data['timestamp']; $graphData[$i]['data'][$j]['value'] = (string) $data[$metric]; } } // loop the metrics foreach ($graphData as $metric) { foreach ($metric['data'] as $data) { // get the maximum value if ((int) $data['value'] > $maxYAxis) { $maxYAxis = (int) $data['value']; } } } $this->tpl->assign('maxYAxis', $maxYAxis); $this->tpl->assign('tickInterval', $maxYAxis == 2 ? '1' : ''); $this->tpl->assign('lineGraphData', $graphData); }
/** * Execute the action * * @return void */ public function execute() { // call parent, this will probably add some general CSS/JS or other required files parent::execute(); // fork is no longer authorized to collect analytics data if (BackendAnalyticsHelper::getStatus() == 'UNAUTHORIZED') { // remove all parameters from the module settings BackendModel::setModuleSetting($this->getModule(), 'session_token', null); BackendModel::setModuleSetting($this->getModule(), 'account_name', null); BackendModel::setModuleSetting($this->getModule(), 'table_id', null); BackendModel::setModuleSetting($this->getModule(), 'profile_title', null); // remove cache files BackendAnalyticsModel::removeCacheFiles(); // clear tables BackendAnalyticsModel::clearTables(); // return status $this->output(self::OK, array('status' => 'unauthorized', 'message' => BL::msg('Redirecting')), 'No longer authorized.'); } // get data $this->getData(); // get html $referrersHtml = $this->parseReferrers(); $keywordsHtml = $this->parseKeywords(); // return status $this->output(self::OK, array('status' => 'success', 'referrersHtml' => $referrersHtml, 'keywordsHtml' => $keywordsHtml, 'date' => BL::lbl('Today'), 'message' => BL::msg('RefreshedTrafficSources')), 'Data has been retrieved.'); }
/** * Load the datagrids * * @return void */ private function loadDataGrids() { // load all categories $categories = BackendFaqModel::getCategories(); // run over categories and create datagrid for each one foreach ($categories as $category) { // create datagrid $dataGrid = new BackendDataGridDB(BackendFaqModel::QRY_DATAGRID_BROWSE, array(BL::getWorkingLanguage(), $category['id'])); // set attributes $dataGrid->setAttributes(array('class' => 'dataGrid sequenceByDragAndDrop')); // disable paging $dataGrid->setPaging(false); // set colum URLs $dataGrid->setColumnURL('question', BackendModel::createURLForAction('edit') . '&id=[id]'); // set colums hidden $dataGrid->setColumnsHidden(array('category_id', 'sequence')); // add edit column $dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit') . '&id=[id]', BL::lbl('Edit')); // add a column for the handle, so users have something to hold while draging $dataGrid->addColumn('dragAndDropHandle', null, '<span>' . BL::lbl('Move') . '</span>'); // make sure the column with the handler is the first one $dataGrid->setColumnsSequence('dragAndDropHandle'); // add a class on the handler column, so JS knows this is just a handler $dataGrid->setColumnAttributes('dragAndDropHandle', array('class' => 'dragAndDropHandle')); // our JS needs to know an id, so we can send the new order $dataGrid->setRowAttributes(array('id' => '[id]')); // add datagrid to list $this->dataGrids[] = array('id' => $category['id'], 'name' => $category['name'], 'content' => $dataGrid->getContent()); } }
/** * Parse into template */ private function parse() { // get the logged in user $authenticatedUser = BackendAuthentication::getUser(); // check if we need to show the password strength and parse the label $this->tpl->assign('showPasswordStrength', $authenticatedUser->getSetting('password_strength') !== 'strong'); $this->tpl->assign('passwordStrengthLabel', BL::lbl($authenticatedUser->getSetting('password_strength'))); }
/** * Sets a link to the campaign statistics if it contains sent mailings * * @param int $id The ID of the campaign. * @return string */ public static function setStatisticsLink($id) { // build the link HTML $html = '<a href="' . BackendModel::createURLForAction('statistics_campaign') . '&id=' . $id . '" class="button icon iconStats linkButton"><span>' . BL::lbl('Statistics') . '</span></a>'; // check if this campaign has sent mailings $hasSentMailings = BackendMailmotorModel::existsSentMailingsByCampaignID($id) > 0 ? true : false; // return the result return $hasSentMailings ? $html : ''; }
/** * Load the datagrids * * @return void */ private function loadDataGrid() { // create datagrid $this->dataGrid = new BackendDataGridDB(BackendPagesModel::QRY_BROWSE_TEMPLATES, array($this->selectedTheme)); // set colum URLs $this->dataGrid->setColumnURL('title', BackendModel::createURLForAction('edit_template') . '&id=[id]'); // add edit column $this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit_template') . '&id=[id]', BL::lbl('Edit')); }
/** * Loads the settings form */ private function loadForm() { $this->frm = new BackendForm('settings'); // add map info (widgets) $this->frm->addDropdown('zoom_level_widget', array_combine(array_merge(array('auto'), range(3, 18)), array_merge(array(BL::lbl('Auto', $this->getModule())), range(3, 18))), BackendModel::getModuleSetting($this->URL->getModule(), 'zoom_level_widget', 13)); $this->frm->addText('width_widget', BackendModel::getModuleSetting($this->URL->getModule(), 'width_widget')); $this->frm->addText('height_widget', BackendModel::getModuleSetting($this->URL->getModule(), 'height_widget')); $this->frm->addDropdown('map_type_widget', array('ROADMAP' => BL::lbl('Roadmap', $this->getModule()), 'SATELLITE' => BL::lbl('Satellite', $this->getModule()), 'HYBRID' => BL::lbl('Hybrid', $this->getModule()), 'TERRAIN' => BL::lbl('Terrain', $this->getModule())), BackendModel::getModuleSetting($this->URL->getModule(), 'map_type_widget', 'roadmap')); }
/** * Load the datagrid */ public function loadDataGrid() { $this->dataGrid = new BackendDataGridDB(BackendGroupsModel::QRY_BROWSE); // check if this action is allowed if (BackendAuthentication::isAllowedAction('edit')) { $this->dataGrid->setColumnURL('name', BackendModel::createURLForAction('edit') . '&id=[id]'); $this->dataGrid->setColumnURL('num_users', BackendModel::createURLForAction('edit') . '&id=[id]#tabUsers'); $this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit') . '&id=[id]'); } }
/** * Load the datagrid * * @return void */ public function loadDataGrid() { // create datagrid with overview of groups $this->dataGrid = new BackendDataGridDB(BackendGroupsModel::QRY_BROWSE); // set collumn URLs $this->dataGrid->setColumnURL('name', BackendModel::createURLForAction('edit') . '&id=[id]'); $this->dataGrid->setColumnURL('num_users', BackendModel::createURLForAction('edit') . '&id=[id]#tabUsers'); // add edit column $this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit') . '&id=[id]'); }
/** * Load the datagrids */ private function loadDataGrid() { $this->dataGrid = new BackendDataGridDB(BackendContentBlocksModel::QRY_BROWSE, array('active', BL::getWorkingLanguage())); $this->dataGrid->setSortingColumns(array('title')); // check if this action is allowed if (BackendAuthentication::isAllowedAction('edit')) { $this->dataGrid->setColumnURL('title', BackendModel::createURLForAction('edit') . '&id=[id]'); $this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit') . '&id=[id]', BL::lbl('Edit')); } }
/** * Load the datagrid. * * @return void */ private function loadDataGrid() { // create datagrid with an overview of all active and undeleted users $this->dataGrid = new BackendDataGridDB(BackendUsersModel::QRY_BROWSE, array('N')); // add column $this->dataGrid->addColumn('nickname', ucfirst(BL::lbl('Nickname')), null, BackendModel::createURLForAction('edit') . '&id=[id]', BL::lbl('Edit')); // show the user's nickname $this->dataGrid->setColumnFunction(array('BackendUser', 'getSettingByUserId'), array('[id]', 'nickname'), 'nickname', false); // add edit column $this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit') . '&id=[id]'); }
/** * Loads the datagrid * * @return void */ private function loadDataGrid() { // create datagrid $this->dataGrid = new BackendDataGridDB(BackendLocationModel::QRY_DATAGRID_BROWSE, array(BL::getWorkingLanguage())); // sorting columns $this->dataGrid->setSortingColumns(array('address', 'title'), 'address'); $this->dataGrid->setSortParameter('ASC'); // set colum URLs $this->dataGrid->setColumnURL('title', BackendModel::createURLForAction('edit') . '&id=[id]'); // add edit column $this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit') . '&id=[id]', BL::lbl('Edit')); }
/** * Load the settings form */ protected function loadSettingsForm() { $mapTypes = array('ROADMAP' => BL::lbl('Roadmap', $this->getModule()), 'SATELLITE' => BL::lbl('Satellite', $this->getModule()), 'HYBRID' => BL::lbl('Hybrid', $this->getModule()), 'TERRAIN' => BL::lbl('Terrain', $this->getModule())); $zoomLevels = array_combine(array_merge(array('auto'), range(3, 18)), array_merge(array(BL::lbl('Auto', $this->getModule())), range(3, 18))); $this->form = new BackendForm('settings'); // add map info (overview map) $this->form->addHidden('map_id', 0); $this->form->addDropdown('zoom_level', $zoomLevels, $this->settings['zoom_level']); $this->form->addText('width', $this->settings['width']); $this->form->addText('height', $this->settings['height']); $this->form->addDropdown('map_type', $mapTypes, $this->settings['map_type']); }
/** * Load the datagrids */ private function loadDataGrid() { // create datagrid $this->dataGrid = new BackendDataGridDB(BackendExtensionsModel::QRY_BROWSE_TEMPLATES, array($this->selectedTheme)); // check if this action is allowed if (BackendAuthentication::isAllowedAction('edit_theme_template')) { // set colum URLs $this->dataGrid->setColumnURL('title', BackendModel::createURLForAction('edit_theme_template') . '&id=[id]'); // add edit column $this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit_theme_template') . '&id=[id]', BL::lbl('Edit')); } }
/** * Loads the datagrid * * @return void */ private function loadDataGrid() { // create datagrid $this->dataGrid = new BackendDataGridDB(BackendFaqModel::QRY_DATAGRID_BROWSE_CATEGORIES, BL::getWorkingLanguage()); // disable paging $this->dataGrid->setPaging(false); // enable drag and drop $this->dataGrid->enableSequenceByDragAndDrop(); // set column URLs $this->dataGrid->setColumnURL('name', BackendModel::createURLForAction('edit_category') . '&id=[id]'); // add edit column $this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit_category') . '&id=[id]', BL::lbl('Edit')); }
/** * Loads the datagrids * * @return void */ private function loadDataGrid() { // create datagrid $this->dataGrid = new BackendDataGridDB(BackendSearchModel::QRY_DATAGRID_BROWSE_SYNONYMS, BL::getWorkingLanguage()); // sorting columns $this->dataGrid->setSortingColumns(array('term'), 'term'); // column function $this->dataGrid->setColumnFunction('str_replace', array(',', ', ', '[synonym]'), 'synonym', true); // set colum URLs $this->dataGrid->setColumnURL('term', BackendModel::createURLForAction('edit_synonym') . '&id=[id]'); // add column $this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit_synonym') . '&id=[id]', BL::lbl('Edit')); }
/** * Load the form * * @return void */ private function loadForm() { // create form $this->frm = new BackendForm('add'); // set hidden values $rbtHiddenValues[] = array('label' => BL::lbl('Hidden', $this->URL->getModule()), 'value' => 'Y'); $rbtHiddenValues[] = array('label' => BL::lbl('Published'), 'value' => 'N'); // create elements $this->frm->addText('question')->setAttribute('id', 'title'); $this->frm->getField('question')->setAttribute('class', 'title ' . $this->frm->getField('question')->getAttribute('class')); $this->frm->addEditor('answer'); $this->frm->addDropdown('categories', $this->categories); $this->frm->addRadiobutton('hidden', $rbtHiddenValues, 'N'); }
/** * Get all active languages in a format usable by SpoonForm's addRadioButton * * @return array */ public static function getCheckboxValues() { $languages = BL::getActiveLanguages(); $results = array(); // stop here if no languages are present if (empty($languages)) { return array(); } // addRadioButton requires an array with keys 'value' and 'label' foreach ($languages as $abbreviation) { $results[] = array('value' => $abbreviation, 'label' => BL::lbl(strtoupper($abbreviation))); } return $results; }
/** * Load the data grid for installed modules. */ private function loadDataGridInstalled() { // create datagrid $this->dataGridInstalledModules = new BackendDataGridArray($this->installedModules); $this->dataGridInstalledModules->setSortingColumns(array('name')); $this->dataGridInstalledModules->setColumnsHidden(array('installed', 'raw_name', 'cronjobs_active')); // check if this action is allowed if (BackendAuthentication::isAllowedAction('detail_module')) { $this->dataGridInstalledModules->setColumnURL('name', BackendModel::createURLForAction('detail_module') . '&module=[raw_name]'); $this->dataGridInstalledModules->addColumn('details', null, BL::lbl('Details'), BackendModel::createURLForAction('detail_module') . '&module=[raw_name]', BL::lbl('Details')); } // add the greyed out option to modules that have warnings $this->dataGridInstalledModules->addColumn('hidden'); $this->dataGridInstalledModules->setColumnFunction(array('BackendExtensionsModel', 'hasModuleWarnings'), array('[raw_name]'), array('hidden')); }
/** * Load the form */ private function loadForm() { // get values for the form $rbtHiddenValues[] = array('label' => BL::lbl('Hidden'), 'value' => 'Y'); $rbtHiddenValues[] = array('label' => BL::lbl('Published'), 'value' => 'N'); $categories = BackendFaqModel::getCategories(); // create form $this->frm = new BackendForm('edit'); $this->frm->addText('title', $this->record['question'], null, 'inputText title', 'inputTextError title'); $this->frm->addEditor('answer', $this->record['answer']); $this->frm->addRadiobutton('hidden', $rbtHiddenValues, $this->record['hidden']); $this->frm->addDropdown('category_id', $categories, $this->record['category_id']); $this->frm->addText('tags', BackendTagsModel::getTags($this->URL->getModule(), $this->record['id']), null, 'inputText tagBox', 'inputTextError tagBox'); $this->meta = new BackendMeta($this->frm, $this->record['meta_id'], 'title', true); }
/** * Parse into template * * @return void */ private function parse() { // init vars $maxYAxis = 2; $metrics = array('visitors', 'pageviews'); $graphData = array(); $startTimestamp = strtotime('-1 week -1 days', mktime(0, 0, 0)); $endTimestamp = mktime(0, 0, 0); // get dashboard data $dashboardData = BackendAnalyticsModel::getDashboardData($metrics, $startTimestamp, $endTimestamp, true); // there are some metrics if ($dashboardData !== false) { // loop metrics foreach ($metrics as $i => $metric) { // build graph data array $graphData[$i] = array(); $graphData[$i]['title'] = $metric; $graphData[$i]['label'] = ucfirst(BL::lbl(SpoonFilter::toCamelCase($metric))); $graphData[$i]['i'] = $i + 1; $graphData[$i]['data'] = array(); // loop metrics per day foreach ($dashboardData as $j => $data) { // cast SimpleXMLElement to array $data = (array) $data; // build array $graphData[$i]['data'][$j]['date'] = (int) $data['timestamp']; $graphData[$i]['data'][$j]['value'] = (string) $data[$metric]; } } } // loop the metrics foreach ($graphData as $metric) { // loop the data foreach ($metric['data'] as $data) { // get the maximum value if ((int) $data['value'] > $maxYAxis) { $maxYAxis = (int) $data['value']; } } } // parse $this->tpl->assign('analyticsRecentVisitsStartDate', $startTimestamp); $this->tpl->assign('analyticsRecentVisitsEndDate', $endTimestamp); $this->tpl->assign('analyticsMaxYAxis', $maxYAxis); $this->tpl->assign('analyticsMaxYAxis', $maxYAxis); $this->tpl->assign('analyticsTickInterval', $maxYAxis == 2 ? '1' : ''); $this->tpl->assign('analyticsGraphData', $graphData); }
/** * Parse the keywords datagrid */ private function parseKeywords() { $results = BackendAnalyticsModel::getRecentKeywords(); if (!empty($results)) { $dataGrid = new BackendDataGridArray($results); $dataGrid->setPaging(false); $dataGrid->setColumnsHidden('id', 'date'); // parse the datagrid $this->tpl->assign('dgAnalyticsKeywords', $dataGrid->getContent()); } // get date $date = isset($results[0]['date']) ? substr($results[0]['date'], 0, 10) : date('Y-m-d'); $timestamp = mktime(0, 0, 0, substr($date, 5, 2), substr($date, 8, 2), substr($date, 0, 4)); // assign date label $this->tpl->assign('analyticsTrafficSourcesDate', $date != date('Y-m-d') ? BackendModel::getUTCDate('d-m', $timestamp) : BL::lbl('Today')); }
/** * Loads the datagrids */ private function loadDataGrid() { // create datagrid $this->dataGrid = new BackendDataGridDB(BackendSearchModel::QRY_DATAGRID_BROWSE_STATISTICS, BL::getWorkingLanguage()); // hide column $this->dataGrid->setColumnsHidden('data'); // create column $this->dataGrid->addColumn('referrer', BL::lbl('Referrer')); // header labels $this->dataGrid->setHeaderLabels(array('time' => SpoonFilter::ucfirst(BL::lbl('SearchedOn')))); // set column function $this->dataGrid->setColumnFunction(array(__CLASS__, 'setReferrer'), '[data]', 'referrer'); $this->dataGrid->setColumnFunction(array('BackendDataGridFunctions', 'getLongDate'), array('[time]'), 'time', true); // sorting columns $this->dataGrid->setSortingColumns(array('time', 'term'), 'time'); $this->dataGrid->setSortParameter('desc'); }
/** * Load the form */ private function loadForm() { // create form $this->frm = new BackendForm('add'); // set hidden values $rbtHiddenValues[] = array('label' => BL::lbl('Hidden', $this->URL->getModule()), 'value' => 'Y'); $rbtHiddenValues[] = array('label' => BL::lbl('Published'), 'value' => 'N'); // get categories $categories = BackendFaqModel::getCategories(); // create elements $this->frm->addText('title', null, null, 'inputText title', 'inputTextError title'); $this->frm->addEditor('answer'); $this->frm->addRadiobutton('hidden', $rbtHiddenValues, 'N'); $this->frm->addDropdown('category_id', $categories); $this->frm->addText('tags', null, null, 'inputText tagBox', 'inputTextError tagBox'); // meta $this->meta = new BackendMeta($this->frm, null, 'title', true); }
/** * Loads the dataGrid */ private function loadDataGrid() { // create dataGrid $this->dataGrid = new BackendDataGridDB(BackendFaqModel::QRY_DATAGRID_BROWSE_CATEGORIES, BL::getWorkingLanguage()); $this->dataGrid->setHeaderLabels(array('num_items' => SpoonFilter::ucfirst(BL::lbl('Amount')))); $this->dataGrid->enableSequenceByDragAndDrop(); $this->dataGrid->setRowAttributes(array('id' => '[id]')); $this->dataGrid->setPaging(false); // check if this action is allowed if (BackendAuthentication::isAllowedAction('index')) { $this->dataGrid->setColumnFunction(array(__CLASS__, 'setClickableCount'), array('[num_items]', BackendModel::createURLForAction('index') . '&category=[id]'), 'num_items', true); } // check if this action is allowed if (BackendAuthentication::isAllowedAction('edit_category')) { $this->dataGrid->setColumnURL('title', BackendModel::createURLForAction('edit_category') . '&id=[id]'); $this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit_category') . '&id=[id]', BL::lbl('Edit')); } }