public function createDashboard($name, $createDefault = false)
 {
     $url = preg_replace('/ +/', '-', trim($name));
     // Replace any spaces
     $url = preg_replace('/[^A-Za-z0-9.+_\\-]/', '', $url);
     // Replace non alphanumeric characters
     $url = strtolower($url);
     $existing = $this->getNamedDashboard($url);
     if ($existing) {
         return $existing;
     }
     $dashboard = new DashboardPage();
     $dashboard->URLSegment = $url;
     $dashboard->Title = trim($name);
     $dashboard->OwnerID = $this->owner->ID;
     $dashboard->write();
     if ($createDefault) {
         $defaults = Config::inst()->get('DashboardUser', 'default_dashlets');
         /* @deprecated Please use the default_layout */
         if (count($defaults)) {
             foreach ($defaults as $dbid => $dashlets) {
                 foreach ($dashlets as $type) {
                     if (class_exists($type)) {
                         $dashlet = new $type();
                         $db = $dashboard->getDashboard($dbid);
                         if ($db && $dashlet->canCreate()) {
                             $dashlet->ParentID = $db->ID;
                             $dashlet->write();
                         }
                     }
                 }
             }
         }
         $layout = Config::inst()->get('DashboardUser', 'default_layout');
         if (count($layout)) {
             foreach ($layout as $type => $properties) {
                 if (class_exists($type)) {
                     $dashlet = new $type();
                     /* @var $dashlet Dashlet */
                     $db = $dashboard->getDashboard(0);
                     if ($db && $dashlet->canCreate()) {
                         $dashlet->ParentID = $db->ID;
                         if (is_array($properties)) {
                             $dashlet->update($properties);
                         }
                         $dashlet->write();
                     }
                 }
             }
         }
         $dashboard = $this->getNamedDashboard($url);
         $this->owner->extend('updateCreatedDashboard', $dashboard);
     }
     return $dashboard;
 }
 public function createDashboard($name, $createDefault = false)
 {
     $url = preg_replace('/ +/', '-', trim($name));
     // Replace any spaces
     $url = preg_replace('/[^A-Za-z0-9.+_\\-]/', '', $url);
     // Replace non alphanumeric characters
     $url = strtolower($url);
     $existing = $this->getNamedDashboard($url);
     if ($existing) {
         return $existing;
     }
     $dashboard = new DashboardPage();
     $dashboard->URLSegment = $url;
     $dashboard->Title = trim($name);
     $dashboard->OwnerID = $this->owner->ID;
     $dashboard->write();
     if ($createDefault) {
         $currentStage = null;
         if (Widget::has_extension('Versioned')) {
             $currentStage = Versioned::current_stage();
             Versioned::reading_stage('Stage');
         }
         $layout = Config::inst()->get('DashboardUser', 'default_layout');
         if (count($layout)) {
             foreach ($layout as $type => $properties) {
                 if (class_exists($type)) {
                     $dashlet = $type::create();
                     /* @var $dashlet Dashlet */
                     $dashletColumn = isset($properties['DashletColumn']) ? $properties['DashletColumn'] : 0;
                     $db = $dashboard->getDashboard($dashletColumn);
                     if ($db && $dashlet->canCreate()) {
                         $dashlet->ParentID = $db->ID;
                         if (is_array($properties)) {
                             $dashlet->update($properties);
                         }
                         $dashlet->write();
                     }
                 }
             }
         }
         if ($currentStage) {
             Versioned::reading_stage($currentStage);
         }
         $dashboard = $this->getNamedDashboard($url);
         $this->owner->extend('updateCreatedDashboard', $dashboard);
     }
     return $dashboard;
 }
 public function Link($action = '')
 {
     if ($this->currentDashboard && $this->currentDashboard->URLSegment != 'main') {
         return $this->currentDashboard->Link($action);
     }
     return $this->dataRecord->Link($action);
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $allboards = DashboardPage::get()->restrict();
     $boards = array();
     foreach ($allboards as $board) {
         $boards[$board->ID] = $board->Title . ' ' . $board->Owner()->Title;
     }
     $fields->addFieldToTab('Root.Main', DropdownField::create('FixedDashboardID', 'Specific dashboard to show', $boards)->setEmptyString('-- none --'), 'Content');
     $fields->removeByName('Content');
     return $fields;
 }
Esempio n. 5
0
 function login_as($username, $password, $success = true)
 {
     $this->username = $username;
     $this->password = $password;
     list($type, $string) = $this->locators['submit button'];
     $e = $this->session->element($type, $string);
     $e->click();
     if ($success) {
         $p = new \DashboardPage($this->session);
         $p->wait_until_loaded();
         return $p;
     } else {
         $w = new \PHPWebDriver_WebDriverWait($this->session, 30, 0.5, array("locator" => $this->locators['errors']));
         $w->until(function ($session, $extra_arguments) {
             list($type, $string) = $extra_arguments['locator'];
             $e = $session->element($type, $string);
             return $e->displayed();
         });
         return $this;
     }
 }
$layout->skins["toplinks"] = "empty";
$layout->blocks["top"][] = "toplinks";
$layout->containers["hmenu"] = array();
$layout->container_properties["hmenu"] = array();
$layout->containers["hmenu"][] = array("name" => "hmenu", "block" => "menu_block", "substyle" => 1);
$layout->skins["hmenu"] = "hmenu";
$layout->blocks["top"][] = "hmenu";
$page_layouts["Stock_Dashboard_dashboard"] = $layout;
$layout->skinsparams = array();
$layout->skinsparams["empty"] = array("button" => "button1");
$layout->skinsparams["menu"] = array("button" => "button1");
$layout->skinsparams["hmenu"] = array("button" => "button1");
$layout->skinsparams["undermenu"] = array("button" => "button1");
$layout->skinsparams["fields"] = array("button" => "button1");
$layout->skinsparams["form"] = array("button" => "button1");
$layout->skinsparams["1"] = array("button" => "button1");
$layout->skinsparams["2"] = array("button" => "button1");
$layout->skinsparams["3"] = array("button" => "button1");
$xt = new Xtempl();
$id = postvalue("id");
$id = $id != "" ? $id : 1;
//array of params for classes
$params = array();
$params["id"] = $id;
$params["xt"] =& $xt;
$params["tName"] = $strTableName;
$params["pageType"] = PAGE_DASHBOARD;
$params["templatefile"] = GetTemplateName("Stock_Dashboard", "dashboard");
$pageObject = new DashboardPage($params);
$pageObject->init();
$pageObject->process();
Esempio n. 7
0
<?php

/**
Copyright 2011-2015 Nick Korbel

This file is part of Booked Scheduler.

Booked Scheduler is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Booked Scheduler is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Booked Scheduler.  If not, see <http://www.gnu.org/licenses/>.
*/
// Reporting E_NOTICE can be good too (to report uninitialized
// variables or catch variable name misspellings ...)
define('ROOT_DIR', '../');
require_once ROOT_DIR . 'Pages/DashboardPage.php';
$page = new DashboardPage();
$page->PageLoad();
Esempio n. 8
0
        $this->SetShowTopPageNavigator(false);
        $this->SetShowBottomPageNavigator(false);
        //
        // Http Handlers
        //
        return $result;
    }
    public function OpenAdvancedSearchByDefault()
    {
        return false;
    }
    protected function DoGetGridHeader()
    {
        return '';
    }
}
SetUpUserAuthorization(GetApplication());
try {
    $Page = new DashboardPage("Dashboard.php", "Dashboard", GetCurrentUserGrantForDataSource("Dashboard"), 'UTF-8');
    $Page->SetShortCaption('Dashboard');
    $Page->SetHeader(GetPagesHeader());
    $Page->SetFooter(GetPagesFooter());
    $Page->SetCaption('Dashboard');
    $Page->SetRecordPermission(GetCurrentUserRecordPermissionsForDataSource("Dashboard"));
    GetApplication()->SetEnableLessRunTimeCompile(GetEnableLessFilesRunTimeCompilation());
    GetApplication()->SetCanUserChangeOwnPassword(!function_exists('CanUserChangeOwnPassword') || CanUserChangeOwnPassword());
    GetApplication()->SetMainPage($Page);
    GetApplication()->Run();
} catch (Exception $e) {
    ShowErrorPage($e->getMessage());
}