/** * @return array|int * @throws Exception */ function gd_report_admin_page_new() { $datasource = gd_datasource_find($_GET['ds']); if ( !$datasource ) { return MENU_NOT_FOUND; } gd_datasource_set_active($datasource->name); if ( !gd_account_user_is_admin() && !gd_account_user_is_datasource_admin(null,gd_datasource_get_active()) ) { return MENU_ACCESS_DENIED; } drupal_add_library('gd_report_admin', 'GD_Admin_ReportSection_Builder'); if ( !empty($_GET['title']) ) { $report = new stdClass(); $report->title = check_plain($_GET['title']); } else { $report = null; } if ( !empty($_GET['dataset']) ) { $reportDataset = gd_data_controller_ui_metadata_get_dataset_ui_metadata($_GET['dataset']); } else { $reportDataset = null; } return gd_report_admin_page($report,$reportDataset); }
/** * @return array */ function gd_dashboard_admin_page_new() { $datasource = gd_datasource_find($_GET['ds']); if ( !$datasource ) { return MENU_NOT_FOUND; } gd_datasource_set_active($datasource->name); if ( !gd_account_user_is_admin() && !gd_account_user_is_datasource_admin(null,gd_datasource_get_active()) ) { return MENU_ACCESS_DENIED; } drupal_add_library('gd_dashboard_admin', 'GD_Admin_DashboardSection_Builder'); drupal_add_library('gd','datatables'); drupal_add_library('gd','highcharts'); drupal_add_js('sites/all/libraries/sparkline/jquery.sparkline.min.js'); return gd_dashboard_admin_page(); }
/** * @param $dashboardNode * @return array */ function gd_dashboard_build_page ( $dashboardNode ) { $event = new DefaultEvent(); gd_datasource_set_active(get_node_field_value($dashboardNode,'field_dashboard_datasource')); ob_start(); /** * Build current dashboard config */ $DashboardConfig = new GD_DashboardConfig($dashboardNode,$_GET); drupal_add_library('gd_dashboard', 'GD_Dashboard_View'); print '<div id="dashboard-view" class="gd-container">'; // dashboard view echo '<div class="row">'; echo ' <div class="col-md-6">'; echo ' <h2>'.$dashboardNode->title.'</h2>'; if ( get_node_field_value($dashboardNode, 'field_dashboard_desc') ) { echo '<p>'.get_node_field_value($dashboardNode, 'field_dashboard_desc').'</p>'; } echo ' </div>'; echo ' <div class="col-md-6">'; echo '<div class="pull-right">'; // is not public if ( arg(0) != 'public' ) { $edit = false; if ( gd_account_user_is_admin() || gd_account_user_is_datasource_admin(null,$DashboardConfig->getDatasource()) ) { $edit = true; } if ($edit) { echo '<a role="button" type="button" id="editButton" tabindex="100" class="btn btn-default gd-dashboard-editbtn" href="/cp/dashboard/'.$dashboardNode->nid.'">Edit</a>'; } } if ( gd_dashboard_get_setting('export') && $DashboardConfig->isExportable() ) { echo ' <button role="button" type="button" id="exportButton" tabindex="100" class="btn btn-default gd-dashboard-exportbtn" data-dashboard="'.$dashboardNode->nid.'">Export</button>'; } echo '</div>'; echo ' </div>'; echo '</div>'; $options = array(); if ( $DashboardConfig->isPublic() && arg(0) == 'public' ) { $options['public'] = TRUE; drupal_add_http_header('Cache-Control','no-transform,public,max-age=3600,s-maxage=3600'); drupal_add_http_header('Expires',gmdate('D, d M Y H:i:s \G\M\T', time() + 3600)); } $configView = new GD_DashboardView($DashboardConfig); print $configView->getView($options); print '</div>'; $DashboardConfig->attachRequiredLibs(); // must be called after building view, or libs won't be set yet $page = array( '#show_messages' => false, '#theme' => 'page', '#type' => 'page', 'content' => array( 'system_main' => array( '#markup' => ob_get_clean() ) ), 'post_header' => array( '#markup' => '' ), 'pre_content' => array( '#markup' => '' ) ); if (isset($dashboardNode->nid)) { $event->type = 1; // see gd_health_monitoring_database_install() for more details $event->owner = $dashboardNode->nid; EventRecorderFactory::getInstance()->record($event); } return $page; }
* You should have received a copy of the GNU General Public License * along with GovDashboard. If not, see <http://www.gnu.org/licenses/>. */ if ( isset($_GET['datasource']) ) { $datasourceName = $_REQUEST['datasource']; } if ( isset($_POST['datasourceName']) ) { $datasourceName = $_POST['datasourceName']; } gd_datasource_set_active($datasourceName); if ( !gd_account_user_is_admin() && !gd_account_user_is_datasource_admin(null,gd_datasource_get_active()) ) { echo "<h3>Access Denied</h3>"; drupal_exit(); } $datasource = gd_datasource_get($datasourceName); $deleteWarningMessage = "Are you sure you want to delete \'".($datasource->publicName)."\'? ". "This will delete all the associated Dashboards, Reports and Datasets from that topic. ". "This action cannot be undone."; if ( isset($_POST['editdatamart']) && $_POST['editdatamart'] == "yes" ) { $errors = array();
public function canEdit () { if ( gd_account_user_is_admin() || gd_account_user_is_datasource_admin(null,$this->getDatasource()) ) { return true; } return false; }