/**
  * 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());
     }
 }
Exemple #2
0
 /**
  * Parses the most important referrals
  */
 private function parseImportantReferrals()
 {
     $results = BackendAnalyticsModel::getTopReferrals($this->startTimestamp, $this->endTimestamp, 25);
     if (!empty($results)) {
         $dataGrid = new BackendDataGridArray($results);
         $dataGrid->setColumnsHidden(array('referral_long'));
         $dataGrid->setColumnURL('referral', 'http://[referral_long]', '[referral_long]');
         // set headers
         $dataGrid->setHeaderLabels(array('pageviews' => SpoonFilter::ucfirst(BL::lbl('Views')), 'pageviews_percentage' => '% ' . SpoonFilter::ucfirst(BL::lbl('Views'))));
         // parse the datagrid
         $this->tpl->assign('dgReferrers', $dataGrid->getContent());
     }
 }
Exemple #3
0
 /**
  * Load the datagrid
  */
 private function loadDataGrid()
 {
     // init var
     $items = array();
     // get modules
     $modules = BackendModel::getModules();
     // loop modules
     foreach ($modules as $module) {
         // check if their is a model-file
         if (SpoonFile::exists(BACKEND_MODULES_PATH . '/' . $module . '/engine/model.php')) {
             // require the model-file
             require_once BACKEND_MODULES_PATH . '/' . $module . '/engine/model.php';
             // build class name
             $className = SpoonFilter::toCamelCase('backend_' . $module . '_model');
             // check if the getByTag-method is available
             if (is_callable(array($className, 'getByTag'))) {
                 // make the call and get the item
                 $moduleItems = (array) call_user_func(array($className, 'getByTag'), $this->id);
                 // loop items
                 foreach ($moduleItems as $row) {
                     // check if needed fields are available
                     if (isset($row['url'], $row['name'], $row['module'])) {
                         // add
                         $items[] = array('module' => SpoonFilter::ucfirst(BL::lbl(SpoonFilter::toCamelCase($row['module']))), 'name' => $row['name'], 'url' => $row['url']);
                     }
                 }
             }
         }
     }
     // create datagrid
     $this->dgUsage = new BackendDataGridArray($items);
     $this->dgUsage->setPaging(false);
     $this->dgUsage->setColumnsHidden(array('url'));
     $this->dgUsage->setHeaderLabels(array('name' => SpoonFilter::ucfirst(BL::lbl('Title')), 'url' => ''));
     $this->dgUsage->setColumnURL('name', '[url]', SpoonFilter::ucfirst(BL::lbl('Edit')));
     $this->dgUsage->addColumn('edit', null, SpoonFilter::ucfirst(BL::lbl('Edit')), '[url]', BL::lbl('Edit'));
 }
 /**
  * Parse this page
  */
 protected function parse()
 {
     parent::parse();
     $results = BackendAnalyticsModel::getLandingPages($this->startTimestamp, $this->endTimestamp);
     if (!empty($results)) {
         $dataGrid = new BackendDataGridArray($results);
         $dataGrid->setColumnsHidden('start_date', 'end_date', 'updated_on', 'page_encoded');
         $dataGrid->setMassActionCheckboxes('checkbox', '[id]');
         // check if this action is allowed
         if (BackendAuthentication::isAllowedAction('detail_page', $this->getModule())) {
             $dataGrid->setColumnURL('page_path', BackendModel::createURLForAction('detail_page') . '&page=[page_encoded]');
         }
         // set headers
         $dataGrid->setHeaderLabels(array('page_path' => SpoonFilter::ucfirst(BL::lbl('Page'))));
         // 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());
     }
 }
Exemple #5
0
 /**
  * Parses the most important referrals
  *
  * @return	void
  */
 private function parseImportantReferrals()
 {
     // get results
     $results = BackendAnalyticsModel::getTopReferrals($this->startTimestamp, $this->endTimestamp, 25);
     // there are some results
     if (!empty($results)) {
         // get the datagrid
         $dataGrid = new BackendDataGridArray($results);
         // hide columns
         $dataGrid->setColumnsHidden(array('referral_long'));
         // set headers values
         $headers['pageviews'] = ucfirst(BL::lbl('Views'));
         $headers['pageviews_percentage'] = '% ' . ucfirst(BL::lbl('Views'));
         // set column url
         $dataGrid->setColumnURL('referral', 'http://[referral_long]', '[referral_long]');
         // set headers
         $dataGrid->setHeaderLabels($headers);
         // parse the datagrid
         $this->tpl->assign('dgReferrers', $dataGrid->getContent());
     }
 }
Exemple #6
0
 /**
  * Load the form
  *
  * @return	void
  */
 private function loadForm()
 {
     // create form
     $this->frm = new BackendForm('add');
     // widgets available?
     if (isset($this->widgets)) {
         // loop through widgets
         foreach ($this->widgets as $j => $widget) {
             // add widget checkboxes
             $widgetBoxes[$j]['checkbox'] = '<span>' . $this->frm->addCheckbox('widgets_' . $widget['label'])->parse() . '</span>';
             $widgetBoxes[$j]['widget'] = $widget['label'];
             $widgetBoxes[$j]['description'] = $widget['description'];
         }
     }
     // loop through modules
     foreach ($this->modules as $key => $module) {
         // add module label
         $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'] = '<span>' . $this->frm->addCheckbox('actions_' . $module['label'] . '_' . 'Group_' . ucfirst($action['group']))->parse() . '</span>';
                     $actionBoxes[$key]['actions'][$i]['action'] = 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'] = '<span>' . $this->frm->addCheckbox('actions_' . $module['label'] . '_' . $action['label'])->parse() . '</span>';
                 $actionBoxes[$key]['actions'][$i]['action'] = $action['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 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();
     }
     // create elements
     $this->frm->addText('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);
 }
Exemple #7
0
 /**
  * Parses the most important pages
  *
  * @return	void
  */
 private function parseImportantPages()
 {
     // get results
     $results = BackendAnalyticsModel::getTopPages($this->startTimestamp, $this->endTimestamp);
     // there are some results
     if (!empty($results)) {
         // get the datagrid
         $dataGrid = new BackendDataGridArray($results);
         // hide columns
         $dataGrid->setColumnHidden('page_encoded');
         // set headers values
         $headers['pageviews_percentage'] = '% ' . ucfirst(BL::lbl('Pageviews'));
         // set headers
         $dataGrid->setHeaderLabels($headers);
         // set url
         $dataGrid->setColumnURL('page', BackendModel::createURLForAction('detail_page') . '&amp;page=[page_encoded]');
         // parse the datagrid
         $this->tpl->assign('dgContent', $dataGrid->getContent());
     }
 }
Exemple #8
0
 /**
  * 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) {
                     // add to array
                     $selectedWidgets[$j] = $widget['value'];
                 }
                 // add widget checkboxes
                 $widgetBoxes[$j]['checkbox'] = '<span>' . $this->frm->addCheckbox('widgets_' . $widget['label'], isset($selectedWidgets[$j]) ? $selectedWidgets[$j] : null)->parse() . '</span>';
                 $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);
 }
Exemple #9
0
 /**
  * Parses the most important pages
  */
 private function parseImportantPages()
 {
     $results = BackendAnalyticsModel::getTopPages($this->startTimestamp, $this->endTimestamp);
     if (!empty($results)) {
         $dataGrid = new BackendDataGridArray($results);
         $dataGrid->setColumnHidden('page_encoded');
         // check if this action is allowed
         if (BackendAuthentication::isAllowedAction('detail_page', $this->getModule())) {
             $dataGrid->setColumnURL('page', BackendModel::createURLForAction('detail_page') . '&amp;page=[page_encoded]');
         }
         // set headers
         $dataGrid->setHeaderLabels(array('pageviews_percentage' => '% ' . SpoonFilter::ucfirst(BL::lbl('Pageviews'))));
         // parse the datagrid
         $this->tpl->assign('dgContent', $dataGrid->getContent());
     }
 }